matterviz 0.4.1 → 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 (395) 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 +75 -85
  7. package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
  8. package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
  9. package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
  10. package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
  11. package/dist/brillouin/BrillouinZoneScene.svelte +26 -39
  12. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
  13. package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
  14. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +62 -74
  15. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
  16. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +511 -547
  17. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
  18. package/dist/chempot-diagram/async-compute.svelte.js +1 -1
  19. package/dist/chempot-diagram/controls-state.svelte.js +1 -1
  20. package/dist/colors/index.d.ts +0 -4
  21. package/dist/colors/index.js +19 -20
  22. package/dist/composition/BarChart.svelte +37 -31
  23. package/dist/composition/BubbleChart.svelte +17 -17
  24. package/dist/composition/Composition.svelte +7 -11
  25. package/dist/composition/Formula.svelte +18 -25
  26. package/dist/composition/FormulaFilter.svelte +92 -95
  27. package/dist/composition/PieChart.svelte +55 -41
  28. package/dist/composition/format.js +1 -1
  29. package/dist/composition/index.d.ts +2 -0
  30. package/dist/composition/index.js +14 -0
  31. package/dist/composition/parse.d.ts +2 -2
  32. package/dist/composition/parse.js +11 -10
  33. package/dist/constants.js +11 -9
  34. package/dist/convex-hull/ConvexHull.svelte +12 -15
  35. package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
  36. package/dist/convex-hull/ConvexHull2D.svelte +93 -92
  37. package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
  38. package/dist/convex-hull/ConvexHull3D.svelte +109 -140
  39. package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
  40. package/dist/convex-hull/ConvexHull4D.svelte +75 -94
  41. package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
  42. package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
  43. package/dist/convex-hull/ConvexHullControls.svelte +46 -48
  44. package/dist/convex-hull/ConvexHullStats.svelte +193 -195
  45. package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
  46. package/dist/convex-hull/GasPressureControls.svelte +5 -12
  47. package/dist/convex-hull/StructurePopup.svelte +17 -21
  48. package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
  49. package/dist/convex-hull/TemperatureSlider.svelte +4 -10
  50. package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
  51. package/dist/convex-hull/helpers.d.ts +8 -10
  52. package/dist/convex-hull/helpers.js +36 -36
  53. package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
  54. package/dist/convex-hull/thermodynamics.js +18 -17
  55. package/dist/coordination/CoordinationBarPlot.svelte +38 -33
  56. package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
  57. package/dist/coordination/calc-coordination.d.ts +1 -1
  58. package/dist/coordination/calc-coordination.js +28 -25
  59. package/dist/element/BohrAtom.svelte +5 -8
  60. package/dist/element/ElementHeading.svelte +4 -1
  61. package/dist/element/ElementPhoto.svelte +11 -9
  62. package/dist/element/ElementStats.svelte +12 -10
  63. package/dist/element/ElementTile.svelte +24 -29
  64. package/dist/element/Nucleus.svelte +4 -2
  65. package/dist/element/data.d.ts +1 -2
  66. package/dist/element/helpers.d.ts +4 -0
  67. package/dist/element/helpers.js +18 -0
  68. package/dist/element/index.d.ts +1 -4
  69. package/dist/element/index.js +3 -18
  70. package/dist/feedback/DragOverlay.svelte +5 -5
  71. package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
  72. package/dist/feedback/StatusMessage.svelte +7 -4
  73. package/dist/fermi-surface/FermiSlice.svelte +21 -18
  74. package/dist/fermi-surface/FermiSurface.svelte +14 -22
  75. package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -7
  76. package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
  77. package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
  78. package/dist/fermi-surface/FermiSurfaceScene.svelte +37 -64
  79. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
  80. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
  81. package/dist/fermi-surface/compute.js +3 -3
  82. package/dist/fermi-surface/parse.js +22 -24
  83. package/dist/heatmap-matrix/HeatmapMatrix.svelte +109 -148
  84. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
  85. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
  86. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
  87. package/dist/heatmap-matrix/index.d.ts +5 -0
  88. package/dist/icons.d.ts +4 -0
  89. package/dist/icons.js +4 -0
  90. package/dist/io/ExportPane.svelte +10 -6
  91. package/dist/io/decompress.d.ts +2 -1
  92. package/dist/io/decompress.js +22 -35
  93. package/dist/io/export.d.ts +4 -0
  94. package/dist/io/export.js +5 -1
  95. package/dist/io/fetch.d.ts +0 -3
  96. package/dist/io/fetch.js +0 -11
  97. package/dist/io/index.d.ts +0 -1
  98. package/dist/io/index.js +2 -9
  99. package/dist/io/is-binary.d.ts +9 -0
  100. package/dist/io/is-binary.js +45 -1
  101. package/dist/io/url-drop.js +13 -25
  102. package/dist/isosurface/Isosurface.svelte +17 -23
  103. package/dist/isosurface/IsosurfaceControls.svelte +37 -42
  104. package/dist/isosurface/parse-vaspwave.d.ts +3 -0
  105. package/dist/isosurface/parse-vaspwave.js +138 -0
  106. package/dist/isosurface/parse.js +6 -6
  107. package/dist/labels.d.ts +6 -2
  108. package/dist/labels.js +43 -13
  109. package/dist/layout/FullscreenButton.svelte +2 -1
  110. package/dist/layout/FullscreenToggle.svelte +10 -4
  111. package/dist/layout/InfoCard.svelte +7 -18
  112. package/dist/layout/InfoTag.svelte +1 -3
  113. package/dist/layout/NumberRangeInput.svelte +46 -0
  114. package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
  115. package/dist/layout/PropertyFilter.svelte +2 -6
  116. package/dist/layout/SettingsSection.svelte +21 -17
  117. package/dist/layout/SubpageGrid.svelte +3 -1
  118. package/dist/layout/ViewerChrome.svelte +9 -10
  119. package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
  120. package/dist/layout/fullscreen.js +3 -5
  121. package/dist/layout/fullscreen.svelte.js +1 -2
  122. package/dist/layout/index.d.ts +1 -0
  123. package/dist/layout/index.js +1 -0
  124. package/dist/layout/json-tree/JsonNode.svelte +8 -11
  125. package/dist/layout/json-tree/JsonTree.svelte +53 -77
  126. package/dist/layout/json-tree/JsonValue.svelte +7 -15
  127. package/dist/layout/json-tree/utils.js +14 -23
  128. package/dist/math.d.ts +2 -0
  129. package/dist/math.js +19 -0
  130. package/dist/overlays/ContextMenu.svelte +4 -2
  131. package/dist/overlays/CopyButton.svelte +11 -5
  132. package/dist/overlays/DragControlTab.svelte +6 -1
  133. package/dist/overlays/DraggablePane.svelte +81 -26
  134. package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
  135. package/dist/overlays/GlassChip.svelte +30 -0
  136. package/dist/overlays/GlassChip.svelte.d.ts +8 -0
  137. package/dist/overlays/InfoPaneCards.svelte +11 -23
  138. package/dist/overlays/index.d.ts +7 -0
  139. package/dist/overlays/index.js +26 -0
  140. package/dist/overlays/portal.d.ts +2 -0
  141. package/dist/overlays/portal.js +14 -0
  142. package/dist/periodic-table/PeriodicTable.svelte +113 -145
  143. package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
  144. package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
  145. package/dist/periodic-table/TableInset.svelte +9 -4
  146. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
  147. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
  148. package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
  149. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
  150. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
  151. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
  152. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
  153. package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
  154. package/dist/phase-diagram/build-diagram.js +3 -3
  155. package/dist/phase-diagram/diagram-input.d.ts +1 -2
  156. package/dist/phase-diagram/parse.js +15 -15
  157. package/dist/phase-diagram/svg-to-diagram.js +21 -15
  158. package/dist/phase-diagram/utils.js +2 -3
  159. package/dist/plot/bar/BarPlot.svelte +430 -391
  160. package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
  161. package/dist/plot/bar/BarPlotControls.svelte +1 -3
  162. package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
  163. package/dist/plot/bar/SpacegroupBarPlot.svelte +29 -36
  164. package/dist/plot/bar/data.d.ts +5 -4
  165. package/dist/plot/bar/data.js +2 -1
  166. package/dist/plot/box/BoxPlot.svelte +301 -209
  167. package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
  168. package/dist/plot/box/Violin.svelte.d.ts +1 -0
  169. package/dist/plot/box/box-plot.js +1 -1
  170. package/dist/plot/core/auto-place.js +1 -1
  171. package/dist/plot/core/axis-utils.d.ts +12 -7
  172. package/dist/plot/core/axis-utils.js +48 -48
  173. package/dist/plot/core/components/AxisLabel.svelte +82 -20
  174. package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
  175. package/dist/plot/core/components/ColorBar.svelte +101 -106
  176. package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
  177. package/dist/plot/core/components/FillArea.svelte +10 -17
  178. package/dist/plot/core/components/HierarchyControls.svelte +249 -0
  179. package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
  180. package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
  181. package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
  182. package/dist/plot/core/components/Line.svelte +18 -9
  183. package/dist/plot/core/components/Line.svelte.d.ts +2 -0
  184. package/dist/plot/core/components/PlotAxis.svelte +40 -17
  185. package/dist/plot/core/components/PlotControls.svelte +65 -41
  186. package/dist/plot/core/components/PlotLegend.svelte +31 -35
  187. package/dist/plot/core/components/PlotMarginals.svelte +616 -0
  188. package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
  189. package/dist/plot/core/components/PlotTooltip.svelte +1 -1
  190. package/dist/plot/core/components/PortalSelect.svelte +4 -8
  191. package/dist/plot/core/components/ReferenceLine.svelte +27 -24
  192. package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
  193. package/dist/plot/core/components/ReferencePlane.svelte +7 -8
  194. package/dist/plot/core/components/ZeroLines.svelte +4 -8
  195. package/dist/plot/core/components/ZoomRect.svelte +1 -2
  196. package/dist/plot/core/components/index.d.ts +1 -0
  197. package/dist/plot/core/components/index.js +1 -0
  198. package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
  199. package/dist/plot/core/data-cleaning-signal.js +467 -0
  200. package/dist/plot/core/data-cleaning.d.ts +2 -42
  201. package/dist/plot/core/data-cleaning.js +27 -474
  202. package/dist/plot/core/data-transform.js +9 -5
  203. package/dist/plot/core/fill-utils.d.ts +3 -1
  204. package/dist/plot/core/fill-utils.js +28 -6
  205. package/dist/plot/core/index.d.ts +1 -0
  206. package/dist/plot/core/index.js +1 -0
  207. package/dist/plot/core/interactions.js +0 -2
  208. package/dist/plot/core/layout.d.ts +3 -1
  209. package/dist/plot/core/layout.js +22 -13
  210. package/dist/plot/core/marginals.d.ts +170 -0
  211. package/dist/plot/core/marginals.js +436 -0
  212. package/dist/plot/core/reference-line.js +1 -1
  213. package/dist/plot/core/scales.d.ts +23 -0
  214. package/dist/plot/core/scales.js +39 -13
  215. package/dist/plot/core/types/fills.d.ts +101 -0
  216. package/dist/plot/core/types/fills.js +15 -0
  217. package/dist/plot/core/types/plot-3d.d.ts +87 -0
  218. package/dist/plot/core/types/plot-3d.js +4 -0
  219. package/dist/plot/core/types/reference-lines.d.ts +140 -0
  220. package/dist/plot/core/types/reference-lines.js +9 -0
  221. package/dist/plot/core/types.d.ts +29 -324
  222. package/dist/plot/core/types.js +23 -20
  223. package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
  224. package/dist/plot/core/utils/hierarchy-chart.js +179 -0
  225. package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
  226. package/dist/plot/core/utils/hierarchy-labels.js +99 -0
  227. package/dist/plot/core/utils/label-placement.js +2 -2
  228. package/dist/plot/histogram/Histogram.svelte +304 -325
  229. package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
  230. package/dist/plot/histogram/HistogramControls.svelte +30 -28
  231. package/dist/plot/histogram/histogram.d.ts +31 -0
  232. package/dist/plot/histogram/histogram.js +70 -0
  233. package/dist/plot/histogram/index.d.ts +1 -0
  234. package/dist/plot/histogram/index.js +1 -0
  235. package/dist/plot/index.d.ts +1 -0
  236. package/dist/plot/index.js +1 -0
  237. package/dist/plot/sankey/Sankey.svelte +78 -69
  238. package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
  239. package/dist/plot/sankey/SankeyControls.svelte +22 -16
  240. package/dist/plot/scatter/BinnedScatterPlot.svelte +263 -109
  241. package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
  242. package/dist/plot/scatter/ElementScatter.svelte +4 -1
  243. package/dist/plot/scatter/ScatterPlot.svelte +477 -385
  244. package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
  245. package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
  246. package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
  247. package/dist/plot/scatter/ScatterPoint.svelte +16 -9
  248. package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
  249. package/dist/plot/scatter/binned-scatter-types.js +6 -1
  250. package/dist/plot/scatter/scatter-data.d.ts +1 -1
  251. package/dist/plot/scatter/scatter-data.js +8 -7
  252. package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
  253. package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
  254. package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
  255. package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
  256. package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
  257. package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
  258. package/dist/plot/sunburst/Sunburst.svelte +251 -329
  259. package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
  260. package/dist/plot/sunburst/index.d.ts +1 -1
  261. package/dist/plot/sunburst/index.js +2 -1
  262. package/dist/plot/sunburst/render.d.ts +2 -2
  263. package/dist/plot/sunburst/render.js +47 -22
  264. package/dist/plot/sunburst/sunburst.d.ts +5 -1
  265. package/dist/plot/sunburst/sunburst.js +10 -3
  266. package/dist/plot/treemap/Treemap.svelte +907 -0
  267. package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
  268. package/dist/plot/treemap/index.d.ts +3 -0
  269. package/dist/plot/treemap/index.js +4 -0
  270. package/dist/plot/treemap/treemap.d.ts +26 -0
  271. package/dist/plot/treemap/treemap.js +99 -0
  272. package/dist/rdf/RdfPlot.svelte +22 -26
  273. package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
  274. package/dist/rdf/calc-rdf.js +4 -8
  275. package/dist/sanitize.js +1 -1
  276. package/dist/scene/bind-renderer.svelte.js +14 -6
  277. package/dist/settings.d.ts +19 -9
  278. package/dist/settings.js +77 -50
  279. package/dist/spectral/Bands.svelte +223 -230
  280. package/dist/spectral/BandsAndDos.svelte +11 -9
  281. package/dist/spectral/BrillouinBandsDos.svelte +19 -27
  282. package/dist/spectral/Dos.svelte +70 -73
  283. package/dist/spectral/helpers.d.ts +3 -3
  284. package/dist/spectral/helpers.js +25 -35
  285. package/dist/state.svelte.js +5 -18
  286. package/dist/structure/Arrow.svelte +5 -18
  287. package/dist/structure/ArrowInstances.svelte +160 -0
  288. package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
  289. package/dist/structure/AtomLegend.svelte +115 -75
  290. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  291. package/dist/structure/Bond.svelte +31 -23
  292. package/dist/structure/CanvasTooltip.svelte +15 -3
  293. package/dist/structure/CellSelect.svelte +11 -26
  294. package/dist/structure/Cylinder.svelte +24 -40
  295. package/dist/structure/InstancedAtoms.svelte +114 -0
  296. package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
  297. package/dist/structure/Lattice.svelte +85 -149
  298. package/dist/structure/SiteLabels.svelte +122 -0
  299. package/dist/structure/SiteLabels.svelte.d.ts +18 -0
  300. package/dist/structure/Structure.svelte +473 -419
  301. package/dist/structure/Structure.svelte.d.ts +4 -2
  302. package/dist/structure/StructureCarousel.svelte +630 -0
  303. package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
  304. package/dist/structure/StructureControls.svelte +157 -399
  305. package/dist/structure/StructureControls.svelte.d.ts +1 -1
  306. package/dist/structure/StructureExportPane.svelte +17 -21
  307. package/dist/structure/StructureInfoPane.svelte +72 -66
  308. package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
  309. package/dist/structure/StructureScene.svelte +467 -476
  310. package/dist/structure/StructureScene.svelte.d.ts +3 -1
  311. package/dist/structure/StructureViewport.svelte +386 -0
  312. package/dist/structure/StructureViewport.svelte.d.ts +63 -0
  313. package/dist/structure/atom-label-placement.d.ts +16 -12
  314. package/dist/structure/atom-label-placement.js +70 -37
  315. package/dist/structure/atom-properties.d.ts +2 -0
  316. package/dist/structure/atom-properties.js +104 -38
  317. package/dist/structure/bonding.d.ts +10 -3
  318. package/dist/structure/bonding.js +84 -28
  319. package/dist/structure/edit-history.d.ts +6 -0
  320. package/dist/structure/edit-history.js +27 -0
  321. package/dist/structure/export.d.ts +1 -0
  322. package/dist/structure/export.js +39 -31
  323. package/dist/structure/format-detect.d.ts +1 -0
  324. package/dist/structure/format-detect.js +22 -0
  325. package/dist/structure/geometry.d.ts +9 -0
  326. package/dist/structure/geometry.js +27 -0
  327. package/dist/structure/index.d.ts +16 -1
  328. package/dist/structure/index.js +13 -2
  329. package/dist/structure/measure.d.ts +1 -1
  330. package/dist/structure/measure.js +6 -12
  331. package/dist/structure/parse.d.ts +2 -1
  332. package/dist/structure/parse.js +243 -222
  333. package/dist/structure/partial-occupancy.js +4 -2
  334. package/dist/structure/pbc.js +78 -98
  335. package/dist/structure/polyhedra.d.ts +0 -1
  336. package/dist/structure/polyhedra.js +3 -18
  337. package/dist/structure/supercell.d.ts +1 -2
  338. package/dist/structure/supercell.js +7 -13
  339. package/dist/symmetry/SymmetryElements.svelte +11 -15
  340. package/dist/symmetry/SymmetryStats.svelte +56 -68
  341. package/dist/symmetry/WyckoffTable.svelte +5 -24
  342. package/dist/symmetry/cell-transform.js +1 -0
  343. package/dist/symmetry/index.d.ts +1 -0
  344. package/dist/symmetry/index.js +8 -2
  345. package/dist/symmetry/spacegroups.js +3 -2
  346. package/dist/table/HeatmapTable.svelte +1102 -365
  347. package/dist/table/HeatmapTable.svelte.d.ts +12 -2
  348. package/dist/table/ToggleMenu.svelte +5 -12
  349. package/dist/table/index.d.ts +21 -6
  350. package/dist/table/index.js +34 -21
  351. package/dist/theme/ThemeControl.svelte +16 -8
  352. package/dist/theme/index.d.ts +1 -5
  353. package/dist/theme/index.js +4 -10
  354. package/dist/theme/themes.mjs +14 -7
  355. package/dist/tooltip/KCoords.svelte +4 -1
  356. package/dist/tooltip/TooltipContent.svelte +2 -5
  357. package/dist/trajectory/Trajectory.svelte +515 -308
  358. package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
  359. package/dist/trajectory/TrajectoryError.svelte +11 -8
  360. package/dist/trajectory/TrajectoryExportPane.svelte +14 -31
  361. package/dist/trajectory/TrajectoryInfoPane.svelte +85 -97
  362. package/dist/trajectory/extract.js +56 -34
  363. package/dist/trajectory/format-detect.js +11 -9
  364. package/dist/trajectory/frame-reader.d.ts +2 -0
  365. package/dist/trajectory/frame-reader.js +33 -29
  366. package/dist/trajectory/helpers.d.ts +2 -0
  367. package/dist/trajectory/helpers.js +18 -7
  368. package/dist/trajectory/index.d.ts +1 -0
  369. package/dist/trajectory/index.js +3 -0
  370. package/dist/trajectory/parse/h5-utils.d.ts +13 -0
  371. package/dist/trajectory/parse/h5-utils.js +109 -0
  372. package/dist/trajectory/parse/hdf5.d.ts +1 -1
  373. package/dist/trajectory/parse/hdf5.js +116 -106
  374. package/dist/trajectory/parse/index.d.ts +2 -3
  375. package/dist/trajectory/parse/index.js +17 -20
  376. package/dist/trajectory/parse/lammps.js +8 -12
  377. package/dist/trajectory/parse/vasp.js +10 -7
  378. package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
  379. package/dist/trajectory/parse/vaspout-electronic.js +207 -0
  380. package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
  381. package/dist/trajectory/parse/vaspout-h5.js +284 -0
  382. package/dist/trajectory/parse/xyz.js +11 -7
  383. package/dist/trajectory/plotting.d.ts +8 -9
  384. package/dist/trajectory/plotting.js +99 -27
  385. package/dist/utils.d.ts +3 -0
  386. package/dist/utils.js +7 -0
  387. package/dist/xrd/XrdPlot.svelte +47 -61
  388. package/dist/xrd/broadening.js +2 -1
  389. package/dist/xrd/calc-xrd.js +2 -4
  390. package/dist/xrd/parse.d.ts +0 -1
  391. package/dist/xrd/parse.js +56 -73
  392. package/package.json +61 -33
  393. package/dist/api/mp.d.ts +0 -6
  394. package/dist/api/mp.js +0 -22
  395. package/dist/plot/sunburst/SunburstControls.svelte +0 -200
