matterviz 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/dist/EmptyState.svelte +10 -2
  2. package/dist/FilePicker.svelte +154 -96
  3. package/dist/Icon.svelte +20 -14
  4. package/dist/MillerIndexInput.svelte +27 -21
  5. package/dist/api/optimade.js +6 -6
  6. package/dist/app.css +216 -178
  7. package/dist/brillouin/BrillouinZone.svelte +299 -198
  8. package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
  9. package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
  10. package/dist/brillouin/BrillouinZoneExportPane.svelte +74 -55
  11. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  12. package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
  13. package/dist/brillouin/BrillouinZoneScene.svelte +277 -165
  14. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
  15. package/dist/brillouin/BrillouinZoneTooltip.svelte +17 -7
  16. package/dist/brillouin/compute.js +11 -6
  17. package/dist/chempot-diagram/ChemPotDiagram.svelte +327 -0
  18. package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
  19. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +847 -0
  20. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
  21. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +3194 -0
  22. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
  23. package/dist/chempot-diagram/ChemPotScene3D.svelte +11 -0
  24. package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
  25. package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
  26. package/dist/chempot-diagram/async-compute.svelte.js +77 -0
  27. package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
  28. package/dist/chempot-diagram/chempot-worker.js +11 -0
  29. package/dist/chempot-diagram/color.d.ts +10 -0
  30. package/dist/chempot-diagram/color.js +32 -0
  31. package/dist/chempot-diagram/compute.d.ts +48 -0
  32. package/dist/chempot-diagram/compute.js +812 -0
  33. package/dist/chempot-diagram/index.d.ts +6 -0
  34. package/dist/chempot-diagram/index.js +6 -0
  35. package/dist/chempot-diagram/pointer.d.ts +16 -0
  36. package/dist/chempot-diagram/pointer.js +40 -0
  37. package/dist/chempot-diagram/temperature.d.ts +15 -0
  38. package/dist/chempot-diagram/temperature.js +36 -0
  39. package/dist/chempot-diagram/types.d.ts +86 -0
  40. package/dist/chempot-diagram/types.js +28 -0
  41. package/dist/colors/index.d.ts +3 -1
  42. package/dist/colors/index.js +9 -3
  43. package/dist/composition/BarChart.svelte +141 -77
  44. package/dist/composition/BubbleChart.svelte +107 -52
  45. package/dist/composition/Composition.svelte +100 -79
  46. package/dist/composition/Formula.svelte +108 -62
  47. package/dist/composition/FormulaFilter.svelte +973 -353
  48. package/dist/composition/FormulaFilter.svelte.d.ts +35 -1
  49. package/dist/composition/PieChart.svelte +199 -99
  50. package/dist/composition/PieChart.svelte.d.ts +1 -1
  51. package/dist/composition/format.d.ts +5 -0
  52. package/dist/composition/format.js +20 -3
  53. package/dist/composition/parse.js +14 -9
  54. package/dist/convex-hull/ConvexHull.svelte +93 -38
  55. package/dist/convex-hull/ConvexHull2D.svelte +551 -393
  56. package/dist/convex-hull/ConvexHull3D.svelte +1303 -825
  57. package/dist/convex-hull/ConvexHull4D.svelte +1012 -686
  58. package/dist/convex-hull/ConvexHullControls.svelte +115 -28
  59. package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
  60. package/dist/convex-hull/ConvexHullStats.svelte +821 -249
  61. package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
  62. package/dist/convex-hull/ConvexHullTooltip.svelte +41 -16
  63. package/dist/convex-hull/GasPressureControls.svelte +104 -61
  64. package/dist/convex-hull/StructurePopup.svelte +25 -4
  65. package/dist/convex-hull/TemperatureSlider.svelte +45 -25
  66. package/dist/convex-hull/barycentric-coords.js +13 -7
  67. package/dist/convex-hull/demo-temperature.d.ts +6 -0
  68. package/dist/convex-hull/demo-temperature.js +40 -0
  69. package/dist/convex-hull/gas-thermodynamics.js +17 -12
  70. package/dist/convex-hull/helpers.d.ts +10 -1
  71. package/dist/convex-hull/helpers.js +79 -38
  72. package/dist/convex-hull/index.d.ts +1 -0
  73. package/dist/convex-hull/index.js +1 -0
  74. package/dist/convex-hull/thermodynamics.d.ts +8 -21
  75. package/dist/convex-hull/thermodynamics.js +163 -69
  76. package/dist/convex-hull/types.d.ts +12 -12
  77. package/dist/convex-hull/types.js +0 -12
  78. package/dist/coordination/CoordinationBarPlot.svelte +232 -176
  79. package/dist/element/BohrAtom.svelte +56 -13
  80. package/dist/element/ElementHeading.svelte +7 -2
  81. package/dist/element/ElementPhoto.svelte +15 -9
  82. package/dist/element/ElementStats.svelte +10 -4
  83. package/dist/element/ElementTile.svelte +137 -73
  84. package/dist/element/Nucleus.svelte +39 -11
  85. package/dist/element/data.js +2 -14
  86. package/dist/element/data.json.gz +0 -0
  87. package/dist/element/types.d.ts +1 -0
  88. package/dist/feedback/ClickFeedback.svelte +16 -5
  89. package/dist/feedback/DragOverlay.svelte +10 -2
  90. package/dist/feedback/Spinner.svelte +4 -2
  91. package/dist/feedback/StatusMessage.svelte +8 -2
  92. package/dist/fermi-surface/FermiSlice.svelte +118 -88
  93. package/dist/fermi-surface/FermiSurface.svelte +336 -239
  94. package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
  95. package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
  96. package/dist/fermi-surface/FermiSurfaceScene.svelte +536 -343
  97. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
  98. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
  99. package/dist/fermi-surface/compute.js +16 -20
  100. package/dist/fermi-surface/parse.js +37 -33
  101. package/dist/fermi-surface/symmetry.js +2 -7
  102. package/dist/fermi-surface/types.d.ts +3 -5
  103. package/dist/heatmap-matrix/HeatmapMatrix.svelte +1527 -0
  104. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
  105. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
  106. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +30 -0
  107. package/dist/heatmap-matrix/index.d.ts +53 -0
  108. package/dist/heatmap-matrix/index.js +100 -0
  109. package/dist/heatmap-matrix/shared.d.ts +2 -0
  110. package/dist/heatmap-matrix/shared.js +4 -0
  111. package/dist/icons.d.ts +111 -0
  112. package/dist/icons.js +158 -0
  113. package/dist/index.d.ts +5 -2
  114. package/dist/index.js +5 -2
  115. package/dist/io/decompress.js +1 -1
  116. package/dist/io/export.d.ts +3 -0
  117. package/dist/io/export.js +138 -140
  118. package/dist/io/file-drop.d.ts +7 -0
  119. package/dist/io/file-drop.js +43 -0
  120. package/dist/io/index.d.ts +2 -2
  121. package/dist/io/index.js +2 -112
  122. package/dist/io/is-binary.js +2 -3
  123. package/dist/io/types.d.ts +1 -0
  124. package/dist/io/url-drop.d.ts +2 -0
  125. package/dist/io/url-drop.js +117 -0
  126. package/dist/isosurface/Isosurface.svelte +220 -110
  127. package/dist/isosurface/IsosurfaceControls.svelte +65 -28
  128. package/dist/isosurface/parse.js +104 -56
  129. package/dist/isosurface/slice.d.ts +2 -1
  130. package/dist/isosurface/slice.js +8 -13
  131. package/dist/isosurface/types.d.ts +14 -1
  132. package/dist/isosurface/types.js +152 -5
  133. package/dist/labels.d.ts +2 -1
  134. package/dist/labels.js +12 -8
  135. package/dist/layout/FullscreenToggle.svelte +11 -2
  136. package/dist/layout/InfoCard.svelte +38 -6
  137. package/dist/layout/InfoTag.svelte +125 -94
  138. package/dist/layout/PropertyFilter.svelte +82 -37
  139. package/dist/layout/SettingsSection.svelte +85 -55
  140. package/dist/layout/SubpageGrid.svelte +82 -0
  141. package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
  142. package/dist/layout/index.d.ts +1 -0
  143. package/dist/layout/index.js +1 -0
  144. package/dist/layout/json-tree/JsonNode.svelte +266 -223
  145. package/dist/layout/json-tree/JsonTree.svelte +516 -429
  146. package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
  147. package/dist/layout/json-tree/JsonValue.svelte +281 -173
  148. package/dist/layout/json-tree/types.d.ts +10 -2
  149. package/dist/layout/json-tree/utils.d.ts +2 -0
  150. package/dist/layout/json-tree/utils.js +37 -2
  151. package/dist/marching-cubes.js +25 -2
  152. package/dist/math.d.ts +20 -17
  153. package/dist/math.js +474 -57
  154. package/dist/overlays/ContextMenu.svelte +66 -40
  155. package/dist/overlays/DraggablePane.svelte +331 -154
  156. package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
  157. package/dist/periodic-table/PeriodicTable.svelte +278 -145
  158. package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
  159. package/dist/periodic-table/PropertySelect.svelte +25 -7
  160. package/dist/periodic-table/TableInset.svelte +8 -3
  161. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +559 -267
  162. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
  163. package/dist/phase-diagram/PhaseDiagramControls.svelte +131 -51
  164. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
  165. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
  166. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
  167. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +160 -110
  168. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +8 -1
  169. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +217 -86
  170. package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
  171. package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
  172. package/dist/phase-diagram/build-diagram.js +9 -9
  173. package/dist/phase-diagram/colors.js +1 -3
  174. package/dist/phase-diagram/index.d.ts +2 -0
  175. package/dist/phase-diagram/index.js +2 -0
  176. package/dist/phase-diagram/parse.js +10 -9
  177. package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
  178. package/dist/phase-diagram/svg-to-diagram.js +869 -0
  179. package/dist/phase-diagram/types.d.ts +10 -0
  180. package/dist/phase-diagram/utils.d.ts +8 -4
  181. package/dist/phase-diagram/utils.js +219 -74
  182. package/dist/plot/AxisLabel.svelte +51 -0
  183. package/dist/plot/AxisLabel.svelte.d.ts +16 -0
  184. package/dist/plot/BarPlot.svelte +1461 -768
  185. package/dist/plot/BarPlot.svelte.d.ts +3 -3
  186. package/dist/plot/BarPlotControls.svelte +33 -6
  187. package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
  188. package/dist/plot/ColorBar.svelte +533 -383
  189. package/dist/plot/ColorBar.svelte.d.ts +1 -1
  190. package/dist/plot/ColorScaleSelect.svelte +28 -7
  191. package/dist/plot/ElementScatter.svelte +38 -16
  192. package/dist/plot/FillArea.svelte +152 -92
  193. package/dist/plot/Histogram.svelte +1162 -709
  194. package/dist/plot/Histogram.svelte.d.ts +1 -1
  195. package/dist/plot/HistogramControls.svelte +81 -18
  196. package/dist/plot/HistogramControls.svelte.d.ts +6 -2
  197. package/dist/plot/InteractiveAxisLabel.svelte +34 -11
  198. package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
  199. package/dist/plot/Line.svelte +63 -28
  200. package/dist/plot/PlotControls.svelte +221 -96
  201. package/dist/plot/PlotControls.svelte.d.ts +1 -1
  202. package/dist/plot/PlotLegend.svelte +174 -91
  203. package/dist/plot/PlotTooltip.svelte +45 -6
  204. package/dist/plot/PortalSelect.svelte +175 -146
  205. package/dist/plot/ReferenceLine.svelte +77 -22
  206. package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
  207. package/dist/plot/ReferenceLine3D.svelte +132 -107
  208. package/dist/plot/ReferencePlane.svelte +146 -123
  209. package/dist/plot/ScatterPlot.svelte +1880 -1156
  210. package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
  211. package/dist/plot/ScatterPlot3D.svelte +256 -131
  212. package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
  213. package/dist/plot/ScatterPlot3DControls.svelte +300 -297
  214. package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
  215. package/dist/plot/ScatterPlot3DScene.svelte +608 -406
  216. package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
  217. package/dist/plot/ScatterPlotControls.svelte +150 -70
  218. package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
  219. package/dist/plot/ScatterPoint.svelte +98 -26
  220. package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
  221. package/dist/plot/SpacegroupBarPlot.svelte +142 -85
  222. package/dist/plot/Surface3D.svelte +159 -108
  223. package/dist/plot/ZeroLines.svelte +96 -0
  224. package/dist/plot/ZeroLines.svelte.d.ts +32 -0
  225. package/dist/plot/ZoomRect.svelte +23 -0
  226. package/dist/plot/ZoomRect.svelte.d.ts +8 -0
  227. package/dist/plot/axis-utils.d.ts +1 -1
  228. package/dist/plot/axis-utils.js +1 -3
  229. package/dist/plot/data-cleaning.js +12 -28
  230. package/dist/plot/data-transform.js +2 -1
  231. package/dist/plot/fill-utils.js +2 -0
  232. package/dist/plot/index.d.ts +6 -2
  233. package/dist/plot/index.js +6 -2
  234. package/dist/plot/interactions.d.ts +8 -10
  235. package/dist/plot/interactions.js +2 -3
  236. package/dist/plot/layout.d.ts +11 -2
  237. package/dist/plot/layout.js +44 -17
  238. package/dist/plot/reference-line.d.ts +5 -22
  239. package/dist/plot/reference-line.js +12 -84
  240. package/dist/plot/scales.js +24 -36
  241. package/dist/plot/types.d.ts +53 -40
  242. package/dist/plot/types.js +12 -7
  243. package/dist/plot/utils/label-placement.d.ts +32 -15
  244. package/dist/plot/utils/label-placement.js +227 -63
  245. package/dist/plot/utils/series-visibility.js +2 -3
  246. package/dist/plot/utils.d.ts +1 -0
  247. package/dist/plot/utils.js +14 -0
  248. package/dist/rdf/RdfPlot.svelte +173 -132
  249. package/dist/rdf/calc-rdf.js +4 -5
  250. package/dist/sanitize.d.ts +4 -0
  251. package/dist/sanitize.js +107 -0
  252. package/dist/settings.d.ts +21 -6
  253. package/dist/settings.js +63 -19
  254. package/dist/spectral/Bands.svelte +963 -412
  255. package/dist/spectral/Bands.svelte.d.ts +22 -2
  256. package/dist/spectral/BandsAndDos.svelte +90 -49
  257. package/dist/spectral/BrillouinBandsDos.svelte +151 -93
  258. package/dist/spectral/Dos.svelte +389 -258
  259. package/dist/spectral/helpers.d.ts +23 -1
  260. package/dist/spectral/helpers.js +119 -51
  261. package/dist/spectral/types.d.ts +2 -0
  262. package/dist/state.svelte.d.ts +1 -1
  263. package/dist/state.svelte.js +3 -2
  264. package/dist/structure/Arrow.svelte +59 -20
  265. package/dist/structure/AtomLegend.svelte +231 -129
  266. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  267. package/dist/structure/Bond.svelte +73 -47
  268. package/dist/structure/CanvasTooltip.svelte +10 -2
  269. package/dist/structure/CellSelect.svelte +148 -51
  270. package/dist/structure/Cylinder.svelte +33 -17
  271. package/dist/structure/Lattice.svelte +88 -33
  272. package/dist/structure/Structure.svelte +1077 -821
  273. package/dist/structure/Structure.svelte.d.ts +1 -1
  274. package/dist/structure/StructureControls.svelte +373 -139
  275. package/dist/structure/StructureControls.svelte.d.ts +1 -1
  276. package/dist/structure/StructureExportPane.svelte +124 -89
  277. package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
  278. package/dist/structure/StructureInfoPane.svelte +304 -231
  279. package/dist/structure/StructureScene.svelte +919 -445
  280. package/dist/structure/StructureScene.svelte.d.ts +16 -7
  281. package/dist/structure/atom-properties.d.ts +6 -2
  282. package/dist/structure/atom-properties.js +42 -29
  283. package/dist/structure/bonding.js +6 -7
  284. package/dist/structure/export.js +22 -34
  285. package/dist/structure/ferrox-wasm-types.d.ts +3 -2
  286. package/dist/structure/ferrox-wasm-types.js +0 -3
  287. package/dist/structure/ferrox-wasm.d.ts +3 -2
  288. package/dist/structure/ferrox-wasm.js +2 -3
  289. package/dist/structure/index.d.ts +16 -0
  290. package/dist/structure/index.js +88 -6
  291. package/dist/structure/measure.d.ts +2 -2
  292. package/dist/structure/measure.js +4 -44
  293. package/dist/structure/parse.js +130 -155
  294. package/dist/structure/partial-occupancy.d.ts +25 -0
  295. package/dist/structure/partial-occupancy.js +99 -0
  296. package/dist/structure/pbc.d.ts +1 -0
  297. package/dist/structure/pbc.js +16 -6
  298. package/dist/structure/supercell.d.ts +2 -2
  299. package/dist/structure/supercell.js +12 -22
  300. package/dist/structure/validation.js +5 -3
  301. package/dist/symmetry/SymmetryStats.svelte +94 -37
  302. package/dist/symmetry/WyckoffTable.svelte +42 -14
  303. package/dist/symmetry/cell-transform.js +5 -3
  304. package/dist/symmetry/index.d.ts +7 -4
  305. package/dist/symmetry/index.js +87 -21
  306. package/dist/symmetry/spacegroups.js +148 -148
  307. package/dist/table/HeatmapTable.svelte +1112 -516
  308. package/dist/table/HeatmapTable.svelte.d.ts +12 -1
  309. package/dist/table/ToggleMenu.svelte +125 -90
  310. package/dist/table/index.d.ts +2 -0
  311. package/dist/table/index.js +2 -4
  312. package/dist/theme/ThemeControl.svelte +21 -12
  313. package/dist/time.js +4 -1
  314. package/dist/tooltip/TooltipContent.svelte +33 -8
  315. package/dist/trajectory/Trajectory.svelte +889 -687
  316. package/dist/trajectory/TrajectoryError.svelte +14 -3
  317. package/dist/trajectory/TrajectoryExportPane.svelte +148 -90
  318. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
  319. package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
  320. package/dist/trajectory/constants.d.ts +6 -0
  321. package/dist/trajectory/constants.js +7 -0
  322. package/dist/trajectory/extract.js +13 -31
  323. package/dist/trajectory/format-detect.d.ts +9 -0
  324. package/dist/trajectory/format-detect.js +76 -0
  325. package/dist/trajectory/frame-reader.d.ts +17 -0
  326. package/dist/trajectory/frame-reader.js +332 -0
  327. package/dist/trajectory/helpers.d.ts +14 -0
  328. package/dist/trajectory/helpers.js +172 -0
  329. package/dist/trajectory/index.d.ts +1 -0
  330. package/dist/trajectory/index.js +23 -14
  331. package/dist/trajectory/parse/ase.d.ts +2 -0
  332. package/dist/trajectory/parse/ase.js +77 -0
  333. package/dist/trajectory/parse/hdf5.d.ts +2 -0
  334. package/dist/trajectory/parse/hdf5.js +129 -0
  335. package/dist/trajectory/parse/index.d.ts +12 -0
  336. package/dist/trajectory/parse/index.js +299 -0
  337. package/dist/trajectory/parse/lammps.d.ts +5 -0
  338. package/dist/trajectory/parse/lammps.js +179 -0
  339. package/dist/trajectory/parse/vasp.d.ts +2 -0
  340. package/dist/trajectory/parse/vasp.js +68 -0
  341. package/dist/trajectory/parse/xyz.d.ts +2 -0
  342. package/dist/trajectory/parse/xyz.js +110 -0
  343. package/dist/trajectory/plotting.js +13 -8
  344. package/dist/trajectory/types.d.ts +11 -0
  345. package/dist/trajectory/types.js +1 -0
  346. package/dist/utils.d.ts +3 -0
  347. package/dist/utils.js +17 -0
  348. package/dist/xrd/XrdPlot.svelte +337 -245
  349. package/dist/xrd/broadening.js +14 -9
  350. package/dist/xrd/calc-xrd.js +12 -19
  351. package/dist/xrd/parse.d.ts +1 -1
  352. package/dist/xrd/parse.js +17 -17
  353. package/package.json +103 -101
  354. package/readme.md +4 -4
  355. package/dist/trajectory/parse.d.ts +0 -42
  356. package/dist/trajectory/parse.js +0 -1267
  357. /package/dist/element/{data.json.d.ts → data.json.gz.d.ts} +0 -0
  358. /package/dist/theme/{themes.js → themes.mjs} +0 -0
