matterviz 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/dist/brillouin/BrillouinZone.svelte +68 -145
  2. package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -14
  3. package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
  4. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  5. package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
  6. package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
  7. package/dist/brillouin/BrillouinZoneScene.svelte +49 -203
  8. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
  9. package/dist/brillouin/ReciprocalVectors.svelte +39 -0
  10. package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
  11. package/dist/brillouin/compute.d.ts +2 -0
  12. package/dist/brillouin/compute.js +80 -77
  13. package/dist/brillouin/geometry.d.ts +8 -0
  14. package/dist/brillouin/geometry.js +57 -0
  15. package/dist/brillouin/index.d.ts +2 -0
  16. package/dist/brillouin/index.js +2 -0
  17. package/dist/brillouin/types.d.ts +2 -2
  18. package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
  19. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +100 -191
  20. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
  21. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +176 -464
  22. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
  23. package/dist/chempot-diagram/color.d.ts +3 -6
  24. package/dist/chempot-diagram/color.js +5 -5
  25. package/dist/chempot-diagram/compute.d.ts +3 -3
  26. package/dist/chempot-diagram/compute.js +3 -1
  27. package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
  28. package/dist/chempot-diagram/controls-state.svelte.js +42 -0
  29. package/dist/chempot-diagram/export.d.ts +47 -0
  30. package/dist/chempot-diagram/export.js +133 -0
  31. package/dist/chempot-diagram/index.d.ts +1 -0
  32. package/dist/chempot-diagram/index.js +1 -0
  33. package/dist/chempot-diagram/pointer.d.ts +0 -10
  34. package/dist/chempot-diagram/pointer.js +4 -4
  35. package/dist/chempot-diagram/types.d.ts +3 -3
  36. package/dist/colors/index.js +2 -2
  37. package/dist/composition/FormulaFilter.svelte +6 -5
  38. package/dist/composition/PieChart.svelte +5 -5
  39. package/dist/composition/chem-sys.js +3 -2
  40. package/dist/composition/format.js +3 -2
  41. package/dist/composition/parse.d.ts +0 -1
  42. package/dist/composition/parse.js +17 -19
  43. package/dist/controls.d.ts +1 -0
  44. package/dist/controls.js +0 -1
  45. package/dist/convex-hull/ConvexHull.svelte +8 -10
  46. package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
  47. package/dist/convex-hull/ConvexHull2D.svelte +94 -175
  48. package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
  49. package/dist/convex-hull/ConvexHull3D.svelte +176 -680
  50. package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
  51. package/dist/convex-hull/ConvexHull4D.svelte +180 -680
  52. package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
  53. package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
  54. package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
  55. package/dist/convex-hull/ConvexHullControls.svelte +88 -7
  56. package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
  57. package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
  58. package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
  59. package/dist/convex-hull/ConvexHullStats.svelte +29 -168
  60. package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
  61. package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
  62. package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
  63. package/dist/convex-hull/barycentric-coords.d.ts +2 -4
  64. package/dist/convex-hull/barycentric-coords.js +6 -33
  65. package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
  66. package/dist/convex-hull/canvas-interactions.svelte.js +278 -0
  67. package/dist/convex-hull/helpers.d.ts +39 -7
  68. package/dist/convex-hull/helpers.js +154 -69
  69. package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
  70. package/dist/convex-hull/hull-state.svelte.js +124 -0
  71. package/dist/convex-hull/index.d.ts +9 -7
  72. package/dist/convex-hull/index.js +7 -2
  73. package/dist/convex-hull/thermodynamics.js +91 -920
  74. package/dist/convex-hull/types.d.ts +12 -4
  75. package/dist/convex-hull/types.js +12 -0
  76. package/dist/coordination/CoordinationBarPlot.svelte +4 -11
  77. package/dist/element/BohrAtom.svelte +2 -1
  78. package/dist/element/ElementTile.svelte.d.ts +1 -1
  79. package/dist/element/index.d.ts +4 -0
  80. package/dist/element/index.js +18 -0
  81. package/dist/feedback/DragOverlay.svelte +3 -1
  82. package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
  83. package/dist/feedback/StatusMessage.svelte +13 -3
  84. package/dist/fermi-surface/FermiSurface.svelte +67 -146
  85. package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
  86. package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
  87. package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -224
  88. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
  89. package/dist/fermi-surface/compute.js +11 -10
  90. package/dist/fermi-surface/export.js +4 -15
  91. package/dist/fermi-surface/index.d.ts +0 -1
  92. package/dist/fermi-surface/index.js +0 -1
  93. package/dist/fermi-surface/parse.d.ts +1 -1
  94. package/dist/fermi-surface/parse.js +64 -75
  95. package/dist/fermi-surface/types.d.ts +2 -2
  96. package/dist/heatmap-matrix/HeatmapMatrix.svelte +55 -40
  97. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
  98. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
  99. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
  100. package/dist/heatmap-matrix/index.d.ts +3 -2
  101. package/dist/index.d.ts +1 -0
  102. package/dist/index.js +1 -0
  103. package/dist/io/ExportPane.svelte +166 -0
  104. package/dist/io/ExportPane.svelte.d.ts +17 -0
  105. package/dist/io/decompress.js +1 -2
  106. package/dist/io/export.d.ts +5 -1
  107. package/dist/io/export.js +32 -28
  108. package/dist/io/fetch.d.ts +2 -1
  109. package/dist/io/file-drop.d.ts +7 -0
  110. package/dist/io/file-drop.js +13 -0
  111. package/dist/io/index.d.ts +2 -0
  112. package/dist/io/index.js +10 -0
  113. package/dist/io/types.d.ts +13 -0
  114. package/dist/isosurface/parse.js +46 -44
  115. package/dist/labels.js +1 -1
  116. package/dist/layout/FullscreenButton.svelte +33 -0
  117. package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
  118. package/dist/layout/FullscreenToggle.svelte +8 -14
  119. package/dist/layout/ViewerChrome.svelte +116 -0
  120. package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
  121. package/dist/layout/fullscreen.d.ts +4 -0
  122. package/dist/layout/fullscreen.svelte.d.ts +8 -0
  123. package/dist/layout/fullscreen.svelte.js +37 -0
  124. package/dist/layout/index.d.ts +3 -0
  125. package/dist/layout/index.js +3 -0
  126. package/dist/math.d.ts +7 -3
  127. package/dist/math.js +18 -21
  128. package/dist/overlays/index.d.ts +4 -0
  129. package/dist/periodic-table/PeriodicTable.svelte +9 -8
  130. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
  131. package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
  132. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
  133. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
  134. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
  135. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
  136. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
  137. package/dist/phase-diagram/colors.js +1 -1
  138. package/dist/phase-diagram/parse.d.ts +2 -1
  139. package/dist/plot/bar/BarPlot.svelte +79 -316
  140. package/dist/plot/bar/BarPlot.svelte.d.ts +7 -15
  141. package/dist/plot/bar/BarPlotControls.svelte.d.ts +1 -1
  142. package/dist/plot/bar/SpacegroupBarPlot.svelte +2 -1
  143. package/dist/plot/box/BoxPlot.svelte +76 -246
  144. package/dist/plot/box/BoxPlot.svelte.d.ts +4 -3
  145. package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
  146. package/dist/plot/box/Violin.svelte.d.ts +1 -1
  147. package/dist/plot/box/box-plot.d.ts +3 -2
  148. package/dist/plot/box/box-plot.js +5 -2
  149. package/dist/plot/box/kde.d.ts +2 -1
  150. package/dist/plot/box/kde.js +4 -4
  151. package/dist/plot/core/auto-place.d.ts +1 -1
  152. package/dist/plot/core/auto-place.js +4 -1
  153. package/dist/plot/core/components/ColorBar.svelte +5 -5
  154. package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
  155. package/dist/plot/core/components/Line.svelte +3 -2
  156. package/dist/plot/core/components/Line.svelte.d.ts +3 -2
  157. package/dist/plot/core/components/PlotAxis.svelte +2 -1
  158. package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
  159. package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
  160. package/dist/plot/core/components/ReferenceLine3D.svelte +2 -2
  161. package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
  162. package/dist/plot/core/components/ReferencePlane.svelte +2 -2
  163. package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
  164. package/dist/plot/core/data-cleaning.js +18 -18
  165. package/dist/plot/core/fill-utils.d.ts +4 -3
  166. package/dist/plot/core/fill-utils.js +6 -3
  167. package/dist/plot/core/interactions.d.ts +5 -1
  168. package/dist/plot/core/interactions.js +14 -0
  169. package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
  170. package/dist/plot/core/pan-zoom.svelte.js +221 -0
  171. package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
  172. package/dist/plot/core/placed-tween.svelte.js +68 -0
  173. package/dist/plot/core/reference-line.d.ts +10 -10
  174. package/dist/plot/core/reference-line.js +6 -6
  175. package/dist/plot/core/scales.d.ts +17 -25
  176. package/dist/plot/core/scales.js +10 -8
  177. package/dist/plot/core/svg.d.ts +2 -1
  178. package/dist/plot/core/types.d.ts +18 -7
  179. package/dist/plot/core/utils/label-placement.d.ts +1 -1
  180. package/dist/plot/core/utils/label-placement.js +3 -3
  181. package/dist/plot/core/utils.d.ts +2 -1
  182. package/dist/plot/histogram/Histogram.svelte +77 -314
  183. package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
  184. package/dist/plot/sankey/Sankey.svelte +2 -5
  185. package/dist/plot/sankey/Sankey.svelte.d.ts +1 -1
  186. package/dist/plot/sankey/sankey.js +3 -1
  187. package/dist/plot/scatter/BinnedScatterPlot.svelte +3 -5
  188. package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +4 -4
  189. package/dist/plot/scatter/ScatterPlot.svelte +160 -450
  190. package/dist/plot/scatter/ScatterPlot.svelte.d.ts +7 -15
  191. package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
  192. package/dist/plot/scatter/binned-scatter-types.d.ts +4 -11
  193. package/dist/plot/scatter/index.d.ts +1 -1
  194. package/dist/plot/scatter-3d/ScatterPlot3D.svelte +15 -26
  195. package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
  196. package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +9 -10
  197. package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
  198. package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +122 -121
  199. package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
  200. package/dist/plot/scatter-3d/Surface3D.svelte +6 -5
  201. package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
  202. package/dist/plot/sunburst/Sunburst.svelte +16 -20
  203. package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
  204. package/dist/plot/sunburst/SunburstControls.svelte.d.ts +1 -1
  205. package/dist/plot/sunburst/sunburst.js +4 -1
  206. package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
  207. package/dist/sanitize.js +13 -2
  208. package/dist/scene/SceneCamera.svelte +62 -0
  209. package/dist/scene/SceneCamera.svelte.d.ts +19 -0
  210. package/dist/scene/bind-renderer.svelte.d.ts +2 -0
  211. package/dist/scene/bind-renderer.svelte.js +14 -0
  212. package/dist/scene/index.d.ts +4 -0
  213. package/dist/scene/index.js +5 -0
  214. package/dist/scene/props.js +52 -0
  215. package/dist/scene/types.d.ts +26 -0
  216. package/dist/scene/types.js +1 -0
  217. package/dist/settings.d.ts +14 -2
  218. package/dist/settings.js +59 -1
  219. package/dist/spectral/Bands.svelte +8 -7
  220. package/dist/spectral/Bands.svelte.d.ts +3 -2
  221. package/dist/spectral/BandsAndDos.svelte +22 -24
  222. package/dist/spectral/BrillouinBandsDos.svelte +3 -3
  223. package/dist/spectral/Dos.svelte +5 -4
  224. package/dist/spectral/Dos.svelte.d.ts +2 -1
  225. package/dist/spectral/helpers.d.ts +6 -6
  226. package/dist/spectral/helpers.js +43 -37
  227. package/dist/state.svelte.d.ts +0 -7
  228. package/dist/state.svelte.js +0 -6
  229. package/dist/structure/Arrow.svelte +2 -4
  230. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  231. package/dist/structure/CanvasTooltip.svelte +1 -0
  232. package/dist/structure/CellSelect.svelte +11 -3
  233. package/dist/structure/CellSelect.svelte.d.ts +2 -1
  234. package/dist/structure/Lattice.svelte +2 -2
  235. package/dist/structure/Structure.svelte +291 -355
  236. package/dist/structure/Structure.svelte.d.ts +5 -15
  237. package/dist/structure/StructureControls.svelte +217 -2
  238. package/dist/structure/StructureControls.svelte.d.ts +5 -3
  239. package/dist/structure/StructureExportPane.svelte +54 -156
  240. package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
  241. package/dist/structure/StructureInfoPane.svelte +5 -3
  242. package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
  243. package/dist/structure/StructureScene.svelte +365 -198
  244. package/dist/structure/StructureScene.svelte.d.ts +22 -20
  245. package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
  246. package/dist/structure/{label-placement.js → atom-label-placement.js} +12 -2
  247. package/dist/structure/atom-properties.d.ts +1 -1
  248. package/dist/structure/atom-properties.js +11 -16
  249. package/dist/structure/bond-order-perception.js +2 -4
  250. package/dist/structure/bonding.d.ts +3 -0
  251. package/dist/structure/bonding.js +91 -48
  252. package/dist/structure/export.d.ts +24 -4
  253. package/dist/structure/export.js +64 -122
  254. package/dist/structure/index.d.ts +2 -0
  255. package/dist/structure/index.js +2 -0
  256. package/dist/structure/parse.d.ts +3 -2
  257. package/dist/structure/parse.js +333 -370
  258. package/dist/structure/partial-occupancy.d.ts +0 -1
  259. package/dist/structure/partial-occupancy.js +1 -1
  260. package/dist/structure/pbc.d.ts +1 -1
  261. package/dist/structure/pbc.js +186 -13
  262. package/dist/structure/polyhedra.d.ts +41 -0
  263. package/dist/structure/polyhedra.js +602 -0
  264. package/dist/structure/site.d.ts +4 -0
  265. package/dist/structure/site.js +1 -0
  266. package/dist/structure/supercell.js +3 -2
  267. package/dist/structure/validation.js +5 -6
  268. package/dist/symmetry/SymmetryElementControls.svelte +69 -0
  269. package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
  270. package/dist/symmetry/SymmetryElements.svelte +354 -0
  271. package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
  272. package/dist/symmetry/SymmetryStats.svelte +111 -6
  273. package/dist/symmetry/WyckoffTable.svelte +68 -7
  274. package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
  275. package/dist/symmetry/cell-transform.js +7 -14
  276. package/dist/symmetry/index.d.ts +14 -4
  277. package/dist/symmetry/index.js +301 -80
  278. package/dist/symmetry/spacegroups.d.ts +5 -1
  279. package/dist/symmetry/spacegroups.js +15 -1
  280. package/dist/symmetry/symmetry-elements.d.ts +33 -0
  281. package/dist/symmetry/symmetry-elements.js +521 -0
  282. package/dist/symmetry/wyckoff-db.d.ts +9 -0
  283. package/dist/symmetry/wyckoff-db.js +87 -0
  284. package/dist/table/HeatmapTable.svelte +4 -15
  285. package/dist/table/HeatmapTable.svelte.d.ts +1 -1
  286. package/dist/trajectory/Trajectory.svelte +58 -61
  287. package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
  288. package/dist/trajectory/TrajectoryExportPane.svelte +15 -24
  289. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
  290. package/dist/trajectory/TrajectoryInfoPane.svelte +3 -2
  291. package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
  292. package/dist/trajectory/constants.js +6 -2
  293. package/dist/trajectory/extract.js +17 -37
  294. package/dist/trajectory/format-detect.d.ts +0 -1
  295. package/dist/trajectory/format-detect.js +3 -9
  296. package/dist/trajectory/frame-reader.d.ts +0 -1
  297. package/dist/trajectory/frame-reader.js +62 -128
  298. package/dist/trajectory/helpers.d.ts +10 -2
  299. package/dist/trajectory/helpers.js +56 -36
  300. package/dist/trajectory/parse/ase.d.ts +9 -1
  301. package/dist/trajectory/parse/ase.js +47 -32
  302. package/dist/trajectory/parse/diagnostics.d.ts +3 -0
  303. package/dist/trajectory/parse/diagnostics.js +14 -0
  304. package/dist/trajectory/parse/index.d.ts +1 -1
  305. package/dist/trajectory/parse/index.js +54 -102
  306. package/dist/trajectory/parse/lammps.d.ts +0 -2
  307. package/dist/trajectory/parse/lammps.js +8 -6
  308. package/dist/trajectory/parse/pymatgen.d.ts +2 -0
  309. package/dist/trajectory/parse/pymatgen.js +74 -0
  310. package/dist/trajectory/parse/vasp.js +4 -3
  311. package/dist/trajectory/parse/xyz.d.ts +9 -21
  312. package/dist/trajectory/parse/xyz.js +28 -33
  313. package/dist/trajectory/plotting.d.ts +0 -1
  314. package/dist/trajectory/plotting.js +3 -100
  315. package/dist/utils.d.ts +1 -0
  316. package/dist/utils.js +1 -1
  317. package/dist/xrd/XrdPlot.svelte +14 -29
  318. package/dist/xrd/broadening.d.ts +2 -1
  319. package/dist/xrd/calc-xrd.js +6 -11
  320. package/dist/xrd/index.d.ts +2 -2
  321. package/package.json +29 -16
  322. package/dist/element/data.json +0 -11864
  323. package/dist/fermi-surface/marching-cubes.d.ts +0 -2
  324. package/dist/fermi-surface/marching-cubes.js +0 -2
  325. package/dist/plot/core/hover-lock.svelte.d.ts +0 -14
  326. package/dist/plot/core/hover-lock.svelte.js +0 -45
