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
|
@@ -41,7 +41,7 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & BasePlotProps & PlotCon
|
|
|
41
41
|
on_ref_line_hover?: (event: RefLineEvent | null) => void;
|
|
42
42
|
on_series_toggle?: (series_idx: number) => void;
|
|
43
43
|
data_loader?: DataLoaderFn;
|
|
44
|
-
on_axis_change?: (axis: `x` | `y` | `y2`, key: string, new_series: DataSeries[]) => void;
|
|
44
|
+
on_axis_change?: (axis: `x` | `x2` | `y` | `y2`, key: string, new_series: DataSeries[]) => void;
|
|
45
45
|
on_error?: (error: AxisLoadError) => void;
|
|
46
46
|
pan?: PanConfig;
|
|
47
47
|
};
|
|
@@ -1,12 +1,56 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// NOTE: Axis config objects must be reassigned (not mutated) to trigger $bindable reactivity.
|
|
3
|
+
import { SettingsSection } from '../layout'
|
|
4
|
+
import type { Vec2 } from '../math'
|
|
5
|
+
import type { BarStyle, DataSeries, PlotConfig } from './'
|
|
6
|
+
import { PlotControls } from './'
|
|
7
|
+
import type { PlotControlsProps } from './types'
|
|
8
|
+
import { DEFAULTS } from '../settings'
|
|
9
|
+
import type { Snippet } from 'svelte'
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
series = [],
|
|
13
|
+
bins = $bindable(DEFAULTS.histogram.bin_count),
|
|
14
|
+
mode = $bindable(DEFAULTS.histogram.mode),
|
|
15
|
+
bar = $bindable({}),
|
|
16
|
+
show_legend = $bindable(DEFAULTS.histogram.show_legend),
|
|
17
|
+
selected_property = $bindable(``),
|
|
18
|
+
x_axis = $bindable({}),
|
|
19
|
+
x2_axis = $bindable({}),
|
|
20
|
+
y_axis = $bindable({}),
|
|
21
|
+
y2_axis = $bindable({}),
|
|
22
|
+
display = $bindable({}),
|
|
23
|
+
show_controls = $bindable(false),
|
|
24
|
+
controls_open = $bindable(false),
|
|
25
|
+
auto_x2_range = undefined,
|
|
26
|
+
auto_y2_range = undefined,
|
|
27
|
+
has_x2_points = false,
|
|
28
|
+
has_y2_points = false,
|
|
29
|
+
children,
|
|
30
|
+
...rest
|
|
31
|
+
}: Omit<PlotControlsProps, `children` | `post_children`> & {
|
|
32
|
+
// Series data for multi-series controls
|
|
33
|
+
series?: readonly DataSeries[]
|
|
34
|
+
// Histogram-specific controls
|
|
35
|
+
bins?: number
|
|
36
|
+
mode?: `single` | `overlay`
|
|
37
|
+
bar?: BarStyle
|
|
38
|
+
show_legend?: boolean
|
|
39
|
+
selected_property?: string
|
|
40
|
+
show_controls?: boolean
|
|
41
|
+
controls_open?: boolean
|
|
42
|
+
auto_x2_range?: Vec2
|
|
43
|
+
auto_y2_range?: Vec2
|
|
44
|
+
has_x2_points?: boolean
|
|
45
|
+
has_y2_points?: boolean
|
|
46
|
+
children?: Snippet<[Required<PlotConfig>]>
|
|
47
|
+
} = $props()
|
|
48
|
+
|
|
49
|
+
bar = { ...DEFAULTS.histogram.bar, ...bar } // Initialize bar styles with defaults (runs once)
|
|
50
|
+
|
|
51
|
+
let has_multiple_series = $derived(series.filter(Boolean).length > 1)
|
|
52
|
+
let visible_series = $derived(series.filter((srs) => srs && (srs.visible ?? true)))
|
|
53
|
+
let series_options = $derived(visible_series.map((srs) => srs.label || `Series`))
|
|
10
54
|
</script>
|
|
11
55
|
|
|
12
56
|
<PlotControls
|
|
@@ -14,12 +58,14 @@ let series_options = $derived(visible_series.map((srs) => srs.label || `Series`)
|
|
|
14
58
|
bind:controls_open
|
|
15
59
|
bind:display
|
|
16
60
|
bind:x_axis
|
|
61
|
+
bind:x2_axis
|
|
17
62
|
bind:y_axis
|
|
18
63
|
bind:y2_axis
|
|
64
|
+
{auto_x2_range}
|
|
19
65
|
{auto_y2_range}
|
|
20
66
|
{...rest}
|
|
21
67
|
>
|
|
22
|
-
{@render children?.({ x_axis, y_axis, y2_axis, display })}
|
|
68
|
+
{@render children?.({ x_axis, x2_axis, y_axis, y2_axis, display })}
|
|
23
69
|
<SettingsSection
|
|
24
70
|
title="Histogram"
|
|
25
71
|
current_values={{ bins, mode, show_legend }}
|
|
@@ -113,8 +159,9 @@ let series_options = $derived(visible_series.map((srs) => srs.label || `Series`)
|
|
|
113
159
|
data-testid="scale-type-section"
|
|
114
160
|
current_values={{
|
|
115
161
|
x_scale_type: x_axis.scale_type,
|
|
162
|
+
...(has_x2_points ? { x2_scale_type: x2_axis.scale_type } : {}),
|
|
116
163
|
y_scale_type: y_axis.scale_type,
|
|
117
|
-
y2_scale_type: y2_axis.scale_type,
|
|
164
|
+
...(has_y2_points ? { y2_scale_type: y2_axis.scale_type } : {}),
|
|
118
165
|
}}
|
|
119
166
|
on_reset={() => {
|
|
120
167
|
x_axis = {
|
|
@@ -125,9 +172,17 @@ let series_options = $derived(visible_series.map((srs) => srs.label || `Series`)
|
|
|
125
172
|
...y_axis,
|
|
126
173
|
scale_type: DEFAULTS.plot.y_scale_type as `linear` | `log`,
|
|
127
174
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
175
|
+
if (has_x2_points) {
|
|
176
|
+
x2_axis = {
|
|
177
|
+
...x2_axis,
|
|
178
|
+
scale_type: DEFAULTS.plot.x_scale_type as `linear` | `log`,
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (has_y2_points) {
|
|
182
|
+
y2_axis = {
|
|
183
|
+
...y2_axis,
|
|
184
|
+
scale_type: DEFAULTS.plot.y_scale_type as `linear` | `log`,
|
|
185
|
+
}
|
|
131
186
|
}
|
|
132
187
|
}}
|
|
133
188
|
class="pane-grid"
|
|
@@ -137,13 +192,21 @@ let series_options = $derived(visible_series.map((srs) => srs.label || `Series`)
|
|
|
137
192
|
<option value="linear">Linear</option>
|
|
138
193
|
<option value="log">Log</option>
|
|
139
194
|
</select></label>
|
|
195
|
+
{#if has_x2_points}
|
|
196
|
+
<label>X2: <select bind:value={x2_axis.scale_type}>
|
|
197
|
+
<option value="linear">Linear</option>
|
|
198
|
+
<option value="log">Log</option>
|
|
199
|
+
</select></label>
|
|
200
|
+
{/if}
|
|
140
201
|
<label>Y: <select bind:value={y_axis.scale_type}>
|
|
141
202
|
<option value="linear">Linear</option>
|
|
142
203
|
<option value="log">Log</option>
|
|
143
204
|
</select></label>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
205
|
+
{#if has_y2_points}
|
|
206
|
+
<label>Y2: <select bind:value={y2_axis.scale_type}>
|
|
207
|
+
<option value="linear">Linear</option>
|
|
208
|
+
<option value="log">Log</option>
|
|
209
|
+
</select></label>
|
|
210
|
+
{/if}
|
|
148
211
|
</SettingsSection>
|
|
149
212
|
</PlotControls>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Vec2 } from '../math';
|
|
1
2
|
import type { BarStyle, DataSeries, PlotConfig } from './';
|
|
2
3
|
import type { PlotControlsProps } from './types';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
@@ -10,9 +11,12 @@ type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> &
|
|
|
10
11
|
selected_property?: string;
|
|
11
12
|
show_controls?: boolean;
|
|
12
13
|
controls_open?: boolean;
|
|
13
|
-
|
|
14
|
+
auto_x2_range?: Vec2;
|
|
15
|
+
auto_y2_range?: Vec2;
|
|
16
|
+
has_x2_points?: boolean;
|
|
17
|
+
has_y2_points?: boolean;
|
|
14
18
|
children?: Snippet<[Required<PlotConfig>]>;
|
|
15
19
|
};
|
|
16
|
-
declare const HistogramControls: import("svelte").Component<$$ComponentProps, {}, "display" | "mode" | "bins" | "show_legend" | "selected_property" | "show_controls" | "controls_open" | "x_axis" | "y_axis" | "bar" | "y2_axis">;
|
|
20
|
+
declare const HistogramControls: import("svelte").Component<$$ComponentProps, {}, "display" | "mode" | "bins" | "show_legend" | "selected_property" | "show_controls" | "controls_open" | "x_axis" | "y_axis" | "bar" | "x2_axis" | "y2_axis">;
|
|
17
21
|
type HistogramControls = ReturnType<typeof HistogramControls>;
|
|
18
22
|
export default HistogramControls;
|
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Spinner from '../feedback/Spinner.svelte'
|
|
3
|
+
import { sanitize_html } from '../sanitize'
|
|
4
|
+
import PortalSelect from './PortalSelect.svelte'
|
|
5
|
+
import type { AxisOption } from './types'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
label = ``,
|
|
9
|
+
options = undefined,
|
|
10
|
+
selected_key = $bindable(),
|
|
11
|
+
loading = $bindable(false),
|
|
12
|
+
axis_type = `x`,
|
|
13
|
+
color = $bindable(),
|
|
14
|
+
on_select,
|
|
15
|
+
...rest
|
|
16
|
+
}: {
|
|
17
|
+
label?: string
|
|
18
|
+
options?: AxisOption[]
|
|
19
|
+
selected_key?: string
|
|
20
|
+
loading?: boolean
|
|
21
|
+
axis_type?: `x` | `x2` | `y` | `y2`
|
|
22
|
+
color?: string | null
|
|
23
|
+
on_select?: (key: string) => void
|
|
24
|
+
[key: string]: unknown
|
|
25
|
+
} = $props()
|
|
26
|
+
|
|
27
|
+
let is_interactive = $derived(Boolean(options?.length))
|
|
28
|
+
|
|
29
|
+
const stop = (evt: Event) => evt.stopPropagation()
|
|
30
|
+
// Only stop propagation for keys the dropdown handles, allow Tab/Escape for navigation
|
|
31
|
+
const stop_key = (evt: KeyboardEvent) => {
|
|
32
|
+
if (![`Tab`, `Escape`].includes(evt.key)) evt.stopPropagation()
|
|
33
|
+
}
|
|
11
34
|
</script>
|
|
12
35
|
|
|
13
36
|
<div
|
|
@@ -36,7 +59,7 @@ const stop_key = (evt) => {
|
|
|
36
59
|
/>
|
|
37
60
|
{/if}
|
|
38
61
|
{:else}
|
|
39
|
-
<span class="static-label">{@html label}</span>
|
|
62
|
+
<span class="static-label">{@html sanitize_html(label)}</span>
|
|
40
63
|
{/if}
|
|
41
64
|
</div>
|
|
42
65
|
|
package/dist/plot/Line.svelte
CHANGED
|
@@ -1,36 +1,71 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TweenedOptions } from './'
|
|
3
|
+
import { DEFAULTS } from '../settings'
|
|
4
|
+
import { extent, min } from 'd3-array'
|
|
5
|
+
import { interpolatePath } from 'd3-interpolate-path'
|
|
6
|
+
import { curveMonotoneX, line } from 'd3-shape'
|
|
7
|
+
import { untrack } from 'svelte'
|
|
8
|
+
import { linear } from 'svelte/easing'
|
|
9
|
+
import type { SVGAttributes } from 'svelte/elements'
|
|
10
|
+
import { Tween } from 'svelte/motion'
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
points,
|
|
14
|
+
origin = [0, 0],
|
|
15
|
+
line_color = `rgba(255, 255, 255, 0.5)`,
|
|
16
|
+
line_width = 2,
|
|
17
|
+
area_color = `rgba(255, 255, 255, 0.1)`,
|
|
18
|
+
area_stroke = null,
|
|
19
|
+
line_tween = {},
|
|
20
|
+
line_dash = DEFAULTS.scatter.line.dash,
|
|
21
|
+
...rest
|
|
22
|
+
}: Omit<SVGAttributes<SVGPathElement>, `origin` | `points`> & {
|
|
23
|
+
points: readonly [number, number][]
|
|
24
|
+
origin: [number, number]
|
|
25
|
+
line_color?: string
|
|
26
|
+
line_width?: number
|
|
27
|
+
area_color?: string
|
|
28
|
+
area_stroke?: string | null
|
|
29
|
+
line_tween?: TweenedOptions<string>
|
|
30
|
+
line_dash?: string
|
|
31
|
+
} = $props()
|
|
32
|
+
|
|
33
|
+
const lineGenerator = line()
|
|
10
34
|
.x((point) => point[0])
|
|
11
35
|
.y((point) => point[1])
|
|
12
|
-
.curve(curveMonotoneX)
|
|
13
|
-
|
|
14
|
-
let
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
36
|
+
.curve(curveMonotoneX)
|
|
37
|
+
|
|
38
|
+
let [x_min, x_max] = $derived(extent(points.map((point) => point[0])))
|
|
39
|
+
let line_path = $derived(lineGenerator(points) ?? ``)
|
|
40
|
+
let ymin = $derived(origin[1] ?? min(points.map((point) => point[1])))
|
|
41
|
+
// Guard against NaN/Infinity in area_path coords (can happen during scale transitions)
|
|
42
|
+
let area_path = $derived(
|
|
43
|
+
line_path && isFinite(x_min ?? NaN) && isFinite(x_max ?? NaN) &&
|
|
44
|
+
isFinite(ymin ?? NaN)
|
|
45
|
+
? `${line_path}L${x_max},${ymin}L${x_min},${ymin}Z`
|
|
46
|
+
: ``,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const default_tween = {
|
|
22
50
|
duration: 300,
|
|
23
51
|
easing: linear,
|
|
24
52
|
interpolate: interpolatePath,
|
|
25
|
-
}
|
|
26
|
-
// Tween objects are stateful - create once, update target via effect
|
|
27
|
-
// untrack() explicitly captures initial tween config (intentional - config set once at mount)
|
|
28
|
-
const tweened_line = new Tween(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
}
|
|
54
|
+
// Tween objects are stateful - create once, update target via effect
|
|
55
|
+
// untrack() explicitly captures initial tween config (intentional - config set once at mount)
|
|
56
|
+
const tweened_line = new Tween(
|
|
57
|
+
``,
|
|
58
|
+
untrack(() => ({ ...default_tween, ...line_tween })),
|
|
59
|
+
)
|
|
60
|
+
const tweened_area = new Tween(
|
|
61
|
+
``,
|
|
62
|
+
untrack(() => ({ ...default_tween, ...line_tween })),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
$effect.pre(() => {
|
|
66
|
+
tweened_line.target = line_path
|
|
67
|
+
tweened_area.target = area_path
|
|
68
|
+
})
|
|
34
69
|
</script>
|
|
35
70
|
|
|
36
71
|
<path
|