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
@@ -0,0 +1,95 @@
1
+ import type { Vec2 } from '../../math';
2
+ import type { BandwidthOption, BasePlotProps, BoxHandlerProps, BoxPlotSeries, LegendConfig, Orientation, PanConfig, PlotConfig, RefLine, RefLineEvent, UserContentProps, ViolinKind, ViolinSide, WhiskerMode } from '..';
3
+ import type { Snippet } from 'svelte';
4
+ import type { HTMLAttributes } from 'svelte/elements';
5
+ declare function $$render<Metadata extends Record<string, unknown> = Record<string, unknown>>(): {
6
+ props: HTMLAttributes<HTMLDivElement> & BasePlotProps & PlotConfig & {
7
+ series?: BoxPlotSeries<Metadata>[];
8
+ orientation?: Orientation;
9
+ legend?: LegendConfig | null;
10
+ show_legend?: boolean;
11
+ box?: {
12
+ color?: string;
13
+ opacity?: number;
14
+ stroke_width?: number;
15
+ stroke_color?: string;
16
+ border_radius?: number;
17
+ };
18
+ whisker?: {
19
+ width?: number;
20
+ color?: string;
21
+ cap_fraction?: number;
22
+ };
23
+ median_style?: {
24
+ width?: number;
25
+ color?: string;
26
+ };
27
+ outlier_style?: {
28
+ radius?: number;
29
+ opacity?: number;
30
+ stroke_width?: number;
31
+ };
32
+ whisker_mode?: WhiskerMode;
33
+ whisker_range?: number;
34
+ whisker_percentiles?: Vec2;
35
+ show_outliers?: boolean;
36
+ show_mean?: boolean;
37
+ show_value_labels?: boolean;
38
+ value_label_stat?: `median` | `mean`;
39
+ value_label_format?: string;
40
+ kind?: ViolinKind;
41
+ side?: ViolinSide;
42
+ bandwidth?: BandwidthOption;
43
+ violin_width?: number;
44
+ violin_style?: {
45
+ opacity?: number;
46
+ stroke_width?: number;
47
+ };
48
+ kde_points?: number;
49
+ kde_cut?: number;
50
+ kde_max_samples?: number;
51
+ kde_clip?: [number | null, number | null];
52
+ tooltip?: Snippet<[BoxHandlerProps<Metadata>]>;
53
+ user_content?: Snippet<[UserContentProps]>;
54
+ header_controls?: Snippet<[{
55
+ height: number;
56
+ width: number;
57
+ fullscreen: boolean;
58
+ }]>;
59
+ controls_extra?: Snippet<[{
60
+ orientation: Orientation;
61
+ } & Required<PlotConfig>]>;
62
+ change?: (data: BoxHandlerProps<Metadata> | null) => void;
63
+ on_box_click?: (data: BoxHandlerProps<Metadata> & {
64
+ event: MouseEvent | KeyboardEvent;
65
+ }) => void;
66
+ on_box_hover?: (data: (BoxHandlerProps<Metadata> & {
67
+ event: MouseEvent | FocusEvent | KeyboardEvent;
68
+ }) | null) => void;
69
+ ref_lines?: RefLine[];
70
+ on_ref_line_click?: (event: RefLineEvent) => void;
71
+ on_ref_line_hover?: (event: RefLineEvent | null) => void;
72
+ pan?: PanConfig;
73
+ };
74
+ exports: {};
75
+ bindings: "display" | "orientation" | "show_controls" | "x2_axis" | "y_axis" | "y2_axis" | "fullscreen" | "series" | "hovered" | "ref_lines" | "controls_open" | "x_axis" | "kind" | "side" | "whisker_mode" | "show_outliers" | "show_mean";
76
+ slots: {};
77
+ events: {};
78
+ };
79
+ declare class __sveltets_Render<Metadata extends Record<string, unknown> = Record<string, unknown>> {
80
+ props(): ReturnType<typeof $$render<Metadata>>['props'];
81
+ events(): ReturnType<typeof $$render<Metadata>>['events'];
82
+ slots(): ReturnType<typeof $$render<Metadata>>['slots'];
83
+ bindings(): "display" | "orientation" | "show_controls" | "x2_axis" | "y_axis" | "y2_axis" | "fullscreen" | "series" | "hovered" | "ref_lines" | "controls_open" | "x_axis" | "kind" | "side" | "whisker_mode" | "show_outliers" | "show_mean";
84
+ exports(): {};
85
+ }
86
+ interface $$IsomorphicComponent {
87
+ new <Metadata extends Record<string, unknown> = Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Metadata>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Metadata>['props']>, ReturnType<__sveltets_Render<Metadata>['events']>, ReturnType<__sveltets_Render<Metadata>['slots']>> & {
88
+ $$bindings?: ReturnType<__sveltets_Render<Metadata>['bindings']>;
89
+ } & ReturnType<__sveltets_Render<Metadata>['exports']>;
90
+ <Metadata extends Record<string, unknown> = Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<Metadata>['props']> & {}): ReturnType<__sveltets_Render<Metadata>['exports']>;
91
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
92
+ }
93
+ declare const BoxPlot: $$IsomorphicComponent;
94
+ type BoxPlot<Metadata extends Record<string, unknown> = Record<string, unknown>> = InstanceType<typeof BoxPlot<Metadata>>;
95
+ export default BoxPlot;
@@ -0,0 +1,109 @@
1
+ <script lang="ts">
2
+ import { SettingsSection } from '../../layout'
3
+ import type { Orientation, PlotConfig, ViolinKind, ViolinSide, WhiskerMode } from '..'
4
+ import { PlotControls } from '..'
5
+ import type { PlotControlsProps } from '../core/types'
6
+ import { unique_id } from '../core/utils'
7
+ import { DEFAULTS } from '../../settings'
8
+ import type { Snippet } from 'svelte'
9
+
10
+ // Unique ID prefix to avoid conflicts when multiple instances on same page
11
+ const uid = unique_id(`box-ctrl`)
12
+
13
+ let {
14
+ orientation = $bindable(`vertical`),
15
+ whisker_mode = $bindable(`tukey`),
16
+ show_outliers = $bindable(true),
17
+ show_mean = $bindable(false),
18
+ kind = $bindable(`box`),
19
+ side = $bindable(`both`),
20
+ x_axis = $bindable({}),
21
+ x2_axis = $bindable({}),
22
+ y_axis = $bindable({}),
23
+ y2_axis = $bindable({}),
24
+ display = $bindable({}),
25
+ show_controls = $bindable(false),
26
+ controls_open = $bindable(false),
27
+ children,
28
+ ...rest
29
+ }: Omit<PlotControlsProps, `children` | `post_children`> & {
30
+ orientation?: Orientation
31
+ whisker_mode?: WhiskerMode
32
+ show_outliers?: boolean
33
+ show_mean?: boolean
34
+ kind?: ViolinKind
35
+ side?: ViolinSide
36
+ show_controls?: boolean
37
+ controls_open?: boolean
38
+ children?: Snippet<[{ orientation: Orientation } & Required<PlotConfig>]>
39
+ } = $props()
40
+ </script>
41
+
42
+ <PlotControls
43
+ bind:show_controls
44
+ bind:controls_open
45
+ bind:x_axis
46
+ bind:x2_axis
47
+ bind:y_axis
48
+ bind:y2_axis
49
+ bind:display
50
+ {...rest}
51
+ >
52
+ {@render children?.({ orientation, x_axis, x2_axis, y_axis, y2_axis, display })}
53
+ <SettingsSection
54
+ title="Box / Violin"
55
+ current_values={{ orientation, kind, side, whisker_mode, show_outliers, show_mean }}
56
+ on_reset={() => {
57
+ orientation = `vertical`
58
+ kind = DEFAULTS.box.kind
59
+ side = DEFAULTS.box.side
60
+ whisker_mode = DEFAULTS.box.whisker_mode
61
+ show_outliers = DEFAULTS.box.show_outliers
62
+ show_mean = DEFAULTS.box.show_mean
63
+ }}
64
+ style="display: flex; flex-wrap: wrap; gap: 2ex"
65
+ >
66
+ <label style="flex: 1">
67
+ Orientation:
68
+ <select bind:value={orientation} id="{uid}-orientation">
69
+ <option value="vertical">Vertical</option>
70
+ <option value="horizontal">Horizontal</option>
71
+ </select>
72
+ </label>
73
+ <label style="flex: 1">
74
+ Glyph:
75
+ <select bind:value={kind} id="{uid}-kind">
76
+ <option value="box">Box</option>
77
+ <option value="violin">Violin</option>
78
+ <option value="violin+box">Violin + Box</option>
79
+ </select>
80
+ </label>
81
+ {#if kind !== `box`}
82
+ <label style="flex: 1">
83
+ Violin side:
84
+ <select bind:value={side} id="{uid}-side">
85
+ <option value="both">Both</option>
86
+ <option value="positive">Positive</option>
87
+ <option value="negative">Negative</option>
88
+ </select>
89
+ </label>
90
+ {/if}
91
+ <label style="flex: 1">
92
+ Whiskers:
93
+ <select bind:value={whisker_mode} id="{uid}-whisker-mode">
94
+ <option value="tukey">Tukey (1.5·IQR)</option>
95
+ <option value="minmax">Min/Max</option>
96
+ <option value="percentile">Percentile</option>
97
+ <option value="std">Std Dev</option>
98
+ </select>
99
+ </label>
100
+ <label style="flex: 1 1 100%">
101
+ <input type="checkbox" bind:checked={show_outliers} />
102
+ Show outliers
103
+ </label>
104
+ <label style="flex: 1 1 100%">
105
+ <input type="checkbox" bind:checked={show_mean} />
106
+ Show mean
107
+ </label>
108
+ </SettingsSection>
109
+ </PlotControls>
@@ -0,0 +1,19 @@
1
+ import type { Orientation, PlotConfig, ViolinKind, ViolinSide, WhiskerMode } from '..';
2
+ import type { PlotControlsProps } from '../core/types';
3
+ import type { Snippet } from 'svelte';
4
+ type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> & {
5
+ orientation?: Orientation;
6
+ whisker_mode?: WhiskerMode;
7
+ show_outliers?: boolean;
8
+ show_mean?: boolean;
9
+ kind?: ViolinKind;
10
+ side?: ViolinSide;
11
+ show_controls?: boolean;
12
+ controls_open?: boolean;
13
+ children?: Snippet<[{
14
+ orientation: Orientation;
15
+ } & Required<PlotConfig>]>;
16
+ };
17
+ declare const BoxPlotControls: import("svelte").Component<$$ComponentProps, {}, "display" | "orientation" | "show_controls" | "x2_axis" | "y_axis" | "y2_axis" | "controls_open" | "x_axis" | "kind" | "side" | "whisker_mode" | "show_outliers" | "show_mean">;
18
+ type BoxPlotControls = ReturnType<typeof BoxPlotControls>;
19
+ export default BoxPlotControls;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ // Thin wrapper around BoxPlot with violin defaults. A violin is the same chart as a box
3
+ // plot (per-series raw distribution on a categorical axis), so all the scaffolding is shared.
4
+ import type { ComponentProps } from 'svelte'
5
+ import BoxPlot from './BoxPlot.svelte'
6
+
7
+ let {
8
+ series = $bindable([]),
9
+ kind = $bindable(`violin`),
10
+ ...rest
11
+ }: ComponentProps<typeof BoxPlot> = $props()
12
+ </script>
13
+
14
+ <BoxPlot bind:series bind:kind {...rest} />
@@ -0,0 +1,70 @@
1
+ declare const Violin: import("svelte").Component<import("svelte/elements").HTMLAttributes<HTMLDivElement> & import("..").BasePlotProps & import("..").PlotConfig & {
2
+ series?: import("./box-plot").BoxPlotSeries<Record<string, unknown>>[] | undefined;
3
+ orientation?: import("..").Orientation;
4
+ legend?: import("..").LegendConfig | null;
5
+ show_legend?: boolean;
6
+ box?: {
7
+ color?: string;
8
+ opacity?: number;
9
+ stroke_width?: number;
10
+ stroke_color?: string;
11
+ border_radius?: number;
12
+ } | undefined;
13
+ whisker?: {
14
+ width?: number;
15
+ color?: string;
16
+ cap_fraction?: number;
17
+ } | undefined;
18
+ median_style?: {
19
+ width?: number;
20
+ color?: string;
21
+ } | undefined;
22
+ outlier_style?: {
23
+ radius?: number;
24
+ opacity?: number;
25
+ stroke_width?: number;
26
+ } | undefined;
27
+ whisker_mode?: import("./box-plot").WhiskerMode;
28
+ whisker_range?: number;
29
+ whisker_percentiles?: import("../..").Vec2;
30
+ show_outliers?: boolean;
31
+ show_mean?: boolean;
32
+ show_value_labels?: boolean;
33
+ value_label_stat?: `median` | `mean`;
34
+ value_label_format?: string;
35
+ kind?: import("./box-plot").ViolinKind;
36
+ side?: import("./box-plot").ViolinSide;
37
+ bandwidth?: import("./box-plot").BandwidthOption;
38
+ violin_width?: number;
39
+ violin_style?: {
40
+ opacity?: number;
41
+ stroke_width?: number;
42
+ } | undefined;
43
+ kde_points?: number;
44
+ kde_cut?: number;
45
+ kde_max_samples?: number;
46
+ kde_clip?: [number | null, number | null];
47
+ tooltip?: import("svelte").Snippet<[import("./box-plot").BoxHandlerProps<Record<string, unknown>>]> | undefined;
48
+ user_content?: import("svelte").Snippet<[import("..").UserContentProps]>;
49
+ header_controls?: import("svelte").Snippet<[{
50
+ height: number;
51
+ width: number;
52
+ fullscreen: boolean;
53
+ }]> | undefined;
54
+ controls_extra?: import("svelte").Snippet<[{
55
+ orientation: import("..").Orientation;
56
+ } & Required<import("..").PlotConfig>]> | undefined;
57
+ change?: ((data: import("./box-plot").BoxHandlerProps<Record<string, unknown>> | null) => void) | undefined;
58
+ on_box_click?: ((data: import("./box-plot").BoxHandlerProps<Record<string, unknown>> & {
59
+ event: MouseEvent | KeyboardEvent;
60
+ }) => void) | undefined;
61
+ on_box_hover?: ((data: (import("./box-plot").BoxHandlerProps<Record<string, unknown>> & {
62
+ event: MouseEvent | FocusEvent | KeyboardEvent;
63
+ }) | null) => void) | undefined;
64
+ ref_lines?: import("..").RefLine[];
65
+ on_ref_line_click?: ((event: import("..").RefLineEvent) => void) | undefined;
66
+ on_ref_line_hover?: ((event: import("..").RefLineEvent | null) => void) | undefined;
67
+ pan?: import("..").PanConfig;
68
+ }, {}, "series" | "kind">;
69
+ type Violin = ReturnType<typeof Violin>;
70
+ export default Violin;
@@ -0,0 +1,56 @@
1
+ import type { Vec2 } from '../../math';
2
+ import type { HandlerProps } from '../core/types';
3
+ export type WhiskerMode = `tukey` | `minmax` | `percentile` | `std`;
4
+ export type ViolinKind = `box` | `violin` | `violin+box`;
5
+ export type ViolinSide = `both` | `positive` | `negative`;
6
+ export type BandwidthOption = number | `silverman` | `scott`;
7
+ export interface BoxPlotSeries<Metadata = Record<string, unknown>> {
8
+ id?: string | number;
9
+ y: readonly number[];
10
+ label?: string;
11
+ color?: string;
12
+ box_width?: number;
13
+ visible?: boolean;
14
+ legend_group?: string;
15
+ metadata?: Metadata;
16
+ x_axis?: `x1` | `x2`;
17
+ y_axis?: `y1` | `y2`;
18
+ whisker_mode?: WhiskerMode;
19
+ whisker_range?: number;
20
+ whisker_percentiles?: Vec2;
21
+ kind?: ViolinKind;
22
+ side?: ViolinSide;
23
+ bandwidth?: BandwidthOption;
24
+ violin_width?: number;
25
+ clip?: [number | null, number | null];
26
+ category?: string;
27
+ }
28
+ export interface BoxHandlerProps<Metadata = Record<string, unknown>> extends HandlerProps<Metadata> {
29
+ box_idx: number;
30
+ stats: BoxStats;
31
+ color: string;
32
+ category_label?: string;
33
+ active_y_axis: `y1` | `y2`;
34
+ active_x_axis: `x1` | `x2`;
35
+ }
36
+ export interface BoxStats {
37
+ min: number;
38
+ max: number;
39
+ q1: number;
40
+ median: number;
41
+ q3: number;
42
+ mean: number;
43
+ whisker_low: number;
44
+ whisker_high: number;
45
+ outliers: number[];
46
+ n: number;
47
+ }
48
+ export interface BoxStatsOptions {
49
+ whisker_mode?: WhiskerMode;
50
+ whisker_range?: number;
51
+ whisker_percentiles?: Vec2;
52
+ collect_outliers?: boolean;
53
+ }
54
+ export declare const WHISKER_MODES: readonly ["tukey", "minmax", "percentile", "std"];
55
+ export declare const is_whisker_mode: (val: string) => val is WhiskerMode;
56
+ export declare function compute_box_stats(values: readonly number[], opts?: BoxStatsOptions): BoxStats;
@@ -0,0 +1,129 @@
1
+ // Box plot statistics: compute quartiles, whiskers and outliers from a raw distribution.
2
+ // Single source of truth for the quantile math used by BoxPlot.svelte.
3
+ import { ascending } from 'd3-array';
4
+ import { quantile_unordered } from './quantile';
5
+ import { DEFAULTS } from '../../settings';
6
+ export const WHISKER_MODES = [`tukey`, `minmax`, `percentile`, `std`];
7
+ const WHISKER_MODE_SET = new Set(WHISKER_MODES);
8
+ export const is_whisker_mode = (val) => WHISKER_MODE_SET.has(val);
9
+ const EMPTY_STATS = {
10
+ min: NaN,
11
+ max: NaN,
12
+ q1: NaN,
13
+ median: NaN,
14
+ q3: NaN,
15
+ mean: NaN,
16
+ whisker_low: NaN,
17
+ whisker_high: NaN,
18
+ outliers: [],
19
+ n: 0,
20
+ };
21
+ const clamp01 = (val) => Math.max(0, Math.min(1, val));
22
+ function collect_outliers_by_scan(values, low_bound, high_bound, collect) {
23
+ if (!collect)
24
+ return [];
25
+ const outliers = [];
26
+ for (const val of values)
27
+ if (val < low_bound || val > high_bound)
28
+ outliers.push(val);
29
+ outliers.sort(ascending);
30
+ return outliers;
31
+ }
32
+ function tukey_scan(values, low_bound, high_bound, collect, data_min, data_max) {
33
+ let whisker_low = Infinity;
34
+ let whisker_high = -Infinity;
35
+ const outliers = [];
36
+ for (const val of values) {
37
+ if (val < low_bound || val > high_bound) {
38
+ if (collect)
39
+ outliers.push(val);
40
+ }
41
+ else {
42
+ if (val < whisker_low)
43
+ whisker_low = val;
44
+ if (val > whisker_high)
45
+ whisker_high = val;
46
+ }
47
+ }
48
+ if (collect)
49
+ outliers.sort(ascending);
50
+ return {
51
+ whisker_low: whisker_low === Infinity ? data_min : whisker_low,
52
+ whisker_high: whisker_high === -Infinity ? data_max : whisker_high,
53
+ outliers,
54
+ };
55
+ }
56
+ // Compute box plot statistics for a raw numeric distribution.
57
+ // Quartiles use type-7 linear interpolation, matching d3/numpy/pandas defaults.
58
+ // Non-finite values are filtered out; the input array is never mutated.
59
+ export function compute_box_stats(values, opts = {}) {
60
+ const {
61
+ // Fallback derives from DEFAULTS.box so component and helper defaults can't drift
62
+ whisker_mode = DEFAULTS.box.whisker_mode, whisker_range = 1.5, whisker_percentiles = [5, 95], collect_outliers = true, } = opts;
63
+ const vals = values.filter((val) => Number.isFinite(val));
64
+ const n_vals = vals.length;
65
+ if (n_vals === 0)
66
+ return { ...EMPTY_STATS, outliers: [] };
67
+ let sum = 0;
68
+ let data_min = Infinity;
69
+ let data_max = -Infinity;
70
+ for (const val of vals) {
71
+ sum += val;
72
+ if (val < data_min)
73
+ data_min = val;
74
+ if (val > data_max)
75
+ data_max = val;
76
+ }
77
+ const mean = sum / n_vals;
78
+ const qtl = (prob) => quantile_unordered(vals, prob);
79
+ const collect_beyond = (lo, hi) => collect_outliers_by_scan(vals, lo, hi, collect_outliers);
80
+ const q1 = qtl(0.25);
81
+ const median = qtl(0.5);
82
+ const q3 = qtl(0.75);
83
+ let whisker_low;
84
+ let whisker_high;
85
+ let outliers = [];
86
+ if (whisker_mode === `minmax`) {
87
+ whisker_low = data_min;
88
+ whisker_high = data_max;
89
+ }
90
+ else if (whisker_mode === `percentile`) {
91
+ // Order-defensively so reversed input like [95, 5] still yields low <= high
92
+ const pct_low = Math.min(...whisker_percentiles);
93
+ const pct_high = Math.max(...whisker_percentiles);
94
+ whisker_low = qtl(clamp01(pct_low / 100));
95
+ whisker_high = qtl(clamp01(pct_high / 100));
96
+ outliers = collect_beyond(whisker_low, whisker_high);
97
+ }
98
+ else if (whisker_mode === `std`) {
99
+ let variance_sum = 0;
100
+ for (const val of vals) {
101
+ const delta = val - mean;
102
+ variance_sum += delta * delta;
103
+ }
104
+ const std = n_vals > 1 ? Math.sqrt(variance_sum / (n_vals - 1)) : 0;
105
+ const low_bound = mean - whisker_range * std;
106
+ const high_bound = mean + whisker_range * std;
107
+ // Clamp whisker ends to the data extent so they never extend past real values
108
+ whisker_low = Math.max(data_min, low_bound);
109
+ whisker_high = Math.min(data_max, high_bound);
110
+ outliers = collect_beyond(low_bound, high_bound);
111
+ }
112
+ else {
113
+ // tukey (default): whiskers extend to the most extreme datum within range*IQR of the quartiles
114
+ const iqr = q3 - q1;
115
+ ({ whisker_low, whisker_high, outliers } = tukey_scan(vals, q1 - whisker_range * iqr, q3 + whisker_range * iqr, collect_outliers, data_min, data_max));
116
+ }
117
+ return {
118
+ min: data_min,
119
+ max: data_max,
120
+ q1,
121
+ median,
122
+ q3,
123
+ mean,
124
+ whisker_low,
125
+ whisker_high,
126
+ outliers,
127
+ n: n_vals,
128
+ };
129
+ }
@@ -0,0 +1,5 @@
1
+ export * from './box-plot';
2
+ export * from './kde';
3
+ export { default as BoxPlot } from './BoxPlot.svelte';
4
+ export { default as BoxPlotControls } from './BoxPlotControls.svelte';
5
+ export { default as Violin } from './Violin.svelte';
@@ -0,0 +1,5 @@
1
+ export * from './box-plot';
2
+ export * from './kde';
3
+ export { default as BoxPlot } from './BoxPlot.svelte';
4
+ export { default as BoxPlotControls } from './BoxPlotControls.svelte';
5
+ export { default as Violin } from './Violin.svelte';
@@ -0,0 +1,17 @@
1
+ import type { Vec2 } from '../../math';
2
+ export interface KdeResult {
3
+ grid: number[];
4
+ density: number[];
5
+ bandwidth: number;
6
+ }
7
+ export interface KdeOptions {
8
+ bandwidth?: number | `silverman` | `scott`;
9
+ n_points?: number;
10
+ cut?: number;
11
+ clip?: [number | null, number | null];
12
+ range?: Vec2;
13
+ max_samples?: number;
14
+ }
15
+ export declare function silverman_bandwidth(sorted: readonly number[]): number;
16
+ export declare function scott_bandwidth(samples: readonly number[]): number;
17
+ export declare function gaussian_kde(samples: readonly number[], opts?: KdeOptions): KdeResult;