matterviz 0.3.2 → 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.
Files changed (280) hide show
  1. package/dist/EmptyState.svelte +10 -2
  2. package/dist/FilePicker.svelte +123 -82
  3. package/dist/Icon.svelte +18 -12
  4. package/dist/MillerIndexInput.svelte +27 -21
  5. package/dist/api/optimade.js +6 -6
  6. package/dist/app.css +216 -207
  7. package/dist/brillouin/BrillouinZone.svelte +292 -149
  8. package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
  9. package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
  10. package/dist/brillouin/BrillouinZoneExportPane.svelte +69 -42
  11. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  12. package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
  13. package/dist/brillouin/BrillouinZoneScene.svelte +275 -163
  14. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
  15. package/dist/brillouin/BrillouinZoneTooltip.svelte +17 -7
  16. package/dist/brillouin/compute.js +11 -6
  17. package/dist/chempot-diagram/ChemPotDiagram.svelte +162 -27
  18. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +451 -281
  19. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +2148 -1642
  20. package/dist/chempot-diagram/ChemPotScene3D.svelte +8 -5
  21. package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
  22. package/dist/chempot-diagram/async-compute.svelte.js +77 -0
  23. package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
  24. package/dist/chempot-diagram/chempot-worker.js +11 -0
  25. package/dist/chempot-diagram/color.js +1 -2
  26. package/dist/chempot-diagram/compute.d.ts +10 -0
  27. package/dist/chempot-diagram/compute.js +250 -88
  28. package/dist/chempot-diagram/index.d.ts +2 -1
  29. package/dist/chempot-diagram/index.js +2 -1
  30. package/dist/chempot-diagram/temperature.js +8 -9
  31. package/dist/chempot-diagram/types.d.ts +3 -0
  32. package/dist/chempot-diagram/types.js +1 -0
  33. package/dist/colors/index.d.ts +1 -1
  34. package/dist/colors/index.js +5 -3
  35. package/dist/composition/BarChart.svelte +128 -55
  36. package/dist/composition/BubbleChart.svelte +102 -49
  37. package/dist/composition/Composition.svelte +100 -79
  38. package/dist/composition/Formula.svelte +108 -62
  39. package/dist/composition/FormulaFilter.svelte +665 -537
  40. package/dist/composition/PieChart.svelte +183 -108
  41. package/dist/composition/format.d.ts +5 -0
  42. package/dist/composition/format.js +20 -3
  43. package/dist/composition/parse.js +14 -9
  44. package/dist/convex-hull/ConvexHull.svelte +93 -40
  45. package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
  46. package/dist/convex-hull/ConvexHull2D.svelte +549 -360
  47. package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
  48. package/dist/convex-hull/ConvexHull3D.svelte +1296 -827
  49. package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
  50. package/dist/convex-hull/ConvexHull4D.svelte +1004 -688
  51. package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
  52. package/dist/convex-hull/ConvexHullControls.svelte +115 -28
  53. package/dist/convex-hull/ConvexHullControls.svelte.d.ts +1 -1
  54. package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
  55. package/dist/convex-hull/ConvexHullStats.svelte +425 -328
  56. package/dist/convex-hull/ConvexHullTooltip.svelte +40 -16
  57. package/dist/convex-hull/GasPressureControls.svelte +104 -61
  58. package/dist/convex-hull/StructurePopup.svelte +25 -4
  59. package/dist/convex-hull/TemperatureSlider.svelte +45 -25
  60. package/dist/convex-hull/barycentric-coords.js +13 -7
  61. package/dist/convex-hull/demo-temperature.js +8 -4
  62. package/dist/convex-hull/gas-thermodynamics.js +17 -12
  63. package/dist/convex-hull/helpers.d.ts +9 -0
  64. package/dist/convex-hull/helpers.js +77 -34
  65. package/dist/convex-hull/thermodynamics.js +61 -56
  66. package/dist/convex-hull/types.d.ts +9 -14
  67. package/dist/convex-hull/types.js +0 -17
  68. package/dist/coordination/CoordinationBarPlot.svelte +227 -154
  69. package/dist/element/BohrAtom.svelte +55 -12
  70. package/dist/element/ElementHeading.svelte +7 -2
  71. package/dist/element/ElementPhoto.svelte +15 -9
  72. package/dist/element/ElementStats.svelte +10 -4
  73. package/dist/element/ElementTile.svelte +137 -73
  74. package/dist/element/Nucleus.svelte +39 -11
  75. package/dist/feedback/ClickFeedback.svelte +16 -5
  76. package/dist/feedback/DragOverlay.svelte +10 -2
  77. package/dist/feedback/Spinner.svelte +4 -2
  78. package/dist/feedback/StatusMessage.svelte +8 -2
  79. package/dist/fermi-surface/FermiSlice.svelte +118 -88
  80. package/dist/fermi-surface/FermiSurface.svelte +328 -187
  81. package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
  82. package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
  83. package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
  84. package/dist/fermi-surface/FermiSurfaceScene.svelte +535 -342
  85. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
  86. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
  87. package/dist/fermi-surface/compute.js +16 -20
  88. package/dist/fermi-surface/parse.js +24 -14
  89. package/dist/fermi-surface/symmetry.js +2 -7
  90. package/dist/fermi-surface/types.d.ts +3 -5
  91. package/dist/heatmap-matrix/HeatmapMatrix.svelte +1019 -765
  92. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +1 -1
  93. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +76 -22
  94. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +2 -3
  95. package/dist/icons.js +47 -0
  96. package/dist/index.d.ts +2 -1
  97. package/dist/index.js +2 -1
  98. package/dist/io/decompress.js +1 -1
  99. package/dist/io/export.d.ts +3 -0
  100. package/dist/io/export.js +129 -143
  101. package/dist/io/is-binary.js +2 -3
  102. package/dist/io/url-drop.js +1 -2
  103. package/dist/isosurface/Isosurface.svelte +202 -148
  104. package/dist/isosurface/IsosurfaceControls.svelte +46 -28
  105. package/dist/isosurface/parse.js +34 -29
  106. package/dist/isosurface/slice.js +5 -10
  107. package/dist/isosurface/types.d.ts +2 -1
  108. package/dist/isosurface/types.js +61 -12
  109. package/dist/labels.js +11 -8
  110. package/dist/layout/FullscreenToggle.svelte +11 -2
  111. package/dist/layout/InfoCard.svelte +38 -6
  112. package/dist/layout/InfoTag.svelte +63 -32
  113. package/dist/layout/PropertyFilter.svelte +82 -37
  114. package/dist/layout/SettingsSection.svelte +85 -55
  115. package/dist/layout/SubpageGrid.svelte +10 -2
  116. package/dist/layout/json-tree/JsonNode.svelte +183 -138
  117. package/dist/layout/json-tree/JsonTree.svelte +499 -413
  118. package/dist/layout/json-tree/JsonValue.svelte +127 -99
  119. package/dist/layout/json-tree/utils.js +4 -2
  120. package/dist/marching-cubes.js +25 -2
  121. package/dist/math.d.ts +13 -17
  122. package/dist/math.js +133 -67
  123. package/dist/overlays/ContextMenu.svelte +65 -40
  124. package/dist/overlays/DraggablePane.svelte +211 -139
  125. package/dist/periodic-table/PeriodicTable.svelte +278 -145
  126. package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
  127. package/dist/periodic-table/PropertySelect.svelte +25 -7
  128. package/dist/periodic-table/TableInset.svelte +8 -3
  129. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +446 -309
  130. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
  131. package/dist/phase-diagram/PhaseDiagramControls.svelte +102 -43
  132. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
  133. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +63 -40
  134. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +71 -28
  135. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +1 -1
  136. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +158 -101
  137. package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
  138. package/dist/phase-diagram/build-diagram.js +9 -9
  139. package/dist/phase-diagram/colors.js +1 -3
  140. package/dist/phase-diagram/parse.js +10 -9
  141. package/dist/phase-diagram/svg-to-diagram.js +53 -49
  142. package/dist/phase-diagram/utils.d.ts +1 -0
  143. package/dist/phase-diagram/utils.js +80 -25
  144. package/dist/plot/AxisLabel.svelte +28 -3
  145. package/dist/plot/BarPlot.svelte +1182 -734
  146. package/dist/plot/BarPlot.svelte.d.ts +2 -2
  147. package/dist/plot/BarPlotControls.svelte +31 -5
  148. package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
  149. package/dist/plot/ColorBar.svelte +479 -329
  150. package/dist/plot/ColorScaleSelect.svelte +27 -6
  151. package/dist/plot/ElementScatter.svelte +36 -15
  152. package/dist/plot/FillArea.svelte +152 -95
  153. package/dist/plot/Histogram.svelte +934 -571
  154. package/dist/plot/Histogram.svelte.d.ts +1 -1
  155. package/dist/plot/HistogramControls.svelte +53 -9
  156. package/dist/plot/HistogramControls.svelte.d.ts +1 -1
  157. package/dist/plot/InteractiveAxisLabel.svelte +34 -11
  158. package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
  159. package/dist/plot/Line.svelte +63 -28
  160. package/dist/plot/PlotControls.svelte +157 -114
  161. package/dist/plot/PlotControls.svelte.d.ts +1 -1
  162. package/dist/plot/PlotLegend.svelte +174 -91
  163. package/dist/plot/PlotTooltip.svelte +45 -6
  164. package/dist/plot/PortalSelect.svelte +175 -147
  165. package/dist/plot/ReferenceLine.svelte +76 -22
  166. package/dist/plot/ReferenceLine3D.svelte +132 -107
  167. package/dist/plot/ReferencePlane.svelte +146 -121
  168. package/dist/plot/ScatterPlot.svelte +1681 -1091
  169. package/dist/plot/ScatterPlot.svelte.d.ts +2 -2
  170. package/dist/plot/ScatterPlot3D.svelte +256 -131
  171. package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
  172. package/dist/plot/ScatterPlot3DControls.svelte +113 -63
  173. package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
  174. package/dist/plot/ScatterPlot3DScene.svelte +608 -403
  175. package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
  176. package/dist/plot/ScatterPlotControls.svelte +65 -25
  177. package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
  178. package/dist/plot/ScatterPoint.svelte +98 -26
  179. package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
  180. package/dist/plot/SpacegroupBarPlot.svelte +142 -85
  181. package/dist/plot/Surface3D.svelte +159 -108
  182. package/dist/plot/ZeroLines.svelte +55 -3
  183. package/dist/plot/ZoomRect.svelte +4 -2
  184. package/dist/plot/axis-utils.js +1 -3
  185. package/dist/plot/data-cleaning.js +12 -28
  186. package/dist/plot/data-transform.js +2 -1
  187. package/dist/plot/fill-utils.js +2 -0
  188. package/dist/plot/layout.d.ts +4 -1
  189. package/dist/plot/layout.js +33 -14
  190. package/dist/plot/reference-line.d.ts +2 -2
  191. package/dist/plot/reference-line.js +7 -5
  192. package/dist/plot/scales.js +24 -36
  193. package/dist/plot/types.d.ts +11 -23
  194. package/dist/plot/types.js +6 -11
  195. package/dist/plot/utils/label-placement.d.ts +32 -15
  196. package/dist/plot/utils/label-placement.js +227 -66
  197. package/dist/plot/utils/series-visibility.js +2 -3
  198. package/dist/rdf/RdfPlot.svelte +143 -91
  199. package/dist/rdf/calc-rdf.js +4 -5
  200. package/dist/sanitize.d.ts +4 -0
  201. package/dist/sanitize.js +107 -0
  202. package/dist/settings.d.ts +18 -6
  203. package/dist/settings.js +46 -16
  204. package/dist/spectral/Bands.svelte +632 -453
  205. package/dist/spectral/BandsAndDos.svelte +90 -49
  206. package/dist/spectral/BrillouinBandsDos.svelte +151 -93
  207. package/dist/spectral/Dos.svelte +389 -258
  208. package/dist/spectral/helpers.js +55 -43
  209. package/dist/state.svelte.d.ts +1 -1
  210. package/dist/state.svelte.js +3 -2
  211. package/dist/structure/Arrow.svelte +59 -20
  212. package/dist/structure/AtomLegend.svelte +215 -134
  213. package/dist/structure/Bond.svelte +73 -47
  214. package/dist/structure/CanvasTooltip.svelte +10 -2
  215. package/dist/structure/CellSelect.svelte +72 -45
  216. package/dist/structure/Cylinder.svelte +33 -17
  217. package/dist/structure/Lattice.svelte +88 -33
  218. package/dist/structure/Structure.svelte +1063 -797
  219. package/dist/structure/Structure.svelte.d.ts +1 -1
  220. package/dist/structure/StructureControls.svelte +349 -118
  221. package/dist/structure/StructureExportPane.svelte +124 -89
  222. package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
  223. package/dist/structure/StructureInfoPane.svelte +304 -237
  224. package/dist/structure/StructureScene.svelte +879 -443
  225. package/dist/structure/StructureScene.svelte.d.ts +15 -7
  226. package/dist/structure/atom-properties.js +8 -8
  227. package/dist/structure/bonding.js +6 -7
  228. package/dist/structure/export.js +14 -29
  229. package/dist/structure/ferrox-wasm.js +1 -1
  230. package/dist/structure/index.d.ts +13 -3
  231. package/dist/structure/index.js +83 -23
  232. package/dist/structure/measure.d.ts +2 -2
  233. package/dist/structure/measure.js +4 -44
  234. package/dist/structure/parse.js +113 -141
  235. package/dist/structure/partial-occupancy.js +7 -10
  236. package/dist/structure/pbc.d.ts +1 -0
  237. package/dist/structure/pbc.js +16 -6
  238. package/dist/structure/supercell.d.ts +2 -2
  239. package/dist/structure/supercell.js +12 -22
  240. package/dist/structure/validation.js +1 -2
  241. package/dist/symmetry/SymmetryStats.svelte +84 -41
  242. package/dist/symmetry/WyckoffTable.svelte +26 -6
  243. package/dist/symmetry/cell-transform.js +5 -3
  244. package/dist/symmetry/index.js +8 -7
  245. package/dist/symmetry/spacegroups.js +148 -148
  246. package/dist/table/HeatmapTable.svelte +790 -554
  247. package/dist/table/HeatmapTable.svelte.d.ts +1 -1
  248. package/dist/table/ToggleMenu.svelte +125 -92
  249. package/dist/table/index.js +2 -4
  250. package/dist/theme/ThemeControl.svelte +21 -12
  251. package/dist/time.js +4 -1
  252. package/dist/tooltip/TooltipContent.svelte +33 -8
  253. package/dist/trajectory/Trajectory.svelte +758 -558
  254. package/dist/trajectory/TrajectoryError.svelte +14 -3
  255. package/dist/trajectory/TrajectoryExportPane.svelte +137 -83
  256. package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
  257. package/dist/trajectory/extract.js +10 -26
  258. package/dist/trajectory/format-detect.js +5 -5
  259. package/dist/trajectory/frame-reader.d.ts +1 -1
  260. package/dist/trajectory/frame-reader.js +5 -12
  261. package/dist/trajectory/helpers.d.ts +0 -1
  262. package/dist/trajectory/helpers.js +2 -17
  263. package/dist/trajectory/index.js +14 -12
  264. package/dist/trajectory/parse/ase.js +5 -4
  265. package/dist/trajectory/parse/hdf5.js +26 -18
  266. package/dist/trajectory/parse/index.js +13 -18
  267. package/dist/trajectory/parse/lammps.js +17 -7
  268. package/dist/trajectory/parse/vasp.js +5 -2
  269. package/dist/trajectory/parse/xyz.js +8 -7
  270. package/dist/trajectory/plotting.js +13 -8
  271. package/dist/utils.d.ts +1 -0
  272. package/dist/utils.js +13 -0
  273. package/dist/xrd/XrdPlot.svelte +337 -247
  274. package/dist/xrd/broadening.js +14 -9
  275. package/dist/xrd/calc-xrd.js +12 -18
  276. package/dist/xrd/parse.d.ts +1 -1
  277. package/dist/xrd/parse.js +17 -17
  278. package/package.json +99 -103
  279. package/readme.md +1 -1
  280. /package/dist/theme/{themes.js → themes.mjs} +0 -0
