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.
Files changed (358) hide show
  1. package/dist/EmptyState.svelte +10 -2
  2. package/dist/FilePicker.svelte +154 -96
  3. package/dist/Icon.svelte +20 -14
  4. package/dist/MillerIndexInput.svelte +27 -21
  5. package/dist/api/optimade.js +6 -6
  6. package/dist/app.css +216 -178
  7. package/dist/brillouin/BrillouinZone.svelte +299 -198
  8. package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
  9. package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
  10. package/dist/brillouin/BrillouinZoneExportPane.svelte +74 -55
  11. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  12. package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
  13. package/dist/brillouin/BrillouinZoneScene.svelte +277 -165
  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 +327 -0
  18. package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
  19. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +847 -0
  20. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
  21. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +3194 -0
  22. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
  23. package/dist/chempot-diagram/ChemPotScene3D.svelte +11 -0
  24. package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
  25. package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
  26. package/dist/chempot-diagram/async-compute.svelte.js +77 -0
  27. package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
  28. package/dist/chempot-diagram/chempot-worker.js +11 -0
  29. package/dist/chempot-diagram/color.d.ts +10 -0
  30. package/dist/chempot-diagram/color.js +32 -0
  31. package/dist/chempot-diagram/compute.d.ts +48 -0
  32. package/dist/chempot-diagram/compute.js +812 -0
  33. package/dist/chempot-diagram/index.d.ts +6 -0
  34. package/dist/chempot-diagram/index.js +6 -0
  35. package/dist/chempot-diagram/pointer.d.ts +16 -0
  36. package/dist/chempot-diagram/pointer.js +40 -0
  37. package/dist/chempot-diagram/temperature.d.ts +15 -0
  38. package/dist/chempot-diagram/temperature.js +36 -0
  39. package/dist/chempot-diagram/types.d.ts +86 -0
  40. package/dist/chempot-diagram/types.js +28 -0
  41. package/dist/colors/index.d.ts +3 -1
  42. package/dist/colors/index.js +9 -3
  43. package/dist/composition/BarChart.svelte +141 -77
  44. package/dist/composition/BubbleChart.svelte +107 -52
  45. package/dist/composition/Composition.svelte +100 -79
  46. package/dist/composition/Formula.svelte +108 -62
  47. package/dist/composition/FormulaFilter.svelte +973 -353
  48. package/dist/composition/FormulaFilter.svelte.d.ts +35 -1
  49. package/dist/composition/PieChart.svelte +199 -99
  50. package/dist/composition/PieChart.svelte.d.ts +1 -1
  51. package/dist/composition/format.d.ts +5 -0
  52. package/dist/composition/format.js +20 -3
  53. package/dist/composition/parse.js +14 -9
  54. package/dist/convex-hull/ConvexHull.svelte +93 -38
  55. package/dist/convex-hull/ConvexHull2D.svelte +551 -393
  56. package/dist/convex-hull/ConvexHull3D.svelte +1303 -825
  57. package/dist/convex-hull/ConvexHull4D.svelte +1012 -686
  58. package/dist/convex-hull/ConvexHullControls.svelte +115 -28
  59. package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
  60. package/dist/convex-hull/ConvexHullStats.svelte +821 -249
  61. package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
  62. package/dist/convex-hull/ConvexHullTooltip.svelte +41 -16
  63. package/dist/convex-hull/GasPressureControls.svelte +104 -61
  64. package/dist/convex-hull/StructurePopup.svelte +25 -4
  65. package/dist/convex-hull/TemperatureSlider.svelte +45 -25
  66. package/dist/convex-hull/barycentric-coords.js +13 -7
  67. package/dist/convex-hull/demo-temperature.d.ts +6 -0
  68. package/dist/convex-hull/demo-temperature.js +40 -0
  69. package/dist/convex-hull/gas-thermodynamics.js +17 -12
  70. package/dist/convex-hull/helpers.d.ts +10 -1
  71. package/dist/convex-hull/helpers.js +79 -38
  72. package/dist/convex-hull/index.d.ts +1 -0
  73. package/dist/convex-hull/index.js +1 -0
  74. package/dist/convex-hull/thermodynamics.d.ts +8 -21
  75. package/dist/convex-hull/thermodynamics.js +163 -69
  76. package/dist/convex-hull/types.d.ts +12 -12
  77. package/dist/convex-hull/types.js +0 -12
  78. package/dist/coordination/CoordinationBarPlot.svelte +232 -176
  79. package/dist/element/BohrAtom.svelte +56 -13
  80. package/dist/element/ElementHeading.svelte +7 -2
  81. package/dist/element/ElementPhoto.svelte +15 -9
  82. package/dist/element/ElementStats.svelte +10 -4
  83. package/dist/element/ElementTile.svelte +137 -73
  84. package/dist/element/Nucleus.svelte +39 -11
  85. package/dist/element/data.js +2 -14
  86. package/dist/element/data.json.gz +0 -0
  87. package/dist/element/types.d.ts +1 -0
  88. package/dist/feedback/ClickFeedback.svelte +16 -5
  89. package/dist/feedback/DragOverlay.svelte +10 -2
  90. package/dist/feedback/Spinner.svelte +4 -2
  91. package/dist/feedback/StatusMessage.svelte +8 -2
  92. package/dist/fermi-surface/FermiSlice.svelte +118 -88
  93. package/dist/fermi-surface/FermiSurface.svelte +336 -239
  94. package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
  95. package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
  96. package/dist/fermi-surface/FermiSurfaceScene.svelte +536 -343
  97. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
  98. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
  99. package/dist/fermi-surface/compute.js +16 -20
  100. package/dist/fermi-surface/parse.js +37 -33
  101. package/dist/fermi-surface/symmetry.js +2 -7
  102. package/dist/fermi-surface/types.d.ts +3 -5
  103. package/dist/heatmap-matrix/HeatmapMatrix.svelte +1527 -0
  104. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
  105. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
  106. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +30 -0
  107. package/dist/heatmap-matrix/index.d.ts +53 -0
  108. package/dist/heatmap-matrix/index.js +100 -0
  109. package/dist/heatmap-matrix/shared.d.ts +2 -0
  110. package/dist/heatmap-matrix/shared.js +4 -0
  111. package/dist/icons.d.ts +111 -0
  112. package/dist/icons.js +158 -0
  113. package/dist/index.d.ts +5 -2
  114. package/dist/index.js +5 -2
  115. package/dist/io/decompress.js +1 -1
  116. package/dist/io/export.d.ts +3 -0
  117. package/dist/io/export.js +138 -140
  118. package/dist/io/file-drop.d.ts +7 -0
  119. package/dist/io/file-drop.js +43 -0
  120. package/dist/io/index.d.ts +2 -2
  121. package/dist/io/index.js +2 -112
  122. package/dist/io/is-binary.js +2 -3
  123. package/dist/io/types.d.ts +1 -0
  124. package/dist/io/url-drop.d.ts +2 -0
  125. package/dist/io/url-drop.js +117 -0
  126. package/dist/isosurface/Isosurface.svelte +220 -110
  127. package/dist/isosurface/IsosurfaceControls.svelte +65 -28
  128. package/dist/isosurface/parse.js +104 -56
  129. package/dist/isosurface/slice.d.ts +2 -1
  130. package/dist/isosurface/slice.js +8 -13
  131. package/dist/isosurface/types.d.ts +14 -1
  132. package/dist/isosurface/types.js +152 -5
  133. package/dist/labels.d.ts +2 -1
  134. package/dist/labels.js +12 -8
  135. package/dist/layout/FullscreenToggle.svelte +11 -2
  136. package/dist/layout/InfoCard.svelte +38 -6
  137. package/dist/layout/InfoTag.svelte +125 -94
  138. package/dist/layout/PropertyFilter.svelte +82 -37
  139. package/dist/layout/SettingsSection.svelte +85 -55
  140. package/dist/layout/SubpageGrid.svelte +82 -0
  141. package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
  142. package/dist/layout/index.d.ts +1 -0
  143. package/dist/layout/index.js +1 -0
  144. package/dist/layout/json-tree/JsonNode.svelte +266 -223
  145. package/dist/layout/json-tree/JsonTree.svelte +516 -429
  146. package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
  147. package/dist/layout/json-tree/JsonValue.svelte +281 -173
  148. package/dist/layout/json-tree/types.d.ts +10 -2
  149. package/dist/layout/json-tree/utils.d.ts +2 -0
  150. package/dist/layout/json-tree/utils.js +37 -2
  151. package/dist/marching-cubes.js +25 -2
  152. package/dist/math.d.ts +20 -17
  153. package/dist/math.js +474 -57
  154. package/dist/overlays/ContextMenu.svelte +66 -40
  155. package/dist/overlays/DraggablePane.svelte +331 -154
  156. package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
  157. package/dist/periodic-table/PeriodicTable.svelte +278 -145
  158. package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
  159. package/dist/periodic-table/PropertySelect.svelte +25 -7
  160. package/dist/periodic-table/TableInset.svelte +8 -3
  161. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +559 -267
  162. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
  163. package/dist/phase-diagram/PhaseDiagramControls.svelte +131 -51
  164. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
  165. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
  166. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
  167. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +160 -110
  168. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +8 -1
  169. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +217 -86
  170. package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
  171. package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
  172. package/dist/phase-diagram/build-diagram.js +9 -9
  173. package/dist/phase-diagram/colors.js +1 -3
  174. package/dist/phase-diagram/index.d.ts +2 -0
  175. package/dist/phase-diagram/index.js +2 -0
  176. package/dist/phase-diagram/parse.js +10 -9
  177. package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
  178. package/dist/phase-diagram/svg-to-diagram.js +869 -0
  179. package/dist/phase-diagram/types.d.ts +10 -0
  180. package/dist/phase-diagram/utils.d.ts +8 -4
  181. package/dist/phase-diagram/utils.js +219 -74
  182. package/dist/plot/AxisLabel.svelte +51 -0
  183. package/dist/plot/AxisLabel.svelte.d.ts +16 -0
  184. package/dist/plot/BarPlot.svelte +1461 -768
  185. package/dist/plot/BarPlot.svelte.d.ts +3 -3
  186. package/dist/plot/BarPlotControls.svelte +33 -6
  187. package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
  188. package/dist/plot/ColorBar.svelte +533 -383
  189. package/dist/plot/ColorBar.svelte.d.ts +1 -1
  190. package/dist/plot/ColorScaleSelect.svelte +28 -7
  191. package/dist/plot/ElementScatter.svelte +38 -16
  192. package/dist/plot/FillArea.svelte +152 -92
  193. package/dist/plot/Histogram.svelte +1162 -709
  194. package/dist/plot/Histogram.svelte.d.ts +1 -1
  195. package/dist/plot/HistogramControls.svelte +81 -18
  196. package/dist/plot/HistogramControls.svelte.d.ts +6 -2
  197. package/dist/plot/InteractiveAxisLabel.svelte +34 -11
  198. package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
  199. package/dist/plot/Line.svelte +63 -28
  200. package/dist/plot/PlotControls.svelte +221 -96
  201. package/dist/plot/PlotControls.svelte.d.ts +1 -1
  202. package/dist/plot/PlotLegend.svelte +174 -91
  203. package/dist/plot/PlotTooltip.svelte +45 -6
  204. package/dist/plot/PortalSelect.svelte +175 -146
  205. package/dist/plot/ReferenceLine.svelte +77 -22
  206. package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
  207. package/dist/plot/ReferenceLine3D.svelte +132 -107
  208. package/dist/plot/ReferencePlane.svelte +146 -123
  209. package/dist/plot/ScatterPlot.svelte +1880 -1156
  210. package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
  211. package/dist/plot/ScatterPlot3D.svelte +256 -131
  212. package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
  213. package/dist/plot/ScatterPlot3DControls.svelte +300 -297
  214. package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
  215. package/dist/plot/ScatterPlot3DScene.svelte +608 -406
  216. package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
  217. package/dist/plot/ScatterPlotControls.svelte +150 -70
  218. package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
  219. package/dist/plot/ScatterPoint.svelte +98 -26
  220. package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
  221. package/dist/plot/SpacegroupBarPlot.svelte +142 -85
  222. package/dist/plot/Surface3D.svelte +159 -108
  223. package/dist/plot/ZeroLines.svelte +96 -0
  224. package/dist/plot/ZeroLines.svelte.d.ts +32 -0
  225. package/dist/plot/ZoomRect.svelte +23 -0
  226. package/dist/plot/ZoomRect.svelte.d.ts +8 -0
  227. package/dist/plot/axis-utils.d.ts +1 -1
  228. package/dist/plot/axis-utils.js +1 -3
  229. package/dist/plot/data-cleaning.js +12 -28
  230. package/dist/plot/data-transform.js +2 -1
  231. package/dist/plot/fill-utils.js +2 -0
  232. package/dist/plot/index.d.ts +6 -2
  233. package/dist/plot/index.js +6 -2
  234. package/dist/plot/interactions.d.ts +8 -10
  235. package/dist/plot/interactions.js +2 -3
  236. package/dist/plot/layout.d.ts +11 -2
  237. package/dist/plot/layout.js +44 -17
  238. package/dist/plot/reference-line.d.ts +5 -22
  239. package/dist/plot/reference-line.js +12 -84
  240. package/dist/plot/scales.js +24 -36
  241. package/dist/plot/types.d.ts +53 -40
  242. package/dist/plot/types.js +12 -7
  243. package/dist/plot/utils/label-placement.d.ts +32 -15
  244. package/dist/plot/utils/label-placement.js +227 -63
  245. package/dist/plot/utils/series-visibility.js +2 -3
  246. package/dist/plot/utils.d.ts +1 -0
  247. package/dist/plot/utils.js +14 -0
  248. package/dist/rdf/RdfPlot.svelte +173 -132
  249. package/dist/rdf/calc-rdf.js +4 -5
  250. package/dist/sanitize.d.ts +4 -0
  251. package/dist/sanitize.js +107 -0
  252. package/dist/settings.d.ts +21 -6
  253. package/dist/settings.js +63 -19
  254. package/dist/spectral/Bands.svelte +963 -412
  255. package/dist/spectral/Bands.svelte.d.ts +22 -2
  256. package/dist/spectral/BandsAndDos.svelte +90 -49
  257. package/dist/spectral/BrillouinBandsDos.svelte +151 -93
  258. package/dist/spectral/Dos.svelte +389 -258
  259. package/dist/spectral/helpers.d.ts +23 -1
  260. package/dist/spectral/helpers.js +119 -51
  261. package/dist/spectral/types.d.ts +2 -0
  262. package/dist/state.svelte.d.ts +1 -1
  263. package/dist/state.svelte.js +3 -2
  264. package/dist/structure/Arrow.svelte +59 -20
  265. package/dist/structure/AtomLegend.svelte +231 -129
  266. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  267. package/dist/structure/Bond.svelte +73 -47
  268. package/dist/structure/CanvasTooltip.svelte +10 -2
  269. package/dist/structure/CellSelect.svelte +148 -51
  270. package/dist/structure/Cylinder.svelte +33 -17
  271. package/dist/structure/Lattice.svelte +88 -33
  272. package/dist/structure/Structure.svelte +1077 -821
  273. package/dist/structure/Structure.svelte.d.ts +1 -1
  274. package/dist/structure/StructureControls.svelte +373 -139
  275. package/dist/structure/StructureControls.svelte.d.ts +1 -1
  276. package/dist/structure/StructureExportPane.svelte +124 -89
  277. package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
  278. package/dist/structure/StructureInfoPane.svelte +304 -231
  279. package/dist/structure/StructureScene.svelte +919 -445
  280. package/dist/structure/StructureScene.svelte.d.ts +16 -7
  281. package/dist/structure/atom-properties.d.ts +6 -2
  282. package/dist/structure/atom-properties.js +42 -29
  283. package/dist/structure/bonding.js +6 -7
  284. package/dist/structure/export.js +22 -34
  285. package/dist/structure/ferrox-wasm-types.d.ts +3 -2
  286. package/dist/structure/ferrox-wasm-types.js +0 -3
  287. package/dist/structure/ferrox-wasm.d.ts +3 -2
  288. package/dist/structure/ferrox-wasm.js +2 -3
  289. package/dist/structure/index.d.ts +16 -0
  290. package/dist/structure/index.js +88 -6
  291. package/dist/structure/measure.d.ts +2 -2
  292. package/dist/structure/measure.js +4 -44
  293. package/dist/structure/parse.js +130 -155
  294. package/dist/structure/partial-occupancy.d.ts +25 -0
  295. package/dist/structure/partial-occupancy.js +99 -0
  296. package/dist/structure/pbc.d.ts +1 -0
  297. package/dist/structure/pbc.js +16 -6
  298. package/dist/structure/supercell.d.ts +2 -2
  299. package/dist/structure/supercell.js +12 -22
  300. package/dist/structure/validation.js +5 -3
  301. package/dist/symmetry/SymmetryStats.svelte +94 -37
  302. package/dist/symmetry/WyckoffTable.svelte +42 -14
  303. package/dist/symmetry/cell-transform.js +5 -3
  304. package/dist/symmetry/index.d.ts +7 -4
  305. package/dist/symmetry/index.js +87 -21
  306. package/dist/symmetry/spacegroups.js +148 -148
  307. package/dist/table/HeatmapTable.svelte +1112 -516
  308. package/dist/table/HeatmapTable.svelte.d.ts +12 -1
  309. package/dist/table/ToggleMenu.svelte +125 -90
  310. package/dist/table/index.d.ts +2 -0
  311. package/dist/table/index.js +2 -4
  312. package/dist/theme/ThemeControl.svelte +21 -12
  313. package/dist/time.js +4 -1
  314. package/dist/tooltip/TooltipContent.svelte +33 -8
  315. package/dist/trajectory/Trajectory.svelte +889 -687
  316. package/dist/trajectory/TrajectoryError.svelte +14 -3
  317. package/dist/trajectory/TrajectoryExportPane.svelte +148 -90
  318. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
  319. package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
  320. package/dist/trajectory/constants.d.ts +6 -0
  321. package/dist/trajectory/constants.js +7 -0
  322. package/dist/trajectory/extract.js +13 -31
  323. package/dist/trajectory/format-detect.d.ts +9 -0
  324. package/dist/trajectory/format-detect.js +76 -0
  325. package/dist/trajectory/frame-reader.d.ts +17 -0
  326. package/dist/trajectory/frame-reader.js +332 -0
  327. package/dist/trajectory/helpers.d.ts +14 -0
  328. package/dist/trajectory/helpers.js +172 -0
  329. package/dist/trajectory/index.d.ts +1 -0
  330. package/dist/trajectory/index.js +23 -14
  331. package/dist/trajectory/parse/ase.d.ts +2 -0
  332. package/dist/trajectory/parse/ase.js +77 -0
  333. package/dist/trajectory/parse/hdf5.d.ts +2 -0
  334. package/dist/trajectory/parse/hdf5.js +129 -0
  335. package/dist/trajectory/parse/index.d.ts +12 -0
  336. package/dist/trajectory/parse/index.js +299 -0
  337. package/dist/trajectory/parse/lammps.d.ts +5 -0
  338. package/dist/trajectory/parse/lammps.js +179 -0
  339. package/dist/trajectory/parse/vasp.d.ts +2 -0
  340. package/dist/trajectory/parse/vasp.js +68 -0
  341. package/dist/trajectory/parse/xyz.d.ts +2 -0
  342. package/dist/trajectory/parse/xyz.js +110 -0
  343. package/dist/trajectory/plotting.js +13 -8
  344. package/dist/trajectory/types.d.ts +11 -0
  345. package/dist/trajectory/types.js +1 -0
  346. package/dist/utils.d.ts +3 -0
  347. package/dist/utils.js +17 -0
  348. package/dist/xrd/XrdPlot.svelte +337 -245
  349. package/dist/xrd/broadening.js +14 -9
  350. package/dist/xrd/calc-xrd.js +12 -19
  351. package/dist/xrd/parse.d.ts +1 -1
  352. package/dist/xrd/parse.js +17 -17
  353. package/package.json +103 -101
  354. package/readme.md +4 -4
  355. package/dist/trajectory/parse.d.ts +0 -42
  356. package/dist/trajectory/parse.js +0 -1267
  357. /package/dist/element/{data.json.d.ts → data.json.gz.d.ts} +0 -0
  358. /package/dist/theme/{themes.js → themes.mjs} +0 -0
