matterviz 0.3.7 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (486) hide show
  1. package/dist/Icon.svelte +7 -4
  2. package/dist/MillerIndexInput.svelte +1 -1
  3. package/dist/api/optimade.js +32 -26
  4. package/dist/app.css +0 -3
  5. package/dist/brillouin/BrillouinZone.svelte +76 -148
  6. package/dist/brillouin/BrillouinZone.svelte.d.ts +6 -14
  7. package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
  8. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  9. package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
  10. package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
  11. package/dist/brillouin/BrillouinZoneScene.svelte +97 -205
  12. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +4 -23
  13. package/dist/brillouin/BrillouinZoneTooltip.svelte +16 -25
  14. package/dist/brillouin/ReciprocalVectors.svelte +39 -0
  15. package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
  16. package/dist/brillouin/compute.d.ts +2 -0
  17. package/dist/brillouin/compute.js +89 -90
  18. package/dist/brillouin/geometry.d.ts +8 -0
  19. package/dist/brillouin/geometry.js +57 -0
  20. package/dist/brillouin/index.d.ts +2 -0
  21. package/dist/brillouin/index.js +2 -0
  22. package/dist/brillouin/types.d.ts +2 -2
  23. package/dist/chempot-diagram/ChemPotDiagram.svelte +14 -13
  24. package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
  25. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +109 -203
  26. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
  27. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +180 -470
  28. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
  29. package/dist/chempot-diagram/async-compute.svelte.js +3 -1
  30. package/dist/chempot-diagram/chempot-worker.js +2 -1
  31. package/dist/chempot-diagram/color.d.ts +3 -6
  32. package/dist/chempot-diagram/color.js +5 -5
  33. package/dist/chempot-diagram/compute.d.ts +4 -4
  34. package/dist/chempot-diagram/compute.js +20 -20
  35. package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
  36. package/dist/chempot-diagram/controls-state.svelte.js +42 -0
  37. package/dist/chempot-diagram/export.d.ts +47 -0
  38. package/dist/chempot-diagram/export.js +133 -0
  39. package/dist/chempot-diagram/index.d.ts +1 -0
  40. package/dist/chempot-diagram/index.js +1 -0
  41. package/dist/chempot-diagram/pointer.d.ts +0 -10
  42. package/dist/chempot-diagram/pointer.js +4 -4
  43. package/dist/chempot-diagram/types.d.ts +3 -3
  44. package/dist/colors/index.js +8 -7
  45. package/dist/composition/FormulaFilter.svelte +18 -11
  46. package/dist/composition/PieChart.svelte +11 -10
  47. package/dist/composition/chem-sys.d.ts +8 -0
  48. package/dist/composition/chem-sys.js +86 -0
  49. package/dist/composition/format.js +7 -4
  50. package/dist/composition/index.d.ts +1 -0
  51. package/dist/composition/index.js +1 -0
  52. package/dist/composition/parse.d.ts +0 -1
  53. package/dist/composition/parse.js +41 -31
  54. package/dist/controls.d.ts +1 -0
  55. package/dist/controls.js +0 -1
  56. package/dist/convex-hull/ConvexHull.svelte +8 -10
  57. package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
  58. package/dist/convex-hull/ConvexHull2D.svelte +106 -185
  59. package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
  60. package/dist/convex-hull/ConvexHull3D.svelte +179 -683
  61. package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
  62. package/dist/convex-hull/ConvexHull4D.svelte +183 -687
  63. package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
  64. package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
  65. package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
  66. package/dist/convex-hull/ConvexHullControls.svelte +88 -7
  67. package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
  68. package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
  69. package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
  70. package/dist/convex-hull/ConvexHullStats.svelte +36 -175
  71. package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
  72. package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
  73. package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
  74. package/dist/convex-hull/GasPressureControls.svelte +4 -4
  75. package/dist/convex-hull/TemperatureSlider.svelte +2 -2
  76. package/dist/convex-hull/barycentric-coords.d.ts +2 -4
  77. package/dist/convex-hull/barycentric-coords.js +6 -33
  78. package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
  79. package/dist/convex-hull/canvas-interactions.svelte.js +278 -0
  80. package/dist/convex-hull/demo-temperature.d.ts +1 -1
  81. package/dist/convex-hull/demo-temperature.js +20 -22
  82. package/dist/convex-hull/gas-thermodynamics.d.ts +2 -2
  83. package/dist/convex-hull/gas-thermodynamics.js +22 -30
  84. package/dist/convex-hull/helpers.d.ts +42 -7
  85. package/dist/convex-hull/helpers.js +171 -78
  86. package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
  87. package/dist/convex-hull/hull-state.svelte.js +124 -0
  88. package/dist/convex-hull/index.d.ts +10 -8
  89. package/dist/convex-hull/index.js +7 -2
  90. package/dist/convex-hull/thermodynamics.js +136 -960
  91. package/dist/convex-hull/types.d.ts +13 -5
  92. package/dist/convex-hull/types.js +12 -0
  93. package/dist/coordination/CoordinationBarPlot.svelte +27 -34
  94. package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
  95. package/dist/element/BohrAtom.svelte +2 -1
  96. package/dist/element/index.d.ts +4 -0
  97. package/dist/element/index.js +18 -0
  98. package/dist/feedback/DragOverlay.svelte +3 -1
  99. package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
  100. package/dist/feedback/StatusMessage.svelte +13 -3
  101. package/dist/fermi-surface/FermiSlice.svelte +13 -5
  102. package/dist/fermi-surface/FermiSurface.svelte +78 -151
  103. package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
  104. package/dist/fermi-surface/FermiSurfaceControls.svelte +1 -1
  105. package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
  106. package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -221
  107. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
  108. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +8 -34
  109. package/dist/fermi-surface/compute.js +67 -66
  110. package/dist/fermi-surface/export.js +6 -16
  111. package/dist/fermi-surface/index.d.ts +0 -1
  112. package/dist/fermi-surface/index.js +0 -1
  113. package/dist/fermi-surface/parse.d.ts +1 -1
  114. package/dist/fermi-surface/parse.js +71 -79
  115. package/dist/fermi-surface/types.d.ts +3 -2
  116. package/dist/heatmap-matrix/HeatmapMatrix.svelte +69 -52
  117. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
  118. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
  119. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
  120. package/dist/heatmap-matrix/index.d.ts +3 -2
  121. package/dist/heatmap-matrix/index.js +1 -1
  122. package/dist/index.d.ts +1 -0
  123. package/dist/index.js +1 -0
  124. package/dist/io/ExportPane.svelte +166 -0
  125. package/dist/io/ExportPane.svelte.d.ts +17 -0
  126. package/dist/io/decompress.js +5 -4
  127. package/dist/io/export.d.ts +9 -5
  128. package/dist/io/export.js +77 -51
  129. package/dist/io/fetch.d.ts +2 -1
  130. package/dist/io/fetch.js +5 -1
  131. package/dist/io/file-drop.d.ts +8 -1
  132. package/dist/io/file-drop.js +48 -36
  133. package/dist/io/index.d.ts +2 -0
  134. package/dist/io/index.js +10 -0
  135. package/dist/io/types.d.ts +13 -0
  136. package/dist/io/url-drop.js +64 -33
  137. package/dist/isosurface/parse.js +52 -51
  138. package/dist/isosurface/slice.js +5 -4
  139. package/dist/isosurface/types.js +1 -1
  140. package/dist/keyboard.d.ts +3 -0
  141. package/dist/keyboard.js +23 -0
  142. package/dist/labels.d.ts +1 -1
  143. package/dist/labels.js +9 -8
  144. package/dist/layout/FullscreenButton.svelte +33 -0
  145. package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
  146. package/dist/layout/FullscreenToggle.svelte +8 -14
  147. package/dist/layout/PropertyFilter.svelte +3 -2
  148. package/dist/layout/SettingsSection.svelte +1 -1
  149. package/dist/layout/ViewerChrome.svelte +116 -0
  150. package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
  151. package/dist/layout/fullscreen.d.ts +4 -0
  152. package/dist/layout/fullscreen.svelte.d.ts +8 -0
  153. package/dist/layout/fullscreen.svelte.js +37 -0
  154. package/dist/layout/index.d.ts +3 -0
  155. package/dist/layout/index.js +3 -0
  156. package/dist/layout/json-tree/JsonNode.svelte +1 -1
  157. package/dist/layout/json-tree/JsonTree.svelte +2 -2
  158. package/dist/layout/json-tree/utils.js +5 -4
  159. package/dist/marching-cubes.js +8 -13
  160. package/dist/math.d.ts +12 -4
  161. package/dist/math.js +42 -30
  162. package/dist/overlays/DraggablePane.svelte +4 -4
  163. package/dist/overlays/index.d.ts +4 -0
  164. package/dist/periodic-table/PeriodicTable.svelte +27 -15
  165. package/dist/periodic-table/PropertySelect.svelte +1 -0
  166. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +9 -3
  167. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
  168. package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
  169. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
  170. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
  171. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
  172. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
  173. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
  174. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +1 -1
  175. package/dist/phase-diagram/build-diagram.js +2 -2
  176. package/dist/phase-diagram/colors.js +1 -1
  177. package/dist/phase-diagram/parse.d.ts +2 -1
  178. package/dist/phase-diagram/parse.js +6 -5
  179. package/dist/phase-diagram/types.d.ts +1 -1
  180. package/dist/phase-diagram/utils.d.ts +3 -3
  181. package/dist/phase-diagram/utils.js +8 -12
  182. package/dist/plot/{BarPlot.svelte → bar/BarPlot.svelte} +246 -841
  183. package/dist/plot/{BarPlot.svelte.d.ts → bar/BarPlot.svelte.d.ts} +8 -16
  184. package/dist/plot/{BarPlotControls.svelte → bar/BarPlotControls.svelte} +6 -5
  185. package/dist/plot/{BarPlotControls.svelte.d.ts → bar/BarPlotControls.svelte.d.ts} +3 -3
  186. package/dist/plot/{SpacegroupBarPlot.svelte → bar/SpacegroupBarPlot.svelte} +8 -7
  187. package/dist/plot/{SpacegroupBarPlot.svelte.d.ts → bar/SpacegroupBarPlot.svelte.d.ts} +1 -1
  188. package/dist/plot/bar/data.d.ts +40 -0
  189. package/dist/plot/bar/data.js +154 -0
  190. package/dist/plot/bar/geometry.d.ts +39 -0
  191. package/dist/plot/bar/geometry.js +60 -0
  192. package/dist/plot/bar/index.d.ts +3 -0
  193. package/dist/plot/bar/index.js +3 -0
  194. package/dist/plot/box/BoxPlot.svelte +1292 -0
  195. package/dist/plot/box/BoxPlot.svelte.d.ts +95 -0
  196. package/dist/plot/box/BoxPlotControls.svelte +109 -0
  197. package/dist/plot/box/BoxPlotControls.svelte.d.ts +19 -0
  198. package/dist/plot/box/Violin.svelte +14 -0
  199. package/dist/plot/box/Violin.svelte.d.ts +70 -0
  200. package/dist/plot/box/box-plot.d.ts +56 -0
  201. package/dist/plot/box/box-plot.js +129 -0
  202. package/dist/plot/box/index.d.ts +5 -0
  203. package/dist/plot/box/index.js +5 -0
  204. package/dist/plot/box/kde.d.ts +17 -0
  205. package/dist/plot/box/kde.js +160 -0
  206. package/dist/plot/box/quantile.d.ts +3 -0
  207. package/dist/plot/box/quantile.js +53 -0
  208. package/dist/plot/{auto-place.d.ts → core/auto-place.d.ts} +1 -1
  209. package/dist/plot/{auto-place.js → core/auto-place.js} +6 -3
  210. package/dist/plot/core/axis-utils.d.ts +46 -0
  211. package/dist/plot/core/axis-utils.js +110 -0
  212. package/dist/plot/{AxisLabel.svelte → core/components/AxisLabel.svelte} +2 -2
  213. package/dist/plot/{AxisLabel.svelte.d.ts → core/components/AxisLabel.svelte.d.ts} +1 -1
  214. package/dist/plot/{ColorBar.svelte → core/components/ColorBar.svelte} +41 -38
  215. package/dist/plot/{ColorBar.svelte.d.ts → core/components/ColorBar.svelte.d.ts} +7 -6
  216. package/dist/plot/{ColorScaleSelect.svelte → core/components/ColorScaleSelect.svelte} +4 -3
  217. package/dist/plot/{ColorScaleSelect.svelte.d.ts → core/components/ColorScaleSelect.svelte.d.ts} +2 -2
  218. package/dist/plot/core/components/ControlPane.svelte +46 -0
  219. package/dist/plot/core/components/ControlPane.svelte.d.ts +13 -0
  220. package/dist/plot/{FillArea.svelte → core/components/FillArea.svelte} +17 -6
  221. package/dist/plot/{FillArea.svelte.d.ts → core/components/FillArea.svelte.d.ts} +1 -1
  222. package/dist/plot/{InteractiveAxisLabel.svelte → core/components/InteractiveAxisLabel.svelte} +3 -3
  223. package/dist/plot/{InteractiveAxisLabel.svelte.d.ts → core/components/InteractiveAxisLabel.svelte.d.ts} +2 -2
  224. package/dist/plot/{Line.svelte → core/components/Line.svelte} +33 -15
  225. package/dist/plot/{Line.svelte.d.ts → core/components/Line.svelte.d.ts} +3 -2
  226. package/dist/plot/{PlotAxis.svelte → core/components/PlotAxis.svelte} +9 -6
  227. package/dist/plot/{PlotAxis.svelte.d.ts → core/components/PlotAxis.svelte.d.ts} +5 -3
  228. package/dist/plot/{PlotControls.svelte → core/components/PlotControls.svelte} +17 -29
  229. package/dist/plot/core/components/PlotControls.svelte.d.ts +4 -0
  230. package/dist/plot/{PlotLegend.svelte → core/components/PlotLegend.svelte} +21 -10
  231. package/dist/plot/{PlotLegend.svelte.d.ts → core/components/PlotLegend.svelte.d.ts} +3 -2
  232. package/dist/plot/{PlotTooltip.svelte → core/components/PlotTooltip.svelte} +17 -1
  233. package/dist/plot/{PlotTooltip.svelte.d.ts → core/components/PlotTooltip.svelte.d.ts} +8 -0
  234. package/dist/plot/{PortalSelect.svelte → core/components/PortalSelect.svelte} +11 -7
  235. package/dist/plot/{ReferenceLine.svelte → core/components/ReferenceLine.svelte} +3 -3
  236. package/dist/plot/{ReferenceLine.svelte.d.ts → core/components/ReferenceLine.svelte.d.ts} +1 -1
  237. package/dist/plot/{ReferenceLine3D.svelte → core/components/ReferenceLine3D.svelte} +5 -5
  238. package/dist/plot/{ReferenceLine3D.svelte.d.ts → core/components/ReferenceLine3D.svelte.d.ts} +5 -5
  239. package/dist/plot/{ReferencePlane.svelte → core/components/ReferencePlane.svelte} +8 -8
  240. package/dist/plot/{ReferencePlane.svelte.d.ts → core/components/ReferencePlane.svelte.d.ts} +5 -5
  241. package/dist/plot/{ZeroLines.svelte → core/components/ZeroLines.svelte} +3 -3
  242. package/dist/plot/{ZeroLines.svelte.d.ts → core/components/ZeroLines.svelte.d.ts} +3 -3
  243. package/dist/plot/{ZoomRect.svelte → core/components/ZoomRect.svelte} +1 -1
  244. package/dist/plot/{ZoomRect.svelte.d.ts → core/components/ZoomRect.svelte.d.ts} +1 -1
  245. package/dist/plot/core/components/index.d.ts +17 -0
  246. package/dist/plot/core/components/index.js +17 -0
  247. package/dist/plot/{data-cleaning.d.ts → core/data-cleaning.d.ts} +71 -1
  248. package/dist/plot/{data-cleaning.js → core/data-cleaning.js} +21 -23
  249. package/dist/plot/{data-transform.d.ts → core/data-transform.d.ts} +2 -2
  250. package/dist/plot/{data-transform.js → core/data-transform.js} +3 -3
  251. package/dist/plot/core/fill-utils.d.ts +34 -0
  252. package/dist/plot/core/fill-utils.js +391 -0
  253. package/dist/plot/core/index.d.ts +10 -0
  254. package/dist/plot/core/index.js +11 -0
  255. package/dist/plot/core/interactions.d.ts +39 -0
  256. package/dist/plot/core/interactions.js +209 -0
  257. package/dist/plot/{layout.d.ts → core/layout.d.ts} +1 -0
  258. package/dist/plot/{layout.js → core/layout.js} +16 -8
  259. package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
  260. package/dist/plot/core/pan-zoom.svelte.js +221 -0
  261. package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
  262. package/dist/plot/core/placed-tween.svelte.js +68 -0
  263. package/dist/plot/{reference-line.d.ts → core/reference-line.d.ts} +11 -11
  264. package/dist/plot/{reference-line.js → core/reference-line.js} +29 -42
  265. package/dist/plot/core/scales.d.ts +40 -0
  266. package/dist/plot/{scales.js → core/scales.js} +94 -93
  267. package/dist/plot/core/svg.d.ts +3 -0
  268. package/dist/plot/core/svg.js +41 -0
  269. package/dist/plot/{types.d.ts → core/types.d.ts} +36 -85
  270. package/dist/plot/{types.js → core/types.js} +1 -1
  271. package/dist/plot/{utils → core/utils}/label-placement.d.ts +3 -3
  272. package/dist/plot/{utils → core/utils}/label-placement.js +3 -3
  273. package/dist/plot/core/utils/series-visibility.d.ts +26 -0
  274. package/dist/plot/{utils → core/utils}/series-visibility.js +29 -2
  275. package/dist/plot/core/utils.d.ts +12 -0
  276. package/dist/plot/core/utils.js +27 -0
  277. package/dist/plot/{Histogram.svelte → histogram/Histogram.svelte} +174 -551
  278. package/dist/plot/{Histogram.svelte.d.ts → histogram/Histogram.svelte.d.ts} +2 -2
  279. package/dist/plot/{HistogramControls.svelte → histogram/HistogramControls.svelte} +6 -6
  280. package/dist/plot/{HistogramControls.svelte.d.ts → histogram/HistogramControls.svelte.d.ts} +4 -4
  281. package/dist/plot/histogram/index.d.ts +2 -0
  282. package/dist/plot/histogram/index.js +2 -0
  283. package/dist/plot/index.d.ts +8 -41
  284. package/dist/plot/index.js +10 -39
  285. package/dist/plot/sankey/Sankey.svelte +697 -0
  286. package/dist/plot/sankey/Sankey.svelte.d.ts +74 -0
  287. package/dist/plot/sankey/SankeyControls.svelte +98 -0
  288. package/dist/plot/sankey/SankeyControls.svelte.d.ts +19 -0
  289. package/dist/plot/sankey/index.d.ts +4 -0
  290. package/dist/plot/sankey/index.js +3 -0
  291. package/dist/plot/sankey/sankey-types.d.ts +42 -0
  292. package/dist/plot/sankey/sankey-types.js +4 -0
  293. package/dist/plot/sankey/sankey.d.ts +52 -0
  294. package/dist/plot/sankey/sankey.js +189 -0
  295. package/dist/plot/{BinnedScatterPlot.svelte → scatter/BinnedScatterPlot.svelte} +64 -64
  296. package/dist/plot/{BinnedScatterPlot.svelte.d.ts → scatter/BinnedScatterPlot.svelte.d.ts} +6 -6
  297. package/dist/plot/{ElementScatter.svelte → scatter/ElementScatter.svelte} +6 -6
  298. package/dist/plot/{ElementScatter.svelte.d.ts → scatter/ElementScatter.svelte.d.ts} +2 -2
  299. package/dist/plot/{ScatterPlot.svelte → scatter/ScatterPlot.svelte} +297 -1008
  300. package/dist/plot/{ScatterPlot.svelte.d.ts → scatter/ScatterPlot.svelte.d.ts} +10 -18
  301. package/dist/plot/{ScatterPlotControls.svelte → scatter/ScatterPlotControls.svelte} +6 -5
  302. package/dist/plot/{ScatterPlotControls.svelte.d.ts → scatter/ScatterPlotControls.svelte.d.ts} +2 -2
  303. package/dist/plot/{ScatterPoint.svelte → scatter/ScatterPoint.svelte} +7 -7
  304. package/dist/plot/{ScatterPoint.svelte.d.ts → scatter/ScatterPoint.svelte.d.ts} +3 -3
  305. package/dist/plot/{adaptive-density.d.ts → scatter/adaptive-density.d.ts} +14 -4
  306. package/dist/plot/{adaptive-density.js → scatter/adaptive-density.js} +46 -20
  307. package/dist/plot/{binned-scatter-types.d.ts → scatter/binned-scatter-types.d.ts} +5 -12
  308. package/dist/plot/scatter/index.d.ts +7 -0
  309. package/dist/plot/scatter/index.js +5 -0
  310. package/dist/plot/scatter/scatter-data.d.ts +19 -0
  311. package/dist/plot/scatter/scatter-data.js +212 -0
  312. package/dist/plot/{ScatterPlot3D.svelte → scatter-3d/ScatterPlot3D.svelte} +25 -34
  313. package/dist/plot/{ScatterPlot3D.svelte.d.ts → scatter-3d/ScatterPlot3D.svelte.d.ts} +9 -17
  314. package/dist/plot/{ScatterPlot3DControls.svelte → scatter-3d/ScatterPlot3DControls.svelte} +14 -14
  315. package/dist/plot/{ScatterPlot3DControls.svelte.d.ts → scatter-3d/ScatterPlot3DControls.svelte.d.ts} +6 -6
  316. package/dist/plot/{ScatterPlot3DScene.svelte → scatter-3d/ScatterPlot3DScene.svelte} +129 -128
  317. package/dist/plot/{ScatterPlot3DScene.svelte.d.ts → scatter-3d/ScatterPlot3DScene.svelte.d.ts} +6 -15
  318. package/dist/plot/{Surface3D.svelte → scatter-3d/Surface3D.svelte} +7 -6
  319. package/dist/plot/{Surface3D.svelte.d.ts → scatter-3d/Surface3D.svelte.d.ts} +5 -4
  320. package/dist/plot/scatter-3d/index.d.ts +4 -0
  321. package/dist/plot/scatter-3d/index.js +4 -0
  322. package/dist/plot/sunburst/Sunburst.svelte +1041 -0
  323. package/dist/plot/sunburst/Sunburst.svelte.d.ts +97 -0
  324. package/dist/plot/sunburst/SunburstControls.svelte +200 -0
  325. package/dist/plot/sunburst/SunburstControls.svelte.d.ts +26 -0
  326. package/dist/plot/sunburst/index.d.ts +4 -0
  327. package/dist/plot/sunburst/index.js +4 -0
  328. package/dist/plot/sunburst/render.d.ts +34 -0
  329. package/dist/plot/sunburst/render.js +122 -0
  330. package/dist/plot/sunburst/sunburst.d.ts +62 -0
  331. package/dist/plot/sunburst/sunburst.js +269 -0
  332. package/dist/rdf/RdfPlot.svelte +2 -1
  333. package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
  334. package/dist/rdf/calc-rdf.js +11 -24
  335. package/dist/sanitize.js +14 -3
  336. package/dist/scene/SceneCamera.svelte +62 -0
  337. package/dist/scene/SceneCamera.svelte.d.ts +19 -0
  338. package/dist/scene/bind-renderer.svelte.d.ts +2 -0
  339. package/dist/scene/bind-renderer.svelte.js +14 -0
  340. package/dist/scene/index.d.ts +4 -0
  341. package/dist/scene/index.js +5 -0
  342. package/dist/scene/props.js +52 -0
  343. package/dist/scene/types.d.ts +26 -0
  344. package/dist/scene/types.js +1 -0
  345. package/dist/settings.d.ts +79 -3
  346. package/dist/settings.js +321 -1
  347. package/dist/spectral/Bands.svelte +47 -36
  348. package/dist/spectral/Bands.svelte.d.ts +6 -6
  349. package/dist/spectral/BandsAndDos.svelte +23 -25
  350. package/dist/spectral/BrillouinBandsDos.svelte +42 -30
  351. package/dist/spectral/Dos.svelte +15 -23
  352. package/dist/spectral/Dos.svelte.d.ts +4 -3
  353. package/dist/spectral/helpers.d.ts +8 -6
  354. package/dist/spectral/helpers.js +137 -65
  355. package/dist/state.svelte.d.ts +0 -7
  356. package/dist/state.svelte.js +0 -6
  357. package/dist/structure/Arrow.svelte +2 -4
  358. package/dist/structure/AtomLegend.svelte +8 -9
  359. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  360. package/dist/structure/CanvasTooltip.svelte +1 -0
  361. package/dist/structure/CellSelect.svelte +12 -5
  362. package/dist/structure/CellSelect.svelte.d.ts +2 -1
  363. package/dist/structure/Cylinder.svelte +12 -8
  364. package/dist/structure/Cylinder.svelte.d.ts +4 -1
  365. package/dist/structure/Lattice.svelte +2 -2
  366. package/dist/structure/Structure.svelte +365 -423
  367. package/dist/structure/Structure.svelte.d.ts +5 -15
  368. package/dist/structure/StructureControls.svelte +217 -2
  369. package/dist/structure/StructureControls.svelte.d.ts +5 -3
  370. package/dist/structure/StructureExportPane.svelte +54 -156
  371. package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
  372. package/dist/structure/StructureInfoPane.svelte +10 -9
  373. package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
  374. package/dist/structure/StructureScene.svelte +376 -208
  375. package/dist/structure/StructureScene.svelte.d.ts +22 -20
  376. package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
  377. package/dist/structure/{label-placement.js → atom-label-placement.js} +15 -5
  378. package/dist/structure/atom-properties.d.ts +1 -1
  379. package/dist/structure/atom-properties.js +17 -22
  380. package/dist/structure/bond-order-perception.js +3 -5
  381. package/dist/structure/bonding.d.ts +4 -0
  382. package/dist/structure/bonding.js +134 -63
  383. package/dist/structure/export.d.ts +24 -4
  384. package/dist/structure/export.js +89 -143
  385. package/dist/structure/index.d.ts +4 -4
  386. package/dist/structure/index.js +3 -3
  387. package/dist/structure/measure.d.ts +3 -2
  388. package/dist/structure/measure.js +6 -5
  389. package/dist/structure/parse.d.ts +3 -2
  390. package/dist/structure/parse.js +419 -438
  391. package/dist/structure/partial-occupancy.d.ts +0 -1
  392. package/dist/structure/partial-occupancy.js +1 -1
  393. package/dist/structure/pbc.d.ts +1 -1
  394. package/dist/structure/pbc.js +190 -13
  395. package/dist/structure/polyhedra.d.ts +41 -0
  396. package/dist/structure/polyhedra.js +602 -0
  397. package/dist/structure/site.d.ts +4 -0
  398. package/dist/structure/site.js +1 -0
  399. package/dist/structure/supercell.js +3 -2
  400. package/dist/structure/validation.js +5 -6
  401. package/dist/symmetry/SymmetryElementControls.svelte +69 -0
  402. package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
  403. package/dist/symmetry/SymmetryElements.svelte +354 -0
  404. package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
  405. package/dist/symmetry/SymmetryStats.svelte +113 -8
  406. package/dist/symmetry/WyckoffTable.svelte +68 -7
  407. package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
  408. package/dist/symmetry/cell-transform.js +7 -14
  409. package/dist/symmetry/index.d.ts +14 -4
  410. package/dist/symmetry/index.js +291 -72
  411. package/dist/symmetry/spacegroups.d.ts +12 -1
  412. package/dist/symmetry/spacegroups.js +63 -14
  413. package/dist/symmetry/symmetry-elements.d.ts +33 -0
  414. package/dist/symmetry/symmetry-elements.js +521 -0
  415. package/dist/symmetry/wyckoff-db.d.ts +9 -0
  416. package/dist/symmetry/wyckoff-db.js +87 -0
  417. package/dist/table/HeatmapTable.svelte +66 -25
  418. package/dist/table/HeatmapTable.svelte.d.ts +1 -1
  419. package/dist/table/index.d.ts +1 -3
  420. package/dist/table/index.js +1 -1
  421. package/dist/theme/index.js +8 -8
  422. package/dist/tooltip/KCoords.svelte +45 -0
  423. package/dist/tooltip/KCoords.svelte.d.ts +8 -0
  424. package/dist/tooltip/index.d.ts +1 -0
  425. package/dist/tooltip/index.js +1 -0
  426. package/dist/trajectory/Trajectory.svelte +123 -100
  427. package/dist/trajectory/Trajectory.svelte.d.ts +11 -22
  428. package/dist/trajectory/TrajectoryExportPane.svelte +17 -25
  429. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
  430. package/dist/trajectory/TrajectoryInfoPane.svelte +5 -3
  431. package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
  432. package/dist/trajectory/constants.js +6 -2
  433. package/dist/trajectory/extract.js +17 -37
  434. package/dist/trajectory/format-detect.d.ts +1 -1
  435. package/dist/trajectory/format-detect.js +27 -19
  436. package/dist/trajectory/frame-reader.d.ts +0 -1
  437. package/dist/trajectory/frame-reader.js +63 -162
  438. package/dist/trajectory/helpers.d.ts +10 -2
  439. package/dist/trajectory/helpers.js +56 -36
  440. package/dist/trajectory/index.js +1 -1
  441. package/dist/trajectory/parse/ase.d.ts +9 -1
  442. package/dist/trajectory/parse/ase.js +47 -32
  443. package/dist/trajectory/parse/diagnostics.d.ts +3 -0
  444. package/dist/trajectory/parse/diagnostics.js +14 -0
  445. package/dist/trajectory/parse/hdf5.js +1 -1
  446. package/dist/trajectory/parse/index.d.ts +1 -1
  447. package/dist/trajectory/parse/index.js +65 -105
  448. package/dist/trajectory/parse/lammps.d.ts +0 -2
  449. package/dist/trajectory/parse/lammps.js +8 -6
  450. package/dist/trajectory/parse/pymatgen.d.ts +2 -0
  451. package/dist/trajectory/parse/pymatgen.js +74 -0
  452. package/dist/trajectory/parse/vasp.js +38 -18
  453. package/dist/trajectory/parse/xyz.d.ts +13 -1
  454. package/dist/trajectory/parse/xyz.js +102 -94
  455. package/dist/trajectory/plotting.d.ts +1 -2
  456. package/dist/trajectory/plotting.js +16 -113
  457. package/dist/utils.d.ts +2 -0
  458. package/dist/utils.js +7 -5
  459. package/dist/xrd/XrdPlot.svelte +16 -30
  460. package/dist/xrd/broadening.d.ts +2 -1
  461. package/dist/xrd/calc-xrd.js +18 -20
  462. package/dist/xrd/index.d.ts +2 -2
  463. package/dist/xrd/parse.js +2 -2
  464. package/package.json +43 -26
  465. package/dist/element/data.json +0 -11864
  466. package/dist/fermi-surface/marching-cubes.d.ts +0 -2
  467. package/dist/fermi-surface/marching-cubes.js +0 -2
  468. package/dist/plot/PlotControls.svelte.d.ts +0 -4
  469. package/dist/plot/axis-utils.d.ts +0 -19
  470. package/dist/plot/axis-utils.js +0 -78
  471. package/dist/plot/defaults.d.ts +0 -19
  472. package/dist/plot/defaults.js +0 -9
  473. package/dist/plot/fill-utils.d.ts +0 -46
  474. package/dist/plot/fill-utils.js +0 -322
  475. package/dist/plot/hover-lock.svelte.d.ts +0 -14
  476. package/dist/plot/hover-lock.svelte.js +0 -46
  477. package/dist/plot/interactions.d.ts +0 -12
  478. package/dist/plot/interactions.js +0 -101
  479. package/dist/plot/scales.d.ts +0 -48
  480. package/dist/plot/svg.d.ts +0 -1
  481. package/dist/plot/svg.js +0 -11
  482. package/dist/plot/utils/series-visibility.d.ts +0 -15
  483. package/dist/plot/utils.d.ts +0 -1
  484. package/dist/plot/utils.js +0 -14
  485. /package/dist/plot/{PortalSelect.svelte.d.ts → core/components/PortalSelect.svelte.d.ts} +0 -0
  486. /package/dist/plot/{binned-scatter-types.js → scatter/binned-scatter-types.js} +0 -0