@@ -1,7 +1,8 @@
1
- import type { ShowControlsProp } from '../controls';
2
- import type { ElementSymbol } from '../element';
1
+ import { type ShowControlsProp } from '../controls';
2
+ import { type ElementSymbol } from '../element';
3
3
  import Spinner from '../feedback/Spinner.svelte';
4
4
  import type { IsosurfaceSettings, VolumetricData } from '../isosurface/types';
5
+ import { type FullscreenToggleProp } from '../layout';
5
6
  import type { AnyStructure, BondEditMode, BondOrder, MeasureMode, StructureBond } from './';
6
7
  import type { CellType, SymmetrySettings } from '../symmetry';
7
8
  import type { MoyoDataset } from '@spglib/moyo-wasm';
@@ -17,15 +18,6 @@ type $$ComponentProps = {
17
18
  structure?: AnyStructure;
18
19
  bonds?: StructureBond[];
19
20
  scene_props?: ComponentProps<typeof StructureScene>;
20
- /**
21
- * Controls visibility configuration.
22
- * - 'always': controls always visible
23
- * - 'hover': controls visible on component hover (default)
24
- * - 'never': controls never visible
25
- * - object: { mode, hidden, style } for fine-grained control
26
- *
27
- * Control names: 'reset-camera', 'fullscreen', 'measure-mode', 'info-pane', 'export-pane', 'controls'
28
- */
29
21
  show_controls?: ShowControlsProp;
30
22
  fullscreen?: boolean;
31
23
  width?: number;
@@ -42,9 +34,7 @@ type $$ComponentProps = {
42
34
  bond_edit_mode?: BondEditMode;
43
35
  bond_edit_order?: BondOrder;
44
36
  info_pane_open?: boolean;
45
- fullscreen_toggle?: Snippet<[{
46
- fullscreen: boolean;
47
- }]> | boolean;
37
+ fullscreen_toggle?: FullscreenToggleProp;
48
38
  bottom_left?: Snippet<[{
49
39
  structure?: AnyStructure;
50
40
  }]>;
@@ -84,6 +74,6 @@ type $$ComponentProps = {
84
74
  on_camera_reset?: EventHandler;
85
75
  on_bonds_change?: (bonds: StructureBond[] | undefined) => void;
86
76
  } & Omit<ComponentProps<typeof StructureControls>, `children` | `onclose`> & Omit<HTMLAttributes<HTMLDivElement>, `children`>;
87
- declare const Structure: import("svelte").Component<$$ComponentProps, {}, "structure" | "dragover" | "height" | "width" | "fullscreen" | "hovered" | "controls_open" | "loading" | "png_dpi" | "color_scheme" | "background_color" | "background_opacity" | "show_image_atoms" | "info_pane_open" | "wrapper" | "sym_data" | "error_msg" | "site_radius_overrides" | "atom_color_config" | "lattice_props" | "measure_mode" | "selected_sites" | "measured_sites" | "bond_edit_mode" | "bond_edit_order" | "hidden_elements" | "hidden_prop_vals" | "element_radius_overrides" | "volumetric_data" | "isosurface_settings" | "element_mapping" | "bonds" | "supercell_scaling" | "cell_type" | "active_volume_idx" | "scene_props" | "highlighted_sites" | "hovered_site_idx" | "enable_measure_mode" | "performance_mode" | "displayed_structure" | "symmetry_settings">;
77
+ declare const Structure: import("svelte").Component<$$ComponentProps, {}, "structure" | "height" | "width" | "dragover" | "color_scheme" | "fullscreen" | "wrapper" | "hovered" | "controls_open" | "bonds" | "sym_data" | "background_color" | "background_opacity" | "atom_color_config" | "hidden_elements" | "hidden_prop_vals" | "element_mapping" | "element_radius_overrides" | "site_radius_overrides" | "selected_sites" | "supercell_scaling" | "cell_type" | "loading" | "active_volume_idx" | "measured_sites" | "bond_edit_mode" | "scene_props" | "lattice_props" | "show_image_atoms" | "volumetric_data" | "isosurface_settings" | "png_dpi" | "highlighted_sites" | "hovered_site_idx" | "measure_mode" | "bond_edit_order" | "info_pane_open" | "enable_measure_mode" | "error_msg" | "performance_mode" | "displayed_structure" | "symmetry_settings">;
88
78
  type Structure = ReturnType<typeof Structure>;
89
79
  export default Structure;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import type { PaneProps, PaneToggleProps } from '../overlays'
2
3
  import type { ColorSchemeName, D3InterpolateName } from '../colors'
3
4
  import { AXIS_COLORS, ELEMENT_COLOR_SCHEMES } from '../colors'
4
5
  import IsosurfaceControls from '../isosurface/IsosurfaceControls.svelte'
@@ -19,6 +20,7 @@
19
20
  VECTOR_PALETTE,
20
21
  } from './'
21
22
  import type { AtomColorConfig } from './atom-properties'
23
+ import { get_majority_element } from './bonding'
22
24
  import { is_valid_supercell_input } from './supercell'
23
25
  import type { CellType } from '../symmetry'
24
26
  import type { MoyoDataset } from '@spglib/moyo-wasm'
@@ -54,6 +56,7 @@
54
56
  volumetric_data = $bindable<VolumetricData[]>(),
55
57
  isosurface_settings = $bindable<IsosurfaceSettings>(),
56
58
  active_volume_idx = $bindable(0),
59
+ polyhedra_rendered_elements = [],
57
60
  pane_props = {},
58
61
  toggle_props = {},
59
62
  ...rest
@@ -74,8 +77,9 @@
74
77
  volumetric_data?: VolumetricData[] // Volumetric data volumes for isosurface controls
75
78
  isosurface_settings?: IsosurfaceSettings // Isosurface rendering settings
76
79
  active_volume_idx?: number // Active volume index
77
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`]
78
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`]
80
+ polyhedra_rendered_elements?: string[] // elements currently anchoring polyhedra
81
+ pane_props?: PaneProps
82
+ toggle_props?: PaneToggleProps
79
83
  } = $props()