@@ -51,7 +51,7 @@ declare function $$render<Metadata extends Record<string, unknown> = Record<stri
51
51
  height?: number;
52
52
  };
53
53
  exports: {};
54
- bindings: "scene" | "camera" | "orbit_controls" | "hovered_point";
54
+ bindings: "camera" | "hovered_point" | "scene" | "orbit_controls";
55
55
  slots: {};
56
56
  events: {};
57
57
  };
@@ -59,7 +59,7 @@ declare class __sveltets_Render<Metadata extends Record<string, unknown> = Recor
59
59
  props(): ReturnType<typeof $$render<Metadata>>['props'];
60
60
  events(): ReturnType<typeof $$render<Metadata>>['events'];
61
61
  slots(): ReturnType<typeof $$render<Metadata>>['slots'];
62
- bindings(): "scene" | "camera" | "orbit_controls" | "hovered_point";
62
+ bindings(): "camera" | "hovered_point" | "scene" | "orbit_controls";
63
63
  exports(): {};
64
64
  }
65
65
  interface $$IsomorphicComponent {
@@ -1,46 +1,116 @@
1
- <script lang="ts">import { SettingsSection } from '../layout';
2
- import { PlotControls } from './';
3
- import { DEFAULTS } from '../settings';
4
- import { tooltip } from 'svelte-multiselect/attachments';
5
- // Unique ID prefix to avoid conflicts when multiple instances on same page
6
- const uid = crypto.randomUUID().slice(0, 8);
7
- let { series = [], x_axis = $bindable({}), y_axis = $bindable({}), y2_axis = $bindable({}), display = $bindable({}), styles = $bindable({}), selected_series_idx = $bindable(0), on_touch, children, ...rest } = $props();
8
- let has_multiple_series = $derived(series.filter(Boolean).length > 1);
9
- $effect(() => {
10
- styles.show_points ??= DEFAULTS.scatter.show_points;
11
- styles.show_lines ??= DEFAULTS.scatter.show_lines;
12
- });
13
- const touch = ({ target }) => {
14
- const key = target?.closest(`[data-key]`)?.getAttribute(`data-key`);
15
- if (key)
16
- on_touch?.(key);
17
- };
18
- </script>
1
+ <script lang="ts">
2
+ import { SettingsSection } from '../layout'
3
+ import { PlotControls } from './'
4
+ import type {
5
+ DataSeries,
6
+ PlotConfig,
7
+ PlotControlsProps,
8
+ StyleOverrides,
9
+ } from './types'
10
+ import { DEFAULTS } from '../settings'
11
+ import type { Snippet } from 'svelte'
12
+ import { tooltip } from 'svelte-multiselect/attachments'
13
+
14
+ // Unique ID prefix to avoid conflicts when multiple instances on same page
15
+ const uid = crypto.randomUUID().slice(0, 8)
19
16
 
20
- <PlotControls bind:x_axis bind:y_axis bind:y2_axis bind:display show_controls {...rest}>
21
- {@render children?.({ x_axis, y_axis, y2_axis, display, styles, selected_series_idx })}
22
- <SettingsSection
23
- title="Markers"
24
- current_values={{ show_points: styles.show_points, show_lines: styles.show_lines }}
25
- on_reset={() => {
26
- styles.show_points = DEFAULTS.scatter.show_points
27
- styles.show_lines = DEFAULTS.scatter.show_lines
28
- }}
29
- style="display: flex; flex-wrap: wrap; gap: 1ex"
30
- >
31
- <label
32
- {@attach tooltip({ content: `Toggle visibility of data points in the scatter plot` })}
17
+ let {
18
+ series = [],
19
+ x_axis = $bindable({}),
20
+ x2_axis = $bindable({}),
21
+ y_axis = $bindable({}),
22
+ y2_axis = $bindable({}),
23
+ display = $bindable({}),
24
+ styles = $bindable({}),
25
+ selected_series_idx = $bindable(0),
26
+ on_touch,
27
+ children,
28
+ ...rest
29
+ }: Omit<PlotControlsProps, `children` | `post_children`> & {
30
+ series?: readonly DataSeries[]
31
+ styles?: StyleOverrides
32
+ selected_series_idx?: number
33
+ on_touch?: (key: string) => void
34
+ children?: Snippet<
35
+ [{ styles: StyleOverrides; selected_series_idx: number } & Required<PlotConfig>]
33
36
  >
34
- <input type="checkbox" bind:checked={styles.show_points} /> Show points
35
- </label>
36
- <label
37
- {@attach tooltip({
38
- content: `Toggle visibility of connecting lines between data points`,
39
- })}
37
+ } = $props()
38
+
39
+ let non_null_series = $derived(series.filter((srs) => srs != null))
40
+ let visible_series = $derived(
41
+ non_null_series.filter((srs) => (srs.visible ?? true)),
42
+ )
43
+ let has_multiple_series = $derived(non_null_series.length > 1)
44
+
45
+ // Derive what marker types are present, and whether color/size are data-driven
46
+ const markers_include = (mode: string) =>
47
+ visible_series.some((srs) => (srs?.markers ?? `line+points`).includes(mode))
48
+ let has_any_lines = $derived(markers_include(`line`))
49
+ let has_any_points = $derived(markers_include(`points`))
50
+ let has_color_data = $derived(
51
+ visible_series.some((srs) => srs?.color_values?.some((val) => val != null)),
52
+ )
53
+ let has_size_data = $derived(
54
+ visible_series.some((srs) => srs?.size_values?.some((val) => val != null)),
55
+ )
56
+
57
+ $effect(() => { // Initialize show_points/show_lines from defaults
58
+ styles.show_points ??= DEFAULTS.scatter.show_points
59
+ styles.show_lines ??= DEFAULTS.scatter.show_lines
60
+ })
61
+
62
+ const touch = ({ target }: Event) => {
63
+ const key = (target as Element)?.closest(`[data-key]`)?.getAttribute(`data-key`)
64
+ if (key) on_touch?.(key)
65
+ }
66
+ </script>
67
+
68
+ <PlotControls
69
+ bind:x_axis
70
+ bind:x2_axis
71
+ bind:y_axis
72
+ bind:y2_axis
73
+ bind:display
74
+ show_controls
75
+ {...rest}
76
+ >
77
+ {@render children?.({
78
+ x_axis,
79
+ x2_axis,
80
+ y_axis,
81
+ y2_axis,
82
+ display,
83
+ styles,
84
+ selected_series_idx,
85
+ })}
86
+ {#if has_any_points || has_any_lines}
87
+ <SettingsSection
88
+ title="Markers"
89
+ current_values={{ show_points: styles.show_points, show_lines: styles.show_lines }}
90
+ on_reset={() => {
91
+ styles.show_points = DEFAULTS.scatter.show_points
92
+ styles.show_lines = DEFAULTS.scatter.show_lines
93
+ }}
94
+ style="display: flex; flex-wrap: wrap; gap: 1ex"
40
95
  >
41
- <input type="checkbox" bind:checked={styles.show_lines} /> Show lines
42
- </label>
43
- </SettingsSection>
96
+ {#if has_any_points}
97
+ <label
98
+ {@attach tooltip({ content: `Toggle visibility of data points in the scatter plot` })}
99
+ >
100
+ <input type="checkbox" bind:checked={styles.show_points} /> Show points
101
+ </label>
102
+ {/if}
103
+ {#if has_any_lines}
104
+ <label
105
+ {@attach tooltip({
106
+ content: `Toggle visibility of connecting lines between data points`,
107
+ })}
108
+ >
109
+ <input type="checkbox" bind:checked={styles.show_lines} /> Show lines
110
+ </label>
111
+ {/if}
112
+ </SettingsSection>
113
+ {/if}
44
114
 
45
115
  {#snippet post_children()}
46
116
  <!-- Series Selection (for multi-series style controls) -->
@@ -59,8 +129,8 @@ const touch = ({ target }) => {
59
129
  </div>
60
130
  {/if}
61
131
 
62
- <!-- Point Style Controls -->
63
- {#if styles.show_points}
132
+ <!-- Point Style Controls: only when points exist and are visible -->
133
+ {#if has_any_points && styles.show_points}
64
134
  <SettingsSection
65
135
  title="Point Style"
66
136
  current_values={styles.point ?? {}}
@@ -71,28 +141,36 @@ const touch = ({ target }) => {
71
141
  oninput={touch}
72
142
  >
73
143
  {#if styles.point}
74
- <div class="pane-row" data-key="point.size">
75
- <label for="{uid}-point-size">Size:</label>
76
- <input
77
- id="{uid}-point-size"
78
- type="range"
79
- min="1"
80
- max="20"
81
- step="0.5"
82
- bind:value={styles.point.size}
83
- />
84
- <input
85
- type="number"
86
- min="1"
87
- max="20"
88
- step="0.5"
89
- bind:value={styles.point.size}
90
- />
91
- </div>
92
- <div class="pane-row" data-key="point.color">
93
- <label for="{uid}-point-color">Color:</label>
94
- <input id="{uid}-point-color" type="color" bind:value={styles.point.color} />
95
- </div>
144
+ {#if !has_size_data}
145
+ <div class="pane-row" data-key="point.size">
146
+ <label for="{uid}-point-size">Size:</label>
147
+ <input
148
+ id="{uid}-point-size"
149
+ type="range"
150
+ min="1"
151
+ max="20"
152
+ step="0.5"
153
+ bind:value={styles.point.size}
154
+ />
155
+ <input
156
+ type="number"
157
+ min="1"
158
+ max="20"
159
+ step="0.5"
160
+ bind:value={styles.point.size}
161
+ />
162
+ </div>
163
+ {/if}
164
+ {#if !has_color_data}
165
+ <div class="pane-row" data-key="point.color">
166
+ <label for="{uid}-point-color">Color:</label>
167
+ <input
168
+ id="{uid}-point-color"
169
+ type="color"
170
+ bind:value={styles.point.color}
171
+ />
172
+ </div>
173
+ {/if}
96
174
  <div class="pane-row" data-key="point.opacity">
97
175
  <label for="{uid}-point-opacity">Opacity:</label>
98
176
  <input
@@ -159,8 +237,8 @@ const touch = ({ target }) => {
159
237
  </SettingsSection>
160
238
  {/if}
161
239
 
162
- <!-- Line Style Controls -->
163
- {#if styles.show_lines}
240
+ <!-- Line Style Controls: only when lines exist and are visible -->
241
+ {#if has_any_lines && styles.show_lines}
164
242
  <SettingsSection
165
243
  title="Line Style"
166
244
  current_values={styles.line ?? {}}
@@ -189,10 +267,12 @@ const touch = ({ target }) => {
189
267
  bind:value={styles.line.width}
190
268
  />
191
269
  </div>
192
- <div class="pane-row" data-key="line.color">
193
- <label for="{uid}-line-color">Color:</label>
194
- <input id="{uid}-line-color" type="color" bind:value={styles.line.color} />
195
- </div>
270
+ {#if !has_color_data}
271
+ <div class="pane-row" data-key="line.color">
272
+ <label for="{uid}-line-color">Color:</label>
273
+ <input id="{uid}-line-color" type="color" bind:value={styles.line.color} />
274
+ </div>
275
+ {/if}
196
276
  <div class="pane-row" data-key="line.opacity">
197
277
  <label for="{uid}-line-opacity">Opacity:</label>
198
278
  <input
@@ -12,6 +12,6 @@ type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> &
12
12
  } & Required<PlotConfig>
13
13
  ]>;
14
14
  };
15
- declare const ScatterPlotControls: import("svelte").Component<$$ComponentProps, {}, "display" | "x_axis" | "y_axis" | "y2_axis" | "selected_series_idx" | "styles">;
15
+ declare const ScatterPlotControls: import("svelte").Component<$$ComponentProps, {}, "display" | "x_axis" | "y_axis" | "x2_axis" | "y2_axis" | "selected_series_idx" | "styles">;
16
16
  type ScatterPlotControls = ReturnType<typeof ScatterPlotControls>;
17
17
  export default ScatterPlotControls;
@@ -1,27 +1,61 @@
1
- <script lang="ts">import { symbol_map } from '../labels';
2
- import { DEFAULTS } from '../settings';
3
- import * as d3_symbols from 'd3-shape';
4
- import { symbol } from 'd3-shape';
5
- import { cubicOut } from 'svelte/easing';
6
- import { Tween } from 'svelte/motion';
7
- let { x, y, style = {}, hover = {}, label = {}, offset = { x: 0, y: 0 }, point_tween = $bindable({}), origin = $bindable({ x: 0, y: 0 }), is_hovered = false, is_selected = false, ...rest } = $props();
8
- // get the SVG path data as 'd' attribute
9
- function get_symbol_path() {
10
- const symbol_key = style.symbol_type ?? DEFAULTS.scatter.symbol_type;
11
- const symbol_type = symbol_map[symbol_key] ?? d3_symbols.symbolCircle;
12
- const size = style.symbol_size ?? Math.PI * Math.pow(style.radius ?? 2, 2);
13
- return symbol().type(symbol_type).size(size)() || ``;
14
- }
15
- let marker_path = $derived.by(get_symbol_path);
16
- const default_tween_props = {
1
+ <script lang="ts">
2
+ import { type D3SymbolName, symbol_map } from '../labels'
3
+ import type { HoverStyle, LabelStyle, Point } from './'
4
+ import type { PointStyle, TweenedOptions, XyObj } from './types'
5
+ import { DEFAULTS } from '../settings'
6
+ import * as d3_symbols from 'd3-shape'
7
+ import { symbol } from 'd3-shape'
8
+ import { cubicOut } from 'svelte/easing'
9
+ import type { SVGAttributes } from 'svelte/elements'
10
+ import { Tween } from 'svelte/motion'
11
+
12
+ let {
13
+ x,
14
+ y,
15
+ style = {},
16
+ hover = {},
17
+ label = {},
18
+ offset = { x: 0, y: 0 },
19
+ point_tween = $bindable({}),
20
+ origin = $bindable({ x: 0, y: 0 }),
21
+ is_hovered = false,
22
+ is_selected = false,
23
+ leader_line_threshold = 15,
24
+ ...rest
25
+ }: Omit<SVGAttributes<SVGGElement>, `style` | `offset` | `origin` | `transform`> & {
26
+ x: number
27
+ y: number
28
+ style?: PointStyle
29
+ hover?: HoverStyle
30
+ label?: LabelStyle
31
+ offset?: Point[`offset`]
32
+ point_tween?: TweenedOptions<XyObj>
33
+ origin?: XyObj
34
+ is_hovered?: boolean
35
+ is_selected?: boolean
36
+ leader_line_threshold?: number
37
+ } = $props()
38
+
39
+ // get the SVG path data as 'd' attribute
40
+ function get_symbol_path(): string {
41
+ const symbol_key: D3SymbolName = style.symbol_type ?? DEFAULTS.scatter.symbol_type
42
+ const symbol_type = symbol_map[symbol_key] ?? d3_symbols.symbolCircle
43
+ const size = style.symbol_size ?? Math.PI * Math.pow(style.radius ?? 2, 2)
44
+ return symbol().type(symbol_type).size(size)() || ``
45
+ }
46
+
47
+ let marker_path = $derived.by(get_symbol_path)
48
+
49
+ const default_tween_props: TweenedOptions<XyObj> = {
17
50
  duration: 600,
18
51
  easing: cubicOut,
19
- };
20
- // Single tween for {x, y} coordinates
21
- const tweened_coords = new Tween(origin, { ...default_tween_props, ...point_tween });
22
- $effect.pre(() => {
23
- tweened_coords.target = { x: x + offset.x, y: y + offset.y };
24
- });
52
+ }
53
+ // Single tween for {x, y} coordinates
54
+ const tweened_coords = new Tween(origin, { ...default_tween_props, ...point_tween })
55
+
56
+ $effect.pre(() => {
57
+ tweened_coords.target = { x: x + offset.x, y: y + offset.y }
58
+ })
25
59
  </script>
26
60
 
27
61
  <g
@@ -61,11 +95,46 @@ $effect.pre(() => {
61
95
  style:cursor={style.cursor}
62
96
  />
63
97
  {#if label.text}
98
+ {@const offset_x = label.offset?.x ?? 10}
99
+ {@const offset_y = label.offset?.y ?? 0}
100
+ {@const displacement = Math.hypot(offset_x, offset_y)}
101
+ {#if displacement > leader_line_threshold}
102
+ {@const marker_radius = style.radius ?? 3}
103
+ {@const angle = Math.atan2(offset_y, offset_x)}
104
+ {@const cos_a = Math.cos(angle)}
105
+ {@const sin_a = Math.sin(angle)}
106
+ {@const start_x = cos_a * (marker_radius + 2)}
107
+ {@const start_y = sin_a * (marker_radius + 2)}
108
+ {@const font_px = parseFloat(label.font_size ?? `10`) || 10}
109
+ {@const half_w = (label.text?.length ?? 1) * font_px * 0.2}
110
+ {@const half_h = font_px * 0.5}
111
+ {@const edge_dist = Math.min(
112
+ Math.abs(cos_a) > 0.01 ? half_w / Math.abs(cos_a) : Infinity,
113
+ Math.abs(sin_a) > 0.01 ? half_h / Math.abs(sin_a) : Infinity,
114
+ )}
115
+ {@const end_x = offset_x - cos_a * (edge_dist + 1)}
116
+ {@const end_y = offset_y - sin_a * (edge_dist + 1)}
117
+ {@const line_len = Math.hypot(end_x - start_x, end_y - start_y)}
118
+ {#if line_len > 6}
119
+ <line
120
+ x1={start_x}
121
+ y1={start_y}
122
+ x2={end_x}
123
+ y2={end_y}
124
+ class="leader-line"
125
+ stroke="var(--scatter-leader-line-color, #888)"
126
+ stroke-width="var(--scatter-leader-line-width, 0.8)"
127
+ stroke-dasharray="var(--scatter-leader-line-dash, 2 2)"
128
+ stroke-opacity="var(--scatter-leader-line-opacity, 0.6)"
129
+ />
130
+ {/if}
131
+ {/if}
64
132
  <text
65
- x={label?.offset?.x ?? 10}
66
- y={label?.offset?.y ?? 0}
67
- style:font-size={label?.font_size ?? `10px`}
68
- style:font-family={label?.font_family ?? `sans-serif`}
133
+ x={offset_x}
134
+ y={offset_y}
135
+ text-anchor={label.auto_placement ? `middle` : undefined}
136
+ style:font-size={label.font_size ?? `10px`}
137
+ style:font-family={label.font_family ?? `sans-serif`}
69
138
  fill="var(--scatter-point-label-fill, currentColor)"
70
139
  dominant-baseline="middle"
71
140
  class="label-text"
@@ -110,4 +179,7 @@ $effect.pre(() => {
110
179
  .label-text {
111
180
  pointer-events: var(--scatter-point-label-pointer-events, none);
112
181
  }
182
+ .leader-line {
183
+ pointer-events: none;
184
+ }
113
185
  </style>
@@ -12,6 +12,7 @@ type $$ComponentProps = Omit<SVGAttributes<SVGGElement>, `style` | `offset` | `o
12
12
  origin?: XyObj;
13
13
  is_hovered?: boolean;
14
14
  is_selected?: boolean;
15
+ leader_line_threshold?: number;
15
16
  };
16
17
  declare const ScatterPoint: import("svelte").Component<$$ComponentProps, {}, "origin" | "point_tween">;
17
18
  type ScatterPoint = ReturnType<typeof ScatterPoint>;