@@ -45,6 +45,6 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & BasePlotProps & PlotCon
45
45
  on_error?: (error: AxisLoadError) => void;
46
46
  pan?: PanConfig;
47
47
  };
48
- declare const Histogram: import("svelte").Component<$$ComponentProps, {}, "mode" | "series" | "show_controls" | "controls_open" | "fullscreen" | "bins" | "show_legend" | "selected_property" | "hovered" | "ref_lines">;
48
+ declare const Histogram: import("svelte").Component<$$ComponentProps, {}, "mode" | "fullscreen" | "series" | "bins" | "show_legend" | "selected_property" | "hovered" | "ref_lines" | "show_controls" | "controls_open">;
49
49
  type Histogram = ReturnType<typeof Histogram>;
50
50
  export default Histogram;
@@ -1,12 +1,56 @@
1
- <script lang="ts">// NOTE: Axis config objects must be reassigned (not mutated) to trigger $bindable reactivity.
2
- import { SettingsSection } from '../layout';
3
- import { PlotControls } from './';
4
- import { DEFAULTS } from '../settings';
5
- let { series = [], bins = $bindable(DEFAULTS.histogram.bin_count), mode = $bindable(DEFAULTS.histogram.mode), bar = $bindable({}), show_legend = $bindable(DEFAULTS.histogram.show_legend), selected_property = $bindable(``), x_axis = $bindable({}), x2_axis = $bindable({}), y_axis = $bindable({}), y2_axis = $bindable({}), display = $bindable({}), show_controls = $bindable(false), controls_open = $bindable(false), auto_x2_range = undefined, auto_y2_range = undefined, has_x2_points = false, has_y2_points = false, children, ...rest } = $props();
6
- bar = { ...DEFAULTS.histogram.bar, ...bar }; // Initialize bar styles with defaults (runs once)
7
- let has_multiple_series = $derived(series.filter(Boolean).length > 1);
8
- let visible_series = $derived(series.filter((srs) => srs && (srs.visible ?? true)));
9
- let series_options = $derived(visible_series.map((srs) => srs.label || `Series`));
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
@@ -17,6 +17,6 @@ type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> &
17
17
  has_y2_points?: boolean;