@@ -6,6 +6,7 @@
6
6
  import type { AxisConfig } from '../plot'
7
7
  import ColorBar from '../plot/core/components/ColorBar.svelte'
8
8
  import { quickselect } from '../plot/box/quantile'
9
+ import { clamp01 } from '../utils'
9
10
  import { type ComponentProps, onDestroy, onMount, type Snippet } from 'svelte'
10
11
  import type { HTMLAttributes } from 'svelte/elements'
11
12
  import { SvelteMap, SvelteSet } from 'svelte/reactivity'
@@ -17,6 +18,7 @@
17
18
  HeatmapExportFormat,
18
19
  HeatmapTooltipProp,
19
20
  LegendPosition,
21
+ MissingCellStyle,
20
22
  NormalizeMode,
21
23
  SymmetricMode,
22
24
  } from './index'
@@ -38,7 +40,7 @@
38
40
  color_scale = $bindable(`interpolateViridis`),
39
41
  color_scale_range = [null, null],
40
42
  color_overrides = {},
41
- missing_color = `transparent`,
43
+ missing = {},
42
44
  log = false,
43
45
  value_transform,
44
46
  normalize = `linear`,
@@ -113,13 +115,11 @@
113
115
  }: Omit<HTMLAttributes<HTMLDivElement>, `onclick` | `ondblclick`> & {
114
116
  x_items: AxisItem[]
115
117
  y_items: AxisItem[]
116
- values?:
117
- | CellValue[][]
118
- | Record<string, Record<string, CellValue>>
118
+ values?: CellValue[][] | Record<string, Record<string, CellValue>>
119
119
  color_scale?: D3InterpolateName | ((val: number) => string)
120
120
  color_scale_range?: [number | null, number | null]
121
121
  color_overrides?: Record<string, string>
122
- missing_color?: string
122
+ missing?: MissingCellStyle
123
123
  log?: boolean
124
124
  value_transform?: (
125
125
  value: number,
@@ -145,11 +145,7 @@
145
145
  onpin?: (cell: CellPos | null) => void
146
146
  oncontextmenu?: (cell: CellContext, event: MouseEvent) => void
147
147
  enable_brush?: boolean
148
- onbrush?: (payload: {
149
- x_range: Vec2
150
- y_range: Vec2
151
- cells: CellContext[]
152
- }) => void
148
+ onbrush?: (payload: { x_range: Vec2; y_range: Vec2; cells: CellContext[] }) => void
153
149
  tile_size?: string
154
150
  gap?: string
155
151
  // false: show all rows/cols. 'compact': remove all-null rows/cols.
@@ -199,9 +195,7 @@
199
195
  } = $props()
200
196
 
201
197
  // Normalize symmetric prop: true→'lower', otherwise pass through
202
- const symmetric = $derived(
203
- symmetric_prop === true ? `lower` : symmetric_prop,
204
- )
198
+ const symmetric = $derived(symmetric_prop === true ? `lower` : symmetric_prop)
205
199
 
206
200
  // Check if a cell should be skipped in symmetric mode
207
201
  function is_hidden_cell(x_idx: number, y_idx: number): boolean {
@@ -220,8 +214,7 @@
220
214
  let get_value = $derived.by(() => {
221
215
  if (Array.isArray(values)) {
222
216
  const matrix_values = values as CellValue[][]
223
- return (x_idx: number, y_idx: number): CellValue =>
224
- matrix_values[y_idx]?.[x_idx] ?? null
217
+ return (x_idx: number, y_idx: number): CellValue => matrix_values[y_idx]?.[x_idx] ?? null
225
218
  }
226
219
  // Record<y_key, Record<x_key, value>>
227
220
  const record = values as Record<string, Record<string, CellValue>>
@@ -266,19 +259,23 @@
266
259
  const all_y = Array.from({ length: y_items.length }, (_, idx) => idx)
267
260
  const filtered_x = search_query_norm
268
261
  ? all_x.filter((idx) => {
269
- const item = x_items[idx]
270
- const key = item.key ?? item.label
271
- return key.toLowerCase().includes(search_query_norm) ||
272
- item.label.toLowerCase().includes(search_query_norm)
273
- })
262
+ const item = x_items[idx]
263
+ const key = item.key ?? item.label
264
+ return (
265
+ key.toLowerCase().includes(search_query_norm) ||
266
+ item.label.toLowerCase().includes(search_query_norm)
267
+ )
268
+ })
274
269
  : all_x
275
270
  const filtered_y = search_query_norm
276
271
  ? all_y.filter((idx) => {
277
- const item = y_items[idx]
278
- const key = item.key ?? item.label
279
- return key.toLowerCase().includes(search_query_norm) ||
280
- item.label.toLowerCase().includes(search_query_norm)
281
- })
272
+ const item = y_items[idx]
273
+ const key = item.key ?? item.label
274
+ return (
275
+ key.toLowerCase().includes(search_query_norm) ||
276
+ item.label.toLowerCase().includes(search_query_norm)
277
+ )
278
+ })
282
279
  : all_y
