matterviz 0.4.0 → 0.4.2

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 (527) hide show
  1. package/dist/EmptyState.svelte +10 -4
  2. package/dist/FilePicker.svelte +12 -14
  3. package/dist/Icon.svelte +7 -4
  4. package/dist/MillerIndexInput.svelte +2 -2
  5. package/dist/app.css +53 -0
  6. package/dist/brillouin/BrillouinZone.svelte +132 -219
  7. package/dist/brillouin/BrillouinZone.svelte.d.ts +9 -20
  8. package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
  9. package/dist/brillouin/BrillouinZoneExportPane.svelte +47 -96
  10. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  11. package/dist/brillouin/BrillouinZoneInfoPane.svelte +15 -42
  12. package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
  13. package/dist/brillouin/BrillouinZoneScene.svelte +63 -230
  14. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
  15. package/dist/brillouin/ReciprocalVectors.svelte +39 -0
  16. package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
  17. package/dist/brillouin/compute.d.ts +2 -0
  18. package/dist/brillouin/compute.js +80 -77
  19. package/dist/brillouin/geometry.d.ts +8 -0
  20. package/dist/brillouin/geometry.js +57 -0
  21. package/dist/brillouin/index.d.ts +2 -0
  22. package/dist/brillouin/index.js +2 -0
  23. package/dist/brillouin/types.d.ts +2 -2
  24. package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
  25. package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
  26. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +143 -246
  27. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
  28. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +652 -976
  29. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
  30. package/dist/chempot-diagram/async-compute.svelte.js +1 -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 +3 -3
  34. package/dist/chempot-diagram/compute.js +3 -1
  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.d.ts +0 -4
  45. package/dist/colors/index.js +21 -22
  46. package/dist/composition/BarChart.svelte +37 -31
  47. package/dist/composition/BubbleChart.svelte +17 -17
  48. package/dist/composition/Composition.svelte +7 -11
  49. package/dist/composition/Formula.svelte +18 -25
  50. package/dist/composition/FormulaFilter.svelte +96 -98
  51. package/dist/composition/PieChart.svelte +60 -46
  52. package/dist/composition/chem-sys.js +3 -2
  53. package/dist/composition/format.js +4 -3
  54. package/dist/composition/index.d.ts +2 -0
  55. package/dist/composition/index.js +14 -0
  56. package/dist/composition/parse.d.ts +2 -3
  57. package/dist/composition/parse.js +27 -28
  58. package/dist/constants.js +11 -9
  59. package/dist/controls.d.ts +1 -0
  60. package/dist/controls.js +0 -1
  61. package/dist/convex-hull/ConvexHull.svelte +20 -25
  62. package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
  63. package/dist/convex-hull/ConvexHull2D.svelte +176 -256
  64. package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
  65. package/dist/convex-hull/ConvexHull3D.svelte +269 -804
  66. package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
  67. package/dist/convex-hull/ConvexHull4D.svelte +236 -755
  68. package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
  69. package/dist/convex-hull/ConvexHullChrome.svelte +264 -0
  70. package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
  71. package/dist/convex-hull/ConvexHullControls.svelte +128 -49
  72. package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
  73. package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
  74. package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
  75. package/dist/convex-hull/ConvexHullStats.svelte +210 -351
  76. package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
  77. package/dist/convex-hull/ConvexHullTooltip.svelte +16 -14
  78. package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
  79. package/dist/convex-hull/GasPressureControls.svelte +5 -12
  80. package/dist/convex-hull/StructurePopup.svelte +17 -21
  81. package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
  82. package/dist/convex-hull/TemperatureSlider.svelte +4 -10
  83. package/dist/convex-hull/barycentric-coords.d.ts +2 -4
  84. package/dist/convex-hull/barycentric-coords.js +6 -33
  85. package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
  86. package/dist/convex-hull/canvas-interactions.svelte.js +279 -0
  87. package/dist/convex-hull/helpers.d.ts +47 -17
  88. package/dist/convex-hull/helpers.js +186 -101
  89. package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
  90. package/dist/convex-hull/hull-state.svelte.js +124 -0
  91. package/dist/convex-hull/index.d.ts +9 -7
  92. package/dist/convex-hull/index.js +7 -2
  93. package/dist/convex-hull/thermodynamics.js +109 -937
  94. package/dist/convex-hull/types.d.ts +12 -4
  95. package/dist/convex-hull/types.js +12 -0
  96. package/dist/coordination/CoordinationBarPlot.svelte +41 -43
  97. package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
  98. package/dist/coordination/calc-coordination.d.ts +1 -1
  99. package/dist/coordination/calc-coordination.js +28 -25
  100. package/dist/element/BohrAtom.svelte +6 -8
  101. package/dist/element/ElementHeading.svelte +4 -1
  102. package/dist/element/ElementPhoto.svelte +11 -9
  103. package/dist/element/ElementStats.svelte +12 -10
  104. package/dist/element/ElementTile.svelte +24 -29
  105. package/dist/element/ElementTile.svelte.d.ts +1 -1
  106. package/dist/element/Nucleus.svelte +4 -2
  107. package/dist/element/data.d.ts +1 -2
  108. package/dist/element/helpers.d.ts +4 -0
  109. package/dist/element/helpers.js +18 -0
  110. package/dist/element/index.d.ts +1 -0
  111. package/dist/element/index.js +3 -0
  112. package/dist/feedback/DragOverlay.svelte +5 -3
  113. package/dist/feedback/DragOverlay.svelte.d.ts +2 -1
  114. package/dist/feedback/StatusMessage.svelte +20 -7
  115. package/dist/fermi-surface/FermiSlice.svelte +21 -18
  116. package/dist/fermi-surface/FermiSurface.svelte +78 -165
  117. package/dist/fermi-surface/FermiSurface.svelte.d.ts +9 -20
  118. package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
  119. package/dist/fermi-surface/FermiSurfaceScene.svelte +93 -272
  120. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
  121. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
  122. package/dist/fermi-surface/compute.js +14 -13
  123. package/dist/fermi-surface/export.js +4 -15
  124. package/dist/fermi-surface/index.d.ts +0 -1
  125. package/dist/fermi-surface/index.js +0 -1
  126. package/dist/fermi-surface/parse.d.ts +1 -1
  127. package/dist/fermi-surface/parse.js +84 -97
  128. package/dist/fermi-surface/types.d.ts +2 -2
  129. package/dist/heatmap-matrix/HeatmapMatrix.svelte +161 -185
  130. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +6 -5
  131. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +12 -9
  132. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
  133. package/dist/heatmap-matrix/index.d.ts +8 -2
  134. package/dist/icons.d.ts +4 -0
  135. package/dist/icons.js +4 -0
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.js +1 -0
  138. package/dist/io/ExportPane.svelte +170 -0
  139. package/dist/io/ExportPane.svelte.d.ts +17 -0
  140. package/dist/io/decompress.d.ts +2 -1
  141. package/dist/io/decompress.js +22 -36
  142. package/dist/io/export.d.ts +9 -1
  143. package/dist/io/export.js +37 -29
  144. package/dist/io/fetch.d.ts +2 -4
  145. package/dist/io/fetch.js +0 -11
  146. package/dist/io/file-drop.d.ts +7 -0
  147. package/dist/io/file-drop.js +13 -0
  148. package/dist/io/index.d.ts +1 -0
  149. package/dist/io/index.js +3 -0
  150. package/dist/io/is-binary.d.ts +9 -0
  151. package/dist/io/is-binary.js +45 -1
  152. package/dist/io/types.d.ts +13 -0
  153. package/dist/io/url-drop.js +13 -25
  154. package/dist/isosurface/Isosurface.svelte +17 -23
  155. package/dist/isosurface/IsosurfaceControls.svelte +37 -42
  156. package/dist/isosurface/parse-vaspwave.d.ts +3 -0
  157. package/dist/isosurface/parse-vaspwave.js +138 -0
  158. package/dist/isosurface/parse.js +50 -48
  159. package/dist/labels.d.ts +6 -2
  160. package/dist/labels.js +44 -14
  161. package/dist/layout/FullscreenButton.svelte +34 -0
  162. package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
  163. package/dist/layout/FullscreenToggle.svelte +12 -12
  164. package/dist/layout/InfoCard.svelte +7 -18
  165. package/dist/layout/InfoTag.svelte +1 -3
  166. package/dist/layout/NumberRangeInput.svelte +46 -0
  167. package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
  168. package/dist/layout/PropertyFilter.svelte +2 -6
  169. package/dist/layout/SettingsSection.svelte +21 -17
  170. package/dist/layout/SubpageGrid.svelte +3 -1
  171. package/dist/layout/ViewerChrome.svelte +115 -0
  172. package/dist/layout/ViewerChrome.svelte.d.ts +18 -0
  173. package/dist/layout/fullscreen.d.ts +4 -0
  174. package/dist/layout/fullscreen.js +3 -5
  175. package/dist/layout/fullscreen.svelte.d.ts +8 -0
  176. package/dist/layout/fullscreen.svelte.js +36 -0
  177. package/dist/layout/index.d.ts +4 -0
  178. package/dist/layout/index.js +4 -0
  179. package/dist/layout/json-tree/JsonNode.svelte +8 -11
  180. package/dist/layout/json-tree/JsonTree.svelte +53 -77
  181. package/dist/layout/json-tree/JsonValue.svelte +7 -15
  182. package/dist/layout/json-tree/utils.js +14 -23
  183. package/dist/math.d.ts +9 -3
  184. package/dist/math.js +37 -21
  185. package/dist/overlays/ContextMenu.svelte +4 -2
  186. package/dist/overlays/CopyButton.svelte +11 -5
  187. package/dist/overlays/DragControlTab.svelte +6 -1
  188. package/dist/overlays/DraggablePane.svelte +81 -26
  189. package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
  190. package/dist/overlays/GlassChip.svelte +30 -0
  191. package/dist/overlays/GlassChip.svelte.d.ts +8 -0
  192. package/dist/overlays/InfoPaneCards.svelte +11 -23
  193. package/dist/overlays/index.d.ts +11 -0
  194. package/dist/overlays/index.js +26 -0
  195. package/dist/overlays/portal.d.ts +2 -0
  196. package/dist/overlays/portal.js +14 -0
  197. package/dist/periodic-table/PeriodicTable.svelte +115 -146
  198. package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
  199. package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
  200. package/dist/periodic-table/TableInset.svelte +9 -4
  201. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
  202. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
  203. package/dist/phase-diagram/PhaseDiagramControls.svelte +73 -96
  204. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
  205. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
  206. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
  207. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +49 -134
  208. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
  209. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
  210. package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
  211. package/dist/phase-diagram/build-diagram.js +3 -3
  212. package/dist/phase-diagram/colors.js +1 -1
  213. package/dist/phase-diagram/diagram-input.d.ts +1 -2
  214. package/dist/phase-diagram/parse.d.ts +2 -1
  215. package/dist/phase-diagram/parse.js +15 -15
  216. package/dist/phase-diagram/svg-to-diagram.js +21 -15
  217. package/dist/phase-diagram/utils.js +2 -3
  218. package/dist/plot/bar/BarPlot.svelte +494 -692
  219. package/dist/plot/bar/BarPlot.svelte.d.ts +9 -15
  220. package/dist/plot/bar/BarPlotControls.svelte +1 -3
  221. package/dist/plot/bar/BarPlotControls.svelte.d.ts +5 -7
  222. package/dist/plot/bar/SpacegroupBarPlot.svelte +31 -37
  223. package/dist/plot/bar/data.d.ts +5 -4
  224. package/dist/plot/bar/data.js +2 -1
  225. package/dist/plot/box/BoxPlot.svelte +361 -439
  226. package/dist/plot/box/BoxPlot.svelte.d.ts +6 -3
  227. package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
  228. package/dist/plot/box/Violin.svelte.d.ts +2 -1
  229. package/dist/plot/box/box-plot.d.ts +3 -2
  230. package/dist/plot/box/box-plot.js +6 -3
  231. package/dist/plot/box/kde.d.ts +2 -1
  232. package/dist/plot/box/kde.js +4 -4
  233. package/dist/plot/core/auto-place.d.ts +1 -1
  234. package/dist/plot/core/auto-place.js +5 -2
  235. package/dist/plot/core/axis-utils.d.ts +12 -7
  236. package/dist/plot/core/axis-utils.js +48 -48
  237. package/dist/plot/core/components/AxisLabel.svelte +82 -20
  238. package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
  239. package/dist/plot/core/components/ColorBar.svelte +106 -111
  240. package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
  241. package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
  242. package/dist/plot/core/components/FillArea.svelte +10 -17
  243. package/dist/plot/core/components/HierarchyControls.svelte +249 -0
  244. package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
  245. package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
  246. package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
  247. package/dist/plot/core/components/Line.svelte +21 -11
  248. package/dist/plot/core/components/Line.svelte.d.ts +5 -2
  249. package/dist/plot/core/components/PlotAxis.svelte +42 -18
  250. package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
  251. package/dist/plot/core/components/PlotControls.svelte +65 -41
  252. package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
  253. package/dist/plot/core/components/PlotLegend.svelte +31 -35
  254. package/dist/plot/core/components/PlotMarginals.svelte +616 -0
  255. package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
  256. package/dist/plot/core/components/PlotTooltip.svelte +1 -1
  257. package/dist/plot/core/components/PortalSelect.svelte +4 -8
  258. package/dist/plot/core/components/ReferenceLine.svelte +27 -24
  259. package/dist/plot/core/components/ReferenceLine3D.svelte +56 -59
  260. package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
  261. package/dist/plot/core/components/ReferencePlane.svelte +9 -10
  262. package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
  263. package/dist/plot/core/components/ZeroLines.svelte +4 -8
  264. package/dist/plot/core/components/ZoomRect.svelte +1 -2
  265. package/dist/plot/core/components/index.d.ts +1 -0
  266. package/dist/plot/core/components/index.js +1 -0
  267. package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
  268. package/dist/plot/core/data-cleaning-signal.js +467 -0
  269. package/dist/plot/core/data-cleaning.d.ts +2 -42
  270. package/dist/plot/core/data-cleaning.js +29 -476
  271. package/dist/plot/core/data-transform.js +9 -5
  272. package/dist/plot/core/fill-utils.d.ts +7 -4
  273. package/dist/plot/core/fill-utils.js +34 -9
  274. package/dist/plot/core/index.d.ts +1 -0
  275. package/dist/plot/core/index.js +1 -0
  276. package/dist/plot/core/interactions.d.ts +5 -1
  277. package/dist/plot/core/interactions.js +14 -2
  278. package/dist/plot/core/layout.d.ts +3 -1
  279. package/dist/plot/core/layout.js +22 -13
  280. package/dist/plot/core/marginals.d.ts +170 -0
  281. package/dist/plot/core/marginals.js +436 -0
  282. package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
  283. package/dist/plot/core/pan-zoom.svelte.js +221 -0
  284. package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
  285. package/dist/plot/core/placed-tween.svelte.js +68 -0
  286. package/dist/plot/core/reference-line.d.ts +10 -10
  287. package/dist/plot/core/reference-line.js +7 -7
  288. package/dist/plot/core/scales.d.ts +40 -25
  289. package/dist/plot/core/scales.js +49 -21
  290. package/dist/plot/core/svg.d.ts +2 -1
  291. package/dist/plot/core/types/fills.d.ts +101 -0
  292. package/dist/plot/core/types/fills.js +15 -0
  293. package/dist/plot/core/types/plot-3d.d.ts +87 -0
  294. package/dist/plot/core/types/plot-3d.js +4 -0
  295. package/dist/plot/core/types/reference-lines.d.ts +140 -0
  296. package/dist/plot/core/types/reference-lines.js +9 -0
  297. package/dist/plot/core/types.d.ts +47 -331
  298. package/dist/plot/core/types.js +23 -20
  299. package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
  300. package/dist/plot/core/utils/hierarchy-chart.js +179 -0
  301. package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
  302. package/dist/plot/core/utils/hierarchy-labels.js +99 -0
  303. package/dist/plot/core/utils/label-placement.d.ts +1 -1
  304. package/dist/plot/core/utils/label-placement.js +5 -5
  305. package/dist/plot/core/utils.d.ts +2 -1
  306. package/dist/plot/histogram/Histogram.svelte +373 -631
  307. package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
  308. package/dist/plot/histogram/HistogramControls.svelte +30 -28
  309. package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
  310. package/dist/plot/histogram/histogram.d.ts +31 -0
  311. package/dist/plot/histogram/histogram.js +70 -0
  312. package/dist/plot/histogram/index.d.ts +1 -0
  313. package/dist/plot/histogram/index.js +1 -0
  314. package/dist/plot/index.d.ts +1 -0
  315. package/dist/plot/index.js +1 -0
  316. package/dist/plot/sankey/Sankey.svelte +79 -73
  317. package/dist/plot/sankey/Sankey.svelte.d.ts +3 -3
  318. package/dist/plot/sankey/SankeyControls.svelte +22 -16
  319. package/dist/plot/sankey/sankey.js +3 -1
  320. package/dist/plot/scatter/BinnedScatterPlot.svelte +264 -112
  321. package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +11 -4
  322. package/dist/plot/scatter/ElementScatter.svelte +4 -1
  323. package/dist/plot/scatter/ScatterPlot.svelte +623 -821
  324. package/dist/plot/scatter/ScatterPlot.svelte.d.ts +9 -15
  325. package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
  326. package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
  327. package/dist/plot/scatter/ScatterPoint.svelte +16 -9
  328. package/dist/plot/scatter/binned-scatter-types.d.ts +6 -12
  329. package/dist/plot/scatter/binned-scatter-types.js +6 -1
  330. package/dist/plot/scatter/index.d.ts +1 -1
  331. package/dist/plot/scatter/scatter-data.d.ts +1 -1
  332. package/dist/plot/scatter/scatter-data.js +8 -7
  333. package/dist/plot/scatter-3d/ScatterPlot3D.svelte +40 -60
  334. package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
  335. package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +17 -15
  336. package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
  337. package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +232 -234
  338. package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
  339. package/dist/plot/scatter-3d/Surface3D.svelte +9 -17
  340. package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
  341. package/dist/plot/sunburst/Sunburst.svelte +256 -338
  342. package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
  343. package/dist/plot/sunburst/index.d.ts +1 -1
  344. package/dist/plot/sunburst/index.js +2 -1
  345. package/dist/plot/sunburst/render.d.ts +2 -2
  346. package/dist/plot/sunburst/render.js +47 -22
  347. package/dist/plot/sunburst/sunburst.d.ts +5 -1
  348. package/dist/plot/sunburst/sunburst.js +14 -4
  349. package/dist/plot/treemap/Treemap.svelte +907 -0
  350. package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
  351. package/dist/plot/treemap/index.d.ts +3 -0
  352. package/dist/plot/treemap/index.js +4 -0
  353. package/dist/plot/treemap/treemap.d.ts +26 -0
  354. package/dist/plot/treemap/treemap.js +99 -0
  355. package/dist/rdf/RdfPlot.svelte +22 -26
  356. package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
  357. package/dist/rdf/calc-rdf.js +4 -8
  358. package/dist/sanitize.js +14 -3
  359. package/dist/scene/SceneCamera.svelte +62 -0
  360. package/dist/scene/SceneCamera.svelte.d.ts +19 -0
  361. package/dist/scene/bind-renderer.svelte.d.ts +2 -0
  362. package/dist/scene/bind-renderer.svelte.js +22 -0
  363. package/dist/scene/index.d.ts +4 -0
  364. package/dist/scene/index.js +5 -0
  365. package/dist/scene/props.js +52 -0
  366. package/dist/scene/types.d.ts +26 -0
  367. package/dist/scene/types.js +1 -0
  368. package/dist/settings.d.ts +33 -11
  369. package/dist/settings.js +136 -51
  370. package/dist/spectral/Bands.svelte +231 -237
  371. package/dist/spectral/Bands.svelte.d.ts +3 -2
  372. package/dist/spectral/BandsAndDos.svelte +29 -29
  373. package/dist/spectral/BrillouinBandsDos.svelte +21 -29
  374. package/dist/spectral/Dos.svelte +75 -77
  375. package/dist/spectral/Dos.svelte.d.ts +2 -1
  376. package/dist/spectral/helpers.d.ts +9 -9
  377. package/dist/spectral/helpers.js +66 -70
  378. package/dist/state.svelte.d.ts +0 -7
  379. package/dist/state.svelte.js +5 -24
  380. package/dist/structure/Arrow.svelte +6 -21
  381. package/dist/structure/ArrowInstances.svelte +160 -0
  382. package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
  383. package/dist/structure/AtomLegend.svelte +115 -75
  384. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  385. package/dist/structure/Bond.svelte +31 -23
  386. package/dist/structure/CanvasTooltip.svelte +16 -3
  387. package/dist/structure/CellSelect.svelte +22 -29
  388. package/dist/structure/CellSelect.svelte.d.ts +2 -1
  389. package/dist/structure/Cylinder.svelte +24 -40
  390. package/dist/structure/InstancedAtoms.svelte +114 -0
  391. package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
  392. package/dist/structure/Lattice.svelte +85 -149
  393. package/dist/structure/SiteLabels.svelte +122 -0
  394. package/dist/structure/SiteLabels.svelte.d.ts +18 -0
  395. package/dist/structure/Structure.svelte +725 -735
  396. package/dist/structure/Structure.svelte.d.ts +8 -16
  397. package/dist/structure/StructureCarousel.svelte +630 -0
  398. package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
  399. package/dist/structure/StructureControls.svelte +298 -325
  400. package/dist/structure/StructureControls.svelte.d.ts +5 -3
  401. package/dist/structure/StructureExportPane.svelte +62 -168
  402. package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
  403. package/dist/structure/StructureInfoPane.svelte +77 -69
  404. package/dist/structure/StructureInfoPane.svelte.d.ts +6 -6
  405. package/dist/structure/StructureScene.svelte +758 -600
  406. package/dist/structure/StructureScene.svelte.d.ts +24 -20
  407. package/dist/structure/StructureViewport.svelte +386 -0
  408. package/dist/structure/StructureViewport.svelte.d.ts +63 -0
  409. package/dist/structure/atom-label-placement.d.ts +18 -0
  410. package/dist/structure/atom-label-placement.js +115 -0
  411. package/dist/structure/atom-properties.d.ts +3 -1
  412. package/dist/structure/atom-properties.js +115 -54
  413. package/dist/structure/bond-order-perception.js +2 -4
  414. package/dist/structure/bonding.d.ts +12 -2
  415. package/dist/structure/bonding.js +172 -73
  416. package/dist/structure/edit-history.d.ts +6 -0
  417. package/dist/structure/edit-history.js +27 -0
  418. package/dist/structure/export.d.ts +25 -4
  419. package/dist/structure/export.js +103 -153
  420. package/dist/structure/format-detect.d.ts +1 -0
  421. package/dist/structure/format-detect.js +22 -0
  422. package/dist/structure/geometry.d.ts +9 -0
  423. package/dist/structure/geometry.js +27 -0
  424. package/dist/structure/index.d.ts +18 -1
  425. package/dist/structure/index.js +15 -2
  426. package/dist/structure/measure.d.ts +1 -1
  427. package/dist/structure/measure.js +6 -12
  428. package/dist/structure/parse.d.ts +5 -3
  429. package/dist/structure/parse.js +551 -567
  430. package/dist/structure/partial-occupancy.d.ts +0 -1
  431. package/dist/structure/partial-occupancy.js +5 -3
  432. package/dist/structure/pbc.d.ts +1 -1
  433. package/dist/structure/pbc.js +204 -51
  434. package/dist/structure/polyhedra.d.ts +40 -0
  435. package/dist/structure/polyhedra.js +587 -0
  436. package/dist/structure/site.d.ts +4 -0
  437. package/dist/structure/site.js +1 -0
  438. package/dist/structure/supercell.d.ts +1 -2
  439. package/dist/structure/supercell.js +10 -15
  440. package/dist/structure/validation.js +5 -6
  441. package/dist/symmetry/SymmetryElementControls.svelte +69 -0
  442. package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
  443. package/dist/symmetry/SymmetryElements.svelte +350 -0
  444. package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
  445. package/dist/symmetry/SymmetryStats.svelte +142 -49
  446. package/dist/symmetry/WyckoffTable.svelte +58 -16
  447. package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
  448. package/dist/symmetry/cell-transform.js +8 -14
  449. package/dist/symmetry/index.d.ts +15 -4
  450. package/dist/symmetry/index.js +308 -81
  451. package/dist/symmetry/spacegroups.d.ts +5 -1
  452. package/dist/symmetry/spacegroups.js +18 -3
  453. package/dist/symmetry/symmetry-elements.d.ts +33 -0
  454. package/dist/symmetry/symmetry-elements.js +521 -0
  455. package/dist/symmetry/wyckoff-db.d.ts +9 -0
  456. package/dist/symmetry/wyckoff-db.js +87 -0
  457. package/dist/table/HeatmapTable.svelte +1104 -378
  458. package/dist/table/HeatmapTable.svelte.d.ts +12 -2
  459. package/dist/table/ToggleMenu.svelte +5 -12
  460. package/dist/table/index.d.ts +21 -6
  461. package/dist/table/index.js +34 -21
  462. package/dist/theme/ThemeControl.svelte +16 -8
  463. package/dist/theme/index.d.ts +1 -5
  464. package/dist/theme/index.js +4 -10
  465. package/dist/theme/themes.mjs +14 -7
  466. package/dist/tooltip/KCoords.svelte +4 -1
  467. package/dist/tooltip/TooltipContent.svelte +2 -5
  468. package/dist/trajectory/Trajectory.svelte +556 -352
  469. package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
  470. package/dist/trajectory/TrajectoryError.svelte +11 -8
  471. package/dist/trajectory/TrajectoryExportPane.svelte +28 -54
  472. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
  473. package/dist/trajectory/TrajectoryInfoPane.svelte +88 -99
  474. package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
  475. package/dist/trajectory/constants.js +6 -2
  476. package/dist/trajectory/extract.js +73 -71
  477. package/dist/trajectory/format-detect.d.ts +0 -1
  478. package/dist/trajectory/format-detect.js +13 -17
  479. package/dist/trajectory/frame-reader.d.ts +2 -1
  480. package/dist/trajectory/frame-reader.js +74 -136
  481. package/dist/trajectory/helpers.d.ts +12 -2
  482. package/dist/trajectory/helpers.js +68 -37
  483. package/dist/trajectory/index.d.ts +1 -0
  484. package/dist/trajectory/index.js +3 -0
  485. package/dist/trajectory/parse/ase.d.ts +9 -1
  486. package/dist/trajectory/parse/ase.js +47 -32
  487. package/dist/trajectory/parse/diagnostics.d.ts +3 -0
  488. package/dist/trajectory/parse/diagnostics.js +14 -0
  489. package/dist/trajectory/parse/h5-utils.d.ts +13 -0
  490. package/dist/trajectory/parse/h5-utils.js +109 -0
  491. package/dist/trajectory/parse/hdf5.d.ts +1 -1
  492. package/dist/trajectory/parse/hdf5.js +116 -106
  493. package/dist/trajectory/parse/index.d.ts +3 -4
  494. package/dist/trajectory/parse/index.js +68 -119
  495. package/dist/trajectory/parse/lammps.d.ts +0 -2
  496. package/dist/trajectory/parse/lammps.js +14 -16
  497. package/dist/trajectory/parse/pymatgen.d.ts +2 -0
  498. package/dist/trajectory/parse/pymatgen.js +74 -0
  499. package/dist/trajectory/parse/vasp.js +13 -9
  500. package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
  501. package/dist/trajectory/parse/vaspout-electronic.js +207 -0
  502. package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
  503. package/dist/trajectory/parse/vaspout-h5.js +284 -0
  504. package/dist/trajectory/parse/xyz.d.ts +9 -21
  505. package/dist/trajectory/parse/xyz.js +38 -39
  506. package/dist/trajectory/plotting.d.ts +8 -10
  507. package/dist/trajectory/plotting.js +102 -127
  508. package/dist/utils.d.ts +4 -0
  509. package/dist/utils.js +8 -1
  510. package/dist/xrd/XrdPlot.svelte +56 -85
  511. package/dist/xrd/broadening.d.ts +2 -1
  512. package/dist/xrd/broadening.js +2 -1
  513. package/dist/xrd/calc-xrd.js +8 -15
  514. package/dist/xrd/index.d.ts +2 -2
  515. package/dist/xrd/parse.d.ts +0 -1
  516. package/dist/xrd/parse.js +56 -73
  517. package/package.json +77 -36
  518. package/dist/api/mp.d.ts +0 -6
  519. package/dist/api/mp.js +0 -22
  520. package/dist/element/data.json +0 -11864
  521. package/dist/fermi-surface/marching-cubes.d.ts +0 -2
  522. package/dist/fermi-surface/marching-cubes.js +0 -2
  523. package/dist/plot/core/hover-lock.svelte.d.ts +0 -14
  524. package/dist/plot/core/hover-lock.svelte.js +0 -45
  525. package/dist/plot/sunburst/SunburstControls.svelte +0 -200
  526. package/dist/structure/label-placement.d.ts +0 -14
  527. package/dist/structure/label-placement.js +0 -72