@@ -1,5 +1,5 @@
1
- import * as math from '../math';
2
- import { get_arcsinh_threshold, get_scale_type_name, is_time_scale } from './types';
1
+ import * as math from '../../math';
2
+ import { get_arcsinh_threshold, get_scale_type_name, is_time_scale, } from './types';
3
3
  import { extent, range } from 'd3-array';
4
4
  import { scaleLinear, scaleLog, scaleSequential, scaleSequentialLog, scaleTime, } from 'd3-scale';
5
5
  import * as d3_sc from 'd3-scale-chromatic';
@@ -33,8 +33,8 @@ export function scale_arcsinh(threshold = 1) {
33
33
  // Linear interpolation in transformed space
34
34
  if (t_max === t_min)
35
35
  return (r_min + r_max) / 2;
36
- const t = (t_val - t_min) / (t_max - t_min);
37
- return r_min + t * (r_max - r_min);
36
+ const frac = (t_val - t_min) / (t_max - t_min);
37
+ return r_min + frac * (r_max - r_min);
38
38
  });
39
39
  // Domain getter/setter
40
40
  scale.domain = function (domain) {
@@ -63,8 +63,8 @@ export function scale_arcsinh(threshold = 1) {
63
63
  // Inverse linear interpolation
64
64
  if (r_max === r_min)
65
65
  return (d_min + d_max) / 2;
66
- const t = (value - r_min) / (r_max - r_min);
67
- const t_val = t_min + t * (t_max - t_min);
66
+ const frac = (value - r_min) / (r_max - r_min);
67
+ const t_val = t_min + frac * (t_max - t_min);
68
68
  // Inverse transform
69
69
  return sinh_transform(t_val);
70
70
  };
@@ -83,9 +83,8 @@ export function scale_arcsinh(threshold = 1) {
83
83
  return scale;
84
84
  }
85
85
  // Generate nice tick values for arcsinh scale
86
- // Strategy: symmetric around zero when possible, with powers of 10 for large values
87
- // Note: For small count values (1 or 2) on mixed ranges, zero takes priority as the
88
- // most important tick. E.g., count=1 yields [0], count=2 yields [0] plus one boundary.
86
+ // Strategy: symmetric around zero when possible, with powers of 10 for large values.
87
+ // On mixed ranges, count=1 yields just [0]; count>=2 yields zero plus symmetric powers per side.
89
88
  export function generate_arcsinh_ticks(min, max, threshold = 1, count = 10) {
90
89
  // Guard against invalid/non-positive threshold to prevent division issues
91
90
  const safe_threshold = Math.max(threshold, Number.EPSILON);
@@ -101,9 +100,10 @@ export function generate_arcsinh_ticks(min, max, threshold = 1, count = 10) {
101
100
  .map((tick) => -tick)
102
101
  .toReversed();
103
102
  }
104
- // Mixed range: symmetric ticks around zero (includes_zero is always true here)
105
- // For very small counts, we prioritize zero as the most meaningful tick
106
- const half_count = Math.floor((count - 1) / 2);
103
+ // Mixed range: symmetric ticks around zero (includes_zero is always here). Split the budget
104
+ // across both sides (zero is shared/free) so e.g. count=4 yields ~5 ticks (0, ±a, ±b) rather
105
+ // than collapsing to 3 matching how linear/log colorbars render a similar count.
106
+ const half_count = Math.floor(count / 2);
107
107
  const ticks = [0];
108
108
  // Add positive ticks
109
109
  const pos_ticks = generate_positive_arcsinh_ticks(0, hi, safe_threshold, half_count);
@@ -111,19 +111,6 @@ export function generate_arcsinh_ticks(min, max, threshold = 1, count = 10) {
111
111
  // Add negative ticks (mirror of positive)
112
112
  const neg_ticks = generate_positive_arcsinh_ticks(0, -lo, safe_threshold, half_count);
113
113
  ticks.push(...neg_ticks.filter((tick) => tick > 0).map((tick) => -tick));
114
- // For small counts where half_count is 0 or 1, ensure at least some boundary coverage
115
- if (half_count <= 1 && count >= 2) {
116
- // Add boundaries if not already present and we have room
117
- const sorted = dedupe_sort(ticks);
118
- if (sorted.length < count) {
119
- // Snap the larger-magnitude boundary to a clean power of 10 (raw extremes would render
120
- // as long unrounded labels); keeps some coverage for very small tick counts.
121
- const boundary = Math.abs(hi) >= Math.abs(lo) ? hi : lo;
122
- const nice = Math.sign(boundary) * 10 ** Math.floor(Math.log10(Math.abs(boundary)));
123
- if (Number.isFinite(nice) && nice !== 0 && !sorted.includes(nice))
124
- ticks.push(nice);
125
- }
126
- }
127
114
  return dedupe_sort(ticks);
128
115
  }
129
116
  // Generate positive arcsinh ticks (helper)
@@ -133,46 +120,49 @@ function generate_positive_arcsinh_ticks(min, max, threshold, count) {
133
120
  if (count <= 0 || max <= min)
134
121
  return [];
135
122
  const ticks = [];
136
- // For values near threshold, use linear-like spacing
137
- // For values >> threshold, use log-like spacing (powers of 10)
123
+ // Small range near threshold: use linear-like spacing
138
124
  if (max <= threshold * 2) {
139
- // Small range: use linear ticks
140
125
  const step = (max - min) / count;
141
126
  for (let idx = 0; idx <= count; idx++) {
142
127
  const val = min + step * idx;
143
128
  if (val >= min && val <= max)
144
129
  ticks.push(val);
145
130
  }
131
+ return dedupe_sort(ticks);
146
132
  }
147
- else {
148
- // Large range: combine linear near zero with powers of 10.
149
- // Domain endpoints are intentionally NOT added as ticks: raw extremes render as long
150
- // unrounded labels (e.g. 1325.8239811994677). Powers of 10 plus 2x/5x multiples below
151
- // already give clean round ticks; pass axis.ticks/axis.format for custom labels.
152
- // Add threshold as a tick if in range
153
- if (threshold >= min && threshold <= max)
154
- ticks.push(threshold);
155
- // Add powers of 10 that are in range
156
- const min_power = Math.floor(Math.log10(Math.max(min, threshold / 10)));
157
- const max_power = Math.ceil(Math.log10(max));
158
- for (let power = min_power; power <= max_power; power++) {
159
- const val = Math.pow(10, power);
160
- if (val >= min && val <= max)
161
- ticks.push(val);
162
- }
163
- // Add intermediate values (2x, 5x) for sparser regions
164
- if (ticks.length < count) {
165
- for (let power = min_power; power < max_power; power++) {
166
- const base = Math.pow(10, power);
167
- for (const mult of [2, 5]) {
168
- const val = base * mult;
169
- if (val >= min && val <= max)
170
- ticks.push(val);
171
- }
133
+ // Large range: log-like spacing via powers of 10.
134
+ // Domain endpoints are intentionally NOT added as ticks: raw extremes render as long
135
+ // unrounded labels (e.g. 1325.8239811994677). Powers of 10 plus 2x/5x multiples below
136
+ // already give clean round ticks; pass axis.ticks/axis.format for custom labels.
137
+ // Add threshold as a tick if in range
138
+ if (threshold >= min && threshold <= max)
139
+ ticks.push(threshold);
140
+ // Add powers of 10 that are in range. Start at the threshold (not a decade below): values
141
+ // below it sit in arcsinh's near-linear region and map almost onto 0, so sub-threshold powers
142
+ // (e.g. ±1 when threshold=10) would pile up on the zero tick and overlap.
143
+ const min_power = Math.floor(Math.log10(Math.max(min, threshold)));
144
+ const max_power = Math.ceil(Math.log10(max));
145
+ for (let power = min_power; power <= max_power; power++) {
146
+ const val = 10 ** power;
147
+ if (val >= min && val <= max)
148
+ ticks.push(val);
149
+ }
150
+ // Add intermediate values (2x, 5x) for sparser regions
151
+ if (ticks.length < count) {
152
+ for (let power = min_power; power < max_power; power++) {
153
+ const base = 10 ** power;
154
+ for (const mult of [2, 5]) {
155
+ const val = base * mult;
156
+ if (val >= min && val <= max)
157
+ ticks.push(val);
172
158
  }
173
159
  }
174
160
  }
175
- return dedupe_sort(ticks);
161
+ const result = dedupe_sort(ticks);
162
+ // Respect `count`: surplus small powers sit near zero in arcsinh space (their values map almost
163
+ // onto 0) and crowd the labels. Keep the largest-magnitude ticks — they anchor the range extent
164
+ // and are the most spread out — dropping near-zero ones first.
165
+ return result.length > count ? result.slice(-count) : result;
176
166
  }
177
167
  // Create a scale function based on type, domain, and range
178
168
  // Note: Time scales are handled separately via create_time_scale() since ScaleTime
@@ -182,8 +172,13 @@ export function create_scale(scale_type, domain, output_range) {
182
172
  const [min_val, max_val] = domain;
183
173
  const type_name = get_scale_type_name(scale_type);
184
174
  if (type_name === `log`) {
175
+ // Clamp BOTH ends to the positive floor: panning shifts ranges linearly, so a
176
+ // log axis panned past zero can arrive with max <= 0 — an unclamped max makes
177
+ // every scale output (and invert) NaN, blanking the chart and polluting axis
178
+ // ranges. A clamped degenerate domain just renders flat and stays recoverable.
179
+ const lo = Math.max(min_val, math.LOG_EPS);
185
180
  return scaleLog()
186
- .domain([Math.max(min_val, math.LOG_EPS), max_val])
181
+ .domain([lo, Math.max(max_val, lo)])
187
182
  .range(output_range);
188
183
  }
189
184
  if (type_name === `arcsinh`) {
@@ -229,15 +224,17 @@ options = {}) {
229
224
  const ticks = time_scale.ticks(count);
230
225
  if (typeof ticks_option === `string`) {
231
226
  if (ticks_option === `month`) {
232
- return ticks.filter((d) => d.getDate() === 1).map((d) => d.getTime());
227
+ return ticks
228
+ .filter((date) => date.getDate() === 1)
229
+ .map((date) => date.getTime());
233
230
  }
234
231
  if (ticks_option === `year`) {
235
232
  return ticks
236
- .filter((d) => d.getMonth() === 0 && d.getDate() === 1)
237
- .map((d) => d.getTime());
233
+ .filter((date) => date.getMonth() === 0 && date.getDate() === 1)
234
+ .map((date) => date.getTime());
238
235
  }
239
236
  }
240
- return ticks.map((d) => d.getTime());
237
+ return ticks.map((date) => date.getTime());
241
238
  }
242
239
  const type_name = get_scale_type_name(scale_type);
243
240
  // Log scale ticks
@@ -284,15 +281,15 @@ export function get_nice_data_range(points, get_value, limits, scale_type, paddi
284
281
  const span = data_max - data_min;
285
282
  if (is_time) {
286
283
  const padding_ms = span * padding_factor;
287
- data_min = data_min - padding_ms;
288
- data_max = data_max + padding_ms;
284
+ data_min -= padding_ms;
285
+ data_max += padding_ms;
289
286
  }
290
287
  else if (type_name === `log`) {
291
288
  const log_min = Math.log10(Math.max(data_min, math.LOG_EPS));
292
289
  const log_max = Math.log10(Math.max(data_max, math.LOG_EPS));
293
290
  const log_span = log_max - log_min;
294
- data_min = Math.pow(10, log_min - log_span * padding_factor);
295
- data_max = Math.pow(10, log_max + log_span * padding_factor);
291
+ data_min = 10 ** (log_min - log_span * padding_factor);
292
+ data_max = 10 ** (log_max + log_span * padding_factor);
296
293
  }
297
294
  else if (type_name === `arcsinh`) {
298
295
  // Arcsinh: apply padding in arcsinh-transformed space
@@ -307,35 +304,33 @@ export function get_nice_data_range(points, get_value, limits, scale_type, paddi
307
304
  else {
308
305
  // Linear scale
309
306
  const padding_abs = span * padding_factor;
310
- data_min = data_min - padding_abs;
311
- data_max = data_max + padding_abs;
307
+ data_min -= padding_abs;
308
+ data_max += padding_abs;
312
309
  }
310
+ // Handle single data point case with fixed relative padding
311
+ }
312
+ else if (is_time) {
313
+ const one_day = 86_400_000; // milliseconds in a day
314
+ data_min -= one_day;
315
+ data_max += one_day;
316
+ }
317
+ else if (type_name === `log`) {
318
+ data_min = Math.max(math.LOG_EPS, data_min / 1.1); // 10% multiplicative padding
319
+ data_max *= 1.1;
320
+ }
321
+ else if (type_name === `arcsinh`) {
322
+ // Arcsinh: 10% padding in transformed space
323
+ // Guard against extremely small thresholds that could cause precision issues
324
+ const threshold = Math.max(get_arcsinh_threshold(scale_type), Number.EPSILON);
325
+ const asinh_val = Math.asinh(data_min / threshold);
326
+ const padding = Math.abs(asinh_val) * 0.1 || 0.1; // Use 0.1 if transformed value is 0 (i.e. data_min = 0)
327
+ data_min = Math.sinh(asinh_val - padding) * threshold;
328
+ data_max = Math.sinh(asinh_val + padding) * threshold;
313
329
  }
314
330
  else {
315
- // Handle single data point case with fixed relative padding
316
- if (is_time) {
317
- const one_day = 86_400_000; // milliseconds in a day
318
- data_min = data_min - one_day;
319
- data_max = data_max + one_day;
320
- }
321
- else if (type_name === `log`) {
322
- data_min = Math.max(math.LOG_EPS, data_min / 1.1); // 10% multiplicative padding
323
- data_max = data_max * 1.1;
324
- }
325
- else if (type_name === `arcsinh`) {
326
- // Arcsinh: 10% padding in transformed space
327
- // Guard against extremely small thresholds that could cause precision issues
328
- const threshold = Math.max(get_arcsinh_threshold(scale_type), Number.EPSILON);
329
- const asinh_val = Math.asinh(data_min / threshold);
330
- const padding = Math.abs(asinh_val) * 0.1 || 0.1; // Use 0.1 if transformed value is 0 (i.e. data_min = 0)
331
- data_min = Math.sinh(asinh_val - padding) * threshold;
332
- data_max = Math.sinh(asinh_val + padding) * threshold;
333
- }
334
- else {
335
- const padding_abs = data_min === 0 ? 1 : Math.abs(data_min * 0.1); // 10% additive padding, or 1 if value is 0
336
- data_min = data_min - padding_abs;
337
- data_max = data_max + padding_abs;
338
- }
331
+ const padding_abs = data_min === 0 ? 1 : Math.abs(data_min * 0.1); // 10% additive padding, or 1 if value is 0
332
+ data_min -= padding_abs;
333
+ data_max += padding_abs;
339
334
  }
340
335
  }
341
336
  // If time or no range after padding, return the (potentially padded) domain directly
@@ -371,20 +366,26 @@ export function generate_log_ticks(min, max, ticks_option) {
371
366
  const range_size = max_power - min_power;
372
367
  const extended_min_power = range_size <= 2 ? min_power - 1 : min_power - Math.max(1, Math.floor(range_size / 4));
373
368
  const extended_max_power = range_size <= 2 ? max_power + 1 : max_power;
374
- const powers = range(extended_min_power, extended_max_power + 1).map((power) => Math.pow(10, power));
369
+ const powers = range(extended_min_power, extended_max_power + 1).map((power) => 10 ** power);
375
370
  // For narrow ranges, include intermediate values
376
371
  if (max_power - min_power < 3 && typeof ticks_option === `number` && ticks_option > 5) {
377
372
  const detailed_ticks = [];
378
373
  powers.forEach((power) => {
379
374
  detailed_ticks.push(power);
380
- if (power * 2 <= Math.pow(10, extended_max_power))
375
+ if (power * 2 <= 10 ** extended_max_power)
381
376
  detailed_ticks.push(power * 2);
382
- if (power * 5 <= Math.pow(10, extended_max_power))
377
+ if (power * 5 <= 10 ** extended_max_power)
383
378
  detailed_ticks.push(power * 5);
384
379
  });
385
380
  return detailed_ticks.filter((tick) => tick >= min && tick <= max);
386
381
  }
387
- return powers.filter((power) => power >= min && power <= max);
382
+ const filtered_powers = powers.filter((power) => power >= min && power <= max);
383
+ if (filtered_powers.length >= 2)
384
+ return filtered_powers;
385
+ // Sub-decade domains (e.g. after zoom) have <2 powers of 10 — use d3's mantissa log ticks
386
+ const tick_count = typeof ticks_option === `number` && ticks_option > 0 ? ticks_option : 5;
387
+ const fallback = scaleLog().domain([min, max]).ticks(tick_count);
388
+ return fallback.length > 0 ? fallback : filtered_powers;
388
389
  }
389
390
  // Get custom label for a tick value if provided, otherwise return null
390
391
  export function get_tick_label(tick_value, ticks_option) {
@@ -0,0 +1,3 @@
1
+ import type { Vec2 } from '../../math';
2
+ export declare function violin_path(grid_px: readonly number[], half_offsets_px: readonly number[], center: number, side: `both` | `positive` | `negative`, orient: (cross: number, val: number) => Vec2): string;
3
+ export declare function bar_path(x: number, y: number, w: number, h: number, r: number, vertical?: boolean): string;
@@ -0,0 +1,41 @@
1
+ // SVG path and rendering utilities for plot components.
2
+ // Build a closed SVG path for a violin (KDE density) shape.
3
+ // `grid_px` are value-axis pixel positions, `half_offsets_px` the category-axis half-widths
4
+ // (>= 0) at each grid point, `center` the category-axis center pixel. `orient(cross, val)`
5
+ // swaps coordinates for orientation (vertical: [cross, val], horizontal: [val, cross]).
6
+ // `both` mirrors density around the center; `positive`/`negative` draw one half against the
7
+ // center line. Linear interpolation between grid points (no curve overshoot).
8
+ export function violin_path(grid_px, half_offsets_px, center, side, orient) {
9
+ const n_pts = grid_px.length;
10
+ if (n_pts === 0)
11
+ return ``;
12
+ const pts = [];
13
+ if (side === `both`) {
14
+ for (let idx = 0; idx < n_pts; idx++) {
15
+ pts.push(orient(center + half_offsets_px[idx], grid_px[idx]));
16
+ }
17
+ for (let idx = n_pts - 1; idx >= 0; idx--) {
18
+ pts.push(orient(center - half_offsets_px[idx], grid_px[idx]));
19
+ }
20
+ }
21
+ else {
22
+ const sign = side === `negative` ? -1 : 1;
23
+ for (let idx = 0; idx < n_pts; idx++) {
24
+ pts.push(orient(center + sign * half_offsets_px[idx], grid_px[idx]));
25
+ }
26
+ // straight inner edge back along the center line
27
+ pts.push(orient(center, grid_px[n_pts - 1]));
28
+ pts.push(orient(center, grid_px[0]));
29
+ }
30
+ return `M${pts.map(([x_pos, y_pos]) => `${x_pos},${y_pos}`).join(`L`)}Z`;
31
+ }
32
+ //
33
+ // Generate SVG path for a bar with rounded corners on the "free" end (away from axis).
34
+ // For vertical bars, rounds top corners. For horizontal bars, rounds right corners.
35
+ export function bar_path(x, y, w, h, r, vertical = true) {
36
+ if (r <= 0)
37
+ return `M${x},${y}h${w}v${h}h${-w}Z`;
38
+ return vertical
39
+ ? `M${x},${y + h}V${y + r}A${r},${r} 0 0 1 ${x + r},${y}H${x + w - r}A${r},${r} 0 0 1 ${x + w},${y + r}V${y + h}Z`
40
+ : `M${x},${y}H${x + w - r}A${r},${r} 0 0 1 ${x + w},${y + r}V${y + h - r}A${r},${r} 0 0 1 ${x + w - r},${y + h}H${x}Z`;
41
+ }
@@ -1,13 +1,18 @@
1
- import type { D3SymbolName } from '../labels';
2
- import type { Point2D, Point3D, Vec2, Vec3 } from '../math';
3
- import type DraggablePane from '../overlays/DraggablePane.svelte';
1
+ import type { PaneProps, PaneToggleProps } from '../../overlays';
2
+ import type { D3ColorSchemeName, D3InterpolateName } from '../../colors';
3
+ import type { D3SymbolName } from '../../labels';
4
+ import type { Point2D, Point3D, Vec2, Vec3 } from '../../math';
4
5
  import type { ComponentProps, Snippet } from 'svelte';
5
6
  import type { HTMLAttributes } from 'svelte/elements';
6
7
  import type { TweenOptions } from 'svelte/motion';
7
- export type { TweenOptions } from 'svelte/motion';
8
8
  import type { Sides } from './layout';
9
- import type PlotLegend from './PlotLegend.svelte';
9
+ import type PlotLegend from './components/PlotLegend.svelte';
10
10
  import type { TicksOption } from './scales';
11
+ export type { TweenOptions } from 'svelte/motion';
12
+ export type { BandwidthOption, BoxHandlerProps, BoxPlotSeries, ViolinKind, ViolinSide, WhiskerMode, } from '../box/box-plot';
13
+ export type { CleaningConfig, CleaningQuality, CleaningResult, InstabilityResult, InvalidValueMode, LocalOutlierConfig, LocalOutlierResult, OscillationWeights, PhysicalBounds, SmoothingConfig, TruncationMode, } from './data-cleaning';
14
+ export type { SankeyData, SankeyHandlerProps, SankeyLink, SankeyLinkColorMode, SankeyLinkHandlerProps, SankeyNode, SankeyNodeAlign, SankeyNodeHandlerProps, SankeyOrientation, } from '../sankey/sankey-types';
15
+ export type { SunburstLabelRotation, SunburstLabelText, SunburstNode, SunburstNodeHandlerProps, SunburstShape, SunburstSort, SunburstValueMode, } from '../sunburst/sunburst';
11
16
  export type XyShift = {
12
17
  x?: number;
13
18
  y?: number;
@@ -18,6 +23,12 @@ export type InitialRanges = {
18
23
  initial_y_range: Vec2;
19
24
  initial_y2_range: Vec2;
20
25
  };
26
+ export type AxisRanges = {
27
+ x: Vec2;
28
+ x2: Vec2;
29
+ y: Vec2;
30
+ y2: Vec2;
31
+ };
21
32
  export type Point<Metadata = Record<string, unknown>> = {
22
33
  x: number;
23
34
  y: number;
@@ -179,6 +190,16 @@ export interface ArcsinhScaleConfig {
179
190
  threshold?: number;
180
191
  }
181
192
  export type ScaleType = `linear` | `log` | `arcsinh` | `time` | ArcsinhScaleConfig;
193
+ export type ColorScaleConfig = {
194
+ type?: ScaleType;
195
+ scheme?: D3ColorSchemeName | D3InterpolateName;
196
+ value_range?: Vec2;
197
+ };
198
+ export type SizeScaleConfig = {
199
+ type?: ScaleType;
200
+ radius_range?: Vec2;
201
+ value_range?: Vec2;
202
+ };
182
203
  export declare const is_scale_type_name: (val: string) => val is ScaleTypeName;
183
204
  export declare function get_scale_type_name(scale_type: ScaleType | undefined): ScaleTypeName;
184
205
  export declare function get_arcsinh_threshold(scale_type: ScaleType | undefined): number;
@@ -374,8 +395,8 @@ export interface PlotConfig {
374
395
  export interface ControlsConfig {
375
396
  show?: boolean;
376
397
  open?: boolean;
377
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
378
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
398
+ toggle_props?: PaneToggleProps;
399
+ pane_props?: PaneProps;
379
400
  }
380
401
  export interface PanConfig {
381
402
  enabled?: boolean;
@@ -402,21 +423,17 @@ export interface PlotControlsProps extends PlotConfig {
402
423
  show_ticks?: boolean;
403
424
  controls_title?: string;
404
425
  controls_class?: string;
405
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
406
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
426
+ toggle_props?: PaneToggleProps;
427
+ pane_props?: PaneProps;
407
428
  }
408
429
  export interface BasePlotProps {
409
- x_range?: [number | null, number | null];
410
- x2_range?: [number | null, number | null];
411
- y_range?: [number | null, number | null];
412
- y2_range?: [number | null, number | null];
413
430
  range_padding?: number;
414
431
  padding?: Sides;
415
432
  hovered?: boolean;
416
433
  show_controls?: boolean;
417
434
  controls_open?: boolean;
418
- controls_toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
419
- controls_pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
435
+ controls_toggle_props?: PaneToggleProps;
436
+ controls_pane_props?: PaneProps;
420
437
  fullscreen?: boolean;
421
438
  fullscreen_toggle?: boolean;
422
439
  change?: (data: Record<string, unknown> | null) => void;
@@ -435,7 +452,7 @@ export type Corner = (typeof CORNER_CELLS)[number];
435
452
  export declare const DEFAULT_GRID_STYLE: {
436
453
  readonly stroke: "var(--border-color, gray)";
437
454
  readonly 'stroke-dasharray': "4";
438
- readonly 'stroke-width': "1";
455
+ readonly 'stroke-width': "0.5";
439
456
  };
440
457
  export declare const DEFAULT_MARKERS: "line+points";
441
458
  export declare const DEFAULT_SERIES_COLORS: readonly ["#4e79a7", "#f28e2c", "#e15759", "#76b7b2", "#59a14f", "#edc949", "#af7aa1", "#ff9da7", "#9c755f", "#bab0ab"];
@@ -544,6 +561,7 @@ export type FillBoundary = {
544
561
  } | {
545
562
  type: `data`;
546
563
  values: readonly number[];
564
+ x?: readonly number[];
547
565
  } | number;
548
566
  export interface FillGradient {
549
567
  type: `linear` | `radial`;
@@ -566,6 +584,8 @@ export interface FillHoverStyle {
566
584
  edge?: FillEdgeStyle;
567
585
  cursor?: string;
568
586
  scale?: number;
587
+ stroke?: string;
588
+ stroke_width?: number;
569
589
  }
570
590
  export interface FillHandlerEvent {
571
591
  event: MouseEvent | KeyboardEvent;
@@ -760,72 +780,3 @@ export type RefPlane = RefPlaneBase & ({
760
780
  p2: Vec3;
761
781
  p3: Vec3;
762
782
  });
763
- export interface OscillationWeights {
764
- derivative_variance?: number;
765
- amplitude_growth?: number;
766
- sign_changes?: number;
767
- }
768
- export type InvalidValueMode = `remove` | `propagate` | `interpolate`;
769
- export type TruncationMode = `hard_cut` | `mark_unstable`;
770
- export interface PhysicalBounds {
771
- min?: number | ((x: number) => number);
772
- max?: number | ((x: number) => number);
773
- mode?: `clamp` | `filter` | `null`;
774
- }
775
- export type SmoothingConfig = {
776
- type: `moving_avg`;
777
- window: number;
778
- } | {
779
- type: `savgol`;
780
- window: number;
781
- polynomial_order?: number;
782
- } | {
783
- type: `gaussian`;
784
- sigma: number;
785
- };
786
- export interface LocalOutlierConfig {
787
- window_half?: number;
788
- mad_threshold?: number;
789
- max_iterations?: number;
790
- }
791
- export interface LocalOutlierResult {
792
- kept_indices: number[];
793
- removed_indices: number[];
794
- iterations_used: number;
795
- }
796
- export interface CleaningConfig {
797
- oscillation_threshold?: number;
798
- oscillation_weights?: OscillationWeights;
799
- window_size?: number;
800
- invalid_values?: InvalidValueMode;
801
- bounds?: PhysicalBounds;
802
- smooth?: SmoothingConfig;
803
- local_outliers?: LocalOutlierConfig;
804
- truncation_mode?: TruncationMode;
805
- in_place?: boolean;
806
- }
807
- export interface CleaningQuality {
808
- points_removed: number;
809
- invalid_values_found: number;
810
- oscillation_detected: boolean;
811
- oscillation_score?: number;
812
- bounds_violations: number;
813
- outliers_removed?: number;
814
- stable_range?: Vec2;
815
- truncated_at_x?: number;
816
- }
817
- export interface CleaningResult<T = DataSeries> {
818
- series: T;
819
- quality: CleaningQuality;
820
- }
821
- export interface InstabilityResult {
822
- detected: boolean;
823
- onset_index: number;
824
- onset_x: number;
825
- combined_score: number;
826
- method_scores: {
827
- derivative_variance: number;
828
- amplitude_growth: number;
829
- sign_changes: number;
830
- };
831
- }
@@ -51,7 +51,7 @@ export const CORNER_CELLS = [`top-left`, `top-right`, `bottom-left`, `bottom-rig
51
51
  export const DEFAULT_GRID_STYLE = {
52
52
  stroke: `var(--border-color, gray)`,
53
53
  'stroke-dasharray': `4`,
54
- 'stroke-width': `1`,
54
+ 'stroke-width': `0.5`,
55
55
  };
56
56
  export const DEFAULT_MARKERS = `line+points`;
57
57
  // Default series colors for auto-differentiation (similar to d3 schemeTableau10)
@@ -1,5 +1,5 @@
1
- import type { Point2D } from '../../math';
2
- import type { AxisConfig, DataSeries } from '..';
1
+ import type { Point2D } from '../../../math';
2
+ import type { AxisConfig, DataSeries } from '../..';
3
3
  import type { PlotScaleFn } from '../scales';
4
4
  import type { LabelPlacementConfig, LabelPlacementWeights } from '../types';
5
5
  export interface Rect {
@@ -42,7 +42,7 @@ export interface LeaderLineOptions {
42
42
  }
43
43
  export declare function parse_font_size(size_str?: string): number;
44
44
  export declare function estimate_label_size(text: string, font_size_str?: string): LabelSize;
45
- export declare function rect_overlap_area(a: Rect, b: Rect): number;
45
+ export declare function rect_overlap_area(rect_a: Rect, rect_b: Rect): number;
46
46
  export declare function rect_circle_overlap(rect: Rect, cx: number, cy: number, radius: number): number;
47
47
  export declare function segments_intersect(ax1: number, ay1: number, ax2: number, ay2: number, bx1: number, by1: number, bx2: number, by2: number): boolean;
48
48
  export declare function segment_rect_intersects(sx1: number, sy1: number, sx2: number, sy2: number, rect: Rect): boolean;
@@ -34,9 +34,9 @@ export function estimate_label_size(text, font_size_str) {
34
34
  };
35
35
  }
36
36
  // === Geometry helpers ===
37
- export function rect_overlap_area(a, b) {
38
- const ox = Math.max(0, Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x));
39
- const oy = Math.max(0, Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y));
37
+ export function rect_overlap_area(rect_a, rect_b) {
38
+ const ox = Math.max(0, Math.min(rect_a.x + rect_a.w, rect_b.x + rect_b.w) - Math.max(rect_a.x, rect_b.x));
39
+ const oy = Math.max(0, Math.min(rect_a.y + rect_a.h, rect_b.y + rect_b.h) - Math.max(rect_a.y, rect_b.y));
40
40
  return ox * oy;
41
41
  }
42
42
  export function rect_circle_overlap(rect, cx, cy, radius) {
@@ -0,0 +1,26 @@
1
+ type VisSeries = {
2
+ label?: string | null;
3
+ unit?: string;
4
+ y_axis?: string;
5
+ visible?: boolean;
6
+ x?: unknown;
7
+ y?: unknown;
8
+ };
9
+ type SeriesSource = [string, string, string, ...unknown[]];
10
+ export type SeriesVisibilitySnapshot = {
11
+ visibility: boolean[];
12
+ source: SeriesSource[];
13
+ };
14
+ export declare function have_compatible_units(series1: VisSeries, series2: VisSeries): boolean;
15
+ export declare function toggle_series_visibility<Series extends VisSeries>(series: Series[], series_idx: number): Series[];
16
+ export declare function toggle_group_visibility<Series extends VisSeries>(series: Series[], series_indices: number[]): Series[];
17
+ export declare function handle_legend_double_click<Series extends VisSeries>(series: Series[], idx: number, prev_snapshot: SeriesVisibilitySnapshot | null): {
18
+ series: Series[];
19
+ prev_visibility: SeriesVisibilitySnapshot | null;
20
+ };
21
+ export declare function create_legend_visibility<Series extends VisSeries>(get_series: () => Series[], set_series: (series: Series[]) => void): {
22
+ on_toggle: (series_idx: number) => void;
23
+ on_group_toggle: (group_name: string, series_indices: number[]) => void;
24
+ on_double_click: (series_idx: number) => void;
25
+ };
26
+ export {};
@@ -1,8 +1,20 @@
1
+ // Length + first/last element: a by-value signature for x/y data. Deliberately NOT
2
+ // array identity: inside components those are $state proxies whose identity changes
3
+ // when the series prop is reassigned (e.g. by the isolate itself), which made the
4
+ // snapshot reject itself and permanently broke restore-from-isolation.
5
+ const data_sig = (arr) => Array.isArray(arr) ? [arr.length, arr[0], arr[arr.length - 1]] : [arr];
1
6
  const series_source = (series, length = series.length) => series
2
7
  .slice(0, length)
3
- .map((srs) => [srs.label ?? ``, srs.unit ?? ``, srs.y_axis ?? ``, srs.x, srs.y]);
8
+ .map((srs) => [
9
+ srs.label ?? ``,
10
+ srs.unit ?? ``,
11
+ srs.y_axis ?? ``,
12
+ ...data_sig(srs.x),
13
+ ...data_sig(srs.y),
14
+ ]);
4
15
  const same_series_source = (series, snapshot_series) => series.length === snapshot_series.length &&
5
- series.every((source, idx) => source.every((part, part_idx) => Object.is(part, snapshot_series[idx][part_idx])));
16
+ series.every((source, idx) => source.length === snapshot_series[idx].length &&
17
+ source.every((part, part_idx) => Object.is(part, snapshot_series[idx][part_idx])));
6
18
  export function have_compatible_units(series1, series2) {
7
19
  if (!series1.unit || !series2.unit)
8
20
  return true;
@@ -83,3 +95,18 @@ export function handle_legend_double_click(series, idx, prev_snapshot) {
83
95
  prev_visibility: new_prev,
84
96
  };
85
97
  }
98
+ // Bundle the three legend visibility handlers (click toggle, group toggle,
99
+ // double-click isolate/restore) around a series accessor pair. Owns the
100
+ // isolate/restore snapshot internally so components don't each carry it.
101
+ export function create_legend_visibility(get_series, set_series) {
102
+ let prev_visibility = null;
103
+ return {
104
+ on_toggle: (series_idx) => set_series(toggle_series_visibility(get_series(), series_idx)),
105
+ on_group_toggle: (_group_name, series_indices) => set_series(toggle_group_visibility(get_series(), series_indices)),
106
+ on_double_click: (series_idx) => {
107
+ const result = handle_legend_double_click(get_series(), series_idx, prev_visibility);
108
+ set_series(result.series);
109
+ prev_visibility = result.prev_visibility;
110
+ },
111
+ };
112
+ }