react-cheminfo 0.76.0 → 0.78.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 +141 -31
- package/lib/card/core/cardAddress.d.ts +19 -2
- package/lib/card/core/cardAddress.d.ts.map +1 -1
- package/lib/card/core/cardAddress.js +35 -2
- package/lib/card/core/cardAddress.js.map +1 -1
- package/lib/card/core/cardPageUrl.d.ts +7 -1
- package/lib/card/core/cardPageUrl.d.ts.map +1 -1
- package/lib/card/core/cardPageUrl.js +4 -2
- package/lib/card/core/cardPageUrl.js.map +1 -1
- package/lib/card/core/index.d.ts +1 -1
- package/lib/card/core/index.d.ts.map +1 -1
- package/lib/card/core/index.js +1 -1
- package/lib/card/core/index.js.map +1 -1
- package/lib/credits/core/credits.d.ts +30 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +35 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/download/core/downloadFigure.d.ts +12 -1
- package/lib/download/core/downloadFigure.d.ts.map +1 -1
- package/lib/download/core/downloadFigure.js +21 -0
- package/lib/download/core/downloadFigure.js.map +1 -1
- package/lib/download/core/figureDpi.d.ts +59 -0
- package/lib/download/core/figureDpi.d.ts.map +1 -0
- package/lib/download/core/figureDpi.js +75 -0
- package/lib/download/core/figureDpi.js.map +1 -0
- package/lib/download/core/figurePng.d.ts +4 -1
- package/lib/download/core/figurePng.d.ts.map +1 -1
- package/lib/download/core/figurePng.js +11 -2
- package/lib/download/core/figurePng.js.map +1 -1
- package/lib/download/core/index.d.ts +4 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +3 -1
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/pngDpi.d.ts +22 -0
- package/lib/download/core/pngDpi.d.ts.map +1 -0
- package/lib/download/core/pngDpi.js +79 -0
- package/lib/download/core/pngDpi.js.map +1 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts +13 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +18 -34
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +5 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
- package/lib/download/ui/figureDownloadHint.js +8 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -1
- package/lib/download/ui/figureDownloadOptions.d.ts +84 -0
- package/lib/download/ui/figureDownloadOptions.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadOptions.js +2 -0
- package/lib/download/ui/figureDownloadOptions.js.map +1 -0
- package/lib/download/ui/resolutionChoices.d.ts +27 -0
- package/lib/download/ui/resolutionChoices.d.ts.map +1 -0
- package/lib/download/ui/resolutionChoices.js +48 -0
- package/lib/download/ui/resolutionChoices.js.map +1 -0
- package/lib/download/ui/useFigureActions.d.ts +4 -1
- package/lib/download/ui/useFigureActions.d.ts.map +1 -1
- package/lib/download/ui/useFigureActions.js +17 -8
- package/lib/download/ui/useFigureActions.js.map +1 -1
- package/lib/download/ui/useFigureDownload.d.ts +2 -55
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -1
- package/lib/download/ui/useFigureDownload.js +45 -13
- package/lib/download/ui/useFigureDownload.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +14 -0
- 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.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +3 -0
- package/lib/ecosystem/ui/glyphs.js.map +1 -1
- package/lib/host/core/connectHost.js +1 -1
- package/lib/host/core/connectHost.js.map +1 -1
- package/lib/host/core/connectTool.d.ts +103 -0
- package/lib/host/core/connectTool.d.ts.map +1 -0
- package/lib/host/core/connectTool.js +169 -0
- package/lib/host/core/connectTool.js.map +1 -0
- package/lib/host/core/hostOutputs.d.ts +16 -3
- package/lib/host/core/hostOutputs.d.ts.map +1 -1
- package/lib/host/core/hostOutputs.js +38 -4
- package/lib/host/core/hostOutputs.js.map +1 -1
- package/lib/host/core/index.d.ts +8 -2
- package/lib/host/core/index.d.ts.map +1 -1
- package/lib/host/core/index.js +4 -1
- package/lib/host/core/index.js.map +1 -1
- package/lib/host/core/kinds.d.ts +31 -3
- package/lib/host/core/kinds.d.ts.map +1 -1
- package/lib/host/core/kinds.js +35 -4
- package/lib/host/core/kinds.js.map +1 -1
- package/lib/host/core/messageValues.d.ts +29 -0
- package/lib/host/core/messageValues.d.ts.map +1 -0
- package/lib/host/core/messageValues.js +57 -0
- package/lib/host/core/messageValues.js.map +1 -0
- package/lib/host/core/protocol.d.ts +2 -5
- package/lib/host/core/protocol.d.ts.map +1 -1
- package/lib/host/core/protocol.js +3 -37
- package/lib/host/core/protocol.js.map +1 -1
- package/lib/host/core/resultKinds.d.ts +74 -0
- package/lib/host/core/resultKinds.d.ts.map +1 -0
- package/lib/host/core/resultKinds.js +40 -0
- package/lib/host/core/resultKinds.js.map +1 -0
- package/lib/host/core/toolMessages.d.ts +24 -0
- package/lib/host/core/toolMessages.d.ts.map +1 -0
- package/lib/host/core/toolMessages.js +136 -0
- package/lib/host/core/toolMessages.js.map +1 -0
- package/lib/host/ui/index.d.ts +2 -0
- package/lib/host/ui/index.d.ts.map +1 -1
- package/lib/host/ui/index.js +1 -0
- package/lib/host/ui/index.js.map +1 -1
- package/lib/host/ui/useFramedTool.d.ts +74 -0
- package/lib/host/ui/useFramedTool.d.ts.map +1 -0
- package/lib/host/ui/useFramedTool.js +125 -0
- package/lib/host/ui/useFramedTool.js.map +1 -0
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +30 -1
- package/lib/locales/en.json +30 -1
- package/lib/locales/es.json +30 -1
- package/lib/locales/fr.json +30 -1
- package/lib/locales/it.json +30 -1
- package/lib/molecule3d/ui/Molecule3DStage.d.ts +4 -33
- package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DStage.js +3 -37
- package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +10 -2
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts +10 -0
- package/lib/molecule3d/ui/exportMoleculeImage.d.ts.map +1 -1
- package/lib/molecule3d/ui/exportMoleculeImage.js +17 -0
- package/lib/molecule3d/ui/exportMoleculeImage.js.map +1 -1
- package/lib/molecule3d/ui/index.d.ts +1 -1
- package/lib/molecule3d/ui/index.d.ts.map +1 -1
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts +23 -0
- package/lib/molecule3d/ui/moleculeViewer3DProps.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.d.ts +3 -0
- package/lib/molecule3d/ui/useImageExport.d.ts.map +1 -1
- package/lib/molecule3d/ui/useImageExport.js +21 -3
- package/lib/molecule3d/ui/useImageExport.js.map +1 -1
- package/lib/osiris/core/barGeometry.d.ts +42 -0
- package/lib/osiris/core/barGeometry.d.ts.map +1 -0
- package/lib/osiris/core/barGeometry.js +46 -0
- package/lib/osiris/core/barGeometry.js.map +1 -0
- package/lib/osiris/core/computeProperties.d.ts +42 -0
- package/lib/osiris/core/computeProperties.d.ts.map +1 -0
- package/lib/osiris/core/computeProperties.js +115 -0
- package/lib/osiris/core/computeProperties.js.map +1 -0
- package/lib/osiris/core/constants.d.ts +70 -0
- package/lib/osiris/core/constants.d.ts.map +1 -0
- package/lib/osiris/core/constants.js +99 -0
- package/lib/osiris/core/constants.js.map +1 -0
- package/lib/osiris/core/fitness.d.ts +32 -0
- package/lib/osiris/core/fitness.d.ts.map +1 -0
- package/lib/osiris/core/fitness.js +48 -0
- package/lib/osiris/core/fitness.js.map +1 -0
- package/lib/osiris/core/index.d.ts +29 -0
- package/lib/osiris/core/index.d.ts.map +1 -0
- package/lib/osiris/core/index.js +19 -0
- package/lib/osiris/core/index.js.map +1 -0
- package/lib/osiris/core/poolSize.d.ts +17 -0
- package/lib/osiris/core/poolSize.d.ts.map +1 -0
- package/lib/osiris/core/poolSize.js +22 -0
- package/lib/osiris/core/poolSize.js.map +1 -0
- package/lib/osiris/core/poolTypes.d.ts +140 -0
- package/lib/osiris/core/poolTypes.d.ts.map +1 -0
- package/lib/osiris/core/poolTypes.js +12 -0
- package/lib/osiris/core/poolTypes.js.map +1 -0
- package/lib/osiris/core/predictIdCode.d.ts +39 -0
- package/lib/osiris/core/predictIdCode.d.ts.map +1 -0
- package/lib/osiris/core/predictIdCode.js +54 -0
- package/lib/osiris/core/predictIdCode.js.map +1 -0
- package/lib/osiris/core/predictProtocol.d.ts +67 -0
- package/lib/osiris/core/predictProtocol.d.ts.map +1 -0
- package/lib/osiris/core/predictProtocol.js +29 -0
- package/lib/osiris/core/predictProtocol.js.map +1 -0
- package/lib/osiris/core/predictionPool.d.ts +23 -0
- package/lib/osiris/core/predictionPool.d.ts.map +1 -0
- package/lib/osiris/core/predictionPool.js +186 -0
- package/lib/osiris/core/predictionPool.js.map +1 -0
- package/lib/osiris/core/predictionQueue.d.ts +46 -0
- package/lib/osiris/core/predictionQueue.d.ts.map +1 -0
- package/lib/osiris/core/predictionQueue.js +57 -0
- package/lib/osiris/core/predictionQueue.js.map +1 -0
- package/lib/osiris/core/predictors.d.ts +62 -0
- package/lib/osiris/core/predictors.d.ts.map +1 -0
- package/lib/osiris/core/predictors.js +100 -0
- package/lib/osiris/core/predictors.js.map +1 -0
- package/lib/osiris/core/propertyKeys.d.ts +32 -0
- package/lib/osiris/core/propertyKeys.d.ts.map +1 -0
- package/lib/osiris/core/propertyKeys.js +44 -0
- package/lib/osiris/core/propertyKeys.js.map +1 -0
- package/lib/osiris/core/riskAppearance.d.ts +60 -0
- package/lib/osiris/core/riskAppearance.d.ts.map +1 -0
- package/lib/osiris/core/riskAppearance.js +59 -0
- package/lib/osiris/core/riskAppearance.js.map +1 -0
- package/lib/osiris/core/riskDetail.d.ts +22 -0
- package/lib/osiris/core/riskDetail.d.ts.map +1 -0
- package/lib/osiris/core/riskDetail.js +86 -0
- package/lib/osiris/core/riskDetail.js.map +1 -0
- package/lib/osiris/core/riskDetailRequest.d.ts +31 -0
- package/lib/osiris/core/riskDetailRequest.d.ts.map +1 -0
- package/lib/osiris/core/riskDetailRequest.js +49 -0
- package/lib/osiris/core/riskDetailRequest.js.map +1 -0
- package/lib/osiris/core/riskFindings.d.ts +26 -0
- package/lib/osiris/core/riskFindings.d.ts.map +1 -0
- package/lib/osiris/core/riskFindings.js +79 -0
- package/lib/osiris/core/riskFindings.js.map +1 -0
- package/lib/osiris/core/runPredictionJob.d.ts +20 -0
- package/lib/osiris/core/runPredictionJob.d.ts.map +1 -0
- package/lib/osiris/core/runPredictionJob.js +43 -0
- package/lib/osiris/core/runPredictionJob.js.map +1 -0
- package/lib/osiris/core/scales.d.ts +70 -0
- package/lib/osiris/core/scales.d.ts.map +1 -0
- package/lib/osiris/core/scales.js +185 -0
- package/lib/osiris/core/scales.js.map +1 -0
- package/lib/osiris/core/types.d.ts +91 -0
- package/lib/osiris/core/types.d.ts.map +1 -0
- package/lib/osiris/core/types.js +19 -0
- package/lib/osiris/core/types.js.map +1 -0
- package/lib/osiris/core/valuation.d.ts +28 -0
- package/lib/osiris/core/valuation.d.ts.map +1 -0
- package/lib/osiris/core/valuation.js +39 -0
- package/lib/osiris/core/valuation.js.map +1 -0
- package/lib/osiris/ui/PropertyBar.d.ts +27 -0
- package/lib/osiris/ui/PropertyBar.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyBar.js +27 -0
- package/lib/osiris/ui/PropertyBar.js.map +1 -0
- package/lib/osiris/ui/PropertyPanel.d.ts +91 -0
- package/lib/osiris/ui/PropertyPanel.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyPanel.js +77 -0
- package/lib/osiris/ui/PropertyPanel.js.map +1 -0
- package/lib/osiris/ui/PropertyRows.d.ts +40 -0
- package/lib/osiris/ui/PropertyRows.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyRows.js +23 -0
- package/lib/osiris/ui/PropertyRows.js.map +1 -0
- package/lib/osiris/ui/RiskFindings.d.ts +43 -0
- package/lib/osiris/ui/RiskFindings.d.ts.map +1 -0
- package/lib/osiris/ui/RiskFindings.js +51 -0
- package/lib/osiris/ui/RiskFindings.js.map +1 -0
- package/lib/osiris/ui/RiskPanel.d.ts +46 -0
- package/lib/osiris/ui/RiskPanel.d.ts.map +1 -0
- package/lib/osiris/ui/RiskPanel.js +32 -0
- package/lib/osiris/ui/RiskPanel.js.map +1 -0
- package/lib/osiris/ui/RiskSquare.d.ts +51 -0
- package/lib/osiris/ui/RiskSquare.d.ts.map +1 -0
- package/lib/osiris/ui/RiskSquare.js +23 -0
- package/lib/osiris/ui/RiskSquare.js.map +1 -0
- package/lib/osiris/ui/index.d.ts +15 -0
- package/lib/osiris/ui/index.d.ts.map +1 -0
- package/lib/osiris/ui/index.js +8 -0
- package/lib/osiris/ui/index.js.map +1 -0
- package/lib/osiris/ui/usePredictions.d.ts +81 -0
- package/lib/osiris/ui/usePredictions.d.ts.map +1 -0
- package/lib/osiris/ui/usePredictions.js +102 -0
- package/lib/osiris/ui/usePredictions.js.map +1 -0
- package/lib/osiris-ui.d.ts +11 -0
- package/lib/osiris-ui.d.ts.map +1 -0
- package/lib/osiris-ui.js +11 -0
- package/lib/osiris-ui.js.map +1 -0
- package/lib/osiris.d.ts +17 -0
- package/lib/osiris.d.ts.map +1 -0
- package/lib/osiris.js +17 -0
- package/lib/osiris.js.map +1 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.js +3 -1
- package/lib/panel/ui/FilterInput.js.map +1 -1
- package/lib/panel/ui/SidePanelItem.d.ts +39 -0
- package/lib/panel/ui/SidePanelItem.d.ts.map +1 -0
- package/lib/panel/ui/SidePanelItem.js +63 -0
- package/lib/panel/ui/SidePanelItem.js.map +1 -0
- package/lib/panel/ui/SidePanelStack.d.ts +11 -10
- package/lib/panel/ui/SidePanelStack.d.ts.map +1 -1
- package/lib/panel/ui/SidePanelStack.js +22 -15
- package/lib/panel/ui/SidePanelStack.js.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.js +4 -2
- package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -1
- package/lib/panel/ui/usePanelFolds.d.ts +35 -0
- package/lib/panel/ui/usePanelFolds.d.ts.map +1 -0
- package/lib/panel/ui/usePanelFolds.js +73 -0
- package/lib/panel/ui/usePanelFolds.js.map +1 -0
- package/lib/shared/ui/FullscreenStage.d.ts +43 -0
- package/lib/shared/ui/FullscreenStage.d.ts.map +1 -0
- package/lib/shared/ui/FullscreenStage.js +38 -0
- package/lib/shared/ui/FullscreenStage.js.map +1 -0
- package/lib/shared/ui/canFillScreen.d.ts +7 -0
- package/lib/shared/ui/canFillScreen.d.ts.map +1 -0
- package/lib/shared/ui/canFillScreen.js +9 -0
- package/lib/shared/ui/canFillScreen.js.map +1 -0
- package/lib/shared/ui/index.d.ts +3 -0
- package/lib/shared/ui/index.d.ts.map +1 -1
- package/lib/shared/ui/index.js +2 -0
- package/lib/shared/ui/index.js.map +1 -1
- package/lib/split/ui/splitPanes.d.ts +3 -3
- package/lib/split/ui/splitPanes.js +1 -1
- package/lib/structure/core/structureNotations.d.ts +8 -1
- package/lib/structure/core/structureNotations.d.ts.map +1 -1
- package/lib/structure/core/structureNotations.js +14 -8
- package/lib/structure/core/structureNotations.js.map +1 -1
- package/lib/structure/ui/StructureExportPanel.d.ts +8 -0
- package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -1
- package/lib/structure/ui/StructureExportPanel.js +9 -4
- package/lib/structure/ui/StructureExportPanel.js.map +1 -1
- package/lib/structure/ui/index.d.ts +1 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js.map +1 -1
- package/package.json +4 -1
- package/src/card/core/cardAddress.ts +39 -3
- package/src/card/core/cardPageUrl.ts +10 -3
- package/src/card/core/index.ts +7 -1
- package/src/credits/core/credits.ts +40 -0
- package/src/download/core/downloadFigure.ts +26 -1
- package/src/download/core/figureDpi.ts +94 -0
- package/src/download/core/figurePng.ts +11 -2
- package/src/download/core/index.ts +13 -1
- package/src/download/core/pngDpi.ts +84 -0
- package/src/download/ui/FigureDownloadPanel.tsx +41 -51
- package/src/download/ui/figureDownloadHint.ts +13 -0
- package/src/download/ui/figureDownloadOptions.ts +85 -0
- package/src/download/ui/resolutionChoices.ts +67 -0
- package/src/download/ui/useFigureActions.ts +24 -9
- package/src/download/ui/useFigureDownload.tsx +57 -71
- package/src/ecosystem/core/sites.ts +14 -0
- package/src/ecosystem/core/types.ts +2 -1
- package/src/ecosystem/ui/glyphs.tsx +20 -0
- package/src/host/core/connectHost.ts +1 -1
- package/src/host/core/connectTool.ts +285 -0
- package/src/host/core/hostOutputs.ts +47 -5
- package/src/host/core/index.ts +20 -1
- package/src/host/core/kinds.ts +53 -8
- package/src/host/core/messageValues.ts +58 -0
- package/src/host/core/protocol.ts +5 -37
- package/src/host/core/resultKinds.ts +65 -0
- package/src/host/core/toolMessages.ts +160 -0
- package/src/host/ui/index.ts +6 -0
- package/src/host/ui/useFramedTool.ts +213 -0
- package/src/locales/de.json +30 -1
- package/src/locales/en.json +30 -1
- package/src/locales/es.json +30 -1
- package/src/locales/fr.json +30 -1
- package/src/locales/it.json +30 -1
- package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +10 -1
- package/src/molecule3d/ui/exportMoleculeImage.ts +22 -0
- package/src/molecule3d/ui/index.ts +4 -1
- package/src/molecule3d/ui/moleculeViewer3DProps.ts +24 -0
- package/src/molecule3d/ui/useImageExport.ts +28 -2
- package/src/osiris/core/barGeometry.ts +74 -0
- package/src/osiris/core/computeProperties.ts +175 -0
- package/src/osiris/core/constants.ts +110 -0
- package/src/osiris/core/fitness.ts +59 -0
- package/src/osiris/core/index.ts +78 -0
- package/src/osiris/core/poolSize.ts +24 -0
- package/src/osiris/core/poolTypes.ts +140 -0
- package/src/osiris/core/predictIdCode.ts +69 -0
- package/src/osiris/core/predictProtocol.ts +78 -0
- package/src/osiris/core/predictionPool.ts +237 -0
- package/src/osiris/core/predictionQueue.ts +89 -0
- package/src/osiris/core/predictors.ts +142 -0
- package/src/osiris/core/propertyKeys.ts +54 -0
- package/src/osiris/core/riskAppearance.ts +86 -0
- package/src/osiris/core/riskDetail.ts +120 -0
- package/src/osiris/core/riskDetailRequest.ts +64 -0
- package/src/osiris/core/riskFindings.ts +92 -0
- package/src/osiris/core/runPredictionJob.ts +49 -0
- package/src/osiris/core/scales.ts +236 -0
- package/src/osiris/core/types.ts +103 -0
- package/src/osiris/core/valuation.ts +44 -0
- package/src/osiris/ui/PropertyBar.tsx +77 -0
- package/src/osiris/ui/PropertyPanel.tsx +227 -0
- package/src/osiris/ui/PropertyRows.tsx +92 -0
- package/src/osiris/ui/RiskFindings.tsx +137 -0
- package/src/osiris/ui/RiskPanel.tsx +81 -0
- package/src/osiris/ui/RiskSquare.tsx +108 -0
- package/src/osiris/ui/index.ts +17 -0
- package/src/osiris/ui/usePredictions.ts +194 -0
- package/src/osiris-ui.ts +11 -0
- package/src/osiris.ts +17 -0
- package/src/panel/ui/FilterInput.tsx +4 -1
- package/src/panel/ui/SidePanelItem.tsx +162 -0
- package/src/panel/ui/SidePanelStack.tsx +29 -36
- package/src/panel/ui/SpectrumColorSwatch.tsx +5 -3
- package/src/panel/ui/usePanelFolds.ts +103 -0
- package/src/shared/ui/FullscreenStage.tsx +96 -0
- package/src/shared/ui/canFillScreen.ts +8 -0
- package/src/shared/ui/index.ts +6 -0
- package/src/split/ui/splitPanes.tsx +4 -4
- package/src/structure/core/structureNotations.ts +25 -8
- package/src/structure/ui/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/index.ts +4 -0
- package/styles/osiris.css +339 -0
package/lib/host/core/kinds.d.ts
CHANGED
|
@@ -4,14 +4,17 @@
|
|
|
4
4
|
* name, a JSON Schema, and ajv.
|
|
5
5
|
*
|
|
6
6
|
* The names are pipeline's (`chem.molfile.2d`, `chem.ocl.id`…), plus
|
|
7
|
-
* `chem.smiles`, which pipeline lists among its future schemas,
|
|
8
|
-
* infrared kinds of `./irKinds.ts
|
|
7
|
+
* `chem.smiles`, which pipeline lists among its future schemas, the two
|
|
8
|
+
* infrared kinds of `./irKinds.ts`, and the kinds a tool hands back, of
|
|
9
|
+
* `./resultKinds.ts`. A name with children is a category whose
|
|
9
10
|
* schema every child satisfies, so `chem.molfile` reads `chem.molfile.2d` and
|
|
10
11
|
* `chem.molfile.3d.h.energy` alike; the fields a tool does not read are
|
|
11
12
|
* stripped rather than refused, so a host sending more than it needs to is
|
|
12
13
|
* never turned away.
|
|
13
14
|
*/
|
|
14
15
|
import type { IrJdxValue, IrPeaksValue } from './irKinds.ts';
|
|
16
|
+
import type { HostItem } from './protocol.ts';
|
|
17
|
+
import type { NameValue, SvgImageValue, TableValue } from './resultKinds.ts';
|
|
15
18
|
/** A molfile, V2000 or V3000. */
|
|
16
19
|
export interface MolfileValue {
|
|
17
20
|
molfile: string;
|
|
@@ -41,9 +44,22 @@ export type CheckedValue = {
|
|
|
41
44
|
} | {
|
|
42
45
|
kind: 'spectra.ir.peaks';
|
|
43
46
|
value: IrPeaksValue;
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'image.svg';
|
|
49
|
+
value: SvgImageValue;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'chem.name';
|
|
52
|
+
value: NameValue;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'data.table';
|
|
55
|
+
value: TableValue;
|
|
44
56
|
};
|
|
45
|
-
/** The name of a kind a tool
|
|
57
|
+
/** The name of a kind there is a schema for: one a tool reads, or one it hands back. */
|
|
46
58
|
export type KnownKind = CheckedValue['kind'];
|
|
59
|
+
/** A checked value of one kind. */
|
|
60
|
+
export type CheckedOf<K extends KnownKind> = Extract<CheckedValue, {
|
|
61
|
+
kind: K;
|
|
62
|
+
}>;
|
|
47
63
|
/** What checking a value gave. */
|
|
48
64
|
export type CheckOutcome = {
|
|
49
65
|
valid: true;
|
|
@@ -78,4 +94,16 @@ export declare function isKnownKind(kind: string): kind is KnownKind;
|
|
|
78
94
|
* them, `'/idCode: must be string'`.
|
|
79
95
|
*/
|
|
80
96
|
export declare function checkValue(kind: KnownKind, value: unknown): CheckOutcome;
|
|
97
|
+
/**
|
|
98
|
+
* Read the value a tool handed back under an output, as the kind the host
|
|
99
|
+
* asked for: the item must be of that kind or one under it, and pass that
|
|
100
|
+
* kind's schema.
|
|
101
|
+
* @param items - What the tool handed back.
|
|
102
|
+
* @param key - The output.
|
|
103
|
+
* @param kind - The kind it is read as.
|
|
104
|
+
* @returns The value tagged with the kind, or `undefined` when the tool handed
|
|
105
|
+
* nothing back under that key.
|
|
106
|
+
* @throws {Error} When the item is of another kind, or not of its shape.
|
|
107
|
+
*/
|
|
108
|
+
export declare function readOutput<K extends KnownKind>(items: readonly HostItem[], key: string, kind: K): CheckedOf<K> | undefined;
|
|
81
109
|
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../src/host/core/kinds.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../src/host/core/kinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe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GACtB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,SAAS,CAE3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAWxE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,EAC5C,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,GACN,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAc1B"}
|
package/lib/host/core/kinds.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* name, a JSON Schema, and ajv.
|
|
5
5
|
*
|
|
6
6
|
* The names are pipeline's (`chem.molfile.2d`, `chem.ocl.id`…), plus
|
|
7
|
-
* `chem.smiles`, which pipeline lists among its future schemas,
|
|
8
|
-
* infrared kinds of `./irKinds.ts
|
|
7
|
+
* `chem.smiles`, which pipeline lists among its future schemas, the two
|
|
8
|
+
* infrared kinds of `./irKinds.ts`, and the kinds a tool hands back, of
|
|
9
|
+
* `./resultKinds.ts`. A name with children is a category whose
|
|
9
10
|
* schema every child satisfies, so `chem.molfile` reads `chem.molfile.2d` and
|
|
10
11
|
* `chem.molfile.3d.h.energy` alike; the fields a tool does not read are
|
|
11
12
|
* stripped rather than refused, so a host sending more than it needs to is
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
*/
|
|
14
15
|
import { Ajv } from 'ajv';
|
|
15
16
|
import { IR_JDX_SCHEMA, IR_PEAKS_SCHEMA } from "./irKinds.js";
|
|
17
|
+
import { NAME_SCHEMA, SVG_IMAGE_SCHEMA, TABLE_SCHEMA } from "./resultKinds.js";
|
|
16
18
|
/**
|
|
17
19
|
* Whether a kind falls under another: the same name, or a name under it on a
|
|
18
20
|
* segment boundary. A list (`…[]`) never stands for one value, nor one value
|
|
@@ -59,6 +61,31 @@ export function checkValue(kind, value) {
|
|
|
59
61
|
}
|
|
60
62
|
return { valid: false, errors };
|
|
61
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Read the value a tool handed back under an output, as the kind the host
|
|
66
|
+
* asked for: the item must be of that kind or one under it, and pass that
|
|
67
|
+
* kind's schema.
|
|
68
|
+
* @param items - What the tool handed back.
|
|
69
|
+
* @param key - The output.
|
|
70
|
+
* @param kind - The kind it is read as.
|
|
71
|
+
* @returns The value tagged with the kind, or `undefined` when the tool handed
|
|
72
|
+
* nothing back under that key.
|
|
73
|
+
* @throws {Error} When the item is of another kind, or not of its shape.
|
|
74
|
+
*/
|
|
75
|
+
export function readOutput(items, key, kind) {
|
|
76
|
+
const item = items.find((entry) => entry.key === key);
|
|
77
|
+
if (item === undefined)
|
|
78
|
+
return undefined;
|
|
79
|
+
if (!kindAccepts(kind, item.kind)) {
|
|
80
|
+
throw new Error(`The ${key} handed back is a ${item.kind}, not a ${kind}.`);
|
|
81
|
+
}
|
|
82
|
+
const outcome = checkValue(kind, item.value);
|
|
83
|
+
if (!outcome.valid) {
|
|
84
|
+
throw new Error(`The ${key} handed back is not shaped as a ${kind}: ${outcome.errors.join('; ')}.`);
|
|
85
|
+
}
|
|
86
|
+
// The validator of `kind` just vouched for the shape of the value.
|
|
87
|
+
return outcome.checked;
|
|
88
|
+
}
|
|
62
89
|
const MOLFILE_SCHEMA = {
|
|
63
90
|
type: 'object',
|
|
64
91
|
properties: { molfile: { type: 'string' } },
|
|
@@ -80,8 +107,9 @@ const SMILES_SCHEMA = {
|
|
|
80
107
|
required: ['smiles'],
|
|
81
108
|
additionalProperties: false,
|
|
82
109
|
};
|
|
83
|
-
// `removeAdditional` strips what `additionalProperties: false` would refuse
|
|
84
|
-
|
|
110
|
+
// `removeAdditional` strips what `additionalProperties: false` would refuse;
|
|
111
|
+
// a table's cell is a string, a number or null, which is a union of types.
|
|
112
|
+
const ajv = new Ajv({ removeAdditional: true, allowUnionTypes: true });
|
|
85
113
|
const VALIDATORS = {
|
|
86
114
|
'chem.molfile': ajv.compile(MOLFILE_SCHEMA),
|
|
87
115
|
'chem.ocl.id': ajv.compile(OCL_ID_SCHEMA),
|
|
@@ -90,5 +118,8 @@ const VALIDATORS = {
|
|
|
90
118
|
// `nullable` on every optional field and so let a `null` band through.
|
|
91
119
|
'spectra.ir.jdx': ajv.compile(IR_JDX_SCHEMA),
|
|
92
120
|
'spectra.ir.peaks': ajv.compile(IR_PEAKS_SCHEMA),
|
|
121
|
+
'image.svg': ajv.compile(SVG_IMAGE_SCHEMA),
|
|
122
|
+
'chem.name': ajv.compile(NAME_SCHEMA),
|
|
123
|
+
'data.table': ajv.compile(TABLE_SCHEMA),
|
|
93
124
|
};
|
|
94
125
|
//# sourceMappingURL=kinds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../../src/host/core/kinds.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../../src/host/core/kinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0C/E;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,OAAe;I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oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAM,aAAa,GAAgC;IACjD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC1C,QAAQ,EAAE,CAAC,QAAQ,CAAC;IACpB,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,6EAA6E;AAC7E,2EAA2E;AAC3E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvE,MAAM,UAAU,GAAuD;IACrE,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC;IAC3C,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;IACzC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;IACzC,4EAA4E;IAC5E,uEAAuE;IACvE,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAa,aAAa,CAAC;IACxD,kBAAkB,EAAE,GAAG,CAAC,OAAO,CAAe,eAAe,CAAC;IAC9D,WAAW,EAAE,GAAG,CAAC,OAAO,CAAgB,gBAAgB,CAAC;IACzD,WAAW,EAAE,GAAG,CAAC,OAAO,CAAY,WAAW,CAAC;IAChD,YAAY,EAAE,GAAG,CAAC,OAAO,CAAa,YAAY,CAAC;CACpD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The values inside a protocol message, read as the untrusted input they are,
|
|
3
|
+
* on either side of the frame boundary.
|
|
4
|
+
*/
|
|
5
|
+
import type { HostItem } from './protocol.ts';
|
|
6
|
+
/** How many items one message may carry; the rest are dropped. */
|
|
7
|
+
export declare const MAX_ITEMS = 64;
|
|
8
|
+
/** How long a label may be, in characters; a longer one is cut. */
|
|
9
|
+
export declare const MAX_LABEL_LENGTH = 80;
|
|
10
|
+
/**
|
|
11
|
+
* Read the items of a message, dropping those without a string `kind`, at
|
|
12
|
+
* most {@link MAX_ITEMS} of them, each label cut to {@link MAX_LABEL_LENGTH}.
|
|
13
|
+
* @param values - The items as they arrived.
|
|
14
|
+
* @returns The items.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readItems(values: readonly unknown[]): HostItem[];
|
|
17
|
+
/**
|
|
18
|
+
* Read a list of strings, dropping anything else.
|
|
19
|
+
* @param value - The list as it arrived.
|
|
20
|
+
* @returns Its strings, or none when it is not a list.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readStrings(value: unknown): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether a value is a plain object, as every message is.
|
|
25
|
+
* @param value - The value.
|
|
26
|
+
* @returns `true` for an object that is not an array.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
29
|
+
//# sourceMappingURL=messageValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageValues.d.ts","sourceRoot":"","sources":["../../../src/host/core/messageValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,kEAAkE;AAClE,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,QAAQ,EAAE,CAehE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAOpD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The values inside a protocol message, read as the untrusted input they are,
|
|
3
|
+
* on either side of the frame boundary.
|
|
4
|
+
*/
|
|
5
|
+
/** How many items one message may carry; the rest are dropped. */
|
|
6
|
+
export const MAX_ITEMS = 64;
|
|
7
|
+
/** How long a label may be, in characters; a longer one is cut. */
|
|
8
|
+
export const MAX_LABEL_LENGTH = 80;
|
|
9
|
+
/**
|
|
10
|
+
* Read the items of a message, dropping those without a string `kind`, at
|
|
11
|
+
* most {@link MAX_ITEMS} of them, each label cut to {@link MAX_LABEL_LENGTH}.
|
|
12
|
+
* @param values - The items as they arrived.
|
|
13
|
+
* @returns The items.
|
|
14
|
+
*/
|
|
15
|
+
export function readItems(values) {
|
|
16
|
+
const items = [];
|
|
17
|
+
const count = Math.min(values.length, MAX_ITEMS);
|
|
18
|
+
for (let index = 0; index < count; index++) {
|
|
19
|
+
const value = values[index];
|
|
20
|
+
if (!isRecord(value) || typeof value.kind !== 'string')
|
|
21
|
+
continue;
|
|
22
|
+
const item = { kind: value.kind, value: value.value };
|
|
23
|
+
if (typeof value.id === 'string')
|
|
24
|
+
item.id = value.id;
|
|
25
|
+
if (typeof value.key === 'string')
|
|
26
|
+
item.key = value.key;
|
|
27
|
+
if (typeof value.label === 'string') {
|
|
28
|
+
item.label = value.label.slice(0, MAX_LABEL_LENGTH);
|
|
29
|
+
}
|
|
30
|
+
items.push(item);
|
|
31
|
+
}
|
|
32
|
+
return items;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Read a list of strings, dropping anything else.
|
|
36
|
+
* @param value - The list as it arrived.
|
|
37
|
+
* @returns Its strings, or none when it is not a list.
|
|
38
|
+
*/
|
|
39
|
+
export function readStrings(value) {
|
|
40
|
+
if (!Array.isArray(value))
|
|
41
|
+
return [];
|
|
42
|
+
const strings = [];
|
|
43
|
+
for (const entry of value) {
|
|
44
|
+
if (typeof entry === 'string')
|
|
45
|
+
strings.push(entry);
|
|
46
|
+
}
|
|
47
|
+
return strings;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether a value is a plain object, as every message is.
|
|
51
|
+
* @param value - The value.
|
|
52
|
+
* @returns `true` for an object that is not an array.
|
|
53
|
+
*/
|
|
54
|
+
export function isRecord(value) {
|
|
55
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=messageValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageValues.js","sourceRoot":"","sources":["../../../src/host/core/messageValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC;AAE5B,mEAAmE;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,MAA0B;IAClD,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACjE,MAAM,IAAI,GAAa,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAChE,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;YAAE,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACrD,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;YAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACxD,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;QACtD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -9,16 +9,13 @@
|
|
|
9
9
|
* takes back changes. This module only spells the messages, and reads what
|
|
10
10
|
* arrives as the untrusted input it is.
|
|
11
11
|
*/
|
|
12
|
+
export { MAX_ITEMS, MAX_LABEL_LENGTH } from './messageValues.ts';
|
|
12
13
|
/** The version a tool speaks; a `connect` naming another is ignored. */
|
|
13
14
|
export declare const PROTOCOL_VERSION = 1;
|
|
14
15
|
/** Posted to the parent frame or the opener at start-up: who the tool is. */
|
|
15
16
|
export declare const HELLO_TYPE = "cheminfo:hello";
|
|
16
17
|
/** The host's answer to `hello`, carrying the port the rest goes through. */
|
|
17
18
|
export declare const CONNECT_TYPE = "cheminfo:connect";
|
|
18
|
-
/** How many items one request may carry; the rest are dropped. */
|
|
19
|
-
export declare const MAX_ITEMS = 64;
|
|
20
|
-
/** How long a label may be, in characters; a longer one is cut. */
|
|
21
|
-
export declare const MAX_LABEL_LENGTH = 80;
|
|
22
19
|
/** One typed value crossing the frame boundary. */
|
|
23
20
|
export interface HostItem {
|
|
24
21
|
/** A kind name, e.g. `'chem.molfile.2d'`. */
|
|
@@ -163,7 +160,7 @@ export interface OutputMessage {
|
|
|
163
160
|
* Anything that is not a well-formed `load` or `get` is `null`, and goes
|
|
164
161
|
* unanswered: an unknown request is a newer host talking, not an error. An item
|
|
165
162
|
* without a string `kind` is dropped, a label is cut to
|
|
166
|
-
*
|
|
163
|
+
* `MAX_LABEL_LENGTH`, and a `load` without `accept` takes nothing back.
|
|
167
164
|
* @param data - What the port delivered.
|
|
168
165
|
* @returns The request, or `null`.
|
|
169
166
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/host/core/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/host/core/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,6EAA6E;AAC7E,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAE/C,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IAC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spells the messages, and reads what
|
|
10
10
|
* arrives as the untrusted input it is.
|
|
11
11
|
*/
|
|
12
|
+
import { isRecord, readItems, readStrings } from "./messageValues.js";
|
|
13
|
+
export { MAX_ITEMS, MAX_LABEL_LENGTH } from "./messageValues.js";
|
|
12
14
|
/** The version a tool speaks; a `connect` naming another is ignored. */
|
|
13
15
|
export const PROTOCOL_VERSION = 1;
|
|
14
16
|
/** Posted to the parent frame or the opener at start-up: who the tool is. */
|
|
15
17
|
export const HELLO_TYPE = 'cheminfo:hello';
|
|
16
18
|
/** The host's answer to `hello`, carrying the port the rest goes through. */
|
|
17
19
|
export const CONNECT_TYPE = 'cheminfo:connect';
|
|
18
|
-
/** How many items one request may carry; the rest are dropped. */
|
|
19
|
-
export const MAX_ITEMS = 64;
|
|
20
|
-
/** How long a label may be, in characters; a longer one is cut. */
|
|
21
|
-
export const MAX_LABEL_LENGTH = 80;
|
|
22
20
|
/**
|
|
23
21
|
* Read a message that arrived through the port.
|
|
24
22
|
*
|
|
25
23
|
* Anything that is not a well-formed `load` or `get` is `null`, and goes
|
|
26
24
|
* unanswered: an unknown request is a newer host talking, not an error. An item
|
|
27
25
|
* without a string `kind` is dropped, a label is cut to
|
|
28
|
-
*
|
|
26
|
+
* `MAX_LABEL_LENGTH`, and a `load` without `accept` takes nothing back.
|
|
29
27
|
* @param data - What the port delivered.
|
|
30
28
|
* @returns The request, or `null`.
|
|
31
29
|
*/
|
|
@@ -61,36 +59,4 @@ export function isConnect(data) {
|
|
|
61
59
|
data.type === CONNECT_TYPE &&
|
|
62
60
|
data.version === PROTOCOL_VERSION);
|
|
63
61
|
}
|
|
64
|
-
function readItems(values) {
|
|
65
|
-
const items = [];
|
|
66
|
-
const count = Math.min(values.length, MAX_ITEMS);
|
|
67
|
-
for (let index = 0; index < count; index++) {
|
|
68
|
-
const value = values[index];
|
|
69
|
-
if (!isRecord(value) || typeof value.kind !== 'string')
|
|
70
|
-
continue;
|
|
71
|
-
const item = { kind: value.kind, value: value.value };
|
|
72
|
-
if (typeof value.id === 'string')
|
|
73
|
-
item.id = value.id;
|
|
74
|
-
if (typeof value.key === 'string')
|
|
75
|
-
item.key = value.key;
|
|
76
|
-
if (typeof value.label === 'string') {
|
|
77
|
-
item.label = value.label.slice(0, MAX_LABEL_LENGTH);
|
|
78
|
-
}
|
|
79
|
-
items.push(item);
|
|
80
|
-
}
|
|
81
|
-
return items;
|
|
82
|
-
}
|
|
83
|
-
function readStrings(value) {
|
|
84
|
-
if (!Array.isArray(value))
|
|
85
|
-
return [];
|
|
86
|
-
const strings = [];
|
|
87
|
-
for (const entry of value) {
|
|
88
|
-
if (typeof entry === 'string')
|
|
89
|
-
strings.push(entry);
|
|
90
|
-
}
|
|
91
|
-
return strings;
|
|
92
|
-
}
|
|
93
|
-
function isRecord(value) {
|
|
94
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
95
|
-
}
|
|
96
62
|
//# sourceMappingURL=protocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/host/core/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/host/core/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAE3C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AA6I/C;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChE,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACpE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,IAAI,GAAgB;YACxB,IAAI,EAAE,MAAM;YACZ,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;SAC7B,CAAC;QACF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACxB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,OAAO,CACL,QAAQ,CAAC,IAAI,CAAC;QACd,IAAI,CAAC,IAAI,KAAK,YAAY;QAC1B,IAAI,CAAC,OAAO,KAAK,gBAAgB,CAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds a tool hands back to the page that frames it: a picture of what it
|
|
3
|
+
* shows, a name it worked out, a table of values it predicted.
|
|
4
|
+
*
|
|
5
|
+
* A host checks what comes back as a tool checks what it is sent: against the
|
|
6
|
+
* kind it asked for, stripped of the fields that kind does not name.
|
|
7
|
+
* `chem.name` is a category — a tool names its preferred IUPAC name
|
|
8
|
+
* `chem.name.iupac` — so a host asking for any name reads every one of them.
|
|
9
|
+
*/
|
|
10
|
+
/** `image.svg`: a picture, as an SVG document. */
|
|
11
|
+
export interface SvgImageValue {
|
|
12
|
+
/** The SVG document, as text. */
|
|
13
|
+
svg: string;
|
|
14
|
+
}
|
|
15
|
+
/** `chem.name`: a name a structure goes by. */
|
|
16
|
+
export interface NameValue {
|
|
17
|
+
/** The name, as written. */
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
/** One cell of a `data.table`: a number, a text, or `null` where there is none. */
|
|
21
|
+
export type TableCell = string | number | null;
|
|
22
|
+
/** `data.table`: values laid out as a table, headings first. */
|
|
23
|
+
export interface TableValue {
|
|
24
|
+
/** The heading of each column, in order. */
|
|
25
|
+
columns: string[];
|
|
26
|
+
/** The rows, each holding one cell per column. */
|
|
27
|
+
rows: TableCell[][];
|
|
28
|
+
}
|
|
29
|
+
/** The schema of `image.svg`. */
|
|
30
|
+
export declare const SVG_IMAGE_SCHEMA: {
|
|
31
|
+
readonly type: "object";
|
|
32
|
+
readonly properties: {
|
|
33
|
+
readonly svg: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly required: readonly ["svg"];
|
|
38
|
+
readonly additionalProperties: false;
|
|
39
|
+
};
|
|
40
|
+
/** The schema of `chem.name`. */
|
|
41
|
+
export declare const NAME_SCHEMA: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly properties: {
|
|
44
|
+
readonly name: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly required: readonly ["name"];
|
|
49
|
+
readonly additionalProperties: false;
|
|
50
|
+
};
|
|
51
|
+
/** The schema of `data.table`. */
|
|
52
|
+
export declare const TABLE_SCHEMA: {
|
|
53
|
+
readonly type: "object";
|
|
54
|
+
readonly properties: {
|
|
55
|
+
readonly columns: {
|
|
56
|
+
readonly type: "array";
|
|
57
|
+
readonly items: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly rows: {
|
|
62
|
+
readonly type: "array";
|
|
63
|
+
readonly items: {
|
|
64
|
+
readonly type: "array";
|
|
65
|
+
readonly items: {
|
|
66
|
+
readonly type: readonly ["string", "number", "null"];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly required: readonly ["columns", "rows"];
|
|
72
|
+
readonly additionalProperties: false;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=resultKinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultKinds.d.ts","sourceRoot":"","sources":["../../../src/host/core/resultKinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,+CAA+C;AAC/C,MAAM,WAAW,SAAS;IACxB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/C,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kDAAkD;IAClD,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;CACrB;AAED,iCAAiC;AACjC,eAAO,MAAM,gBAAgB;;;;;;;;;CAKnB,CAAC;AAEX,iCAAiC;AACjC,eAAO,MAAM,WAAW;;;;;;;;;CAKd,CAAC;AAEX,kCAAkC;AAClC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;CAcf,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds a tool hands back to the page that frames it: a picture of what it
|
|
3
|
+
* shows, a name it worked out, a table of values it predicted.
|
|
4
|
+
*
|
|
5
|
+
* A host checks what comes back as a tool checks what it is sent: against the
|
|
6
|
+
* kind it asked for, stripped of the fields that kind does not name.
|
|
7
|
+
* `chem.name` is a category — a tool names its preferred IUPAC name
|
|
8
|
+
* `chem.name.iupac` — so a host asking for any name reads every one of them.
|
|
9
|
+
*/
|
|
10
|
+
/** The schema of `image.svg`. */
|
|
11
|
+
export const SVG_IMAGE_SCHEMA = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: { svg: { type: 'string' } },
|
|
14
|
+
required: ['svg'],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
};
|
|
17
|
+
/** The schema of `chem.name`. */
|
|
18
|
+
export const NAME_SCHEMA = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: { name: { type: 'string' } },
|
|
21
|
+
required: ['name'],
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
};
|
|
24
|
+
/** The schema of `data.table`. */
|
|
25
|
+
export const TABLE_SCHEMA = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
columns: { type: 'array', items: { type: 'string' } },
|
|
29
|
+
rows: {
|
|
30
|
+
type: 'array',
|
|
31
|
+
items: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
items: { type: ['string', 'number', 'null'] },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ['columns', 'rows'],
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=resultKinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultKinds.js","sourceRoot":"","sources":["../../../src/host/core/resultKinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,iCAAiC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IACvC,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,iCAAiC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IACxC,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,kCAAkC;AAClC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACrD,IAAI,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE;aAC9C;SACF;KACF;IACD,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,KAAK;CACnB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a framed tool sends its host, read as the untrusted input it is: the
|
|
3
|
+
* `hello` it posts to the window, and on the port the `result` of each request
|
|
4
|
+
* and the `output` it sends when a value the host takes back changes.
|
|
5
|
+
*
|
|
6
|
+
* Anything that is not well formed is `null` and is ignored, as a tool ignores
|
|
7
|
+
* a request it does not know: a newer tool talking, not an error.
|
|
8
|
+
*/
|
|
9
|
+
import type { HelloMessage, OutputMessage, ResultMessage } from './protocol.ts';
|
|
10
|
+
/** What a tool says of itself in `hello`. */
|
|
11
|
+
export type ToolHello = HelloMessage['tool'];
|
|
12
|
+
/**
|
|
13
|
+
* Read a tool's `hello`, in this version of the protocol.
|
|
14
|
+
* @param data - What the window delivered.
|
|
15
|
+
* @returns What the tool takes and gives, or `null` for anything else.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readHello(data: unknown): ToolHello | null;
|
|
18
|
+
/**
|
|
19
|
+
* Read a message a tool sent through the port.
|
|
20
|
+
* @param data - What the port delivered.
|
|
21
|
+
* @returns The `result` or the `output`, or `null` for anything else.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readToolMessage(data: unknown): ResultMessage | OutputMessage | null;
|
|
24
|
+
//# sourceMappingURL=toolMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolMessages.d.ts","sourceRoot":"","sources":["../../../src/host/core/toolMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EACV,YAAY,EAGZ,aAAa,EACb,aAAa,EAId,MAAM,eAAe,CAAC;AAGvB,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAY7C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAuBzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,GACZ,aAAa,GAAG,aAAa,GAAG,IAAI,CAqBtC"}
|