283
280
  if (!hide_empty) {
284
281
  return {
@@ -345,7 +342,7 @@
345
342
  // Interpolated quantile via quickselect (O(n) avg vs full sort); reorders `scratch_values` in place so callers must pass a copy they own
346
343
  function get_quantile(scratch_values: number[], quantile: number): number {
347
344
  if (scratch_values.length === 0) return 0
348
- const clipped_quantile = Math.max(0, Math.min(1, quantile))
345
+ const clipped_quantile = clamp01(quantile)
349
346
  const float_idx = (scratch_values.length - 1) * clipped_quantile
350
347
  const low_idx = Math.floor(float_idx)
351
348
  const high_idx = Math.ceil(float_idx)
@@ -390,8 +387,8 @@
390
387
  const clipped_min = get_quantile(scratch, q_low)
391
388
  const clipped_max = get_quantile(scratch, q_high)
392
389
  return clipped_min <= clipped_max
393
- ? [clipped_min, clipped_max] as const
394
- : [clipped_max, clipped_min] as const
390
+ ? ([clipped_min, clipped_max] as const)
391
+ : ([clipped_max, clipped_min] as const)
395
392
  })
396
393
 
397
394
  let [domain_min, domain_max] = $derived.by(() => {
@@ -410,41 +407,44 @@
410
407
  let cs_max = $derived(color_scale_range[1] ?? domain_max)
411
408
  let use_log_norm = $derived(normalize === `log` || log)
412
409
 
410
+ // fill for cells with no mappable value (default transparent)
411
+ let missing_fill = $derived(missing.color ?? `transparent`)
412
+
413
+ // whether a value lacks a mappable scale color (-> missing fill + label/style decorations)
414
+ function cell_is_missing(val: CellValue): boolean {
415
+ if (val === null) return true
416
+ if (typeof val === `string`) return !is_color(val)
417
+ return !Number.isFinite(val) || (use_log_norm && val <= 0)
418
+ }
419
+
413
420
  // Map a single value to a background color
414
421
  function value_to_color(val: CellValue): string | null {
415
- if (val === null) return missing_color || null
416
- if (typeof val === `string`) {
417
- if (is_color(val)) return val
418
- return missing_color || null
419
- }
420
- if (!Number.isFinite(val) || !color_scale_fn) return missing_color || null
421
- if (use_log_norm && val <= 0) return missing_color || null
422
+ if (typeof val === `string`) return is_color(val) ? val : missing_fill || null
423
+ // null/string excluded above -> val narrows to number past this guard
424
+ if (val === null || !color_scale_fn || cell_is_missing(val)) return missing_fill || null
422
425
 
423
426
  const span = cs_max - cs_min
424
427
  if (!Number.isFinite(span) || span === 0) return color_scale_fn(0.5)
425
428
 
426
- let normalized = typeof normalize === `function`
427
- ? normalize(val, cs_min, cs_max)
428
- : (val - cs_min) / span
429
+ let normalized =
430
+ typeof normalize === `function` ? normalize(val, cs_min, cs_max) : (val - cs_min) / span
429
431
  if (use_log_norm) {
430
432
  const is_descending_range = cs_min > cs_max
431
433
  const lower_bound = Math.min(cs_min, cs_max)
432
434
  const upper_bound = Math.max(cs_min, cs_max)
433
- if (upper_bound <= 0) return missing_color || null
435
+ if (upper_bound <= 0) return missing_fill || null
434
436
  const safe_lower_bound = lower_bound > 0 ? lower_bound : (min_pos ?? upper_bound)
435
437
  const safe_value = Math.max(val, safe_lower_bound)
436
438
  const log_min = Math.log(safe_lower_bound)
437
439
  const log_max = Math.log(upper_bound)
438
- if (
439
- !Number.isFinite(log_min) || !Number.isFinite(log_max) || log_max === log_min
440
- ) {
440
+ if (!Number.isFinite(log_min) || !Number.isFinite(log_max) || log_max === log_min) {
441
441
  return color_scale_fn(0.5)
442
442
  }
443
443
  const log_normalized = (Math.log(safe_value) - log_min) / (log_max - log_min)
444
444
  normalized = is_descending_range ? 1 - log_normalized : log_normalized
445
445
  }
446
- if (!Number.isFinite(normalized)) return missing_color || null
447
- return color_scale_fn(Math.max(0, Math.min(1, normalized)))
446
+ if (!Number.isFinite(normalized)) return missing_fill || null
447
+ return color_scale_fn(clamp01(normalized))
448
448
  }
449
449
 
450
450
  // Batch compute background colors as a flat array indexed by y_idx * n_x + x_idx.
@@ -462,21 +462,19 @@
462
462
  }
463
463
  const override_key = make_color_override_key(x_keys[x_idx], y_keys[y_idx])
464
464
  const raw_value = get_value(x_idx, y_idx)
465
- const transformed_value = typeof raw_value === `number`
466
- ? get_transformed_value(x_idx, y_idx)
467
- : raw_value
468
- colors[row_offset + x_idx] = override_key in color_overrides
469
- ? color_overrides[override_key]
470
- : value_to_color(transformed_value)
465
+ const transformed_value =
466
+ typeof raw_value === `number` ? get_transformed_value(x_idx, y_idx) : raw_value
467
+ colors[row_offset + x_idx] =
468
+ override_key in color_overrides
469
+ ? color_overrides[override_key]
470
+ : value_to_color(transformed_value)
471
471
  }
472
472
  }
473
473
  return colors
474
474
  })
