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
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
const safe_formula = (comp: string) => sanitize_formula(comp, use_subscripts)
|
|
52
52
|
|
|
53
53
|
// Convert a temperature from data unit to display unit
|
|
54
|
-
const to_display = (temp: number): number =>
|
|
55
|
-
convert_temp(temp, data_unit, temperature_unit)
|
|
54
|
+
const to_display = (temp: number): number => convert_temp(temp, data_unit, temperature_unit)
|
|
56
55
|
|
|
57
56
|
// Convert atomic fraction to weight fraction: wt_B = (x_B * M_B) / (x_A * M_A + x_B * M_B)
|
|
58
57
|
const wt_fraction_b = $derived.by(() => {
|
|
@@ -136,14 +135,8 @@
|
|
|
136
135
|
phase_b: vlr.top_phase,
|
|
137
136
|
fraction_a: vlr.fraction_bottom,
|
|
138
137
|
fraction_b: vlr.fraction_top,
|
|
139
|
-
detail_a: format_temperature(
|
|
140
|
-
|
|
141
|
-
temperature_unit,
|
|
142
|
-
),
|
|
143
|
-
detail_b: format_temperature(
|
|
144
|
-
to_display(vlr.top_temperature),
|
|
145
|
-
temperature_unit,
|
|
146
|
-
),
|
|
138
|
+
detail_a: format_temperature(to_display(vlr.bottom_temperature), temperature_unit),
|
|
139
|
+
detail_b: format_temperature(to_display(vlr.top_temperature), temperature_unit),
|
|
147
140
|
}
|
|
148
141
|
}
|
|
149
142
|
if (lever_rule_mode === `horizontal` && hover_info.lever_rule) {
|
|
@@ -165,10 +158,14 @@
|
|
|
165
158
|
<TooltipContent data={hover_info} snippet_arg={hover_info} {tooltip}>
|
|
166
159
|
<div class="phase-diagram-tooltip">
|
|
167
160
|
<header>
|
|
168
|
-
<strong
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}</
|
|
161
|
+
<strong
|
|
162
|
+
>{@html sanitize_html(
|
|
163
|
+
format_label_html(hover_info.region.name, use_subscripts),
|
|
164
|
+
)}</strong
|
|
165
|
+
>
|
|
166
|
+
{#if special_point_info}<span class="special-point-badge"
|
|
167
|
+
>{special_point_info.badge}</span
|
|
168
|
+
>{/if}
|
|
172
169
|
</header>
|
|
173
170
|
|
|
174
171
|
{#if special_point_info?.description}
|
|
@@ -178,54 +175,51 @@
|
|
|
178
175
|
<dl>
|
|
179
176
|
<dt>Temperature</dt>
|
|
180
177
|
<dd>
|
|
181
|
-
{
|
|
182
|
-
format_temperature(
|
|
183
|
-
to_display(hover_info.temperature),
|
|
184
|
-
temperature_unit,
|
|
185
|
-
)
|
|
186
|
-
}
|
|
178
|
+
{format_temperature(to_display(hover_info.temperature), temperature_unit)}
|
|
187
179
|
{#if temperature_unit !== `°C`}
|
|
188
|
-
<small
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
180
|
+
<small
|
|
181
|
+
>({format_temperature(
|
|
182
|
+
convert_temp(hover_info.temperature, data_unit, `°C`),
|
|
183
|
+
`°C`,
|
|
184
|
+
)})</small
|
|
185
|
+
>
|
|
194
186
|
{/if}
|
|
195
187
|
</dd>
|
|
196
188
|
<dt>Composition</dt>
|
|
197
189
|
<dd>
|
|
198
190
|
{format_composition(hover_info.composition, composition_unit)}
|
|
199
191
|
{@html safe_formula(component_b)}
|
|
200
|
-
<small
|
|
201
|
-
{
|
|
192
|
+
<small
|
|
193
|
+
>({format_composition(1 - hover_info.composition, composition_unit)}
|
|
194
|
+
{@html safe_formula(component_a)})</small
|
|
195
|
+
>
|
|
202
196
|
</dd>
|
|
203
197
|
{#if wt_fraction_b !== null}
|
|
204
198
|
<dt>Weight</dt>
|
|
205
199
|
<dd>
|
|
206
200
|
{format_num(wt_fraction_b * 100, `.1f`)}%
|
|
207
201
|
{@html safe_formula(component_b)}
|
|
208
|
-
<small
|
|
209
|
-
{
|
|
202
|
+
<small
|
|
203
|
+
>({format_num((1 - wt_fraction_b) * 100, `.1f`)}%
|
|
204
|
+
{@html safe_formula(component_a)})</small
|
|
205
|
+
>
|
|
210
206
|
</dd>
|
|
211
207
|
{/if}
|
|
212
208
|
{#if stability}
|
|
213
|
-
<dt>Stable</dt
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
209
|
+
<dt>Stable</dt>
|
|
210
|
+
<dd>
|
|
211
|
+
{format_num(to_display(stability.t_min), `.0f`)} – {format_num(
|
|
212
|
+
to_display(stability.t_max),
|
|
213
|
+
`.0f`,
|
|
214
|
+
)}
|
|
215
|
+
{temperature_unit}
|
|
217
216
|
{#if temperature_unit !== `°C`}
|
|
218
|
-
<small
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
format_num(
|
|
225
|
-
convert_temp(stability.t_max, data_unit, `°C`),
|
|
226
|
-
`.0f`,
|
|
227
|
-
)
|
|
228
|
-
} °C)</small>
|
|
217
|
+
<small
|
|
218
|
+
>({format_num(convert_temp(stability.t_min, data_unit, `°C`), `.0f`)} – {format_num(
|
|
219
|
+
convert_temp(stability.t_max, data_unit, `°C`),
|
|
220
|
+
`.0f`,
|
|
221
|
+
)} °C)</small
|
|
222
|
+
>
|
|
229
223
|
{/if}
|
|
230
224
|
</dd>
|
|
231
225
|
{/if}
|
|
@@ -239,22 +233,22 @@
|
|
|
239
233
|
<div
|
|
240
234
|
style:width="{ld.fraction_a * 100}%"
|
|
241
235
|
title="{ld.phase_a}: {format_num(ld.fraction_a * 100, `.1f`)}%"
|
|
242
|
-
>
|
|
243
|
-
</div>
|
|
236
|
+
></div>
|
|
244
237
|
<div
|
|
245
238
|
style:width="{ld.fraction_b * 100}%"
|
|
246
239
|
title="{ld.phase_b}: {format_num(ld.fraction_b * 100, `.1f`)}%"
|
|
247
|
-
>
|
|
248
|
-
</div>
|
|
240
|
+
></div>
|
|
249
241
|
<i style:left="{ld.fraction_a * 100}%"></i>
|
|
250
242
|
</div>
|
|
251
243
|
<div class="phase-info">
|
|
252
|
-
<span
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
244
|
+
<span
|
|
245
|
+
>{@html safe_formula(ld.phase_a)}: {format_num(ld.fraction_a * 100, `.0f`)}%
|
|
246
|
+
<small>at {ld.detail_a}</small></span
|
|
247
|
+
>
|
|
248
|
+
<span
|
|
249
|
+
>{@html safe_formula(ld.phase_b)}: {format_num(ld.fraction_b * 100, `.0f`)}%
|
|
250
|
+
<small>at {ld.detail_b}</small></span
|
|
251
|
+
>
|
|
258
252
|
</div>
|
|
259
253
|
</div>
|
|
260
254
|
{/if}
|
|
@@ -263,11 +257,13 @@
|
|
|
263
257
|
{@const { type, delta_t } = boundary_distance}
|
|
264
258
|
{@const label = delta_t > 0 ? `above` : `below`}
|
|
265
259
|
{@const display_delta = Math.abs(
|
|
266
|
-
to_display(hover_info.temperature) -
|
|
267
|
-
to_display(hover_info.temperature - delta_t),
|
|
260
|
+
to_display(hover_info.temperature) - to_display(hover_info.temperature - delta_t),
|
|
268
261
|
)}
|
|
269
262
|
<div class="boundary-info">
|
|
270
|
-
{Math.round(display_delta)}
|
|
263
|
+
{Math.round(display_delta)}
|
|
264
|
+
{temperature_unit}
|
|
265
|
+
{label}
|
|
266
|
+
{type}
|
|
271
267
|
</div>
|
|
272
268
|
{/if}
|
|
273
269
|
</div>
|
|
@@ -20,12 +20,8 @@
|
|
|
20
20
|
style = ``,
|
|
21
21
|
}: Props = $props()
|
|
22
22
|
|
|
23
|
-
const reference = $derived(
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
const model_summary = $derived(
|
|
27
|
-
result.data ? summarize_models(result.data.phases) : null,
|
|
28
|
-
)
|
|
23
|
+
const reference = $derived(result.data ? extract_tdb_reference(result.data.comments) : null)
|
|
24
|
+
const model_summary = $derived(result.data ? summarize_models(result.data.phases) : null)
|
|
29
25
|
</script>
|
|
30
26
|
|
|
31
27
|
<div class="tdb-info-panel" {style}>
|
|
@@ -38,23 +34,30 @@
|
|
|
38
34
|
<dt>System</dt>
|
|
39
35
|
<dd>{sys}</dd>
|
|
40
36
|
<dt>Phases</dt>
|
|
41
|
-
<dd class="phases">
|
|
42
|
-
|
|
37
|
+
<dd class="phases">
|
|
38
|
+
{#each phases as { name } (name)}<span>{name}</span>{/each}
|
|
39
|
+
</dd>
|
|
40
|
+
{#if model_summary}<dt>Models</dt>
|
|
41
|
+
<dd>{model_summary}</dd>{/if}
|
|
43
42
|
<dt>Funcs / Params</dt>
|
|
44
43
|
<dd>{functions.length} / {parameters.length}</dd>
|
|
45
44
|
{#if result.temperature_range}
|
|
46
45
|
{@const [t_min, t_max] = result.temperature_range}
|
|
47
|
-
<dt>T Range</dt
|
|
46
|
+
<dt>T Range</dt>
|
|
47
|
+
<dd>{t_min} – {t_max} K</dd>
|
|
48
48
|
{/if}
|
|
49
|
-
{#if reference}<dt>Ref</dt
|
|
49
|
+
{#if reference}<dt>Ref</dt>
|
|
50
|
+
<dd class="ref" title={reference}>{reference}</dd>{/if}
|
|
50
51
|
</dl>
|
|
51
52
|
|
|
52
53
|
{#if has_precomputed}
|
|
53
54
|
<p class="notice success">
|
|
54
55
|
✓ {#if is_precomputed_loaded}
|
|
55
56
|
<strong>Phase diagram loaded</strong> ({sys}.json)
|
|
56
|
-
<small
|
|
57
|
-
|
|
57
|
+
<small
|
|
58
|
+
>TDB contains model parameters. Boundaries computed offline via
|
|
59
|
+
<a href="https://pycalphad.org" target="_blank">pycalphad</a>.</small
|
|
60
|
+
>
|
|
58
61
|
{:else}
|
|
59
62
|
Pre-computed diagram available!
|
|
60
63
|
{#if on_load_precomputed}
|
|
@@ -71,16 +74,19 @@
|
|
|
71
74
|
<div class="notice warning">
|
|
72
75
|
<p>
|
|
73
76
|
ℹ No pre-computed diagram. Use <a href="https://pycalphad.org" target="_blank"
|
|
74
|
-
|
|
77
|
+
>pycalphad</a
|
|
78
|
+
>:
|
|
75
79
|
</p>
|
|
76
80
|
<pre>
|
|
77
|
-
<code
|
|
81
|
+
<code
|
|
82
|
+
>from pycalphad import Database, binplot
|
|
78
83
|
import pycalphad.variables as v
|
|
79
84
|
|
|
80
85
|
db = Database('{tdb}.tdb')
|
|
81
86
|
binplot(db, ['{el_a}', '{el_b}', 'VA'], list(db.phases.keys()), {`{`}
|
|
82
87
|
v.X('{el_b}'): (0, 1, 0.01), v.T: (300, 2000, 10), v.P: 101325, v.N: 1
|
|
83
|
-
})</code
|
|
88
|
+
})</code
|
|
89
|
+
></pre>
|
|
84
90
|
</div>
|
|
85
91
|
{/if}
|
|
86
92
|
{:else}
|
|
@@ -19,11 +19,11 @@ export function parse_curve_ref(ref) {
|
|
|
19
19
|
name = name.slice(1);
|
|
20
20
|
}
|
|
21
21
|
// Check for slice suffix [start:end]
|
|
22
|
-
const slice_match = /^(
|
|
22
|
+
const slice_match = /^(?<base>.+)\[(?<start>-?\d*):(?<end>-?\d*)\]$/.exec(name);
|
|
23
23
|
if (slice_match) {
|
|
24
24
|
name = slice_match[1];
|
|
25
|
-
start = slice_match[2] ?
|
|
26
|
-
end = slice_match[3] ?
|
|
25
|
+
start = slice_match[2] ? Number(slice_match[2]) : null;
|
|
26
|
+
end = slice_match[3] ? Number(slice_match[3]) : null;
|
|
27
27
|
}
|
|
28
28
|
return { name, reverse, start, end };
|
|
29
29
|
}
|
|
@@ -20,10 +20,9 @@ export interface RegionInput {
|
|
|
20
20
|
bounds: BoundElement[];
|
|
21
21
|
label_position?: DiagramPoint;
|
|
22
22
|
}
|
|
23
|
-
export type SpecialPointInput = SpecialPoint;
|
|
24
23
|
export interface DiagramInput {
|
|
25
24
|
meta: DiagramInputMeta;
|
|
26
25
|
curves: Record<string, DiagramPoint[]>;
|
|
27
26
|
regions: RegionInput[];
|
|
28
|
-
special_points?:
|
|
27
|
+
special_points?: SpecialPoint[];
|
|
29
28
|
}
|
|
@@ -86,31 +86,31 @@ const LINE_PARSERS = [
|
|
|
86
86
|
{
|
|
87
87
|
// ELEMENT AL FCC_A1 2.698154E-02 4.5773304E+03 2.871870E+01!
|
|
88
88
|
prefix: `ELEMENT `,
|
|
89
|
-
pattern: /ELEMENT\s+(
|
|
89
|
+
pattern: /ELEMENT\s+(?<symbol>\S+)\s+(?<reference_phase>\S+)\s+(?<mass>[\d.E+-]+)\s+(?<enthalpy>[\d.E+-]+)\s+(?<entropy>[\d.E+-]+)/i,
|
|
90
90
|
handler: (match, data) => {
|
|
91
91
|
data.elements.push({
|
|
92
92
|
symbol: match[1].toUpperCase(),
|
|
93
93
|
reference_phase: match[2],
|
|
94
|
-
mass:
|
|
95
|
-
enthalpy:
|
|
96
|
-
entropy:
|
|
94
|
+
mass: Number(match[3]),
|
|
95
|
+
enthalpy: Number(match[4]),
|
|
96
|
+
entropy: Number(match[5]),
|
|
97
97
|
});
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
// PHASE LIQUID % 1 1.0 !
|
|
102
102
|
prefix: `PHASE `,
|
|
103
|
-
pattern: /PHASE\s+(
|
|
103
|
+
pattern: /PHASE\s+(?<name>\S+)\s+(?<model_hints>%\S*)\s+(?<count>\d+)\s+(?<sites>.+?)!/i,
|
|
104
104
|
handler: (match, data) => {
|
|
105
105
|
const sublattice_sites = match[4]
|
|
106
106
|
.trim()
|
|
107
107
|
.split(/\s+/)
|
|
108
|
-
.map(
|
|
108
|
+
.map(Number)
|
|
109
109
|
.filter((val) => !isNaN(val));
|
|
110
110
|
data.phases.push({
|
|
111
111
|
name: match[1],
|
|
112
112
|
model_hints: match[2],
|
|
113
|
-
sublattice_count:
|
|
113
|
+
sublattice_count: Math.trunc(Number(match[3])),
|
|
114
114
|
sublattice_sites,
|
|
115
115
|
});
|
|
116
116
|
},
|
|
@@ -118,7 +118,7 @@ const LINE_PARSERS = [
|
|
|
118
118
|
{
|
|
119
119
|
// CONSTITUENT FCC_A1 :AL,ZN : VA : !
|
|
120
120
|
prefix: `CONSTITUENT `,
|
|
121
|
-
pattern: /CONSTITUENT\s+(
|
|
121
|
+
pattern: /CONSTITUENT\s+(?<phase_name>\S+)\s*:\s*(?<constituents>.+?)!/i,
|
|
122
122
|
handler: (match, data) => {
|
|
123
123
|
const phase_name = match[1];
|
|
124
124
|
const constituents = match[2].split(`:`).map((sub) => sub
|
|
@@ -133,7 +133,7 @@ const LINE_PARSERS = [
|
|
|
133
133
|
{
|
|
134
134
|
// FUNCTION GHSERAL 298.15 expr1; 700 Y expr2; 933.47 Y expr3; 2900 N !
|
|
135
135
|
prefix: `FUNCTION `,
|
|
136
|
-
pattern: /FUNCTION\s+(
|
|
136
|
+
pattern: /FUNCTION\s+(?<name>\S+)\s+(?<body>.+?)!/i,
|
|
137
137
|
handler: (match, data) => {
|
|
138
138
|
const ranges = parse_temperature_ranges(match[2]);
|
|
139
139
|
if (ranges.length > 0) {
|
|
@@ -148,15 +148,15 @@ const LINE_PARSERS = [
|
|
|
148
148
|
{
|
|
149
149
|
// PARAMETER G(LIQUID,AL;0) 298.15 +GHSERAL+11005.029-11.841867*T; 6000 N !
|
|
150
150
|
prefix: `PARAMETER `,
|
|
151
|
-
pattern: /PARAMETER\s+(
|
|
151
|
+
pattern: /PARAMETER\s+(?<type>\w+)\((?<spec>[^)]+)\)\s+(?<expression>.+?)!/i,
|
|
152
152
|
handler: (match, data) => {
|
|
153
|
-
const spec_match = /([^,]+),([^;]+);(
|
|
153
|
+
const spec_match = /(?<phase>[^,]+),(?<constituents>[^;]+);(?<order>\d+)/.exec(match[2]);
|
|
154
154
|
if (spec_match) {
|
|
155
155
|
data.parameters.push({
|
|
156
156
|
type: match[1],
|
|
157
157
|
phase: spec_match[1],
|
|
158
158
|
constituents: spec_match[2].split(`,`).map((name) => name.trim()),
|
|
159
|
-
order:
|
|
159
|
+
order: Math.trunc(Number(spec_match[3])),
|
|
160
160
|
expression: match[3],
|
|
161
161
|
});
|
|
162
162
|
}
|
|
@@ -170,9 +170,9 @@ function parse_temperature_ranges(body) {
|
|
|
170
170
|
const trimmed = segment.trim();
|
|
171
171
|
if (!trimmed)
|
|
172
172
|
continue;
|
|
173
|
-
const temp_match = /^([\d.E+-]+)\s+(
|
|
173
|
+
const temp_match = /^(?<temp>[\d.E+-]+)\s+(?<expr>.+)/i.exec(trimmed);
|
|
174
174
|
if (temp_match) {
|
|
175
|
-
const next_temp =
|
|
175
|
+
const next_temp = Number(temp_match[1]);
|
|
176
176
|
const expr = temp_match[2].replace(/\s+[YN]\s*$/, ``).trim();
|
|
177
177
|
if (ranges.length > 0)
|
|
178
178
|
ranges[ranges.length - 1].max = next_temp;
|
|
@@ -191,7 +191,7 @@ function parse_tdb_line(line, data) {
|
|
|
191
191
|
parser.handler(match, data);
|
|
192
192
|
else if (parser.prefix === `ELEMENT `) {
|
|
193
193
|
// Fallback for simpler ELEMENT format: ELEMENT AL FCC_A1!
|
|
194
|
-
const simple_match = /ELEMENT\s+(
|
|
194
|
+
const simple_match = /ELEMENT\s+(?<symbol>\S+)\s+(?<reference_phase>\S+)/i.exec(line);
|
|
195
195
|
if (simple_match) {
|
|
196
196
|
data.elements.push({
|
|
197
197
|
symbol: simple_match[1].toUpperCase(),
|
|
@@ -81,7 +81,7 @@ function extract_matplotlib_ticks(doc, x_ticks, y_ticks) {
|
|
|
81
81
|
function extract_simple_ticks(doc, x_ticks, y_ticks) {
|
|
82
82
|
// Y-axis ticks: class="tick-text" with text-anchor: end
|
|
83
83
|
for (const text_el of Array.from(doc.querySelectorAll(`.tick-text`))) {
|
|
84
|
-
const value =
|
|
84
|
+
const value = leading_number(text_el.textContent);
|
|
85
85
|
if (isNaN(value))
|
|
86
86
|
continue;
|
|
87
87
|
// Find the immediately preceding sibling tick line (not just any line in parent)
|
|
@@ -97,7 +97,7 @@ function extract_simple_ticks(doc, x_ticks, y_ticks) {
|
|
|
97
97
|
}
|
|
98
98
|
// X-axis ticks: class="tick-text-x"
|
|
99
99
|
for (const text_el of Array.from(doc.querySelectorAll(`.tick-text-x`))) {
|
|
100
|
-
const value =
|
|
100
|
+
const value = leading_number(text_el.textContent);
|
|
101
101
|
if (isNaN(value))
|
|
102
102
|
continue;
|
|
103
103
|
const px_x = parse_float_attr(text_el, `x`);
|
|
@@ -116,7 +116,7 @@ function extract_mpds_scales(doc) {
|
|
|
116
116
|
// Extract all numeric text values to infer axis ranges
|
|
117
117
|
const numbers = [];
|
|
118
118
|
for (const text_el of Array.from(doc.querySelectorAll(`text`))) {
|
|
119
|
-
const val =
|
|
119
|
+
const val = leading_number(text_el.textContent);
|
|
120
120
|
if (!isNaN(val))
|
|
121
121
|
numbers.push(val);
|
|
122
122
|
}
|
|
@@ -668,20 +668,26 @@ function infer_mpds_components(doc) {
|
|
|
668
668
|
return [unique[0] ?? `A`, unique[1] ?? `B`];
|
|
669
669
|
}
|
|
670
670
|
// === Utility Functions ===
|
|
671
|
-
//
|
|
671
|
+
// Leading numeric prefix like parseFloat (`2px` -> 2, `600 K` -> 600, else NaN):
|
|
672
|
+
// Number() alone rejects unit-suffixed/annotated values that real SVG exports contain
|
|
673
|
+
function leading_number(text) {
|
|
674
|
+
const match = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/.exec(text?.trim() ?? ``);
|
|
675
|
+
return match ? Number(match[0]) : NaN;
|
|
676
|
+
}
|
|
677
|
+
// Parse stroke-width from style or direct attribute (0 if missing, `2px` units ok)
|
|
672
678
|
function parse_stroke_width(el) {
|
|
673
|
-
const style_match = /stroke-width:\s*([\d.]+)/.exec(el.getAttribute(`style`) ?? ``);
|
|
679
|
+
const style_match = /stroke-width:\s*(?<width>[\d.]+)/.exec(el.getAttribute(`style`) ?? ``);
|
|
674
680
|
if (style_match)
|
|
675
|
-
return
|
|
676
|
-
const
|
|
677
|
-
return
|
|
681
|
+
return Number(style_match[1]);
|
|
682
|
+
const parsed = leading_number(el.getAttribute(`stroke-width`));
|
|
683
|
+
return isNaN(parsed) ? 0 : parsed;
|
|
678
684
|
}
|
|
679
685
|
// Parse a float attribute from an SVG element
|
|
680
686
|
function parse_float_attr(el, attr) {
|
|
681
687
|
const val = el.getAttribute(attr);
|
|
682
688
|
if (val === null)
|
|
683
689
|
return null;
|
|
684
|
-
const parsed =
|
|
690
|
+
const parsed = leading_number(val);
|
|
685
691
|
return isNaN(parsed) ? null : parsed;
|
|
686
692
|
}
|
|
687
693
|
// Extract a number from XML comment nodes inside a group element
|
|
@@ -689,7 +695,7 @@ function extract_comment_number(group) {
|
|
|
689
695
|
const walker = group.ownerDocument.createTreeWalker(group, NodeFilter.SHOW_COMMENT);
|
|
690
696
|
let node;
|
|
691
697
|
while ((node = walker.nextNode())) {
|
|
692
|
-
const value =
|
|
698
|
+
const value = leading_number(node.textContent);
|
|
693
699
|
if (!isNaN(value))
|
|
694
700
|
return value;
|
|
695
701
|
}
|
|
@@ -721,8 +727,8 @@ function find_comment_text(group) {
|
|
|
721
727
|
}
|
|
722
728
|
// Clean LaTeX subscript notation: "La$_2$NiO$_4$" -> "La2NiO4"
|
|
723
729
|
const clean_latex = (text) => text
|
|
724
|
-
.replaceAll(/\$_\{([^}]*)\}\$/g, `$1`) // $_{10}$ -> 10
|
|
725
|
-
.replaceAll(/\$_(
|
|
730
|
+
.replaceAll(/\$_\{(?<digits>[^}]*)\}\$/g, `$1`) // $_{10}$ -> 10
|
|
731
|
+
.replaceAll(/\$_(?<digit>\d)\$/g, `$1`) // $_2$ -> 2
|
|
726
732
|
.replaceAll(`$`, ``) // remove any remaining $
|
|
727
733
|
.replaceAll(/\s+/g, ` `)
|
|
728
734
|
.trim();
|
|
@@ -742,7 +748,7 @@ function parse_path_segments(path_str) {
|
|
|
742
748
|
return segments;
|
|
743
749
|
let idx = 0;
|
|
744
750
|
const peek = () => tokens[idx];
|
|
745
|
-
const next_num = () =>
|
|
751
|
+
const next_num = () => Number(tokens[idx++] || `0`);
|
|
746
752
|
while (idx < tokens.length) {
|
|
747
753
|
let cmd = peek() ?? ``;
|
|
748
754
|
if (cmd.length === 1 && /[A-Za-z]/.test(cmd)) {
|
|
@@ -825,10 +831,10 @@ function parse_ml_path(path_str) {
|
|
|
825
831
|
// Parse translate(x, y) or translate(x) from a transform attribute
|
|
826
832
|
// Single-arg translate uses implicit y=0 per SVG spec
|
|
827
833
|
function parse_translate(el) {
|
|
828
|
-
const match = /translate\(\s*([\d.eE+-]+)(?:\s*[,\s]\s*([\d.eE+-]+))?\s*\)/.exec(el?.getAttribute(`transform`) ?? ``);
|
|
834
|
+
const match = /translate\(\s*(?<x>[\d.eE+-]+)(?:\s*[,\s]\s*(?<y>[\d.eE+-]+))?\s*\)/.exec(el?.getAttribute(`transform`) ?? ``);
|
|
829
835
|
if (!match)
|
|
830
836
|
return null;
|
|
831
|
-
return [
|
|
837
|
+
return [Number(match[1]), match[2] ? Number(match[2]) : 0];
|
|
832
838
|
}
|
|
833
839
|
// Get translate X or Y from a group's transform attribute
|
|
834
840
|
function get_group_translate(el, axis) {
|
|
@@ -116,8 +116,7 @@ export function get_phase_color_key(name) {
|
|
|
116
116
|
}
|
|
117
117
|
// Get phase color - returns rgba() by default, or RGB string if format='rgb'
|
|
118
118
|
export function get_phase_color(name, format = `rgba`) {
|
|
119
|
-
const
|
|
120
|
-
const key = lower.includes(`+`) ? `two_phase` : get_phase_color_key(name);
|
|
119
|
+
const key = name.includes(`+`) ? `two_phase` : get_phase_color_key(name);
|
|
121
120
|
return format === `rgb` ? PHASE_COLOR_RGB[key] : PHASE_COLORS[key];
|
|
122
121
|
}
|
|
123
122
|
// Get gradient colors for multi-phase regions (2+ phases separated by '+')
|
|
@@ -523,7 +522,7 @@ function format_label_parts(label, use_subscripts, formatter) {
|
|
|
523
522
|
if (!use_subscripts)
|
|
524
523
|
return label;
|
|
525
524
|
return label
|
|
526
|
-
.split(/(
|
|
525
|
+
.split(/(?<separator>\s*\+\s*)/)
|
|
527
526
|
.map((part) => {
|
|
528
527
|
if (part.trim() === `+`)
|
|
529
528
|
return part;
|