18
18
  children?: Snippet<[Required<PlotConfig>]>;
19
19
  };
20
- declare const HistogramControls: import("svelte").Component<$$ComponentProps, {}, "display" | "mode" | "bar" | "show_controls" | "controls_open" | "x_axis" | "x2_axis" | "y_axis" | "y2_axis" | "bins" | "show_legend" | "selected_property">;
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">;
21
21
  type HistogramControls = ReturnType<typeof HistogramControls>;
22
22
  export default HistogramControls;
@@ -1,13 +1,36 @@
1
- <script lang="ts">import Spinner from '../feedback/Spinner.svelte';
2
- import PortalSelect from './PortalSelect.svelte';
3
- let { label = ``, options = undefined, selected_key = $bindable(), loading = $bindable(false), axis_type = `x`, color = $bindable(), on_select, ...rest } = $props();
4
- let is_interactive = $derived(Boolean(options?.length));
5
- const stop = (evt) => evt.stopPropagation();
6
- // Only stop propagation for keys the dropdown handles, allow Tab/Escape for navigation
7
- const stop_key = (evt) => {
8
- if (![`Tab`, `Escape`].includes(evt.key))
9
- evt.stopPropagation();
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
 
@@ -9,6 +9,6 @@ type $$ComponentProps = {
9
9
  on_select?: (key: string) => void;
10
10
  [key: string]: unknown;
11
11
  };
12
- declare const InteractiveAxisLabel: import("svelte").Component<$$ComponentProps, {}, "color" | "selected_key" | "loading">;
12
+ declare const InteractiveAxisLabel: import("svelte").Component<$$ComponentProps, {}, "color" | "loading" | "selected_key">;
13
13
  type InteractiveAxisLabel = ReturnType<typeof InteractiveAxisLabel>;
14
14
  export default InteractiveAxisLabel;
@@ -1,36 +1,71 @@
1
- <script lang="ts">import { DEFAULTS } from '../settings';
2
- import { extent, min } from 'd3-array';
3
- import { interpolatePath } from 'd3-interpolate-path';
4
- import { curveMonotoneX, line } from 'd3-shape';
5
- import { untrack } from 'svelte';
6
- import { linear } from 'svelte/easing';
7
- import { Tween } from 'svelte/motion';
8
- let { points, origin = [0, 0], line_color = `rgba(255, 255, 255, 0.5)`, line_width = 2, area_color = `rgba(255, 255, 255, 0.1)`, area_stroke = null, line_tween = {}, line_dash = DEFAULTS.scatter.line.dash, ...rest } = $props();
9
- const lineGenerator = line()
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
- let [x_min, x_max] = $derived(extent(points.map((p) => p[0])));
14
- let line_path = $derived(lineGenerator(points) ?? ``);
15
- let ymin = $derived(origin[1] ?? min(points.map((p) => p[1])));
16
- // Guard against NaN/Infinity in area_path coords (can happen during scale transitions)
17
- let area_path = $derived(line_path && isFinite(x_min ?? NaN) && isFinite(x_max ?? NaN) &&
18
- isFinite(ymin ?? NaN)
19
- ? `${line_path}L${x_max},${ymin}L${x_min},${ymin}Z`
20
- : ``);
21
- const default_tween = {
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(``, untrack(() => ({ ...default_tween, ...line_tween })));
29
- const tweened_area = new Tween(``, untrack(() => ({ ...default_tween, ...line_tween })));
30
- $effect.pre(() => {
31
- tweened_line.target = line_path;
32
- tweened_area.target = area_path;
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
@@ -1,98 +1,141 @@
1
- <script lang="ts">// NOTE: Axis config objects (x_axis, x2_axis, y_axis, y2_axis) must be reassigned (not mutated)
2
- // to trigger $bindable reactivity propagation to parent components.
3
- // Pattern: `x_axis = { ...x_axis, prop: value }` instead of `x_axis.prop = value`
4
- import SettingsSection from '../layout/SettingsSection.svelte';
5
- import DraggablePane from '../overlays/DraggablePane.svelte';
6
- import { DEFAULTS } from '../settings';
7
- import { format } from 'd3-format';
8
- import { timeFormat } from 'd3-time-format';
9
- import { tooltip } from 'svelte-multiselect/attachments';
10
- import { normalize_y2_sync } from './interactions';
11
- import { get_scale_type_name, is_scale_type_name, is_y2_sync_mode } from './types';
12
- let { show_controls = $bindable(false), controls_open = $bindable(false), children, post_children, x_axis = $bindable({}), x2_axis = $bindable({}), y_axis = $bindable({}), y2_axis = $bindable({}), display = $bindable({}), auto_x_range = [0, 1], auto_x2_range = undefined, auto_y_range = [0, 1], auto_y2_range = undefined, has_x2_points = false, has_y2_points = false, show_ticks = false, controls_title = `plot`, controls_class = ``, toggle_props = {}, pane_props = {}, } = $props();
13
- // Range input state
14
- let range_inputs = $state({ x: [null, null], x2: [null, null], y: [null, null], y2: [null, null] });
15
- let range_els = $state({});
16
- // Check if an axis range spans zero (handles inverted ranges like [3.5, 1.4])
17
- const range_spans_zero = (lo, hi) => Math.min(lo, hi) <= 0 && Math.max(lo, hi) >= 0;
18
- let x_includes_zero = $derived(range_spans_zero(x_axis.range?.[0] ?? auto_x_range[0], x_axis.range?.[1] ?? auto_x_range[1]));
19
- let x2_includes_zero = $derived(has_x2_points && auto_x2_range != null &&
20
- range_spans_zero(x2_axis.range?.[0] ?? auto_x2_range[0], x2_axis.range?.[1] ?? auto_x2_range[1]));
21
- let y_includes_zero = $derived(range_spans_zero(y_axis.range?.[0] ?? auto_y_range[0], y_axis.range?.[1] ?? auto_y_range[1]));
22
- let y2_includes_zero = $derived(has_y2_points && auto_y2_range != null &&
23
- range_spans_zero(y2_axis.range?.[0] ?? auto_y2_range[0], y2_axis.range?.[1] ?? auto_y2_range[1]));
24
- // Validation function for format specifiers
25
- function is_valid_format(format_string) {
26
- if (!format_string)
27
- return true;
1
+ <script lang="ts">
2
+ // NOTE: Axis config objects (x_axis, x2_axis, y_axis, y2_axis) must be reassigned (not mutated)
3
+ // to trigger $bindable reactivity propagation to parent components.
4
+ // Pattern: `x_axis = { ...x_axis, prop: value }` instead of `x_axis.prop = value`
5
+ import SettingsSection from '../layout/SettingsSection.svelte'
6
+ import DraggablePane from '../overlays/DraggablePane.svelte'
7
+ import { DEFAULTS } from '../settings'
8
+ import { format } from 'd3-format'
9
+ import { timeFormat } from 'd3-time-format'
10
+ import { tooltip } from 'svelte-multiselect/attachments'
11
+ import type { Vec2 } from '../math'
12
+ import type { AxisKey, PlotControlsProps } from './index'
13
+ import { normalize_y2_sync } from './interactions'
14
+ import { get_scale_type_name, is_scale_type_name, is_y2_sync_mode } from './types'
15
+
16
+ let {
17
+ show_controls = $bindable(false),
18
+ controls_open = $bindable(false),
19
+ children,
20
+ post_children,
21
+ x_axis = $bindable({}),
22
+ x2_axis = $bindable({}),
23
+ y_axis = $bindable({}),
24
+ y2_axis = $bindable({}),
25
+ display = $bindable({}),
26
+ auto_x_range = [0, 1],
27
+ auto_x2_range = undefined,
28
+ auto_y_range = [0, 1],
29
+ auto_y2_range = undefined,
30
+ has_x2_points = false,
31
+ has_y2_points = false,
32
+ show_ticks = false,
33
+ controls_title = `plot`,
34
+ controls_class = ``,
35
+ toggle_props = {},
36
+ pane_props = {},
37
+ }: PlotControlsProps = $props()
38
+
39
+ // Range input state
40
+ let range_inputs: Record<AxisKey, [number | null, number | null]> = $state(
41
+ { x: [null, null], x2: [null, null], y: [null, null], y2: [null, null] },
42
+ )
43
+ let range_els = $state<Record<string, HTMLInputElement>>({})
44
+
45
+ // Check if an axis range spans zero (handles inverted ranges like [3.5, 1.4])
46
+ const range_spans_zero = (lo: number, hi: number): boolean =>
47
+ Math.min(lo, hi) <= 0 && Math.max(lo, hi) >= 0
48
+
49
+ let x_includes_zero = $derived(
50
+ range_spans_zero(
51
+ x_axis.range?.[0] ?? auto_x_range[0],
52
+ x_axis.range?.[1] ?? auto_x_range[1],
53
+ ),
54
+ )
55
+ let x2_includes_zero = $derived(
56
+ has_x2_points && auto_x2_range != null &&
57
+ range_spans_zero(
58
+ x2_axis.range?.[0] ?? auto_x2_range[0],
59
+ x2_axis.range?.[1] ?? auto_x2_range[1],
60
+ ),
61
+ )
62
+ let y_includes_zero = $derived(
63
+ range_spans_zero(
64
+ y_axis.range?.[0] ?? auto_y_range[0],
65
+ y_axis.range?.[1] ?? auto_y_range[1],
66
+ ),
67
+ )
68
+ let y2_includes_zero = $derived(
69
+ has_y2_points && auto_y2_range != null &&
70
+ range_spans_zero(
71
+ y2_axis.range?.[0] ?? auto_y2_range[0],
72
+ y2_axis.range?.[1] ?? auto_y2_range[1],
73
+ ),
74
+ )
75
+
76
+ // Validation function for format specifiers
77
+ function is_valid_format(format_string: string): boolean {
78
+ if (!format_string) return true
28
79
  try {
29
- if (format_string.startsWith(`%`)) {
30
- timeFormat(format_string)(new Date());
31
- return true;
32
- }
33
- else {
34
- format(format_string)(123.456);
35
- return true;
36
- }
37
- }
38
- catch {
39
- return false;
80
+ if (format_string.startsWith(`%`)) {
81
+ timeFormat(format_string)(new Date())
82
+ return true
83
+ } else {
84
+ format(format_string)(123.456)
85
+ return true
86
+ }
87
+ } catch {
88
+ return false
40
89
  }
41
- }
42
- // Handle format input changes
43
- const format_input_handler = (format_type) => (event) => {
44
- const input = event.target;
45
- if (!(input instanceof HTMLInputElement))
46
- return;
90
+ }
91
+
92
+ // Handle format input changes
93
+ const format_input_handler = (format_type: AxisKey) => (event: Event) => {
94
+ const input = event.target
95
+ if (!(input instanceof HTMLInputElement)) return
47
96
  if (!is_valid_format(input.value)) {
48
- input.classList.add(`invalid`);
49
- return;
97
+ input.classList.add(`invalid`)
98
+ return
50
99
  }
51
- input.classList.remove(`invalid`);
52
- if (format_type === `x`)
53
- x_axis = { ...x_axis, format: input.value };
54
- else if (format_type === `x2`)
55
- x2_axis = { ...x2_axis, format: input.value };
56
- else if (format_type === `y`)
57
- y_axis = { ...y_axis, format: input.value };
58
- else
59
- y2_axis = { ...y2_axis, format: input.value };
60
- };
61
- // Handle range input changes
62
- const update_range = (axis, bound, value) => {
63
- const parsed = value === `` ? null : Number(value);
64
- range_inputs[axis][bound] = Number.isFinite(parsed) ? parsed : null;
65
- const [min, max] = range_inputs[axis];
66
- const auto = { x: auto_x_range, x2: auto_x2_range, y: auto_y_range, y2: auto_y2_range }[axis];
67
- const invalid = min !== null && max !== null && min >= max;
68
- range_els[`${axis}-min`]?.classList.toggle(`invalid`, invalid);
69
- range_els[`${axis}-max`]?.classList.toggle(`invalid`, invalid);
70
- if (invalid)
71
- return;
72
- const axis_config = { x: x_axis, x2: x2_axis, y: y_axis, y2: y2_axis }[axis];
100
+ input.classList.remove(`invalid`)
101
+ if (format_type === `x`) x_axis = { ...x_axis, format: input.value }
102
+ else if (format_type === `x2`) x2_axis = { ...x2_axis, format: input.value }
103
+ else if (format_type === `y`) y_axis = { ...y_axis, format: input.value }
104
+ else y2_axis = { ...y2_axis, format: input.value }
105
+ }
106
+
107
+ // Handle range input changes
108
+ const update_range = (axis: AxisKey, bound: 0 | 1, value: string) => {
109
+ const parsed = value === `` ? null : Number(value)
110
+ range_inputs[axis][bound] = Number.isFinite(parsed) ? parsed : null
111
+ const [min, max] = range_inputs[axis]
112
+ const auto =
113
+ { x: auto_x_range, x2: auto_x2_range, y: auto_y_range, y2: auto_y2_range }[axis]
114
+ const invalid = min !== null && max !== null && min >= max
115
+ range_els[`${axis}-min`]?.classList.toggle(`invalid`, invalid)
116
+ range_els[`${axis}-max`]?.classList.toggle(`invalid`, invalid)
117
+ if (invalid) return
118
+ const axis_config = { x: x_axis, x2: x2_axis, y: y_axis, y2: y2_axis }[axis]
73
119
  const next_range = min === null && max === null
74
- ? undefined
75
- : [min ?? auto?.[0] ?? 0, max ?? auto?.[1] ?? 1];
120
+ ? undefined
121
+ : [min ?? auto?.[0] ?? 0, max ?? auto?.[1] ?? 1] as Vec2
76
122
  // If auto range is undefined, only set if both min and max are provided
77
- if (!auto && (min === null || max === null))
78
- return;
79
- if (axis === `x`)
80
- x_axis = { ...axis_config, range: next_range };
81
- else if (axis === `x2`)
82
- x2_axis = { ...axis_config, range: next_range };
83
- else if (axis === `y`)
84
- y_axis = { ...axis_config, range: next_range };
85
- else
86
- y2_axis = { ...axis_config, range: next_range };
87
- };
88
- // Sync range inputs from props
89
- $effect(() => {
90
- range_inputs.x = [x_axis.range?.[0] ?? null, x_axis.range?.[1] ?? null];
91
- range_inputs.x2 = [x2_axis.range?.[0] ?? null, x2_axis.range?.[1] ?? null];
92
- range_inputs.y = [y_axis.range?.[0] ?? null, y_axis.range?.[1] ?? null];
93
- range_inputs.y2 = [y2_axis.range?.[0] ?? null, y2_axis.range?.[1] ?? null];
94
- });
95
- let ctrl_state = $derived({
123
+ if (!auto && (min === null || max === null)) return
124
+ if (axis === `x`) x_axis = { ...axis_config, range: next_range }
125
+ else if (axis === `x2`) x2_axis = { ...axis_config, range: next_range }
126
+ else if (axis === `y`) y_axis = { ...axis_config, range: next_range }
127
+ else y2_axis = { ...axis_config, range: next_range }
128
+ }
129
+
130
+ // Sync range inputs from props
131
+ $effect(() => {
132
+ range_inputs.x = [x_axis.range?.[0] ?? null, x_axis.range?.[1] ?? null]
133
+ range_inputs.x2 = [x2_axis.range?.[0] ?? null, x2_axis.range?.[1] ?? null]
134
+ range_inputs.y = [y_axis.range?.[0] ?? null, y_axis.range?.[1] ?? null]
135
+ range_inputs.y2 = [y2_axis.range?.[0] ?? null, y2_axis.range?.[1] ?? null]
136
+ })
137
+
138
+ let ctrl_state = $derived({
96
139
  show_controls,
97
140
  controls_open,
98
141
  x_axis,
@@ -101,7 +144,7 @@ let ctrl_state = $derived({
101
144
  y2_axis,
102
145
  display,
103
146
  range_inputs,
104
- });
147
+ })
105
148
  </script>
106
149
 
107
150
  {#if show_controls}
@@ -215,16 +258,16 @@ let ctrl_state = $derived({
215
258
  bind:this={range_els[`${axis}-min`]}
216
259
  placeholder="auto"
217
260
  class="range-input"
218
- oninput={(e) => update_range(axis, 0, e.currentTarget.value)}
219
- onkeydown={(e) => e.key === `Enter` && e.currentTarget?.blur()}
261
+ oninput={(evt) => update_range(axis, 0, evt.currentTarget.value)}
262
+ onkeydown={(evt) => evt.key === `Enter` && evt.currentTarget?.blur()}
220
263
  /> to <input
221
264
  type="number"
222
265
  value={range_inputs[axis][1] ?? ``}
223
266
  bind:this={range_els[`${axis}-max`]}
224
267
  placeholder="auto"
225
268
  class="range-input"
226
- oninput={(e) => update_range(axis, 1, e.currentTarget.value)}
227
- onkeydown={(e) => e.key === `Enter` && e.currentTarget?.blur()}
269
+ oninput={(evt) => update_range(axis, 1, evt.currentTarget.value)}
270
+ onkeydown={(evt) => evt.key === `Enter` && evt.currentTarget?.blur()}
228
271
  />
229
272
  </label>
230
273
  {/each}
@@ -249,12 +292,12 @@ let ctrl_state = $derived({
249
292
  max={max_ticks}
250
293
  step="1"
251
294
  value={typeof x_axis.ticks === `number` ? x_axis.ticks : 8}
252
- oninput={(e) => {
253
- const v = parseInt(e.currentTarget.value, 10)
254
- if (isNaN(v)) return
295
+ oninput={(evt) => {
296
+ const parsed = parseInt(evt.currentTarget.value, 10)
297
+ if (isNaN(parsed)) return
255
298
  x_axis = {
256
299
  ...x_axis,
257
- ticks: Math.max(min_ticks, Math.min(max_ticks, v)),
300
+ ticks: Math.max(min_ticks, Math.min(max_ticks, parsed)),
258
301
  }
259
302
  }}
260
303
  />
@@ -266,12 +309,12 @@ let ctrl_state = $derived({
266
309
  max={max_ticks}
267
310
  step="1"
268
311
  value={typeof y_axis.ticks === `number` ? y_axis.ticks : 6}
269
- oninput={(e) => {
270
- const v = parseInt(e.currentTarget.value, 10)
271
- if (isNaN(v)) return
312
+ oninput={(evt) => {
313
+ const parsed = parseInt(evt.currentTarget.value, 10)
314
+ if (isNaN(parsed)) return
272
315
  y_axis = {
273
316
  ...y_axis,
274
- ticks: Math.max(min_ticks, Math.min(max_ticks, v)),
317
+ ticks: Math.max(min_ticks, Math.min(max_ticks, parsed)),
275
318
  }
276
319
  }}
277
320
  />
@@ -299,8 +342,8 @@ let ctrl_state = $derived({
299
342
  <label>X:
300
343
  <select
301
344
  value={get_scale_type_name(x_axis.scale_type)}
302
- onchange={(e) => {
303
- const val = e.currentTarget.value
345
+ onchange={(evt) => {
346
+ const val = evt.currentTarget.value
304
347
  x_axis = {
305
348
  ...x_axis,
306
349
  scale_type: is_scale_type_name(val) ? val : `linear`,
@@ -316,8 +359,8 @@ let ctrl_state = $derived({
316
359
  <label>X2:
317
360
  <select
318
361
  value={get_scale_type_name(x2_axis.scale_type)}
319
- onchange={(e) => {
320
- const val = e.currentTarget.value
362
+ onchange={(evt) => {
363
+ const val = evt.currentTarget.value
321
364
  x2_axis = {
322
365
  ...x2_axis,
323
366
  scale_type: is_scale_type_name(val) ? val : `linear`,
@@ -333,8 +376,8 @@ let ctrl_state = $derived({
333
376
  <label>Y:
334
377
  <select
335
378
  value={get_scale_type_name(y_axis.scale_type)}
336
- onchange={(e) => {
337
- const val = e.currentTarget.value
379
+ onchange={(evt) => {
380
+ const val = evt.currentTarget.value
338
381
  y_axis = {
339
382
  ...y_axis,
340
383
  scale_type: is_scale_type_name(val) ? val : `linear`,
@@ -350,8 +393,8 @@ let ctrl_state = $derived({
350
393
  <label>Y2:
351
394
  <select
352
395
  value={get_scale_type_name(y2_axis.scale_type)}
353
- onchange={(e) => {
354
- const val = e.currentTarget.value
396
+ onchange={(evt) => {
397
+ const val = evt.currentTarget.value
355
398
  y2_axis = {
356
399
  ...y2_axis,
357
400
  scale_type: is_scale_type_name(val) ? val : `linear`,
@@ -385,8 +428,8 @@ let ctrl_state = $derived({
385
428
  <select
386
429
  value={current_sync.mode}
387
430
  aria-label="Y2 axis synchronization mode"
388
- onchange={(e) => {
389
- const val = e.currentTarget.value
431
+ onchange={(evt) => {
432
+ const val = evt.currentTarget.value
390
433
  const mode = is_y2_sync_mode(val) ? val : `none`
391
434
  if (mode === `none`) {
392
435
  y2_axis = { ...y2_axis, sync: undefined }
@@ -412,8 +455,8 @@ let ctrl_state = $derived({
412
455
  value={current_sync.align_value ?? 0}
413
456
  aria-label="Value to align on both axes"
414
457
  style="width: 5em"
415
- onchange={(e) => {
416
- const val = parseFloat(e.currentTarget.value)
458
+ onchange={(evt) => {
459
+ const val = parseFloat(evt.currentTarget.value)
417
460
  y2_axis = {
418
461
  ...y2_axis,
419
462
  sync: {
@@ -1,4 +1,4 @@
1
1
  import type { PlotControlsProps } from './index';
2
- declare const PlotControls: import("svelte").Component<PlotControlsProps, {}, "display" | "show_controls" | "controls_open" | "x_axis" | "x2_axis" | "y_axis" | "y2_axis">;
2
+ declare const PlotControls: import("svelte").Component<PlotControlsProps, {}, "display" | "show_controls" | "controls_open" | "x_axis" | "y_axis" | "x2_axis" | "y2_axis">;
3
3
  type PlotControls = ReturnType<typeof PlotControls>;
4
4
  export default PlotControls;