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
package/src/extension.ts
DELETED
|
@@ -1,972 +0,0 @@
|
|
|
1
|
-
import { COMPRESSION_EXTENSIONS_REGEX } from '$lib/constants'
|
|
2
|
-
import { detect_compression_format } from '$lib/io/decompress'
|
|
3
|
-
import { format_bytes } from '$lib/labels'
|
|
4
|
-
import { DEFAULTS, type DefaultSettings, merge } from '$lib/settings'
|
|
5
|
-
import { is_structure_file } from '$lib/structure/parse'
|
|
6
|
-
import { AUTO_THEME, COLOR_THEMES, is_valid_theme_mode, type ThemeName } from '$lib/theme'
|
|
7
|
-
import type { FrameLoader } from '$lib/trajectory'
|
|
8
|
-
import {
|
|
9
|
-
create_frame_loader,
|
|
10
|
-
is_trajectory_file,
|
|
11
|
-
parse_trajectory_async,
|
|
12
|
-
} from '$lib/trajectory/parse'
|
|
13
|
-
import { Buffer } from 'node:buffer'
|
|
14
|
-
import * as fs from 'node:fs'
|
|
15
|
-
import * as os from 'node:os'
|
|
16
|
-
import * as path from 'node:path'
|
|
17
|
-
import * as vscode from 'vscode'
|
|
18
|
-
import pkg_json from '../package.json' with { type: 'json' }
|
|
19
|
-
import { stream_file_to_buffer } from './node-io'
|
|
20
|
-
import type { ViewType } from './types'
|
|
21
|
-
import { FERMI_FILE_RE, VOLUMETRIC_EXT_RE, VOLUMETRIC_VASP_RE } from './types'
|
|
22
|
-
|
|
23
|
-
interface FrameLoaderData {
|
|
24
|
-
loader: FrameLoader
|
|
25
|
-
file_data: ArrayBuffer
|
|
26
|
-
filename: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// WebviewLike and ExtensionContextLike are unions to allow both real vscode types and mock types for testing
|
|
30
|
-
type WebviewLike =
|
|
31
|
-
| vscode.Webview
|
|
32
|
-
| {
|
|
33
|
-
cspSource: string
|
|
34
|
-
asWebviewUri: (uri: { fsPath: string }) => string | { toString(): string }
|
|
35
|
-
onDidReceiveMessage: (listener: (message: unknown) => void) => { dispose(): void } | void
|
|
36
|
-
postMessage: (message: unknown) => Promise<boolean> | void
|
|
37
|
-
html: string
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type ExtensionContextLike =
|
|
41
|
-
| vscode.ExtensionContext
|
|
42
|
-
| {
|
|
43
|
-
extensionUri: { fsPath: string }
|
|
44
|
-
subscriptions: { dispose(): void }[]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface FileData {
|
|
48
|
-
filename: string
|
|
49
|
-
content: string
|
|
50
|
-
is_base64: boolean // content is base64-encoded (binary or compressed)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface WebviewData {
|
|
54
|
-
type: ViewType
|
|
55
|
-
data: FileData
|
|
56
|
-
theme: ThemeName
|
|
57
|
-
defaults?: DefaultSettings
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type IncomingCommand =
|
|
61
|
-
| `info`
|
|
62
|
-
| `error`
|
|
63
|
-
| `request_large_file`
|
|
64
|
-
| `request_frame`
|
|
65
|
-
| `saveAs`
|
|
66
|
-
| `startWatching`
|
|
67
|
-
| `stopWatching`
|
|
68
|
-
|
|
69
|
-
export interface MessageData {
|
|
70
|
-
command: IncomingCommand
|
|
71
|
-
text?: string
|
|
72
|
-
filename?: string
|
|
73
|
-
file_size?: number
|
|
74
|
-
content?: string
|
|
75
|
-
is_binary?: boolean
|
|
76
|
-
file_path?: string
|
|
77
|
-
// Add frame loading support
|
|
78
|
-
request_id?: string
|
|
79
|
-
frame_index?: number
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
type WatcherMeta = { request_id?: string; filename?: string; frame_index?: number }
|
|
83
|
-
|
|
84
|
-
// Track active file watchers by file path
|
|
85
|
-
export const active_watchers = new Map<string, vscode.FileSystemWatcher>()
|
|
86
|
-
// Track active frame loaders by file path
|
|
87
|
-
export const active_frame_loaders = new Map<string, FrameLoaderData>()
|
|
88
|
-
// Track auto-render timers to clear them on deactivate
|
|
89
|
-
export const auto_render_timers = new Map<string, ReturnType<typeof setTimeout>>()
|
|
90
|
-
// Track active panels by URI to prevent duplicate opens
|
|
91
|
-
export const active_auto_render_panels = new Map<string, vscode.WebviewPanel>()
|
|
92
|
-
|
|
93
|
-
let wasm_filename_cache: string | null = null
|
|
94
|
-
|
|
95
|
-
function get_wasm_filename(ext_path: string): string | null {
|
|
96
|
-
if (wasm_filename_cache) return wasm_filename_cache
|
|
97
|
-
const assets_dir = path.join(ext_path, `dist`, `assets`)
|
|
98
|
-
|
|
99
|
-
// In tests, the assets directory might not exist
|
|
100
|
-
if (!fs.existsSync(assets_dir)) {
|
|
101
|
-
console.warn(`Assets directory not found: ${assets_dir}`)
|
|
102
|
-
return null
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const wasm_file = fs
|
|
106
|
-
.readdirSync(assets_dir)
|
|
107
|
-
.find((file: string) => file.startsWith(`moyo_wasm_bg-`) && file.endsWith(`.wasm`))
|
|
108
|
-
if (!wasm_file) {
|
|
109
|
-
console.warn(`moyo-wasm not found in ${assets_dir}`)
|
|
110
|
-
return null
|
|
111
|
-
}
|
|
112
|
-
wasm_filename_cache = wasm_file
|
|
113
|
-
return wasm_file
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// File size thresholds for reading files via VSCode API (1GB for both text and binary)
|
|
117
|
-
const MAX_VSCODE_FILE_SIZE = 1024 * 1024 * 1024 // 1GB
|
|
118
|
-
|
|
119
|
-
const normalize_browser_supported_filename = (filename: string): string | null => {
|
|
120
|
-
const format = detect_compression_format(filename)
|
|
121
|
-
if (!format) return filename
|
|
122
|
-
if ([`zip`, `xz`, `bz2`].includes(format)) return null
|
|
123
|
-
return filename.replace(COMPRESSION_EXTENSIONS_REGEX, ``)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Helper: determine view type using content when available
|
|
127
|
-
const infer_view_type = (file: FileData): ViewType => {
|
|
128
|
-
// Strip only browser-supported compression extensions before matching.
|
|
129
|
-
const name = normalize_browser_supported_filename(file.filename.toLowerCase())
|
|
130
|
-
if (name && FERMI_FILE_RE.test(name)) return `fermi_surface`
|
|
131
|
-
if (name && (VOLUMETRIC_EXT_RE.test(name) || VOLUMETRIC_VASP_RE.test(name))) {
|
|
132
|
-
return `isosurface`
|
|
133
|
-
}
|
|
134
|
-
// Only pass content for text files; for binary (compressed) fall back to filename
|
|
135
|
-
const content = file.is_base64 ? undefined : file.content
|
|
136
|
-
if (is_trajectory_file(file.filename, content)) return `trajectory`
|
|
137
|
-
return `structure`
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Check if a file should be auto-rendered
|
|
141
|
-
export const should_auto_render = (filename: string): boolean => {
|
|
142
|
-
if (!filename || typeof filename !== `string`) return false
|
|
143
|
-
// Strip only browser-supported compression extensions so unsupported
|
|
144
|
-
// compressed files are not advertised as auto-renderable.
|
|
145
|
-
const name = normalize_browser_supported_filename(path.basename(filename))
|
|
146
|
-
if (name === null) return false
|
|
147
|
-
if (FERMI_FILE_RE.test(name)) return true
|
|
148
|
-
if (VOLUMETRIC_EXT_RE.test(name) || VOLUMETRIC_VASP_RE.test(name)) return true
|
|
149
|
-
// Structure and trajectory files (existing behavior)
|
|
150
|
-
return is_structure_file(filename) || is_trajectory_file(filename)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Update the shared VS Code context for supported resources
|
|
154
|
-
const update_supported_resource_context = (uri?: vscode.Uri): void => {
|
|
155
|
-
// Prefer explicit URI; otherwise fall back to the active editor filename
|
|
156
|
-
const filename = uri?.fsPath
|
|
157
|
-
? path.basename(uri.fsPath)
|
|
158
|
-
: vscode.window.activeTextEditor?.document?.fileName
|
|
159
|
-
? path.basename(vscode.window.activeTextEditor.document.fileName)
|
|
160
|
-
: ``
|
|
161
|
-
const is_supported = should_auto_render(filename)
|
|
162
|
-
vscode.commands.executeCommand(`setContext`, `matterviz.supported_resource`, is_supported)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Read file from filesystem using VSCode API (works with remote SSH)
|
|
166
|
-
export const read_file = async (file_path: string): Promise<FileData> => {
|
|
167
|
-
const filename = path.basename(file_path)
|
|
168
|
-
const uri = vscode.Uri.file(file_path)
|
|
169
|
-
|
|
170
|
-
// Files we serialize as base64 for the webview (compressed OR binary)
|
|
171
|
-
const is_base64_payload =
|
|
172
|
-
COMPRESSION_EXTENSIONS_REGEX.test(filename) || /\.(traj|h5|hdf5)$/i.test(filename)
|
|
173
|
-
|
|
174
|
-
// Check file size to avoid loading huge files into memory
|
|
175
|
-
let file_size: number
|
|
176
|
-
try {
|
|
177
|
-
file_size = (await vscode.workspace.fs.stat(uri)).size
|
|
178
|
-
} catch (error) {
|
|
179
|
-
console.warn(`Failed to get file stats for ${filename}:`, error)
|
|
180
|
-
throw new Error(
|
|
181
|
-
`Failed to access file ${filename}: ${
|
|
182
|
-
error instanceof Error ? error.message : String(error)
|
|
183
|
-
}`,
|
|
184
|
-
{ cause: error },
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const threshold = MAX_VSCODE_FILE_SIZE
|
|
189
|
-
|
|
190
|
-
if (file_size > threshold) {
|
|
191
|
-
return {
|
|
192
|
-
filename,
|
|
193
|
-
content: `LARGE_FILE:${file_path}:${file_size}`,
|
|
194
|
-
is_base64: is_base64_payload, // NOTE: base64 payload (compressed or binary)
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// For normal-sized files, read using VSCode API
|
|
199
|
-
try {
|
|
200
|
-
const uint8array = await vscode.workspace.fs.readFile(uri)
|
|
201
|
-
const content = is_base64_payload
|
|
202
|
-
? Buffer.from(uint8array).toString(`base64`)
|
|
203
|
-
: Buffer.from(uint8array).toString(`utf8`)
|
|
204
|
-
return { filename, content, is_base64: is_base64_payload }
|
|
205
|
-
} catch (error) {
|
|
206
|
-
throw new Error(
|
|
207
|
-
`Failed to read file ${filename}: ${error instanceof Error ? error.message : String(error)}`,
|
|
208
|
-
{ cause: error },
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Get file data from URI or active editor
|
|
214
|
-
export const get_file = async (uri?: vscode.Uri): Promise<FileData> => {
|
|
215
|
-
if (uri) return await read_file(uri.fsPath)
|
|
216
|
-
|
|
217
|
-
if (vscode.window.activeTextEditor) {
|
|
218
|
-
const filename = path.basename(vscode.window.activeTextEditor.document.fileName)
|
|
219
|
-
const content = vscode.window.activeTextEditor.document.getText()
|
|
220
|
-
return { filename, content, is_base64: false }
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const active_tab = vscode.window.tabGroups.activeTabGroup.activeTab
|
|
224
|
-
if (
|
|
225
|
-
active_tab?.input &&
|
|
226
|
-
typeof active_tab.input === `object` &&
|
|
227
|
-
active_tab.input !== null &&
|
|
228
|
-
`uri` in active_tab.input
|
|
229
|
-
)
|
|
230
|
-
return await read_file((active_tab.input as { uri: vscode.Uri }).uri.fsPath)
|
|
231
|
-
|
|
232
|
-
throw new Error(`No file selected. MatterViz needs an active editor to know what to render.`)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Detect VSCode theme and user preference
|
|
236
|
-
export const get_theme = (): ThemeName => {
|
|
237
|
-
const config = vscode.workspace.getConfiguration(`matterviz`)
|
|
238
|
-
const theme_setting = config.get<string>(`theme`, AUTO_THEME)
|
|
239
|
-
|
|
240
|
-
// Validate theme setting
|
|
241
|
-
if (!is_valid_theme_mode(theme_setting)) {
|
|
242
|
-
console.warn(`Invalid theme setting: ${theme_setting}, falling back to auto`)
|
|
243
|
-
return get_system_theme()
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (theme_setting !== AUTO_THEME) return theme_setting // Handle manual theme selection
|
|
247
|
-
|
|
248
|
-
return get_system_theme() // Auto-detect from VSCode color theme
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// Get system theme based on VSCode's current color theme
|
|
252
|
-
const get_system_theme = (): ThemeName => {
|
|
253
|
-
const color_theme = vscode.window.activeColorTheme
|
|
254
|
-
|
|
255
|
-
// Map VSCode theme kind to our theme names
|
|
256
|
-
if (color_theme.kind === vscode.ColorThemeKind.Light) return COLOR_THEMES.light
|
|
257
|
-
else if (color_theme.kind === vscode.ColorThemeKind.Dark) return COLOR_THEMES.dark
|
|
258
|
-
else if (color_theme.kind === vscode.ColorThemeKind.HighContrast) {
|
|
259
|
-
return COLOR_THEMES.black
|
|
260
|
-
} else if (color_theme.kind === vscode.ColorThemeKind.HighContrastLight) {
|
|
261
|
-
return COLOR_THEMES.white
|
|
262
|
-
} else return COLOR_THEMES.light
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Settings reader with nested structure support and built-in error handling
|
|
266
|
-
export const get_defaults = (): DefaultSettings => {
|
|
267
|
-
try {
|
|
268
|
-
const config = vscode.workspace.getConfiguration(`matterviz`)
|
|
269
|
-
const user_settings: Partial<DefaultSettings> = {}
|
|
270
|
-
|
|
271
|
-
// Helper to read settings section
|
|
272
|
-
const read_section = (
|
|
273
|
-
section_key: keyof DefaultSettings,
|
|
274
|
-
defaults_section: Record<string, unknown>,
|
|
275
|
-
) => {
|
|
276
|
-
const settings: Record<string, unknown> = {}
|
|
277
|
-
const section_config = config.get<Record<string, unknown>>(section_key, {})
|
|
278
|
-
for (const key of Object.keys(defaults_section)) {
|
|
279
|
-
const value = section_config?.[key]
|
|
280
|
-
if (value !== undefined) settings[key] = value
|
|
281
|
-
}
|
|
282
|
-
return Object.keys(settings).length > 0 ? settings : undefined
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Read all settings sections
|
|
286
|
-
// Top-level simple keys
|
|
287
|
-
const color_scheme_val = config.get(`color_scheme`)
|
|
288
|
-
if (color_scheme_val !== undefined) {
|
|
289
|
-
user_settings.color_scheme = color_scheme_val as DefaultSettings[`color_scheme`]
|
|
290
|
-
}
|
|
291
|
-
const bg_color_val = config.get(`background_color`)
|
|
292
|
-
if (bg_color_val !== undefined) {
|
|
293
|
-
user_settings.background_color = bg_color_val as DefaultSettings[`background_color`]
|
|
294
|
-
}
|
|
295
|
-
const bg_opacity_val = config.get(`background_opacity`)
|
|
296
|
-
if (bg_opacity_val !== undefined) {
|
|
297
|
-
user_settings.background_opacity =
|
|
298
|
-
bg_opacity_val as DefaultSettings[`background_opacity`]
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const structure_settings = read_section(`structure`, DEFAULTS.structure)
|
|
302
|
-
if (structure_settings) {
|
|
303
|
-
user_settings.structure = structure_settings as DefaultSettings[`structure`]
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const trajectory_settings = read_section(`trajectory`, DEFAULTS.trajectory)
|
|
307
|
-
if (trajectory_settings) {
|
|
308
|
-
user_settings.trajectory = trajectory_settings as DefaultSettings[`trajectory`]
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const composition_settings = read_section(`composition`, DEFAULTS.composition)
|
|
312
|
-
if (composition_settings) {
|
|
313
|
-
user_settings.composition = composition_settings as DefaultSettings[`composition`]
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return merge(user_settings)
|
|
317
|
-
} catch (error) {
|
|
318
|
-
console.error(`Failed to get defaults:`, error)
|
|
319
|
-
return DEFAULTS
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Create HTML content for webview
|
|
324
|
-
export const create_html = (
|
|
325
|
-
webview: WebviewLike,
|
|
326
|
-
context: ExtensionContextLike,
|
|
327
|
-
data: WebviewData,
|
|
328
|
-
): string => {
|
|
329
|
-
const nonce = Math.random().toString(36).slice(2, 34)
|
|
330
|
-
const webview_uri = webview.asWebviewUri(
|
|
331
|
-
vscode.Uri.joinPath(context.extensionUri as vscode.Uri, `dist`, `webview.js`),
|
|
332
|
-
)
|
|
333
|
-
const js_uri = typeof webview_uri === `string` ? webview_uri : webview_uri.toString()
|
|
334
|
-
const assets_dir = path.join(context.extensionUri.fsPath, `dist`, `assets`)
|
|
335
|
-
const css_file = fs.existsSync(assets_dir)
|
|
336
|
-
? fs
|
|
337
|
-
.readdirSync(assets_dir)
|
|
338
|
-
.find((file) => file.startsWith(`main-`) && file.endsWith(`.css`))
|
|
339
|
-
: undefined
|
|
340
|
-
const css_href = css_file
|
|
341
|
-
? webview
|
|
342
|
-
.asWebviewUri(
|
|
343
|
-
vscode.Uri.joinPath(context.extensionUri as vscode.Uri, `dist`, `assets`, css_file),
|
|
344
|
-
)
|
|
345
|
-
.toString()
|
|
346
|
-
: undefined
|
|
347
|
-
|
|
348
|
-
// Resolve WASM URI for webview (enables symmetry analysis)
|
|
349
|
-
// Include in data object instead of global scope for cleaner functional approach
|
|
350
|
-
const wasm_filename = get_wasm_filename(context.extensionUri.fsPath)
|
|
351
|
-
let moyo_wasm_url: string | undefined
|
|
352
|
-
if (wasm_filename) {
|
|
353
|
-
const wasm_uri = webview.asWebviewUri(
|
|
354
|
-
vscode.Uri.joinPath(context.extensionUri as vscode.Uri, `dist`, `assets`, wasm_filename),
|
|
355
|
-
)
|
|
356
|
-
moyo_wasm_url = typeof wasm_uri === `string` ? wasm_uri : wasm_uri.toString()
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const webview_data = { ...data, moyo_wasm_url }
|
|
360
|
-
|
|
361
|
-
return `<!DOCTYPE html>
|
|
362
|
-
<html>
|
|
363
|
-
<head>
|
|
364
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${nonce}' 'unsafe-eval' 'wasm-unsafe-eval' ${webview.cspSource}; style-src 'unsafe-inline' ${webview.cspSource}; img-src ${webview.cspSource} data:; connect-src ${webview.cspSource}; worker-src blob:;">
|
|
365
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
366
|
-
${css_href ? `<link rel="stylesheet" href="${css_href}">` : ``}
|
|
367
|
-
<script nonce="${nonce}">
|
|
368
|
-
window.matterviz_data=${JSON.stringify(webview_data).replace(/<\//g, `<\\/`)};
|
|
369
|
-
</script>
|
|
370
|
-
</head>
|
|
371
|
-
<body>
|
|
372
|
-
<div id="matterviz-app"></div>
|
|
373
|
-
<script nonce="${nonce}" type="module">
|
|
374
|
-
await import(${JSON.stringify(js_uri)});
|
|
375
|
-
window.initializeMatterViz?.();
|
|
376
|
-
</script>
|
|
377
|
-
</body>
|
|
378
|
-
</html>`
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// Handle messages from webview
|
|
382
|
-
export const handle_msg = async (msg: MessageData, webview?: WebviewLike): Promise<void> => {
|
|
383
|
-
if (msg.command === `info` && msg.text) {
|
|
384
|
-
vscode.window.showInformationMessage(msg.text)
|
|
385
|
-
} else if (msg.command === `error` && msg.text) {
|
|
386
|
-
vscode.window.showErrorMessage(msg.text)
|
|
387
|
-
} else if (msg.command === `request_large_file` && msg.file_path && webview) {
|
|
388
|
-
// Handle large file by parsing with indexing and setting up frame loader
|
|
389
|
-
const command = `large_file_response`
|
|
390
|
-
try {
|
|
391
|
-
const { request_id, file_path } = msg
|
|
392
|
-
const filename = path.basename(file_path)
|
|
393
|
-
const array_buffer = await stream_file_to_buffer(file_path, (progress_data) => {
|
|
394
|
-
webview.postMessage({
|
|
395
|
-
command: `large_file_progress`,
|
|
396
|
-
request_id,
|
|
397
|
-
stage: `Reading file`,
|
|
398
|
-
progress: Math.round(progress_data.progress * 100),
|
|
399
|
-
})
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
// Parse with indexing and create frame loader
|
|
403
|
-
const parsed_trajectory = await parse_trajectory_async(
|
|
404
|
-
array_buffer,
|
|
405
|
-
filename,
|
|
406
|
-
undefined,
|
|
407
|
-
{
|
|
408
|
-
use_indexing: true,
|
|
409
|
-
extract_plot_metadata: true,
|
|
410
|
-
},
|
|
411
|
-
)
|
|
412
|
-
|
|
413
|
-
active_frame_loaders.set(file_path, {
|
|
414
|
-
loader: create_frame_loader(filename),
|
|
415
|
-
file_data: array_buffer,
|
|
416
|
-
filename,
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
webview.postMessage({
|
|
420
|
-
command,
|
|
421
|
-
request_id,
|
|
422
|
-
parsed_trajectory,
|
|
423
|
-
is_parsed: true,
|
|
424
|
-
supports_frame_streaming: true,
|
|
425
|
-
file_path,
|
|
426
|
-
})
|
|
427
|
-
} catch (error) {
|
|
428
|
-
const error_message = error instanceof Error ? error.message : String(error)
|
|
429
|
-
console.error(`Failed to setup indexed parsing:`, error_message)
|
|
430
|
-
const { request_id } = msg
|
|
431
|
-
webview.postMessage({ command, request_id, error: error_message })
|
|
432
|
-
}
|
|
433
|
-
} else if (msg.command === `request_frame` && msg.file_path && webview) {
|
|
434
|
-
try {
|
|
435
|
-
const { request_id, file_path, frame_index } = msg
|
|
436
|
-
if (
|
|
437
|
-
typeof request_id !== `string` ||
|
|
438
|
-
frame_index === undefined ||
|
|
439
|
-
!Number.isInteger(frame_index) ||
|
|
440
|
-
frame_index < 0
|
|
441
|
-
) {
|
|
442
|
-
throw new Error(`Invalid request_id or frame_index`)
|
|
443
|
-
}
|
|
444
|
-
const loader_data = active_frame_loaders.get(file_path)
|
|
445
|
-
if (!loader_data) throw new Error(`No frame loader found for file: ${file_path}`)
|
|
446
|
-
|
|
447
|
-
const frame = await loader_data.loader.load_frame(loader_data.file_data, frame_index)
|
|
448
|
-
const command = `frame_response`
|
|
449
|
-
webview.postMessage({ command, request_id, frame, frame_index })
|
|
450
|
-
} catch (error) {
|
|
451
|
-
const error_message = error instanceof Error ? error.message : String(error)
|
|
452
|
-
console.error(`Failed to load frame ${msg.frame_index}:`, error_message)
|
|
453
|
-
webview.postMessage({
|
|
454
|
-
command: `frame_response`,
|
|
455
|
-
request_id: msg.request_id ?? ``,
|
|
456
|
-
error: error_message,
|
|
457
|
-
frame_index: msg.frame_index,
|
|
458
|
-
})
|
|
459
|
-
}
|
|
460
|
-
} else if (msg.command === `saveAs` && msg.content) {
|
|
461
|
-
let is_binary_save = false
|
|
462
|
-
try {
|
|
463
|
-
const uri = await vscode.window.showSaveDialog({
|
|
464
|
-
defaultUri: vscode.Uri.file(msg.filename || `structure`),
|
|
465
|
-
filters: { Files: [`*`] },
|
|
466
|
-
})
|
|
467
|
-
|
|
468
|
-
if (uri && msg.content) {
|
|
469
|
-
if (msg.is_binary) {
|
|
470
|
-
is_binary_save = true
|
|
471
|
-
const base64_data = msg.content.replace(/^data:[^;]+;base64,/, ``)
|
|
472
|
-
if (!base64_data) throw new Error(`Invalid data URL: missing base64 data`)
|
|
473
|
-
await vscode.workspace.fs.writeFile(
|
|
474
|
-
uri,
|
|
475
|
-
Uint8Array.from(Buffer.from(base64_data, `base64`)),
|
|
476
|
-
)
|
|
477
|
-
} else {
|
|
478
|
-
await vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(msg.content))
|
|
479
|
-
}
|
|
480
|
-
vscode.window.showInformationMessage(`Saved: ${path.basename(uri.fsPath)}`)
|
|
481
|
-
}
|
|
482
|
-
} catch (error: unknown) {
|
|
483
|
-
const message = error instanceof Error ? error.message : String(error)
|
|
484
|
-
const error_type = is_binary_save ? `binary data` : `text file`
|
|
485
|
-
vscode.window.showErrorMessage(`Failed to save ${error_type}: ${message}`)
|
|
486
|
-
}
|
|
487
|
-
} else if (
|
|
488
|
-
msg.command === `startWatching` &&
|
|
489
|
-
webview &&
|
|
490
|
-
typeof msg.file_path === `string` &&
|
|
491
|
-
path.isAbsolute(msg.file_path)
|
|
492
|
-
) {
|
|
493
|
-
// Handle request to start watching a file
|
|
494
|
-
start_watching_file(msg.file_path, webview, {
|
|
495
|
-
request_id: msg.request_id,
|
|
496
|
-
filename: msg.filename,
|
|
497
|
-
frame_index: msg.frame_index,
|
|
498
|
-
})
|
|
499
|
-
} else if (msg.command === `stopWatching` && msg.file_path) {
|
|
500
|
-
// Handle request to stop watching a file
|
|
501
|
-
stop_watching_file(msg.file_path)
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// Start watching a file using VS Code's built-in file system watcher
|
|
506
|
-
function start_watching_file(
|
|
507
|
-
file_path: string,
|
|
508
|
-
webview: WebviewLike,
|
|
509
|
-
meta?: WatcherMeta,
|
|
510
|
-
): void {
|
|
511
|
-
try {
|
|
512
|
-
// Stop existing watcher for this file if any
|
|
513
|
-
stop_watching_file(file_path)
|
|
514
|
-
|
|
515
|
-
// Create a new file system watcher for this specific file
|
|
516
|
-
const watcher = vscode.workspace.createFileSystemWatcher(
|
|
517
|
-
new vscode.RelativePattern(
|
|
518
|
-
vscode.Uri.file(path.dirname(file_path)),
|
|
519
|
-
path.basename(file_path),
|
|
520
|
-
),
|
|
521
|
-
)
|
|
522
|
-
|
|
523
|
-
// Listen for file changes
|
|
524
|
-
watcher.onDidChange(() => {
|
|
525
|
-
handle_file_change(`change`, file_path, webview, meta)
|
|
526
|
-
})
|
|
527
|
-
|
|
528
|
-
// Listen for file deletion
|
|
529
|
-
watcher.onDidDelete(() => {
|
|
530
|
-
handle_file_change(`delete`, file_path, webview, meta)
|
|
531
|
-
stop_watching_file(file_path) // Clean up watcher
|
|
532
|
-
})
|
|
533
|
-
|
|
534
|
-
active_watchers.set(file_path, watcher)
|
|
535
|
-
} catch (error) {
|
|
536
|
-
console.error(`Failed to start watching file ${file_path}:`, error)
|
|
537
|
-
webview.postMessage({
|
|
538
|
-
command: `error`,
|
|
539
|
-
text: `Failed to start watching file: ${error}`,
|
|
540
|
-
})
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// Handle file change events from VS Code file system watcher
|
|
545
|
-
async function handle_file_change(
|
|
546
|
-
event_type: `change` | `delete`,
|
|
547
|
-
file_path: string,
|
|
548
|
-
webview: WebviewLike,
|
|
549
|
-
meta: WatcherMeta = {},
|
|
550
|
-
): Promise<void> {
|
|
551
|
-
if (event_type === `delete`) {
|
|
552
|
-
try {
|
|
553
|
-
// File was deleted - send notification
|
|
554
|
-
webview.postMessage({ command: `fileDeleted`, file_path, ...meta })
|
|
555
|
-
} catch (error) {
|
|
556
|
-
console.error(`[MatterViz] Failed to send fileDeleted message:`, error)
|
|
557
|
-
}
|
|
558
|
-
return
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
if (event_type === `change`) {
|
|
562
|
-
// File was changed - send updated content
|
|
563
|
-
try {
|
|
564
|
-
const updated_file = await read_file(file_path)
|
|
565
|
-
|
|
566
|
-
webview.postMessage({
|
|
567
|
-
command: `fileUpdated`,
|
|
568
|
-
file_path,
|
|
569
|
-
data: updated_file,
|
|
570
|
-
type: infer_view_type(updated_file),
|
|
571
|
-
theme: get_theme(),
|
|
572
|
-
...meta,
|
|
573
|
-
})
|
|
574
|
-
} catch (error) {
|
|
575
|
-
console.error(`[MatterViz] Failed to read updated file ${file_path}:`, error)
|
|
576
|
-
try {
|
|
577
|
-
webview.postMessage({
|
|
578
|
-
command: `error`,
|
|
579
|
-
text: `Failed to read updated file: ${error}`,
|
|
580
|
-
})
|
|
581
|
-
} catch (msgError) {
|
|
582
|
-
console.error(`[MatterViz] Failed to send error message:`, msgError)
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
// Stop watching a file and dispose the watcher
|
|
589
|
-
function stop_watching_file(file_path: string): void {
|
|
590
|
-
const watcher = active_watchers.get(file_path)
|
|
591
|
-
if (watcher) {
|
|
592
|
-
watcher.dispose()
|
|
593
|
-
active_watchers.delete(file_path)
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// Also clean up frame loader for this file
|
|
597
|
-
if (active_frame_loaders.has(file_path)) {
|
|
598
|
-
active_frame_loaders.delete(file_path)
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// Resolve which ViewColumn to use based on user settings and explicit override
|
|
603
|
-
function get_view_column(explicit?: vscode.ViewColumn): vscode.ViewColumn {
|
|
604
|
-
if (explicit !== undefined) return explicit
|
|
605
|
-
const open_beside = vscode.workspace.getConfiguration(`matterviz`).get(`open_beside`, false)
|
|
606
|
-
return open_beside ? vscode.ViewColumn.Beside : vscode.ViewColumn.Active
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// Create webview panel with common setup
|
|
610
|
-
function create_webview_panel(
|
|
611
|
-
context: vscode.ExtensionContext,
|
|
612
|
-
file_data: FileData,
|
|
613
|
-
file_path?: string,
|
|
614
|
-
view_column?: vscode.ViewColumn,
|
|
615
|
-
): vscode.WebviewPanel {
|
|
616
|
-
const panel = vscode.window.createWebviewPanel(
|
|
617
|
-
`matterviz`,
|
|
618
|
-
`MatterViz - ${file_data.filename}`,
|
|
619
|
-
get_view_column(view_column),
|
|
620
|
-
{
|
|
621
|
-
enableScripts: true,
|
|
622
|
-
retainContextWhenHidden: true,
|
|
623
|
-
localResourceRoots: [
|
|
624
|
-
vscode.Uri.joinPath(context.extensionUri, `dist`),
|
|
625
|
-
vscode.Uri.joinPath(context.extensionUri, `../../static`),
|
|
626
|
-
],
|
|
627
|
-
},
|
|
628
|
-
)
|
|
629
|
-
|
|
630
|
-
if (file_path) start_watching_file(file_path, panel.webview)
|
|
631
|
-
|
|
632
|
-
panel.webview.html = create_html(panel.webview, context, {
|
|
633
|
-
type: infer_view_type(file_data),
|
|
634
|
-
data: file_data,
|
|
635
|
-
theme: get_theme(),
|
|
636
|
-
defaults: get_defaults(),
|
|
637
|
-
})
|
|
638
|
-
|
|
639
|
-
panel.webview.onDidReceiveMessage(
|
|
640
|
-
(msg: MessageData) => handle_msg(msg, panel.webview),
|
|
641
|
-
undefined,
|
|
642
|
-
context.subscriptions,
|
|
643
|
-
)
|
|
644
|
-
|
|
645
|
-
// Theme change handling
|
|
646
|
-
const update_theme = async () => {
|
|
647
|
-
if (panel.visible) {
|
|
648
|
-
const current_file = file_path ? await read_file(file_path) : file_data
|
|
649
|
-
panel.webview.html = create_html(panel.webview, context, {
|
|
650
|
-
type: infer_view_type(current_file),
|
|
651
|
-
data: current_file,
|
|
652
|
-
theme: get_theme(),
|
|
653
|
-
defaults: get_defaults(),
|
|
654
|
-
})
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
const theme_listener = vscode.window.onDidChangeActiveColorTheme(update_theme)
|
|
659
|
-
const config_listener = vscode.workspace.onDidChangeConfiguration(
|
|
660
|
-
(event: vscode.ConfigurationChangeEvent) => {
|
|
661
|
-
if (event.affectsConfiguration(`matterviz`)) update_theme()
|
|
662
|
-
},
|
|
663
|
-
)
|
|
664
|
-
|
|
665
|
-
panel.onDidDispose(() => {
|
|
666
|
-
theme_listener.dispose()
|
|
667
|
-
config_listener.dispose()
|
|
668
|
-
if (file_path) stop_watching_file(file_path)
|
|
669
|
-
})
|
|
670
|
-
|
|
671
|
-
return panel
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
// Enhanced render function with file watching
|
|
675
|
-
export const render = async (
|
|
676
|
-
context: vscode.ExtensionContext,
|
|
677
|
-
uri?: vscode.Uri,
|
|
678
|
-
): Promise<void> => {
|
|
679
|
-
try {
|
|
680
|
-
const file = await get_file(uri)
|
|
681
|
-
const file_path = uri?.fsPath || vscode.window.activeTextEditor?.document.fileName
|
|
682
|
-
|
|
683
|
-
create_webview_panel(context, file, file_path)
|
|
684
|
-
} catch (error: unknown) {
|
|
685
|
-
const message = error instanceof Error ? error.message : String(error)
|
|
686
|
-
vscode.window.showErrorMessage(`Failed: ${message}`)
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
// Custom editor provider for MatterViz files
|
|
691
|
-
class Provider implements vscode.CustomReadonlyEditorProvider<vscode.CustomDocument> {
|
|
692
|
-
constructor(private readonly context: vscode.ExtensionContext) {}
|
|
693
|
-
|
|
694
|
-
openCustomDocument(
|
|
695
|
-
uri: vscode.Uri,
|
|
696
|
-
_open_context: vscode.CustomDocumentOpenContext,
|
|
697
|
-
_token: vscode.CancellationToken,
|
|
698
|
-
): vscode.CustomDocument {
|
|
699
|
-
return {
|
|
700
|
-
uri,
|
|
701
|
-
dispose: () => {},
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
async resolveCustomEditor(
|
|
706
|
-
document: vscode.CustomDocument,
|
|
707
|
-
webview_panel: vscode.WebviewPanel,
|
|
708
|
-
_token: vscode.CancellationToken,
|
|
709
|
-
): Promise<void> {
|
|
710
|
-
try {
|
|
711
|
-
const file_path = document.uri.fsPath
|
|
712
|
-
|
|
713
|
-
webview_panel.webview.options = {
|
|
714
|
-
enableScripts: true,
|
|
715
|
-
localResourceRoots: [
|
|
716
|
-
vscode.Uri.joinPath(this.context.extensionUri, `dist`),
|
|
717
|
-
vscode.Uri.joinPath(this.context.extensionUri, `../../static`),
|
|
718
|
-
],
|
|
719
|
-
}
|
|
720
|
-
const current = await read_file(document.uri.fsPath)
|
|
721
|
-
webview_panel.webview.html = create_html(webview_panel.webview, this.context, {
|
|
722
|
-
type: infer_view_type(current),
|
|
723
|
-
data: current,
|
|
724
|
-
theme: get_theme(),
|
|
725
|
-
defaults: get_defaults(),
|
|
726
|
-
})
|
|
727
|
-
webview_panel.webview.onDidReceiveMessage(
|
|
728
|
-
(msg: MessageData) => handle_msg(msg, webview_panel.webview),
|
|
729
|
-
undefined,
|
|
730
|
-
this.context.subscriptions,
|
|
731
|
-
)
|
|
732
|
-
|
|
733
|
-
// Start watching the file immediately
|
|
734
|
-
start_watching_file(file_path, webview_panel.webview)
|
|
735
|
-
|
|
736
|
-
// Listen for theme changes and update webview
|
|
737
|
-
const update_theme = async () => {
|
|
738
|
-
if (webview_panel.visible) {
|
|
739
|
-
const current = await read_file(document.uri.fsPath)
|
|
740
|
-
webview_panel.webview.html = create_html(webview_panel.webview, this.context, {
|
|
741
|
-
type: infer_view_type(current),
|
|
742
|
-
data: current,
|
|
743
|
-
theme: get_theme(),
|
|
744
|
-
defaults: get_defaults(),
|
|
745
|
-
})
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
const theme_change_listener = vscode.window.onDidChangeActiveColorTheme(update_theme)
|
|
750
|
-
const config_change_listener = vscode.workspace.onDidChangeConfiguration(
|
|
751
|
-
(event: vscode.ConfigurationChangeEvent) => {
|
|
752
|
-
if (event.affectsConfiguration(`matterviz`)) update_theme()
|
|
753
|
-
},
|
|
754
|
-
)
|
|
755
|
-
|
|
756
|
-
// Dispose listeners when panel is closed
|
|
757
|
-
webview_panel.onDidDispose(() => {
|
|
758
|
-
theme_change_listener.dispose()
|
|
759
|
-
config_change_listener.dispose()
|
|
760
|
-
|
|
761
|
-
stop_watching_file(file_path) // Clean up file watcher
|
|
762
|
-
})
|
|
763
|
-
// Note: webview_panel disposal is managed by VSCode for custom editors
|
|
764
|
-
} catch (error: unknown) {
|
|
765
|
-
const message = error instanceof Error ? error.message : String(error)
|
|
766
|
-
vscode.window.showErrorMessage(`Failed: ${message}`)
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
// Activate extension
|
|
772
|
-
export const activate = (context: vscode.ExtensionContext) => {
|
|
773
|
-
console.info(`MatterViz extension activated (v${pkg_json.version})`)
|
|
774
|
-
|
|
775
|
-
// Set initial context for currently active editor
|
|
776
|
-
update_supported_resource_context(vscode.window.activeTextEditor?.document.uri)
|
|
777
|
-
|
|
778
|
-
context.subscriptions.push(
|
|
779
|
-
vscode.commands.registerCommand(`matterviz.open`, (uri?: vscode.Uri) =>
|
|
780
|
-
render(context, uri),
|
|
781
|
-
),
|
|
782
|
-
vscode.commands.registerCommand(`matterviz.report_bug`, report_bug),
|
|
783
|
-
vscode.window.registerCustomEditorProvider(`matterviz.viewer`, new Provider(context), {
|
|
784
|
-
webviewOptions: { retainContextWhenHidden: true },
|
|
785
|
-
}),
|
|
786
|
-
vscode.workspace.onDidOpenTextDocument((document: vscode.TextDocument) => {
|
|
787
|
-
// Update context on any document open
|
|
788
|
-
update_supported_resource_context(document.uri)
|
|
789
|
-
if (
|
|
790
|
-
document.uri.scheme === `file` &&
|
|
791
|
-
should_auto_render(path.basename(document.uri.fsPath))
|
|
792
|
-
) {
|
|
793
|
-
const file_path = document.uri.fsPath
|
|
794
|
-
|
|
795
|
-
// Clear existing timer and reveal existing panel if present
|
|
796
|
-
const existing_timer = auto_render_timers.get(file_path)
|
|
797
|
-
if (existing_timer) {
|
|
798
|
-
clearTimeout(existing_timer)
|
|
799
|
-
auto_render_timers.delete(file_path)
|
|
800
|
-
}
|
|
801
|
-
if (active_auto_render_panels.has(file_path)) {
|
|
802
|
-
active_auto_render_panels.get(file_path)?.reveal(vscode.ViewColumn.One)
|
|
803
|
-
return
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
const timer = setTimeout(async () => {
|
|
807
|
-
try {
|
|
808
|
-
if (!vscode.workspace.getConfiguration(`matterviz`).get(`auto_render`, true))
|
|
809
|
-
return
|
|
810
|
-
const panel = create_webview_panel(
|
|
811
|
-
context,
|
|
812
|
-
await read_file(file_path),
|
|
813
|
-
file_path,
|
|
814
|
-
vscode.ViewColumn.One,
|
|
815
|
-
)
|
|
816
|
-
active_auto_render_panels.set(file_path, panel)
|
|
817
|
-
panel.onDidDispose(() => active_auto_render_panels.delete(file_path))
|
|
818
|
-
} catch (error: unknown) {
|
|
819
|
-
console.error(`Error auto-rendering file:`, error)
|
|
820
|
-
vscode.window.showErrorMessage(`MatterViz auto-render failed: ${error}`)
|
|
821
|
-
} finally {
|
|
822
|
-
auto_render_timers.delete(file_path)
|
|
823
|
-
}
|
|
824
|
-
}, 100) // Small delay to allow VS Code to finish opening the document
|
|
825
|
-
|
|
826
|
-
auto_render_timers.set(file_path, timer)
|
|
827
|
-
}
|
|
828
|
-
}),
|
|
829
|
-
vscode.window.onDidChangeActiveTextEditor((editor: vscode.TextEditor | undefined) => {
|
|
830
|
-
update_supported_resource_context(editor?.document?.uri)
|
|
831
|
-
}),
|
|
832
|
-
)
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
// Collect debug information for bug reporting
|
|
836
|
-
async function collect_debug_info(): Promise<string> {
|
|
837
|
-
// Check if running remotely
|
|
838
|
-
const remote_name = vscode.env.remoteName
|
|
839
|
-
const is_remote = !!remote_name
|
|
840
|
-
const ui_kind = vscode.env.uiKind === vscode.UIKind.Desktop ? `Desktop` : `Web`
|
|
841
|
-
|
|
842
|
-
// Get information about active files being rendered
|
|
843
|
-
const active_files: {
|
|
844
|
-
filename: string
|
|
845
|
-
file_path: string
|
|
846
|
-
file_size?: number
|
|
847
|
-
has_watcher: boolean
|
|
848
|
-
has_frame_loader: boolean
|
|
849
|
-
}[] = []
|
|
850
|
-
|
|
851
|
-
// Collect file stats asynchronously in parallel
|
|
852
|
-
const file_stat_promises = Array.from(active_watchers.keys()).map(async (file_path) => {
|
|
853
|
-
const filename = path.basename(file_path)
|
|
854
|
-
let file_size: number | undefined
|
|
855
|
-
try {
|
|
856
|
-
const uri = vscode.Uri.file(file_path)
|
|
857
|
-
file_size = (await vscode.workspace.fs.stat(uri)).size
|
|
858
|
-
} catch {
|
|
859
|
-
// File might not exist anymore
|
|
860
|
-
}
|
|
861
|
-
const has_frame_loader = active_frame_loaders.has(file_path)
|
|
862
|
-
return { filename, file_path, file_size, has_watcher: true, has_frame_loader }
|
|
863
|
-
})
|
|
864
|
-
|
|
865
|
-
active_files.push(...(await Promise.all(file_stat_promises)))
|
|
866
|
-
|
|
867
|
-
// Get memory usage if available (use global process object)
|
|
868
|
-
const memory_usage = globalThis.process?.memoryUsage() ?? {
|
|
869
|
-
rss: 0,
|
|
870
|
-
heapUsed: 0,
|
|
871
|
-
heapTotal: 0,
|
|
872
|
-
external: 0,
|
|
873
|
-
arrayBuffers: 0,
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
// Build debug report
|
|
877
|
-
let report = `### Environment\n\n`
|
|
878
|
-
report += `- **Editor**: ${vscode.env.appName}\n`
|
|
879
|
-
report += `- **Editor Version**: ${vscode.version}\n`
|
|
880
|
-
report += `- **MatterViz Version**: ${pkg_json.version}\n`
|
|
881
|
-
report += `- **OS**: ${os.type()} ${os.platform()} ${os.arch()}\n`
|
|
882
|
-
report += `- **OS Version**: ${os.release()}\n`
|
|
883
|
-
report += `- **UI Kind**: ${ui_kind}\n`
|
|
884
|
-
report += `- **Remote Session**: ${is_remote ? `Yes (${remote_name})` : `No (Local)`}\n\n`
|
|
885
|
-
|
|
886
|
-
report += `### System Resources\n\n`
|
|
887
|
-
report += `- **Total Memory**: ${format_bytes(os.totalmem())}\n`
|
|
888
|
-
report += `- **Free Memory**: ${format_bytes(os.freemem())}\n`
|
|
889
|
-
report += `- **Process RSS**: ${format_bytes(memory_usage.rss)}\n`
|
|
890
|
-
report += `- **Process Heap Used**: ${format_bytes(memory_usage.heapUsed)}\n`
|
|
891
|
-
report += `- **Process Heap Total**: ${format_bytes(memory_usage.heapTotal)}\n\n`
|
|
892
|
-
|
|
893
|
-
report += `### Active Files & Extension State\n\n`
|
|
894
|
-
report += `- **Active Watchers**: ${active_watchers.size}\n`
|
|
895
|
-
report += `- **Active Frame Loaders**: ${active_frame_loaders.size}\n`
|
|
896
|
-
report += `- **Auto-Render Timers**: ${auto_render_timers.size}\n`
|
|
897
|
-
report += `- **Active Auto-Render Panels**: ${active_auto_render_panels.size}\n\n`
|
|
898
|
-
|
|
899
|
-
if (active_files.length === 0) {
|
|
900
|
-
report += `No files currently being watched/rendered.\n\n`
|
|
901
|
-
} else {
|
|
902
|
-
report += `Currently watching/rendering ${active_files.length} file(s):\n\n`
|
|
903
|
-
for (const file_info of active_files) {
|
|
904
|
-
report += `**${file_info.filename}**\n`
|
|
905
|
-
report += `- **Path**: \`${file_info.file_path}\`\n`
|
|
906
|
-
report += `- **Size**: ${format_bytes(file_info.file_size)}\n`
|
|
907
|
-
report += `- **Has Watcher**: ${file_info.has_watcher}\n`
|
|
908
|
-
report += `- **Has Frame Loader**: ${file_info.has_frame_loader}\n\n`
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
report += `### Console Logs\n\n`
|
|
913
|
-
report += `**Please check for console errors/warnings:**\n\n`
|
|
914
|
-
report += `1. Open Developer Tools:\n`
|
|
915
|
-
report += ` - Cursor/VSCode: Help → Toggle Developer Tools (or Cmd/Ctrl+Shift+I)\n`
|
|
916
|
-
report += `2. Go to the "Console" tab\n`
|
|
917
|
-
report += `3. Look for any errors or warnings related to MatterViz (especially in red)\n`
|
|
918
|
-
report += `4. Copy and paste any relevant error messages into your GitHub issue\n\n`
|
|
919
|
-
report += `Tip: You can filter console messages by typing "matterviz" in the filter box.\n\n`
|
|
920
|
-
|
|
921
|
-
report += `---\n\n`
|
|
922
|
-
report += `**Generated**: ${new Date().toISOString()}\n\n`
|
|
923
|
-
report += `Please include this information when reporting bugs at:\n`
|
|
924
|
-
report += `https://github.com/janosh/matterviz/issues\n`
|
|
925
|
-
|
|
926
|
-
return report
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
// Command to report a bug with debug information
|
|
930
|
-
async function report_bug(): Promise<void> {
|
|
931
|
-
try {
|
|
932
|
-
// Collect debug information
|
|
933
|
-
const debug_info = await collect_debug_info()
|
|
934
|
-
|
|
935
|
-
// Create a new untitled document with the debug info
|
|
936
|
-
const doc = await vscode.workspace.openTextDocument({
|
|
937
|
-
content: debug_info,
|
|
938
|
-
language: `markdown`,
|
|
939
|
-
})
|
|
940
|
-
|
|
941
|
-
await vscode.window.showTextDocument(doc, { preview: false })
|
|
942
|
-
|
|
943
|
-
// Show a message with instructions
|
|
944
|
-
const action = await vscode.window.showInformationMessage(
|
|
945
|
-
`Debug information collected. Please copy this information and include it when reporting a bug on GitHub.`,
|
|
946
|
-
`Copy to Clipboard`,
|
|
947
|
-
`Open GitHub Issues`,
|
|
948
|
-
)
|
|
949
|
-
|
|
950
|
-
if (action === `Copy to Clipboard`) {
|
|
951
|
-
await vscode.env.clipboard.writeText(debug_info)
|
|
952
|
-
vscode.window.showInformationMessage(`Debug information copied to clipboard!`)
|
|
953
|
-
} else if (action === `Open GitHub Issues`) {
|
|
954
|
-
vscode.env.openExternal(
|
|
955
|
-
vscode.Uri.parse(`https://github.com/janosh/matterviz/issues/new`),
|
|
956
|
-
)
|
|
957
|
-
}
|
|
958
|
-
} catch (error: unknown) {
|
|
959
|
-
const message = error instanceof Error ? error.message : String(error)
|
|
960
|
-
vscode.window.showErrorMessage(`Failed to collect debug information: ${message}`)
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
// Deactivate extension and clean up resources
|
|
965
|
-
export const deactivate = (): void => {
|
|
966
|
-
auto_render_timers.forEach(clearTimeout)
|
|
967
|
-
auto_render_timers.clear()
|
|
968
|
-
active_watchers.forEach((watcher) => watcher.dispose())
|
|
969
|
-
active_watchers.clear()
|
|
970
|
-
active_frame_loaders.clear()
|
|
971
|
-
active_auto_render_panels.clear()
|
|
972
|
-
}
|