react-cheminfo 0.65.0 → 0.67.0
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/README.md +33 -17
- package/lib/download/ui/FigureDownloadPanel.d.ts +7 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +2 -2
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/ecosystem/core/sites.js +3 -3
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +1 -1
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/i18n/core/messageCatalog.d.ts +2 -2
- package/lib/i18n/vite/localeCatalog.d.ts +1 -1
- package/lib/ir/core/analysisSpectra.d.ts +23 -6
- package/lib/ir/core/analysisSpectra.d.ts.map +1 -1
- package/lib/ir/core/analysisSpectra.js.map +1 -1
- package/lib/ir/core/bandLabelPlan.d.ts.map +1 -1
- package/lib/ir/core/bandLabelPlan.js +11 -6
- package/lib/ir/core/bandLabelPlan.js.map +1 -1
- package/lib/ir/core/index.d.ts +15 -11
- package/lib/ir/core/index.d.ts.map +1 -1
- package/lib/ir/core/index.js +9 -6
- package/lib/ir/core/index.js.map +1 -1
- package/lib/ir/core/irBand.d.ts +45 -14
- package/lib/ir/core/irBand.d.ts.map +1 -1
- package/lib/ir/core/irBand.js +28 -6
- package/lib/ir/core/irBand.js.map +1 -1
- package/lib/ir/core/irCommands.d.ts +11 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -1
- package/lib/ir/core/irCommands.js +11 -1
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/core/irDomain.d.ts +4 -3
- package/lib/ir/core/irDomain.d.ts.map +1 -1
- package/lib/ir/core/irDomain.js +10 -7
- package/lib/ir/core/irDomain.js.map +1 -1
- package/lib/ir/core/irEditorApi.d.ts +12 -0
- package/lib/ir/core/irEditorApi.d.ts.map +1 -1
- package/lib/ir/core/irFormat.d.ts +14 -2
- package/lib/ir/core/irFormat.d.ts.map +1 -1
- package/lib/ir/core/irFormat.js +33 -4
- package/lib/ir/core/irFormat.js.map +1 -1
- package/lib/ir/core/irMode.d.ts +35 -8
- package/lib/ir/core/irMode.d.ts.map +1 -1
- package/lib/ir/core/irMode.js +38 -10
- package/lib/ir/core/irMode.js.map +1 -1
- package/lib/ir/core/irReducer.d.ts +2 -30
- package/lib/ir/core/irReducer.d.ts.map +1 -1
- package/lib/ir/core/irReducer.js +1 -24
- package/lib/ir/core/irReducer.js.map +1 -1
- package/lib/ir/core/irSidePanels.d.ts +7 -1
- package/lib/ir/core/irSidePanels.d.ts.map +1 -1
- package/lib/ir/core/irSpectrum.d.ts +52 -26
- package/lib/ir/core/irSpectrum.d.ts.map +1 -1
- package/lib/ir/core/irSpectrum.js +21 -15
- package/lib/ir/core/irSpectrum.js.map +1 -1
- package/lib/ir/core/irState.d.ts +46 -5
- package/lib/ir/core/irState.d.ts.map +1 -1
- package/lib/ir/core/irState.js +38 -1
- package/lib/ir/core/irState.js.map +1 -1
- package/lib/ir/core/irTechnique.d.ts +94 -0
- package/lib/ir/core/irTechnique.d.ts.map +1 -0
- package/lib/ir/core/irTechnique.js +87 -0
- package/lib/ir/core/irTechnique.js.map +1 -0
- package/lib/ir/core/irTechniqueCommands.d.ts +26 -0
- package/lib/ir/core/irTechniqueCommands.d.ts.map +1 -0
- package/lib/ir/core/irTechniqueCommands.js +68 -0
- package/lib/ir/core/irTechniqueCommands.js.map +1 -0
- package/lib/ir/core/pickBands.d.ts +6 -5
- package/lib/ir/core/pickBands.d.ts.map +1 -1
- package/lib/ir/core/pickBands.js +49 -26
- package/lib/ir/core/pickBands.js.map +1 -1
- package/lib/ir/core/ramanBands.d.ts +30 -0
- package/lib/ir/core/ramanBands.d.ts.map +1 -0
- package/lib/ir/core/ramanBands.js +83 -0
- package/lib/ir/core/ramanBands.js.map +1 -0
- package/lib/ir/core/spectrumJcamp.d.ts +10 -5
- package/lib/ir/core/spectrumJcamp.d.ts.map +1 -1
- package/lib/ir/core/spectrumJcamp.js +63 -15
- package/lib/ir/core/spectrumJcamp.js.map +1 -1
- package/lib/ir/core/toIrSpectrum.d.ts.map +1 -1
- package/lib/ir/core/toIrSpectrum.js +17 -2
- package/lib/ir/core/toIrSpectrum.js.map +1 -1
- package/lib/ir/ui/BandRow.d.ts +30 -0
- package/lib/ir/ui/BandRow.d.ts.map +1 -0
- package/lib/ir/ui/BandRow.js +42 -0
- package/lib/ir/ui/BandRow.js.map +1 -0
- package/lib/ir/ui/BandsPanel.d.ts +4 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -1
- package/lib/ir/ui/BandsPanel.js +14 -59
- package/lib/ir/ui/BandsPanel.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts +7 -0
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +16 -3
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- package/lib/ir/ui/IrCanvas.d.ts +7 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +9 -4
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrChart.d.ts +2 -1
- package/lib/ir/ui/IrChart.d.ts.map +1 -1
- package/lib/ir/ui/IrChart.js +22 -21
- package/lib/ir/ui/IrChart.js.map +1 -1
- package/lib/ir/ui/IrCommandProvider.d.ts +7 -0
- package/lib/ir/ui/IrCommandProvider.d.ts.map +1 -1
- package/lib/ir/ui/IrCommandProvider.js +2 -2
- package/lib/ir/ui/IrCommandProvider.js.map +1 -1
- package/lib/ir/ui/IrCommandTooltip.d.ts +7 -0
- package/lib/ir/ui/IrCommandTooltip.d.ts.map +1 -1
- package/lib/ir/ui/IrCommandTooltip.js +3 -2
- package/lib/ir/ui/IrCommandTooltip.js.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.d.ts +8 -1
- package/lib/ir/ui/IrDocumentationDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js +30 -7
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -1
- package/lib/ir/ui/IrEditor.d.ts +25 -5
- package/lib/ir/ui/IrEditor.d.ts.map +1 -1
- package/lib/ir/ui/IrEditor.js +3 -20
- package/lib/ir/ui/IrEditor.js.map +1 -1
- package/lib/ir/ui/IrHeader.d.ts.map +1 -1
- package/lib/ir/ui/IrHeader.js +5 -1
- package/lib/ir/ui/IrHeader.js.map +1 -1
- package/lib/ir/ui/IrLogo.d.ts +11 -3
- package/lib/ir/ui/IrLogo.d.ts.map +1 -1
- package/lib/ir/ui/IrLogo.js +14 -5
- package/lib/ir/ui/IrLogo.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts +9 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +26 -74
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrSidePanel.d.ts +11 -0
- package/lib/ir/ui/IrSidePanel.d.ts.map +1 -1
- package/lib/ir/ui/IrSidePanel.js +12 -3
- package/lib/ir/ui/IrSidePanel.js.map +1 -1
- package/lib/ir/ui/IrStatusBar.d.ts +3 -2
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -1
- package/lib/ir/ui/IrStatusBar.js +14 -9
- package/lib/ir/ui/IrStatusBar.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +3 -0
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +10 -3
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/IrTraces.d.ts +4 -1
- package/lib/ir/ui/IrTraces.d.ts.map +1 -1
- package/lib/ir/ui/IrTraces.js +2 -0
- package/lib/ir/ui/IrTraces.js.map +1 -1
- package/lib/ir/ui/RamanEditor.d.ts +64 -0
- package/lib/ir/ui/RamanEditor.d.ts.map +1 -0
- package/lib/ir/ui/RamanEditor.js +17 -0
- package/lib/ir/ui/RamanEditor.js.map +1 -0
- package/lib/ir/ui/SpectraPanel.d.ts.map +1 -1
- package/lib/ir/ui/SpectraPanel.js +2 -2
- package/lib/ir/ui/SpectraPanel.js.map +1 -1
- package/lib/ir/ui/SpectrumRow.d.ts +7 -0
- package/lib/ir/ui/SpectrumRow.d.ts.map +1 -1
- package/lib/ir/ui/SpectrumRow.js +4 -5
- package/lib/ir/ui/SpectrumRow.js.map +1 -1
- package/lib/ir/ui/VibrationalEditor.d.ts +62 -0
- package/lib/ir/ui/VibrationalEditor.d.ts.map +1 -0
- package/lib/ir/ui/VibrationalEditor.js +33 -0
- package/lib/ir/ui/VibrationalEditor.js.map +1 -0
- package/lib/ir/ui/bandsTsv.d.ts +19 -0
- package/lib/ir/ui/bandsTsv.d.ts.map +1 -0
- package/lib/ir/ui/bandsTsv.js +38 -0
- package/lib/ir/ui/bandsTsv.js.map +1 -0
- package/lib/ir/ui/index.d.ts +1 -0
- package/lib/ir/ui/index.d.ts.map +1 -1
- package/lib/ir/ui/index.js.map +1 -1
- package/lib/ir/ui/irActions.d.ts +3 -3
- package/lib/ir/ui/irActions.d.ts.map +1 -1
- package/lib/ir/ui/irChartProps.d.ts +21 -4
- package/lib/ir/ui/irChartProps.d.ts.map +1 -1
- package/lib/ir/ui/irChartProps.js +3 -2
- package/lib/ir/ui/irChartProps.js.map +1 -1
- package/lib/ir/ui/irCommandContext.d.ts +8 -0
- package/lib/ir/ui/irCommandContext.d.ts.map +1 -1
- package/lib/ir/ui/irCommandContext.js +14 -3
- package/lib/ir/ui/irCommandContext.js.map +1 -1
- package/lib/ir/ui/irHostPanels.d.ts +53 -0
- package/lib/ir/ui/irHostPanels.d.ts.map +1 -0
- package/lib/ir/ui/irHostPanels.js +41 -0
- package/lib/ir/ui/irHostPanels.js.map +1 -0
- package/lib/ir/ui/useIrEditor.d.ts +3 -3
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.js +13 -4
- package/lib/ir/ui/useIrEditor.js.map +1 -1
- package/lib/ir/ui/useIrHandle.d.ts +14 -0
- package/lib/ir/ui/useIrHandle.d.ts.map +1 -0
- package/lib/ir/ui/useIrHandle.js +39 -0
- package/lib/ir/ui/useIrHandle.js.map +1 -0
- package/lib/ir/ui/useIrSide.d.ts +27 -0
- package/lib/ir/ui/useIrSide.d.ts.map +1 -0
- package/lib/ir/ui/useIrSide.js +42 -0
- package/lib/ir/ui/useIrSide.js.map +1 -0
- package/lib/ir/ui/useIrText.d.ts +40 -0
- package/lib/ir/ui/useIrText.d.ts.map +1 -0
- package/lib/ir/ui/useIrText.js +118 -0
- package/lib/ir/ui/useIrText.js.map +1 -0
- package/lib/ir/ui/useIrZoom.d.ts +15 -0
- package/lib/ir/ui/useIrZoom.d.ts.map +1 -1
- package/lib/ir/ui/useIrZoom.js +6 -4
- package/lib/ir/ui/useIrZoom.js.map +1 -1
- package/lib/ir/ui/useValueAxisZoom.d.ts +20 -0
- package/lib/ir/ui/useValueAxisZoom.d.ts.map +1 -0
- package/lib/ir/ui/useValueAxisZoom.js +54 -0
- package/lib/ir/ui/useValueAxisZoom.js.map +1 -0
- package/lib/ir.d.ts +3 -0
- package/lib/ir.d.ts.map +1 -1
- package/lib/ir.js +3 -0
- package/lib/ir.js.map +1 -1
- package/lib/locales/de.json +29 -2
- package/lib/locales/en.json +29 -2
- package/lib/locales/es.json +29 -2
- package/lib/locales/fr.json +29 -2
- package/lib/locales/it.json +29 -2
- package/lib/molecule3d/core/animatedPng.d.ts +25 -0
- package/lib/molecule3d/core/animatedPng.d.ts.map +1 -0
- package/lib/molecule3d/core/animatedPng.js +59 -0
- package/lib/molecule3d/core/animatedPng.js.map +1 -0
- package/lib/molecule3d/core/file.d.ts +24 -0
- package/lib/molecule3d/core/file.d.ts.map +1 -0
- package/lib/molecule3d/core/file.js +2 -0
- package/lib/molecule3d/core/file.js.map +1 -0
- package/lib/molecule3d/core/index.d.ts +4 -1
- package/lib/molecule3d/core/index.d.ts.map +1 -1
- package/lib/molecule3d/core/index.js +1 -0
- package/lib/molecule3d/core/index.js.map +1 -1
- package/lib/molecule3d/core/settings.d.ts +0 -7
- package/lib/molecule3d/core/settings.d.ts.map +1 -1
- package/lib/molecule3d/core/settings.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DExport.d.ts +10 -2
- package/lib/molecule3d/ui/Molecule3DExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DExport.js +15 -2
- package/lib/molecule3d/ui/Molecule3DExport.js.map +1 -1
- package/lib/molecule3d/ui/Molecule3DToolbar.js +9 -2
- package/lib/molecule3d/ui/Molecule3DToolbar.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +23 -41
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/drawScene.d.ts +2 -1
- package/lib/molecule3d/ui/drawScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/drawScene.js.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts +15 -1
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.js +14 -2
- package/lib/molecule3d/ui/exportMoleculeImage.js.map +1 -1
- package/lib/molecule3d/ui/moleculeFrames.d.ts +47 -0
- package/lib/molecule3d/ui/moleculeFrames.d.ts.map +1 -0
- package/lib/molecule3d/ui/moleculeFrames.js +65 -0
- package/lib/molecule3d/ui/moleculeFrames.js.map +1 -0
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +14 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/renderMolecule.d.ts +3 -3
- package/lib/molecule3d/ui/renderMolecule.d.ts.map +1 -1
- package/lib/molecule3d/ui/renderMolecule.js +2 -1
- package/lib/molecule3d/ui/renderMolecule.js.map +1 -1
- package/lib/molecule3d/ui/sceneDrawer.d.ts +2 -1
- package/lib/molecule3d/ui/sceneDrawer.d.ts.map +1 -1
- package/lib/molecule3d/ui/sceneDrawer.js +9 -1
- package/lib/molecule3d/ui/sceneDrawer.js.map +1 -1
- package/lib/molecule3d/ui/useImageExport.d.ts +8 -3
- package/lib/molecule3d/ui/useImageExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.js +13 -4
- package/lib/molecule3d/ui/useImageExport.js.map +1 -1
- package/lib/molecule3d/ui/useMoleculeScene.d.ts +2 -1
- package/lib/molecule3d/ui/useMoleculeScene.d.ts.map +1 -1
- package/lib/molecule3d/ui/useMoleculeScene.js.map +1 -1
- package/lib/molecule3d/ui/useMoleculeViewer.d.ts +16 -0
- package/lib/molecule3d/ui/useMoleculeViewer.d.ts.map +1 -0
- package/lib/molecule3d/ui/useMoleculeViewer.js +37 -0
- package/lib/molecule3d/ui/useMoleculeViewer.js.map +1 -0
- package/lib/molecule3d/ui/usePolarSurfaceArea.d.ts +3 -3
- package/lib/molecule3d/ui/usePolarSurfaceArea.d.ts.map +1 -1
- package/lib/molecule3d/ui/usePolarSurfaceArea.js +4 -3
- package/lib/molecule3d/ui/usePolarSurfaceArea.js.map +1 -1
- package/lib/molecule3d/ui/viewer.d.ts +4 -1
- package/lib/molecule3d/ui/viewer.d.ts.map +1 -1
- package/lib/molecule3d/ui/viewer.js +21 -19
- package/lib/molecule3d/ui/viewer.js.map +1 -1
- package/lib/molecule3d/ui/viewerTypes.d.ts +6 -0
- package/lib/molecule3d/ui/viewerTypes.d.ts.map +1 -1
- package/lib/molstar/core/captureScene.d.ts +19 -1
- package/lib/molstar/core/captureScene.d.ts.map +1 -1
- package/lib/molstar/core/captureScene.js +57 -2
- package/lib/molstar/core/captureScene.js.map +1 -1
- package/lib/molstar/core/index.d.ts +5 -2
- package/lib/molstar/core/index.d.ts.map +1 -1
- package/lib/molstar/core/index.js +4 -2
- package/lib/molstar/core/index.js.map +1 -1
- package/lib/molstar/core/trajectory.d.ts +56 -0
- package/lib/molstar/core/trajectory.d.ts.map +1 -0
- package/lib/molstar/core/trajectory.js +96 -0
- package/lib/molstar/core/trajectory.js.map +1 -0
- package/lib/panel/ui/PanelRail.d.ts.map +1 -1
- package/lib/panel/ui/PanelRail.js +1 -1
- package/lib/panel/ui/PanelRail.js.map +1 -1
- package/lib/raman.d.ts +17 -0
- package/lib/raman.d.ts.map +1 -0
- package/lib/raman.js +12 -0
- package/lib/raman.js.map +1 -0
- package/lib/router/core/basePath.d.ts +2 -2
- package/lib/router/core/basePath.js +2 -2
- package/lib/router/core/siteAddresses.d.ts +1 -1
- package/lib/router/core/siteAddresses.js +1 -1
- package/lib/seo/core/siteFiles.js +1 -1
- package/lib/seo/core/siteFiles.js.map +1 -1
- package/lib/server/answerAddresses.d.ts +3 -3
- package/lib/server/answerAddresses.js +3 -3
- package/lib/structure/core/index.d.ts +2 -0
- package/lib/structure/core/index.d.ts.map +1 -1
- package/lib/structure/core/index.js +1 -0
- package/lib/structure/core/index.js.map +1 -1
- package/lib/structure/core/structureTransfer.d.ts +29 -0
- package/lib/structure/core/structureTransfer.d.ts.map +1 -0
- package/lib/structure/core/structureTransfer.js +26 -0
- package/lib/structure/core/structureTransfer.js.map +1 -0
- package/lib/structure/ui/EditorImportButton.d.ts +20 -0
- package/lib/structure/ui/EditorImportButton.d.ts.map +1 -0
- package/lib/structure/ui/EditorImportButton.js +24 -0
- package/lib/structure/ui/EditorImportButton.js.map +1 -0
- package/lib/structure/ui/EditorImportProblem.d.ts +17 -0
- package/lib/structure/ui/EditorImportProblem.d.ts.map +1 -0
- package/lib/structure/ui/EditorImportProblem.js +32 -0
- package/lib/structure/ui/EditorImportProblem.js.map +1 -0
- package/lib/structure/ui/StructureDrop.d.ts +39 -0
- package/lib/structure/ui/StructureDrop.d.ts.map +1 -0
- package/lib/structure/ui/StructureDrop.js +19 -0
- package/lib/structure/ui/StructureDrop.js.map +1 -0
- package/lib/structure/ui/StructureDropOverlay.d.ts +16 -0
- package/lib/structure/ui/StructureDropOverlay.d.ts.map +1 -0
- package/lib/structure/ui/StructureDropOverlay.js +29 -0
- package/lib/structure/ui/StructureDropOverlay.js.map +1 -0
- package/lib/structure/ui/StructureEditor.d.ts +3 -80
- package/lib/structure/ui/StructureEditor.d.ts.map +1 -1
- package/lib/structure/ui/StructureEditor.js +21 -33
- package/lib/structure/ui/StructureEditor.js.map +1 -1
- package/lib/structure/ui/importedStructure.d.ts +25 -0
- package/lib/structure/ui/importedStructure.d.ts.map +1 -0
- package/lib/structure/ui/importedStructure.js +74 -0
- package/lib/structure/ui/importedStructure.js.map +1 -0
- package/lib/structure/ui/index.d.ts +2 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js +1 -0
- package/lib/structure/ui/index.js.map +1 -1
- package/lib/structure/ui/structureEditorProps.d.ts +98 -0
- package/lib/structure/ui/structureEditorProps.d.ts.map +1 -0
- package/lib/structure/ui/structureEditorProps.js +2 -0
- package/lib/structure/ui/structureEditorProps.js.map +1 -0
- package/lib/structure/ui/useDebouncedChange.d.ts +16 -0
- package/lib/structure/ui/useDebouncedChange.d.ts.map +1 -0
- package/lib/structure/ui/useDebouncedChange.js +30 -0
- package/lib/structure/ui/useDebouncedChange.js.map +1 -0
- package/lib/structure/ui/useStructureDrop.d.ts +30 -0
- package/lib/structure/ui/useStructureDrop.d.ts.map +1 -0
- package/lib/structure/ui/useStructureDrop.js +49 -0
- package/lib/structure/ui/useStructureDrop.js.map +1 -0
- package/lib/structure/ui/useStructureImport.d.ts +45 -0
- package/lib/structure/ui/useStructureImport.d.ts.map +1 -0
- package/lib/structure/ui/useStructureImport.js +62 -0
- package/lib/structure/ui/useStructureImport.js.map +1 -0
- package/package.json +5 -1
- package/src/download/ui/FigureDownloadPanel.tsx +9 -2
- package/src/ecosystem/core/sites.ts +3 -3
- package/src/ecosystem/core/types.ts +1 -1
- package/src/ecosystem/ui/glyphs.tsx +1 -1
- package/src/i18n/core/messageCatalog.ts +2 -2
- package/src/i18n/vite/localeCatalog.ts +1 -1
- package/src/ir/core/analysisSpectra.ts +26 -10
- package/src/ir/core/bandLabelPlan.ts +21 -10
- package/src/ir/core/index.ts +31 -7
- package/src/ir/core/irBand.ts +52 -14
- package/src/ir/core/irCommands.ts +15 -1
- package/src/ir/core/irDomain.ts +9 -7
- package/src/ir/core/irEditorApi.ts +13 -0
- package/src/ir/core/irFormat.ts +39 -6
- package/src/ir/core/irMode.ts +42 -10
- package/src/ir/core/irReducer.ts +3 -51
- package/src/ir/core/irSidePanels.ts +8 -1
- package/src/ir/core/irSpectrum.ts +59 -30
- package/src/ir/core/irState.ts +73 -5
- package/src/ir/core/irTechnique.ts +115 -0
- package/src/ir/core/irTechniqueCommands.ts +82 -0
- package/src/ir/core/pickBands.ts +63 -28
- package/src/ir/core/ramanBands.ts +105 -0
- package/src/ir/core/spectrumJcamp.ts +65 -16
- package/src/ir/core/toIrSpectrum.ts +20 -2
- package/src/ir/ui/BandRow.tsx +107 -0
- package/src/ir/ui/BandsPanel.tsx +32 -125
- package/src/ir/ui/IrAboutDialog.tsx +69 -28
- package/src/ir/ui/IrCanvas.tsx +29 -3
- package/src/ir/ui/IrChart.tsx +31 -24
- package/src/ir/ui/IrCommandProvider.tsx +10 -3
- package/src/ir/ui/IrCommandTooltip.tsx +11 -2
- package/src/ir/ui/IrDocumentationDialog.tsx +99 -55
- package/src/ir/ui/IrEditor.tsx +27 -40
- package/src/ir/ui/IrHeader.tsx +10 -3
- package/src/ir/ui/IrLogo.tsx +28 -9
- package/src/ir/ui/IrShell.tsx +47 -96
- package/src/ir/ui/IrSidePanel.tsx +36 -10
- package/src/ir/ui/IrStatusBar.tsx +17 -12
- package/src/ir/ui/IrToolbar.tsx +26 -15
- package/src/ir/ui/IrTraces.tsx +5 -1
- package/src/ir/ui/RamanEditor.tsx +71 -0
- package/src/ir/ui/SpectraPanel.tsx +2 -1
- package/src/ir/ui/SpectrumRow.tsx +14 -5
- package/src/ir/ui/VibrationalEditor.tsx +113 -0
- package/src/ir/ui/bandsTsv.ts +46 -0
- package/src/ir/ui/index.ts +1 -0
- package/src/ir/ui/irActions.ts +3 -3
- package/src/ir/ui/irChartProps.ts +21 -4
- package/src/ir/ui/irCommandContext.tsx +18 -3
- package/src/ir/ui/irHostPanels.ts +76 -0
- package/src/ir/ui/useIrEditor.ts +20 -8
- package/src/ir/ui/useIrHandle.ts +51 -0
- package/src/ir/ui/useIrSide.ts +60 -0
- package/src/ir/ui/useIrText.ts +170 -0
- package/src/ir/ui/useIrZoom.ts +22 -3
- package/src/ir/ui/useValueAxisZoom.ts +67 -0
- package/src/ir.ts +3 -0
- package/src/locales/de.json +29 -2
- package/src/locales/en.json +29 -2
- package/src/locales/es.json +29 -2
- package/src/locales/fr.json +29 -2
- package/src/locales/it.json +29 -2
- package/src/molecule3d/core/animatedPng.ts +79 -0
- package/src/molecule3d/core/file.ts +23 -0
- package/src/molecule3d/core/index.ts +3 -1
- package/src/molecule3d/core/settings.ts +0 -8
- package/src/molecule3d/ui/Molecule3DExport.tsx +43 -5
- package/src/molecule3d/ui/Molecule3DToolbar.tsx +9 -2
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +24 -38
- package/src/molecule3d/ui/drawScene.ts +2 -1
- package/src/molecule3d/ui/exportMoleculeImage.ts +28 -3
- package/src/molecule3d/ui/moleculeFrames.ts +88 -0
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +14 -5
- package/src/molecule3d/ui/renderMolecule.ts +5 -3
- package/src/molecule3d/ui/sceneDrawer.ts +14 -2
- package/src/molecule3d/ui/useImageExport.ts +22 -5
- package/src/molecule3d/ui/useMoleculeScene.ts +2 -1
- package/src/molecule3d/ui/useMoleculeViewer.ts +46 -0
- package/src/molecule3d/ui/usePolarSurfaceArea.ts +6 -4
- package/src/molecule3d/ui/viewer.ts +34 -27
- package/src/molecule3d/ui/viewerTypes.ts +6 -0
- package/src/molstar/core/captureScene.ts +85 -2
- package/src/molstar/core/index.ts +13 -2
- package/src/molstar/core/trajectory.ts +117 -0
- package/src/panel/ui/PanelRail.tsx +3 -0
- package/src/raman.ts +20 -0
- package/src/router/core/basePath.ts +2 -2
- package/src/router/core/siteAddresses.ts +1 -1
- package/src/seo/core/siteFiles.ts +1 -1
- package/src/server/answerAddresses.ts +3 -3
- package/src/structure/core/index.ts +8 -0
- package/src/structure/core/structureTransfer.ts +37 -0
- package/src/structure/ui/EditorImportButton.tsx +59 -0
- package/src/structure/ui/EditorImportProblem.tsx +63 -0
- package/src/structure/ui/StructureDrop.tsx +66 -0
- package/src/structure/ui/StructureDropOverlay.tsx +50 -0
- package/src/structure/ui/StructureEditor.tsx +49 -134
- package/src/structure/ui/importedStructure.ts +83 -0
- package/src/structure/ui/index.ts +2 -0
- package/src/structure/ui/structureEditorProps.ts +103 -0
- package/src/structure/ui/useDebouncedChange.ts +41 -0
- package/src/structure/ui/useStructureDrop.ts +76 -0
- package/src/structure/ui/useStructureImport.ts +122 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@blueprintjs/core';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
5
|
+
import { ActionTooltip } from "../../shared/ui/ActionTooltip.js";
|
|
6
|
+
/**
|
|
7
|
+
* The editor's open button, beside the export one, for a visitor who cannot
|
|
8
|
+
* drag a file onto the canvas — on a phone, or from a picker.
|
|
9
|
+
* @param props - See {@link EditorImportButtonProps}.
|
|
10
|
+
* @returns The button and its hidden file input.
|
|
11
|
+
*/
|
|
12
|
+
export function EditorImportButton(props) {
|
|
13
|
+
const { onImport, accept } = props;
|
|
14
|
+
const t = useChromeT();
|
|
15
|
+
const input = useRef(null);
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(ActionTooltip, { content: t('structure.import.open'), placement: "left", children: _jsx(Button, { variant: "minimal", size: "small", icon: "import", "aria-label": t('structure.import.open'), onClick: () => input.current?.click() }) }), _jsx("input", { ref: input, type: "file", accept: accept, hidden: true, "data-testid": "structure-editor-file", onChange: (event) => {
|
|
17
|
+
const files = Array.from(event.currentTarget.files ?? []);
|
|
18
|
+
// Cleared, so choosing the same file again is a change.
|
|
19
|
+
event.currentTarget.value = '';
|
|
20
|
+
if (files.length > 0)
|
|
21
|
+
onImport({ kind: 'files', files });
|
|
22
|
+
} })] }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=EditorImportButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorImportButton.js","sourceRoot":"","sources":["../../../src/structure/ui/EditorImportButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAmC,CAAC;AAclE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAA8B;IAE9B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACnC,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAE7C,OAAO,CACL,8BACE,KAAC,aAAa,IAAC,OAAO,EAAE,CAAC,CAAC,uBAAuB,CAAC,EAAE,SAAS,EAAC,MAAM,YAClE,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,gBACD,CAAC,CAAC,uBAAuB,CAAC,EACtC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,GACrC,GACY,EAChB,gBACE,GAAG,EAAE,KAAK,EACV,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,EACd,MAAM,uBACM,uBAAuB,EACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;oBAC1D,wDAAwD;oBACxD,KAAK,CAAC,aAAa,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;wBAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC3D,CAAC,GACD,IACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { StructureImportProblem } from './useStructureImport.ts';
|
|
3
|
+
/** What {@link EditorImportProblem} needs. */
|
|
4
|
+
export interface EditorImportProblemProps {
|
|
5
|
+
/** What went wrong. */
|
|
6
|
+
problem: StructureImportProblem;
|
|
7
|
+
/** Forget it. */
|
|
8
|
+
onDismiss: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The line along the bottom of the canvas that says a drop loaded nothing,
|
|
12
|
+
* and that the drawing is still there.
|
|
13
|
+
* @param props - See {@link EditorImportProblemProps}.
|
|
14
|
+
* @returns The line.
|
|
15
|
+
*/
|
|
16
|
+
export declare function EditorImportProblem(props: EditorImportProblemProps): ReactElement;
|
|
17
|
+
//# sourceMappingURL=EditorImportProblem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorImportProblem.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/EditorImportProblem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,8CAA8C;AAC9C,MAAM,WAAW,wBAAwB;IACvC,uBAAuB;IACvB,OAAO,EAAE,sBAAsB,CAAC;IAChC,iBAAiB;IACjB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,YAAY,CAqBd"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Callout } from '@blueprintjs/core';
|
|
3
|
+
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
4
|
+
/**
|
|
5
|
+
* The line along the bottom of the canvas that says a drop loaded nothing,
|
|
6
|
+
* and that the drawing is still there.
|
|
7
|
+
* @param props - See {@link EditorImportProblemProps}.
|
|
8
|
+
* @returns The line.
|
|
9
|
+
*/
|
|
10
|
+
export function EditorImportProblem(props) {
|
|
11
|
+
const { problem, onDismiss } = props;
|
|
12
|
+
const t = useChromeT();
|
|
13
|
+
return (_jsx("div", { role: "alert", style: PLACE, children: _jsxs(Callout, { intent: "danger", icon: null, compact: true, style: LINE, children: [_jsx("span", { style: TEXT, children: problem.file === null
|
|
14
|
+
? t('structure.import.unreadableText')
|
|
15
|
+
: t('structure.import.unreadableFile', { name: problem.file }) }), _jsx(Button, { variant: "minimal", size: "small", icon: "cross", "aria-label": t('overlay.dismiss'), onClick: onDismiss })] }) }));
|
|
16
|
+
}
|
|
17
|
+
/** Clear of the tool palette, two 21px columns in a 2px border, at the left. */
|
|
18
|
+
const PLACE = {
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
right: 4,
|
|
21
|
+
bottom: 4,
|
|
22
|
+
left: 52,
|
|
23
|
+
zIndex: 10,
|
|
24
|
+
};
|
|
25
|
+
const LINE = {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
gap: 6,
|
|
29
|
+
fontSize: 12,
|
|
30
|
+
};
|
|
31
|
+
const TEXT = { flex: 1 };
|
|
32
|
+
//# sourceMappingURL=EditorImportProblem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorImportProblem.js","sourceRoot":"","sources":["../../../src/structure/ui/EditorImportProblem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAYnD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAA+B;IAE/B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,OAAO,CACL,cAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,KAAK,YAC5B,MAAC,OAAO,IAAC,MAAM,EAAC,QAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,QAAC,KAAK,EAAE,IAAI,aACtD,eAAM,KAAK,EAAE,IAAI,YACd,OAAO,CAAC,IAAI,KAAK,IAAI;wBACpB,CAAC,CAAC,CAAC,CAAC,iCAAiC,CAAC;wBACtC,CAAC,CAAC,CAAC,CAAC,iCAAiC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,GAC3D,EACP,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,OAAO,gBACA,CAAC,CAAC,iBAAiB,CAAC,EAChC,OAAO,EAAE,SAAS,GAClB,IACM,GACN,CACP,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,KAAK,GAAkB;IAC3B,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,EAAE;CACX,CAAC;AAEF,MAAM,IAAI,GAAkB;IAC1B,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,GAAG,EAAE,CAAC;IACN,QAAQ,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,IAAI,GAAkB,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { StructureTransfer } from '../core/structureTransfer.ts';
|
|
3
|
+
/** What {@link StructureDrop} needs. */
|
|
4
|
+
export interface StructureDropProps {
|
|
5
|
+
/** Called with the files or the text dropped. */
|
|
6
|
+
onDrop: (transfer: StructureTransfer) => void;
|
|
7
|
+
/** What the drop lands on. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* What the overlay says while something is dragged over.
|
|
11
|
+
* @default 'Drop to load the structure', in the page's language
|
|
12
|
+
*/
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Take no drop, while a load is already running for instance.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Class of the wrapping element.
|
|
21
|
+
* @default undefined
|
|
22
|
+
*/
|
|
23
|
+
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Extra style for the wrapping element, which is positioned so the overlay
|
|
26
|
+
* covers it.
|
|
27
|
+
* @default undefined
|
|
28
|
+
*/
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Make an area take a structure file, or structure text dragged from another
|
|
33
|
+
* page, with the same veil the structure editor raises over its canvas. What
|
|
34
|
+
* was dropped is handed over unread: the page knows which formats it takes.
|
|
35
|
+
* @param props - See {@link StructureDropProps}.
|
|
36
|
+
* @returns The area.
|
|
37
|
+
*/
|
|
38
|
+
export declare function StructureDrop(props: StructureDropProps): ReactElement;
|
|
39
|
+
//# sourceMappingURL=StructureDrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureDrop.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureDrop.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKtE,wCAAwC;AACxC,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,MAAM,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,8BAA8B;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAqBrE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
3
|
+
import { StructureDropOverlay } from "./StructureDropOverlay.js";
|
|
4
|
+
import { useStructureDrop } from "./useStructureDrop.js";
|
|
5
|
+
/**
|
|
6
|
+
* Make an area take a structure file, or structure text dragged from another
|
|
7
|
+
* page, with the same veil the structure editor raises over its canvas. What
|
|
8
|
+
* was dropped is handed over unread: the page knows which formats it takes.
|
|
9
|
+
* @param props - See {@link StructureDropProps}.
|
|
10
|
+
* @returns The area.
|
|
11
|
+
*/
|
|
12
|
+
export function StructureDrop(props) {
|
|
13
|
+
const { onDrop, children, label, disabled = false } = props;
|
|
14
|
+
const { className, style } = props;
|
|
15
|
+
const t = useChromeT();
|
|
16
|
+
const drop = useStructureDrop(disabled ? undefined : onDrop);
|
|
17
|
+
return (_jsxs("div", { className: className, style: { position: 'relative', ...style }, ...drop.targetProps, children: [children, drop.over ? (_jsx(StructureDropOverlay, { label: label ?? t('structure.import.drop'), handlers: drop.overlayProps })) : null] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=StructureDrop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureDrop.js","sourceRoot":"","sources":["../../../src/structure/ui/StructureDrop.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA+BzD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAC5D,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACnC,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO,CACL,eACE,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,KACrC,IAAI,CAAC,WAAW,aAEnB,QAAQ,EACR,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,KAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,uBAAuB,CAAC,EAC1C,QAAQ,EAAE,IAAI,CAAC,YAAY,GAC3B,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { DropHandlers } from './useStructureDrop.ts';
|
|
3
|
+
/** What {@link StructureDropOverlay} needs. */
|
|
4
|
+
export interface StructureDropOverlayProps {
|
|
5
|
+
/** What the overlay says. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The overlay handlers of `useStructureDrop`. */
|
|
8
|
+
handlers: DropHandlers;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The veil a drop target raises while a file or text is dragged over it.
|
|
12
|
+
* @param props - See {@link StructureDropOverlayProps}.
|
|
13
|
+
* @returns The overlay.
|
|
14
|
+
*/
|
|
15
|
+
export declare function StructureDropOverlay(props: StructureDropOverlayProps): ReactElement;
|
|
16
|
+
//# sourceMappingURL=StructureDropOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureDropOverlay.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureDropOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,+CAA+C;AAC/C,MAAM,WAAW,yBAAyB;IACxC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,YAAY,CAUd"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '@blueprintjs/core';
|
|
3
|
+
/**
|
|
4
|
+
* The veil a drop target raises while a file or text is dragged over it.
|
|
5
|
+
* @param props - See {@link StructureDropOverlayProps}.
|
|
6
|
+
* @returns The overlay.
|
|
7
|
+
*/
|
|
8
|
+
export function StructureDropOverlay(props) {
|
|
9
|
+
const { label, handlers } = props;
|
|
10
|
+
return (_jsxs("div", { "data-testid": "structure-drop-overlay", style: OVERLAY, ...handlers, children: [_jsx(Icon, { icon: "import", size: 28, style: PASSIVE }), _jsx("span", { style: PASSIVE, children: label })] }));
|
|
11
|
+
}
|
|
12
|
+
const OVERLAY = {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
inset: 0,
|
|
15
|
+
zIndex: 20,
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
gap: 8,
|
|
21
|
+
border: '2px dashed var(--accent)',
|
|
22
|
+
borderRadius: 'inherit',
|
|
23
|
+
background: 'color-mix(in oklab, var(--accent) 10%, rgb(255 255 255 / 88%))',
|
|
24
|
+
color: 'var(--accent)',
|
|
25
|
+
fontSize: 14,
|
|
26
|
+
fontWeight: 600,
|
|
27
|
+
};
|
|
28
|
+
const PASSIVE = { pointerEvents: 'none' };
|
|
29
|
+
//# sourceMappingURL=StructureDropOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureDropOverlay.js","sourceRoot":"","sources":["../../../src/structure/ui/StructureDropOverlay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAazC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAgC;IAEhC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAClC,OAAO,CACL,8BAAiB,wBAAwB,EAAC,KAAK,EAAE,OAAO,KAAM,QAAQ,aAGpE,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,GAAI,EAChD,eAAM,KAAK,EAAE,OAAO,YAAG,KAAK,GAAQ,IAChC,CACP,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,GAAkB;IAC7B,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,0BAA0B;IAClC,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,gEAAgE;IAC5E,KAAK,EAAE,eAAe;IACtB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;CAChB,CAAC;AAEF,MAAM,OAAO,GAAkB,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -6,86 +6,9 @@
|
|
|
6
6
|
* and `react-cheminfo/structure` stays importable when those optional peers
|
|
7
7
|
* are absent.
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
|
|
12
|
-
/** What {@link StructureEditor} needs. */
|
|
13
|
-
export interface StructureEditorProps {
|
|
14
|
-
/**
|
|
15
|
-
* Called after every edit, once the drawing has been still for `debounce`
|
|
16
|
-
* milliseconds, with every notation read out of the editor.
|
|
17
|
-
*/
|
|
18
|
-
onChange: (change: StructureEditorChange) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Draw a query fragment rather than a whole structure, which is what a
|
|
21
|
-
* substructure filter needs.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
fragment?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* How `value` is written.
|
|
27
|
-
* @default 'idcode'
|
|
28
|
-
*/
|
|
29
|
-
inputFormat?: CanvasEditorInputFormat;
|
|
30
|
-
/**
|
|
31
|
-
* What the canvas holds. Read once, when the editor appears and again on
|
|
32
|
-
* every change of `revision`: the editor is uncontrolled, so feeding the
|
|
33
|
-
* drawing back into it would replace the structure and reset every
|
|
34
|
-
* coordinate under the pen.
|
|
35
|
-
* @default ''
|
|
36
|
-
*/
|
|
37
|
-
value?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Bumped by the caller to load `value` into the canvas again, which is what
|
|
40
|
-
* an example, a share link or a Clear button does. Changing it discards
|
|
41
|
-
* whatever was being drawn.
|
|
42
|
-
* @default 0
|
|
43
|
-
*/
|
|
44
|
-
revision?: number;
|
|
45
|
-
/**
|
|
46
|
-
* How long the drawing has to be still before `onChange` is called, in
|
|
47
|
-
* milliseconds. Long enough that drawing a ring does not publish six
|
|
48
|
-
* structures; `0` reports every stroke.
|
|
49
|
-
* @default 300
|
|
50
|
-
*/
|
|
51
|
-
debounce?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Smallest height of the drawing area, in pixels. Raised to whatever the
|
|
54
|
-
* toolbar needs, which is usually more.
|
|
55
|
-
* @default 320
|
|
56
|
-
*/
|
|
57
|
-
minHeight?: number;
|
|
58
|
-
/**
|
|
59
|
-
* Whether the editor draws one structure or a reaction. A reaction canvas
|
|
60
|
-
* has its own toolbar and its own arrow.
|
|
61
|
-
* @default 'molecule'
|
|
62
|
-
*/
|
|
63
|
-
mode?: StructureEditorMode;
|
|
64
|
-
/**
|
|
65
|
-
* Explain each toolbar button in a tooltip, and put a button in the corner
|
|
66
|
-
* that opens a guide to the mouse and the keyboard, which F1 opens too.
|
|
67
|
-
* @default true
|
|
68
|
-
*/
|
|
69
|
-
help?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Put a button in the corner that opens every notation of the drawing — its
|
|
72
|
-
* SMILES, its molfiles, its canonical identifiers — and the picture of it,
|
|
73
|
-
* ready to copy or to save. A reaction has none of those, so it is never
|
|
74
|
-
* offered one.
|
|
75
|
-
* @default true
|
|
76
|
-
*/
|
|
77
|
-
exportable?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Class the container carries, so a site can reach it from its stylesheet.
|
|
80
|
-
* @default undefined
|
|
81
|
-
*/
|
|
82
|
-
className?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Extra style for the container, merged over the packaged one.
|
|
85
|
-
* @default undefined
|
|
86
|
-
*/
|
|
87
|
-
style?: CSSProperties;
|
|
88
|
-
}
|
|
9
|
+
import type { ReactElement } from 'react';
|
|
10
|
+
import type { StructureEditorProps } from './structureEditorProps.ts';
|
|
11
|
+
export type { StructureEditorProps } from './structureEditorProps.ts';
|
|
89
12
|
/**
|
|
90
13
|
* The canvas structure editor, sized to fill its container and never to hide
|
|
91
14
|
* part of its toolbar, with a tooltip on every toolbar button and a guide to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureEditor.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"StructureEditor.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAYzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAOtE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAYtE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAoGzE"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense, lazy, useCallback
|
|
2
|
+
import { Suspense, lazy, useCallback } from 'react';
|
|
3
3
|
import { useChromeT } from "../../i18n/ui/useT.js";
|
|
4
4
|
import { TOKEN } from "../../tokens/core/familyTokens.js";
|
|
5
|
-
import { createPendingCall } from "../core/pendingCall.js";
|
|
6
5
|
import { EditorHelpButton } from "./EditorHelpButton.js";
|
|
6
|
+
import { EditorImportButton } from "./EditorImportButton.js";
|
|
7
|
+
import { EditorImportProblem } from "./EditorImportProblem.js";
|
|
8
|
+
import { StructureDropOverlay } from "./StructureDropOverlay.js";
|
|
7
9
|
import { ToolbarTooltip } from "./ToolbarTooltip.js";
|
|
10
|
+
import { useDebouncedChange } from "./useDebouncedChange.js";
|
|
8
11
|
import { useEditorStructure } from "./useEditorStructure.js";
|
|
12
|
+
import { useStructureDrop } from "./useStructureDrop.js";
|
|
13
|
+
import { useStructureImport } from "./useStructureImport.js";
|
|
9
14
|
import { useToolbarFloor } from "./useToolbarFloor.js";
|
|
10
15
|
const EditorExportButton = lazy(async () => {
|
|
11
16
|
const module = await import("./EditorExportButton.js");
|
|
@@ -23,10 +28,10 @@ const EditorCanvas = lazy(async () => {
|
|
|
23
28
|
* @returns The editor.
|
|
24
29
|
*/
|
|
25
30
|
export function StructureEditor(props) {
|
|
26
|
-
const { onChange, fragment = false, inputFormat = 'idcode', value = '', revision = 0, debounce = 300, minHeight = 320, mode = 'molecule', help = true, exportable = true, className, style, } = props;
|
|
31
|
+
const { onChange, fragment = false, inputFormat = 'idcode', value = '', revision = 0, debounce = 300, minHeight = 320, mode = 'molecule', help = true, exportable = true, importable = true, onImport, className, style, } = props;
|
|
27
32
|
const t = useChromeT();
|
|
28
33
|
const containerRef = useToolbarFloor({ minHeight, revision });
|
|
29
|
-
const handleChange =
|
|
34
|
+
const handleChange = useDebouncedChange(onChange, debounce, revision);
|
|
30
35
|
const drawing = useEditorStructure({ value, inputFormat, revision });
|
|
31
36
|
const handleEdit = useCallback((change) => {
|
|
32
37
|
// Tapped undebounced, so a button beside the canvas reads the structure
|
|
@@ -34,34 +39,15 @@ export function StructureEditor(props) {
|
|
|
34
39
|
drawing.track(change);
|
|
35
40
|
handleChange(change);
|
|
36
41
|
}, [drawing, handleChange]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* The editor's own event is read out before the wait starts, so what arrives
|
|
43
|
-
* late is a plain object rather than a handle on an editor that has moved on.
|
|
44
|
-
* An editor removed mid-burst — a tab switched, a card folded — still reports
|
|
45
|
-
* its last edit, which would otherwise be lost with the timer.
|
|
46
|
-
* @param onChange - What the caller wants told.
|
|
47
|
-
* @param delay - How long the drawing has to be still, in milliseconds.
|
|
48
|
-
* @param resetKey - Dropped edits: a burst still waiting when the caller
|
|
49
|
-
* replaces the structure describes a canvas that no longer exists.
|
|
50
|
-
* @returns The handler to give the canvas.
|
|
51
|
-
*/
|
|
52
|
-
function useDebounced(onChange, delay, resetKey) {
|
|
53
|
-
const [pending] = useState((createPendingCall));
|
|
54
|
-
const onChangeRef = useRef(onChange);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
onChangeRef.current = onChange;
|
|
42
|
+
const imports = useStructureImport({
|
|
43
|
+
revision,
|
|
44
|
+
fragment,
|
|
45
|
+
onImport,
|
|
46
|
+
onRead: handleEdit,
|
|
57
47
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
useEffect(() => () => pending.flush(), [pending]);
|
|
62
|
-
return useCallback((change) => {
|
|
63
|
-
pending.push(change, delay, (value) => onChangeRef.current(value));
|
|
64
|
-
}, [pending, delay]);
|
|
48
|
+
const takesImports = importable && mode === 'molecule';
|
|
49
|
+
const drop = useStructureDrop(takesImports ? imports.load : undefined);
|
|
50
|
+
return (_jsxs("div", { ref: containerRef, className: className, style: { ...ROOT_STYLE, minHeight, ...style }, ...drop.targetProps, children: [_jsxs(Suspense, { fallback: _jsx("div", { style: LOADING_STYLE, children: t('structure.loadingEditor') }), children: [_jsx(EditorCanvas, { onChange: handleEdit, fragment: fragment, inputFormat: imports.idCode === null ? inputFormat : 'idcode', value: imports.idCode ?? value, mode: mode }, imports.canvasKey), help ? (_jsx(ToolbarTooltip, { containerRef: containerRef, mode: mode })) : null, _jsxs("div", { style: CORNER_STYLE, children: [takesImports ? (_jsx(EditorImportButton, { onImport: imports.load, accept: onImport === undefined ? STRUCTURE_FILES : undefined })) : null, exportable && mode === 'molecule' ? (_jsx(EditorExportButton, { source: drawing.source, fragment: fragment, empty: drawing.empty })) : null, help ? (_jsx(EditorHelpButton, { containerRef: containerRef, mode: mode, fragment: fragment })) : null] }), imports.problem === null ? null : (_jsx(EditorImportProblem, { problem: imports.problem, onDismiss: imports.dismiss }))] }), drop.over ? (_jsx(StructureDropOverlay, { label: t('structure.import.drop'), handlers: drop.overlayProps })) : null] }));
|
|
65
51
|
}
|
|
66
52
|
/**
|
|
67
53
|
* The canvas is positioned out of the height computation, so the container's
|
|
@@ -79,8 +65,8 @@ const ROOT_STYLE = {
|
|
|
79
65
|
background: '#fff',
|
|
80
66
|
};
|
|
81
67
|
/**
|
|
82
|
-
* The corner the editor's own buttons sit in: export
|
|
83
|
-
*
|
|
68
|
+
* The corner the editor's own buttons sit in: open, export, then help — the
|
|
69
|
+
* drawing in, the drawing out, and the guide last.
|
|
84
70
|
*/
|
|
85
71
|
const CORNER_STYLE = {
|
|
86
72
|
position: 'absolute',
|
|
@@ -99,4 +85,6 @@ const LOADING_STYLE = {
|
|
|
99
85
|
color: TOKEN.textFaint,
|
|
100
86
|
fontSize: 13,
|
|
101
87
|
};
|
|
88
|
+
/** What the editor reads itself, offered first by the file picker. */
|
|
89
|
+
const STRUCTURE_FILES = '.mol,.sdf,.sd,.smi,.smiles,.txt';
|
|
102
90
|
//# sourceMappingURL=StructureEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructureEditor.js","sourceRoot":"","sources":["../../../src/structure/ui/StructureEditor.tsx"],"names":[],"mappings":";AAUA,OAAO,
|
|
1
|
+
{"version":3,"file":"StructureEditor.js","sourceRoot":"","sources":["../../../src/structure/ui/StructureEditor.tsx"],"names":[],"mappings":";AAUA,O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EAAE,OAAO,CAAC,OAAO,EACxB,SAAS,EAAE,OAAO,CAAC,OAAO,GAC1B,CACH,IACQ,EACV,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,KAAC,oBAAoB,IACnB,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACjC,QAAQ,EAAE,IAAI,CAAC,YAAY,GAC3B,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,GAAkB;IAChC,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,aAAa,KAAK,CAAC,MAAM,EAAE;IACnC,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,MAAM;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,YAAY,GAAkB;IAClC,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,MAAM;IACf,GAAG,EAAE,CAAC;CACP,CAAC;AAEF,kEAAkE;AAClE,MAAM,aAAa,GAAkB;IACnC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,KAAK,EAAE,KAAK,CAAC,SAAS;IACtB,QAAQ,EAAE,EAAE;CACb,CAAC;AAEF,sEAAsE;AACtE,MAAM,eAAe,GAAG,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a structure dropped on the editor, or opened from disk.
|
|
3
|
+
*
|
|
4
|
+
* **Not exported from `ui/index.ts`**: it value-imports `openchemlib`. The
|
|
5
|
+
* editor loads it on the first drop, by which time the canvas has already
|
|
6
|
+
* brought openchemlib in.
|
|
7
|
+
*/
|
|
8
|
+
import type { StructureEditorMoleculeChange } from './editorChange.ts';
|
|
9
|
+
/**
|
|
10
|
+
* Turn dropped text into what the editor reports after an edit.
|
|
11
|
+
*
|
|
12
|
+
* A molfile is read whole, so an SDF gives its first record. Anything else is
|
|
13
|
+
* read from its first meaningful line, as a SMILES and then as an idCode — but
|
|
14
|
+
* an idCode only when it is the canonical one, because openchemlib decodes
|
|
15
|
+
* almost any word into some molecule: `ethanol` read as an idCode has 1106
|
|
16
|
+
* atoms. A word holding a character no idCode holds is never decoded, since
|
|
17
|
+
* openchemlib does not return from some of them — `O=Cc1cccc`, a SMILES with
|
|
18
|
+
* an unclosed ring, is one. A 3D structure is laid out flat, since the canvas
|
|
19
|
+
* draws in 2D.
|
|
20
|
+
* @param text - The file's content or the dragged text.
|
|
21
|
+
* @param fragment - Whether the editor draws a query fragment.
|
|
22
|
+
* @returns The change, or `null` when the text holds no structure.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readImportedStructure(text: string, fragment: boolean): StructureEditorMoleculeChange | null;
|
|
25
|
+
//# sourceMappingURL=importedStructure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importedStructure.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/importedStructure.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,GAChB,6BAA6B,GAAG,IAAI,CActC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a structure dropped on the editor, or opened from disk.
|
|
3
|
+
*
|
|
4
|
+
* **Not exported from `ui/index.ts`**: it value-imports `openchemlib`. The
|
|
5
|
+
* editor loads it on the first drop, by which time the canvas has already
|
|
6
|
+
* brought openchemlib in.
|
|
7
|
+
*/
|
|
8
|
+
import { Canonizer, Molecule } from 'openchemlib';
|
|
9
|
+
import { splitEditorValue } from "../core/editorValue.js";
|
|
10
|
+
/**
|
|
11
|
+
* Turn dropped text into what the editor reports after an edit.
|
|
12
|
+
*
|
|
13
|
+
* A molfile is read whole, so an SDF gives its first record. Anything else is
|
|
14
|
+
* read from its first meaningful line, as a SMILES and then as an idCode — but
|
|
15
|
+
* an idCode only when it is the canonical one, because openchemlib decodes
|
|
16
|
+
* almost any word into some molecule: `ethanol` read as an idCode has 1106
|
|
17
|
+
* atoms. A word holding a character no idCode holds is never decoded, since
|
|
18
|
+
* openchemlib does not return from some of them — `O=Cc1cccc`, a SMILES with
|
|
19
|
+
* an unclosed ring, is one. A 3D structure is laid out flat, since the canvas
|
|
20
|
+
* draws in 2D.
|
|
21
|
+
* @param text - The file's content or the dragged text.
|
|
22
|
+
* @param fragment - Whether the editor draws a query fragment.
|
|
23
|
+
* @returns The change, or `null` when the text holds no structure.
|
|
24
|
+
*/
|
|
25
|
+
export function readImportedStructure(text, fragment) {
|
|
26
|
+
const molecule = parseStructure(text);
|
|
27
|
+
if (molecule === null || molecule.getAllAtoms() === 0)
|
|
28
|
+
return null;
|
|
29
|
+
if (hasDepth(molecule))
|
|
30
|
+
molecule.inventCoordinates();
|
|
31
|
+
molecule.setFragment(fragment);
|
|
32
|
+
const canonizer = new Canonizer(molecule);
|
|
33
|
+
return {
|
|
34
|
+
mode: 'molecule',
|
|
35
|
+
idCode: `${canonizer.getIDCode()} ${canonizer.getEncodedCoordinates(false)}`,
|
|
36
|
+
molfile: molecule.toMolfile(),
|
|
37
|
+
smiles: molecule.toIsomericSmiles(),
|
|
38
|
+
molecule: molecule.getCompactCopy(),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function parseStructure(text) {
|
|
42
|
+
const value = splitEditorValue(text);
|
|
43
|
+
if (value.kind === 'molfile') {
|
|
44
|
+
return attempt(() => Molecule.fromMolfile(value.molfile));
|
|
45
|
+
}
|
|
46
|
+
const notation = value.entries[0]?.structure;
|
|
47
|
+
if (notation === undefined)
|
|
48
|
+
return null;
|
|
49
|
+
return (attempt(() => Molecule.fromSmiles(notation)) ?? canonicalIdCode(notation));
|
|
50
|
+
}
|
|
51
|
+
function canonicalIdCode(text) {
|
|
52
|
+
if (!ID_CODE.test(text))
|
|
53
|
+
return null;
|
|
54
|
+
const molecule = attempt(() => Molecule.fromIDCode(text));
|
|
55
|
+
return molecule?.getIDCode() === text ? molecule : null;
|
|
56
|
+
}
|
|
57
|
+
function attempt(parse) {
|
|
58
|
+
try {
|
|
59
|
+
return parse();
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function hasDepth(molecule) {
|
|
66
|
+
for (let atom = 0; atom < molecule.getAllAtoms(); atom++) {
|
|
67
|
+
if (molecule.getAtomZ(atom) !== 0)
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
/** An idCode is written in six-bit groups offset to `@`, so in `@` to DEL. */
|
|
73
|
+
const ID_CODE = /^[\u0040-\u007F]+$/;
|
|
74
|
+
//# sourceMappingURL=importedStructure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importedStructure.js","sourceRoot":"","sources":["../../../src/structure/ui/importedStructure.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,QAAiB;IAEjB,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnE,IAAI,QAAQ,CAAC,QAA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AE,SAAS,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC;AAED,SAAS,OAAO,CAAC,KAAqB;IACpC,IAAI,CAAC;QACH,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,QAAkB;IAClC,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;QACzD,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8EAA8E;AAC9E,MAAM,OAAO,GAAG,oBAAoB,CAAC"}
|
|
@@ -15,6 +15,8 @@ export type { StructureLabels, StructureProps } from './Structure.tsx';
|
|
|
15
15
|
export { Structure } from './Structure.tsx';
|
|
16
16
|
export type { StructureEditorProps } from './StructureEditor.tsx';
|
|
17
17
|
export { StructureEditor } from './StructureEditor.tsx';
|
|
18
|
+
export type { StructureDropProps } from './StructureDrop.tsx';
|
|
19
|
+
export { StructureDrop } from './StructureDrop.tsx';
|
|
18
20
|
export type { StructureEditorHelpProps } from './StructureEditorHelp.tsx';
|
|
19
21
|
export { StructureEditorHelp } from './StructureEditorHelp.tsx';
|
|
20
22
|
export type { StructureExportDialogProps } from './StructureExportDialog.tsx';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,eAAe,EAA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AAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { Structure } from "./Structure.js";
|
|
14
14
|
export { StructureEditor } from "./StructureEditor.js";
|
|
15
|
+
export { StructureDrop } from "./StructureDrop.js";
|
|
15
16
|
export { StructureEditorHelp } from "./StructureEditorHelp.js";
|
|
16
17
|
export { StructureExportDialog } from "./StructureExportDialog.js";
|
|
17
18
|
export { StructureExportButton } from "./StructureExportButton.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structure/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structure/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA6B,CAAC;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|