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.
- package/dist/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +75 -85
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
- package/dist/brillouin/BrillouinZoneScene.svelte +26 -39
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +62 -74
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +511 -547
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +92 -95
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +1 -1
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -2
- package/dist/composition/parse.js +11 -10
- package/dist/constants.js +11 -9
- package/dist/convex-hull/ConvexHull.svelte +12 -15
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +93 -92
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +109 -140
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +75 -94
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
- package/dist/convex-hull/ConvexHullControls.svelte +46 -48
- package/dist/convex-hull/ConvexHullStats.svelte +193 -195
- package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +36 -36
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +18 -17
- package/dist/coordination/CoordinationBarPlot.svelte +38 -33
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +5 -8
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +24 -29
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -4
- package/dist/element/index.js +3 -18
- package/dist/feedback/DragOverlay.svelte +5 -5
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
- package/dist/feedback/StatusMessage.svelte +7 -4
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +14 -22
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -7
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +37 -64
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +3 -3
- package/dist/fermi-surface/parse.js +22 -24
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +109 -148
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/index.d.ts +5 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/io/ExportPane.svelte +10 -6
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -35
- package/dist/io/export.d.ts +4 -0
- package/dist/io/export.js +5 -1
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/index.d.ts +0 -1
- package/dist/io/index.js +2 -9
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +6 -6
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +43 -13
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +7 -18
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +9 -10
- package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.js +1 -2
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +2 -0
- package/dist/math.js +19 -0
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +113 -145
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +430 -391
- package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
- package/dist/plot/bar/SpacegroupBarPlot.svelte +29 -36
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +301 -209
- package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
- package/dist/plot/box/Violin.svelte.d.ts +1 -0
- package/dist/plot/box/box-plot.js +1 -1
- package/dist/plot/core/auto-place.js +1 -1
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +101 -106
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +18 -9
- package/dist/plot/core/components/Line.svelte.d.ts +2 -0
- package/dist/plot/core/components/PlotAxis.svelte +40 -17
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
- package/dist/plot/core/components/ReferencePlane.svelte +7 -8
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +27 -474
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +3 -1
- package/dist/plot/core/fill-utils.js +28 -6
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.js +0 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/reference-line.js +1 -1
- package/dist/plot/core/scales.d.ts +23 -0
- package/dist/plot/core/scales.js +39 -13
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +304 -325
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +78 -69
- package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/scatter/BinnedScatterPlot.svelte +263 -109
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +477 -385
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
- package/dist/plot/sunburst/Sunburst.svelte +251 -329
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +10 -3
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- package/dist/sanitize.js +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +77 -50
- package/dist/spectral/Bands.svelte +223 -230
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -27
- package/dist/spectral/Dos.svelte +70 -73
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +25 -35
- package/dist/state.svelte.js +5 -18
- package/dist/structure/Arrow.svelte +5 -18
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +11 -26
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +473 -419
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +157 -399
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +72 -66
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +467 -476
- package/dist/structure/StructureScene.svelte.d.ts +3 -1
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +16 -12
- package/dist/structure/atom-label-placement.js +70 -37
- package/dist/structure/atom-properties.d.ts +2 -0
- package/dist/structure/atom-properties.js +104 -38
- package/dist/structure/bonding.d.ts +10 -3
- package/dist/structure/bonding.js +84 -28
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +1 -0
- package/dist/structure/export.js +39 -31
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +16 -1
- package/dist/structure/index.js +13 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +2 -1
- package/dist/structure/parse.js +243 -222
- package/dist/structure/partial-occupancy.js +4 -2
- package/dist/structure/pbc.js +78 -98
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +3 -18
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +7 -13
- package/dist/symmetry/SymmetryElements.svelte +11 -15
- package/dist/symmetry/SymmetryStats.svelte +56 -68
- package/dist/symmetry/WyckoffTable.svelte +5 -24
- package/dist/symmetry/cell-transform.js +1 -0
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +8 -2
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1102 -365
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +515 -308
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -31
- package/dist/trajectory/TrajectoryInfoPane.svelte +85 -97
- package/dist/trajectory/extract.js +56 -34
- package/dist/trajectory/format-detect.js +11 -9
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +33 -29
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +18 -7
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +2 -3
- package/dist/trajectory/parse/index.js +17 -20
- package/dist/trajectory/parse/lammps.js +8 -12
- package/dist/trajectory/parse/vasp.js +10 -7
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.js +11 -7
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +99 -27
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +47 -61
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +2 -4
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +61 -33
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
|
@@ -17,6 +17,6 @@ type $$ComponentProps = {
|
|
|
17
17
|
controls_open?: boolean;
|
|
18
18
|
export_pane_open?: boolean;
|
|
19
19
|
};
|
|
20
|
-
declare const ChemPotDiagram3D: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "
|
|
20
|
+
declare const ChemPotDiagram3D: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "fullscreen" | "wrapper" | "controls_open" | "export_pane_open" | "temperature" | "hover_info">;
|
|
21
21
|
type ChemPotDiagram3D = ReturnType<typeof ChemPotDiagram3D>;
|
|
22
22
|
export default ChemPotDiagram3D;
|
|
@@ -68,7 +68,7 @@ export function compute_chempot_async(entries, config = {}) {
|
|
|
68
68
|
pending.set(id, { resolve, reject });
|
|
69
69
|
try {
|
|
70
70
|
// $state.snapshot strips Svelte $state proxies (not structured-cloneable)
|
|
71
|
-
//
|
|
71
|
+
// oxlint-disable-next-line unicorn/require-post-message-target-origin
|
|
72
72
|
wkr.postMessage($state.snapshot({ id, entries, config }));
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
@@ -13,7 +13,7 @@ export function create_chempot_overrides(config, keys, custom_defaults = {}) {
|
|
|
13
13
|
}));
|
|
14
14
|
let overrides = $state({});
|
|
15
15
|
return {
|
|
16
|
-
resolve: (key) =>
|
|
16
|
+
resolve: (key) => overrides[key] ?? config()[key] ?? defaults[key],
|
|
17
17
|
set: (key, value) => {
|
|
18
18
|
overrides[key] = value;
|
|
19
19
|
},
|
package/dist/colors/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as d3_sc from 'd3-scale-chromatic';
|
|
2
|
-
import type { Vec3 } from '../math';
|
|
3
|
-
import type { ELEM_SYMBOLS } from '../labels';
|
|
4
2
|
export type D3InterpolateName = keyof typeof d3_sc & `interpolate${string}`;
|
|
5
3
|
export type D3ColorSchemeName = D3InterpolateName extends `interpolate${infer Name}` ? Name : never;
|
|
6
4
|
export declare const get_d3_interpolator: (name: D3InterpolateName) => ((t: number) => string);
|
|
@@ -9,8 +7,6 @@ export type ColorScaleType = (typeof COLOR_SCALE_TYPES)[number];
|
|
|
9
7
|
export declare const DEFAULT_CATEGORY_COLORS: Record<string, string>;
|
|
10
8
|
export declare const AXIS_COLORS: readonly [readonly ["x", "#d75555", "#e66666"], readonly ["y", "#55b855", "#66c966"], readonly ["z", "#5555d7", "#6666e6"]];
|
|
11
9
|
export declare const NEG_AXIS_COLORS: readonly [readonly ["nx", "#b84444", "#cc5555"], readonly ["ny", "#44a044", "#55b155"], readonly ["nz", "#4444b8", "#5555c9"]];
|
|
12
|
-
export type RGBColor = Vec3;
|
|
13
|
-
export type ElementColorScheme = Record<(typeof ELEM_SYMBOLS)[number], RGBColor>;
|
|
14
10
|
export declare const vesta_hex: Record<string, string>;
|
|
15
11
|
export declare const jmol_hex: Record<string, string>;
|
|
16
12
|
export declare const alloy_hex: Record<string, string>;
|
package/dist/colors/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { color as d3_color, rgb } from 'd3-color';
|
|
2
2
|
import * as d3_sc from 'd3-scale-chromatic';
|
|
3
|
+
import { COLOR_THEMES, get_system_mode, get_theme_preference, is_valid_theme_name, resolve_theme_mode, THEME_STORAGE_KEY, THEME_TYPE, } from '../theme';
|
|
4
|
+
import { clamp01 } from '../utils';
|
|
3
5
|
import alloy_colors from './alloy-colors.json' with { type: 'json' };
|
|
4
6
|
import dark_mode_colors from './dark-mode-colors.json' with { type: 'json' };
|
|
5
7
|
import jmol_colors from './jmol-colors.json' with { type: 'json' };
|
|
@@ -82,16 +84,17 @@ export function luminance(clr) {
|
|
|
82
84
|
const { r: red, g: green, b: blue } = rgb(clr);
|
|
83
85
|
return (0.299 * red + 0.587 * green + 0.114 * blue) / 255; // https://stackoverflow.com/a/596243
|
|
84
86
|
}
|
|
87
|
+
// CSS color string for a fully transparent background
|
|
88
|
+
const NO_BG = `rgba(0, 0, 0, 0)`;
|
|
85
89
|
// get background color of passed DOM node, or recurse up the DOM tree if current node is transparent
|
|
86
90
|
export function get_bg_color(elem, bg_color = null) {
|
|
87
91
|
if (bg_color)
|
|
88
92
|
return bg_color;
|
|
89
93
|
// recurse up the DOM tree to find the first non-transparent background color
|
|
90
|
-
const transparent = `rgba(0, 0, 0, 0)`;
|
|
91
94
|
if (!elem)
|
|
92
|
-
return
|
|
95
|
+
return NO_BG; // if no DOM node, return transparent
|
|
93
96
|
const bg = getComputedStyle(elem).backgroundColor; // get node background color
|
|
94
|
-
if (bg !==
|
|
97
|
+
if (bg !== NO_BG)
|
|
95
98
|
return bg; // if not transparent, return it
|
|
96
99
|
return get_bg_color(elem.parentElement); // otherwise recurse up the DOM tree
|
|
97
100
|
}
|
|
@@ -104,7 +107,7 @@ export function pick_contrast_color(options = {}) {
|
|
|
104
107
|
export const contrast_color = (options = {}) => (node) => {
|
|
105
108
|
node.style.color = pick_contrast_color({ ...options, bg_color: get_bg_color(node) });
|
|
106
109
|
};
|
|
107
|
-
const is_valid_bg = (bg) => bg !== `` && bg !==
|
|
110
|
+
const is_valid_bg = (bg) => bg !== `` && bg !== NO_BG && bg !== `transparent`;
|
|
108
111
|
// Detect and return the page background color from html/body elements or user preferences
|
|
109
112
|
export function get_page_background(fallback_dark = `#1a1a1a`, fallback_light = `#ffffff`) {
|
|
110
113
|
if (typeof window === `undefined`)
|
|
@@ -119,25 +122,21 @@ export function get_page_background(fallback_dark = `#1a1a1a`, fallback_light =
|
|
|
119
122
|
if (is_valid_bg(html_bg))
|
|
120
123
|
return html_bg;
|
|
121
124
|
// Fall back to prefers-color-scheme
|
|
122
|
-
const prefers_dark = globalThis.matchMedia(`(prefers-color-scheme: dark)`)
|
|
125
|
+
const prefers_dark = globalThis.matchMedia?.(`(prefers-color-scheme: dark)`)?.matches;
|
|
123
126
|
return prefers_dark ? fallback_dark : fallback_light;
|
|
124
127
|
}
|
|
125
|
-
// Detect dark mode: checks data-theme attribute,
|
|
128
|
+
// Detect dark mode: checks data-theme attribute, then the persisted theme
|
|
129
|
+
// preference (resolving `auto` against the OS), then falls back to OS preference.
|
|
126
130
|
export function is_dark_mode() {
|
|
127
131
|
if (typeof document === `undefined`)
|
|
128
132
|
return false;
|
|
133
|
+
// Prefer the resolved theme name on data-theme (light/dark/white/black), else
|
|
134
|
+
// fall back to the persisted preference (resolving `auto` against the OS)
|
|
129
135
|
const data_theme = document.documentElement.dataset.theme;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (stored === `dark` || stored === `light`)
|
|
135
|
-
return stored === `dark`;
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
/* localStorage throws in private browsing mode */
|
|
139
|
-
}
|
|
140
|
-
return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches ?? false;
|
|
136
|
+
const theme_name = data_theme && is_valid_theme_name(data_theme)
|
|
137
|
+
? data_theme
|
|
138
|
+
: resolve_theme_mode(get_theme_preference(), get_system_mode());
|
|
139
|
+
return THEME_TYPE[theme_name] === COLOR_THEMES.dark;
|
|
141
140
|
}
|
|
142
141
|
// Watch for dark mode changes and call callback on each change. Returns cleanup function.
|
|
143
142
|
export function watch_dark_mode(on_change) {
|
|
@@ -149,8 +148,8 @@ export function watch_dark_mode(on_change) {
|
|
|
149
148
|
attributes: true,
|
|
150
149
|
attributeFilter: [`data-theme`],
|
|
151
150
|
});
|
|
152
|
-
const on_storage = (
|
|
153
|
-
if (
|
|
151
|
+
const on_storage = (event) => {
|
|
152
|
+
if (event.key === THEME_STORAGE_KEY)
|
|
154
153
|
notify();
|
|
155
154
|
};
|
|
156
155
|
globalThis.addEventListener(`storage`, on_storage);
|
|
@@ -178,7 +177,7 @@ export function css_color_to_hex(color, fallback) {
|
|
|
178
177
|
// Returns the color in rgba() format, or the original color if format is unsupported.
|
|
179
178
|
export function add_alpha(color, alpha) {
|
|
180
179
|
// Clamp alpha to valid CSS range [0, 1]
|
|
181
|
-
const clamped_alpha =
|
|
180
|
+
const clamped_alpha = clamp01(alpha);
|
|
182
181
|
// Handle hex colors (#rgb, #rgba, #rrggbb, #rrggbbaa)
|
|
183
182
|
if (color.startsWith(`#`)) {
|
|
184
183
|
const hex = color.slice(1);
|
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
import { format_num } from '../labels'
|
|
7
7
|
import type { Snippet } from 'svelte'
|
|
8
8
|
import type { SVGAttributes } from 'svelte/elements'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
chart_segment_label,
|
|
11
|
+
chart_segment_suffix,
|
|
12
|
+
type ChartSegmentData,
|
|
13
|
+
get_chart_font_scale,
|
|
14
|
+
} from './index'
|
|
10
15
|
import { fractional_composition } from './parse'
|
|
11
16
|
|
|
12
17
|
type BarSegmentData = ChartSegmentData & {
|
|
@@ -66,13 +71,11 @@
|
|
|
66
71
|
let svg_height = $derived(label_height + gap + bar_height + gap + label_height)
|
|
67
72
|
let bar_y = $derived(label_height + gap)
|
|
68
73
|
let above_labels_y = $derived(label_height / 2)
|
|
69
|
-
let below_labels_y = $derived(
|
|
70
|
-
label_height + gap + bar_height + gap + label_height / 2,
|
|
71
|
-
)
|
|
74
|
+
let below_labels_y = $derived(label_height + gap + bar_height + gap + label_height / 2)
|
|
72
75
|
|
|
73
76
|
let segments = $derived.by(() => {
|
|
74
|
-
const element_entries = Object.entries(composition).filter(
|
|
75
|
-
amount && amount > 0
|
|
77
|
+
const element_entries = Object.entries(composition).filter(
|
|
78
|
+
([_, amount]) => amount && amount > 0,
|
|
76
79
|
) as [ElementSymbol, number][]
|
|
77
80
|
if (element_entries.length === 0) return []
|
|
78
81
|
|
|
@@ -87,8 +90,13 @@
|
|
|
87
90
|
|
|
88
91
|
const segment_size = Math.min(width, size)
|
|
89
92
|
const base_scale = Math.min(2, Math.max(1, segment_size / 40))
|
|
90
|
-
const label_text =
|
|
91
|
-
|
|
93
|
+
const label_text = chart_segment_label(
|
|
94
|
+
element,
|
|
95
|
+
amount,
|
|
96
|
+
fraction,
|
|
97
|
+
show_amounts,
|
|
98
|
+
show_percentages,
|
|
99
|
+
)
|
|
92
100
|
const font_scale = get_chart_font_scale(
|
|
93
101
|
base_scale,
|
|
94
102
|
label_text,
|
|
@@ -135,9 +143,7 @@
|
|
|
135
143
|
</tspan>
|
|
136
144
|
{#if show_amounts || show_percentages}
|
|
137
145
|
<tspan class="amount" style:font-size="{6.5 * segment.font_scale}px" dx="1" dy="5">
|
|
138
|
-
{
|
|
139
|
-
show_percentages ? format_num(segment.fraction, `.1~%`) : ``
|
|
140
|
-
}
|
|
146
|
+
{chart_segment_suffix(segment.amount, segment.fraction, show_amounts, show_percentages)}
|
|
141
147
|
</tspan>
|
|
142
148
|
{/if}
|
|
143
149
|
{/snippet}
|
|
@@ -145,7 +151,7 @@
|
|
|
145
151
|
<svg
|
|
146
152
|
viewBox="0 0 {size} {svg_height}"
|
|
147
153
|
{...rest}
|
|
148
|
-
class=
|
|
154
|
+
class={[`bar-chart`, rest.class]}
|
|
149
155
|
style:max-width="{size}px"
|
|
150
156
|
bind:this={svg_node}
|
|
151
157
|
>
|
|
@@ -161,8 +167,7 @@
|
|
|
161
167
|
|
|
162
168
|
<!-- External labels above -->
|
|
163
169
|
{#each segments as segment (segment.element)}
|
|
164
|
-
{#if show_labels && segment.needs_external_label &&
|
|
165
|
-
segment.external_label_position === `above`}
|
|
170
|
+
{#if show_labels && segment.needs_external_label && segment.external_label_position === `above`}
|
|
166
171
|
<text
|
|
167
172
|
x={segment.label_x}
|
|
168
173
|
y={above_labels_y}
|
|
@@ -205,20 +210,19 @@
|
|
|
205
210
|
class:hovered={hovered_element === segment.element}
|
|
206
211
|
onmouseenter={() => interactive && (hovered_element = segment.element)}
|
|
207
212
|
onmouseleave={() => interactive && (hovered_element = null)}
|
|
208
|
-
{...
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
{...interactive
|
|
214
|
+
? {
|
|
215
|
+
role: `button`,
|
|
216
|
+
tabindex: 0,
|
|
217
|
+
'aria-label': `${segment.element}: ${segment.amount} ${
|
|
218
|
+
segment.amount === 1 ? `atom` : `atoms`
|
|
219
|
+
} (${format_num(segment.fraction, `.1~%`)})`,
|
|
220
|
+
}
|
|
221
|
+
: {}}
|
|
217
222
|
>
|
|
218
223
|
<title>
|
|
219
|
-
{segment.element}: {segment.amount}
|
|
220
|
-
|
|
221
|
-
})
|
|
224
|
+
{segment.element}: {segment.amount}
|
|
225
|
+
{segment.amount === 1 ? `atom` : `atoms`} ({format_num(segment.fraction, `.1~%`)})
|
|
222
226
|
</title>
|
|
223
227
|
</rect>
|
|
224
228
|
{#if segment_content}
|
|
@@ -245,8 +249,7 @@
|
|
|
245
249
|
|
|
246
250
|
<!-- External labels below -->
|
|
247
251
|
{#each segments as segment (segment.element)}
|
|
248
|
-
{#if show_labels && segment.needs_external_label &&
|
|
249
|
-
segment.external_label_position === `below`}
|
|
252
|
+
{#if show_labels && segment.needs_external_label && segment.external_label_position === `below`}
|
|
250
253
|
<text
|
|
251
254
|
x={segment.label_x}
|
|
252
255
|
y={below_labels_y}
|
|
@@ -274,18 +277,21 @@
|
|
|
274
277
|
.bar-segment.interactive {
|
|
275
278
|
cursor: pointer;
|
|
276
279
|
}
|
|
277
|
-
.bar-segment.interactive:hover,
|
|
280
|
+
.bar-segment.interactive:hover,
|
|
281
|
+
.bar-segment.hovered {
|
|
278
282
|
filter: brightness(1.1);
|
|
279
283
|
}
|
|
280
284
|
.bar-segment.interactive:focus {
|
|
281
285
|
outline: 2px solid var(--focus-color, #0066cc);
|
|
282
286
|
outline-offset: 2px;
|
|
283
287
|
}
|
|
284
|
-
.external-label,
|
|
288
|
+
.external-label,
|
|
289
|
+
.bar-label {
|
|
285
290
|
transition: all 0.2s ease;
|
|
286
291
|
pointer-events: none;
|
|
287
292
|
}
|
|
288
|
-
.external-label.hovered,
|
|
293
|
+
.external-label.hovered,
|
|
294
|
+
.bar-label.hovered {
|
|
289
295
|
font-weight: 700;
|
|
290
296
|
}
|
|
291
297
|
.element-symbol {
|
|
@@ -60,14 +60,13 @@
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Use D3's pack layout for proper circle packing
|
|
63
|
-
const pack_layout = pack<HierarchyData | Child>()
|
|
64
|
-
size - 2 * padding,
|
|
65
|
-
|
|
66
|
-
]).padding(padding * 0.1) // Small padding between circles
|
|
63
|
+
const pack_layout = pack<HierarchyData | Child>()
|
|
64
|
+
.size([size - 2 * padding, size - 2 * padding])
|
|
65
|
+
.padding(padding * 0.1) // Small padding between circles
|
|
67
66
|
|
|
68
67
|
const root = pack_layout(
|
|
69
|
-
hierarchy<HierarchyData | Child>(hierarchy_data).sum(
|
|
70
|
-
|
|
68
|
+
hierarchy<HierarchyData | Child>(hierarchy_data).sum((data) =>
|
|
69
|
+
`amount` in data ? data.amount : 0,
|
|
71
70
|
),
|
|
72
71
|
)
|
|
73
72
|
|
|
@@ -82,8 +81,7 @@
|
|
|
82
81
|
// Calculate font scale based on bubble size and smart text fitting
|
|
83
82
|
const [min_font_scale, max_font_scale] = [0.6, 2] as const
|
|
84
83
|
const scale_factor = radius / max_radius
|
|
85
|
-
const base_scale = min_font_scale +
|
|
86
|
-
scale_factor * (max_font_scale - min_font_scale)
|
|
84
|
+
const base_scale = min_font_scale + scale_factor * (max_font_scale - min_font_scale)
|
|
87
85
|
const label_text = data.element + (show_amounts ? data.amount.toString() : ``)
|
|
88
86
|
const available_space = radius * 2 * 0.8 // 80% of bubble diameter for text
|
|
89
87
|
const font_scale = get_chart_font_scale(base_scale, label_text, available_space)
|
|
@@ -109,7 +107,7 @@
|
|
|
109
107
|
viewBox="0 0 {size} {size}"
|
|
110
108
|
style:max-width="{size}px"
|
|
111
109
|
{...rest}
|
|
112
|
-
class=
|
|
110
|
+
class={[`bubble-chart`, rest.class]}
|
|
113
111
|
bind:this={svg_node}
|
|
114
112
|
>
|
|
115
113
|
{#each bubbles as bubble (bubble.element)}
|
|
@@ -134,7 +132,8 @@
|
|
|
134
132
|
}}
|
|
135
133
|
>
|
|
136
134
|
<title>
|
|
137
|
-
{bubble.element}: {bubble.amount}
|
|
135
|
+
{bubble.element}: {bubble.amount}
|
|
136
|
+
{bubble.amount === 1 ? `atom` : `atoms`}
|
|
138
137
|
</title>
|
|
139
138
|
</circle>
|
|
140
139
|
|
|
@@ -154,13 +153,13 @@
|
|
|
154
153
|
class:hovered={hovered_element === bubble.element}
|
|
155
154
|
>
|
|
156
155
|
<div class="bubble-label" style:color={bubble.text_color}>
|
|
157
|
-
<span class="element-symbol" style:font-size="{14 * bubble.font_scale}px"
|
|
158
|
-
bubble.element
|
|
159
|
-
|
|
156
|
+
<span class="element-symbol" style:font-size="{14 * bubble.font_scale}px"
|
|
157
|
+
>{bubble.element}</span
|
|
158
|
+
>
|
|
160
159
|
{#if show_amounts}
|
|
161
|
-
<sub class="amount" style:font-size="{8 * bubble.font_scale}px"
|
|
162
|
-
bubble.amount
|
|
163
|
-
|
|
160
|
+
<sub class="amount" style:font-size="{8 * bubble.font_scale}px"
|
|
161
|
+
>{bubble.amount}</sub
|
|
162
|
+
>
|
|
164
163
|
{/if}
|
|
165
164
|
</div>
|
|
166
165
|
</foreignObject>
|
|
@@ -177,7 +176,8 @@
|
|
|
177
176
|
.bubble.interactive {
|
|
178
177
|
cursor: pointer;
|
|
179
178
|
}
|
|
180
|
-
.bubble.interactive:hover,
|
|
179
|
+
.bubble.interactive:hover,
|
|
180
|
+
.bubble.hovered {
|
|
181
181
|
filter: brightness(1.1);
|
|
182
182
|
}
|
|
183
183
|
.bubble.interactive:focus {
|
|
@@ -30,9 +30,7 @@
|
|
|
30
30
|
let current_mode = $state(untrack(() => mode))
|
|
31
31
|
let svg_node = $state<SVGSVGElement | null>(null)
|
|
32
32
|
|
|
33
|
-
let Component = $derived(
|
|
34
|
-
{ pie: PieChart, bubble: BubbleChart, bar: BarChart }[current_mode],
|
|
35
|
-
)
|
|
33
|
+
let Component = $derived({ pie: PieChart, bubble: BubbleChart, bar: BarChart }[current_mode])
|
|
36
34
|
let parsed: CompositionType = $derived.by(() => {
|
|
37
35
|
try {
|
|
38
36
|
return parse_composition(composition)
|
|
@@ -46,13 +44,14 @@
|
|
|
46
44
|
|
|
47
45
|
let context_menu = $state({ open: false, x: 0, y: 0 })
|
|
48
46
|
|
|
49
|
-
function handle_right_click(event: MouseEvent) {
|
|
47
|
+
function handle_right_click(event: MouseEvent) {
|
|
48
|
+
// open context menu
|
|
50
49
|
event.preventDefault()
|
|
51
50
|
context_menu.open = false // Close any existing context menu first
|
|
52
51
|
context_menu.x = event.pageX
|
|
53
52
|
context_menu.y = event.pageY
|
|
54
53
|
// Use a small delay to ensure the prev context menu closes happens before opening new one
|
|
55
|
-
setTimeout(() => context_menu.open = true, 0)
|
|
54
|
+
setTimeout(() => (context_menu.open = true), 0)
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
const mode_options = [
|
|
@@ -89,10 +88,7 @@
|
|
|
89
88
|
{ title: sec_titles.export, options: export_options },
|
|
90
89
|
] as const
|
|
91
90
|
|
|
92
|
-
function handle_context_menu_select(
|
|
93
|
-
section_title: string,
|
|
94
|
-
option: { value: string },
|
|
95
|
-
) {
|
|
91
|
+
function handle_context_menu_select(section_title: string, option: { value: string }) {
|
|
96
92
|
if (section_title === sec_titles.display_mode) {
|
|
97
93
|
current_mode = option.value as CompositionChartMode
|
|
98
94
|
} else if (section_title === sec_titles.color_scheme) {
|
|
@@ -147,7 +143,7 @@
|
|
|
147
143
|
aria-haspopup="menu"
|
|
148
144
|
aria-expanded={context_menu.open}
|
|
149
145
|
{...rest}
|
|
150
|
-
class=
|
|
146
|
+
class={[`composition`, rest.class]}
|
|
151
147
|
/>
|
|
152
148
|
|
|
153
149
|
{#if context_menu.open}
|
|
@@ -160,6 +156,6 @@
|
|
|
160
156
|
on_select={handle_context_menu_select}
|
|
161
157
|
position={context_menu}
|
|
162
158
|
visible={context_menu.open}
|
|
163
|
-
on_close={() => context_menu.open = false}
|
|
159
|
+
on_close={() => (context_menu.open = false)}
|
|
164
160
|
/>
|
|
165
161
|
{/if}
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
import ElementTile from '../element/ElementTile.svelte'
|
|
7
7
|
import { format_num } from '../labels'
|
|
8
8
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
9
|
-
import {
|
|
10
|
-
format_oxi_state,
|
|
11
|
-
sort_by_electronegativity,
|
|
12
|
-
sort_by_hill_notation,
|
|
13
|
-
} from './format'
|
|
9
|
+
import { format_oxi_state, sort_by_electronegativity, sort_by_hill_notation } from './format'
|
|
14
10
|
import type { ElementWithOxidation, OxiComposition } from './parse'
|
|
15
11
|
import { oxi_composition_to_elements, parse_formula_with_oxidation } from './parse'
|
|
16
12
|
|
|
@@ -63,9 +59,7 @@
|
|
|
63
59
|
return sorted[0] === el1.element ? -1 : 1
|
|
64
60
|
},
|
|
65
61
|
}
|
|
66
|
-
const sorted_elements = $derived(
|
|
67
|
-
[...parsed_elements].sort(COMPARATORS[ordering]),
|
|
68
|
-
)
|
|
62
|
+
const sorted_elements = $derived([...parsed_elements].sort(COMPARATORS[ordering]))
|
|
69
63
|
|
|
70
64
|
let hovered_element = $state<ElementSymbol | null>(null)
|
|
71
65
|
let tooltip_pos = $state({ x: 0, y: 0 })
|
|
@@ -97,7 +91,8 @@
|
|
|
97
91
|
if (
|
|
98
92
|
!formula_el.contains(selection.anchorNode) ||
|
|
99
93
|
!formula_el.contains(selection.focusNode)
|
|
100
|
-
)
|
|
94
|
+
)
|
|
95
|
+
return // Selection extends outside formula, let browser handle normally
|
|
101
96
|
event.preventDefault()
|
|
102
97
|
event.clipboardData?.setData(`text/plain`, plain_text_formula)
|
|
103
98
|
}
|
|
@@ -106,8 +101,8 @@
|
|
|
106
101
|
element: ElementSymbol,
|
|
107
102
|
event: MouseEvent & { currentTarget: HTMLElement },
|
|
108
103
|
) {
|
|
109
|
-
const { left, width, top, bottom, right, height } =
|
|
110
|
-
.getBoundingClientRect()
|
|
104
|
+
const { left, width, top, bottom, right, height } =
|
|
105
|
+
event.currentTarget.getBoundingClientRect()
|
|
111
106
|
hovered_element = element
|
|
112
107
|
|
|
113
108
|
const positions = {
|
|
@@ -121,12 +116,7 @@
|
|
|
121
116
|
}
|
|
122
117
|
</script>
|
|
123
118
|
|
|
124
|
-
<svelte:element
|
|
125
|
-
this={as}
|
|
126
|
-
{...rest}
|
|
127
|
-
class="formula {rest.class ?? ``}"
|
|
128
|
-
oncopy={handle_copy}
|
|
129
|
-
>
|
|
119
|
+
<svelte:element this={as} {...rest} class={[`formula`, rest.class]} oncopy={handle_copy}>
|
|
130
120
|
{#each sorted_elements as { element, amount, oxidation_state } (element)}
|
|
131
121
|
{@const color = ELEMENT_COLOR_SCHEMES[color_scheme]?.[element] ?? `#666666`}
|
|
132
122
|
{@const lum = luminance(color)}
|
|
@@ -151,14 +141,16 @@
|
|
|
151
141
|
class:light-border={lum < 0.15}
|
|
152
142
|
style:color
|
|
153
143
|
>
|
|
154
|
-
{element}</span
|
|
155
|
-
|
|
144
|
+
{element}</span
|
|
145
|
+
>
|
|
146
|
+
<span class="script-wrapper"
|
|
147
|
+
>{#if has_oxidation}
|
|
156
148
|
<sup class="oxi">{format_oxi_state(oxidation_state)}</sup>
|
|
157
149
|
{/if}
|
|
158
150
|
{#if amount !== 1}
|
|
159
|
-
<sub class="amt" class:no-sup={!has_oxidation}
|
|
160
|
-
format_num(amount, amount_format)
|
|
161
|
-
|
|
151
|
+
<sub class="amt" class:no-sup={!has_oxidation}
|
|
152
|
+
>{format_num(amount, amount_format)}</sub
|
|
153
|
+
>
|
|
162
154
|
{/if}
|
|
163
155
|
</span>
|
|
164
156
|
</span>
|
|
@@ -167,8 +159,8 @@
|
|
|
167
159
|
|
|
168
160
|
{#if hovered_elem_data}
|
|
169
161
|
{@const { x, y } = tooltip_pos}
|
|
170
|
-
{@const tile_color =
|
|
171
|
-
`#666666`}
|
|
162
|
+
{@const tile_color =
|
|
163
|
+
ELEMENT_COLOR_SCHEMES[color_scheme]?.[hovered_elem_data.symbol] ?? `#666666`}
|
|
172
164
|
{@const transforms = {
|
|
173
165
|
top: `translate(-50%, -100%)`,
|
|
174
166
|
bottom: `translateX(-50%)`,
|
|
@@ -250,7 +242,8 @@
|
|
|
250
242
|
.script-wrapper:empty {
|
|
251
243
|
display: none;
|
|
252
244
|
}
|
|
253
|
-
.amt,
|
|
245
|
+
.amt,
|
|
246
|
+
.oxi {
|
|
254
247
|
font-size: var(--formula-script-font-size, 0.7em);
|
|
255
248
|
line-height: var(--formula-script-inner-line-height, 1);
|
|
256
249
|
}
|