@@ -1,11 +1,13 @@
1
1
  import { get_electro_neg_formula } from '../composition';
2
2
  import { download } from '../io/fetch';
3
3
  import * as math from '../math';
4
+ import { is_plain_object } from '../utils';
4
5
  import { Color, Group, Matrix4, Mesh, MeshStandardMaterial, ShaderMaterial } from 'three';
5
6
  import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
6
7
  import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js';
7
- // Type guard to check if a material has a color property (duck typing for bundler compatibility)
8
- // Uses duck typing to work across different Three.js instances (Threlte vs vanilla Three.js)
8
+ // @internal exported only for tests - not part of the public API.
9
+ // Type guard to check if a material has a color property (duck typing for bundler
10
+ // compatibility across different Three.js instances - Threlte vs vanilla Three.js).
9
11
  export function has_color_property(mat) {
10
12
  if (!(`color` in mat))
11
13
  return false;
@@ -47,8 +49,9 @@ function convert_shader_to_standard(shader_mat) {
47
49
  standard_mat.name = shader_mat.name || `converted_shader_material`;
48
50
  return standard_mat;
49
51
  }
50
- // Extract bond gradient colors from geometry attributes for a specific instance
51
- // Returns midpoint color between start and end colors for the bond
52
+ // @internal exported only for tests - not part of the public API.
53
+ // Extract bond gradient colors from geometry attributes for a specific instance.
54
+ // Returns midpoint color between start and end colors for the bond.
52
55
  export function extract_bond_color_for_instance(geometry, instance_idx) {
53
56
  const color_start_attr = geometry.getAttribute(`instanceColorStart`);
54
57
  const color_end_attr = geometry.getAttribute(`instanceColorEnd`);
@@ -70,8 +73,10 @@ export function extract_bond_color_for_instance(geometry, instance_idx) {
70
73
  const [mid_r, mid_g, mid_b] = math.scale(math.add(start_rgb, end_rgb), 0.5);
71
74
  return new Color(mid_r, mid_g, mid_b);
72
75
  }
73
- // Remove custom/non-standard attributes from geometry that cause export issues
74
- // Standard GLTF attributes: position, normal, tangent, texcoord_N, color_N, joints_N, weights_N
76
+ // @internal exported only for tests - not part of the public API.
77
+ // Remove custom/non-standard attributes from geometry that cause export issues.
78
+ // Standard GLTF attributes: position, normal, tangent, texcoord_N, color_N, joints_N,
79
+ // weights_N.
75
80
  export function clean_geometry_for_export(geometry) {
76
81
  const standard_attrs = new Set([
77
82
  `position`,
@@ -98,7 +103,8 @@ export function clean_geometry_for_export(geometry) {
98
103
  geometry.deleteAttribute(attr_name);
99
104
  }
100
105
  }
101
- // Generate MTL (Wavefront Material) content from scene materials
106
+ // @internal exported only for tests - not part of the public API.
107
+ // Generate MTL (Wavefront Material) content from scene materials.
102
108
  export function generate_mtl_content(scene) {
103
109
  const lines = [`# MTL file generated by MatterViz`, ``];
104
110
  const processed_materials = new Set();
@@ -117,9 +123,10 @@ export function generate_mtl_content(scene) {
117
123
  // Get diffuse color (main color)
118
124
  if (has_color_property(mat)) {
119
125
  const color = mat.color;
120
- lines.push(`Kd ${color.r.toFixed(6)} ${color.g.toFixed(6)} ${color.b.toFixed(6)}`);
126
+ const fmt = (val) => val.toFixed(6);
127
+ lines.push(`Kd ${fmt(color.r)} ${fmt(color.g)} ${fmt(color.b)}`);
121
128
  // Ambient is typically a fraction of diffuse
122
- lines.push(`Ka ${(color.r * 0.2).toFixed(6)} ${(color.g * 0.2).toFixed(6)} ${(color.b * 0.2).toFixed(6)}`);
129
+ lines.push(`Ka ${fmt(color.r * 0.2)} ${fmt(color.g * 0.2)} ${fmt(color.b * 0.2)}`);
123
130
  }
124
131
  else {
125
132
  // Default white if no color
@@ -151,7 +158,28 @@ function extract_material_color(mat) {
151
158
  // Note: Threlte's InstancedMesh sets isInstancedMesh=true but type remains "Mesh"
152
159
  // Type guard for InstancedMesh (Three.js uses isInstancedMesh property, not exposed in Object3D type)
153
160
  const is_instanced_mesh = (obj) => obj.isInstancedMesh || obj.type === `InstancedMesh`;
154
- function convert_instanced_meshes_to_regular(scene) {
161
+ // Resolve the export color for one instance of an InstancedMesh. Precedence:
162
+ // gradient bond midpoints (shader bonds), then per-instance colors on meshes
163
+ // flagged userData.per_instance_color (atoms/arrows keep a white base material
164
+ // and store real colors in the instanceColor buffer), then the shared material
165
+ // color (legacy threlte-instanced meshes carry an all-white instanceColor that
166
+ // must NOT win), then instanceColor as a last resort. null = keep default.
167
+ function resolve_instance_material_color(instanced_mesh, instance_idx, bond_colors, stored_color) {
168
+ const bond_color = bond_colors?.get(instance_idx);
169
+ if (bond_color)
170
+ return bond_color;
171
+ const { instanceColor } = instanced_mesh;
172
+ const per_instance = instanceColor
173
+ ? new Color(instanceColor.getX(instance_idx), instanceColor.getY(instance_idx), instanceColor.getZ(instance_idx))
174
+ : null;
175
+ if (instanced_mesh.userData.per_instance_color && per_instance)
176
+ return per_instance;
177
+ if (stored_color)
178
+ return new Color(stored_color.r, stored_color.g, stored_color.b);
179
+ return per_instance;
180
+ }
181
+ // @internal exported only for tests - not part of the public API.
182
+ export function convert_instanced_meshes_to_regular(scene) {
155
183
  // STEP 1: Collect material colors from ORIGINAL scene BEFORE cloning
156
184
  // This is crucial because scene.clone() may not properly preserve Threlte's material colors
157
185
  const material_colors = new Map();
@@ -238,24 +266,10 @@ function convert_instanced_meshes_to_regular(scene) {
238
266
  roughness: 0.5,
239
267
  });
240
268
  new_material.name = `material_${mesh_idx}_${idx}`;
241
- // Apply the correct color
242
- const bond_color = stored_bond_colors?.get(idx);
243
- if (bond_color) {
244
- // Bond with gradient color - use stored midpoint color
245
- new_material.color.copy(bond_color);
246
- }
247
- else if (stored_color) {
248
- // Atom with shared material color
249
- new_material.color.setRGB(stored_color.r, stored_color.g, stored_color.b);
250
- }
251
- else if (instanced_mesh.instanceColor) {
252
- // Fallback: per-instance colors from instanceColor attribute
253
- const color_r = instanced_mesh.instanceColor.getX(idx);
254
- const color_g = instanced_mesh.instanceColor.getY(idx);
255
- const color_b = instanced_mesh.instanceColor.getZ(idx);
256
- new_material.color.setRGB(color_r, color_g, color_b);
257
- }
258
- // If no color found, material stays default white
269
+ // Apply the correct color (null = no color found, material stays default white)
270
+ const resolved_color = resolve_instance_material_color(instanced_mesh, idx, stored_bond_colors, stored_color);
271
+ if (resolved_color)
272
+ new_material.color.copy(resolved_color);
259
273
  const mesh = new Mesh(cloned_geometry, new_material);
260
274
  // Combine base transform with instance transform
261
275
  const combined_matrix = new Matrix4();
@@ -341,6 +355,17 @@ export function create_structure_filename(structure, extension) {
341
355
  const base_name = parts.length > 0 ? parts.join(`-`) : `structure`;
342
356
  return `${base_name}.${extension}`;
343
357
  }
358
+ // First species' element of a site, or `X` when the site has no species
359
+ const site_element = (site) => site.species?.[0]?.element || `X`;
360
+ // Fractional coordinates from abc, falling back to converting xyz; throws when neither
361
+ // is available. idx (when given) is included in the error message.
362
+ function get_frac_coords(site, cart_to_frac, idx) {
363
+ if (Array.isArray(site.abc) && site.abc.length >= 3)
364
+ return site.abc.slice(0, 3);
365
+ if (site.xyz?.length >= 3 && cart_to_frac)
366
+ return cart_to_frac(site.xyz.slice(0, 3));
367
+ throw new Error(`No valid coordinates found for site${idx === undefined ? `` : ` ${idx}`}`);
368
+ }
344
369
  // Generate XYZ content string without saving
345
370
  export function structure_to_xyz_str(structure) {
346
371
  if (!structure?.sites)
@@ -355,30 +380,23 @@ export function structure_to_xyz_str(structure) {
355
380
  const formula = get_electro_neg_formula(structure, true);
356
381
  if (formula && formula !== `Unknown`)
357
382
  comment_parts.push(formula);
383
+ const lattice_matrix = `lattice` in structure && structure.lattice?.matrix?.length === 3
384
+ ? structure.lattice.matrix
385
+ : null;
358
386
  // Include extended XYZ lattice information when available so round-trips preserve lattice
359
- if (`lattice` in structure && structure.lattice?.matrix?.length === 3) {
360
- const lattice_values = structure.lattice.matrix
361
- .flat()
362
- .map((value) => (Number.isFinite(value) ? value : 0).toFixed(8))
387
+ if (lattice_matrix) {
388
+ const lattice_values = lattice_matrix
389
+ .flatMap((row) => row.map((value) => (Number.isFinite(value) ? value : 0).toFixed(8)))
363
390
  .join(` `);
364
391
  comment_parts.push(`Lattice="${lattice_values}"`);
365
392
  }
366
393
  const comment = comment_parts.length > 0 ? comment_parts.join(` `) : `Generated from structure`;
367
394
  lines.push(comment);
368
395
  // Cache converter for fractional→Cartesian (if lattice available)
369
- const frac_to_cart = `lattice` in structure && structure.lattice?.matrix?.length === 3
370
- ? math.create_frac_to_cart(structure.lattice.matrix)
371
- : null;
396
+ const frac_to_cart = lattice_matrix ? math.create_frac_to_cart(lattice_matrix) : null;
372
397
  // Atom lines: element symbol followed by x, y, z coordinates
373
398
  for (const site of structure.sites) {
374
- // Extract element symbol from species
375
- let element_symbol = `X`; // default fallback
376
- if (site.species && Array.isArray(site.species) && site.species.length > 0) {
377
- // species is an array of Species objects with element property
378
- const first_species = site.species[0];
379
- if (first_species && `element` in first_species && first_species.element)
380
- element_symbol = first_species.element;
381
- }
399
+ const element_symbol = site_element(site);
382
400
  // Get coordinates - prefer xyz; fallback to abc (converted to cartesian if lattice available)
383
401
  let coords;
384
402
  if (site.xyz && Array.isArray(site.xyz) && site.xyz.length >= 3) {
@@ -464,11 +482,8 @@ export function structure_to_cif_str(structure) {
464
482
  lines.push(`_cell_angle_gamma ${lattice.gamma.toFixed(6)}`);
465
483
  }
466
484
  // Space group information
467
- if (`symmetry` in structure &&
468
- structure.symmetry &&
469
- typeof structure.symmetry === `object`) {
470
- const symmetry = structure.symmetry;
471
- const { space_group_number, space_group_symbol } = symmetry;
485
+ if (`symmetry` in structure && is_plain_object(structure.symmetry)) {
486
+ const { space_group_number, space_group_symbol } = structure.symmetry;
472
487
  if (typeof space_group_symbol === `string` && space_group_symbol) {
473
488
  // Quote H-M symbols: their spaces (e.g. 'F m -3 m') would break CIF tokenization
474
489
  lines.push(`_space_group_name_H-M_alt '${space_group_symbol}'`);
@@ -498,16 +513,7 @@ export function structure_to_cif_str(structure) {
498
513
  const site = structure.sites[idx];
499
514
  if (!site)
500
515
  continue; // Skip if site is undefined
501
- // Get fractional coordinates
502
- let frac_coords;
503
- if (Array.isArray(site.abc) && site.abc.length >= 3) {
504
- frac_coords = site.abc.slice(0, 3);
505
- }
506
- else if (site.xyz?.length >= 3 && cart_to_frac) {
507
- frac_coords = cart_to_frac(site.xyz);
508
- }
509
- else
510
- throw new Error(`No valid coordinates found for site ${idx}`);
516
+ const frac_coords = get_frac_coords(site, cart_to_frac, idx);
511
517
  const coords_str = frac_coords.map((coord) => coord.toFixed(8)).join(` `);
512
518
  const species_list = site.species?.length ? site.species : [{ element: `X`, occu: 1 }];
513
519
  for (const [spec_idx, species] of species_list.entries()) {
@@ -539,36 +545,28 @@ export function structure_to_poscar_str(structure) {
539
545
  lines.push(`1.0`); // Scale factor (1.0 for direct coordinates)
540
546
  const lattice = structure.lattice;
541
547
  if (lattice.matrix && Array.isArray(lattice.matrix) && lattice.matrix.length >= 3) {
542
- // Convert 3x3 matrix to 3 vectors
543
- const matrix = lattice.matrix;
544
- lines.push(`${matrix[0][0].toFixed(8)} ${matrix[0][1].toFixed(8)} ${matrix[0][2].toFixed(8)}`);
545
- lines.push(`${matrix[1][0].toFixed(8)} ${matrix[1][1].toFixed(8)} ${matrix[1][2].toFixed(8)}`);
546
- lines.push(`${matrix[2][0].toFixed(8)} ${matrix[2][1].toFixed(8)} ${matrix[2][2].toFixed(8)}`);
548
+ // One line per lattice vector, exactly 3 components at 8-decimal fixed precision
549
+ for (const vec of lattice.matrix.slice(0, 3)) {
550
+ lines.push([vec[0], vec[1], vec[2]].map((coord) => coord.toFixed(8)).join(` `));
551
+ }
547
552
  }
548
553
  else {
549
554
  throw new Error(`No valid lattice matrix for POSCAR export`);
550
555
  }
551
- // Count atoms by element
552
- const element_counts = new Map();
553
- const element_symbols = [];
556
+ // Group sites by element in one pass, preserving first-appearance element order
557
+ const sites_by_element = new Map();
554
558
  for (const site of structure.sites) {
555
- let element_symbol = `X`; // default fallback
556
- if (site.species && Array.isArray(site.species) && site.species.length > 0) {
557
- const first_species = site.species[0];
558
- if (first_species && `element` in first_species && first_species.element) {
559
- element_symbol = first_species.element;
560
- }
561
- }
562
- if (!element_counts.has(element_symbol)) {
563
- element_counts.set(element_symbol, 0);
564
- element_symbols.push(element_symbol);
565
- }
566
- element_counts.set(element_symbol, Number(element_counts.get(element_symbol)) + 1);
559
+ const element_symbol = site_element(site);
560
+ const group = sites_by_element.get(element_symbol);
561
+ if (group)
562
+ group.push(site);
563
+ else
564
+ sites_by_element.set(element_symbol, [site]);
567
565
  }
568
566
  // Element symbols line
569
- lines.push(element_symbols.join(` `));
567
+ lines.push([...sites_by_element.keys()].join(` `));
570
568
  // Atom counts line
571
- lines.push(element_symbols.map((el) => element_counts.get(el)).join(` `));
569
+ lines.push([...sites_by_element.values()].map((group) => group.length).join(` `));
572
570
  // Check if any site has selective dynamics
573
571
  const has_selective_dynamics = structure.sites.some((site) => site.properties?.selective_dynamics);
574
572
  if (has_selective_dynamics) {
@@ -579,38 +577,19 @@ export function structure_to_poscar_str(structure) {
579
577
  // Cache inverse transpose for Cartesian→fractional conversion (avoids recomputing per site)
580
578
  const cart_to_frac = lattice.matrix?.length === 3 ? math.create_cart_to_frac(lattice.matrix) : null;
581
579
  // Atom coordinates grouped by element
582
- for (const element_symbol of element_symbols) {
583
- for (const site of structure.sites) {
584
- let site_element = `X`;
585
- if (site.species && Array.isArray(site.species) && site.species.length > 0) {
586
- const first_species = site.species[0];
587
- if (first_species && `element` in first_species && first_species.element) {
588
- site_element = first_species.element;
589
- }
590
- }
591
- if (site_element === element_symbol) {
592
- // Get fractional coordinates
593
- let frac_coords;
594
- if (site.abc && Array.isArray(site.abc) && site.abc.length >= 3) {
595
- frac_coords = site.abc.slice(0, 3);
596
- }
597
- else if (site.xyz?.length >= 3 && cart_to_frac) {
598
- frac_coords = cart_to_frac(site.xyz.slice(0, 3));
599
- }
600
- else {
601
- throw new Error(`No valid coordinates found for site`);
602
- }
603
- let selective_dynamics_str = ``;
604
- if (has_selective_dynamics) {
605
- const sel_dyn = (site.properties?.selective_dynamics ?? [
606
- true,
607
- true,
608
- true,
609
- ]);
610
- selective_dynamics_str = ` ${sel_dyn[0] ? `T` : `F`} ${sel_dyn[1] ? `T` : `F`} ${sel_dyn[2] ? `T` : `F`}`;
611
- }
612
- lines.push(`${frac_coords[0].toFixed(8)} ${frac_coords[1].toFixed(8)} ${frac_coords[2].toFixed(8)}${selective_dynamics_str}`);
580
+ for (const group of sites_by_element.values()) {
581
+ for (const site of group) {
582
+ const frac_coords = get_frac_coords(site, cart_to_frac);
583
+ let selective_dynamics_str = ``;
584
+ if (has_selective_dynamics) {
585
+ const sel_dyn = (site.properties?.selective_dynamics ?? [
586
+ true,
587
+ true,
588
+ true,
589
+ ]);
590
+ selective_dynamics_str = ` ${sel_dyn[0] ? `T` : `F`} ${sel_dyn[1] ? `T` : `F`} ${sel_dyn[2] ? `T` : `F`}`;
613
591
  }
592
+ lines.push(`${frac_coords[0].toFixed(8)} ${frac_coords[1].toFixed(8)} ${frac_coords[2].toFixed(8)}${selective_dynamics_str}`);
614
593
  }
615
594
  }
616
595
  return lines.join(`\n`);
@@ -621,51 +600,22 @@ export function structure_to_json_str(structure) {
621
600
  throw new Error(`No structure to export`);
622
601
  return JSON.stringify(structure, null, 2);
623
602
  }
624
- // Export structure as CIF format
625
- export function export_structure_as_cif(structure) {
626
- try {
627
- const content = structure_to_cif_str(structure);
628
- const filename = create_structure_filename(structure, `cif`);
629
- download(content, filename, `chemical/x-cif`);
630
- }
631
- catch (error) {
632
- console.error(`Failed to export CIF:`, error);
633
- }
634
- }
635
- // Export structure as VASP POSCAR format
636
- export function export_structure_as_poscar(structure) {
637
- try {
638
- const content = structure_to_poscar_str(structure);
639
- const filename = create_structure_filename(structure, `poscar`);
640
- download(content, filename, `text/plain`);
641
- }
642
- catch (error) {
643
- console.error(`Failed to export POSCAR:`, error);
644
- }
645
- }
646
- // Export structure as XYZ format. Format specification:
647
- // - Line 1: Number of atoms
648
- // - Line 2: Comment line (structure ID, formula, etc.)
649
- // - Remaining lines: Element symbol followed by x, y, z coordinates (in Angstrom)
650
- export function export_structure_as_xyz(structure) {
651
- try {
652
- const xyz_content = structure_to_xyz_str(structure);
653
- const filename = create_structure_filename(structure, `xyz`);
654
- download(xyz_content, filename, `text/plain`);
655
- }
656
- catch (error) {
657
- console.error(`Error exporting XYZ:`, error);
658
- }
659
- }
660
- // Export structure in pymatgen JSON format
661
- export function export_structure_as_json(structure) {
603
+ // Text export formats: serializer + file extension + MIME type per format
604
+ export const STRUCT_TEXT_FORMATS = {
605
+ json: { to_str: structure_to_json_str, ext: `json`, mime: `application/json` },
606
+ xyz: { to_str: structure_to_xyz_str, ext: `xyz`, mime: `text/plain` },
607
+ cif: { to_str: structure_to_cif_str, ext: `cif`, mime: `chemical/x-cif` },
608
+ poscar: { to_str: structure_to_poscar_str, ext: `poscar`, mime: `text/plain` },
609
+ };
610
+ // Serialize structure in the given text format and trigger a browser download
611
+ export function export_structure_as(fmt, structure) {
612
+ const { to_str, ext, mime } = STRUCT_TEXT_FORMATS[fmt];
662
613
  try {
663
- const data = structure_to_json_str(structure);
664
- const filename = create_structure_filename(structure, `json`);
665
- download(data, filename, `application/json`);
614
+ const content = to_str(structure);
615
+ download(content, create_structure_filename(structure, ext), mime);
666
616
  }
667
617
  catch (error) {
668
- console.error(`Error exporting JSON:`, error);
618
+ console.error(`Failed to export ${fmt.toUpperCase()}:`, error);
669
619
  }
670
620
  }
671
621
  // Export Three.js scene as GLB (binary GLTF) file
@@ -0,0 +1 @@
1
+ export declare function is_structure_file(filename: string): boolean;
@@ -0,0 +1,22 @@
1
+ import { CONFIG_DIRS_REGEX, STRUCT_KEYWORDS_REGEX, STRUCT_KEYWORDS_STRICT_REGEX, STRUCTURE_EXTENSIONS_REGEX, TRAJ_KEYWORDS_REGEX, VASP_FILES_REGEX, } from '../constants';
2
+ import { strip_compression_extensions } from '../io/decompress';
3
+ // Filename-only detection lives apart from the parsers so lightweight callers
4
+ // (desktop recents, file pickers) do not load YAML, structure math, and element
5
+ // data just to choose an icon.
6
+ export function is_structure_file(filename) {
7
+ const name = strip_compression_extensions(filename);
8
+ if (/\.(?:traj|xtc|h5|hdf5)$/i.test(name) || /xdatcar/i.test(name))
9
+ return false;
10
+ if (STRUCTURE_EXTENSIONS_REGEX.test(name) || VASP_FILES_REGEX.test(name))
11
+ return true;
12
+ if (/\.(?:xyz|extxyz)$/i.test(name))
13
+ return !TRAJ_KEYWORDS_REGEX.test(name);
14
+ if (/\.(?:yaml|yml|xml)$/i.test(name) && STRUCT_KEYWORDS_REGEX.test(name))
15
+ return true;
16
+ if (/\.json$/i.test(name) &&
17
+ STRUCT_KEYWORDS_STRICT_REGEX.test(name) &&
18
+ !TRAJ_KEYWORDS_REGEX.test(name) &&
19
+ !CONFIG_DIRS_REGEX.test(name))
20
+ return true;
21
+ return false;
22
+ }
@@ -0,0 +1,9 @@
1
+ import { type Vec3 } from '../math';
2
+ import { Quaternion } from 'three';
3
+ export declare function quaternion_from_direction(direction: Vec3): Quaternion;
4
+ export declare function rotation_from_direction(direction: Vec3): Vec3;
5
+ export declare function cylinder_between(start: Vec3, end: Vec3): {
6
+ position: Vec3;
7
+ rotation: Vec3;
8
+ length: number;
9
+ };
@@ -0,0 +1,27 @@
1
+ // Three.js orientation helpers shared by 3D components (Arrow, Cylinder, Lattice,
2
+ // SymmetryElements). Kept out of $lib/math, which is pure TS with no three.js dependency.
3
+ import { add, EPS, scale, subtract } from '../math';
4
+ import { Euler, Quaternion, Vector3 } from 'three';
5
+ const UP = new Vector3(0, 1, 0);
6
+ // Quaternion rotating the +Y axis onto `direction` (zero-length → identity). Cylinder and
7
+ // cone geometries run along +Y, so this orients them toward an arbitrary direction.
8
+ export function quaternion_from_direction(direction) {
9
+ const vec = new Vector3(...direction);
10
+ if (vec.lengthSq() < EPS * EPS)
11
+ return new Quaternion(); // ~zero length → no rotation
12
+ return new Quaternion().setFromUnitVectors(UP, vec.normalize());
13
+ }
14
+ // Same orientation as an Euler rotation tuple, for Threlte `rotation` props
15
+ export function rotation_from_direction(direction) {
16
+ const { x, y, z } = new Euler().setFromQuaternion(quaternion_from_direction(direction));
17
+ return [x, y, z];
18
+ }
19
+ // Transform placing a +Y-aligned cylinder so it spans start→end: midpoint position,
20
+ // orientation, and length (coincident points → length 0, identity rotation).
21
+ export function cylinder_between(start, end) {
22
+ const delta = subtract(end, start);
23
+ const position = add(start, scale(delta, 0.5));
24
+ const rotation = rotation_from_direction(delta);
25
+ const length = Math.hypot(...delta);
26
+ return { position, rotation, length };
27
+ }
@@ -2,6 +2,7 @@ import type { CompositionType } from '../composition';
2
2
  import type { ElementSymbol } from '../element';
3
3
  import type { Vec3 } from '../math';
4
4
  import * as math from '../math';
5
+ import type { CameraProjection } from '../settings';
5
6
  import type { ComponentProps } from 'svelte';
6
7
  import type LatticeComponent from './Lattice.svelte';
7
8
  import type { Pbc } from './pbc';
@@ -15,14 +16,30 @@ export { default as CanvasTooltip } from './CanvasTooltip.svelte';
15
16
  export { default as Cylinder } from './Cylinder.svelte';
16
17
  export { default as Lattice } from './Lattice.svelte';
17
18
  export * from './pbc';
19
+ export * from './polyhedra';
20
+ export * from './site';
18
21
  export { default as Structure } from './Structure.svelte';
22
+ export { default as StructureCarousel } from './StructureCarousel.svelte';
23
+ export type StructureCarouselItem = {
24
+ id: string;
25
+ label: string;
26
+ subtitle?: string;
27
+ structure: AnyStructure;
28
+ };
19
29
  export { default as StructureControls } from './StructureControls.svelte';
20
30
  export { default as StructureExportPane } from './StructureExportPane.svelte';
21
31
  export { default as StructureInfoPane } from './StructureInfoPane.svelte';
22
32
  export { default as StructureScene } from './StructureScene.svelte';
33
+ export { default as StructureViewport } from './StructureViewport.svelte';
23
34
  export * from './supercell';
24
35
  export type MeasureMode = `distance` | `angle` | `edit-bonds` | `edit-atoms`;
25
36
  export type BondEditMode = `add` | `delete`;
37
+ export type StructureView = {
38
+ label?: string;
39
+ projection?: CameraProjection;
40
+ direction?: Vec3;
41
+ };
42
+ export declare const DEFAULT_STRUCTURE_VIEWS: StructureView[];
26
43
  export type Species = {
27
44
  element: ElementSymbol;
28
45
  occu: number;
@@ -75,7 +92,7 @@ export type BondPair = {
75
92
  };
76
93
  export type { PerceivedBond, PerceptionOptions } from './bond-order-perception';
77
94
  export { compose_perceived_bonds, perceive_bond_orders, } from './bond-order-perception';
78
- export declare function get_element_counts(structure: AnyStructure): Partial<Record<"S" | "K" | "B" | "H" | "He" | "Li" | "Be" | "C" | "N" | "O" | "F" | "Ne" | "Na" | "Mg" | "Al" | "Si" | "P" | "Cl" | "Ar" | "Ca" | "Sc" | "Ti" | "V" | "Cr" | "Mn" | "Fe" | "Co" | "Ni" | "Cu" | "Zn" | "Ga" | "Ge" | "As" | "Se" | "Br" | "Kr" | "Rb" | "Sr" | "Y" | "Zr" | "Nb" | "Mo" | "Tc" | "Ru" | "Rh" | "Pd" | "Ag" | "Cd" | "In" | "Sn" | "Sb" | "Te" | "I" | "Xe" | "Cs" | "Ba" | "La" | "Ce" | "Pr" | "Nd" | "Pm" | "Sm" | "Eu" | "Gd" | "Tb" | "Dy" | "Ho" | "Er" | "Tm" | "Yb" | "Lu" | "Hf" | "Ta" | "W" | "Re" | "Os" | "Ir" | "Pt" | "Au" | "Hg" | "Tl" | "Pb" | "Bi" | "Po" | "At" | "Rn" | "Fr" | "Ra" | "Ac" | "Th" | "Pa" | "U" | "Np" | "Pu" | "Am" | "Cm" | "Bk" | "Cf" | "Es" | "Fm" | "Md" | "No" | "Lr" | "Rf" | "Db" | "Sg" | "Bh" | "Hs" | "Mt" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og", number>>;
95
+ export declare function get_element_counts(structure: AnyStructure): Partial<Record<"Ac" | "Ag" | "Al" | "Am" | "Ar" | "As" | "At" | "Au" | "B" | "Ba" | "Be" | "Bh" | "Bi" | "Bk" | "Br" | "C" | "Ca" | "Cd" | "Ce" | "Cf" | "Cl" | "Cm" | "Co" | "Cr" | "Cs" | "Cu" | "Db" | "Dy" | "Er" | "Es" | "Eu" | "F" | "Fe" | "Fm" | "Fr" | "Ga" | "Gd" | "Ge" | "H" | "He" | "Hf" | "Hg" | "Ho" | "Hs" | "I" | "In" | "Ir" | "K" | "Kr" | "La" | "Li" | "Lr" | "Lu" | "Md" | "Mg" | "Mn" | "Mo" | "Mt" | "N" | "Na" | "Nb" | "Nd" | "Ne" | "Ni" | "No" | "Np" | "O" | "Os" | "P" | "Pa" | "Pb" | "Pd" | "Pm" | "Po" | "Pr" | "Pt" | "Pu" | "Ra" | "Rb" | "Re" | "Rf" | "Rh" | "Rn" | "Ru" | "S" | "Sb" | "Sc" | "Se" | "Sg" | "Si" | "Sm" | "Sn" | "Sr" | "Ta" | "Tb" | "Tc" | "Te" | "Th" | "Ti" | "Tl" | "Tm" | "U" | "V" | "W" | "Xe" | "Y" | "Yb" | "Zn" | "Zr" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og", number>>;
79
96
  export declare function format_chemical_formula(structure: AnyStructure, sort_fn: (symbols: ElementSymbol[]) => ElementSymbol[]): string;
80
97
  export declare function format_formula_by_electronegativity(structure: AnyStructure): string;
81
98
  export declare const atomic_radii: CompositionType;
@@ -10,12 +10,23 @@ export { default as CanvasTooltip } from './CanvasTooltip.svelte';
10
10
  export { default as Cylinder } from './Cylinder.svelte';
11
11
  export { default as Lattice } from './Lattice.svelte';
12
12
  export * from './pbc';
13
+ export * from './polyhedra';
14
+ export * from './site';
13
15
  export { default as Structure } from './Structure.svelte';
16
+ export { default as StructureCarousel } from './StructureCarousel.svelte';
14
17
  export { default as StructureControls } from './StructureControls.svelte';
15
18
  export { default as StructureExportPane } from './StructureExportPane.svelte';
16
19
  export { default as StructureInfoPane } from './StructureInfoPane.svelte';
17
20
  export { default as StructureScene } from './StructureScene.svelte';
21
+ export { default as StructureViewport } from './StructureViewport.svelte';
18
22
  export * from './supercell';
23
+ // Ovito-like default 2x2 view set: one perspective + three orthographic axis views.
24
+ export const DEFAULT_STRUCTURE_VIEWS = [
25
+ { label: `Perspective`, projection: `perspective`, direction: [1, 0.3, 0.8] },
26
+ { label: `Front`, projection: `orthographic`, direction: [0, 0, 1] },
27
+ { label: `Top`, projection: `orthographic`, direction: [0, 1, 0] },
28
+ { label: `Right`, projection: `orthographic`, direction: [1, 0, 0] },
29
+ ];
19
30
  export const LATTICE_PARAM_KEYS = [`a`, `b`, `c`, `alpha`, `beta`, `gamma`];
20
31
  export { compose_perceived_bonds, perceive_bond_orders, } from './bond-order-perception';
21
32
  export function get_element_counts(structure) {
@@ -41,11 +52,13 @@ export function format_chemical_formula(structure, sort_fn) {
41
52
  }
42
53
  return formula.join(` `);
43
54
  }
55
+ // Electronegativity by element symbol (0 when missing), for O(1) sort comparisons
56
+ const electronegativity_by_symbol = new Map(element_data.map((el) => [el.symbol, el.electronegativity ?? 0]));
44
57
  export function format_formula_by_electronegativity(structure) {
45
58
  // concatenate elements in a structure followed by their amount sorted by electronegativity
46
59
  return format_chemical_formula(structure, (symbols) => symbols.sort((el1, el2) => {
47
- const elec_neg1 = element_data.find((el) => el.symbol === el1)?.electronegativity ?? 0;
48
- const elec_neg2 = element_data.find((el) => el.symbol === el2)?.electronegativity ?? 0;
60
+ const elec_neg1 = electronegativity_by_symbol.get(el1) ?? 0;
61
+ const elec_neg2 = electronegativity_by_symbol.get(el2) ?? 0;
49
62
  // Sort by electronegativity (ascending), then alphabetically for ties
50
63
  if (elec_neg1 !== elec_neg2)
51
64
  return elec_neg1 - elec_neg2;
@@ -3,5 +3,5 @@ import type { Pbc } from './pbc';
3
3
  export type AngleMode = `degrees` | `radians`;
4
4
  export declare const MAX_SELECTED_SITES = 8;
5
5
  export declare function displacement_pbc(from: Vec3, to: Vec3, lattice_matrix: Matrix3x3 | null | undefined, converters?: LatticeConverters, pbc?: Pbc): Vec3;
6
- export declare function distance_pbc(a: Vec3, b: Vec3, lattice_matrix: Matrix3x3, converters?: LatticeConverters, pbc?: Pbc): number;
6
+ export { pbc_dist as distance_pbc } from '../math';
7
7
  export declare function angle_between_vectors(v1: Vec3, v2: Vec3, mode?: AngleMode): number;
@@ -1,5 +1,5 @@
1
1
  // functions for measuring distances and angles between structure sites
2
- import { min_image_displacement, subtract } from '../math';
2
+ import { dot, min_image_displacement, subtract, to_degrees } from '../math';
3
3
  export const MAX_SELECTED_SITES = 8;
4
4
  // Calculate minimum image displacement between two points under PBC
5
5
  // If lattice_matrix is null/undefined, returns Euclidean displacement.
@@ -9,22 +9,16 @@ export function displacement_pbc(from, to, lattice_matrix, converters, pbc) {
9
9
  return subtract(to, from);
10
10
  return min_image_displacement(from, to, lattice_matrix, converters, pbc);
11
11
  }
12
- export function distance_pbc(a, b, lattice_matrix, converters, pbc) {
13
- const [dx, dy, dz] = displacement_pbc(a, b, lattice_matrix, converters, pbc);
14
- return Math.hypot(dx, dy, dz);
15
- }
12
+ // Minimum-image distance between two Cartesian points
13
+ export { pbc_dist as distance_pbc } from '../math';
16
14
  export function angle_between_vectors(v1, v2, mode = `degrees`) {
17
15
  const n1 = Math.hypot(v1[0], v1[1], v1[2]);
18
16
  const n2 = Math.hypot(v2[0], v2[1], v2[2]);
19
17
  if (n1 === 0 || n2 === 0)
20
18
  return 0;
21
- // Dot product of vectors
22
- const dot = v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
23
- // Normalize dot product to get cosine
24
- const cos_angle = dot / (n1 * n2);
25
- // Clamp to [-1, 1] to avoid numerical errors with acos
19
+ // Normalize dot product to get cosine, clamped to [-1, 1] to avoid acos NaN
20
+ const cos_angle = dot(v1, v2) / (n1 * n2);
26
21
  const clamped = Math.max(-1, Math.min(1, cos_angle));
27
- // Compute angle using arccos
28
22
  const ang = Math.acos(clamped);
29
- return mode === `degrees` ? (ang * 180) / Math.PI : ang;
23
+ return mode === `degrees` ? to_degrees(ang) : ang;
30
24
  }
@@ -2,6 +2,7 @@ import type { OptimadeStructure } from '../api/optimade';
2
2
  import * as math from '../math';
3
3
  import type { AnyStructure, Crystal, Site, StructureProperties } from './';
4
4
  import type { Pbc } from './pbc';
5
+ export { is_structure_file } from './format-detect';
5
6
  export interface ParsedStructure {
6
7
  sites: Site[];
7
8
  properties?: StructureProperties;
@@ -54,13 +55,14 @@ export declare function parse_xyz(content: string): ParsedStructure | null;
54
55
  export declare function parse_cif(content: string, wrap_fractional_coords?: boolean, strict?: boolean): ParsedStructure | null;
55
56
  export type CellType = `primitive_cell` | `unit_cell` | `supercell` | `phonon_primitive_cell` | `phonon_supercell` | `auto`;
56
57
  export declare function parse_phonopy_yaml(content: string, cell_type?: CellType): ParsedStructure | null;
58
+ export declare function is_parsed_structure(obj: unknown): obj is ParsedStructure;
59
+ export declare function ensure_lattice_params(structure: ParsedStructure): ParsedStructure;
57
60
  export declare function normalize_fractional_coords(structure: ParsedStructure): ParsedStructure;
58
- export declare function parse_structure_file(content: string, filename?: string): ParsedStructure | null;
59
- export declare function parse_any_structure(content: string, filename: string): AnyStructure | null;
61
+ export declare function parse_structure_file(content: string, filename?: string): ParsedStructure;
62
+ export declare function parse_any_structure(content: string, filename: string): AnyStructure;
60
63
  export declare function parse_optimade_json(content: string): ParsedStructure | null;
61
64
  export declare function parse_optimade_from_raw(raw: unknown): ParsedStructure | null;
62
65
  export declare function is_optimade_json(content: string): boolean;
63
66
  export declare const is_optimade_raw: (raw: unknown) => boolean;
64
67
  export declare function optimade_to_crystal(optimade_structure: OptimadeStructure): Crystal | null;
65
- export declare function is_structure_file(filename: string): boolean;
66
68
  export declare const detect_structure_type: (filename: string, content: string) => `crystal` | `molecule` | `unknown`;