@@ -11,6 +11,7 @@ export function caglioti_fwhm(two_theta, // Angle in degrees (2θ)
11
11
  U, // Caglioti parameter U
12
12
  V, // Caglioti parameter V
13
13
  W) {
14
+ // FWHM in degrees (2θ)
14
15
  const theta_rad = (two_theta / 2) * (Math.PI / 180);
15
16
  const tan_theta = Math.tan(theta_rad);
16
17
  const fwhm_sq = U * tan_theta ** 2 + V * tan_theta + W;
@@ -19,6 +20,7 @@ W) {
19
20
  }
20
21
  // Normalized Gaussian profile. x: position, x0: peak center, fwhm: Full Width at Half Maximum
21
22
  function gaussian(x, x0, fwhm) {
23
+ // Intensity at x
22
24
  const safe_fwhm = Math.max(fwhm, 1e-9);
23
25
  const sigma = safe_fwhm / (2 * Math.sqrt(2 * LOG_2));
24
26
  const prefactor = 1 / (sigma * Math.sqrt(2 * Math.PI));
@@ -27,6 +29,7 @@ function gaussian(x, x0, fwhm) {
27
29
  }
28
30
  // Normalized Lorentzian profile. x: position, x0: peak center, fwhm: Full Width at Half Maximum
29
31
  function lorentzian(x, x0, fwhm) {
32
+ // Intensity at x
30
33
  const safe_fwhm = Math.max(fwhm, 1e-9);
31
34
  const gamma = safe_fwhm / 2;
32
35
  const prefactor = 1 / (Math.PI * gamma);
@@ -38,15 +41,17 @@ export function pseudo_voigt(x, // Position
38
41
  x0, // Peak center
39
42
  fwhm, // Full Width at Half Maximum
40
43
  eta) {
44
+ // Intensity at x
41
45
  // Clamp eta to [0, 1]
42
46
  const safe_eta = Math.max(0, Math.min(1, eta));
43
- return (safe_eta * lorentzian(x, x0, fwhm) + (1 - safe_eta) * gaussian(x, x0, fwhm));
47
+ return safe_eta * lorentzian(x, x0, fwhm) + (1 - safe_eta) * gaussian(x, x0, fwhm);
44
48
  }
45
49
  // Computes a broadened XRD pattern from discrete peaks.
46
50
  export function compute_broadened_pattern(pattern, // Discrete XRD pattern (peaks)
47
51
  params, // Broadening parameters (U, V, W, shape_factor)
48
52
  range, // Angular range [min, max] in degrees
49
53
  step_size = 0.02) {
54
+ // Continuous broadened pattern
50
55
  if (!Number.isFinite(step_size) || step_size <= 0) {
51
56
  throw new Error(`step_size must be > 0 and finite`);
52
57
  }
@@ -59,14 +64,14 @@ step_size = 0.02) {
59
64
  const n_steps = Math.ceil((max_angle - min_angle) / step_size);
60
65
  const xs = new Float32Array(n_steps);
61
66
  const ys = new Float32Array(n_steps);
62
- for (let i = 0; i < n_steps; i++) {
63
- xs[i] = min_angle + i * step_size;
67
+ for (let idx = 0; idx < n_steps; idx++) {
68
+ xs[idx] = min_angle + idx * step_size;
64
69
  }
65
70
  const { x: peak_pos, y: peak_int } = pattern;
66
71
  // Optimization: Process each peak and add to grid
67
- for (let p = 0; p < peak_pos.length; p++) {
68
- const x0 = peak_pos[p];
69
- const intensity = peak_int[p];
72
+ for (let peak_idx = 0; peak_idx < peak_pos.length; peak_idx++) {
73
+ const x0 = peak_pos[peak_idx];
74
+ const intensity = peak_int[peak_idx];
70
75
  // Skip negligible peaks
71
76
  if (intensity < 1e-5)
72
77
  continue;
@@ -80,9 +85,9 @@ step_size = 0.02) {
80
85
  const window = 20 * fwhm;
81
86
  const start_idx = Math.max(0, Math.floor((x0 - window - min_angle) / step_size));
82
87
  const end_idx = Math.min(n_steps - 1, Math.ceil((x0 + window - min_angle) / step_size));
83
- for (let i = start_idx; i <= end_idx; i++) {
84
- const x = xs[i];
85
- ys[i] += intensity * pseudo_voigt(x, x0, fwhm, shape_factor);
88
+ for (let idx = start_idx; idx <= end_idx; idx++) {
89
+ const x = xs[idx];
90
+ ys[idx] += intensity * pseudo_voigt(x, x0, fwhm, shape_factor);
86
91
  }
87
92
  }
88
93
  // Convert back to number[]
@@ -2,11 +2,8 @@ import { element_data } from '../element';
2
2
  import * as math from '../math';
3
3
  import { parse_any_structure } from '../structure/parse';
4
4
  import { is_crystal } from '../structure/validation';
5
- // Single source of truth for atomic scattering params (shared with Rust/ferrox)
6
- // Development: imports from extensions/rust/src/, Production: copied to dist/xrd/ by package script
7
- import ATOMIC_SCATTERING_PARAMS from './atomic_scattering_params.json' with {
8
- type: 'json'
9
- };
5
+ // Single source of truth for atomic scattering params
6
+ import ATOMIC_SCATTERING_PARAMS from './atomic_scattering_params.json' with { type: 'json' };
10
7
  import { is_xrd_data_file, parse_xrd_file } from './parse';
11
8
  // XRD wavelengths in Angstrom (Å)
12
9
  export const WAVELENGTHS = {
@@ -47,7 +44,7 @@ function get_unique_families(hkls) {
47
44
  // Port of pymatgen's get_unique_families: group Miller indices by absolute-value permutations
48
45
  const key_map = new Map();
49
46
  for (const hkl of hkls) {
50
- const abs_sorted = [...hkl.map((v) => Math.abs(v))].sort((x, y) => x - y);
47
+ const abs_sorted = [...hkl.map((val) => Math.abs(val))].sort((x, y) => x - y);
51
48
  const key = abs_sorted.join(`,`);
52
49
  const list = key_map.get(key);
53
50
  if (list)
@@ -85,9 +82,9 @@ function enumerate_reciprocal_points(recip_rows, max_radius, min_radius) {
85
82
  const n1 = Math.max(Math.hypot(...recip_b1), 1e-12);
86
83
  const n2 = Math.max(Math.hypot(...recip_b2), 1e-12);
87
84
  const n3 = Math.max(Math.hypot(...recip_b3), 1e-12);
88
- const h_max = Math.ceil((max_radius / n1) + 2);
89
- const k_max = Math.ceil((max_radius / n2) + 2);
90
- const l_max = Math.ceil((max_radius / n3) + 2);
85
+ const h_max = Math.ceil(max_radius / n1 + 2);
86
+ const k_max = Math.ceil(max_radius / n2 + 2);
87
+ const l_max = Math.ceil(max_radius / n3 + 2);
91
88
  // Safety cap to avoid pathological enumeration volume
92
89
  const CAP = 512;
93
90
  if (Math.max(h_max, k_max, l_max) > CAP) {
@@ -140,9 +137,7 @@ export function compute_xrd_pattern(structure, options = {}) {
140
137
  // const symprec = options.symprec ?? 0
141
138
  const recip_rows = compute_reciprocal_lattice_rows(structure);
142
139
  // Bragg condition bounds: reciprocal vector length r = 2 sin(theta) / lambda
143
- const two_theta_range = options.two_theta_range === null
144
- ? null
145
- : options.two_theta_range ?? [0, 180];
140
+ const two_theta_range = options.two_theta_range === null ? null : (options.two_theta_range ?? [0, 180]);
146
141
  const [min_radius, max_radius] = two_theta_range === null
147
142
  ? [0, 2 / wavelength]
148
143
  : (([t_min, t_max]) => {
@@ -162,7 +157,6 @@ export function compute_xrd_pattern(structure, options = {}) {
162
157
  if (ELEMENT_Z[element_symbol] === undefined) {
163
158
  throw new Error(`Unknown atomic number for element ${element_symbol}`);
164
159
  }
165
- // Cast needed: imported JSON has different type structure than our union type
166
160
  const raw_coeff = ATOMIC_SCATTERING_PARAMS[element_symbol];
167
161
  if (!raw_coeff) {
168
162
  throw new Error(`No atomic scattering coefficients for ${element_symbol}. Extend ATOMIC_SCATTERING_PARAMS.`);
@@ -220,7 +214,7 @@ export function compute_xrd_pattern(structure, options = {}) {
220
214
  }, { real: 0, imag: 0 });
221
215
  const sin_theta = Math.sin(theta);
222
216
  const cos_theta = Math.cos(theta);
223
- const denom_raw = (sin_theta * sin_theta) * Math.abs(cos_theta);
217
+ const denom_raw = sin_theta * sin_theta * Math.abs(cos_theta);
224
218
  // Clamp denominator away from zero to avoid Inf/NaN when 2θ → 180° (cosθ → 0)
225
219
  const denom = Math.max(denom_raw, 1e-12);
226
220
  const lorentz = (1 + Math.cos(2 * theta) ** 2) / denom;
@@ -254,7 +248,7 @@ export function compute_xrd_pattern(structure, options = {}) {
254
248
  if (peaks.size === 0)
255
249
  return { x: [], y: [] };
256
250
  // Scale intensities so that the max intensity is 100, and filter by scaled tol
257
- const max_intensity = Math.max(...Array.from(peaks.values()).map((p) => p.intensity));
251
+ const max_intensity = Math.max(...Array.from(peaks.values()).map((peak) => peak.intensity));
258
252
  const xs = [];
259
253
  const ys = [];
260
254
  const hkls_out = [];
@@ -271,7 +265,7 @@ export function compute_xrd_pattern(structure, options = {}) {
271
265
  const fam = get_unique_families(item.hkls);
272
266
  const fam_array = [];
273
267
  for (const [repr_key, multiplicity] of fam.entries()) {
274
- const repr = repr_key.split(`,`).map((n) => parseInt(n, 10));
268
+ const repr = repr_key.split(`,`).map((num_str) => parseInt(num_str, 10));
275
269
  fam_array.push({ hkl: repr, multiplicity });
276
270
  }
277
271
  hkls_out.push(fam_array);
@@ -292,6 +286,7 @@ export function compute_xrd_pattern(structure, options = {}) {
292
286
  export async function add_xrd_pattern(content, // File content as string or ArrayBuffer
293
287
  filename, // Name of the file (used to detect format)
294
288
  wavelength) {
289
+ // Object with pattern entry or error message
295
290
  try {
296
291
  // Check if file is a direct XRD data file (.xy, .brml)
297
292
  if (is_xrd_data_file(filename)) {
@@ -320,9 +315,7 @@ wavelength) {
320
315
  return { error: `Failed to parse ${ext} file: no valid data found. ${hint}` };
321
316
  }
322
317
  // Otherwise, try to parse as a structure file and compute XRD pattern
323
- const text_content = typeof content === `string`
324
- ? content
325
- : new TextDecoder().decode(content);
318
+ const text_content = typeof content === `string` ? content : new TextDecoder().decode(content);
326
319
  const parsed_structure = parse_any_structure(text_content, filename);
327
320
  if (is_crystal(parsed_structure)) {
328
321
  const pattern = compute_xrd_pattern(parsed_structure, {
@@ -8,6 +8,6 @@ export declare function parse_bruker_raw_file(data: ArrayBuffer): XrdPattern | n
8
8
  export declare function parse_brml_file(data: ArrayBuffer): Promise<XrdPattern | null>;
9
9
  export declare function parse_xrdml_file(content: string): XrdPattern | null;
10
10
  export declare const XRD_FILE_EXTENSIONS: readonly ["xy", "xye", "csv", "dat", "asc", "txt", "ras", "uxd", "gsas", "gsa", "gda", "fxye", "xrdml", "brml", "raw"];
11
- export type XrdFileExtension = typeof XRD_FILE_EXTENSIONS[number];
11
+ export type XrdFileExtension = (typeof XRD_FILE_EXTENSIONS)[number];
12
12
  export declare function parse_xrd_file(content: string | ArrayBuffer, filename: string): Promise<XrdPattern | null>;
13
13
  export declare function is_xrd_data_file(filename: string): boolean;
package/dist/xrd/parse.js CHANGED
@@ -15,7 +15,11 @@ function create_pattern(start, step, intensities) {
15
15
  return { x: normalized.x, y: normalized.y };
16
16
  }
17
17
  // Parse whitespace-separated numbers from text. Used by multiple formats.
18
- const parse_number_list = (text) => text.trim().split(/\s+/).map(parseFloat).filter((val) => !isNaN(val));
18
+ const parse_number_list = (text) => text
19
+ .trim()
20
+ .split(/\s+/)
21
+ .map(parseFloat)
22
+ .filter((val) => !isNaN(val));
19
23
  // Extract numeric value from header line matching "KEY=VALUE" or "KEY VALUE" pattern.
20
24
  // Returns null if not found or not a valid number.
21
25
  function extract_header_value(lines, key_pattern) {
@@ -71,7 +75,7 @@ function subsample_preserve_peaks(x_values, y_values, target_points) {
71
75
  .map((idx) => ({ idx, y: y_values[idx] }))
72
76
  .sort((a, b) => b.y - a.y)
73
77
  .slice(0, peak_slots)
74
- .map((p) => p.idx);
78
+ .map((peak) => peak.idx);
75
79
  // Uniform sampling (guard against division by zero)
76
80
  const uniform_indices = new Set();
77
81
  if (uniform_slots > 1) {
@@ -174,14 +178,12 @@ export function parse_ras_file(content) {
174
178
  // Detect by: 2-3 values per line, multiple rows, first column monotonically increasing
175
179
  // (angles increase during a scan, intensities do not follow this pattern)
176
180
  const first_values = parse_number_list(data_lines[0]);
177
- const has_column_structure = first_values.length >= 2 && first_values.length <= 3 &&
178
- data_lines.length > 1;
181
+ const has_column_structure = first_values.length >= 2 && first_values.length <= 3 && data_lines.length > 1;
179
182
  if (has_column_structure) {
180
183
  // Check if first column values are monotonically increasing (characteristic of angle data)
181
184
  // Sample a few lines to verify the pattern
182
185
  const sample_count = Math.min(5, data_lines.length);
183
- let is_monotonic = true;
184
- let prev_angle = first_values[0];
186
+ let [is_monotonic, prev_angle] = [true, first_values[0]];
185
187
  for (let idx = 1; idx < sample_count; idx++) {
186
188
  const values = parse_number_list(data_lines[idx]);
187
189
  if (values.length < 2 || values[0] <= prev_angle) {
@@ -245,7 +247,7 @@ export function parse_gsas_file(content) {
245
247
  let bin_type = `CONST`; // CONST, RALF, or others
246
248
  let found_bank = false;
247
249
  for (const line of lines) {
248
- const bank_match = line.match(/BANK\s+\d+\s+(\d+)\s+\d+\s+(\w+)\s+([\d.+-]+)\s+([\d.+-]+)/i);
250
+ const bank_match = /BANK\s+\d+\s+(\d+)\s+\d+\s+(\w+)\s+([\d.+-]+)\s+([\d.+-]+)/i.exec(line);
249
251
  if (bank_match) {
250
252
  bin_type = bank_match[2].toUpperCase();
251
253
  // For CONST type: BCOEF1 is start*100 (centidegrees), BCOEF2 is step*100
@@ -333,9 +335,9 @@ function parse_bruker_raw_v1(view, bytes) {
333
335
  // V1 has ASCII header with scan parameters followed by binary data
334
336
  const header_text = String.fromCharCode(...bytes.slice(0, 512));
335
337
  // Try to find scan parameters in ASCII header
336
- const start_match = header_text.match(/START\s*=\s*([\d.+-]+)/i);
337
- const step_match = header_text.match(/STEP\s*=\s*([\d.+-]+)/i);
338
- const count_match = header_text.match(/(?:COUNT|POINTS|NPTS)\s*=\s*(\d+)/i);
338
+ const start_match = /START\s*=\s*([\d.+-]+)/i.exec(header_text);
339
+ const step_match = /STEP\s*=\s*([\d.+-]+)/i.exec(header_text);
340
+ const count_match = /(?:COUNT|POINTS|NPTS)\s*=\s*(\d+)/i.exec(header_text);
339
341
  const start = start_match ? parseFloat(start_match[1]) : 0;
340
342
  const step = step_match ? parseFloat(step_match[1]) : DEFAULT_STEP_SIZE;
341
343
  // Find where binary data starts (after header)
@@ -397,9 +399,9 @@ function parse_rigaku_raw_file(data) {
397
399
  const bytes = new Uint8Array(data);
398
400
  // Try to find ASCII header section with scan parameters
399
401
  const header_text = String.fromCharCode(...bytes.slice(0, Math.min(2048, bytes.length)));
400
- const start_match = header_text.match(/(?:START|2THETA_START|SCAN_START)\s*[:=]?\s*([\d.+-]+)/i);
401
- const step_match = header_text.match(/(?:STEP|STEP_SIZE|SCAN_STEP)\s*[:=]?\s*([\d.+-]+)/i);
402
- const count_match = header_text.match(/(?:COUNT|POINTS|NPTS|STEPS)\s*[:=]?\s*(\d+)/i);
402
+ const start_match = /(?:START|2THETA_START|SCAN_START)\s*[:=]?\s*([\d.+-]+)/i.exec(header_text);
403
+ const step_match = /(?:STEP|STEP_SIZE|SCAN_STEP)\s*[:=]?\s*([\d.+-]+)/i.exec(header_text);
404
+ const count_match = /(?:COUNT|POINTS|NPTS|STEPS)\s*[:=]?\s*(\d+)/i.exec(header_text);
403
405
  if (!start_match && !step_match && !count_match)
404
406
  return null; // Not a recognizable Rigaku format
405
407
  const start = start_match ? parseFloat(start_match[1]) : 0;
@@ -457,7 +459,7 @@ function read_float32_array(view, offset, count) {
457
459
  // Extracts 2θ and intensity data from the RawData XML within the archive.
458
460
  export async function parse_brml_file(data) {
459
461
  try {
460
- // Lazy import fflate to avoid bundling in SSR (Deno compatibility)
462
+ // Lazy import fflate to avoid bundling in SSR
461
463
  const { unzipSync } = await import(`fflate`);
462
464
  const files = unzipSync(new Uint8Array(data));
463
465
  // Find the RawData XML file (usually named RawData0.xml or similar)
@@ -703,9 +705,7 @@ export async function parse_xrd_file(content, filename) {
703
705
  if (!ext)
704
706
  return null;
705
707
  // Helper to get text content
706
- const get_text = () => typeof content === `string`
707
- ? content
708
- : new TextDecoder().decode(content);
708
+ const get_text = () => typeof content === `string` ? content : new TextDecoder().decode(content);
709
709
  // Helper to get binary content
710
710
  const get_buffer = () => {
711
711
  if (typeof content === `string`) {
package/package.json CHANGED
@@ -1,102 +1,26 @@
1
1
  {
2
2
  "name": "matterviz",
3
+ "version": "0.3.3",
3
4
  "description": "Interactive visualizations for materials science: periodic tables, 3D structures, MD trajectories, heatmaps, scatter plots.",
4
- "author": "Janosh Riebesell <janosh.riebesell@gmail.com>",
5
- "homepage": "https://janosh.github.io/matterviz",
6
- "repository": "https://github.com/janosh/matterviz",
7
- "license": "MIT",
8
- "version": "0.3.1",
9
- "type": "module",
10
- "engines": {
11
- "node": ">=24"
12
- },
13
- "svelte": "./dist/index.js",
14
- "bugs": "https://github.com/janosh/matterviz/issues",
15
- "scripts": {
16
- "dev": "vite dev",
17
- "build": "vite build",
18
- "preview": "vite preview",
19
- "test": "vitest --run && playwright test",
20
- "package": "svelte-package && mkdir -p dist/xrd && cp extensions/rust/src/atomic_scattering_params.json dist/xrd/",
21
- "prepare": "svelte-kit sync && svelte-package && mkdir -p dist/xrd && cp extensions/rust/src/atomic_scattering_params.json dist/xrd/",
22
- "prepublishOnly": "svelte-package && mkdir -p dist/xrd && cp extensions/rust/src/atomic_scattering_params.json dist/xrd/"
23
- },
24
- "dependencies": {
25
- "@spglib/moyo-wasm": "^0.7.7",
26
- "@sveltejs/kit": "^2.50.2",
27
- "@threlte/core": "^8.3.1",
28
- "@threlte/extras": "^9.7.1",
29
- "@types/d3-force": "^3.0.10",
30
- "@types/d3-hierarchy": "^3.1.7",
31
- "@types/js-yaml": "^4.0.9",
32
- "d3": "^7.9.0",
33
- "d3-array": "^3.2.4",
34
- "d3-color": "^3.1.0",
35
- "d3-force": "^3.0.0",
36
- "d3-format": "^3.1.2",
37
- "d3-hierarchy": "^3.1.2",
38
- "d3-interpolate-path": "^2.3.0",
39
- "d3-scale": "^4.0.2",
40
- "d3-scale-chromatic": "^3.1.0",
41
- "d3-shape": "^3.2.0",
42
- "fflate": "^0.8.2",
43
- "h5wasm": "^0.8.11",
44
- "highlight.js": "^11.11.1",
45
- "js-yaml": "^4.1.1",
46
- "svelte": "5.50.0",
47
- "svelte-multiselect": "^11.6.1",
48
- "svelte-toc": "^0.6.2",
49
- "three": "^0.182.0"
50
- },
51
- "devDependencies": {
52
- "@playwright/test": "^1.58.2",
53
- "@rollup/plugin-yaml": "^4.1.2",
54
- "@stylistic/eslint-plugin": "^5.7.1",
55
- "@sveltejs/adapter-static": "3.0.10",
56
- "@sveltejs/package": "^2.5.7",
57
- "@sveltejs/vite-plugin-svelte": "^6.2.4",
58
- "@types/d3-array": "^3.2.2",
59
- "@types/d3-color": "^3.1.3",
60
- "@types/d3-format": "^3.0.4",
61
- "@types/d3-interpolate-path": "^2.0.3",
62
- "@types/d3-scale": "^4.0.9",
63
- "@types/d3-scale-chromatic": "^3.1.0",
64
- "@types/d3-shape": "^3.1.8",
65
- "@types/d3-time-format": "^4.0.3",
66
- "@types/three": "^0.182.0",
67
- "@typescript/native-preview": "7.0.0-dev.20260208.1",
68
- "@vitest/coverage-v8": "^4.0.18",
69
- "@wooorm/starry-night": "^3.9.0",
70
- "abstract-syntax-tree": "^2.22.0",
71
- "d3-time-format": "^4.1.0",
72
- "eslint": "^10.0.0",
73
- "eslint-plugin-svelte": "^3.14.0",
74
- "happy-dom": "^20.5.0",
75
- "matterviz-wasm": "^0.0.6",
76
- "mdsvex": "^0.12.6",
77
- "rehype-katex": "^7.0.1",
78
- "remark-math": "3.0.1",
79
- "svelte-check-rs": "0.9.1",
80
- "svelte-preprocess": "^6.0.3",
81
- "svelte2tsx": "^0.7.47",
82
- "typedoc": "^0.28.16",
83
- "typedoc-plugin-markdown": "^4.10.0",
84
- "typescript": "5.9.3",
85
- "typescript-eslint": "^8.54.0",
86
- "vite": "^7.3.1",
87
- "vitest": "^4.0.18"
88
- },
89
5
  "keywords": [
90
- "svelte",
91
- "periodic table",
92
6
  "chemistry",
7
+ "component",
93
8
  "data viz",
9
+ "periodic table",
94
10
  "plotting",
95
- "component"
11
+ "svelte"
96
12
  ],
97
- "publishConfig": {
98
- "access": "public"
99
- },
13
+ "homepage": "https://janosh.github.io/matterviz",
14
+ "bugs": "https://github.com/janosh/matterviz/issues",
15
+ "license": "MIT",
16
+ "author": "Janosh Riebesell <janosh.riebesell@gmail.com>",
17
+ "repository": "https://github.com/janosh/matterviz",
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "type": "module",
22
+ "types": "./dist/index.d.ts",
23
+ "svelte": "./dist/index.js",
100
24
  "exports": {
101
25
  ".": {
102
26
  "types": "./dist/index.d.ts",
@@ -119,6 +43,10 @@
119
43
  "types": "./dist/composition/index.d.ts",
120
44
  "default": "./dist/composition/index.js"
121
45
  },
46
+ "./chempot-diagram": {
47
+ "types": "./dist/chempot-diagram/index.d.ts",
48
+ "default": "./dist/chempot-diagram/index.js"
49
+ },
122
50
  "./colors": {
123
51
  "types": "./dist/colors/index.d.ts",
124
52
  "default": "./dist/colors/index.js"
@@ -205,7 +133,7 @@
205
133
  },
206
134
  "./theme/themes": {
207
135
  "types": "./dist/theme/themes.d.ts",
208
- "default": "./dist/theme/themes.js"
136
+ "default": "./dist/theme/themes.mjs"
209
137
  },
210
138
  "./tooltip": {
211
139
  "types": "./dist/tooltip/index.d.ts",
@@ -229,13 +157,87 @@
229
157
  },
230
158
  "./xrd/atomic_scattering_params.json": "./dist/xrd/atomic_scattering_params.json"
231
159
  },
232
- "types": "./dist/index.d.ts",
233
- "files": [
234
- "dist"
235
- ],
236
- "pnpm": {
237
- "allowBuilds": [
238
- "esbuild"
239
- ]
240
- }
160
+ "publishConfig": {
161
+ "access": "public"
162
+ },
163
+ "scripts": {
164
+ "dev": "vp dev",
165
+ "build": "vp build",
166
+ "preview": "vp preview",
167
+ "test": "vp test --run && playwright test",
168
+ "check": "vp check",
169
+ "lint": "vp lint",
170
+ "fmt": "vp fmt --write",
171
+ "package-dist-assets": "node scripts/package-dist-assets.mjs",
172
+ "package:dist": "svelte-package && npm run package-dist-assets",
173
+ "package": "npm run package:dist",
174
+ "prepare": "NODE_OPTIONS=--experimental-strip-types svelte-kit sync && npm run package:dist",
175
+ "prepublishOnly": "npm run package:dist"
176
+ },
177
+ "dependencies": {
178
+ "@spglib/moyo-wasm": "^0.7.9",
179
+ "@sveltejs/kit": "2.58.0",
180
+ "@threlte/core": "^8.5.10",
181
+ "@threlte/extras": "^9.15.0",
182
+ "@types/d3-hierarchy": "^3.1.7",
183
+ "@types/js-yaml": "^4.0.9",
184
+ "d3": "^7.9.0",
185
+ "d3-array": "^3.2.4",
186
+ "d3-color": "^3.1.0",
187
+ "d3-format": "^3.1.2",
188
+ "d3-hierarchy": "^3.1.2",
189
+ "d3-interpolate-path": "^2.3.0",
190
+ "d3-scale": "^4.0.2",
191
+ "d3-scale-chromatic": "^3.1.0",
192
+ "d3-shape": "^3.2.0",
193
+ "dompurify": "^3.4.1",
194
+ "fflate": "^0.8.2",
195
+ "h5wasm": "^0.10.1",
196
+ "js-yaml": "^4.1.1",
197
+ "svelte-multiselect": "^11.7.0",
198
+ "three": "^0.184.0"
199
+ },
200
+ "devDependencies": {
201
+ "@playwright/test": "^1.59.1",
202
+ "@rollup/plugin-yaml": "^4.1.2",
203
+ "@sveltejs/adapter-static": "3.0.10",
204
+ "@sveltejs/package": "^2.5.7",
205
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
206
+ "@types/d3-array": "^3.2.2",
207
+ "@types/d3-color": "^3.1.3",
208
+ "@types/d3-format": "^3.0.4",
209
+ "@types/d3-interpolate-path": "^2.0.3",
210
+ "@types/d3-scale": "^4.0.9",
211
+ "@types/d3-scale-chromatic": "^3.1.0",
212
+ "@types/d3-shape": "^3.1.8",
213
+ "@types/d3-time-format": "^4.0.3",
214
+ "@types/node": "^25.6.0",
215
+ "@types/three": "^0.184.0",
216
+ "@typescript/native-preview": "7.0.0-dev.20260429.1",
217
+ "@vitest/coverage-v8": "4.1.5",
218
+ "@wooorm/starry-night": "^3.9.0",
219
+ "d3-time-format": "^4.1.0",
220
+ "happy-dom": "^20.9.0",
221
+ "matterviz-wasm": "^0.0.10",
222
+ "mdsvex": "^0.12.7",
223
+ "rehype-katex": "^7.0.1",
224
+ "remark-math": "3.0.1",
225
+ "svelte": "5.55.5",
226
+ "svelte-check-rs": "0.9.7",
227
+ "typescript": "6.0.3",
228
+ "vite": "npm:@voidzero-dev/vite-plus-core@^0.1.20",
229
+ "vite-plus": "latest",
230
+ "vitest": "npm:@voidzero-dev/vite-plus-test@^0.1.20"
231
+ },
232
+ "peerDependencies": {
233
+ "svelte": "^5.0.0"
234
+ },
235
+ "overrides": {
236
+ "vite": "npm:@voidzero-dev/vite-plus-core@^0.1.20",
237
+ "vitest": "npm:@voidzero-dev/vite-plus-test@^0.1.20"
238
+ },
239
+ "engines": {
240
+ "node": ">=24"
241
+ },
242
+ "packageManager": "pnpm@10.33.0"
241
243
  }
package/readme.md CHANGED
@@ -55,7 +55,7 @@ Rich element pages with physical properties, electron configurations, Bohr atom
55
55
  ## 🔨 &thinsp; Installation
56
56
 
57
57
  ```sh
58
- npm install --dev matterviz
58
+ npm add -D matterviz
59
59
  ```
60
60
 
61
61
  ## 📙 &thinsp; Usage
@@ -114,10 +114,10 @@ npm install --dev matterviz
114
114
 
115
115
  ## 🙏 &thinsp; Acknowledgements
116
116
 
117
- - Element properties in `src/lib/element-data.ts` were combined from [`Bowserinator/Periodic-Table-JSON`](https://github.com/Bowserinator/Periodic-Table-JSON/blob/master/PeriodicTableJSON.json) under Creative Commons license and [`robertwb/Periodic Table of Elements.csv`](https://gist.github.com/robertwb/22aa4dbfb6bcecd94f2176caa912b952) (unlicensed).
117
+ - Element properties in `src/lib/element/data.ts` were combined from [`Bowserinator/Periodic-Table-JSON`](https://github.com/Bowserinator/Periodic-Table-JSON/blob/master/PeriodicTableJSON.json) under Creative Commons license and [`robertwb/Periodic Table of Elements.csv`](https://gist.github.com/robertwb/22aa4dbfb6bcecd94f2176caa912b952) (unlicensed).
118
118
  - Thanks to [Images of Elements](https://images-of-elements.com) for providing photos of elemental crystals and glowing excited gases.
119
119
  - Thanks to [@kadinzhang](https://github.com/kadinzhang) and their [Periodicity project](https://ptable.netlify.app) [[code](https://github.com/kadinzhang/Periodicity)] for the idea to display animated Bohr model atoms and inset a scatter plot into the periodic table to visualize the periodic nature of elemental properties.
120
- - Big thanks to all sources of element images. See [`fetch-elem-images.ts`](https://github.com/janosh/matterviz/blob/-/src/fetch-elem-images.ts) and [`static/elements`](https://github.com/janosh/matterviz/tree/main/static/elements).
120
+ - Big thanks to all sources of element images. See [`fetch-elem-images.ts`](https://github.com/janosh/matterviz/blob/-/src/scripts/fetch-elem-images.ts) and [`static/elements`](https://github.com/janosh/matterviz/tree/main/static/elements).
121
121
  - Thanks to [@ixxie](https://github.com/ixxie) ([shenhav.fyi](https://shenhav.fyi)) for great suggestions.
122
122
 
123
123
  This project would not have been possible as a one-person side project without many fine open-source projects. 🙏 To name just a few:
@@ -141,6 +141,6 @@ Use [`citation.cff`](citation.cff) or cite the [Zenodo record](https://zenodo.or
141
141
  url = {https://github.com/janosh/matterviz},
142
142
  note = {10.5281/zenodo.17094509 - https://github.com/janosh/matterviz},
143
143
  urldate = {2026-01-23}, % optional, replace with your date of access
144
- version = {0.2.2}, % replace with the version you use
144
+ version = {0.3.1}, % replace with the version you use
145
145
  }
146
146
  ```
@@ -1,42 +0,0 @@
1
- import type { ElementSymbol } from '../element';
2
- import type { FrameIndex, FrameLoader, ParseProgress, TrajectoryFrame, TrajectoryMetadata, TrajectoryType } from './index';
3
- export declare const MAX_SAFE_STRING_LENGTH: number;
4
- export declare const MAX_METADATA_SIZE: number;
5
- export declare const LARGE_FILE_THRESHOLD: number;
6
- export declare const INDEX_SAMPLE_RATE = 100;
7
- export declare const MAX_BIN_FILE_SIZE: number;
8
- export declare const MAX_TEXT_FILE_SIZE: number;
9
- export type AtomTypeMapping = Record<number, ElementSymbol>;
10
- export interface LoadingOptions {
11
- use_indexing?: boolean;
12
- buffer_size?: number;
13
- index_sample_rate?: number;
14
- extract_plot_metadata?: boolean;
15
- bin_file_threshold?: number;
16
- text_file_threshold?: number;
17
- atom_type_mapping?: AtomTypeMapping;
18
- }
19
- export declare function is_trajectory_file(filename: string, content?: string): boolean;
20
- export declare class TrajFrameReader implements FrameLoader {
21
- private format;
22
- private global_numbers?;
23
- constructor(filename: string);
24
- get_total_frames(data: string | ArrayBuffer): Promise<number>;
25
- build_frame_index(data: string | ArrayBuffer, sample_rate: number, on_progress?: (progress: ParseProgress) => void): Promise<FrameIndex[]>;
26
- load_frame(data: string | ArrayBuffer, frame_number: number): Promise<TrajectoryFrame | null>;
27
- extract_plot_metadata(data: string | ArrayBuffer, options?: {
28
- sample_rate?: number;
29
- properties?: string[];
30
- }, on_progress?: (progress: ParseProgress) => void): Promise<TrajectoryMetadata[]>;
31
- private load_xyz_frame;
32
- private load_ase_frame;
33
- private parse_xyz_metadata;
34
- private parse_ase_metadata;
35
- }
36
- export declare function parse_trajectory_data(data: unknown, filename?: string, atom_type_mapping?: AtomTypeMapping): Promise<TrajectoryType>;
37
- export declare function get_unsupported_format_message(filename: string, content: string): string | null;
38
- export declare function parse_trajectory_async(data: ArrayBuffer | string, filename: string, on_progress?: (progress: ParseProgress) => void, options?: LoadingOptions): Promise<TrajectoryType>;
39
- export declare function create_frame_loader(filename: string): FrameLoader;
40
- export declare const XYZFrameLoader: typeof TrajFrameReader;
41
- export declare const ASEFrameLoader: typeof TrajFrameReader;
42
- export declare function load_binary_traj(resp: Response, type: string, fallback?: boolean): Promise<ArrayBuffer | string>;