475
475
 
476
476
  const to_contrast_colors = (bg_values: (string | null)[]): (string | null)[] =>
477
- bg_values.map((bg_color) =>
478
- bg_color ? pick_contrast_color({ bg_color }) : null
479
- )
477
+ bg_values.map((bg_color) => (bg_color ? pick_contrast_color({ bg_color }) : null))
480
478
 
481
479
  // Compute text colors when cells render content that needs contrast (cell snippet or show_values)
482
480
  let text_flat = $derived.by(() => {
@@ -530,12 +528,10 @@
530
528
  symmetric && symmetric_label_position === `diagonal`,
531
529
  )
532
530
  let use_staggered_x_labels = $derived(
533
- stagger_axis_labels === true ||
534
- (stagger_axis_labels === `auto` && vis_x.length >= 24),
531
+ stagger_axis_labels === true || (stagger_axis_labels === `auto` && vis_x.length >= 24),
535
532
  )
536
533
  let use_staggered_y_labels = $derived(
537
- stagger_axis_labels === true ||
538
- (stagger_axis_labels === `auto` && vis_y.length >= 24),
534
+ stagger_axis_labels === true || (stagger_axis_labels === `auto` && vis_y.length >= 24),
539
535
  )
540
536
  let use_side_split_x_labels = $derived(
541
537
  use_staggered_x_labels && !use_diagonal_symmetric_labels,
@@ -560,7 +556,7 @@
560
556
  )
561
557
 
562
558
  function parse_px_size(size: string): number {
563
- const parsed = Number.parseFloat(size)
559
+ const parsed = Number(size.replace(`px`, ``))
564
560
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 12
565
561
  }
566
562
 
@@ -573,8 +569,7 @@
573
569
  Math.floor((scroll_left - grid_offset_left) / tile_stride_px) - overscan
574
570
  const start_pos = Math.max(0, raw_start_pos)
575
571
  const raw_end_pos =
576
- Math.ceil((scroll_left - grid_offset_left + viewport_width) / tile_stride_px) +
577
- overscan
572
+ Math.ceil((scroll_left - grid_offset_left + viewport_width) / tile_stride_px) + overscan
578
573
  const end_pos = Math.min(vis_x.length, raw_end_pos)
579
574
  return vis_x.slice(start_pos, end_pos)
580
575
  })
