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
package/dist/rdf/RdfPlot.svelte
CHANGED
|
@@ -1,120 +1,165 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 { PLOT_COLORS } from '../colors'
|
|
3
|
+
import { get_electro_neg_formula } from '../composition'
|
|
4
|
+
import { StatusMessage } from '../feedback'
|
|
5
|
+
import { create_file_drop_handler } from '../io'
|
|
6
|
+
import type { DataSeries } from '../plot'
|
|
7
|
+
import { ScatterPlot } from '../plot'
|
|
8
|
+
import type { Crystal, Pbc } from '../structure'
|
|
9
|
+
import { parse_any_structure } from '../structure/parse'
|
|
10
|
+
import { is_crystal } from '../structure/validation'
|
|
11
|
+
import type { ComponentProps, Snippet } from 'svelte'
|
|
12
|
+
import { calculate_all_pair_rdfs, calculate_rdf, type RdfEntry } from './index'
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
patterns,
|
|
16
|
+
structures,
|
|
17
|
+
mode = `element_pairs`,
|
|
18
|
+
show_reference_line = true,
|
|
19
|
+
x_axis = {},
|
|
20
|
+
y_axis = {},
|
|
21
|
+
cutoff = 15,
|
|
22
|
+
n_bins = 75,
|
|
23
|
+
pbc = [true, true, true],
|
|
24
|
+
enable_drop = false,
|
|
25
|
+
on_file_drop,
|
|
26
|
+
loading = $bindable(false),
|
|
27
|
+
error_msg = $bindable(),
|
|
28
|
+
children,
|
|
29
|
+
drag_dropped = $bindable([]),
|
|
30
|
+
dragging = $bindable(false),
|
|
31
|
+
...rest
|
|
32
|
+
}: {
|
|
33
|
+
patterns?: RdfEntry | RdfEntry[]
|
|
34
|
+
structures?: Crystal | Crystal[] | Record<string, Crystal>
|
|
35
|
+
mode?: `element_pairs` | `full`
|
|
36
|
+
show_reference_line?: boolean
|
|
37
|
+
x_axis?: ComponentProps<typeof ScatterPlot>[`x_axis`]
|
|
38
|
+
y_axis?: ComponentProps<typeof ScatterPlot>[`y_axis`]
|
|
39
|
+
cutoff?: number
|
|
40
|
+
n_bins?: number
|
|
41
|
+
pbc?: Pbc
|
|
42
|
+
enable_drop?: boolean
|
|
43
|
+
on_file_drop?: (content: string | ArrayBuffer, filename: string) => void
|
|
44
|
+
loading?: boolean
|
|
45
|
+
error_msg?: string
|
|
46
|
+
children?: Snippet<[{ drag_dropped: Crystal[] }]>
|
|
47
|
+
drag_dropped?: Crystal[]
|
|
48
|
+
dragging?: boolean
|
|
49
|
+
} & ComponentProps<typeof ScatterPlot> = $props()
|
|
50
|
+
|
|
51
|
+
function format_structure_label(struct: Crystal, label_base: string): string {
|
|
52
|
+
const formula = get_electro_neg_formula(struct)
|
|
53
|
+
return formula && label_base ? `${formula}: ${label_base}` : formula || label_base
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const compute_and_add = (content: string | ArrayBuffer, filename: string) => {
|
|
37
57
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
const text = content instanceof ArrayBuffer
|
|
59
|
+
? new TextDecoder().decode(content)
|
|
60
|
+
: content
|
|
61
|
+
const parsed_struct = parse_any_structure(text, filename)
|
|
62
|
+
if (is_crystal(parsed_struct)) {
|
|
63
|
+
drag_dropped = [...drag_dropped, parsed_struct]
|
|
64
|
+
} else {
|
|
65
|
+
error_msg = `Crystal has no lattice or sites; cannot compute RDF`
|
|
66
|
+
}
|
|
67
|
+
} catch (exc) {
|
|
68
|
+
error_msg = `Failed to process structure: ${
|
|
69
|
+
exc instanceof Error ? exc.message : String(exc)
|
|
70
|
+
}`
|
|
48
71
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const handle_drop = create_file_drop_handler({
|
|
75
|
+
allow: () => enable_drop,
|
|
76
|
+
on_drop: (content, filename) =>
|
|
77
|
+
(on_file_drop || compute_and_add)(content, filename),
|
|
78
|
+
on_error: (msg) => {
|
|
79
|
+
error_msg = msg
|
|
80
|
+
},
|
|
81
|
+
set_loading: (val) => {
|
|
82
|
+
loading = val
|
|
83
|
+
if (val) [error_msg, dragging] = [undefined, false]
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
function handle_dragover(ev: DragEvent) {
|
|
88
|
+
ev.preventDefault()
|
|
89
|
+
if (ev.dataTransfer) ev.dataTransfer.dropEffect = `copy`
|
|
90
|
+
dragging = true
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const entries = $derived.by(() => {
|
|
94
|
+
const result: RdfEntry[] = []
|
|
95
|
+
|
|
58
96
|
// Add patterns
|
|
59
97
|
if (patterns) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
else
|
|
63
|
-
result.push(patterns);
|
|
98
|
+
if (Array.isArray(patterns)) result.push(...patterns)
|
|
99
|
+
else result.push(patterns)
|
|
64
100
|
}
|
|
101
|
+
|
|
65
102
|
// Add structures
|
|
66
|
-
const struct_list = []
|
|
103
|
+
const struct_list: { struct: Crystal; label: string }[] = []
|
|
67
104
|
if (structures) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
if (Array.isArray(structures)) {
|
|
106
|
+
structures.forEach((struct, idx) =>
|
|
107
|
+
struct_list.push({
|
|
108
|
+
struct,
|
|
109
|
+
label: format_structure_label(struct, `Crystal ${idx + 1}`),
|
|
110
|
+
})
|
|
111
|
+
)
|
|
112
|
+
} else if (is_crystal(structures)) {
|
|
113
|
+
struct_list.push({
|
|
114
|
+
struct: structures,
|
|
115
|
+
label: format_structure_label(structures, ``),
|
|
116
|
+
})
|
|
117
|
+
} else {
|
|
118
|
+
Object.entries(structures).forEach(([label, struct]) =>
|
|
119
|
+
struct_list.push({ struct, label: format_structure_label(struct, label) })
|
|
120
|
+
)
|
|
121
|
+
}
|
|
83
122
|
}
|
|
84
|
-
drag_dropped.forEach((struct, idx) =>
|
|
123
|
+
drag_dropped.forEach((struct, idx) =>
|
|
124
|
+
struct_list.push({
|
|
85
125
|
struct,
|
|
86
126
|
label: format_structure_label(struct, `Dropped ${idx + 1}`),
|
|
87
|
-
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
|
|
88
130
|
for (const { struct, label } of struct_list) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
131
|
+
if (mode === `element_pairs`) {
|
|
132
|
+
const pairs = calculate_all_pair_rdfs(struct, { cutoff, n_bins, pbc })
|
|
133
|
+
result.push(...pairs.map((p) => ({
|
|
134
|
+
label: p.element_pair ? `${p.element_pair[0]}-${p.element_pair[1]}` : label,
|
|
135
|
+
legend_group: label, // Group by structure name for multi-structure plots
|
|
136
|
+
pattern: p,
|
|
137
|
+
})))
|
|
138
|
+
} else {
|
|
139
|
+
const pattern = calculate_rdf(struct, { cutoff, n_bins, pbc })
|
|
140
|
+
result.push({ label, pattern })
|
|
141
|
+
}
|
|
101
142
|
}
|
|
102
|
-
return result
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
143
|
+
return result
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
const max_r = $derived(Math.max(...entries.flatMap((e) => e.pattern.r), 0))
|
|
147
|
+
const max_g = $derived(Math.max(1.2, ...entries.flatMap((e) => e.pattern.g_r)))
|
|
148
|
+
|
|
149
|
+
const series = $derived<DataSeries[]>(
|
|
150
|
+
entries.map((ent, idx) => ({
|
|
151
|
+
x: ent.pattern.r,
|
|
152
|
+
y: ent.pattern.g_r,
|
|
153
|
+
label: ent.label,
|
|
154
|
+
legend_group: ent.legend_group,
|
|
155
|
+
visible: mode === `element_pairs` ? idx < 3 : true,
|
|
156
|
+
markers: `line` as const,
|
|
157
|
+
line_style: {
|
|
114
158
|
stroke: ent.color ?? PLOT_COLORS[idx % PLOT_COLORS.length],
|
|
115
159
|
stroke_width: 2,
|
|
116
|
-
|
|
117
|
-
}))
|
|
160
|
+
},
|
|
161
|
+
})),
|
|
162
|
+
)
|
|
118
163
|
</script>
|
|
119
164
|
|
|
120
165
|
<StatusMessage bind:message={error_msg} type="error" dismissible />
|
|
@@ -127,11 +172,20 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
127
172
|
{/if}
|
|
128
173
|
|
|
129
174
|
{#if series.length === 0}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
175
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
176
|
+
<div
|
|
177
|
+
class="empty-drop {dragging ? `dragging` : ``}"
|
|
178
|
+
ondragover={enable_drop ? handle_dragover : undefined}
|
|
179
|
+
ondragleave={enable_drop ? () => (dragging = false) : undefined}
|
|
180
|
+
ondrop={enable_drop ? handle_drop : undefined}
|
|
181
|
+
>
|
|
182
|
+
<StatusMessage
|
|
183
|
+
message={enable_drop
|
|
184
|
+
? `Drag and drop structure files here to visualize RDFs`
|
|
185
|
+
: `No RDF data to display`}
|
|
186
|
+
style="border: none"
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
135
189
|
{:else}
|
|
136
190
|
<ScatterPlot
|
|
137
191
|
{...rest}
|
|
@@ -139,15 +193,9 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
139
193
|
x_axis={{ label: `r (Å)`, range: [0, max_r], ...x_axis }}
|
|
140
194
|
y_axis={{ label: `g(r)`, range: [0, max_g * 1.05], ...y_axis }}
|
|
141
195
|
styles={{ show_lines: true, show_points: false }}
|
|
142
|
-
class={
|
|
196
|
+
class="{rest.class ?? ``} {dragging ? `dragging` : ``}"
|
|
143
197
|
style={rest.style ?? `height: 400px;`}
|
|
144
|
-
ondragover={enable_drop
|
|
145
|
-
? (ev) => {
|
|
146
|
-
ev.preventDefault()
|
|
147
|
-
if (ev.dataTransfer) ev.dataTransfer.dropEffect = `copy`
|
|
148
|
-
dragging = true
|
|
149
|
-
}
|
|
150
|
-
: undefined}
|
|
198
|
+
ondragover={enable_drop ? handle_dragover : undefined}
|
|
151
199
|
ondragleave={enable_drop ? () => (dragging = false) : undefined}
|
|
152
200
|
ondrop={enable_drop ? handle_drop : undefined}
|
|
153
201
|
>
|
|
@@ -155,22 +203,10 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
155
203
|
{#if show_reference_line}
|
|
156
204
|
{@const y1 = y_scale_fn(1)}
|
|
157
205
|
{#if isFinite(y1)}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
y2={y1}
|
|
163
|
-
stroke="gray"
|
|
164
|
-
stroke-dasharray="4"
|
|
165
|
-
opacity="0.5"
|
|
166
|
-
/>
|
|
167
|
-
<text
|
|
168
|
-
x={width - pad.r - 5}
|
|
169
|
-
y={y1 - 5}
|
|
170
|
-
text-anchor="end"
|
|
171
|
-
fill="gray"
|
|
172
|
-
font-size="0.8em"
|
|
173
|
-
>
|
|
206
|
+
{@const [x1, x2] = [pad.l, width - pad.r]}
|
|
207
|
+
{@const [x, y] = [width - pad.r - 5, y1 - 5]}
|
|
208
|
+
<line {x1} {x2} {y1} y2={y1} stroke="gray" stroke-dasharray="4" opacity="0.5" />
|
|
209
|
+
<text {x} {y} text-anchor="end" fill="gray" font-size="0.8em">
|
|
174
210
|
g(r) = 1
|
|
175
211
|
</text>
|
|
176
212
|
{/if}
|
|
@@ -186,6 +222,11 @@ const series = $derived(entries.map((ent, idx) => ({
|
|
|
186
222
|
outline: 2px dashed #4e79a7;
|
|
187
223
|
outline-offset: 4px;
|
|
188
224
|
}
|
|
225
|
+
.empty-drop {
|
|
226
|
+
outline: 2px dashed #ccc;
|
|
227
|
+
border-radius: var(--border-radius, 3pt);
|
|
228
|
+
text-align: center;
|
|
229
|
+
}
|
|
189
230
|
.dropped-info {
|
|
190
231
|
padding: 0.5em;
|
|
191
232
|
margin-bottom: 0.5em;
|
package/dist/rdf/calc-rdf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { calc_lattice_params,
|
|
1
|
+
import { calc_lattice_params, create_lattice_converters, euclidean_dist, pbc_dist, } from '../math';
|
|
2
2
|
import { make_supercell } from '../structure/supercell';
|
|
3
3
|
// Calculate radial distribution function
|
|
4
4
|
export function calculate_rdf(structure, options = {}) {
|
|
@@ -45,18 +45,17 @@ export function calculate_rdf(structure, options = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
// Calculate distances and bin them with occupancy weighting
|
|
47
47
|
const use_pbc = pbc.some((flag) => flag);
|
|
48
|
-
const
|
|
48
|
+
const converters = use_pbc ? create_lattice_converters(lattice) : undefined;
|
|
49
49
|
for (const center of centers) {
|
|
50
50
|
for (const neighbor of neighbors) {
|
|
51
51
|
if (center === neighbor)
|
|
52
52
|
continue;
|
|
53
53
|
const dist = use_pbc
|
|
54
|
-
? pbc_dist(center.xyz, neighbor.xyz, lattice,
|
|
54
|
+
? pbc_dist(center.xyz, neighbor.xyz, lattice, converters, pbc)
|
|
55
55
|
: euclidean_dist(center.xyz, neighbor.xyz);
|
|
56
56
|
if (dist > 0 && dist < cutoff) {
|
|
57
57
|
// Weight by product of occupancies for the species pair
|
|
58
|
-
const weight = get_occu(center, center_species) *
|
|
59
|
-
get_occu(neighbor, neighbor_species);
|
|
58
|
+
const weight = get_occu(center, center_species) * get_occu(neighbor, neighbor_species);
|
|
60
59
|
g_r[Math.min(Math.floor(dist / bin_size), n_bins - 1)] += weight;
|
|
61
60
|
}
|
|
62
61
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function sanitize_html(html: unknown): string;
|
|
2
|
+
export declare const sanitize_formula: (formula: string, use_subscripts?: boolean) => string;
|
|
3
|
+
export declare const sanitize_svg: (html: string) => string;
|
|
4
|
+
export declare const sanitize_icon_svg: (html: string) => string;
|
package/dist/sanitize.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
|
+
import { format_formula_html } from './phase-diagram/utils';
|
|
3
|
+
// SSR: provide a DOM for DOMPurify when no browser window exists (e.g. during vite build)
|
|
4
|
+
let ssr_window;
|
|
5
|
+
if (typeof globalThis.window === `undefined`) {
|
|
6
|
+
try {
|
|
7
|
+
const { Window } = await import(`happy-dom`);
|
|
8
|
+
ssr_window = new Window();
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// happy-dom not available at runtime — get_purify() will fall back to pass-through
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const SAFE_TAGS = [`a`, `b`, `i`, `em`, `strong`, `sub`, `sup`, `br`, `span`, `code`, `small`];
|
|
15
|
+
const SAFE_ATTRS = [`style`, `class`, `title`, `href`, `target`, `rel`];
|
|
16
|
+
// only allow safe CSS properties for text formatting
|
|
17
|
+
const SAFE_STYLE_RE = /^\s*(color|font-weight|font-style|font-size|text-decoration|vertical-align)\s*:/;
|
|
18
|
+
// Add a token to a space-separated string if not already present
|
|
19
|
+
const ensure_token = (value, token) => {
|
|
20
|
+
const tokens = new Set(value.split(/\s+/).filter(Boolean));
|
|
21
|
+
tokens.add(token);
|
|
22
|
+
return [...tokens].join(` `);
|
|
23
|
+
};
|
|
24
|
+
// undefined = not yet checked, null = no DOM available, instance = ready
|
|
25
|
+
let purify;
|
|
26
|
+
function get_purify() {
|
|
27
|
+
if (purify !== undefined)
|
|
28
|
+
return purify;
|
|
29
|
+
const instance = ssr_window
|
|
30
|
+
? DOMPurify(ssr_window)
|
|
31
|
+
: DOMPurify();
|
|
32
|
+
if (typeof instance.sanitize !== `function`) {
|
|
33
|
+
purify = null;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
purify = instance;
|
|
37
|
+
instance.addHook(`uponSanitizeAttribute`, (node, data) => {
|
|
38
|
+
if (data.attrName === `style`) {
|
|
39
|
+
const rules = data.attrValue.split(`;`).filter((rule) => SAFE_STYLE_RE.test(rule));
|
|
40
|
+
if (rules.length === 0)
|
|
41
|
+
data.keepAttr = false;
|
|
42
|
+
else
|
|
43
|
+
data.attrValue = rules.join(`;`);
|
|
44
|
+
}
|
|
45
|
+
// force rel="noopener" on links to prevent window.opener attacks
|
|
46
|
+
if (data.attrName === `href`) {
|
|
47
|
+
node.setAttribute(`rel`, ensure_token(node.getAttribute(`rel`) ?? ``, `noopener`));
|
|
48
|
+
}
|
|
49
|
+
if (data.attrName === `rel`) {
|
|
50
|
+
data.attrValue = ensure_token(data.attrValue, `noopener`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return instance;
|
|
54
|
+
}
|
|
55
|
+
// Wrap in <svg>, sanitize with allowlist, then unwrap. Required because DOMPurify
|
|
56
|
+
// needs the <svg> parent to parse children in the SVG namespace.
|
|
57
|
+
function sanitize_svg_content(html, allowed_tags, allowed_attrs) {
|
|
58
|
+
const dp = get_purify();
|
|
59
|
+
if (!dp)
|
|
60
|
+
return html;
|
|
61
|
+
const wrapped = dp.sanitize(`<svg>${html}</svg>`, {
|
|
62
|
+
ALLOWED_TAGS: [...allowed_tags, `svg`],
|
|
63
|
+
ALLOWED_ATTR: allowed_attrs,
|
|
64
|
+
});
|
|
65
|
+
const open_end = wrapped.indexOf(`>`);
|
|
66
|
+
const close_start = wrapped.lastIndexOf(`</svg>`);
|
|
67
|
+
if (open_end < 0 || close_start < 0)
|
|
68
|
+
return wrapped;
|
|
69
|
+
return wrapped.slice(open_end + 1, close_start);
|
|
70
|
+
}
|
|
71
|
+
// Sanitize HTML string, allowing only safe formatting tags and links.
|
|
72
|
+
// Two-pass: happy-dom promotes dangerous children when a non-allowed parent is
|
|
73
|
+
// stripped (e.g. <div><script>…</script></div> → <script>…</script>). The first
|
|
74
|
+
// pass explicitly removes dangerous tags so they can't survive promotion.
|
|
75
|
+
export function sanitize_html(html) {
|
|
76
|
+
const str = html == null ? `` : String(html);
|
|
77
|
+
const dp = get_purify();
|
|
78
|
+
if (!dp)
|
|
79
|
+
return str;
|
|
80
|
+
// oxfmt-ignore
|
|
81
|
+
const safe = dp.sanitize(str, { ADD_ATTR: [`target`], FORBID_TAGS: [
|
|
82
|
+
`script`, `style`, `iframe`, `object`, `embed`, `form`, `input`, `textarea`,
|
|
83
|
+
`select`, `button`, `meta`, `link`, `base`, `template`, `noscript`,
|
|
84
|
+
] });
|
|
85
|
+
return dp.sanitize(safe, { ALLOWED_TAGS: SAFE_TAGS, ALLOWED_ATTR: SAFE_ATTRS });
|
|
86
|
+
}
|
|
87
|
+
// Sanitize a chemical formula with optional subscript formatting
|
|
88
|
+
export const sanitize_formula = (formula, use_subscripts = true) => sanitize_html(format_formula_html(formula, use_subscripts));
|
|
89
|
+
const SVG_TEXT_TAGS = [`tspan`, `title`];
|
|
90
|
+
// oxfmt-ignore
|
|
91
|
+
const SVG_TEXT_ATTRS = [`dx`, `dy`, `x`, `y`, `fill`, `font-size`, `font-weight`, `baseline-shift`];
|
|
92
|
+
// Sanitize HTML intended for SVG text contexts (tspan, title)
|
|
93
|
+
export const sanitize_svg = (html) => sanitize_svg_content(html, SVG_TEXT_TAGS, SVG_TEXT_ATTRS);
|
|
94
|
+
// oxfmt-ignore
|
|
95
|
+
const SVG_ICON_TAGS = [
|
|
96
|
+
`path`, `circle`, `rect`, `line`, `polyline`, `polygon`, `g`, `ellipse`,
|
|
97
|
+
`clipPath`, `defs`, `mask`, `use`, `title`,
|
|
98
|
+
];
|
|
99
|
+
// oxfmt-ignore
|
|
100
|
+
const SVG_ICON_ATTRS = [
|
|
101
|
+
`d`, `fill`, `stroke`, `stroke-width`, `stroke-linecap`, `stroke-linejoin`,
|
|
102
|
+
`cx`, `cy`, `r`, `rx`, `ry`, `x`, `y`, `x1`, `y1`, `x2`, `y2`,
|
|
103
|
+
`width`, `height`, `viewBox`, `points`, `transform`, `opacity`,
|
|
104
|
+
`clip-path`, `clip-rule`, `fill-rule`, `id`, `class`,
|
|
105
|
+
];
|
|
106
|
+
// Sanitize inline SVG markup (path, circle, rect, etc.) for icon rendering
|
|
107
|
+
export const sanitize_icon_svg = (html) => sanitize_svg_content(html, SVG_ICON_TAGS, SVG_ICON_ATTRS);
|
package/dist/settings.d.ts
CHANGED
|
@@ -17,6 +17,13 @@ export interface SettingType<T = unknown> {
|
|
|
17
17
|
export declare const SHOW_BONDS_OPTIONS: readonly ["never", "always", "crystals", "molecules"];
|
|
18
18
|
export type ShowBonds = (typeof SHOW_BONDS_OPTIONS)[number];
|
|
19
19
|
export type CameraProjection = `perspective` | `orthographic`;
|
|
20
|
+
export declare const VECTOR_COLOR_MODES: readonly ["auto", "element", "spin_direction", "magnitude", "uniform"];
|
|
21
|
+
export type VectorColorMode = (typeof VECTOR_COLOR_MODES)[number];
|
|
22
|
+
export type VectorLayerConfig = {
|
|
23
|
+
visible: boolean;
|
|
24
|
+
color: string | null;
|
|
25
|
+
scale: number | null;
|
|
26
|
+
};
|
|
20
27
|
export declare const ATOM_COLOR_MODE_OPTIONS: readonly ["element", "coordination", "wyckoff", "custom"];
|
|
21
28
|
export type AtomColorMode = (typeof ATOM_COLOR_MODE_OPTIONS)[number];
|
|
22
29
|
type DisplayConfigType = {
|
|
@@ -50,6 +57,7 @@ type LineStyleType = {
|
|
|
50
57
|
type SimpleBarStyleType = {
|
|
51
58
|
color: SettingType<string>;
|
|
52
59
|
opacity: SettingType<number>;
|
|
60
|
+
border_radius: SettingType<number>;
|
|
53
61
|
};
|
|
54
62
|
type SimpleLineStyleType = {
|
|
55
63
|
width: SettingType<number>;
|
|
@@ -121,12 +129,17 @@ export interface SettingsConfig {
|
|
|
121
129
|
site_label_offset: SettingType<Vec3>;
|
|
122
130
|
ambient_light: SettingType<number>;
|
|
123
131
|
directional_light: SettingType<number>;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
vector_configs: SettingType<Record<string, VectorLayerConfig>>;
|
|
133
|
+
vector_scale: SettingType<number>;
|
|
134
|
+
vector_color: SettingType<string>;
|
|
135
|
+
vector_color_mode: SettingType<VectorColorMode>;
|
|
136
|
+
vector_color_scale: SettingType<D3InterpolateName>;
|
|
137
|
+
vector_normalize: SettingType<boolean>;
|
|
138
|
+
vector_uniform_thickness: SettingType<boolean>;
|
|
139
|
+
vector_origin_gap: SettingType<number>;
|
|
140
|
+
vector_shaft_radius: SettingType<number>;
|
|
141
|
+
vector_arrow_head_radius: SettingType<number>;
|
|
142
|
+
vector_arrow_head_length: SettingType<number>;
|
|
130
143
|
show_cell: SettingType<boolean>;
|
|
131
144
|
show_cell_vectors: SettingType<boolean>;
|
|
132
145
|
cell_edge_opacity: SettingType<number>;
|
|
@@ -178,9 +191,11 @@ export interface SettingsConfig {
|
|
|
178
191
|
show_x_zero_line: SettingType<boolean>;
|
|
179
192
|
show_y_zero_line: SettingType<boolean>;
|
|
180
193
|
show_x_grid: SettingType<boolean>;
|
|
194
|
+
show_x2_grid: SettingType<boolean>;
|
|
181
195
|
show_y_grid: SettingType<boolean>;
|
|
182
196
|
show_y2_grid: SettingType<boolean>;
|
|
183
197
|
x_format: SettingType<string>;
|
|
198
|
+
x2_format: SettingType<string>;
|
|
184
199
|
y_format: SettingType<string>;
|
|
185
200
|
y2_format: SettingType<string>;
|
|
186
201
|
x_scale_type: SettingType<string>;
|