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
|
@@ -7,13 +7,20 @@
|
|
|
7
7
|
import Icon from '../Icon.svelte'
|
|
8
8
|
import { format_num } from '../labels'
|
|
9
9
|
import { sanitize_html } from '../sanitize'
|
|
10
|
+
import { escape_html } from '../utils'
|
|
10
11
|
import Histogram from '../plot/histogram/Histogram.svelte'
|
|
11
12
|
import type { Label, RowData } from '../table'
|
|
12
13
|
import HeatmapTable from '../table/HeatmapTable.svelte'
|
|
13
14
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
14
15
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity'
|
|
15
|
-
import type {
|
|
16
|
-
|
|
16
|
+
import type {
|
|
17
|
+
ConvexHullEntry,
|
|
18
|
+
EntryCategoryConfig,
|
|
19
|
+
PhaseArityField,
|
|
20
|
+
PhaseStats,
|
|
21
|
+
} from './types'
|
|
22
|
+
import { MAGNETIC_ORDERING_CATEGORY } from './types'
|
|
23
|
+
import { get_arity, is_on_hull, visible_entries as filter_visible } from './helpers'
|
|
17
24
|
|
|
18
25
|
let {
|
|
19
26
|
phase_stats,
|
|
@@ -21,6 +28,8 @@
|
|
|
21
28
|
unstable_entries,
|
|
22
29
|
show_stable = true,
|
|
23
30
|
show_unstable = true,
|
|
31
|
+
entry_category = MAGNETIC_ORDERING_CATEGORY,
|
|
32
|
+
hidden_categories = [],
|
|
24
33
|
layout = `toggle`,
|
|
25
34
|
on_entry_click,
|
|
26
35
|
highlighted_entry_id,
|
|
@@ -35,6 +44,9 @@
|
|
|
35
44
|
unstable_entries: ConvexHullEntry[]
|
|
36
45
|
show_stable?: boolean
|
|
37
46
|
show_unstable?: boolean
|
|
47
|
+
// Categorical classification + hidden values (excluded from shown counts/table)
|
|
48
|
+
entry_category?: EntryCategoryConfig | null
|
|
49
|
+
hidden_categories?: string[]
|
|
38
50
|
// 'toggle' shows stats/table with toggle buttons (default)
|
|
39
51
|
// 'side-by-side' shows both stats and table next to each other without toggle
|
|
40
52
|
layout?: `toggle` | `side-by-side`
|
|
@@ -52,7 +64,6 @@
|
|
|
52
64
|
let view_mode = $state<`stats` | `table`>(`stats`)
|
|
53
65
|
// Formula filter: when set, table shows only entries with this reduced formula
|
|
54
66
|
let formula_filter = $state(``)
|
|
55
|
-
let show_export_dropdown = $state(false)
|
|
56
67
|
const table_scroll_height =
|
|
57
68
|
`var(--hull-stats-table-height, calc(var(--hull-stats-table-row-height, 2.35rem) * 10 + var(--hull-stats-table-header-height, 3.5rem)))`
|
|
58
69
|
const table_scroll_style = $derived(layout === `side-by-side`
|
|
@@ -86,10 +97,15 @@
|
|
|
86
97
|
|
|
87
98
|
// Shared concatenation of stable + unstable for histograms
|
|
88
99
|
let all_entries = $derived([...stable_entries, ...unstable_entries])
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
// show_stable/show_unstable respect the caller's partition; pass show flags as true
|
|
101
|
+
// so filter_visible only applies the category filter on top
|
|
102
|
+
let shown_entries = $derived(filter_visible(
|
|
103
|
+
[...(show_stable ? stable_entries : []), ...(show_unstable ? unstable_entries : [])],
|
|
104
|
+
true,
|
|
105
|
+
true,
|
|
106
|
+
entry_category,
|
|
107
|
+
hidden_categories,
|
|
108
|
+
))
|
|
93
109
|
|
|
94
110
|
// Static arity labels for phase breakdown display
|
|
95
111
|
const arity_types: [string, PhaseArityField, number][] = [
|
|
@@ -251,14 +267,6 @@
|
|
|
251
267
|
const sort_span = (sort_val: number | string, display: string, attrs = ``) =>
|
|
252
268
|
`<span data-sort-value="${sort_val}"${attrs ? ` ${attrs}` : ``}>${display}</span>`
|
|
253
269
|
|
|
254
|
-
// Escape HTML special chars to prevent XSS when rendering user-supplied strings via {@html}
|
|
255
|
-
const escape_html = (str: string): string =>
|
|
256
|
-
str
|
|
257
|
-
.replaceAll('&', `&`)
|
|
258
|
-
.replaceAll('<', `<`)
|
|
259
|
-
.replaceAll('>', `>`)
|
|
260
|
-
.replaceAll('"', `"`)
|
|
261
|
-
.replaceAll('\'', `'`)
|
|
262
270
|
const unescape_html = (str: string, max_rounds = 5): string => {
|
|
263
271
|
let decoded = str
|
|
264
272
|
for (let round_idx = 0; round_idx < max_rounds; round_idx++) {
|
|
@@ -430,67 +438,11 @@
|
|
|
430
438
|
] satisfies Label[],
|
|
431
439
|
)
|
|
432
440
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return temp_el.textContent?.trim() ?? ``
|
|
439
|
-
}
|
|
440
|
-
const csv_escape = (val: string): string =>
|
|
441
|
-
/[",\n]/.test(val) ? `"${val.replaceAll(`"`, `""`)}"` : val
|
|
442
|
-
const get_export_filename = (format: `csv` | `json`): string => {
|
|
443
|
-
const system = (phase_stats?.chemical_system ?? `convex-hull-stats`)
|
|
444
|
-
.toLowerCase()
|
|
445
|
-
.replaceAll(/\s+/g, `-`)
|
|
446
|
-
return `${system}.${format}`
|
|
447
|
-
}
|
|
448
|
-
const build_export_rows = () => {
|
|
449
|
-
const column_labels = table_columns.map((col) => col.label)
|
|
450
|
-
return table_data.map((row) =>
|
|
451
|
-
Object.fromEntries(
|
|
452
|
-
column_labels.map((label) => [html_to_text(label), html_to_text(row[label])]),
|
|
453
|
-
)
|
|
454
|
-
)
|
|
455
|
-
}
|
|
456
|
-
const download_file = (
|
|
457
|
-
content: string,
|
|
458
|
-
filename: string,
|
|
459
|
-
mime_type: string,
|
|
460
|
-
): void => {
|
|
461
|
-
const blob = new Blob([content], { type: mime_type })
|
|
462
|
-
const object_url = URL.createObjectURL(blob)
|
|
463
|
-
const link_el = document.createElement(`a`)
|
|
464
|
-
link_el.href = object_url
|
|
465
|
-
link_el.download = filename
|
|
466
|
-
document.body.append(link_el)
|
|
467
|
-
link_el.click()
|
|
468
|
-
link_el.remove()
|
|
469
|
-
URL.revokeObjectURL(object_url)
|
|
470
|
-
}
|
|
471
|
-
function export_table(format: `csv` | `json`): void {
|
|
472
|
-
const rows = build_export_rows()
|
|
473
|
-
if (format === `json`) {
|
|
474
|
-
download_file(
|
|
475
|
-
JSON.stringify(rows, null, 2),
|
|
476
|
-
get_export_filename(`json`),
|
|
477
|
-
`application/json;charset=utf-8`,
|
|
478
|
-
)
|
|
479
|
-
return
|
|
480
|
-
}
|
|
481
|
-
const headers = rows.length > 0 ? Object.keys(rows[0]) : []
|
|
482
|
-
const csv_lines = [
|
|
483
|
-
headers.map(csv_escape).join(`,`),
|
|
484
|
-
...rows.map((row) =>
|
|
485
|
-
headers.map((header) => csv_escape(row[header] ?? ``)).join(`,`)
|
|
486
|
-
),
|
|
487
|
-
]
|
|
488
|
-
download_file(
|
|
489
|
-
csv_lines.join(`\n`),
|
|
490
|
-
get_export_filename(`csv`),
|
|
491
|
-
`text/csv;charset=utf-8`,
|
|
492
|
-
)
|
|
493
|
-
}
|
|
441
|
+
// Filename for HeatmapTable's built-in CSV/JSON export
|
|
442
|
+
const export_filename = $derived(
|
|
443
|
+
phase_stats?.chemical_system?.toLowerCase().replaceAll(/\s+/g, `-`) ??
|
|
444
|
+
`convex-hull-stats`,
|
|
445
|
+
)
|
|
494
446
|
</script>
|
|
495
447
|
|
|
496
448
|
{#snippet stats_panel()}
|
|
@@ -617,39 +569,6 @@
|
|
|
617
569
|
</label>
|
|
618
570
|
{/if}
|
|
619
571
|
<span class="filter-count">{visible_entries.length} entries</span>
|
|
620
|
-
<span class="filter-spacer"></span>
|
|
621
|
-
<div class="export-actions">
|
|
622
|
-
<button
|
|
623
|
-
class="icon-btn"
|
|
624
|
-
class:active={show_export_dropdown}
|
|
625
|
-
title="Export"
|
|
626
|
-
onclick={() => show_export_dropdown = !show_export_dropdown}
|
|
627
|
-
>
|
|
628
|
-
<Icon icon="Export" style="width: 14px" />
|
|
629
|
-
</button>
|
|
630
|
-
{#if show_export_dropdown}
|
|
631
|
-
<div class="export-dropdown">
|
|
632
|
-
<button
|
|
633
|
-
class="dropdown-option"
|
|
634
|
-
onclick={() => {
|
|
635
|
-
export_table(`csv`)
|
|
636
|
-
show_export_dropdown = false
|
|
637
|
-
}}
|
|
638
|
-
>
|
|
639
|
-
<Icon icon="Download" style="width: 12px" /> CSV
|
|
640
|
-
</button>
|
|
641
|
-
<button
|
|
642
|
-
class="dropdown-option"
|
|
643
|
-
onclick={() => {
|
|
644
|
-
export_table(`json`)
|
|
645
|
-
show_export_dropdown = false
|
|
646
|
-
}}
|
|
647
|
-
>
|
|
648
|
-
<Icon icon="Download" style="width: 12px" /> JSON
|
|
649
|
-
</button>
|
|
650
|
-
</div>
|
|
651
|
-
{/if}
|
|
652
|
-
</div>
|
|
653
572
|
</div>
|
|
654
573
|
<HeatmapTable
|
|
655
574
|
data={table_data}
|
|
@@ -659,7 +578,7 @@
|
|
|
659
578
|
style="width: 100%"
|
|
660
579
|
root_style={table_root_style}
|
|
661
580
|
onrowclick={on_entry_click ? handle_row_click : undefined}
|
|
662
|
-
export_data={
|
|
581
|
+
export_data={{ filename: export_filename }}
|
|
663
582
|
/>
|
|
664
583
|
{/snippet}
|
|
665
584
|
|
|
@@ -826,64 +745,6 @@
|
|
|
826
745
|
font-size: inherit;
|
|
827
746
|
}
|
|
828
747
|
}
|
|
829
|
-
.filter-spacer {
|
|
830
|
-
flex: 1 1 auto;
|
|
831
|
-
}
|
|
832
|
-
.export-actions {
|
|
833
|
-
position: relative;
|
|
834
|
-
.icon-btn {
|
|
835
|
-
padding: 2pt 6pt;
|
|
836
|
-
border: 1px solid
|
|
837
|
-
var(--hull-stats-border-color, color-mix(in srgb, currentColor 20%, transparent));
|
|
838
|
-
border-radius: 3pt;
|
|
839
|
-
background: transparent;
|
|
840
|
-
color: inherit;
|
|
841
|
-
cursor: pointer;
|
|
842
|
-
display: inline-flex;
|
|
843
|
-
align-items: center;
|
|
844
|
-
justify-content: center;
|
|
845
|
-
}
|
|
846
|
-
.icon-btn:hover {
|
|
847
|
-
background: color-mix(in srgb, currentColor 8%, transparent);
|
|
848
|
-
}
|
|
849
|
-
.icon-btn.active {
|
|
850
|
-
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
.export-dropdown {
|
|
854
|
-
position: absolute;
|
|
855
|
-
right: 0;
|
|
856
|
-
top: calc(100% + 4px);
|
|
857
|
-
display: flex;
|
|
858
|
-
flex-direction: column;
|
|
859
|
-
min-width: 88px;
|
|
860
|
-
padding: 3pt;
|
|
861
|
-
border: 1px solid
|
|
862
|
-
var(--hull-stats-border-color, color-mix(in srgb, currentColor 20%, transparent));
|
|
863
|
-
border-radius: 4pt;
|
|
864
|
-
background: var(--page-bg, Canvas);
|
|
865
|
-
z-index: 4;
|
|
866
|
-
box-shadow: 0 2px 8px color-mix(in srgb, black 20%, transparent);
|
|
867
|
-
.dropdown-option {
|
|
868
|
-
display: inline-flex;
|
|
869
|
-
align-items: center;
|
|
870
|
-
gap: 5px;
|
|
871
|
-
border: none;
|
|
872
|
-
border-radius: 3pt;
|
|
873
|
-
background: transparent;
|
|
874
|
-
color: inherit;
|
|
875
|
-
cursor: pointer;
|
|
876
|
-
text-align: left;
|
|
877
|
-
padding: 3pt 6pt;
|
|
878
|
-
}
|
|
879
|
-
.dropdown-option:hover {
|
|
880
|
-
background: color-mix(in srgb, currentColor 8%, transparent);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
.table-pane :global(.control-buttons) {
|
|
884
|
-
display: none;
|
|
885
|
-
margin: 0;
|
|
886
|
-
}
|
|
887
748
|
.filter-count {
|
|
888
749
|
color: var(--text-color-muted, light-dark(#666, #bbb));
|
|
889
750
|
font-size: 0.9em;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
import type { ConvexHullEntry, PhaseStats } from './types';
|
|
2
|
+
import type { ConvexHullEntry, EntryCategoryConfig, PhaseStats } from './types';
|
|
3
3
|
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
phase_stats: PhaseStats | null;
|
|
5
5
|
stable_entries: ConvexHullEntry[];
|
|
6
6
|
unstable_entries: ConvexHullEntry[];
|
|
7
7
|
show_stable?: boolean;
|
|
8
8
|
show_unstable?: boolean;
|
|
9
|
+
entry_category?: EntryCategoryConfig | null;
|
|
10
|
+
hidden_categories?: string[];
|
|
9
11
|
layout?: `toggle` | `side-by-side`;
|
|
10
12
|
on_entry_click?: (entry: ConvexHullEntry) => void;
|
|
11
13
|
highlighted_entry_id?: string;
|
|
@@ -7,19 +7,22 @@
|
|
|
7
7
|
import { TooltipContent } from '../tooltip'
|
|
8
8
|
import type { PolymorphStats } from './helpers'
|
|
9
9
|
import type { ConvexHullTooltipProp, TooltipSnippetProps } from './index'
|
|
10
|
-
import type { HighlightStyle, PhaseData } from './types'
|
|
11
|
-
import {
|
|
10
|
+
import type { EntryCategoryConfig, HighlightStyle, PhaseData } from './types'
|
|
11
|
+
import { MAGNETIC_ORDERING_CATEGORY } from './types'
|
|
12
|
+
import { get_entry_category, is_unary_entry } from './helpers'
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
entry,
|
|
15
16
|
polymorph_stats_map,
|
|
16
17
|
highlight_style,
|
|
18
|
+
entry_category = MAGNETIC_ORDERING_CATEGORY,
|
|
17
19
|
tooltip,
|
|
18
20
|
show_fractional = true,
|
|
19
21
|
}: {
|
|
20
22
|
entry: EntryT
|
|
21
23
|
polymorph_stats_map?: Map<string, PolymorphStats>
|
|
22
24
|
highlight_style?: HighlightStyle
|
|
25
|
+
entry_category?: EntryCategoryConfig | null
|
|
23
26
|
tooltip?: ConvexHullTooltipProp<EntryT>
|
|
24
27
|
show_fractional?: boolean
|
|
25
28
|
} = $props()
|
|
@@ -36,6 +39,7 @@
|
|
|
36
39
|
? polymorph_stats_map.get(entry.entry_id)
|
|
37
40
|
: null,
|
|
38
41
|
)
|
|
42
|
+
const category_value = $derived(get_entry_category(entry, entry_category))
|
|
39
43
|
</script>
|
|
40
44
|
|
|
41
45
|
<TooltipContent
|
|
@@ -69,6 +73,11 @@
|
|
|
69
73
|
{#if entry.e_form_per_atom != null}
|
|
70
74
|
<div>E<sub>form</sub>: {format_num(entry.e_form_per_atom, `.3~`)} eV/atom</div>
|
|
71
75
|
{/if}
|
|
76
|
+
{#if entry_category && category_value}
|
|
77
|
+
<div title={entry_category.labels?.[category_value]}>
|
|
78
|
+
{entry_category.label}: {category_value}
|
|
79
|
+
</div>
|
|
80
|
+
{/if}
|
|
72
81
|
|
|
73
82
|
{#if show_fractional && !is_element}
|
|
74
83
|
{@const total = Object.values(entry.composition).reduce(
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { PolymorphStats } from './helpers';
|
|
2
2
|
import type { ConvexHullTooltipProp } from './index';
|
|
3
|
-
import type { HighlightStyle, PhaseData } from './types';
|
|
3
|
+
import type { EntryCategoryConfig, HighlightStyle, PhaseData } from './types';
|
|
4
4
|
declare function $$render<EntryT extends PhaseData = PhaseData>(): {
|
|
5
5
|
props: {
|
|
6
6
|
entry: EntryT;
|
|
7
7
|
polymorph_stats_map?: Map<string, PolymorphStats>;
|
|
8
8
|
highlight_style?: HighlightStyle;
|
|
9
|
+
entry_category?: EntryCategoryConfig | null;
|
|
9
10
|
tooltip?: ConvexHullTooltipProp<EntryT>;
|
|
10
11
|
show_fractional?: boolean;
|
|
11
12
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { ElementSymbol } from '../element';
|
|
2
|
-
import type { Point3D, Vec3 } from '../math';
|
|
2
|
+
import type { Point3D, Vec2, Vec3 } from '../math';
|
|
3
3
|
import type { ConvexHullEntry, PhaseData } from './types';
|
|
4
4
|
export declare const TRIANGLE_VERTICES: readonly [readonly [1, 0], readonly [0.5, number], readonly [0, 0]];
|
|
5
5
|
export declare function composition_to_barycentric_3d(composition: Record<string, number>, elements: ElementSymbol[]): Vec3;
|
|
6
|
-
export declare function barycentric_to_ternary_xy(barycentric: Vec3):
|
|
6
|
+
export declare function barycentric_to_ternary_xy(barycentric: Vec3): Vec2;
|
|
7
7
|
export declare function barycentric_to_ternary_xyz(barycentric: Vec3, formation_energy: number): Point3D;
|
|
8
8
|
export declare function get_triangle_centroid(): Point3D;
|
|
9
|
-
export declare function calculate_face_normal(p1: Point3D, p2: Point3D, p3: Point3D): Point3D;
|
|
10
|
-
export declare const calculate_face_centroid: (p1: Point3D, p2: Point3D, p3: Point3D) => Point3D;
|
|
11
9
|
export declare function get_ternary_3d_coordinates(entries: PhaseData[], elements: ElementSymbol[], el_refs?: Record<string, PhaseData>): ConvexHullEntry[];
|
|
12
10
|
export declare function get_triangle_edges(): [Point3D, Point3D][];
|
|
13
11
|
export declare function get_triangle_vertical_edges(min_z: number, max_z: number): [Point3D, Point3D][];
|
|
@@ -10,13 +10,7 @@ export function composition_to_barycentric_3d(composition, elements) {
|
|
|
10
10
|
if (elements.length !== 3) {
|
|
11
11
|
throw new Error(`Ternary system requires exactly 3 elements, got ${elements.length}`);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
const total = amounts.reduce((sum, amt) => sum + amt, 0);
|
|
15
|
-
if (total === 0) {
|
|
16
|
-
throw new Error(`Composition has no elements from the ternary system: ${elements.join(`-`)}`);
|
|
17
|
-
}
|
|
18
|
-
const normalized = amounts.map((amount) => amount / total);
|
|
19
|
-
return [normalized[0], normalized[1], normalized[2]];
|
|
13
|
+
return composition_to_barycentric_nd(composition, elements);
|
|
20
14
|
}
|
|
21
15
|
// map barycentric coordinates to triangular 2D coordinates
|
|
22
16
|
export function barycentric_to_ternary_xy(barycentric) {
|
|
@@ -37,22 +31,6 @@ export function get_triangle_centroid() {
|
|
|
37
31
|
const centroid_y = (v0[1] + v1[1] + v2[1]) / 3;
|
|
38
32
|
return { x: centroid_x, y: centroid_y, z: 0 };
|
|
39
33
|
}
|
|
40
|
-
export function calculate_face_normal(p1, p2, p3) {
|
|
41
|
-
const edge1 = { x: p2.x - p1.x, y: p2.y - p1.y, z: p2.z - p1.z };
|
|
42
|
-
const edge2 = { x: p3.x - p1.x, y: p3.y - p1.y, z: p3.z - p1.z };
|
|
43
|
-
const nx = edge1.y * edge2.z - edge1.z * edge2.y;
|
|
44
|
-
const ny = edge1.z * edge2.x - edge1.x * edge2.z;
|
|
45
|
-
const nz = edge1.x * edge2.y - edge1.y * edge2.x;
|
|
46
|
-
const magnitude = Math.hypot(nx, ny, nz);
|
|
47
|
-
if (magnitude === 0)
|
|
48
|
-
return { x: 0, y: 0, z: 1 };
|
|
49
|
-
return { x: nx / magnitude, y: ny / magnitude, z: nz / magnitude };
|
|
50
|
-
}
|
|
51
|
-
export const calculate_face_centroid = (p1, p2, p3) => ({
|
|
52
|
-
x: (p1.x + p2.x + p3.x) / 3,
|
|
53
|
-
y: (p1.y + p2.y + p3.y) / 3,
|
|
54
|
-
z: (p1.z + p2.z + p3.z) / 3,
|
|
55
|
-
});
|
|
56
34
|
export function get_ternary_3d_coordinates(entries, elements, el_refs) {
|
|
57
35
|
if (elements.length !== 3) {
|
|
58
36
|
throw new Error(`Ternary convex hull requires exactly 3 elements, got ${elements.length}`);
|
|
@@ -105,14 +83,14 @@ export function get_triangle_vertical_edges(min_z, max_z) {
|
|
|
105
83
|
{ ...vertex, z: max_z },
|
|
106
84
|
]);
|
|
107
85
|
}
|
|
108
|
-
// --- N-dimensional barycentric coordinates (
|
|
86
|
+
// --- N-dimensional barycentric coordinates (the 3D/4D converters wrap this) ---
|
|
109
87
|
// Convert composition to N-dimensional barycentric coordinates
|
|
110
88
|
// Returns array of length N where coords sum to 1 (all N coords are explicit)
|
|
111
89
|
// The last coordinate represents formation energy when used in hull calculations
|
|
112
90
|
export function composition_to_barycentric_nd(composition, elements) {
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
throw new Error(`Barycentric coordinates require at least 2 elements, got ${
|
|
91
|
+
const n_elems = elements.length;
|
|
92
|
+
if (n_elems < 2) {
|
|
93
|
+
throw new Error(`Barycentric coordinates require at least 2 elements, got ${n_elems}`);
|
|
116
94
|
}
|
|
117
95
|
// NaN and undefined/missing elements are treated as 0
|
|
118
96
|
const amounts = elements.map((el) => {
|
|
@@ -146,12 +124,7 @@ export function composition_to_barycentric_4d(composition, elements) {
|
|
|
146
124
|
if (elements.length !== 4) {
|
|
147
125
|
throw new Error(`Quaternary barycentric coordinates require exactly 4 elements`);
|
|
148
126
|
}
|
|
149
|
-
|
|
150
|
-
const total = amounts.reduce((sum, amount) => sum + amount, 0);
|
|
151
|
-
if (total === 0) {
|
|
152
|
-
throw new Error(`Composition has no elements from the quaternary system: ${elements.join(`-`)}`);
|
|
153
|
-
}
|
|
154
|
-
return amounts.map((amount) => amount / total);
|
|
127
|
+
return composition_to_barycentric_nd(composition, elements);
|
|
155
128
|
}
|
|
156
129
|
// map barycentric coordinates to tetrahedral 3D coordinates
|
|
157
130
|
export function barycentric_to_tetrahedral(barycentric) {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { AnyStructure } from '../structure';
|
|
2
|
+
import type { ConvexHullEntry, EntryCategoryConfig, HoverData3D, PhaseData } from './types';
|
|
3
|
+
export interface CanvasInteractionInputs {
|
|
4
|
+
wheel_clamp: [min: number, max: number];
|
|
5
|
+
fullscreen_bg_var: string;
|
|
6
|
+
canvas: () => HTMLCanvasElement | undefined;
|
|
7
|
+
wrapper: () => HTMLDivElement | undefined;
|
|
8
|
+
ctx: () => CanvasRenderingContext2D | null;
|
|
9
|
+
set_ctx: (ctx: CanvasRenderingContext2D | null) => void;
|
|
10
|
+
set_canvas_dims: (dims: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
scale: number;
|
|
14
|
+
}) => void;
|
|
15
|
+
visible_entries: () => ConvexHullEntry[];
|
|
16
|
+
plot_entries: () => ConvexHullEntry[];
|
|
17
|
+
selected_entry: () => ConvexHullEntry | null;
|
|
18
|
+
set_selected_entry: (entry: ConvexHullEntry | null) => void;
|
|
19
|
+
fullscreen: () => boolean;
|
|
20
|
+
enable_click_selection: () => boolean;
|
|
21
|
+
enable_structure_preview: () => boolean;
|
|
22
|
+
on_point_click: () => ((entry: ConvexHullEntry) => void) | undefined;
|
|
23
|
+
on_point_hover: () => ((data: HoverData3D | null) => void) | undefined;
|
|
24
|
+
on_file_drop: () => ((entries: PhaseData[]) => void) | undefined;
|
|
25
|
+
entry_category: () => EntryCategoryConfig | null;
|
|
26
|
+
zoom: () => number;
|
|
27
|
+
set_zoom: (zoom: number) => void;
|
|
28
|
+
project_point: (x: number, y: number, z: number) => {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
depth: number;
|
|
32
|
+
};
|
|
33
|
+
extract_structure: (entry: ConvexHullEntry) => AnyStructure | null;
|
|
34
|
+
render_frame: () => void;
|
|
35
|
+
on_drag: (dx: number, dy: number, panning: boolean) => void;
|
|
36
|
+
on_fullscreen_change: () => void;
|
|
37
|
+
actions: () => Record<string, () => void>;
|
|
38
|
+
}
|
|
39
|
+
export declare function create_canvas_interactions(inputs: CanvasInteractionInputs): {
|
|
40
|
+
readonly is_dragging: boolean;
|
|
41
|
+
readonly hover_data: HoverData3D<ConvexHullEntry> | null;
|
|
42
|
+
readonly drag_over: boolean;
|
|
43
|
+
readonly modal_open: boolean;
|
|
44
|
+
readonly selected_structure: AnyStructure | null;
|
|
45
|
+
readonly modal_place_right: boolean;
|
|
46
|
+
readonly sorted_points_cache: {
|
|
47
|
+
entry: ConvexHullEntry;
|
|
48
|
+
projected: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
depth: number;
|
|
52
|
+
};
|
|
53
|
+
}[];
|
|
54
|
+
copy_feedback: {
|
|
55
|
+
visible: boolean;
|
|
56
|
+
position: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
canvas_handlers: {
|
|
62
|
+
onmousedown: (event: MouseEvent) => void;
|
|
63
|
+
onmousemove: (event: MouseEvent) => void;
|
|
64
|
+
onclick: (event: MouseEvent) => void;
|
|
65
|
+
onkeydown: (event: KeyboardEvent) => void;
|
|
66
|
+
ondblclick: (event: MouseEvent) => void;
|
|
67
|
+
onwheel: (event: WheelEvent) => void;
|
|
68
|
+
};
|
|
69
|
+
wrapper_handlers: {
|
|
70
|
+
onkeydown: (event: KeyboardEvent) => void;
|
|
71
|
+
ondrop: (event: DragEvent) => Promise<void>;
|
|
72
|
+
ondragover: (event: DragEvent) => void;
|
|
73
|
+
ondragleave: (event: DragEvent) => void;
|
|
74
|
+
};
|
|
75
|
+
handle_mouse_move: (event: MouseEvent) => void;
|
|
76
|
+
handle_mouse_up: () => void;
|
|
77
|
+
close_structure_popup: () => void;
|
|
78
|
+
render_once: () => void;
|
|
79
|
+
};
|