@@ -584,8 +579,7 @@
584
579
  Math.floor((scroll_top - grid_offset_top) / tile_stride_px) - overscan
585
580
  const start_pos = Math.max(0, raw_start_pos)
586
581
  const raw_end_pos =
587
- Math.ceil((scroll_top - grid_offset_top + viewport_height) / tile_stride_px) +
588
- overscan
582
+ Math.ceil((scroll_top - grid_offset_top + viewport_height) / tile_stride_px) + overscan
589
583
  const end_pos = Math.min(vis_y.length, raw_end_pos)
590
584
  return vis_y.slice(start_pos, end_pos)
591
585
  })
@@ -610,16 +604,12 @@
610
604
  })
611
605
  let highlight_x_by_idx = $derived(
612
606
  new SvelteSet(
613
- vis_x.filter((idx) =>
614
- highlight_x_key_set.has(x_items[idx].key ?? x_items[idx].label)
615
- ),
607
+ vis_x.filter((idx) => highlight_x_key_set.has(x_items[idx].key ?? x_items[idx].label)),
616
608
  ),
617
609
  )
618
610
  let highlight_y_by_idx = $derived(
619
611
  new SvelteSet(
620
- vis_y.filter((idx) =>
621
- highlight_y_key_set.has(y_items[idx].key ?? y_items[idx].label)
622
- ),
612
+ vis_y.filter((idx) => highlight_y_key_set.has(y_items[idx].key ?? y_items[idx].label)),
623
613
  ),
624
614
  )
