matterviz 0.3.6 → 0.3.7
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.d.ts +9 -0
- package/dist/FilePicker.svelte +360 -0
- package/dist/FilePicker.svelte.d.ts +17 -0
- package/dist/Icon.svelte.d.ts +13 -0
- package/dist/MillerIndexInput.svelte +66 -0
- package/dist/MillerIndexInput.svelte.d.ts +7 -0
- package/dist/api/mp.d.ts +6 -0
- package/dist/api/mp.js +22 -0
- package/dist/api/optimade.d.ts +45 -0
- package/dist/api/optimade.js +135 -0
- package/dist/brillouin/BrillouinZone.svelte +549 -0
- package/dist/brillouin/BrillouinZone.svelte.d.ts +83 -0
- package/dist/brillouin/BrillouinZoneControls.svelte +144 -0
- package/dist/brillouin/BrillouinZoneControls.svelte.d.ts +17 -0
- package/dist/brillouin/BrillouinZoneExportPane.svelte +146 -0
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +15 -0
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +146 -0
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +13 -0
- package/dist/brillouin/BrillouinZoneScene.svelte +476 -0
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +48 -0
- package/dist/brillouin/BrillouinZoneTooltip.svelte +92 -0
- package/dist/brillouin/BrillouinZoneTooltip.svelte.d.ts +8 -0
- package/dist/brillouin/compute.d.ts +17 -0
- package/dist/brillouin/compute.js +426 -0
- package/dist/brillouin/index.d.ts +8 -0
- package/dist/brillouin/index.js +7 -0
- package/dist/brillouin/types.d.ts +43 -0
- package/dist/brillouin/types.js +1 -0
- package/dist/chempot-diagram/ChemPotDiagram.svelte +327 -0
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +846 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +3193 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
- package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
- package/dist/chempot-diagram/async-compute.svelte.js +78 -0
- package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
- package/dist/chempot-diagram/chempot-worker.js +11 -0
- package/dist/chempot-diagram/color.d.ts +10 -0
- package/dist/chempot-diagram/color.js +32 -0
- package/dist/chempot-diagram/compute.d.ts +48 -0
- package/dist/chempot-diagram/compute.js +806 -0
- package/dist/chempot-diagram/index.d.ts +6 -0
- package/dist/chempot-diagram/index.js +6 -0
- package/dist/chempot-diagram/pointer.d.ts +16 -0
- package/dist/chempot-diagram/pointer.js +40 -0
- package/dist/chempot-diagram/temperature.d.ts +15 -0
- package/dist/chempot-diagram/temperature.js +34 -0
- package/dist/chempot-diagram/types.d.ts +81 -0
- package/dist/chempot-diagram/types.js +28 -0
- package/dist/colors/index.d.ts +47 -0
- package/dist/colors/index.js +203 -0
- package/dist/composition/BarChart.svelte +297 -0
- package/dist/composition/BarChart.svelte.d.ts +39 -0
- package/dist/composition/BubbleChart.svelte +218 -0
- package/dist/composition/BubbleChart.svelte.d.ts +28 -0
- package/dist/composition/Composition.svelte +165 -0
- package/dist/composition/Composition.svelte.d.ts +15 -0
- package/dist/composition/Formula.svelte +268 -0
- package/dist/composition/Formula.svelte.d.ts +19 -0
- package/dist/composition/FormulaFilter.svelte +1257 -0
- package/dist/composition/FormulaFilter.svelte.d.ts +51 -0
- package/dist/composition/PieChart.svelte +323 -0
- package/dist/composition/PieChart.svelte.d.ts +37 -0
- package/dist/composition/format.d.ts +15 -0
- package/dist/composition/format.js +109 -0
- package/dist/composition/index.d.ts +20 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +56 -0
- package/dist/composition/parse.js +474 -0
- package/dist/constants.d.ts +29 -0
- package/dist/constants.js +99 -0
- package/dist/controls.d.ts +14 -0
- package/dist/controls.js +30 -0
- package/dist/convex-hull/ConvexHull.svelte +157 -0
- package/dist/convex-hull/ConvexHull.svelte.d.ts +13 -0
- package/dist/convex-hull/ConvexHull2D.svelte +825 -0
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +11 -0
- package/dist/convex-hull/ConvexHull3D.svelte +1801 -0
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +8 -0
- package/dist/convex-hull/ConvexHull4D.svelte +1398 -0
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +8 -0
- package/dist/convex-hull/ConvexHullControls.svelte +535 -0
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +48 -0
- package/dist/convex-hull/ConvexHullInfoPane.svelte +125 -0
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +20 -0
- package/dist/convex-hull/ConvexHullStats.svelte +929 -0
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +17 -0
- package/dist/convex-hull/ConvexHullTooltip.svelte +131 -0
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +33 -0
- package/dist/convex-hull/GasPressureControls.svelte +247 -0
- package/dist/convex-hull/GasPressureControls.svelte.d.ts +11 -0
- package/dist/convex-hull/StructurePopup.svelte +151 -0
- package/dist/convex-hull/StructurePopup.svelte.d.ts +18 -0
- package/dist/convex-hull/TemperatureSlider.svelte.d.ts +8 -0
- package/dist/convex-hull/barycentric-coords.d.ts +18 -0
- package/dist/convex-hull/barycentric-coords.js +182 -0
- package/dist/convex-hull/demo-temperature.d.ts +6 -0
- package/dist/convex-hull/demo-temperature.js +40 -0
- package/dist/convex-hull/gas-thermodynamics.d.ts +16 -0
- package/dist/convex-hull/gas-thermodynamics.js +314 -0
- package/dist/convex-hull/helpers.d.ts +114 -0
- package/dist/convex-hull/helpers.js +710 -0
- package/dist/convex-hull/index.d.ts +119 -0
- package/dist/convex-hull/index.js +58 -0
- package/dist/convex-hull/thermodynamics.d.ts +67 -0
- package/dist/convex-hull/thermodynamics.js +1752 -0
- package/dist/convex-hull/types.d.ts +162 -0
- package/dist/convex-hull/types.js +36 -0
- package/dist/coordination/CoordinationBarPlot.svelte +311 -0
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +30 -0
- package/dist/coordination/calc-coordination.d.ts +15 -0
- package/dist/coordination/calc-coordination.js +63 -0
- package/dist/coordination/index.d.ts +8 -0
- package/dist/coordination/index.js +7 -0
- package/dist/effects.svelte.d.ts +12 -0
- package/dist/effects.svelte.js +37 -0
- package/dist/element/BohrAtom.svelte.d.ts +20 -0
- package/dist/element/ElementHeading.svelte +26 -0
- package/dist/element/ElementHeading.svelte.d.ts +8 -0
- package/dist/element/ElementPhoto.svelte +57 -0
- package/dist/element/ElementPhoto.svelte.d.ts +9 -0
- package/dist/element/ElementStats.svelte +80 -0
- package/dist/element/ElementStats.svelte.d.ts +8 -0
- package/dist/element/ElementTile.svelte +484 -0
- package/dist/element/ElementTile.svelte.d.ts +29 -0
- package/dist/element/Nucleus.svelte.d.ts +17 -0
- package/dist/element/data.d.ts +2 -0
- package/dist/element/data.js +2 -0
- package/dist/element/index.d.ts +8 -0
- package/dist/element/index.js +7 -0
- package/dist/element/types.d.ts +57 -0
- package/dist/element/types.js +1 -0
- package/dist/feedback/ClickFeedback.svelte +58 -0
- package/dist/feedback/ClickFeedback.svelte.d.ts +12 -0
- package/dist/feedback/DragOverlay.svelte +42 -0
- package/dist/feedback/DragOverlay.svelte.d.ts +7 -0
- package/dist/feedback/Spinner.svelte.d.ts +7 -0
- package/dist/feedback/StatusMessage.svelte.d.ts +9 -0
- package/dist/feedback/index.d.ts +4 -0
- package/dist/feedback/index.js +4 -0
- package/dist/fermi-surface/FermiSlice.svelte +189 -0
- package/dist/fermi-surface/FermiSlice.svelte.d.ts +24 -0
- package/dist/fermi-surface/FermiSurface.svelte +600 -0
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +83 -0
- package/dist/fermi-surface/FermiSurfaceControls.svelte +448 -0
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +35 -0
- package/dist/fermi-surface/FermiSurfaceScene.svelte +794 -0
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +50 -0
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +111 -0
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte.d.ts +8 -0
- package/dist/fermi-surface/compute.d.ts +5 -0
- package/dist/fermi-surface/compute.js +538 -0
- package/dist/fermi-surface/constants.d.ts +9 -0
- package/dist/fermi-surface/constants.js +27 -0
- package/dist/fermi-surface/export.d.ts +5 -0
- package/dist/fermi-surface/export.js +50 -0
- package/dist/fermi-surface/index.d.ts +12 -0
- package/dist/fermi-surface/index.js +13 -0
- package/dist/fermi-surface/marching-cubes.d.ts +2 -0
- package/dist/fermi-surface/marching-cubes.js +2 -0
- package/dist/fermi-surface/parse.d.ts +2 -0
- package/dist/fermi-surface/parse.js +491 -0
- package/dist/fermi-surface/symmetry.d.ts +3 -0
- package/dist/fermi-surface/symmetry.js +46 -0
- package/dist/fermi-surface/types.d.ts +110 -0
- package/dist/fermi-surface/types.js +4 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +1545 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +30 -0
- package/dist/heatmap-matrix/index.d.ts +53 -0
- package/dist/heatmap-matrix/index.js +100 -0
- package/dist/heatmap-matrix/shared.d.ts +2 -0
- package/dist/heatmap-matrix/shared.js +4 -0
- package/dist/icons.d.ts +569 -0
- package/dist/icons.js +648 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/io/decompress.d.ts +11 -0
- package/dist/io/decompress.js +74 -0
- package/dist/io/export.d.ts +16 -0
- package/dist/io/export.js +316 -0
- package/dist/io/fetch.d.ts +5 -0
- package/dist/io/fetch.js +39 -0
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +43 -0
- package/dist/io/index.d.ts +7 -0
- package/dist/io/index.js +6 -0
- package/dist/io/is-binary.d.ts +1 -0
- package/dist/io/is-binary.js +20 -0
- package/dist/io/types.d.ts +8 -0
- package/dist/io/types.js +1 -0
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +123 -0
- package/dist/isosurface/Isosurface.svelte +285 -0
- package/dist/isosurface/Isosurface.svelte.d.ts +8 -0
- package/dist/isosurface/IsosurfaceControls.svelte +277 -0
- package/dist/isosurface/IsosurfaceControls.svelte.d.ts +9 -0
- package/dist/isosurface/index.d.ts +5 -0
- package/dist/isosurface/index.js +6 -0
- package/dist/isosurface/parse.d.ts +6 -0
- package/dist/isosurface/parse.js +553 -0
- package/dist/isosurface/slice.d.ts +11 -0
- package/dist/isosurface/slice.js +140 -0
- package/dist/isosurface/types.d.ts +56 -0
- package/dist/isosurface/types.js +227 -0
- package/dist/labels.d.ts +53 -0
- package/dist/labels.js +277 -0
- package/dist/layout/FullscreenToggle.svelte +50 -0
- package/dist/layout/FullscreenToggle.svelte.d.ts +7 -0
- package/dist/layout/InfoCard.svelte +120 -0
- package/dist/layout/InfoCard.svelte.d.ts +21 -0
- package/dist/layout/InfoTag.svelte +185 -0
- package/dist/layout/InfoTag.svelte.d.ts +19 -0
- package/dist/layout/PropertyFilter.svelte +246 -0
- package/dist/layout/PropertyFilter.svelte.d.ts +24 -0
- package/dist/layout/SettingsSection.svelte +148 -0
- package/dist/layout/SettingsSection.svelte.d.ts +17 -0
- package/dist/layout/SubpageGrid.svelte +82 -0
- package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
- package/dist/layout/fullscreen.d.ts +9 -0
- package/dist/layout/fullscreen.js +53 -0
- package/dist/layout/index.d.ts +10 -0
- package/dist/layout/index.js +8 -0
- package/dist/layout/json-tree/JsonNode.svelte +548 -0
- package/dist/layout/json-tree/JsonNode.svelte.d.ts +11 -0
- package/dist/layout/json-tree/JsonTree.svelte +1230 -0
- package/dist/layout/json-tree/JsonTree.svelte.d.ts +6 -0
- package/dist/layout/json-tree/JsonValue.svelte.d.ts +9 -0
- package/dist/layout/json-tree/index.d.ts +3 -0
- package/dist/layout/json-tree/index.js +3 -0
- package/dist/layout/json-tree/types.d.ts +74 -0
- package/dist/layout/json-tree/types.js +2 -0
- package/dist/layout/json-tree/utils.d.ts +29 -0
- package/dist/layout/json-tree/utils.js +641 -0
- package/dist/marching-cubes.d.ts +14 -0
- package/dist/marching-cubes.js +540 -0
- package/dist/math.d.ts +101 -0
- package/dist/math.js +905 -0
- package/dist/overlays/ContextMenu.svelte +162 -0
- package/dist/overlays/ContextMenu.svelte.d.ts +25 -0
- package/dist/overlays/CopyButton.svelte +45 -0
- package/dist/overlays/CopyButton.svelte.d.ts +8 -0
- package/dist/overlays/DragControlTab.svelte +98 -0
- package/dist/overlays/DragControlTab.svelte.d.ts +8 -0
- package/dist/overlays/DraggablePane.svelte +487 -0
- package/dist/overlays/DraggablePane.svelte.d.ts +36 -0
- package/dist/overlays/InfoPaneCards.svelte +149 -0
- package/dist/overlays/InfoPaneCards.svelte.d.ts +22 -0
- package/dist/overlays/index.d.ts +3 -0
- package/dist/overlays/index.js +3 -0
- package/dist/periodic-table/PeriodicTable.svelte +469 -0
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +55 -0
- package/dist/periodic-table/PeriodicTableControls.svelte +557 -0
- package/dist/periodic-table/PeriodicTableControls.svelte.d.ts +24 -0
- package/dist/periodic-table/PropertySelect.svelte +37 -0
- package/dist/periodic-table/PropertySelect.svelte.d.ts +13 -0
- package/dist/periodic-table/TableInset.svelte.d.ts +9 -0
- package/dist/periodic-table/index.d.ts +10 -0
- package/dist/periodic-table/index.js +4 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +1086 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +44 -0
- package/dist/phase-diagram/PhaseDiagramControls.svelte +444 -0
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +30 -0
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +184 -0
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +19 -0
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +391 -0
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +16 -0
- package/dist/phase-diagram/TdbInfoPanel.svelte +203 -0
- package/dist/phase-diagram/TdbInfoPanel.svelte.d.ts +12 -0
- package/dist/phase-diagram/build-diagram.d.ts +11 -0
- package/dist/phase-diagram/build-diagram.js +160 -0
- package/dist/phase-diagram/colors.d.ts +35 -0
- package/dist/phase-diagram/colors.js +51 -0
- package/dist/phase-diagram/diagram-input.d.ts +29 -0
- package/dist/phase-diagram/diagram-input.js +3 -0
- package/dist/phase-diagram/index.d.ts +13 -0
- package/dist/phase-diagram/index.js +11 -0
- package/dist/phase-diagram/parse.d.ts +55 -0
- package/dist/phase-diagram/parse.js +272 -0
- package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
- package/dist/phase-diagram/svg-to-diagram.js +867 -0
- package/dist/phase-diagram/types.d.ts +93 -0
- package/dist/phase-diagram/types.js +1 -0
- package/dist/phase-diagram/utils.d.ts +118 -0
- package/dist/phase-diagram/utils.js +604 -0
- package/dist/plot/AxisLabel.svelte +51 -0
- package/dist/plot/AxisLabel.svelte.d.ts +16 -0
- package/dist/plot/BarPlot.svelte +2113 -0
- package/dist/plot/BarPlot.svelte.d.ts +84 -0
- package/dist/plot/BarPlotControls.svelte +66 -0
- package/dist/plot/BarPlotControls.svelte.d.ts +18 -0
- package/dist/plot/BinnedScatterPlot.svelte +1114 -0
- package/dist/plot/BinnedScatterPlot.svelte.d.ts +66 -0
- package/dist/plot/ColorBar.svelte +721 -0
- package/dist/plot/ColorBar.svelte.d.ts +31 -0
- package/dist/plot/ColorScaleSelect.svelte +54 -0
- package/dist/plot/ColorScaleSelect.svelte.d.ts +15 -0
- package/dist/plot/ElementScatter.svelte +63 -0
- package/dist/plot/ElementScatter.svelte.d.ts +14 -0
- package/dist/plot/FillArea.svelte.d.ts +21 -0
- package/dist/plot/Histogram.svelte +1558 -0
- package/dist/plot/Histogram.svelte.d.ts +50 -0
- package/dist/plot/HistogramControls.svelte +212 -0
- package/dist/plot/HistogramControls.svelte.d.ts +22 -0
- package/dist/plot/InteractiveAxisLabel.svelte +96 -0
- package/dist/plot/InteractiveAxisLabel.svelte.d.ts +14 -0
- package/dist/plot/Line.svelte +84 -0
- package/dist/plot/Line.svelte.d.ts +15 -0
- package/dist/plot/PlotAxis.svelte +169 -0
- package/dist/plot/PlotAxis.svelte.d.ts +24 -0
- package/dist/plot/PlotControls.svelte +537 -0
- package/dist/plot/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/PlotLegend.svelte +569 -0
- package/dist/plot/PlotLegend.svelte.d.ts +29 -0
- package/dist/plot/PlotTooltip.svelte +67 -0
- package/dist/plot/PlotTooltip.svelte.d.ts +17 -0
- package/dist/plot/PortalSelect.svelte +253 -0
- package/dist/plot/PortalSelect.svelte.d.ts +16 -0
- package/dist/plot/ReferenceLine.svelte.d.ts +20 -0
- package/dist/plot/ReferenceLine3D.svelte +156 -0
- package/dist/plot/ReferenceLine3D.svelte.d.ts +14 -0
- package/dist/plot/ReferencePlane.svelte +175 -0
- package/dist/plot/ReferencePlane.svelte.d.ts +14 -0
- package/dist/plot/ScatterPlot.svelte +2778 -0
- package/dist/plot/ScatterPlot.svelte.d.ts +96 -0
- package/dist/plot/ScatterPlot3D.svelte +529 -0
- package/dist/plot/ScatterPlot3D.svelte.d.ts +95 -0
- package/dist/plot/ScatterPlot3DControls.svelte +437 -0
- package/dist/plot/ScatterPlot3DControls.svelte.d.ts +20 -0
- package/dist/plot/ScatterPlot3DScene.svelte +912 -0
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +74 -0
- package/dist/plot/ScatterPlotControls.svelte +306 -0
- package/dist/plot/ScatterPlotControls.svelte.d.ts +17 -0
- package/dist/plot/ScatterPoint.svelte +182 -0
- package/dist/plot/ScatterPoint.svelte.d.ts +22 -0
- package/dist/plot/SpacegroupBarPlot.svelte +293 -0
- package/dist/plot/SpacegroupBarPlot.svelte.d.ts +9 -0
- package/dist/plot/Surface3D.svelte +197 -0
- package/dist/plot/Surface3D.svelte.d.ts +13 -0
- package/dist/plot/ZeroLines.svelte +97 -0
- package/dist/plot/ZeroLines.svelte.d.ts +33 -0
- package/dist/plot/ZoomRect.svelte +23 -0
- package/dist/plot/ZoomRect.svelte.d.ts +8 -0
- package/dist/plot/adaptive-density.d.ts +69 -0
- package/dist/plot/adaptive-density.js +191 -0
- package/dist/plot/auto-place.d.ts +43 -0
- package/dist/plot/auto-place.js +122 -0
- package/dist/plot/axis-utils.d.ts +19 -0
- package/dist/plot/axis-utils.js +78 -0
- package/dist/plot/binned-scatter-types.d.ts +59 -0
- package/dist/plot/binned-scatter-types.js +1 -0
- package/dist/plot/data-cleaning.d.ts +37 -0
- package/dist/plot/data-cleaning.js +855 -0
- package/dist/plot/data-transform.d.ts +16 -0
- package/dist/plot/data-transform.js +45 -0
- package/dist/plot/defaults.d.ts +19 -0
- package/dist/plot/defaults.js +9 -0
- package/dist/plot/fill-utils.d.ts +46 -0
- package/dist/plot/fill-utils.js +322 -0
- package/dist/plot/hover-lock.svelte.d.ts +14 -0
- package/dist/plot/hover-lock.svelte.js +46 -0
- package/dist/plot/index.d.ts +41 -0
- package/dist/plot/index.js +39 -0
- package/dist/plot/interactions.d.ts +12 -0
- package/dist/plot/interactions.js +101 -0
- package/dist/plot/layout.d.ts +78 -0
- package/dist/plot/layout.js +273 -0
- package/dist/plot/reference-line.d.ts +60 -0
- package/dist/plot/reference-line.js +314 -0
- package/dist/plot/scales.d.ts +48 -0
- package/dist/plot/scales.js +481 -0
- package/dist/plot/svg.d.ts +1 -0
- package/dist/plot/svg.js +11 -0
- package/dist/plot/types.d.ts +831 -0
- package/dist/plot/types.js +99 -0
- package/dist/plot/utils/label-placement.d.ts +68 -0
- package/dist/plot/utils/label-placement.js +326 -0
- package/dist/plot/utils/series-visibility.d.ts +15 -0
- package/dist/plot/utils/series-visibility.js +85 -0
- package/dist/plot/utils.d.ts +1 -0
- package/dist/plot/utils.js +14 -0
- package/dist/rdf/RdfPlot.svelte +247 -0
- package/dist/rdf/RdfPlot.svelte.d.ts +27 -0
- package/dist/rdf/calc-rdf.d.ts +4 -0
- package/dist/rdf/calc-rdf.js +111 -0
- package/dist/rdf/index.d.ts +23 -0
- package/dist/rdf/index.js +2 -0
- package/dist/sanitize.d.ts +6 -0
- package/dist/sanitize.js +116 -0
- package/dist/settings.d.ts +255 -0
- package/dist/settings.js +1132 -0
- package/dist/spectral/Bands.svelte +1040 -0
- package/dist/spectral/Bands.svelte.d.ts +40 -0
- package/dist/spectral/BandsAndDos.svelte +134 -0
- package/dist/spectral/BandsAndDos.svelte.d.ts +18 -0
- package/dist/spectral/BrillouinBandsDos.svelte +252 -0
- package/dist/spectral/BrillouinBandsDos.svelte.d.ts +20 -0
- package/dist/spectral/Dos.svelte +697 -0
- package/dist/spectral/Dos.svelte.d.ts +29 -0
- package/dist/spectral/helpers.d.ts +119 -0
- package/dist/spectral/helpers.js +1032 -0
- package/dist/spectral/index.d.ts +6 -0
- package/dist/spectral/index.js +6 -0
- package/dist/spectral/types.d.ts +84 -0
- package/dist/spectral/types.js +2 -0
- package/dist/state.svelte.d.ts +25 -0
- package/dist/state.svelte.js +45 -0
- package/dist/structure/Arrow.svelte +72 -0
- package/dist/structure/Arrow.svelte.d.ts +15 -0
- package/dist/structure/AtomLegend.svelte +815 -0
- package/dist/structure/AtomLegend.svelte.d.ts +35 -0
- package/dist/structure/Bond.svelte +140 -0
- package/dist/structure/Bond.svelte.d.ts +9 -0
- package/dist/structure/CanvasTooltip.svelte +33 -0
- package/dist/structure/CanvasTooltip.svelte.d.ts +12 -0
- package/dist/structure/CellSelect.svelte +349 -0
- package/dist/structure/CellSelect.svelte.d.ts +13 -0
- package/dist/structure/Cylinder.svelte +45 -0
- package/dist/structure/Cylinder.svelte.d.ts +10 -0
- package/dist/structure/Lattice.svelte +196 -0
- package/dist/structure/Lattice.svelte.d.ts +17 -0
- package/dist/structure/Structure.svelte +2248 -0
- package/dist/structure/Structure.svelte.d.ts +89 -0
- package/dist/structure/StructureControls.svelte +1273 -0
- package/dist/structure/StructureControls.svelte.d.ts +31 -0
- package/dist/structure/StructureExportPane.svelte +252 -0
- package/dist/structure/StructureExportPane.svelte.d.ts +17 -0
- package/dist/structure/StructureInfoPane.svelte +737 -0
- package/dist/structure/StructureInfoPane.svelte.d.ts +19 -0
- package/dist/structure/StructureScene.svelte +2255 -0
- package/dist/structure/StructureScene.svelte.d.ts +111 -0
- package/dist/structure/atom-properties.d.ts +37 -0
- package/dist/structure/atom-properties.js +200 -0
- package/dist/structure/bond-order-perception.d.ts +13 -0
- package/dist/structure/bond-order-perception.js +384 -0
- package/dist/structure/bonding.d.ts +68 -0
- package/dist/structure/bonding.js +696 -0
- package/dist/structure/export.d.ts +20 -0
- package/dist/structure/export.js +727 -0
- package/dist/structure/index.d.ts +126 -0
- package/dist/structure/index.js +169 -0
- package/dist/structure/label-placement.d.ts +14 -0
- package/dist/structure/label-placement.js +72 -0
- package/dist/structure/measure.d.ts +6 -0
- package/dist/structure/measure.js +29 -0
- package/dist/structure/parse.d.ts +66 -0
- package/dist/structure/parse.js +1392 -0
- package/dist/structure/partial-occupancy.d.ts +25 -0
- package/dist/structure/partial-occupancy.js +99 -0
- package/dist/structure/pbc.d.ts +9 -0
- package/dist/structure/pbc.js +123 -0
- package/dist/structure/supercell.d.ts +8 -0
- package/dist/structure/supercell.js +170 -0
- package/dist/structure/validation.d.ts +2 -0
- package/dist/structure/validation.js +10 -0
- package/dist/symmetry/SymmetryStats.svelte +226 -0
- package/dist/symmetry/SymmetryStats.svelte.d.ts +21 -0
- package/dist/symmetry/WyckoffTable.svelte +120 -0
- package/dist/symmetry/WyckoffTable.svelte.d.ts +11 -0
- package/dist/symmetry/cell-transform.d.ts +12 -0
- package/dist/symmetry/cell-transform.js +91 -0
- package/dist/symmetry/index.d.ts +43 -0
- package/dist/symmetry/index.js +228 -0
- package/dist/symmetry/spacegroups.d.ts +9 -0
- package/dist/symmetry/spacegroups.js +394 -0
- package/dist/table/HeatmapTable.svelte +1833 -0
- package/dist/table/HeatmapTable.svelte.d.ts +49 -0
- package/dist/table/ToggleMenu.svelte +385 -0
- package/dist/table/ToggleMenu.svelte.d.ts +11 -0
- package/dist/table/index.d.ts +74 -0
- package/dist/table/index.js +38 -0
- package/dist/theme/ThemeControl.svelte +53 -0
- package/dist/theme/ThemeControl.svelte.d.ts +9 -0
- package/dist/theme/index.d.ts +29 -0
- package/dist/theme/index.js +79 -0
- package/dist/time.d.ts +4 -0
- package/dist/time.js +70 -0
- package/dist/tooltip/TooltipContent.svelte +58 -0
- package/dist/tooltip/TooltipContent.svelte.d.ts +31 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tooltip/types.d.ts +8 -0
- package/dist/tooltip/types.js +1 -0
- package/dist/trajectory/Trajectory.svelte +1545 -0
- package/dist/trajectory/Trajectory.svelte.d.ts +77 -0
- package/dist/trajectory/TrajectoryError.svelte +128 -0
- package/dist/trajectory/TrajectoryError.svelte.d.ts +13 -0
- package/dist/trajectory/TrajectoryExportPane.svelte +357 -0
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +17 -0
- package/dist/trajectory/TrajectoryInfoPane.svelte +313 -0
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +17 -0
- package/dist/trajectory/constants.d.ts +6 -0
- package/dist/trajectory/constants.js +7 -0
- package/dist/trajectory/extract.d.ts +5 -0
- package/dist/trajectory/extract.js +162 -0
- package/dist/trajectory/format-detect.d.ts +9 -0
- package/dist/trajectory/format-detect.js +76 -0
- package/dist/trajectory/frame-reader.d.ts +17 -0
- package/dist/trajectory/frame-reader.js +332 -0
- package/dist/trajectory/helpers.d.ts +15 -0
- package/dist/trajectory/helpers.js +164 -0
- package/dist/trajectory/index.d.ts +63 -0
- package/dist/trajectory/index.js +126 -0
- package/dist/trajectory/parse/ase.d.ts +2 -0
- package/dist/trajectory/parse/ase.js +73 -0
- package/dist/trajectory/parse/hdf5.d.ts +2 -0
- package/dist/trajectory/parse/hdf5.js +127 -0
- package/dist/trajectory/parse/index.d.ts +12 -0
- package/dist/trajectory/parse/index.js +298 -0
- package/dist/trajectory/parse/lammps.d.ts +5 -0
- package/dist/trajectory/parse/lammps.js +179 -0
- package/dist/trajectory/parse/vasp.d.ts +2 -0
- package/dist/trajectory/parse/vasp.js +68 -0
- package/dist/trajectory/parse/xyz.d.ts +2 -0
- package/dist/trajectory/parse/xyz.js +110 -0
- package/dist/trajectory/plotting.d.ts +28 -0
- package/dist/trajectory/plotting.js +423 -0
- package/dist/trajectory/types.d.ts +11 -0
- package/dist/trajectory/types.js +1 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +45 -0
- package/dist/xrd/XrdPlot.svelte +615 -0
- package/dist/xrd/XrdPlot.svelte.d.ts +28 -0
- package/dist/xrd/broadening.d.ts +20 -0
- package/dist/xrd/broadening.js +97 -0
- package/dist/xrd/calc-xrd.d.ts +37 -0
- package/dist/xrd/calc-xrd.js +336 -0
- package/dist/xrd/index.d.ts +37 -0
- package/dist/xrd/index.js +4 -0
- package/dist/xrd/parse.d.ts +13 -0
- package/dist/xrd/parse.js +749 -0
- package/license +1 -1
- package/package.json +232 -1457
- package/readme.md +98 -171
- package/.vscode/launch.json +0 -13
- package/.vscodeignore +0 -7
- package/dist/assets/STLExporter-BpTH3YHE.js +0 -8
- package/dist/assets/browser-DdDecX_W.js +0 -1
- package/dist/assets/export-qgn-H9y6.js +0 -2
- package/dist/assets/main-DiKYzti2.css +0 -1
- package/dist/assets/moyo_wasm_bg-0ocwg7xY.wasm +0 -0
- package/dist/extension.js +0 -31293
- package/dist/src/lib/FilePicker.svelte +0 -360
- package/dist/src/lib/MillerIndexInput.svelte +0 -66
- package/dist/src/lib/api/mp.ts +0 -26
- package/dist/src/lib/api/optimade.ts +0 -204
- package/dist/src/lib/brillouin/BrillouinZone.svelte +0 -549
- package/dist/src/lib/brillouin/BrillouinZoneControls.svelte +0 -144
- package/dist/src/lib/brillouin/BrillouinZoneExportPane.svelte +0 -146
- package/dist/src/lib/brillouin/BrillouinZoneInfoPane.svelte +0 -146
- package/dist/src/lib/brillouin/BrillouinZoneScene.svelte +0 -476
- package/dist/src/lib/brillouin/BrillouinZoneTooltip.svelte +0 -92
- package/dist/src/lib/brillouin/compute.ts +0 -529
- package/dist/src/lib/brillouin/index.ts +0 -8
- package/dist/src/lib/brillouin/types.ts +0 -51
- package/dist/src/lib/chempot-diagram/ChemPotDiagram.svelte +0 -327
- package/dist/src/lib/chempot-diagram/ChemPotDiagram2D.svelte +0 -846
- package/dist/src/lib/chempot-diagram/ChemPotDiagram3D.svelte +0 -3193
- package/dist/src/lib/chempot-diagram/async-compute.svelte.ts +0 -94
- package/dist/src/lib/chempot-diagram/chempot-worker.ts +0 -11
- package/dist/src/lib/chempot-diagram/color.ts +0 -42
- package/dist/src/lib/chempot-diagram/compute.ts +0 -1014
- package/dist/src/lib/chempot-diagram/index.ts +0 -6
- package/dist/src/lib/chempot-diagram/pointer.ts +0 -56
- package/dist/src/lib/chempot-diagram/temperature.ts +0 -77
- package/dist/src/lib/chempot-diagram/types.ts +0 -130
- package/dist/src/lib/colors/index.ts +0 -249
- package/dist/src/lib/composition/BarChart.svelte +0 -297
- package/dist/src/lib/composition/BubbleChart.svelte +0 -218
- package/dist/src/lib/composition/Composition.svelte +0 -165
- package/dist/src/lib/composition/Formula.svelte +0 -268
- package/dist/src/lib/composition/FormulaFilter.svelte +0 -1257
- package/dist/src/lib/composition/PieChart.svelte +0 -323
- package/dist/src/lib/composition/format.ts +0 -155
- package/dist/src/lib/composition/index.ts +0 -37
- package/dist/src/lib/composition/parse.ts +0 -605
- package/dist/src/lib/constants.ts +0 -134
- package/dist/src/lib/controls.ts +0 -42
- package/dist/src/lib/convex-hull/ConvexHull.svelte +0 -157
- package/dist/src/lib/convex-hull/ConvexHull2D.svelte +0 -825
- package/dist/src/lib/convex-hull/ConvexHull3D.svelte +0 -1801
- package/dist/src/lib/convex-hull/ConvexHull4D.svelte +0 -1398
- package/dist/src/lib/convex-hull/ConvexHullControls.svelte +0 -535
- package/dist/src/lib/convex-hull/ConvexHullInfoPane.svelte +0 -125
- package/dist/src/lib/convex-hull/ConvexHullStats.svelte +0 -929
- package/dist/src/lib/convex-hull/ConvexHullTooltip.svelte +0 -131
- package/dist/src/lib/convex-hull/GasPressureControls.svelte +0 -247
- package/dist/src/lib/convex-hull/StructurePopup.svelte +0 -151
- package/dist/src/lib/convex-hull/barycentric-coords.ts +0 -246
- package/dist/src/lib/convex-hull/demo-temperature.ts +0 -63
- package/dist/src/lib/convex-hull/gas-thermodynamics.ts +0 -405
- package/dist/src/lib/convex-hull/helpers.ts +0 -932
- package/dist/src/lib/convex-hull/index.ts +0 -202
- package/dist/src/lib/convex-hull/thermodynamics.ts +0 -2192
- package/dist/src/lib/convex-hull/types.ts +0 -267
- package/dist/src/lib/coordination/CoordinationBarPlot.svelte +0 -311
- package/dist/src/lib/coordination/calc-coordination.ts +0 -93
- package/dist/src/lib/coordination/index.ts +0 -9
- package/dist/src/lib/effects.svelte.ts +0 -48
- package/dist/src/lib/element/ElementHeading.svelte +0 -26
- package/dist/src/lib/element/ElementPhoto.svelte +0 -57
- package/dist/src/lib/element/ElementStats.svelte +0 -80
- package/dist/src/lib/element/ElementTile.svelte +0 -484
- package/dist/src/lib/element/data.ts +0 -14
- package/dist/src/lib/element/index.ts +0 -8
- package/dist/src/lib/element/types.ts +0 -62
- package/dist/src/lib/feedback/ClickFeedback.svelte +0 -58
- package/dist/src/lib/feedback/DragOverlay.svelte +0 -42
- package/dist/src/lib/feedback/index.ts +0 -4
- package/dist/src/lib/fermi-surface/FermiSlice.svelte +0 -189
- package/dist/src/lib/fermi-surface/FermiSurface.svelte +0 -600
- package/dist/src/lib/fermi-surface/FermiSurfaceControls.svelte +0 -448
- package/dist/src/lib/fermi-surface/FermiSurfaceScene.svelte +0 -794
- package/dist/src/lib/fermi-surface/FermiSurfaceTooltip.svelte +0 -111
- package/dist/src/lib/fermi-surface/compute.ts +0 -728
- package/dist/src/lib/fermi-surface/constants.ts +0 -32
- package/dist/src/lib/fermi-surface/export.ts +0 -64
- package/dist/src/lib/fermi-surface/index.ts +0 -14
- package/dist/src/lib/fermi-surface/marching-cubes.ts +0 -3
- package/dist/src/lib/fermi-surface/parse.ts +0 -574
- package/dist/src/lib/fermi-surface/symmetry.ts +0 -56
- package/dist/src/lib/fermi-surface/types.ts +0 -159
- package/dist/src/lib/heatmap-matrix/HeatmapMatrix.svelte +0 -1545
- package/dist/src/lib/heatmap-matrix/HeatmapMatrixControls.svelte +0 -225
- package/dist/src/lib/heatmap-matrix/index.ts +0 -167
- package/dist/src/lib/heatmap-matrix/shared.ts +0 -7
- package/dist/src/lib/icons.ts +0 -650
- package/dist/src/lib/index.ts +0 -61
- package/dist/src/lib/io/decompress.ts +0 -92
- package/dist/src/lib/io/export.ts +0 -385
- package/dist/src/lib/io/fetch.ts +0 -46
- package/dist/src/lib/io/file-drop.ts +0 -51
- package/dist/src/lib/io/index.ts +0 -7
- package/dist/src/lib/io/is-binary.ts +0 -24
- package/dist/src/lib/io/types.ts +0 -8
- package/dist/src/lib/io/url-drop.ts +0 -141
- package/dist/src/lib/isosurface/Isosurface.svelte +0 -285
- package/dist/src/lib/isosurface/IsosurfaceControls.svelte +0 -277
- package/dist/src/lib/isosurface/index.ts +0 -7
- package/dist/src/lib/isosurface/parse.ts +0 -656
- package/dist/src/lib/isosurface/slice.ts +0 -175
- package/dist/src/lib/isosurface/types.ts +0 -309
- package/dist/src/lib/labels.ts +0 -320
- package/dist/src/lib/layout/FullscreenToggle.svelte +0 -50
- package/dist/src/lib/layout/InfoCard.svelte +0 -120
- package/dist/src/lib/layout/InfoTag.svelte +0 -185
- package/dist/src/lib/layout/PropertyFilter.svelte +0 -246
- package/dist/src/lib/layout/SettingsSection.svelte +0 -148
- package/dist/src/lib/layout/SubpageGrid.svelte +0 -82
- package/dist/src/lib/layout/fullscreen.ts +0 -65
- package/dist/src/lib/layout/index.ts +0 -11
- package/dist/src/lib/layout/json-tree/JsonNode.svelte +0 -548
- package/dist/src/lib/layout/json-tree/JsonTree.svelte +0 -1230
- package/dist/src/lib/layout/json-tree/index.ts +0 -3
- package/dist/src/lib/layout/json-tree/types.ts +0 -126
- package/dist/src/lib/layout/json-tree/utils.ts +0 -682
- package/dist/src/lib/marching-cubes.ts +0 -614
- package/dist/src/lib/math.ts +0 -1081
- package/dist/src/lib/overlays/ContextMenu.svelte +0 -162
- package/dist/src/lib/overlays/CopyButton.svelte +0 -45
- package/dist/src/lib/overlays/DragControlTab.svelte +0 -98
- package/dist/src/lib/overlays/DraggablePane.svelte +0 -487
- package/dist/src/lib/overlays/InfoPaneCards.svelte +0 -149
- package/dist/src/lib/overlays/index.ts +0 -3
- package/dist/src/lib/periodic-table/PeriodicTable.svelte +0 -469
- package/dist/src/lib/periodic-table/PeriodicTableControls.svelte +0 -557
- package/dist/src/lib/periodic-table/PropertySelect.svelte +0 -37
- package/dist/src/lib/periodic-table/index.ts +0 -12
- package/dist/src/lib/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +0 -1086
- package/dist/src/lib/phase-diagram/PhaseDiagramControls.svelte +0 -444
- package/dist/src/lib/phase-diagram/PhaseDiagramEditorPane.svelte +0 -126
- package/dist/src/lib/phase-diagram/PhaseDiagramExportPane.svelte +0 -184
- package/dist/src/lib/phase-diagram/PhaseDiagramTooltip.svelte +0 -391
- package/dist/src/lib/phase-diagram/TdbInfoPanel.svelte +0 -203
- package/dist/src/lib/phase-diagram/build-diagram.ts +0 -186
- package/dist/src/lib/phase-diagram/colors.ts +0 -58
- package/dist/src/lib/phase-diagram/diagram-input.ts +0 -40
- package/dist/src/lib/phase-diagram/index.ts +0 -13
- package/dist/src/lib/phase-diagram/parse.ts +0 -348
- package/dist/src/lib/phase-diagram/svg-to-diagram.ts +0 -1023
- package/dist/src/lib/phase-diagram/types.ts +0 -144
- package/dist/src/lib/phase-diagram/utils.ts +0 -775
- package/dist/src/lib/plot/AxisLabel.svelte +0 -51
- package/dist/src/lib/plot/BarPlot.svelte +0 -2113
- package/dist/src/lib/plot/BarPlotControls.svelte +0 -66
- package/dist/src/lib/plot/BinnedScatterPlot.svelte +0 -1114
- package/dist/src/lib/plot/ColorBar.svelte +0 -721
- package/dist/src/lib/plot/ColorScaleSelect.svelte +0 -54
- package/dist/src/lib/plot/ElementScatter.svelte +0 -63
- package/dist/src/lib/plot/Histogram.svelte +0 -1558
- package/dist/src/lib/plot/HistogramControls.svelte +0 -212
- package/dist/src/lib/plot/InteractiveAxisLabel.svelte +0 -96
- package/dist/src/lib/plot/Line.svelte +0 -84
- package/dist/src/lib/plot/PlotAxis.svelte +0 -169
- package/dist/src/lib/plot/PlotControls.svelte +0 -537
- package/dist/src/lib/plot/PlotLegend.svelte +0 -569
- package/dist/src/lib/plot/PlotTooltip.svelte +0 -67
- package/dist/src/lib/plot/PortalSelect.svelte +0 -253
- package/dist/src/lib/plot/ReferenceLine3D.svelte +0 -156
- package/dist/src/lib/plot/ReferencePlane.svelte +0 -175
- package/dist/src/lib/plot/ScatterPlot.svelte +0 -2778
- package/dist/src/lib/plot/ScatterPlot3D.svelte +0 -529
- package/dist/src/lib/plot/ScatterPlot3DControls.svelte +0 -437
- package/dist/src/lib/plot/ScatterPlot3DScene.svelte +0 -912
- package/dist/src/lib/plot/ScatterPlotControls.svelte +0 -306
- package/dist/src/lib/plot/ScatterPoint.svelte +0 -182
- package/dist/src/lib/plot/SpacegroupBarPlot.svelte +0 -293
- package/dist/src/lib/plot/Surface3D.svelte +0 -197
- package/dist/src/lib/plot/ZeroLines.svelte +0 -97
- package/dist/src/lib/plot/ZoomRect.svelte +0 -23
- package/dist/src/lib/plot/adaptive-density.ts +0 -316
- package/dist/src/lib/plot/auto-place.ts +0 -184
- package/dist/src/lib/plot/axis-utils.ts +0 -122
- package/dist/src/lib/plot/binned-scatter-types.ts +0 -83
- package/dist/src/lib/plot/data-cleaning.ts +0 -1069
- package/dist/src/lib/plot/data-transform.ts +0 -69
- package/dist/src/lib/plot/defaults.ts +0 -9
- package/dist/src/lib/plot/fill-utils.ts +0 -494
- package/dist/src/lib/plot/hover-lock.svelte.ts +0 -60
- package/dist/src/lib/plot/index.ts +0 -53
- package/dist/src/lib/plot/interactions.ts +0 -119
- package/dist/src/lib/plot/layout.ts +0 -425
- package/dist/src/lib/plot/reference-line.ts +0 -426
- package/dist/src/lib/plot/scales.ts +0 -654
- package/dist/src/lib/plot/svg.ts +0 -23
- package/dist/src/lib/plot/types.ts +0 -1144
- package/dist/src/lib/plot/utils/label-placement.ts +0 -541
- package/dist/src/lib/plot/utils/series-visibility.ts +0 -140
- package/dist/src/lib/plot/utils.ts +0 -11
- package/dist/src/lib/rdf/RdfPlot.svelte +0 -247
- package/dist/src/lib/rdf/calc-rdf.ts +0 -167
- package/dist/src/lib/rdf/index.ts +0 -27
- package/dist/src/lib/sanitize.ts +0 -126
- package/dist/src/lib/settings.ts +0 -1479
- package/dist/src/lib/spectral/Bands.svelte +0 -1040
- package/dist/src/lib/spectral/BandsAndDos.svelte +0 -134
- package/dist/src/lib/spectral/BrillouinBandsDos.svelte +0 -252
- package/dist/src/lib/spectral/Dos.svelte +0 -697
- package/dist/src/lib/spectral/helpers.ts +0 -1381
- package/dist/src/lib/spectral/index.ts +0 -8
- package/dist/src/lib/spectral/types.ts +0 -112
- package/dist/src/lib/state.svelte.ts +0 -64
- package/dist/src/lib/structure/Arrow.svelte +0 -72
- package/dist/src/lib/structure/AtomLegend.svelte +0 -815
- package/dist/src/lib/structure/Bond.svelte +0 -140
- package/dist/src/lib/structure/CanvasTooltip.svelte +0 -33
- package/dist/src/lib/structure/CellSelect.svelte +0 -349
- package/dist/src/lib/structure/Cylinder.svelte +0 -45
- package/dist/src/lib/structure/Lattice.svelte +0 -196
- package/dist/src/lib/structure/Structure.svelte +0 -2248
- package/dist/src/lib/structure/StructureControls.svelte +0 -1273
- package/dist/src/lib/structure/StructureExportPane.svelte +0 -252
- package/dist/src/lib/structure/StructureInfoPane.svelte +0 -737
- package/dist/src/lib/structure/StructureScene.svelte +0 -2255
- package/dist/src/lib/structure/atom-properties.ts +0 -316
- package/dist/src/lib/structure/bond-order-perception.ts +0 -447
- package/dist/src/lib/structure/bonding.ts +0 -944
- package/dist/src/lib/structure/export.ts +0 -861
- package/dist/src/lib/structure/index.ts +0 -291
- package/dist/src/lib/structure/label-placement.ts +0 -130
- package/dist/src/lib/structure/measure.ts +0 -45
- package/dist/src/lib/structure/parse.ts +0 -1705
- package/dist/src/lib/structure/partial-occupancy.ts +0 -183
- package/dist/src/lib/structure/pbc.ts +0 -164
- package/dist/src/lib/structure/supercell.ts +0 -226
- package/dist/src/lib/structure/validation.ts +0 -11
- package/dist/src/lib/symmetry/SymmetryStats.svelte +0 -226
- package/dist/src/lib/symmetry/WyckoffTable.svelte +0 -120
- package/dist/src/lib/symmetry/cell-transform.ts +0 -118
- package/dist/src/lib/symmetry/index.ts +0 -348
- package/dist/src/lib/symmetry/spacegroups.ts +0 -404
- package/dist/src/lib/table/HeatmapTable.svelte +0 -1833
- package/dist/src/lib/table/ToggleMenu.svelte +0 -385
- package/dist/src/lib/table/index.ts +0 -139
- package/dist/src/lib/theme/ThemeControl.svelte +0 -53
- package/dist/src/lib/theme/index.ts +0 -107
- package/dist/src/lib/time.ts +0 -71
- package/dist/src/lib/tooltip/TooltipContent.svelte +0 -58
- package/dist/src/lib/tooltip/index.ts +0 -2
- package/dist/src/lib/tooltip/types.ts +0 -13
- package/dist/src/lib/trajectory/Trajectory.svelte +0 -1545
- package/dist/src/lib/trajectory/TrajectoryError.svelte +0 -128
- package/dist/src/lib/trajectory/TrajectoryExportPane.svelte +0 -357
- package/dist/src/lib/trajectory/TrajectoryInfoPane.svelte +0 -313
- package/dist/src/lib/trajectory/constants.ts +0 -7
- package/dist/src/lib/trajectory/extract.ts +0 -196
- package/dist/src/lib/trajectory/format-detect.ts +0 -96
- package/dist/src/lib/trajectory/frame-reader.ts +0 -456
- package/dist/src/lib/trajectory/helpers.ts +0 -217
- package/dist/src/lib/trajectory/index.ts +0 -218
- package/dist/src/lib/trajectory/parse/ase.ts +0 -109
- package/dist/src/lib/trajectory/parse/hdf5.ts +0 -173
- package/dist/src/lib/trajectory/parse/index.ts +0 -411
- package/dist/src/lib/trajectory/parse/lammps.ts +0 -215
- package/dist/src/lib/trajectory/parse/vasp.ts +0 -102
- package/dist/src/lib/trajectory/parse/xyz.ts +0 -143
- package/dist/src/lib/trajectory/plotting.ts +0 -599
- package/dist/src/lib/trajectory/types.ts +0 -13
- package/dist/src/lib/utils.ts +0 -56
- package/dist/src/lib/xrd/XrdPlot.svelte +0 -615
- package/dist/src/lib/xrd/broadening.ts +0 -130
- package/dist/src/lib/xrd/calc-xrd.ts +0 -397
- package/dist/src/lib/xrd/index.ts +0 -38
- package/dist/src/lib/xrd/parse.ts +0 -858
- package/dist/webview.js +0 -29421
- package/icon.png +0 -0
- package/matterviz-0.3.2.vsix +0 -0
- package/matterviz-0.3.4.vsix +0 -0
- package/matterviz-0.3.5.vsix +0 -0
- package/scripts/sync-config.ts +0 -101
- package/src/declarations.d.ts +0 -2
- package/src/extension.ts +0 -972
- package/src/node-io.ts +0 -65
- package/src/types.ts +0 -17
- package/src/webview/JsonBrowser.svelte +0 -1079
- package/src/webview/PlotPanel.svelte +0 -346
- package/src/webview/detect.ts +0 -444
- package/src/webview/main.ts +0 -764
- package/src/webview/plot-utils.ts +0 -250
- package/test-fixtures/all-viz-types.json.gz +0 -0
- package/test-fixtures/plot-demo-data.json.gz +0 -0
- package/tests/detect.test.ts +0 -604
- package/tests/extension.test.ts +0 -2041
- package/tests/node-io.test.ts +0 -39
- package/tests/plot-utils.test.ts +0 -302
- package/tests/vite-plugin-json-gz.test.ts +0 -114
- package/tests/vscode-mock.ts +0 -18
- package/tests/webview.test.ts +0 -231
- package/tsconfig.json +0 -20
- package/vite-plugin-json-gz.ts +0 -29
- package/vite.config.ts +0 -34
- package/vite.extension.config.ts +0 -34
- /package/dist/{src/lib/EmptyState.svelte → EmptyState.svelte} +0 -0
- /package/dist/{src/lib/Icon.svelte → Icon.svelte} +0 -0
- /package/dist/{src/lib/app.css → app.css} +0 -0
- /package/dist/{src/lib/chempot-diagram → chempot-diagram}/ChemPotScene3D.svelte +0 -0
- /package/dist/{src/lib/colors → colors}/alloy-colors.json +0 -0
- /package/dist/{src/lib/colors → colors}/dark-mode-colors.json +0 -0
- /package/dist/{src/lib/colors → colors}/jmol-colors.json +0 -0
- /package/dist/{src/lib/colors → colors}/muted-colors.json +0 -0
- /package/dist/{src/lib/colors → colors}/pastel-colors.json +0 -0
- /package/dist/{src/lib/colors → colors}/vesta-colors.json +0 -0
- /package/dist/{src/lib/convex-hull → convex-hull}/TemperatureSlider.svelte +0 -0
- /package/dist/{src/lib/element → element}/BohrAtom.svelte +0 -0
- /package/dist/{src/lib/element → element}/Nucleus.svelte +0 -0
- /package/dist/{src/lib/element → element}/data.json +0 -0
- /package/dist/{src/lib/element → element}/data.json.gz +0 -0
- /package/dist/{src/lib/element → element}/data.json.gz.d.ts +0 -0
- /package/dist/{src/lib/element → element}/data.schema.json +0 -0
- /package/dist/{src/lib/element-image-urls.json → element-image-urls.json} +0 -0
- /package/dist/{src/lib/feedback → feedback}/Spinner.svelte +0 -0
- /package/dist/{src/lib/feedback → feedback}/StatusMessage.svelte +0 -0
- /package/dist/{src/lib/layout → layout}/json-tree/JsonValue.svelte +0 -0
- /package/dist/{src/lib/periodic-table → periodic-table}/TableInset.svelte +0 -0
- /package/dist/{src/lib/plot → plot}/FillArea.svelte +0 -0
- /package/dist/{src/lib/plot → plot}/ReferenceLine.svelte +0 -0
- /package/dist/{src/lib/theme → theme}/themes.mjs +0 -0
- /package/dist/{src/lib/xrd → xrd}/atomic_scattering_params.json +0 -0
|
@@ -1,1079 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// Split-pane JSON browser for the VS Code extension.
|
|
3
|
-
// Left sidebar shows a JsonTree for navigating the file's JSON structure.
|
|
4
|
-
// Right canvas renders one or more visualization panels in a split layout.
|
|
5
|
-
// Users can click tree nodes to render in the main panel, or drag nodes
|
|
6
|
-
// to specific edges to create horizontal/vertical splits.
|
|
7
|
-
import BrillouinZone from '$lib/brillouin/BrillouinZone.svelte'
|
|
8
|
-
import ConvexHull from '$lib/convex-hull/ConvexHull.svelte'
|
|
9
|
-
import type { PhaseData } from '$lib/convex-hull/types'
|
|
10
|
-
import FermiSurface from '$lib/fermi-surface/FermiSurface.svelte'
|
|
11
|
-
import { is_fermi_surface_data } from '$lib/fermi-surface/types'
|
|
12
|
-
import type { VolumetricData } from '$lib/isosurface/types'
|
|
13
|
-
import JsonTree from '$lib/layout/json-tree/JsonTree.svelte'
|
|
14
|
-
import IsobaricBinaryPhaseDiagram from '$lib/phase-diagram/IsobaricBinaryPhaseDiagram.svelte'
|
|
15
|
-
import type { PhaseDiagramData } from '$lib/phase-diagram/types'
|
|
16
|
-
import { merge, type DefaultSettings } from '$lib/settings'
|
|
17
|
-
import Bands from '$lib/spectral/Bands.svelte'
|
|
18
|
-
import BandsAndDos from '$lib/spectral/BandsAndDos.svelte'
|
|
19
|
-
import Dos from '$lib/spectral/Dos.svelte'
|
|
20
|
-
import type { BaseBandStructure, DosInput } from '$lib/spectral/types'
|
|
21
|
-
import type { AnyStructure, LatticeType } from '$lib/structure'
|
|
22
|
-
import {
|
|
23
|
-
is_optimade_raw,
|
|
24
|
-
normalize_fractional_coords,
|
|
25
|
-
parse_optimade_from_raw,
|
|
26
|
-
} from '$lib/structure/parse'
|
|
27
|
-
import Structure from '$lib/structure/Structure.svelte'
|
|
28
|
-
import type { XrdPattern } from '$lib/xrd'
|
|
29
|
-
import XrdPlot from '$lib/xrd/XrdPlot.svelte'
|
|
30
|
-
import { mount, unmount } from 'svelte'
|
|
31
|
-
import {
|
|
32
|
-
detect_view_type,
|
|
33
|
-
scan_renderable_paths,
|
|
34
|
-
TYPE_COLORS,
|
|
35
|
-
TYPE_LABELS,
|
|
36
|
-
} from './detect'
|
|
37
|
-
import type { RenderableType } from './detect'
|
|
38
|
-
import PlotPanel from './PlotPanel.svelte'
|
|
39
|
-
|
|
40
|
-
let {
|
|
41
|
-
value,
|
|
42
|
-
defaults,
|
|
43
|
-
filename,
|
|
44
|
-
}: {
|
|
45
|
-
value: unknown
|
|
46
|
-
defaults?: DefaultSettings
|
|
47
|
-
filename?: string
|
|
48
|
-
} = $props()
|
|
49
|
-
|
|
50
|
-
// === Panel state ===
|
|
51
|
-
// Each panel holds a mounted component. Panels are arranged in a flat list
|
|
52
|
-
// with split info (direction) between consecutive panels.
|
|
53
|
-
// Panel sizing is stored as a parallel array of flex weights.
|
|
54
|
-
interface PanelInfo {
|
|
55
|
-
id: string
|
|
56
|
-
data_path: string
|
|
57
|
-
detected_type: RenderableType
|
|
58
|
-
val: unknown
|
|
59
|
-
component: ReturnType<typeof mount> | null
|
|
60
|
-
element: HTMLElement | null
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
type SplitDirection = `horizontal` | `vertical`
|
|
64
|
-
|
|
65
|
-
let panels = $state<PanelInfo[]>([])
|
|
66
|
-
let panel_sizes = $state<number[]>([]) // flex weight per panel (parallel to panels[])
|
|
67
|
-
let split_directions = $state<SplitDirection[]>([]) // direction between panels[i] and panels[i+1]
|
|
68
|
-
|
|
69
|
-
// Debounce timer for rapid clicks (cleaned up when component is destroyed)
|
|
70
|
-
let select_timer: ReturnType<typeof setTimeout> | undefined
|
|
71
|
-
let destroyed = false
|
|
72
|
-
$effect(() => () => {
|
|
73
|
-
destroyed = true
|
|
74
|
-
if (select_timer) clearTimeout(select_timer)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
// Unmount all imperatively mounted panels when this component is destroyed
|
|
78
|
-
// (prevents leaked WebGL contexts, Three.js renderers, etc.)
|
|
79
|
-
$effect(() => () => {
|
|
80
|
-
for (let idx = 0; idx < panels.length; idx++) {
|
|
81
|
-
unmount_panel(idx)
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
// Scan for renderable paths asynchronously to avoid blocking the UI on large JSON files.
|
|
86
|
-
// Uses requestIdleCallback to yield to the main thread during tree rendering.
|
|
87
|
-
let renderable_paths = $state(new Map<string, { type: RenderableType; label: string }>())
|
|
88
|
-
let auto_rendered = false
|
|
89
|
-
$effect(() => {
|
|
90
|
-
const current_value = value
|
|
91
|
-
const idle_handle = requestIdleCallback(() => {
|
|
92
|
-
renderable_paths = scan_renderable_paths(current_value)
|
|
93
|
-
// Auto-render if the root value itself is a single renderable type
|
|
94
|
-
// (avoids forcing the user to click for single-type JSON files)
|
|
95
|
-
if (!auto_rendered && renderable_paths.has(``)) {
|
|
96
|
-
auto_rendered = true
|
|
97
|
-
const info = renderable_paths.get(``)
|
|
98
|
-
if (info) replace_or_add_panel(``, info.type, current_value)
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
return () => cancelIdleCallback(idle_handle)
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
// === Draggable sidebar divider ===
|
|
105
|
-
let sidebar_width = $state(320)
|
|
106
|
-
let is_sidebar_dragging = $state(false)
|
|
107
|
-
|
|
108
|
-
// Generic drag cleanup helper -- in a webview iframe the cursor can leave the
|
|
109
|
-
// document entirely, so we listen for mouseup, blur, and pointerleave to ensure
|
|
110
|
-
// the drag always terminates.
|
|
111
|
-
function start_drag(on_move: (event: MouseEvent) => void, on_done: () => void): void {
|
|
112
|
-
let cleaned_up = false
|
|
113
|
-
function cleanup(): void {
|
|
114
|
-
if (cleaned_up) return
|
|
115
|
-
cleaned_up = true
|
|
116
|
-
on_done()
|
|
117
|
-
globalThis.removeEventListener(`mousemove`, on_move)
|
|
118
|
-
globalThis.removeEventListener(`mouseup`, cleanup)
|
|
119
|
-
globalThis.removeEventListener(`blur`, cleanup)
|
|
120
|
-
document.documentElement.removeEventListener(`mouseleave`, cleanup)
|
|
121
|
-
}
|
|
122
|
-
globalThis.addEventListener(`mousemove`, on_move)
|
|
123
|
-
globalThis.addEventListener(`mouseup`, cleanup)
|
|
124
|
-
globalThis.addEventListener(`blur`, cleanup)
|
|
125
|
-
document.documentElement.addEventListener(`mouseleave`, cleanup)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function on_sidebar_divider_mousedown(event: MouseEvent): void {
|
|
129
|
-
event.preventDefault()
|
|
130
|
-
is_sidebar_dragging = true
|
|
131
|
-
const start_x = event.clientX
|
|
132
|
-
const start_width = sidebar_width
|
|
133
|
-
start_drag(
|
|
134
|
-
(move_event) => {
|
|
135
|
-
const delta = move_event.clientX - start_x
|
|
136
|
-
sidebar_width = Math.max(150, Math.min(start_width + delta, window.innerWidth * 0.6))
|
|
137
|
-
},
|
|
138
|
-
() => {
|
|
139
|
-
is_sidebar_dragging = false
|
|
140
|
-
},
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// === Drag-and-drop from tree ===
|
|
145
|
-
let drop_zone = $state<`top` | `bottom` | `left` | `right` | `center` | null>(null)
|
|
146
|
-
let drop_target_panel_idx = $state<number>(-1)
|
|
147
|
-
let canvas_element: HTMLElement | undefined = $state()
|
|
148
|
-
|
|
149
|
-
let sidebar_element: HTMLElement | undefined = $state()
|
|
150
|
-
|
|
151
|
-
// Strip internal suffix used to register multiple renderable types at the same path
|
|
152
|
-
function strip_type_suffix(path: string): string {
|
|
153
|
-
const idx = path.indexOf(`\x00`)
|
|
154
|
-
return idx >= 0 ? path.slice(0, idx) : path
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Convert a data path (relative to JSON root) to the tree path used by JsonTree
|
|
158
|
-
function data_to_tree_path(data_path: string): string {
|
|
159
|
-
const clean = strip_type_suffix(data_path)
|
|
160
|
-
return filename ? (clean ? `${filename}.${clean}` : filename) : clean
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Build a map of tree paths that are renderable (for fast draggable lookup).
|
|
164
|
-
// Skip synthetic suffix paths (\x00...) since those have their own badge drag handlers.
|
|
165
|
-
let renderable_tree_paths = $derived(
|
|
166
|
-
new Map(
|
|
167
|
-
[...renderable_paths]
|
|
168
|
-
.filter(([data_path]) => !data_path.includes(`\x00`))
|
|
169
|
-
.map(([data_path, info]) => [data_to_tree_path(data_path), { data_path, ...info }]),
|
|
170
|
-
),
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
// Mark renderable tree nodes as draggable via attribute (no per-node listeners)
|
|
174
|
-
function mark_draggable_nodes(): void {
|
|
175
|
-
if (!sidebar_element) return
|
|
176
|
-
for (const node of sidebar_element.querySelectorAll(`[data-path]`)) {
|
|
177
|
-
const el = node as HTMLElement
|
|
178
|
-
const tree_path = el.getAttribute(`data-path`) ?? ``
|
|
179
|
-
el.draggable = renderable_tree_paths.has(tree_path)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Single delegated dragstart handler on sidebar (no per-node listeners needed)
|
|
184
|
-
$effect(() => {
|
|
185
|
-
if (!sidebar_element) return
|
|
186
|
-
function on_dragstart(event: DragEvent): void {
|
|
187
|
-
if (!event.dataTransfer) {
|
|
188
|
-
event.preventDefault()
|
|
189
|
-
return
|
|
190
|
-
}
|
|
191
|
-
const origin = event.target
|
|
192
|
-
if (!(origin instanceof HTMLElement)) return
|
|
193
|
-
// If dragging a badge directly, use its own data attributes
|
|
194
|
-
const badge = origin.closest(`.renderable-badge`) as HTMLElement | null
|
|
195
|
-
if (badge) {
|
|
196
|
-
const data_path = badge.dataset.renderable_path ?? ``
|
|
197
|
-
const detected_type = badge.dataset.renderable_type ?? ``
|
|
198
|
-
event.dataTransfer.setData(`text/plain`, JSON.stringify({ data_path, detected_type }))
|
|
199
|
-
event.dataTransfer.effectAllowed = `copy`
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
// Otherwise dragging a tree node -- look up from tree path
|
|
203
|
-
const target = origin.closest(`[data-path]`) as HTMLElement | null
|
|
204
|
-
if (!target) return
|
|
205
|
-
const tree_path = target.getAttribute(`data-path`) ?? ``
|
|
206
|
-
const info = renderable_tree_paths.get(tree_path)
|
|
207
|
-
if (!info) {
|
|
208
|
-
event.preventDefault()
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
event.dataTransfer.setData(
|
|
212
|
-
`text/plain`,
|
|
213
|
-
JSON.stringify({ data_path: info.data_path, detected_type: info.type }),
|
|
214
|
-
)
|
|
215
|
-
event.dataTransfer.effectAllowed = `copy`
|
|
216
|
-
}
|
|
217
|
-
sidebar_element.addEventListener(`dragstart`, on_dragstart)
|
|
218
|
-
return () => sidebar_element?.removeEventListener(`dragstart`, on_dragstart)
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
// === Badge injection ===
|
|
222
|
-
function apply_badges(): void {
|
|
223
|
-
if (!sidebar_element || renderable_paths.size === 0) return
|
|
224
|
-
for (const existing of sidebar_element.querySelectorAll(`.renderable-badge`)) {
|
|
225
|
-
existing.remove()
|
|
226
|
-
}
|
|
227
|
-
for (const [data_path, info] of renderable_paths) {
|
|
228
|
-
const node = sidebar_element.querySelector(
|
|
229
|
-
`[data-path="${CSS.escape(data_to_tree_path(data_path))}"]`,
|
|
230
|
-
)
|
|
231
|
-
if (!node) continue
|
|
232
|
-
const colon_el = node.querySelector(`.colon`)
|
|
233
|
-
const insert_after = colon_el ?? node.querySelector(`.node-key`) ?? node
|
|
234
|
-
const badge = document.createElement(`span`)
|
|
235
|
-
badge.className = `renderable-badge`
|
|
236
|
-
badge.textContent = info.label
|
|
237
|
-
badge.title = `Drag to canvas or click to render`
|
|
238
|
-
badge.dataset.renderable_path = data_path
|
|
239
|
-
badge.dataset.renderable_type = info.type
|
|
240
|
-
badge.style.background = TYPE_COLORS[info.type]
|
|
241
|
-
badge.draggable = true
|
|
242
|
-
insert_after.after(badge)
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Delegated click handler for badges (avoids per-badge listeners that leak on re-render)
|
|
247
|
-
// Uses capture phase to intercept before tree node fold/select handlers
|
|
248
|
-
$effect(() => {
|
|
249
|
-
if (!sidebar_element) return
|
|
250
|
-
function on_badge_click(event: MouseEvent): void {
|
|
251
|
-
const origin = event.target
|
|
252
|
-
if (!(origin instanceof HTMLElement)) return
|
|
253
|
-
const badge = origin.closest(`.renderable-badge`) as HTMLElement | null
|
|
254
|
-
if (!badge) return
|
|
255
|
-
event.stopPropagation()
|
|
256
|
-
event.preventDefault()
|
|
257
|
-
const raw_path = badge.dataset.renderable_path ?? ``
|
|
258
|
-
const data_path = strip_type_suffix(raw_path)
|
|
259
|
-
const detected_type = badge.dataset.renderable_type
|
|
260
|
-
if (!detected_type || !(detected_type in TYPE_LABELS)) return
|
|
261
|
-
const val = resolve_path(value, data_path)
|
|
262
|
-
if (val !== undefined)
|
|
263
|
-
replace_or_add_panel(data_path, detected_type as RenderableType, val)
|
|
264
|
-
}
|
|
265
|
-
sidebar_element.addEventListener(`click`, on_badge_click, true)
|
|
266
|
-
return () => sidebar_element?.removeEventListener(`click`, on_badge_click, true)
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
// Escape key closes all panels, returning to the overview
|
|
270
|
-
$effect(() => {
|
|
271
|
-
if (panels.length === 0) return
|
|
272
|
-
function on_keydown(event: KeyboardEvent): void {
|
|
273
|
-
if (event.key !== `Escape`) return
|
|
274
|
-
const target = event.target
|
|
275
|
-
if (
|
|
276
|
-
target instanceof HTMLElement &&
|
|
277
|
-
[`INPUT`, `SELECT`, `TEXTAREA`].includes(target.tagName)
|
|
278
|
-
) return
|
|
279
|
-
close_all_panels()
|
|
280
|
-
}
|
|
281
|
-
globalThis.addEventListener(`keydown`, on_keydown)
|
|
282
|
-
return () => globalThis.removeEventListener(`keydown`, on_keydown)
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
// Re-apply badges + draggable attributes when tree DOM changes.
|
|
286
|
-
// Guard with a flag so our own badge DOM mutations don't re-trigger the observer,
|
|
287
|
-
// and coalesce rapid mutations into a single rAF.
|
|
288
|
-
let applying_badges = false
|
|
289
|
-
$effect(() => {
|
|
290
|
-
if (!sidebar_element) return
|
|
291
|
-
let pending_raf: number | null = null
|
|
292
|
-
function schedule_refresh(): void {
|
|
293
|
-
if (pending_raf) return
|
|
294
|
-
pending_raf = requestAnimationFrame(() => {
|
|
295
|
-
pending_raf = null
|
|
296
|
-
if (applying_badges) return
|
|
297
|
-
applying_badges = true
|
|
298
|
-
try {
|
|
299
|
-
apply_badges()
|
|
300
|
-
mark_draggable_nodes()
|
|
301
|
-
} finally {
|
|
302
|
-
applying_badges = false
|
|
303
|
-
}
|
|
304
|
-
})
|
|
305
|
-
}
|
|
306
|
-
schedule_refresh()
|
|
307
|
-
const observer = new MutationObserver(schedule_refresh)
|
|
308
|
-
observer.observe(sidebar_element, { childList: true, subtree: true })
|
|
309
|
-
return () => {
|
|
310
|
-
observer.disconnect()
|
|
311
|
-
if (pending_raf) cancelAnimationFrame(pending_raf)
|
|
312
|
-
}
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
// === Panel management ===
|
|
316
|
-
|
|
317
|
-
const make_panel_id = (): string => `panel_${crypto.randomUUID()}`
|
|
318
|
-
|
|
319
|
-
// Click replaces the single/first panel; drag adds a split
|
|
320
|
-
function replace_or_add_panel(
|
|
321
|
-
data_path: string,
|
|
322
|
-
detected_type: RenderableType,
|
|
323
|
-
val: unknown,
|
|
324
|
-
): void {
|
|
325
|
-
if (panels.length === 0) {
|
|
326
|
-
panels = [
|
|
327
|
-
{ id: make_panel_id(), data_path, detected_type, val, component: null, element: null },
|
|
328
|
-
]
|
|
329
|
-
panel_sizes = [1]
|
|
330
|
-
} else {
|
|
331
|
-
unmount_panel(0)
|
|
332
|
-
panels[0] = {
|
|
333
|
-
id: make_panel_id(),
|
|
334
|
-
data_path,
|
|
335
|
-
detected_type,
|
|
336
|
-
val,
|
|
337
|
-
component: null,
|
|
338
|
-
element: null,
|
|
339
|
-
}
|
|
340
|
-
panels = [...panels] // trigger reactivity
|
|
341
|
-
}
|
|
342
|
-
requestAnimationFrame(() => mount_all_panels())
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function add_panel_with_split(
|
|
346
|
-
data_path: string,
|
|
347
|
-
detected_type: RenderableType,
|
|
348
|
-
val: unknown,
|
|
349
|
-
target_idx: number,
|
|
350
|
-
zone: `top` | `bottom` | `left` | `right`,
|
|
351
|
-
): void {
|
|
352
|
-
const new_panel: PanelInfo = {
|
|
353
|
-
id: make_panel_id(),
|
|
354
|
-
data_path,
|
|
355
|
-
detected_type,
|
|
356
|
-
val,
|
|
357
|
-
component: null,
|
|
358
|
-
element: null,
|
|
359
|
-
}
|
|
360
|
-
const direction: SplitDirection =
|
|
361
|
-
zone === `top` || zone === `bottom` ? `vertical` : `horizontal`
|
|
362
|
-
const insert_before = zone === `top` || zone === `left`
|
|
363
|
-
|
|
364
|
-
if (panels.length === 0) {
|
|
365
|
-
panels = [new_panel]
|
|
366
|
-
panel_sizes = [1]
|
|
367
|
-
} else {
|
|
368
|
-
const new_panels = [...panels]
|
|
369
|
-
const new_sizes = [...panel_sizes]
|
|
370
|
-
const new_dirs = [...split_directions]
|
|
371
|
-
const insert_idx = insert_before ? target_idx : target_idx + 1
|
|
372
|
-
// Split the target panel's size in half: new panel gets half, target keeps half
|
|
373
|
-
const target_size = new_sizes[target_idx] ?? 1
|
|
374
|
-
new_sizes[target_idx] = target_size / 2
|
|
375
|
-
new_panels.splice(insert_idx, 0, new_panel)
|
|
376
|
-
new_sizes.splice(insert_idx, 0, target_size / 2)
|
|
377
|
-
// Add direction between the two panels
|
|
378
|
-
new_dirs.splice(target_idx, 0, direction)
|
|
379
|
-
panels = new_panels
|
|
380
|
-
panel_sizes = new_sizes
|
|
381
|
-
split_directions = new_dirs
|
|
382
|
-
}
|
|
383
|
-
requestAnimationFrame(() => mount_all_panels())
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function close_panel(idx: number): void {
|
|
387
|
-
unmount_panel(idx)
|
|
388
|
-
const new_panels = [...panels]
|
|
389
|
-
const new_sizes = [...panel_sizes]
|
|
390
|
-
const new_dirs = [...split_directions]
|
|
391
|
-
// Give the closed panel's size to its neighbor
|
|
392
|
-
const closed_size = new_sizes[idx] ?? 0
|
|
393
|
-
const neighbor_idx = idx > 0 ? idx - 1 : idx + 1
|
|
394
|
-
if (neighbor_idx < new_sizes.length) new_sizes[neighbor_idx] += closed_size
|
|
395
|
-
new_panels.splice(idx, 1)
|
|
396
|
-
new_sizes.splice(idx, 1)
|
|
397
|
-
// Remove the adjacent split direction
|
|
398
|
-
if (new_dirs.length > 0) {
|
|
399
|
-
const dir_idx = Math.min(idx, new_dirs.length - 1)
|
|
400
|
-
new_dirs.splice(dir_idx, 1)
|
|
401
|
-
}
|
|
402
|
-
panels = new_panels
|
|
403
|
-
panel_sizes = new_sizes
|
|
404
|
-
split_directions = new_dirs
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
function close_all_panels(): void {
|
|
408
|
-
for (let idx = panels.length - 1; idx >= 0; idx--) unmount_panel(idx)
|
|
409
|
-
panels = []
|
|
410
|
-
panel_sizes = []
|
|
411
|
-
split_directions = []
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
function unmount_panel(idx: number): void {
|
|
415
|
-
const panel = panels[idx]
|
|
416
|
-
if (panel?.component) {
|
|
417
|
-
try {
|
|
418
|
-
unmount(panel.component)
|
|
419
|
-
} catch (error) {
|
|
420
|
-
console.error(`JsonBrowser: unmount failed:`, error)
|
|
421
|
-
}
|
|
422
|
-
panel.component = null
|
|
423
|
-
}
|
|
424
|
-
if (panel?.element) panel.element.innerHTML = ``
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// === Component mounting ===
|
|
428
|
-
|
|
429
|
-
function prepare_structure(val: unknown): unknown {
|
|
430
|
-
if (is_optimade_raw(val)) {
|
|
431
|
-
const result = parse_optimade_from_raw(val)
|
|
432
|
-
if (result) return result
|
|
433
|
-
}
|
|
434
|
-
const record = val as Record<string, unknown>
|
|
435
|
-
if (Array.isArray(record.sites) && record.lattice) {
|
|
436
|
-
return normalize_fractional_coords(
|
|
437
|
-
val as Parameters<typeof normalize_fractional_coords>[0],
|
|
438
|
-
)
|
|
439
|
-
}
|
|
440
|
-
return val
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// Map user defaults to structure component props (mirrors main.ts structure_props)
|
|
444
|
-
function struct_props(merged: DefaultSettings): Record<string, unknown> {
|
|
445
|
-
const { structure } = merged
|
|
446
|
-
return {
|
|
447
|
-
scene_props: { ...structure, gizmo: structure.show_gizmo },
|
|
448
|
-
lattice_props: {
|
|
449
|
-
show_cell_vectors: structure.show_cell_vectors,
|
|
450
|
-
cell_edge_opacity: structure.cell_edge_opacity,
|
|
451
|
-
cell_surface_opacity: structure.cell_surface_opacity,
|
|
452
|
-
cell_edge_color: structure.cell_edge_color,
|
|
453
|
-
cell_surface_color: structure.cell_surface_color,
|
|
454
|
-
},
|
|
455
|
-
color_scheme: merged.color_scheme,
|
|
456
|
-
background_color: merged.background_color,
|
|
457
|
-
background_opacity: merged.background_opacity,
|
|
458
|
-
show_image_atoms: structure.show_image_atoms,
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// Merge defaults once (reused across all panel mounts)
|
|
463
|
-
const merged_defaults = $derived(merge(defaults))
|
|
464
|
-
const common_props = { fullscreen_toggle: false, style: `height:100%` }
|
|
465
|
-
|
|
466
|
-
function mount_into(
|
|
467
|
-
target: HTMLElement,
|
|
468
|
-
val: unknown,
|
|
469
|
-
detected_type: RenderableType,
|
|
470
|
-
panel_id?: string,
|
|
471
|
-
): ReturnType<typeof mount> | null {
|
|
472
|
-
const onclose =
|
|
473
|
-
panel_id !== undefined
|
|
474
|
-
? () => {
|
|
475
|
-
const idx = panels.findIndex((p) => p.id === panel_id)
|
|
476
|
-
if (idx < 0) return
|
|
477
|
-
if (panels.length > 1) close_panel(idx)
|
|
478
|
-
else close_all_panels()
|
|
479
|
-
}
|
|
480
|
-
: undefined
|
|
481
|
-
target.innerHTML = ``
|
|
482
|
-
// Force layout so Three.js gets real dimensions
|
|
483
|
-
void target.offsetHeight
|
|
484
|
-
|
|
485
|
-
const struct_common = {
|
|
486
|
-
allow_file_drop: false,
|
|
487
|
-
enable_tips: false,
|
|
488
|
-
...struct_props(merged_defaults),
|
|
489
|
-
...common_props,
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
try {
|
|
493
|
-
if (detected_type === `structure`) {
|
|
494
|
-
return mount(Structure, {
|
|
495
|
-
target,
|
|
496
|
-
props: { structure: prepare_structure(val) as AnyStructure, ...struct_common },
|
|
497
|
-
})
|
|
498
|
-
} else if (detected_type === `fermi_surface` || detected_type === `band_grid`) {
|
|
499
|
-
const fermi_props: Record<string, unknown> = {
|
|
500
|
-
allow_file_drop: false,
|
|
501
|
-
...common_props,
|
|
502
|
-
}
|
|
503
|
-
if (is_fermi_surface_data(val as Parameters<typeof is_fermi_surface_data>[0]))
|
|
504
|
-
fermi_props.fermi_data = val
|
|
505
|
-
else fermi_props.band_data = val
|
|
506
|
-
return mount(FermiSurface, { target, props: fermi_props })
|
|
507
|
-
} else if (detected_type === `convex_hull`) {
|
|
508
|
-
return mount(ConvexHull, {
|
|
509
|
-
target,
|
|
510
|
-
props: { entries: val as PhaseData[], ...common_props },
|
|
511
|
-
})
|
|
512
|
-
} else if (detected_type === `phase_diagram`) {
|
|
513
|
-
return mount(IsobaricBinaryPhaseDiagram, {
|
|
514
|
-
target,
|
|
515
|
-
props: { data: val as PhaseDiagramData, ...common_props },
|
|
516
|
-
})
|
|
517
|
-
} else if (detected_type === `volumetric`) {
|
|
518
|
-
const vol_data = val as { lattice: LatticeType }
|
|
519
|
-
return mount(Structure, {
|
|
520
|
-
target,
|
|
521
|
-
props: {
|
|
522
|
-
structure: { sites: [], lattice: vol_data.lattice } as AnyStructure,
|
|
523
|
-
volumetric_data: [val as VolumetricData],
|
|
524
|
-
...struct_common,
|
|
525
|
-
},
|
|
526
|
-
})
|
|
527
|
-
} else if (detected_type === `bands_and_dos`) {
|
|
528
|
-
const data = val as Record<string, unknown>
|
|
529
|
-
// Support both { band_structure, dos } wrapper and combined-fields format
|
|
530
|
-
const band_data = (data.band_structure ?? val) as BaseBandStructure
|
|
531
|
-
const dos_data = (data.dos ?? val) as DosInput
|
|
532
|
-
return mount(BandsAndDos, {
|
|
533
|
-
target,
|
|
534
|
-
props: { band_structs: band_data, doses: dos_data, ...common_props },
|
|
535
|
-
})
|
|
536
|
-
} else if (detected_type === `band_structure`) {
|
|
537
|
-
return mount(Bands, {
|
|
538
|
-
target,
|
|
539
|
-
props: {
|
|
540
|
-
band_structs: val as BaseBandStructure,
|
|
541
|
-
...common_props,
|
|
542
|
-
padding: { b: 60 },
|
|
543
|
-
},
|
|
544
|
-
})
|
|
545
|
-
} else if (detected_type === `dos`) {
|
|
546
|
-
return mount(Dos, {
|
|
547
|
-
target,
|
|
548
|
-
props: { doses: val as DosInput, ...common_props, padding: { b: 60 } },
|
|
549
|
-
})
|
|
550
|
-
} else if (detected_type === `brillouin_zone`) {
|
|
551
|
-
const bz_val = val as Record<string, unknown>
|
|
552
|
-
const bz_props: Record<string, unknown> = { allow_file_drop: false, ...common_props }
|
|
553
|
-
if (bz_val.structure) bz_props.structure = prepare_structure(bz_val.structure)
|
|
554
|
-
// Pass pre-computed BZ data (vertices, faces, edges) if present
|
|
555
|
-
if (bz_val.vertices && bz_val.faces) bz_props.bz_data = bz_val
|
|
556
|
-
return mount(BrillouinZone, { target, props: bz_props })
|
|
557
|
-
} else if (detected_type === `xrd`) {
|
|
558
|
-
return mount(XrdPlot, {
|
|
559
|
-
target,
|
|
560
|
-
props: { patterns: val as XrdPattern, allow_file_drop: false, ...common_props },
|
|
561
|
-
})
|
|
562
|
-
} else if (detected_type === `table`) {
|
|
563
|
-
return mount(PlotPanel, {
|
|
564
|
-
target,
|
|
565
|
-
props: { data: val, initial_type: `table`, onclose, ...common_props },
|
|
566
|
-
})
|
|
567
|
-
} else if (detected_type === `plot`) {
|
|
568
|
-
return mount(PlotPanel, { target, props: { data: val, onclose, ...common_props } })
|
|
569
|
-
}
|
|
570
|
-
} catch (error) {
|
|
571
|
-
console.error(`JsonBrowser: mount failed for ${detected_type}:`, error)
|
|
572
|
-
}
|
|
573
|
-
return null
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
function mount_all_panels(): void {
|
|
577
|
-
for (let idx = 0; idx < panels.length; idx++) {
|
|
578
|
-
const panel = panels[idx]
|
|
579
|
-
if (panel.component) continue // already mounted
|
|
580
|
-
const el = document.getElementById(panel.id)
|
|
581
|
-
if (!el) continue
|
|
582
|
-
panel.element = el
|
|
583
|
-
panel.component = mount_into(el, panel.val, panel.detected_type, panel.id)
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// === Drop zone detection ===
|
|
588
|
-
|
|
589
|
-
function get_drop_zone(
|
|
590
|
-
event: DragEvent,
|
|
591
|
-
rect: DOMRect,
|
|
592
|
-
): `top` | `bottom` | `left` | `right` | `center` {
|
|
593
|
-
const rel_x = (event.clientX - rect.left) / rect.width
|
|
594
|
-
const rel_y = (event.clientY - rect.top) / rect.height
|
|
595
|
-
const edge_threshold = 0.25
|
|
596
|
-
if (rel_y < edge_threshold) return `top`
|
|
597
|
-
if (rel_y > 1 - edge_threshold) return `bottom`
|
|
598
|
-
if (rel_x < edge_threshold) return `left`
|
|
599
|
-
if (rel_x > 1 - edge_threshold) return `right`
|
|
600
|
-
return `center`
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
function on_canvas_dragover(event: DragEvent): void {
|
|
604
|
-
event.preventDefault()
|
|
605
|
-
if (event.dataTransfer) event.dataTransfer.dropEffect = `copy`
|
|
606
|
-
if (!canvas_element) return
|
|
607
|
-
// Default to center/first panel; override if cursor is inside a specific panel
|
|
608
|
-
drop_zone = `center`
|
|
609
|
-
drop_target_panel_idx = 0
|
|
610
|
-
const panel_els = canvas_element.querySelectorAll(`.viz-panel`)
|
|
611
|
-
for (let idx = 0; idx < panel_els.length; idx++) {
|
|
612
|
-
const rect = panel_els[idx].getBoundingClientRect()
|
|
613
|
-
if (
|
|
614
|
-
event.clientX >= rect.left &&
|
|
615
|
-
event.clientX <= rect.right &&
|
|
616
|
-
event.clientY >= rect.top &&
|
|
617
|
-
event.clientY <= rect.bottom
|
|
618
|
-
) {
|
|
619
|
-
drop_zone = get_drop_zone(event, rect)
|
|
620
|
-
drop_target_panel_idx = idx
|
|
621
|
-
break
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
// Prevent mixed-axis splits until nested layouts are supported
|
|
625
|
-
if (split_directions.length > 0) {
|
|
626
|
-
const layout = split_directions[0]
|
|
627
|
-
if (layout === `vertical` && (drop_zone === `left` || drop_zone === `right`)) {
|
|
628
|
-
drop_zone = `center`
|
|
629
|
-
} else if (layout === `horizontal` && (drop_zone === `top` || drop_zone === `bottom`)) {
|
|
630
|
-
drop_zone = `center`
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
function on_canvas_dragleave(event: DragEvent): void {
|
|
636
|
-
// Only clear if leaving the canvas entirely
|
|
637
|
-
if (canvas_element && !canvas_element.contains(event.relatedTarget as Node)) {
|
|
638
|
-
drop_zone = null
|
|
639
|
-
drop_target_panel_idx = -1
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
function on_canvas_drop(event: DragEvent): void {
|
|
644
|
-
event.preventDefault()
|
|
645
|
-
const raw = event.dataTransfer?.getData(`text/plain`)
|
|
646
|
-
// Capture the already-computed drop state before clearing it
|
|
647
|
-
const zone = drop_zone
|
|
648
|
-
const target_idx = Math.max(0, drop_target_panel_idx)
|
|
649
|
-
drop_zone = null
|
|
650
|
-
drop_target_panel_idx = -1
|
|
651
|
-
if (!raw) return
|
|
652
|
-
try {
|
|
653
|
-
const parsed = JSON.parse(raw) as { data_path: string; detected_type: RenderableType }
|
|
654
|
-
const data_path = strip_type_suffix(parsed.data_path)
|
|
655
|
-
const { detected_type } = parsed
|
|
656
|
-
if (!detected_type || !(detected_type in TYPE_LABELS)) return
|
|
657
|
-
const val = resolve_path(value, data_path)
|
|
658
|
-
if (val === undefined) return
|
|
659
|
-
if (panels.length === 0 || zone === `center` || !zone) {
|
|
660
|
-
replace_or_add_panel(data_path, detected_type, val)
|
|
661
|
-
} else {
|
|
662
|
-
add_panel_with_split(data_path, detected_type, val, target_idx, zone)
|
|
663
|
-
}
|
|
664
|
-
} catch (error) {
|
|
665
|
-
console.error(`JsonBrowser: drop failed:`, error)
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
// === Panel split divider dragging ===
|
|
670
|
-
let split_dragging_idx = $state(-1)
|
|
671
|
-
|
|
672
|
-
function on_split_divider_mousedown(event: MouseEvent, split_idx: number): void {
|
|
673
|
-
event.preventDefault()
|
|
674
|
-
split_dragging_idx = split_idx
|
|
675
|
-
const direction = split_directions[split_idx]
|
|
676
|
-
if (!direction) return
|
|
677
|
-
const panel_container = canvas_element?.querySelector(
|
|
678
|
-
`.panel-container`,
|
|
679
|
-
) as HTMLElement | null
|
|
680
|
-
if (!panel_container) return
|
|
681
|
-
const container_rect = panel_container.getBoundingClientRect()
|
|
682
|
-
|
|
683
|
-
const is_vertical = direction === `vertical`
|
|
684
|
-
const start_pos = is_vertical ? event.clientY : event.clientX
|
|
685
|
-
const container_size = is_vertical ? container_rect.height : container_rect.width
|
|
686
|
-
// Total flex of the two adjacent panels
|
|
687
|
-
const left_idx = split_idx
|
|
688
|
-
const right_idx = split_idx + 1
|
|
689
|
-
const total_flex = (panel_sizes[left_idx] ?? 1) + (panel_sizes[right_idx] ?? 1)
|
|
690
|
-
const start_left_size = panel_sizes[left_idx] ?? total_flex / 2
|
|
691
|
-
|
|
692
|
-
start_drag(
|
|
693
|
-
(move_event) => {
|
|
694
|
-
const current_pos = is_vertical ? move_event.clientY : move_event.clientX
|
|
695
|
-
const delta_fraction = (current_pos - start_pos) / container_size
|
|
696
|
-
const delta_flex = delta_fraction * total_flex
|
|
697
|
-
const new_left = Math.max(
|
|
698
|
-
total_flex * 0.1,
|
|
699
|
-
Math.min(total_flex * 0.9, start_left_size + delta_flex),
|
|
700
|
-
)
|
|
701
|
-
panel_sizes[left_idx] = new_left
|
|
702
|
-
panel_sizes[right_idx] = total_flex - new_left
|
|
703
|
-
},
|
|
704
|
-
() => {
|
|
705
|
-
split_dragging_idx = -1
|
|
706
|
-
},
|
|
707
|
-
)
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
// === Helpers ===
|
|
711
|
-
|
|
712
|
-
function strip_root_prefix(path: string): string {
|
|
713
|
-
if (!filename || !path.startsWith(filename)) return path
|
|
714
|
-
const stripped = path.slice(filename.length)
|
|
715
|
-
return stripped.startsWith(`.`) ? stripped.slice(1) : stripped
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
function handle_select(path: string, val: unknown): void {
|
|
719
|
-
const data_path = strip_root_prefix(path)
|
|
720
|
-
if (select_timer) clearTimeout(select_timer)
|
|
721
|
-
select_timer = setTimeout(() => {
|
|
722
|
-
if (destroyed) return // component was destroyed while timer was pending
|
|
723
|
-
const detected = detect_view_type(val)
|
|
724
|
-
if (detected) replace_or_add_panel(data_path, detected, val)
|
|
725
|
-
}, 150)
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
function resolve_path(root: unknown, path: string): unknown {
|
|
729
|
-
if (!path) return root
|
|
730
|
-
// Parse path segments: handles dotted keys like ["foo.bar"], array indices like [0],
|
|
731
|
-
// and regular dotted paths like a.b.c
|
|
732
|
-
const segments: string[] = []
|
|
733
|
-
const segment_re = /\["([^"]+)"\]|\[(\d+)\]|([^.[\]]+)/g
|
|
734
|
-
let match: RegExpExecArray | null
|
|
735
|
-
while ((match = segment_re.exec(path)) !== null) {
|
|
736
|
-
segments.push(match[1] ?? match[2] ?? match[3])
|
|
737
|
-
}
|
|
738
|
-
let current: unknown = root
|
|
739
|
-
for (const segment of segments) {
|
|
740
|
-
if (current === null || current === undefined || typeof current !== `object`)
|
|
741
|
-
return undefined
|
|
742
|
-
current = (current as Record<string, unknown>)[segment]
|
|
743
|
-
}
|
|
744
|
-
return current
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
// The first split direction determines the flex layout direction
|
|
748
|
-
let layout_direction = $derived(
|
|
749
|
-
split_directions.length > 0 ? split_directions[0] : `vertical`,
|
|
750
|
-
)
|
|
751
|
-
|
|
752
|
-
const type_color = (key: string) => TYPE_COLORS[key as RenderableType] ?? `#888`
|
|
753
|
-
</script>
|
|
754
|
-
|
|
755
|
-
{#snippet type_list(header: string, extra_style?: string)}
|
|
756
|
-
<div class="type-list" style={extra_style ?? ``}>
|
|
757
|
-
<p class="type-list-header">{header}</p>
|
|
758
|
-
{#each Object.entries(TYPE_LABELS) as [type_key, label] (type_key)}
|
|
759
|
-
<span class="type-tag" style="border-color: {type_color(type_key)}44;">
|
|
760
|
-
<span class="chip-dot" style="background: {type_color(type_key)};"></span>
|
|
761
|
-
{label}
|
|
762
|
-
</span>
|
|
763
|
-
{/each}
|
|
764
|
-
</div>
|
|
765
|
-
{/snippet}
|
|
766
|
-
|
|
767
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
768
|
-
<div class="json-browser" class:dragging={is_sidebar_dragging || split_dragging_idx >= 0}>
|
|
769
|
-
<aside class="sidebar" bind:this={sidebar_element} style="width: {sidebar_width}px">
|
|
770
|
-
<JsonTree
|
|
771
|
-
{value}
|
|
772
|
-
root_label={filename}
|
|
773
|
-
default_fold_level={1}
|
|
774
|
-
onselect={handle_select}
|
|
775
|
-
show_header
|
|
776
|
-
/>
|
|
777
|
-
</aside>
|
|
778
|
-
|
|
779
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
780
|
-
<div class="divider sidebar-divider" onmousedown={on_sidebar_divider_mousedown}></div>
|
|
781
|
-
|
|
782
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
783
|
-
<div
|
|
784
|
-
class="canvas"
|
|
785
|
-
bind:this={canvas_element}
|
|
786
|
-
ondragover={on_canvas_dragover}
|
|
787
|
-
ondragleave={on_canvas_dragleave}
|
|
788
|
-
ondrop={on_canvas_drop}
|
|
789
|
-
>
|
|
790
|
-
{#if panels.length === 0}
|
|
791
|
-
<!-- Placeholder when no panels -->
|
|
792
|
-
<div class="placeholder">
|
|
793
|
-
{#if renderable_paths.size === 0}
|
|
794
|
-
<p class="placeholder-title">No renderable data found</p>
|
|
795
|
-
<p class="placeholder-sub">
|
|
796
|
-
This JSON file doesn't contain recognized visualization data.
|
|
797
|
-
</p>
|
|
798
|
-
{@render type_list(`Recognized types:`)}
|
|
799
|
-
{:else}
|
|
800
|
-
<p class="placeholder-title">Click or drag a data node to visualize it</p>
|
|
801
|
-
<p class="placeholder-sub">
|
|
802
|
-
Found {renderable_paths.size} renderable item{renderable_paths.size === 1
|
|
803
|
-
? ``
|
|
804
|
-
: `s`}. Click to render, or drag to an edge to create a split view.
|
|
805
|
-
</p>
|
|
806
|
-
<div
|
|
807
|
-
style="margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;"
|
|
808
|
-
>
|
|
809
|
-
{#each [...renderable_paths] as [data_path, info] (data_path)}
|
|
810
|
-
<button
|
|
811
|
-
type="button"
|
|
812
|
-
class="renderable-chip"
|
|
813
|
-
style="background: {type_color(info.type)}22; border: 1px solid {type_color(
|
|
814
|
-
info.type,
|
|
815
|
-
)}66;"
|
|
816
|
-
onclick={() => {
|
|
817
|
-
const clean_path = strip_type_suffix(data_path)
|
|
818
|
-
const val = resolve_path(value, clean_path)
|
|
819
|
-
if (val !== undefined) {
|
|
820
|
-
replace_or_add_panel(clean_path, info.type, val)
|
|
821
|
-
}
|
|
822
|
-
}}
|
|
823
|
-
>
|
|
824
|
-
<span class="chip-dot" style="background: {type_color(info.type)};"></span>
|
|
825
|
-
{info.label}: <code>{strip_type_suffix(data_path) || `root`}</code>
|
|
826
|
-
</button>
|
|
827
|
-
{/each}
|
|
828
|
-
</div>
|
|
829
|
-
{@render type_list(`All recognized types:`, `margin-top: 20px`)}
|
|
830
|
-
{/if}
|
|
831
|
-
</div>
|
|
832
|
-
{:else}
|
|
833
|
-
<!-- Panel layout -->
|
|
834
|
-
<div
|
|
835
|
-
class="panel-container"
|
|
836
|
-
class:vertical={layout_direction === `vertical`}
|
|
837
|
-
class:horizontal={layout_direction === `horizontal`}
|
|
838
|
-
>
|
|
839
|
-
{#each panels as panel, idx (panel.id)}
|
|
840
|
-
{#if idx > 0 && split_directions[idx - 1]}
|
|
841
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
842
|
-
<div
|
|
843
|
-
class="split-divider"
|
|
844
|
-
class:vertical={split_directions[idx - 1] === `vertical`}
|
|
845
|
-
class:horizontal={split_directions[idx - 1] === `horizontal`}
|
|
846
|
-
class:active={split_dragging_idx === idx - 1}
|
|
847
|
-
onmousedown={(event) => on_split_divider_mousedown(event, idx - 1)}
|
|
848
|
-
></div>
|
|
849
|
-
{/if}
|
|
850
|
-
<div class="viz-panel" style="flex: {panel_sizes[idx] ?? 1}">
|
|
851
|
-
<div class="panel-mount" id={panel.id}></div>
|
|
852
|
-
<!-- Panel label -->
|
|
853
|
-
<div class="panel-label" style="background: {TYPE_COLORS[panel.detected_type]}cc;">
|
|
854
|
-
{TYPE_LABELS[panel.detected_type]}: {strip_type_suffix(panel.data_path)}
|
|
855
|
-
</div>
|
|
856
|
-
</div>
|
|
857
|
-
{/each}
|
|
858
|
-
</div>
|
|
859
|
-
{/if}
|
|
860
|
-
|
|
861
|
-
<!-- Drop zone overlay -->
|
|
862
|
-
{#if drop_zone && drop_zone !== `center`}
|
|
863
|
-
<div class="drop-indicator {drop_zone}"></div>
|
|
864
|
-
{/if}
|
|
865
|
-
</div>
|
|
866
|
-
</div>
|
|
867
|
-
|
|
868
|
-
<style>
|
|
869
|
-
.json-browser {
|
|
870
|
-
display: flex;
|
|
871
|
-
width: 100%;
|
|
872
|
-
height: 100%;
|
|
873
|
-
overflow: hidden;
|
|
874
|
-
background: var(--vscode-editor-background, #1e1e1e);
|
|
875
|
-
color: var(--vscode-editor-foreground, #d4d4d4);
|
|
876
|
-
}
|
|
877
|
-
.json-browser.dragging {
|
|
878
|
-
user-select: none;
|
|
879
|
-
}
|
|
880
|
-
.sidebar {
|
|
881
|
-
flex-shrink: 0;
|
|
882
|
-
min-width: 150px;
|
|
883
|
-
max-width: 60%;
|
|
884
|
-
overflow: auto;
|
|
885
|
-
padding: 4px;
|
|
886
|
-
}
|
|
887
|
-
.divider {
|
|
888
|
-
width: 5px;
|
|
889
|
-
flex-shrink: 0;
|
|
890
|
-
background: var(--vscode-panel-border, rgba(255, 255, 255, 0.1));
|
|
891
|
-
cursor: col-resize;
|
|
892
|
-
transition: background 0.15s;
|
|
893
|
-
}
|
|
894
|
-
.divider:hover,
|
|
895
|
-
.json-browser.dragging .sidebar-divider {
|
|
896
|
-
background: var(--vscode-focusBorder, #007fd4);
|
|
897
|
-
}
|
|
898
|
-
.canvas {
|
|
899
|
-
flex: 1;
|
|
900
|
-
height: 100%;
|
|
901
|
-
position: relative;
|
|
902
|
-
overflow: hidden;
|
|
903
|
-
min-width: 200px;
|
|
904
|
-
}
|
|
905
|
-
/* === Panel layout === */
|
|
906
|
-
.panel-container {
|
|
907
|
-
display: flex;
|
|
908
|
-
width: 100%;
|
|
909
|
-
height: 100%;
|
|
910
|
-
}
|
|
911
|
-
.panel-container.vertical {
|
|
912
|
-
flex-direction: column;
|
|
913
|
-
}
|
|
914
|
-
.panel-container.horizontal {
|
|
915
|
-
flex-direction: row;
|
|
916
|
-
}
|
|
917
|
-
.viz-panel {
|
|
918
|
-
position: relative;
|
|
919
|
-
overflow: hidden;
|
|
920
|
-
min-width: 100px;
|
|
921
|
-
min-height: 80px;
|
|
922
|
-
}
|
|
923
|
-
.panel-mount {
|
|
924
|
-
width: 100%;
|
|
925
|
-
height: 100%;
|
|
926
|
-
}
|
|
927
|
-
.panel-label {
|
|
928
|
-
position: absolute;
|
|
929
|
-
bottom: 4px;
|
|
930
|
-
left: 4px;
|
|
931
|
-
z-index: 10;
|
|
932
|
-
font-size: 10px;
|
|
933
|
-
padding: 2px 6px;
|
|
934
|
-
border-radius: 3px;
|
|
935
|
-
color: white;
|
|
936
|
-
opacity: 0.7;
|
|
937
|
-
pointer-events: none;
|
|
938
|
-
white-space: nowrap;
|
|
939
|
-
max-width: calc(100% - 16px);
|
|
940
|
-
overflow: hidden;
|
|
941
|
-
text-overflow: ellipsis;
|
|
942
|
-
}
|
|
943
|
-
/* === Split dividers === */
|
|
944
|
-
.split-divider {
|
|
945
|
-
flex-shrink: 0;
|
|
946
|
-
background: var(--vscode-panel-border, rgba(255, 255, 255, 0.15));
|
|
947
|
-
transition: background 0.15s;
|
|
948
|
-
z-index: 5;
|
|
949
|
-
}
|
|
950
|
-
.split-divider.vertical {
|
|
951
|
-
height: 5px;
|
|
952
|
-
cursor: row-resize;
|
|
953
|
-
}
|
|
954
|
-
.split-divider.horizontal {
|
|
955
|
-
width: 5px;
|
|
956
|
-
cursor: col-resize;
|
|
957
|
-
}
|
|
958
|
-
.split-divider:hover,
|
|
959
|
-
.split-divider.active {
|
|
960
|
-
background: var(--vscode-focusBorder, #007fd4);
|
|
961
|
-
}
|
|
962
|
-
/* === Drop zone indicators === */
|
|
963
|
-
.drop-indicator {
|
|
964
|
-
position: absolute;
|
|
965
|
-
background: rgba(0, 127, 212, 0.25);
|
|
966
|
-
border: 2px solid var(--vscode-focusBorder, #007fd4);
|
|
967
|
-
z-index: 20;
|
|
968
|
-
pointer-events: none;
|
|
969
|
-
transition: all 0.1s;
|
|
970
|
-
}
|
|
971
|
-
.drop-indicator.top {
|
|
972
|
-
top: 0;
|
|
973
|
-
left: 0;
|
|
974
|
-
right: 0;
|
|
975
|
-
height: 40%;
|
|
976
|
-
}
|
|
977
|
-
.drop-indicator.bottom {
|
|
978
|
-
bottom: 0;
|
|
979
|
-
left: 0;
|
|
980
|
-
right: 0;
|
|
981
|
-
height: 40%;
|
|
982
|
-
}
|
|
983
|
-
.drop-indicator.left {
|
|
984
|
-
top: 0;
|
|
985
|
-
left: 0;
|
|
986
|
-
bottom: 0;
|
|
987
|
-
width: 40%;
|
|
988
|
-
}
|
|
989
|
-
.drop-indicator.right {
|
|
990
|
-
top: 0;
|
|
991
|
-
right: 0;
|
|
992
|
-
bottom: 0;
|
|
993
|
-
width: 40%;
|
|
994
|
-
}
|
|
995
|
-
/* === Placeholder === */
|
|
996
|
-
.placeholder {
|
|
997
|
-
display: flex;
|
|
998
|
-
flex-direction: column;
|
|
999
|
-
align-items: center;
|
|
1000
|
-
justify-content: center;
|
|
1001
|
-
height: 100%;
|
|
1002
|
-
opacity: 0.8;
|
|
1003
|
-
padding: 2rem;
|
|
1004
|
-
text-align: center;
|
|
1005
|
-
}
|
|
1006
|
-
.placeholder-title {
|
|
1007
|
-
font-size: 16px;
|
|
1008
|
-
margin-bottom: 8px;
|
|
1009
|
-
font-weight: 500;
|
|
1010
|
-
}
|
|
1011
|
-
.placeholder-sub {
|
|
1012
|
-
font-size: 13px;
|
|
1013
|
-
opacity: 0.65;
|
|
1014
|
-
max-width: 400px;
|
|
1015
|
-
line-height: 1.5;
|
|
1016
|
-
}
|
|
1017
|
-
.type-list {
|
|
1018
|
-
margin-top: 16px;
|
|
1019
|
-
display: flex;
|
|
1020
|
-
flex-wrap: wrap;
|
|
1021
|
-
gap: 6px;
|
|
1022
|
-
justify-content: center;
|
|
1023
|
-
align-items: center;
|
|
1024
|
-
}
|
|
1025
|
-
.type-list-header {
|
|
1026
|
-
width: 100%;
|
|
1027
|
-
font-size: 11px;
|
|
1028
|
-
text-transform: uppercase;
|
|
1029
|
-
letter-spacing: 0.5px;
|
|
1030
|
-
opacity: 0.5;
|
|
1031
|
-
margin-bottom: 4px;
|
|
1032
|
-
}
|
|
1033
|
-
.type-tag {
|
|
1034
|
-
display: inline-flex;
|
|
1035
|
-
align-items: center;
|
|
1036
|
-
gap: 5px;
|
|
1037
|
-
padding: 3px 8px;
|
|
1038
|
-
border-radius: 10px;
|
|
1039
|
-
font-size: 11px;
|
|
1040
|
-
border: 1px solid;
|
|
1041
|
-
opacity: 0.7;
|
|
1042
|
-
}
|
|
1043
|
-
.renderable-chip {
|
|
1044
|
-
display: inline-flex;
|
|
1045
|
-
align-items: center;
|
|
1046
|
-
gap: 6px;
|
|
1047
|
-
padding: 4px 10px;
|
|
1048
|
-
border-radius: 12px;
|
|
1049
|
-
font-size: 12px;
|
|
1050
|
-
cursor: pointer;
|
|
1051
|
-
color: inherit;
|
|
1052
|
-
transition: opacity 0.15s;
|
|
1053
|
-
}
|
|
1054
|
-
.renderable-chip:hover {
|
|
1055
|
-
opacity: 0.8;
|
|
1056
|
-
}
|
|
1057
|
-
.renderable-chip code {
|
|
1058
|
-
font-size: 11px;
|
|
1059
|
-
opacity: 0.8;
|
|
1060
|
-
}
|
|
1061
|
-
.chip-dot {
|
|
1062
|
-
width: 8px;
|
|
1063
|
-
height: 8px;
|
|
1064
|
-
border-radius: 50%;
|
|
1065
|
-
flex-shrink: 0;
|
|
1066
|
-
}
|
|
1067
|
-
/* Badges are injected imperatively — use :global so Svelte doesn't strip the rule */
|
|
1068
|
-
:global(.renderable-badge) {
|
|
1069
|
-
font-size: 9px;
|
|
1070
|
-
padding: 1px 4px;
|
|
1071
|
-
margin-left: 4px;
|
|
1072
|
-
border-radius: 3px;
|
|
1073
|
-
color: white;
|
|
1074
|
-
font-weight: 500;
|
|
1075
|
-
white-space: nowrap;
|
|
1076
|
-
cursor: grab;
|
|
1077
|
-
flex-shrink: 0;
|
|
1078
|
-
}
|
|
1079
|
-
</style>
|