80
84
 
81
85
  // Color scheme selection state
@@ -112,6 +116,44 @@
112
116
  }
113
117
  })
114
118
 
119
+ // Unique majority elements in the structure, for polyhedra center toggles.
120
+ // Majority (not all) species so the list matches what compute_polyhedra can
121
+ // actually use as centers - minority occupancies of disordered sites never are.
122
+ let structure_elements = $derived(
123
+ [
124
+ ...new Set(
125
+ (structure?.sites ?? []).flatMap((site) => get_majority_element(site) ?? []),
126
+ ),
127
+ ].sort(),
128
+ )
129
+
130
+ // An element counts as an enabled polyhedra center if it isn't excluded and is
131
+ // either force-included or currently rendered. Using configured intent (not just
132
+ // the transient render state) keeps the checkbox reversible: a force-included
133
+ // element that the CN/geometry filters can't render still shows checked, so the
134
+ // user can toggle it back off.
135
+ const is_polyhedra_center_enabled = (element: string): boolean => {
136
+ const excluded = scene_props.polyhedra_excluded_elements ?? []
137
+ const included = scene_props.polyhedra_included_elements ?? []
138
+ return !excluded.includes(element) &&
139
+ (included.includes(element) || polyhedra_rendered_elements.includes(element))
140
+ }
141
+
142
+ // Toggle an element as polyhedra center. Enabled elements get excluded; disabled
143
+ // ones get force-included (which also bypasses the automatic hiding of spectator
144
+ // cations like Li/Na/Ba).
145
+ function toggle_polyhedra_element(element: string) {
146
+ const excluded = scene_props.polyhedra_excluded_elements ?? []
147
+ const included = scene_props.polyhedra_included_elements ?? []
148
+ if (is_polyhedra_center_enabled(element)) {
149
+ scene_props.polyhedra_excluded_elements = [...new Set([...excluded, element])]
150
+ scene_props.polyhedra_included_elements = included.filter((el) => el !== element)
151
+ } else {
152
+ scene_props.polyhedra_excluded_elements = excluded.filter((el) => el !== element)
153
+ scene_props.polyhedra_included_elements = [...new Set([...included, element])]
154
+ }
155
+ }
156
+
115
157
  const hex_color_pattern = /^#[0-9a-f]{3}([0-9a-f]{3})?$/i