625
615
 
@@ -708,18 +698,14 @@
708
698
  click_timeout_id = null
709
699
  }
710
700
 
711
- function parse_cell_indices(
712
- cell_el: HTMLElement,
713
- ): { x_idx: number; y_idx: number } | null {
701
+ function parse_cell_indices(cell_el: HTMLElement): { x_idx: number; y_idx: number } | null {
714
702
  const x_value = Number(cell_el.dataset.x)
715
703
  const y_value = Number(cell_el.dataset.y)
716
704
  if (!Number.isInteger(x_value) || !Number.isInteger(y_value)) return null
717
705
  return { x_idx: x_value, y_idx: y_value }
718
706
  }
719
707
 
720
- function get_cell_context_from_target(
721
- event_target: EventTarget | null,
722
- ): CellContext | null {
708
+ function get_cell_context_from_target(event_target: EventTarget | null): CellContext | null {
723
709
  const cell_el = get_cell_el_from_target(event_target)
724
710
  if (!cell_el) return null
725
711
  const indices = parse_cell_indices(cell_el)
@@ -740,9 +726,7 @@
740
726
  }, dblclick_delay_ms)
741
727
  }
742
728
 
743
- function get_cell_el_from_target(
744
- event_target: EventTarget | null,
745
- ): HTMLElement | null {
729
+ function get_cell_el_from_target(event_target: EventTarget | null): HTMLElement | null {
746
730
  const target_node = event_target
747
731
  if (!(target_node instanceof Element)) return null
748
732
  if (target_node instanceof HTMLElement && target_node.dataset.x !== undefined) {
@@ -752,21 +736,14 @@
752
736
  return closest_cell instanceof HTMLElement ? closest_cell : null
753
737
  }
754
738
 
755
- function update_selected_cells(
756
- event: MouseEvent,
757
- clicked_cell: CellPos,
758
- ): void {
739
+ function update_selected_cells(event: MouseEvent, clicked_cell: CellPos): void {
759
740
  if (selection_mode === `single`) {
760
741
  selected_cells = [clicked_cell]
761
742
  last_selected_cell = clicked_cell
762
743
  onselect?.(selected_cells)
763
744
  return
764
745
  }
765
- if (
766
- selection_mode === `range` &&
767
- event.shiftKey &&
768
- last_selected_cell
769
- ) {
746
+ if (selection_mode === `range` && event.shiftKey && last_selected_cell) {
770
747
  const x_min = Math.min(last_selected_cell.x_idx, clicked_cell.x_idx)
771
748
  const x_max = Math.max(last_selected_cell.x_idx, clicked_cell.x_idx)
772
749
  const y_min = Math.min(last_selected_cell.y_idx, clicked_cell.y_idx)
@@ -784,8 +761,8 @@
784
761
  }
785
762
  const clicked_key = cell_pos_key(clicked_cell.x_idx, clicked_cell.y_idx)
786
763
  const next_cells = [...selected_cells]
787
- const existing_idx = next_cells.findIndex((pos) =>
788
- cell_pos_key(pos.x_idx, pos.y_idx) === clicked_key
764
+ const existing_idx = next_cells.findIndex(
765
+ (pos) => cell_pos_key(pos.x_idx, pos.y_idx) === clicked_key,
789
766
  )
790
767
  const toggle_mode = selection_mode === `multi` && (event.metaKey || event.ctrlKey)
791
768
  if (existing_idx !== -1 && toggle_mode) next_cells.splice(existing_idx, 1)
@@ -801,8 +778,10 @@
801
778
  const tw = tooltip_div.offsetWidth
802
779
  const th = tooltip_div.offsetHeight
803
780
  // Flip to opposite side of cursor when near viewport edges
804
- const left = client_x + 10 + tw > globalThis.innerWidth ? client_x - 10 - tw : client_x + 10
805
- const top = client_y + 12 + th > globalThis.innerHeight ? client_y - 12 - th : client_y + 12
781
+ const left =
782
+ client_x + 10 + tw > globalThis.innerWidth ? client_x - 10 - tw : client_x + 10
783
+ const top =
784
+ client_y + 12 + th > globalThis.innerHeight ? client_y - 12 - th : client_y + 12
806
785
  tooltip_div.style.left = `${Math.max(0, left)}px`
807
786
  tooltip_div.style.top = `${Math.max(0, top)}px`
808
787
  }
@@ -813,19 +792,12 @@
813
792
  }
814
793
 
815
794
  // Write default tooltip content imperatively (no reactive state)
816
- function update_tooltip_content(
817
- td: HTMLElement,
818
- x_idx: number,
819
- y_idx: number,
820
- ): void {
795
+ function update_tooltip_content(td: HTMLElement, x_idx: number, y_idx: number): void {
821
796
  const x_label = x_items[x_idx]?.label ?? ``
822
797
  const y_label = y_items[y_idx]?.label ?? ``
823
798
  const val = get_value(x_idx, y_idx)
824
- const value_str = val == null
825
- ? ``
826
- : typeof val === `number`
827
- ? format_num(val)
828
- : String(val)
799
+ const value_str =
800
+ val == null ? `` : typeof val === `number` ? format_num(val) : String(val)
829
801
  td.textContent = value_str
830
802
  ? `${x_label} - ${y_label}: ${value_str}`
831
803
  : `${x_label} - ${y_label}`
@@ -873,8 +845,8 @@
873
845
  // Clear active state imperatively
874
846
  last_hover_x = -1
875
847
  last_hover_y = -1
876
- const keep_tooltip_visible = tooltip_mode === `pinned` ||
877
- (tooltip_mode === `both` && pinned_cell !== null)
848
+ const keep_tooltip_visible =
849
+ tooltip_mode === `pinned` || (tooltip_mode === `both` && pinned_cell !== null)
878
850
  if (!keep_tooltip_visible) {
879
851
  tooltip_div?.classList.remove(`visible`)
880
852
  }
@@ -982,10 +954,7 @@
982
954
  for (let step_idx = 0; step_idx < max_steps; step_idx++) {
983
955
  next_x += x_step
984
956
  next_y += y_step
985
- if (
986
- next_x < 0 || next_y < 0 || next_x >= x_items.length ||
987
- next_y >= y_items.length
988
- ) {
957
+ if (next_x < 0 || next_y < 0 || next_x >= x_items.length || next_y >= y_items.length) {
989
958
  return
990
959
  }
991
960
  if (is_hidden_cell(next_x, next_y)) continue
@@ -1078,23 +1047,19 @@
1078
1047
  let legend_wrapper_style = $derived.by(() =>
1079
1048
  legend_position === `right`
1080
1049
  ? `--cbar-height: 120px; --cbar-min-height: 120px; --cbar-max-height: 120px;`
1081
- : `--cbar-width: 180px;`
1050
+ : `--cbar-width: 180px;`,
1082
1051
  )
1083
1052
 
1084
1053
  let has_interaction_handlers = $derived(
1085
1054
  !disabled &&
1086
- (
1087
- Boolean(onclick) ||
1055
+ (Boolean(onclick) ||
1088
1056
  Boolean(ondblclick) ||
1089
1057
  Boolean(oncontextmenu) ||
1090
1058
  selection_mode !== `single` ||
1091
- tooltip_mode !== `hover`
1092
- ),
1059
+ tooltip_mode !== `hover`),
1093
1060
  )
1094
1061
  let cell_tag_name = $derived(has_interaction_handlers ? `button` : `div`)
1095
- let cell_class_name = $derived(
1096
- has_interaction_handlers ? `cell interactive` : `cell`,
1097
- )
1062
+ let cell_class_name = $derived(has_interaction_handlers ? `cell interactive` : `cell`)
1098
1063
 
1099
1064
  // Tooltip state: only used for custom tooltip snippets (function tooltips)
1100
1065
  let tooltip_cell: CellContext | null = $state(null)
@@ -1103,7 +1068,8 @@
1103
1068
  keys_a.length === keys_b.length && keys_a.every((key, idx) => key === keys_b[idx])
1104
1069
  let prev_axis_keys: { x: string[]; y: string[] } | null = null
1105
1070
  $effect(() => {
1106
- const changed = prev_axis_keys !== null &&
1071
+ const changed =
1072
+ prev_axis_keys !== null &&
1107
1073
  !(keys_equal(x_keys, prev_axis_keys.x) && keys_equal(y_keys, prev_axis_keys.y))
1108
1074
  prev_axis_keys = { x: x_keys, y: y_keys }
1109
1075
  if (!changed) return
@@ -1151,8 +1117,8 @@
1151
1117
  bind:search_query
1152
1118
  {export_formats}
1153
1119
  onexport={onexport
1154
- ? (fmt: HeatmapExportFormat) => onexport(fmt, build_export_payload(fmt))
1155
- : undefined}
1120
+ ? (fmt: HeatmapExportFormat) => onexport(fmt, build_export_payload(fmt))
1121
+ : undefined}
1156
1122
  toggle_visible
1157
1123
  children={controls_children}
1158
1124
  {...controls_props}
@@ -1161,12 +1127,14 @@
1161
1127
  <div
1162
1128
  {...rest}
1163
1129
  bind:this={matrix_el}
1164
- class="grid theme-{theme} {rest.class ?? ``}"
1130
+ class={[`grid`, `theme-${theme}`, rest.class]}
1165
1131
  style:--n-cols={gaps_mode ? x_items.length : grid_col_count}
1166
1132
  style:--n-rows={gaps_mode ? y_items.length : grid_row_count}
1167
- style:--extra-right-y={(use_side_split_y_labels || symmetric === `upper`) ? 1 : 0}
1133
+ style:--extra-right-y={use_side_split_y_labels || symmetric === `upper` ? 1 : 0}
1168
1134
  style:--extra-bottom-x={use_side_split_x_labels ? 1 : 0}
1169
- style:--right-y-track={(use_side_split_y_labels || symmetric === `upper`) ? `max-content` : `0`}
1135
+ style:--right-y-track={use_side_split_y_labels || symmetric === `upper`
1136
+ ? `max-content`
1137
+ : `0`}
1170
1138
  style:--bottom-x-track={use_side_split_x_labels ? `max-content` : `0`}
1171
1139
  style:--tile-size={tile_size}
1172
1140
  style:--heatmap-gridline-color={gridline_color}
@@ -1241,6 +1209,11 @@
1241
1209
  {@const bg = bg_flat[flat_idx]}
1242
1210
  {@const should_render = !is_hidden_cell(x_idx, y_idx)}
1243
1211
  {#if should_render}
1212
+ {@const raw = get_value(x_idx, y_idx)}
1213
+ <!-- missing-state must match bg_flat, which colors from the transformed value -->
1214
+ {@const cell_missing = cell_is_missing(
1215
+ typeof raw === `number` ? get_transformed_value(x_idx, y_idx) : raw,
1216
+ )}
1244
1217
  <svelte:element
1245
1218
  this={cell_tag_name}
1246
1219
  class={cell_class_name}
@@ -1249,6 +1222,7 @@
1249
1222
  class:animated={animate_updates}
1250
1223
  data-x={x_idx}
1251
1224
  data-y={y_idx}
1225
+ style={cell_missing ? missing.style : undefined}
1252
1226
  style:background-color={bg}
1253
1227
  style:color={text_flat?.[flat_idx]}
1254
1228
  style:--heatmap-selected-outline-color={selected_outline_flat[flat_idx]}
@@ -1257,15 +1231,14 @@
1257
1231
  >
1258
1232
  {#if cell}
1259
1233
  {@render cell(build_cell_context(x_idx, y_idx))}
1260
- {:else if show_values}
1261
- {@const raw = get_value(x_idx, y_idx)}
1262
- {#if raw !== null}
1263
- <span class="cell-value">{
1264
- typeof raw === `number`
1234
+ {:else if cell_missing}
1235
+ {#if missing.label}<span class="cell-value">{missing.label}</span>{/if}
1236
+ {:else if show_values && raw !== null}
1237
+ <span class="cell-value"
1238
+ >{typeof raw === `number`
1265
1239
  ? format_num(raw, show_values === true ? `.3~g` : show_values)
1266
- : raw
1267
- }</span>
1268
- {/if}
1240
+ : raw}</span
1241
+ >
1269
1242
  {/if}
1270
1243
  </svelte:element>
1271
1244
  {:else}
@@ -1273,8 +1246,7 @@
1273
1246
  class="cell empty"
1274
1247
  style:grid-column={cell_grid_col(x_idx)}
1275
1248
  style:grid-row={cell_grid_row(y_idx)}
1276
- >
1277
- </div>
1249
+ ></div>
1278
1250
  {/if}
1279
1251
  {/each}
1280
1252
  {/each}
@@ -1379,25 +1351,17 @@
1379
1351
  .grid {
1380
1352
  display: grid;
1381
1353
  grid-template-columns:
1382
- max-content repeat(
1383
- var(--n-cols),
1384
- minmax(var(--tile-size, 6px), 1fr)
1385
- ) var(--right-y-track, 0);
1354
+ max-content repeat(var(--n-cols), minmax(var(--tile-size, 6px), 1fr))
1355
+ var(--right-y-track, 0);
1386
1356
  grid-template-rows:
1387
- max-content repeat(
1388
- var(--n-rows),
1389
- minmax(var(--tile-size, 6px), 1fr)
1390
- ) var(--bottom-x-track, 0);
1357
+ max-content repeat(var(--n-rows), minmax(var(--tile-size, 6px), 1fr))
1358
+ var(--bottom-x-track, 0);
1391
1359
  position: relative;
1392
1360
  width: min(100%, var(--heatmap-max-width, 1200px));
1393
1361
  max-width: var(--heatmap-max-width, 1200px);
1394
1362
  aspect-ratio: calc(
1395
- (
1396
- var(--n-cols) + 1 + var(--extra-right-y, 0)
1397
- )
1398
- / (
1399
- var(--n-rows) + 1 + var(--extra-bottom-x, 0)
1400
- )
1363
+ (var(--n-cols) + 1 + var(--extra-right-y, 0)) /
1364
+ (var(--n-rows) + 1 + var(--extra-bottom-x, 0))
1401
1365
  );
1402
1366
  overflow: auto;
1403
1367
  &.theme-publication {
@@ -1527,10 +1491,7 @@
1527
1491
  display: none;
1528
1492
  position: fixed;
1529
1493
  transform: none;
1530
- background: var(
1531
- --tooltip-bg,
1532
- light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.85))
1533
- );
1494
+ background: var(--tooltip-bg, light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.85)));
1534
1495
  color: var(--tooltip-color, light-dark(#222, #eee));
1535
1496
  padding: var(--tooltip-padding, 4px 6px);
1536
1497
  border-radius: var(--tooltip-border-radius, var(--border-radius, 3pt));
@@ -4,7 +4,7 @@ import type { AxisConfig } from '../plot';
4
4
  import { type ComponentProps, type Snippet } from 'svelte';
5
5
  import type { HTMLAttributes } from 'svelte/elements';
6
6
  import HeatmapMatrixControls from './HeatmapMatrixControls.svelte';
7
- import type { AxisItem, CellContext, DomainMode, HeatmapExportFormat, HeatmapTooltipProp, LegendPosition, NormalizeMode, SymmetricMode } from './index';
7
+ import type { AxisItem, CellContext, DomainMode, HeatmapExportFormat, HeatmapTooltipProp, LegendPosition, MissingCellStyle, NormalizeMode, SymmetricMode } from './index';
8
8
  type CellValue = number | string | null;
9
9
  type SelectionMode = `single` | `multi` | `range`;
10
10
  type AxisOrderKey = `label` | `key` | `sort_value`;
@@ -20,7 +20,7 @@ type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, `onclick` | `ondblc
20
20
  color_scale?: D3InterpolateName | ((val: number) => string);
21
21
  color_scale_range?: [number | null, number | null];
22
22
  color_overrides?: Record<string, string>;
23
- missing_color?: string;
23
+ missing?: MissingCellStyle;
24
24
  log?: boolean;
25
25
  value_transform?: (value: number, ctx: {
26
26
  x_item: AxisItem;
@@ -2,11 +2,15 @@
2
2
  import type { PaneProps, PaneToggleProps } from '../overlays'
3
3
  import DraggablePane from '../overlays/DraggablePane.svelte'
4
4
  import type { ComponentProps, Snippet } from 'svelte'
5
- import {
6
- ELEMENT_ORDERINGS,
7
- ORDERING_LABELS,
5
+ import { ELEMENT_ORDERINGS, ORDERING_LABELS } from './index'
6
+ import type {
7
+ ElementAxisOrderingKey,
8
+ DomainMode,
9
+ HeatmapExportFormat,
10
+ LegendPosition,
11
+ NormalizeMode,
12
+ SymmetricMode,
8
13
  } from './index'
9
- import type { ElementAxisOrderingKey, DomainMode, HeatmapExportFormat, LegendPosition, NormalizeMode, SymmetricMode } from './index'
10
14
 
11
15
  let {
12
16
  ordering = $bindable(`atomic_number`),
@@ -53,9 +57,7 @@
53
57
  } = $props()
54
58
 
55
59
  function merge_styles(base_style: string, override_style: unknown): string {
56
- const override_style_str = typeof override_style === `string`
57
- ? override_style
58
- : ``
60
+ const override_style_str = typeof override_style === `string` ? override_style : ``
59
61
  return override_style_str ? `${base_style}; ${override_style_str}` : base_style
60
62
  }
61
63
 
@@ -25,6 +25,6 @@ type $$ComponentProps = {
25
25
  controls_open: boolean;
26
26
  }]>;
27
27
  };
28
- declare const HeatmapMatrixControls: import("svelte").Component<$$ComponentProps, {}, "normalize" | "show_values" | "show_legend" | "controls_open" | "ordering" | "theme" | "toggle_visible" | "domain_mode" | "legend_position" | "search_query" | "symmetric" | "show_row_summaries" | "show_col_summaries">;
28
+ declare const HeatmapMatrixControls: import("svelte").Component<$$ComponentProps, {}, "normalize" | "theme" | "show_values" | "show_legend" | "controls_open" | "ordering" | "search_query" | "toggle_visible" | "domain_mode" | "legend_position" | "symmetric" | "show_row_summaries" | "show_col_summaries">;
29
29
  type HeatmapMatrixControls = ReturnType<typeof HeatmapMatrixControls>;
30
30
  export default HeatmapMatrixControls;
@@ -17,6 +17,11 @@ export type CellContext = {
17
17
  value: number | string | null;
18
18
  bg_color: string | null;
19
19
  };
20
+ export interface MissingCellStyle {
21
+ color?: `element-category` | (string & {});
22
+ label?: string;
23
+ style?: string;
24
+ }
20
25
  export declare const ORDERING_LABELS: {
21
26
  readonly atomic_number: "Atomic Number";
22
27
  readonly mendeleev_number: "Pettifor Chemical Similarity";
package/dist/icons.d.ts CHANGED
@@ -540,6 +540,10 @@ export declare const ICON_DATA: {
540
540
  readonly viewBox: "0 0 24 24";
541
541
  readonly path: "<path fill=\"currentColor\" d=\"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h5v16H4zm7 0h9v8h-9zm0 10h9v6h-9z\"/>";
542
542
  };
543
+ readonly Grid2x2: {
544
+ readonly viewBox: "0 0 24 24";
545
+ readonly path: "<path fill=\"currentColor\" d=\"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h7v7H4zm0 9h7v7H4zm9-9h7v7h-7zm0 9h7v7h-7z\"/>";
546
+ };
543
547
  readonly FermiSurface: {
544
548
  readonly viewBox: "0 0 24 24";
545
549
  readonly stroke: "currentColor";
package/dist/icons.js CHANGED
@@ -620,6 +620,10 @@ export const ICON_DATA = {
620
620
  viewBox: `0 0 24 24`,
621
621
  path: `<path fill="currentColor" d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h5v16H4zm7 0h9v8h-9zm0 10h9v6h-9z"/>`,
622
622
  },
623
+ Grid2x2: {
624
+ viewBox: `0 0 24 24`,
625
+ path: `<path fill="currentColor" d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M4 4h7v7H4zm0 9h7v7H4zm9-9h7v7h-7zm0 9h7v7h-7z"/>`,
626
+ },
623
627
  FermiSurface: {
624
628
  viewBox: `0 0 24 24`,
625
629
  stroke: `currentColor`,