116
158
  const color_mix_pattern =
117
159
  /^color-mix\(in srgb,\s*(#[0-9a-f]{3}(?:[0-9a-f]{3})?)\s+(\d+(?:\.\d+)?)%,\s*transparent\)$/i
@@ -293,6 +335,7 @@
293
335
  current_values={{
294
336
  show_atoms: scene_props.show_atoms,
295
337
  show_bonds: scene_props.show_bonds,
338
+ show_polyhedra: scene_props.show_polyhedra,
296
339
  show_image_atoms,
297
340
  show_site_labels: scene_props.show_site_labels,
298
341
  show_site_indices: scene_props.show_site_indices,
@@ -302,6 +345,7 @@
302
345
  on_reset={() => {
303
346
  scene_props.show_atoms = DEFAULTS.structure.show_atoms
304
347
  scene_props.show_bonds = DEFAULTS.structure.show_bonds
348
+ scene_props.show_polyhedra = DEFAULTS.structure.show_polyhedra
305
349
  scene_props.show_site_labels = DEFAULTS.structure.show_site_labels
306
350
  scene_props.show_site_indices = DEFAULTS.structure.show_site_indices
307
351
  scene_props.vector_configs = default_vector_configs(available_vector_keys)
@@ -394,6 +438,20 @@
394
438
  {/each}
395
439
  </select>
396
440
  </label>
441
+ <label
442
+ {@attach tooltip({ content: SETTINGS_CONFIG.structure.show_polyhedra.description })}
443
+ style="gap: 6pt"
444
+ >
445
+ Polyhedra:
446
+ <select bind:value={scene_props.show_polyhedra}>
447
+ {#each Object.entries(SETTINGS_CONFIG.structure.show_polyhedra.enum ?? {}) as
448
+ [value, label]
449
+ (value)
450
+ }
451
+ <option {value}>{label}</option>
452
+ {/each}
453
+ </select>
454
+ </label>
397
455
  </SettingsSection>
398
456
 
399
457
  <SettingsSection
@@ -1215,6 +1273,163 @@
1215
1273
  </label>
1216
1274
  </SettingsSection>
1217
1275
  {/if}
1276
+
1277
+ {#if scene_props.show_polyhedra && scene_props.show_polyhedra !== `never`}
1278
+ <SettingsSection
1279
+ title="Polyhedra"
1280
+ current_values={{
1281
+ polyhedra_opacity: scene_props.polyhedra_opacity,
1282
+ polyhedra_show_edges: scene_props.polyhedra_show_edges,
1283
+ polyhedra_edge_color: scene_props.polyhedra_edge_color,
1284
+ polyhedra_color_mode: scene_props.polyhedra_color_mode,
1285
+ polyhedra_color: scene_props.polyhedra_color,
1286
+ polyhedra_hide_center_atoms: scene_props.polyhedra_hide_center_atoms,
1287
+ polyhedra_min_neighbors: scene_props.polyhedra_min_neighbors,
1288
+ polyhedra_max_neighbors: scene_props.polyhedra_max_neighbors,
1289
+ polyhedra_excluded_elements: scene_props.polyhedra_excluded_elements,
1290
+ polyhedra_included_elements: scene_props.polyhedra_included_elements,
1291
+ }}
1292
+ on_reset={() => {
1293
+ scene_props.polyhedra_opacity = DEFAULTS.structure.polyhedra_opacity
1294
+ scene_props.polyhedra_show_edges = DEFAULTS.structure.polyhedra_show_edges
1295
+ scene_props.polyhedra_edge_color = DEFAULTS.structure.polyhedra_edge_color
1296
+ scene_props.polyhedra_color_mode = DEFAULTS.structure.polyhedra_color_mode
1297
+ scene_props.polyhedra_color = DEFAULTS.structure.polyhedra_color
1298
+ scene_props.polyhedra_hide_center_atoms =
1299
+ DEFAULTS.structure.polyhedra_hide_center_atoms
1300
+ scene_props.polyhedra_min_neighbors = DEFAULTS.structure.polyhedra_min_neighbors
1301
+ scene_props.polyhedra_max_neighbors = DEFAULTS.structure.polyhedra_max_neighbors
1302
+ scene_props.polyhedra_excluded_elements =
1303
+ DEFAULTS.structure.polyhedra_excluded_elements
1304
+ scene_props.polyhedra_included_elements =
1305
+ DEFAULTS.structure.polyhedra_included_elements
1306
+ }}
1307
+ >
1308
+ <label
1309
+ {@attach tooltip({
1310
+ content: SETTINGS_CONFIG.structure.polyhedra_opacity.description,
1311
+ })}
1312
+ >
1313
+ Opacity
1314
+ <input
1315
+ type="number"
1316
+ min={0}
1317
+ max={1}
1318
+ step={0.05}
1319
+ bind:value={scene_props.polyhedra_opacity}
1320
+ />
1321
+ <input
1322
+ type="range"
1323
+ min={0}
1324
+ max={1}
1325
+ step={0.05}
1326
+ bind:value={scene_props.polyhedra_opacity}
1327
+ />
1328
+ </label>
1329
+ <label
1330
+ {@attach tooltip({
1331
+ content: SETTINGS_CONFIG.structure.polyhedra_color_mode.description,
1332
+ })}
1333
+ >
1334
+ Color <select bind:value={scene_props.polyhedra_color_mode}>
1335
+ {#each Object.entries(
1336
+ SETTINGS_CONFIG.structure.polyhedra_color_mode.enum ?? {},
1337
+ ) as
1338
+ [value, label]
1339
+ (value)
1340
+ }
1341
+ <option {value}>{label}</option>
1342
+ {/each}
1343
+ </select>
1344
+ {#if scene_props.polyhedra_color_mode === `uniform`}
1345
+ <input type="color" bind:value={scene_props.polyhedra_color} />
1346
+ {/if}
1347
+ </label>
1348
+ <label
1349
+ style="gap: 6pt"
1350
+ {@attach tooltip({
1351
+ content: SETTINGS_CONFIG.structure.polyhedra_show_edges.description,
1352
+ })}
1353
+ >
1354
+ <input type="checkbox" bind:checked={scene_props.polyhedra_show_edges} />
1355
+ Edges
1356
+ {#if scene_props.polyhedra_show_edges}
1357
+ <input type="color" bind:value={scene_props.polyhedra_edge_color} />
1358
+ {/if}
1359
+ </label>
1360
+ <label
1361
+ style="gap: 6pt"
1362
+ {@attach tooltip({
1363
+ content: SETTINGS_CONFIG.structure.polyhedra_hide_center_atoms.description,
1364
+ })}
1365
+ >
1366
+ <input type="checkbox" bind:checked={scene_props.polyhedra_hide_center_atoms} />
1367
+ Hide center atoms
1368
+ </label>
1369
+ <label
1370
+ {@attach tooltip({
1371
+ content: SETTINGS_CONFIG.structure.polyhedra_min_neighbors.description,
1372
+ })}
1373
+ >
1374
+ Min neighbors
1375
+ <input
1376
+ type="number"
1377
+ min={4}
1378
+ max={12}
1379
+ step={1}
1380
+ bind:value={scene_props.polyhedra_min_neighbors}
1381
+ />
1382
+ <input
1383
+ type="range"
1384
+ min={4}
1385
+ max={12}
1386
+ step={1}
1387
+ bind:value={scene_props.polyhedra_min_neighbors}
1388
+ />
1389
+ </label>
1390
+ <label
1391
+ {@attach tooltip({
1392
+ content: SETTINGS_CONFIG.structure.polyhedra_max_neighbors.description,
1393
+ })}
1394
+ >
1395
+ Max neighbors
1396
+ <input
1397
+ type="number"
1398
+ min={4}
1399
+ max={16}
1400
+ step={1}
1401
+ bind:value={scene_props.polyhedra_max_neighbors}
1402
+ />
1403
+ <input
1404
+ type="range"
1405
+ min={4}
1406
+ max={16}
1407
+ step={1}
1408
+ bind:value={scene_props.polyhedra_max_neighbors}
1409
+ />
1410
+ </label>
1411
+ {#if structure_elements.length > 0}
1412
+ <div
1413
+ style="display: flex; flex-wrap: wrap; gap: 8pt; align-items: center"
1414
+ {@attach tooltip({
1415
+ content: SETTINGS_CONFIG.structure.polyhedra_excluded_elements.description,
1416
+ })}
1417
+ >
1418
+ Centers:
1419
+ {#each structure_elements as element (element)}
1420
+ <label style="gap: 4pt">
1421
+ <input
1422
+ type="checkbox"
1423
+ checked={is_polyhedra_center_enabled(element)}
1424
+ onchange={() => toggle_polyhedra_element(element)}
1425
+ />
1426
+ {element}
1427
+ </label>
1428
+ {/each}
1429
+ </div>
1430
+ {/if}
1431
+ </SettingsSection>
1432
+ {/if}
1218
1433
  </DraggablePane>
1219
1434
 
1220
1435
  <style>
@@ -1,3 +1,4 @@
1
+ import type { PaneProps, PaneToggleProps } from '../overlays';
1
2
  import type { IsosurfaceSettings, VolumetricData } from '../isosurface/types';
2
3
  import DraggablePane from '../overlays/DraggablePane.svelte';
3
4
  import type { AnyStructure } from './';
@@ -23,9 +24,10 @@ type $$ComponentProps = Omit<ComponentProps<typeof DraggablePane>, `children`> &
23
24
  volumetric_data?: VolumetricData[];
24
25
  isosurface_settings?: IsosurfaceSettings;
25
26
  active_volume_idx?: number;
26
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
27
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
27
+ polyhedra_rendered_elements?: string[];
28
+ pane_props?: PaneProps;
29
+ toggle_props?: PaneToggleProps;
28
30
  };
29
- declare const StructureControls: import("svelte").Component<$$ComponentProps, {}, "controls_open" | "color_scheme" | "background_color" | "background_opacity" | "show_image_atoms" | "atom_color_config" | "lattice_props" | "volumetric_data" | "isosurface_settings" | "supercell_scaling" | "cell_type" | "active_volume_idx" | "scene_props" | "supercell_loading">;
31
+ declare const StructureControls: import("svelte").Component<$$ComponentProps, {}, "color_scheme" | "controls_open" | "background_color" | "background_opacity" | "atom_color_config" | "supercell_scaling" | "cell_type" | "active_volume_idx" | "scene_props" | "lattice_props" | "show_image_atoms" | "supercell_loading" | "volumetric_data" | "isosurface_settings">;
30
32
  type StructureControls = ReturnType<typeof StructureControls>;
31
33
  export default StructureControls;
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
+ import type { PaneProps, PaneToggleProps } from '../overlays'
3
+ import type { ExportSection } from '../io'
4
+ import ExportPane from '../io/ExportPane.svelte'
5
+ import { export_canvas_as_png, observe_canvas_presence } from '../io/export'
2
6
  import type { AnyStructure } from './'
3
- import DraggablePane from '../overlays/DraggablePane.svelte'
4
- import { export_canvas_as_png } from '../io/export'
5
- import { sanitize_html } from '../sanitize'
6
7
  import * as exports from './export'
8
+ import type { StructTextFormat } from './export'
7
9
  import type { ComponentProps } from 'svelte'
8
- import { tooltip } from 'svelte-multiselect/attachments'
9
10
  import type { Camera, Scene } from 'three'
10
11
 
11
12
  let {
@@ -25,18 +26,10 @@
25
26
  scene?: Scene
26
27
  camera?: Camera
27
28
  png_dpi?: number
28
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`]
29
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`]
29
+ pane_props?: PaneProps
30
+ toggle_props?: PaneToggleProps
30
31
  } = $props()
31
32
 
32
- // Copy button feedback state
33
- let copy_status = $state<
34
- { json: boolean; xyz: boolean; cif: boolean; poscar: boolean }
35
- >({ json: false, xyz: false, cif: false, poscar: false })
36
-
37
- // Dynamic button text based on copy status
38
- const copy_confirm = `✅`
39
-
40
33
  const text_export_formats = [
41
34
  {
42
35
  label: `JSON`,
@@ -79,43 +72,14 @@
79
72
  },
80
73
  ] as const
81
74
 
82
- // Helper function to export structure to file
83
- function export_structure(format: `json` | `xyz` | `cif` | `poscar`) {
84
- if (!structure) return
85
- const export_fns = {
86
- json: exports.export_structure_as_json,
87
- xyz: exports.export_structure_as_xyz,
88
- cif: exports.export_structure_as_cif,
89
- poscar: exports.export_structure_as_poscar,
90
- } as const
91
- export_fns[format](structure)
92
- }
93
-
94
- // Handle clipboard copy with user feedback
95
- async function handle_copy(format: `json` | `xyz` | `cif` | `poscar`) {
96
- if (!structure) {
97
- console.warn(`No structure available for copying`)
98
- return
99
- }
100
-
75
+ // Clipboard content for a text format; must not throw (ExportPane evaluates on click)
76
+ function get_text_content(format: StructTextFormat): string | null {
77
+ if (!structure) return null
101
78
  try {
102
- let content: string
103
- if (format === `json`) content = exports.structure_to_json_str(structure)
104
- else if (format === `xyz`) content = exports.structure_to_xyz_str(structure)
105
- else if (format === `cif`) content = exports.structure_to_cif_str(structure)
106
- else if (format === `poscar`) {
107
- content = exports.structure_to_poscar_str(structure)
108
- } else throw new Error(`Invalid format: ${format}`)
109
-
110
- await navigator.clipboard.writeText(content)
111
-
112
- // Show temporary feedback in button text
113
- copy_status[format] = true
114
- setTimeout(() => {
115
- copy_status[format] = false
116
- }, 1000)
79
+ return exports.STRUCT_TEXT_FORMATS[format].to_str(structure)
117
80
  } catch (error) {
118
81
  console.error(`Failed to copy ${format.toUpperCase()} to clipboard`, error)
82
+ return null
119
83
  }
120
84
  }
121
85
 
@@ -124,7 +88,6 @@
124
88
  console.warn(`No scene available for ${format.toUpperCase()} export`)
125
89
  return
126
90
  }
127
-
128
91
  try {
129
92
  if (format === `glb`) exports.export_structure_as_glb(scene, structure)
130
93
  else if (format === `obj`) exports.export_structure_as_obj(scene, structure)
@@ -135,118 +98,53 @@
135
98
 
136
99
  let has_canvas = $state(false)
137
100
 
138
- $effect(() => {
139
- if (!wrapper) {
140
- has_canvas = false
141
- return
142
- }
143
- const check = () => (has_canvas = Boolean(wrapper.querySelector(`canvas`)))
144
- check()
145
- const observer = new MutationObserver(check)
146
- observer.observe(wrapper, { childList: true, subtree: true })
147
- return () => observer.disconnect()
148
- })
101
+ $effect(() => observe_canvas_presence(wrapper, (val) => (has_canvas = val)))
102
+
103
+ const sections = $derived<ExportSection[]>([
104
+ {
105
+ title: `Export as text`,
106
+ items: text_export_formats.map(({ label, format, hint }) => ({
107
+ label,
108
+ hint,
109
+ disabled: !structure,
110
+ on_download: () => structure && exports.export_structure_as(format, structure),
111
+ copy_text: () => get_text_content(format),
112
+ })),
113
+ },
114
+ {
115
+ title: `Export as image`,
116
+ items: [{
117
+ label: `PNG`,
118
+ disabled: !has_canvas,
119
+ show_dpi: true,
120
+ on_download: () => {
121
+ const canvas = wrapper?.querySelector(`canvas`)
122
+ if (canvas) export_canvas_as_png(canvas, structure, png_dpi, scene, camera)
123
+ else console.warn(`Canvas element not found for PNG export`)
124
+ },
125
+ }],
126
+ },
127
+ {
128
+ title: `Export as 3D model`,
129
+ items: model_3d_formats.map(({ label, format, hint }) => ({
130
+ label,
131
+ hint,
132
+ disabled: !scene,
133
+ on_download: () => handle_3d_export(format),
134
+ })),
135
+ },
136
+ ])
149
137
  </script>
150
138
 
151
- <DraggablePane
152
- bind:show={export_pane_open}
153
- open_icon="Cross"
154
- closed_icon="Export"
155
- pane_props={{ ...pane_props, class: `export-pane ${pane_props?.class ?? ``}` }}
139
+ <ExportPane
140
+ bind:export_pane_open
141
+ bind:png_dpi
142
+ {sections}
143
+ {pane_props}
156
144
  toggle_props={{
157
145
  title: export_pane_open ? `` : `Export Structure`,
158
146
  ...toggle_props,
159
147
  class: `structure-export-toggle ${toggle_props?.class ?? ``}`,
160
148
  }}
161
149
  {...rest}
162
- >
163
- <h4 id="export-as-text">Export as text</h4>
164
- <div class="export-buttons">
165
- {#each text_export_formats as { label, format, hint } (format)}
166
- <div style="display: flex; align-items: center; gap: 4pt">
167
- <span {@attach tooltip({ allow_html: true, content: sanitize_html(hint) })}>{label}</span>
168
- <button
169
- type="button"
170
- onclick={() => export_structure(format)}
171
- title="Download {label}"
172
- >
173
-
174
- </button>
175
- <button
176
- type="button"
177
- onclick={() => handle_copy(format)}
178
- title="Copy {label} to clipboard"
179
- >
180
- {copy_status[format] ? copy_confirm : `📋`}
181
- </button>
182
- </div>
183
- {/each}
184
- </div>
185
-
186
- <h4 id="export-as-image">Export as image</h4>
187
- <div class="export-buttons">
188
- <label>
189
- PNG
190
- <button
191
- type="button"
192
- disabled={!has_canvas}
193
- onclick={() => {
194
- const canvas = wrapper?.querySelector(`canvas`) as HTMLCanvasElement
195
- if (canvas) {
196
- export_canvas_as_png(
197
- canvas,
198
- structure,
199
- png_dpi,
200
- scene,
201
- camera,
202
- )
203
- } else console.warn(`Canvas element not found for PNG export`)
204
- }}
205
- title="PNG ({png_dpi} DPI)"
206
- >
207
-
208
- </button>
209
- &nbsp;(DPI: <input
210
- type="number"
211
- min={50}
212
- max={500}
213
- bind:value={png_dpi}
214
- title="Export resolution in dots per inch"
215
- style="margin: 0 0 0 2pt"
216
- />)
217
- </label>
218
- </div>
219
-
220
- <h4 id="export-as-3d-model">Export as 3D model</h4>
221
- <div class="export-buttons">
222
- {#each model_3d_formats as { label, format, hint } (format)}
223
- <div style="display: flex; align-items: center; gap: 4pt">
224
- <span {@attach tooltip({ content: hint })}>{label}</span>
225
- <button
226
- type="button"
227
- onclick={() => handle_3d_export(format)}
228
- disabled={!scene}
229
- title="Download {label}"
230
- >
231
-
232
- </button>
233
- </div>
234
- {/each}
235
- </div>
236
- </DraggablePane>
237
-
238
- <style>
239
- .export-buttons {
240
- display: flex;
241
- flex-wrap: wrap;
242
- gap: 9pt;
243
- font-size: 0.95em;
244
- }
245
- .export-buttons button {
246
- min-width: 1.9em;
247
- height: 1.6em;
248
- padding: 0 4pt;
249
- margin: 0 0 0 4pt;
250
- box-sizing: border-box;
251
- }
252
- </style>
150
+ />
@@ -1,6 +1,5 @@
1
+ import type { PaneProps, PaneToggleProps } from '../overlays';
1
2
  import type { AnyStructure } from './';
2
- import DraggablePane from '../overlays/DraggablePane.svelte';
3
- import type { ComponentProps } from 'svelte';
4
3
  import type { Camera, Scene } from 'three';
5
4
  type $$ComponentProps = {
6
5
  export_pane_open?: boolean;
@@ -9,9 +8,9 @@ type $$ComponentProps = {
9
8
  scene?: Scene;
10
9
  camera?: Camera;
11
10
  png_dpi?: number;
12
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
13
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
11
+ pane_props?: PaneProps;
12
+ toggle_props?: PaneToggleProps;
14
13
  };
15
- declare const StructureExportPane: import("svelte").Component<$$ComponentProps, {}, "png_dpi" | "export_pane_open">;
14
+ declare const StructureExportPane: import("svelte").Component<$$ComponentProps, {}, "export_pane_open" | "png_dpi">;
16
15
  type StructureExportPane = ReturnType<typeof StructureExportPane>;
17
16
  export default StructureExportPane;
@@ -1,9 +1,11 @@
1
1
  <script lang="ts">
2
+ import type { PaneProps, PaneToggleProps } from '../overlays'
2
3
  import { get_electro_neg_formula } from '../composition'
3
4
  import { element_data, type ElementSymbol } from '../element'
4
5
  import Icon from '../Icon.svelte'
5
6
  import { format_num } from '../labels'
6
7
  import type { InfoItem } from '../layout'
8
+ import type { Vec2 } from '../math'
7
9
  import CopyButton from '../overlays/CopyButton.svelte'
8
10
  import DraggablePane from '../overlays/DraggablePane.svelte'
9
11
  import { sanitize_html } from '../sanitize'
@@ -75,9 +77,9 @@
75
77
  }: Omit<HTMLAttributes<HTMLDivElement>, `onclose`> & {
76
78
  structure: AnyStructure
77
79
  pane_open?: boolean
78
- atom_count_thresholds?: [number, number] // if atom count is less than min_threshold, show sites, if atom count is greater than max_threshold, hide sites. in between, show sites behind a toggle button.
79
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`]
80
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`]
80
+ atom_count_thresholds?: Vec2 // if atom count is less than min_threshold, show sites, if atom count is greater than max_threshold, hide sites. in between, show sites behind a toggle button.
81
+ toggle_props?: PaneToggleProps
82
+ pane_props?: PaneProps
81
83
  highlighted_sites?: number[] // Sites highlighted from Wyckoff table hover
82
84
  hovered_site_idx?: number | null // Site hovered in this pane or in the 3D scene
83
85
  selected_sites?: number[] // Sites selected from Wyckoff table click
@@ -1,14 +1,14 @@
1
- import DraggablePane from '../overlays/DraggablePane.svelte';
1
+ import type { PaneProps, PaneToggleProps } from '../overlays';
2
+ import type { Vec2 } from '../math';
2
3
  import type { AnyStructure } from './';
3
4
  import type { MoyoDataset } from '@spglib/moyo-wasm';
4
- import type { ComponentProps } from 'svelte';
5
5
  import type { HTMLAttributes } from 'svelte/elements';
6
6
  type $$ComponentProps = Omit<HTMLAttributes<HTMLDivElement>, `onclose`> & {
7
7
  structure: AnyStructure;
8
8
  pane_open?: boolean;
9
- atom_count_thresholds?: [number, number];
10
- toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
11
- pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
9
+ atom_count_thresholds?: Vec2;
10
+ toggle_props?: PaneToggleProps;
11
+ pane_props?: PaneProps;
12
12
  highlighted_sites?: number[];
13
13
  hovered_site_idx?: number | null;
14
14
  selected_sites?: number[];