react-cheminfo 0.75.0 → 0.77.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/copySvg.d.ts +12 -0
- package/lib/download/core/copySvg.d.ts.map +1 -0
- package/lib/download/core/copySvg.js +38 -0
- package/lib/download/core/copySvg.js.map +1 -0
- 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 +5 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +4 -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/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/bandAssignments.d.ts.map +1 -1
- package/lib/ir/core/bandAssignments.js +27 -0
- package/lib/ir/core/bandAssignments.js.map +1 -1
- package/lib/ir/ui/BandRow.d.ts +4 -4
- package/lib/ir/ui/BandRow.d.ts.map +1 -1
- package/lib/ir/ui/BandRow.js +41 -14
- package/lib/ir/ui/BandRow.js.map +1 -1
- package/lib/locales/de.json +32 -1
- package/lib/locales/en.json +32 -1
- package/lib/locales/es.json +32 -1
- package/lib/locales/fr.json +32 -1
- package/lib/locales/it.json +32 -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/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/CardStructure.d.ts +43 -0
- package/lib/structure/ui/CardStructure.d.ts.map +1 -0
- package/lib/structure/ui/CardStructure.js +28 -0
- package/lib/structure/ui/CardStructure.js.map +1 -0
- 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/StructurePicturePane.d.ts +1 -1
- package/lib/structure/ui/StructurePicturePane.d.ts.map +1 -1
- package/lib/structure/ui/StructurePicturePane.js +5 -2
- package/lib/structure/ui/StructurePicturePane.js.map +1 -1
- package/lib/structure/ui/index.d.ts +3 -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/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/copySvg.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 +14 -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/ir/core/bandAssignments.ts +27 -0
- package/src/ir/ui/BandRow.tsx +84 -26
- package/src/locales/de.json +32 -1
- package/src/locales/en.json +32 -1
- package/src/locales/es.json +32 -1
- package/src/locales/fr.json +32 -1
- package/src/locales/it.json +32 -1
- package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
- 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/CardStructure.tsx +76 -0
- package/src/structure/ui/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/StructurePicturePane.tsx +14 -1
- package/src/structure/ui/index.ts +6 -0
- package/styles/chrome.css +3 -3
- package/styles/osiris.css +339 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything OSIRIS predicts about one molecule: the four toxicity risks, then
|
|
3
|
+
* the ten numbers, in the order the original panel showed them.
|
|
4
|
+
*
|
|
5
|
+
* One panel wherever a molecule is predicted — beside an editor's canvas, for
|
|
6
|
+
* the row of a table the reader focused, beside a drawing — because a second
|
|
7
|
+
* panel would be a second place for the same ten rows to drift apart.
|
|
8
|
+
*
|
|
9
|
+
* The sections stand whether or not there is anything in them. A prediction
|
|
10
|
+
* costs a fifth of a second, and a panel that appeared only once it was ready
|
|
11
|
+
* would move the page under the reader's eye every time they drew a bond.
|
|
12
|
+
*
|
|
13
|
+
* Which explanation is open is the caller's state — it belongs to the page, and
|
|
14
|
+
* on the explorer it is what a click on a square changes — but *fetching* it is
|
|
15
|
+
* the panel's own business, so no page repeats the dance.
|
|
16
|
+
*/
|
|
17
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
18
|
+
import type { PropertyKey } from '../core/propertyKeys.ts';
|
|
19
|
+
import type { OsirisProperties, RiskDetail, RiskType } from '../core/types.ts';
|
|
20
|
+
/** What {@link PropertyPanel} needs. */
|
|
21
|
+
export interface PropertyPanelProps {
|
|
22
|
+
/**
|
|
23
|
+
* What was predicted, or `null` when there is nothing to show yet.
|
|
24
|
+
* @default null
|
|
25
|
+
*/
|
|
26
|
+
properties?: OsirisProperties | null;
|
|
27
|
+
/**
|
|
28
|
+
* The atom layout to draw the molecule with, in an explanation. Empty leaves
|
|
29
|
+
* openchemlib to invent one.
|
|
30
|
+
* @default ''
|
|
31
|
+
*/
|
|
32
|
+
coordinates?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Whether a prediction is running for the molecule the panel is showing.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
pending?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* What went wrong with this structure, in one sentence, or `null`.
|
|
40
|
+
* @default null
|
|
41
|
+
*/
|
|
42
|
+
problem?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to open on the molecule's formula and name. Off for a host that
|
|
45
|
+
* already shows the formula beside the panel, such as a structure editor's
|
|
46
|
+
* side panel.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
head?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to draw the four risks, and the explanation a square opens. Off
|
|
52
|
+
* for a page answering a question about the numbers alone.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
risks?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The property rows to draw, in the panel's order whatever order they are
|
|
58
|
+
* given in. Empty leaves the section out, for a page answering a question
|
|
59
|
+
* about the risks alone.
|
|
60
|
+
* @default PROPERTY_KEYS
|
|
61
|
+
*/
|
|
62
|
+
rows?: readonly PropertyKey[];
|
|
63
|
+
/**
|
|
64
|
+
* What is said when there is nothing predicted and nothing running.
|
|
65
|
+
* @default 'Nothing to predict yet.'
|
|
66
|
+
*/
|
|
67
|
+
emptyMessage?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Which risk has its explanation open.
|
|
70
|
+
* @default null
|
|
71
|
+
*/
|
|
72
|
+
openRisk?: RiskType | null;
|
|
73
|
+
/**
|
|
74
|
+
* Called with the risk to open, or `null` to close it. Without it the squares
|
|
75
|
+
* are not clickable.
|
|
76
|
+
* @default undefined
|
|
77
|
+
*/
|
|
78
|
+
onOpenRisk?: (risk: RiskType | null) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Why a risk came back as it did. Without it no explanation is offered.
|
|
81
|
+
* @default undefined
|
|
82
|
+
*/
|
|
83
|
+
loadDetail?: (structure: string, risk: RiskType) => Promise<RiskDetail>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The risks and the properties of one molecule.
|
|
87
|
+
* @param props - See {@link PropertyPanelProps}.
|
|
88
|
+
* @returns The two panels, and the open explanation between them.
|
|
89
|
+
*/
|
|
90
|
+
export declare function PropertyPanel(props: PropertyPanelProps): ReactElement;
|
|
91
|
+
//# sourceMappingURL=PropertyPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyP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sx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Everything OSIRIS predicts about one molecule: the four toxicity risks, then
|
|
4
|
+
* the ten numbers, in the order the original panel showed them.
|
|
5
|
+
*
|
|
6
|
+
* One panel wherever a molecule is predicted — beside an editor's canvas, for
|
|
7
|
+
* the row of a table the reader focused, beside a drawing — because a second
|
|
8
|
+
* panel would be a second place for the same ten rows to drift apart.
|
|
9
|
+
*
|
|
10
|
+
* The sections stand whether or not there is anything in them. A prediction
|
|
11
|
+
* costs a fifth of a second, and a panel that appeared only once it was ready
|
|
12
|
+
* would move the page under the reader's eye every time they drew a bond.
|
|
13
|
+
*
|
|
14
|
+
* Which explanation is open is the caller's state — it belongs to the page, and
|
|
15
|
+
* on the explorer it is what a click on a square changes — but *fetching* it is
|
|
16
|
+
* the panel's own business, so no page repeats the dance.
|
|
17
|
+
*/
|
|
18
|
+
import { Callout, H5 } from '@blueprintjs/core';
|
|
19
|
+
import { useEffect, useState } from 'react';
|
|
20
|
+
import { MF } from 'react-mf';
|
|
21
|
+
import { errorMessage } from "../../error/core/toError.js";
|
|
22
|
+
import { PagePart } from "../../share/ui/PagePart.js";
|
|
23
|
+
import { PROPERTY_KEYS } from "../core/propertyKeys.js";
|
|
24
|
+
import { PropertyRows } from "./PropertyRows.js";
|
|
25
|
+
import { RiskFindings } from "./RiskFindings.js";
|
|
26
|
+
import { RiskPanel } from "./RiskPanel.js";
|
|
27
|
+
/**
|
|
28
|
+
* The risks and the properties of one molecule.
|
|
29
|
+
* @param props - See {@link PropertyPanelProps}.
|
|
30
|
+
* @returns The two panels, and the open explanation between them.
|
|
31
|
+
*/
|
|
32
|
+
export function PropertyPanel(props) {
|
|
33
|
+
const { properties = null, coordinates = '', pending = false, problem = null, head = true, risks = true, rows = PROPERTY_KEYS, emptyMessage = 'Nothing to predict yet.', openRisk = null, onOpenRisk, loadDetail, } = props;
|
|
34
|
+
const structure = properties === null
|
|
35
|
+
? ''
|
|
36
|
+
: coordinates === ''
|
|
37
|
+
? properties.idCode
|
|
38
|
+
: `${properties.idCode} ${coordinates}`;
|
|
39
|
+
const answer = useRiskDetail(structure, openRisk, loadDetail);
|
|
40
|
+
return (_jsxs("div", { className: "property-panel", children: [problem === null ? null : (_jsx(Callout, { intent: "warning", compact: true, children: problem })), properties === null ? (_jsx("p", { className: "osiris-note", children: pending ? 'Predicting…' : emptyMessage })) : head ? (_jsxs("header", { className: "property-panel__head", children: [_jsx(MF, { mf: properties.molecularFormula }), _jsx("span", { className: "property-panel__label", children: properties.label })] })) : null, risks ? (_jsx(PagePart, { part: "risks", children: _jsx(RiskPanel, { risks: properties?.risks ?? null, pending: pending, openRisk: openRisk, onOpenRisk: onOpenRisk }) })) : null, !risks ||
|
|
41
|
+
openRisk === null ||
|
|
42
|
+
structure === '' ||
|
|
43
|
+
loadDetail === undefined ? null : (_jsx(PagePart, { part: "detail", children: _jsx(RiskFindings, { risk: openRisk, structure: structure, detail: answer?.detail ?? null, error: answer?.error ?? null }) })), rows.length === 0 ? null : (_jsx(PagePart, { part: "properties", children: _jsxs("section", { className: "property-section", children: [_jsx(H5, { children: "Predicted properties" }), _jsx(PropertyRows, { properties: properties, keys: rows })] }) }))] }));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fetch the open risk's explanation, and answer only about the request that is
|
|
47
|
+
* open now.
|
|
48
|
+
*
|
|
49
|
+
* The answer carries the request it belongs to rather than being cleared when a
|
|
50
|
+
* new one starts: clearing would mean writing state from inside the effect, and
|
|
51
|
+
* comparing keys says the same thing without the extra render.
|
|
52
|
+
* @param structure - The molecule: an idCode, with its coordinates after a space.
|
|
53
|
+
* @param openRisk - Which risk is open, or `null`.
|
|
54
|
+
* @param loadDetail - What answers the question, or `undefined` when nothing does.
|
|
55
|
+
* @returns The answer to the open request, or `null` while it is being worked out.
|
|
56
|
+
*/
|
|
57
|
+
function useRiskDetail(structure, openRisk, loadDetail) {
|
|
58
|
+
const key = openRisk === null || structure === '' ? '' : `${structure} ${openRisk}`;
|
|
59
|
+
const [answer, setAnswer] = useState(null);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (key === '' || openRisk === null || loadDetail === undefined)
|
|
62
|
+
return;
|
|
63
|
+
let live = true;
|
|
64
|
+
loadDetail(structure, openRisk).then((detail) => {
|
|
65
|
+
if (live)
|
|
66
|
+
setAnswer({ key, detail, error: null });
|
|
67
|
+
}, (error) => {
|
|
68
|
+
if (live)
|
|
69
|
+
setAnswer({ key, detail: null, error: errorMessage(error) });
|
|
70
|
+
});
|
|
71
|
+
return () => {
|
|
72
|
+
live = false;
|
|
73
|
+
};
|
|
74
|
+
}, [key, structure, openRisk, loadDetail]);
|
|
75
|
+
return answer !== null && answer.key === key ? answer : null;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=PropertyPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyPanel.js","sourceRoot":"","sources":["../../../src/osiris/ui/PropertyPanel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA6B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AA2E5C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EACJ,UAAU,GAAG,IAAI,EACjB,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AAC;QAChB,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,IAAI,CAClC,CAAC,MAAM,EAAE,EAAE;YACT,IAAI,IAAI;gBAAE,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YACjB,IAAI,IAAI;gBAAE,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC,CACF,CAAC;QACF,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,KAAK,CAAC;QACf,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3C,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ten predicted numbers, one row each: a name, a bar and a value.
|
|
3
|
+
*
|
|
4
|
+
* The order is the legacy panel's — cLogP, solubility, molweight, TPSA,
|
|
5
|
+
* drug-likeness, the two hydrogen-bond counts, stereocentres, rotatable bonds,
|
|
6
|
+
* drug score — and it is `PROPERTY_KEYS`, which the comparison table's columns
|
|
7
|
+
* and the plot's default axes also read. A reader who learned the panel reads
|
|
8
|
+
* the table without relearning it.
|
|
9
|
+
*
|
|
10
|
+
* A value the predictor could not answer prints the missing marker and draws no
|
|
11
|
+
* bar. It is never zero: `DrugScoreCalculator` consumes every sentinel and
|
|
12
|
+
* hands back a plausible number, so a bar drawn from one would be a wrong
|
|
13
|
+
* answer with nothing saying it is wrong.
|
|
14
|
+
*/
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
import type { PropertyKey } from '../core/propertyKeys.ts';
|
|
17
|
+
import type { OsirisProperties } from '../core/types.ts';
|
|
18
|
+
/** What {@link PropertyRows} needs. */
|
|
19
|
+
export interface PropertyRowsProps {
|
|
20
|
+
/**
|
|
21
|
+
* What was predicted, or `null` while the molecule is still being worked on —
|
|
22
|
+
* in which case every row stands with its name and no value, so nothing moves
|
|
23
|
+
* when the answer arrives.
|
|
24
|
+
* @default null
|
|
25
|
+
*/
|
|
26
|
+
properties?: OsirisProperties | null;
|
|
27
|
+
/**
|
|
28
|
+
* The rows to draw. They are drawn in the panel's order whatever order they
|
|
29
|
+
* are given in, so a narrowed panel still reads as the whole one does.
|
|
30
|
+
* @default PROPERTY_KEYS
|
|
31
|
+
*/
|
|
32
|
+
keys?: readonly PropertyKey[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The property rows, all ten unless fewer are asked, in the panel's order.
|
|
36
|
+
* @param props - See {@link PropertyRowsProps}.
|
|
37
|
+
* @returns One row per property.
|
|
38
|
+
*/
|
|
39
|
+
export declare function PropertyRows(props: PropertyRowsProps): ReactElement;
|
|
40
|
+
//# sourceMappingURL=PropertyRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyRows.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/PropertyRows.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAcnE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MISSING_VALUE } from "../../format/core/missing.js";
|
|
3
|
+
import { formatDecimal } from "../../format/core/numbers.js";
|
|
4
|
+
import { barGeometry } from "../core/barGeometry.js";
|
|
5
|
+
import { PROPERTY_KEYS, propertyValue } from "../core/propertyKeys.js";
|
|
6
|
+
import { propertyScale } from "../core/scales.js";
|
|
7
|
+
import { PropertyBar } from "./PropertyBar.js";
|
|
8
|
+
/**
|
|
9
|
+
* The property rows, all ten unless fewer are asked, in the panel's order.
|
|
10
|
+
* @param props - See {@link PropertyRowsProps}.
|
|
11
|
+
* @returns One row per property.
|
|
12
|
+
*/
|
|
13
|
+
export function PropertyRows(props) {
|
|
14
|
+
const { properties = null, keys = PROPERTY_KEYS } = props;
|
|
15
|
+
return (_jsx("div", { className: "property-rows", children: PROPERTY_KEYS.filter((key) => keys.includes(key)).map((key) => (_jsx(PropertyRow, { propertyKey: key, value: properties === null ? null : propertyValue(properties, key) }, key))) }));
|
|
16
|
+
}
|
|
17
|
+
function PropertyRow(props) {
|
|
18
|
+
const { propertyKey, value } = props;
|
|
19
|
+
const scale = propertyScale(propertyKey);
|
|
20
|
+
const geometry = barGeometry(propertyKey, value);
|
|
21
|
+
return (_jsxs("div", { className: "property-row", children: [_jsxs("span", { className: "property-row__label", children: [scale.label, scale.unit === '' ? null : (_jsx("span", { className: "property-row__unit", children: scale.unit }))] }), _jsx("span", { className: "property-row__bar", children: geometry === null ? null : _jsx(PropertyBar, { geometry: geometry }) }), _jsx("span", { className: "property-row__value", children: value === null ? MISSING_VALUE : formatDecimal(value, scale.decimals) })] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=PropertyRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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AC,qBAAqB,aAClC,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC1B,eAAM,SAAS,EAAC,oBAAoB,YAAE,KAAK,CAAC,IAAI,GAAQ,CACzD,IACI,EACP,eAAM,SAAS,EAAC,mBAAmB,YAChC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,GAAI,GAC1D,EACP,eAAM,SAAS,EAAC,qBAAqB,YAClC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,GACjE,IACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why one risk came back as it did.
|
|
3
|
+
*
|
|
4
|
+
* Two branches of the predictor reach the same red square and mean different
|
|
5
|
+
* things. *This molecule is known to be mutagenic* means the compound's own
|
|
6
|
+
* idCode is in a list derived from RTECS — data on this exact compound, and
|
|
7
|
+
* nothing on the drawing to point at. *High-risk fragments indicating
|
|
8
|
+
* Mutagenicity* means a substructure matched, and that substructure is drawn
|
|
9
|
+
* beside the molecule with its atoms painted on it.
|
|
10
|
+
*
|
|
11
|
+
* Telling them apart is the whole point of opening a square: aspirin, caffeine
|
|
12
|
+
* and paracetamol are all red through the first branch, and highlighting the
|
|
13
|
+
* whole molecule there would call the compound its own toxicophore.
|
|
14
|
+
*
|
|
15
|
+
* A fragment heading is repeated on each of the fragments under it, so it is
|
|
16
|
+
* printed once and the matches follow.
|
|
17
|
+
*/
|
|
18
|
+
import type { ReactElement } from 'react';
|
|
19
|
+
import type { RiskDetail, RiskType } from '../core/types.ts';
|
|
20
|
+
/** What {@link RiskFindings} needs. */
|
|
21
|
+
export interface RiskFindingsProps {
|
|
22
|
+
/** Which risk is open. */
|
|
23
|
+
risk: RiskType;
|
|
24
|
+
/** The molecule it was assessed on: the idCode, with its coordinates after a space. */
|
|
25
|
+
structure: string;
|
|
26
|
+
/**
|
|
27
|
+
* What the predictor found, or `null` while it is being worked out.
|
|
28
|
+
* @default null
|
|
29
|
+
*/
|
|
30
|
+
detail?: RiskDetail | null;
|
|
31
|
+
/**
|
|
32
|
+
* Why the explanation could not be fetched, or `null`.
|
|
33
|
+
* @default null
|
|
34
|
+
*/
|
|
35
|
+
error?: string | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The explanation of one risk.
|
|
39
|
+
* @param props - See {@link RiskFindingsProps}.
|
|
40
|
+
* @returns The predictor's own sentences, with every matched fragment drawn.
|
|
41
|
+
*/
|
|
42
|
+
export declare function RiskFindings(props: RiskFindingsProps): ReactElement;
|
|
43
|
+
//# sourceMappingURL=RiskFindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiskFindings.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/RiskFindings.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,UAAU,EAAe,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE1E,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,uFAAuF;IACvF,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAkCnE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Why one risk came back as it did.
|
|
4
|
+
*
|
|
5
|
+
* Two branches of the predictor reach the same red square and mean different
|
|
6
|
+
* things. *This molecule is known to be mutagenic* means the compound's own
|
|
7
|
+
* idCode is in a list derived from RTECS — data on this exact compound, and
|
|
8
|
+
* nothing on the drawing to point at. *High-risk fragments indicating
|
|
9
|
+
* Mutagenicity* means a substructure matched, and that substructure is drawn
|
|
10
|
+
* beside the molecule with its atoms painted on it.
|
|
11
|
+
*
|
|
12
|
+
* Telling them apart is the whole point of opening a square: aspirin, caffeine
|
|
13
|
+
* and paracetamol are all red through the first branch, and highlighting the
|
|
14
|
+
* whole molecule there would call the compound its own toxicophore.
|
|
15
|
+
*
|
|
16
|
+
* A fragment heading is repeated on each of the fragments under it, so it is
|
|
17
|
+
* printed once and the matches follow.
|
|
18
|
+
*/
|
|
19
|
+
import { Callout, Spinner } from '@blueprintjs/core';
|
|
20
|
+
import { Structure } from "../../structure/ui/Structure.js";
|
|
21
|
+
import { RISK_LABELS } from "../core/constants.js";
|
|
22
|
+
import { KNOWN_MOLECULE_NOTE } from "../core/riskAppearance.js";
|
|
23
|
+
/** How big a drawing in the explanation is, in pixels. */
|
|
24
|
+
const DRAWING = { width: 190, height: 130 };
|
|
25
|
+
/**
|
|
26
|
+
* The explanation of one risk.
|
|
27
|
+
* @param props - See {@link RiskFindingsProps}.
|
|
28
|
+
* @returns The predictor's own sentences, with every matched fragment drawn.
|
|
29
|
+
*/
|
|
30
|
+
export function RiskFindings(props) {
|
|
31
|
+
const { risk, structure, detail = null, error = null } = props;
|
|
32
|
+
if (error !== null) {
|
|
33
|
+
return _jsx(Callout, { intent: "warning", children: error });
|
|
34
|
+
}
|
|
35
|
+
if (detail === null) {
|
|
36
|
+
return (_jsxs("div", { className: "osiris-note osiris-note--working", children: [_jsx(Spinner, { size: 14 }), " Working out why ", RISK_LABELS[risk], " came back as it did."] }));
|
|
37
|
+
}
|
|
38
|
+
return (_jsx("div", { className: "risk-findings", children: detail.findings.map((finding, index) => (_jsx(Finding
|
|
39
|
+
// The predictor prints each heading once and each matching fragment
|
|
40
|
+
// once under it, so the pair names the line without an index.
|
|
41
|
+
, { finding: finding, structure: structure, heading: detail.findings[index - 1]?.description === finding.description
|
|
42
|
+
? null
|
|
43
|
+
: finding.description }, `${finding.kind}:${finding.description}:${finding.idCode ?? ''}`))) }));
|
|
44
|
+
}
|
|
45
|
+
function Finding(props) {
|
|
46
|
+
const { finding, structure, heading } = props;
|
|
47
|
+
return (_jsxs("div", { className: "risk-finding", children: [heading === null ? null : (_jsx("p", { className: "risk-finding__heading", children: heading })), finding.kind === 'known' ? (_jsx("p", { className: "osiris-note", children: KNOWN_MOLECULE_NOTE })) : null, finding.idCode === null ? null : (_jsxs("div", { className: "risk-finding__drawings", children: [_jsxs("figure", { className: "risk-finding__figure", children: [_jsx(Structure, { idCode: finding.idCode, width: DRAWING.width, height: DRAWING.height }), _jsxs("figcaption", { children: [finding.severity === 'medium' ? 'Medium-risk' : 'High-risk', ' ', "fragment"] })] }), _jsxs("figure", { className: "risk-finding__figure", children: [_jsx(Structure, { idCode: structure, width: DRAWING.width, height: DRAWING.height, atomHighlight: [...finding.atoms], bondHighlight: [...finding.bonds] }), _jsx("figcaption", { children: finding.atoms.length === 0
|
|
48
|
+
? 'Not located on this drawing'
|
|
49
|
+
: 'Where it sits on the molecule' })] })] }))] }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=RiskFindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiskFindings.js","sourceRoot":"","sources":["../../../src/osiris/ui/RiskFindings.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAkC,CAAC;AAC7D,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1
|
+
/**
|
|
2
|
+
* The four toxicity risks, and the sentence that keeps them honest.
|
|
3
|
+
*
|
|
4
|
+
* OSIRIS assesses mutagenicity, tumorigenicity, irritating effects and
|
|
5
|
+
* reproductive effects, in that order, and answers each with one of three
|
|
6
|
+
* levels — the same three the drug score multiplies by. A red square is very
|
|
7
|
+
* often the known-molecule branch rather than a matched fragment, which is why
|
|
8
|
+
* every assessed square opens its explanation.
|
|
9
|
+
*
|
|
10
|
+
* The caveat under them is the author's own, quoted rather than paraphrased: it
|
|
11
|
+
* is the sentence that stops a red square being read as a verdict, and softening
|
|
12
|
+
* it would be our words over his.
|
|
13
|
+
*/
|
|
14
|
+
import type { ReactElement } from 'react';
|
|
15
|
+
import type { RiskLevel, RiskType } from '../core/types.ts';
|
|
16
|
+
/** What {@link RiskPanel} needs. */
|
|
17
|
+
export interface RiskPanelProps {
|
|
18
|
+
/**
|
|
19
|
+
* How the four came back, or `null` when none of them has been assessed.
|
|
20
|
+
* @default null
|
|
21
|
+
*/
|
|
22
|
+
risks?: Record<RiskType, RiskLevel> | null;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a prediction is running for the molecule the panel is showing.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
pending?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Which risk has its explanation open.
|
|
30
|
+
* @default null
|
|
31
|
+
*/
|
|
32
|
+
openRisk?: RiskType | null;
|
|
33
|
+
/**
|
|
34
|
+
* Called with the risk to open, or `null` to close the one that is open.
|
|
35
|
+
* Without it the squares are not clickable.
|
|
36
|
+
* @default undefined
|
|
37
|
+
*/
|
|
38
|
+
onOpenRisk?: (risk: RiskType | null) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The four risk squares.
|
|
42
|
+
* @param props - See {@link RiskPanelProps}.
|
|
43
|
+
* @returns The panel, with the caveat under it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function RiskPanel(props: RiskPanelProps): ReactElement;
|
|
46
|
+
//# sourceMappingURL=RiskPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiskPanel.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/RiskPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK5D,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;IAC3C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CA2B7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The four toxicity risks, and the sentence that keeps them honest.
|
|
4
|
+
*
|
|
5
|
+
* OSIRIS assesses mutagenicity, tumorigenicity, irritating effects and
|
|
6
|
+
* reproductive effects, in that order, and answers each with one of three
|
|
7
|
+
* levels — the same three the drug score multiplies by. A red square is very
|
|
8
|
+
* often the known-molecule branch rather than a matched fragment, which is why
|
|
9
|
+
* every assessed square opens its explanation.
|
|
10
|
+
*
|
|
11
|
+
* The caveat under them is the author's own, quoted rather than paraphrased: it
|
|
12
|
+
* is the sentence that stops a red square being read as a verdict, and softening
|
|
13
|
+
* it would be our words over his.
|
|
14
|
+
*/
|
|
15
|
+
import { H5 } from '@blueprintjs/core';
|
|
16
|
+
import { RISK_CAVEAT } from "../core/riskAppearance.js";
|
|
17
|
+
import { RISK_TYPES } from "../core/types.js";
|
|
18
|
+
import { RiskSquare } from "./RiskSquare.js";
|
|
19
|
+
/**
|
|
20
|
+
* The four risk squares.
|
|
21
|
+
* @param props - See {@link RiskPanelProps}.
|
|
22
|
+
* @returns The panel, with the caveat under it.
|
|
23
|
+
*/
|
|
24
|
+
export function RiskPanel(props) {
|
|
25
|
+
const { risks = null, pending = false, openRisk = null, onOpenRisk } = props;
|
|
26
|
+
return (_jsxs("section", { className: "risk-panel", children: [_jsx(H5, { children: "Predicted toxicity risks" }), _jsx("div", { className: "risk-grid", children: RISK_TYPES.map((risk) => (_jsx(RiskSquare, { risk: risk, level: risks?.[risk], pending: pending, selected: openRisk === risk, onSelect: onOpenRisk === undefined
|
|
27
|
+
? undefined
|
|
28
|
+
: (chosen) => {
|
|
29
|
+
onOpenRisk(chosen === openRisk ? null : chosen);
|
|
30
|
+
} }, risk))) }), _jsx("p", { className: "osiris-note", children: RISK_CAVEAT })] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=RiskPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiskPanel.js","sourceRoot":"","sources":["../../../src/osiris/ui/RiskPanel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AA2B9C;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE7E,OAAO,CACL,mBAAS,SAAS,EAAC,YAAY,aAC7B,KAAC,EAAE,2CAA8B,EACjC,cAAK,SAAS,EAAC,WAAW,YACvB,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACxB,KAAC,UAAU,IAET,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,KAAK,IAAI,EAC3B,QAAQ,EACN,UAAU,KAAK,SAAS;wBACtB,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE;4BACT,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;wBAClD,CAAC,IAVF,IAAI,CAYT,CACH,CAAC,GACE,EACN,YAAG,SAAS,EAAC,aAAa,YAAE,WAAW,GAAK,IACpC,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One toxicity risk, as a coloured square with its name beside it.
|
|
3
|
+
*
|
|
4
|
+
* The square is a button whenever the page can explain it, because the
|
|
5
|
+
* explanation is the honest half of the colour: aspirin, caffeine and
|
|
6
|
+
* paracetamol come back red through the known-molecule branch, not through a
|
|
7
|
+
* toxicophore, and only opening it says so.
|
|
8
|
+
*
|
|
9
|
+
* `compact` drops the words and keeps the square, which is what a cell of the
|
|
10
|
+
* comparison table needs; the name and the level stay on the accessible label,
|
|
11
|
+
* so the cell is still readable to a screen reader and on hover.
|
|
12
|
+
*/
|
|
13
|
+
import type { ReactElement } from 'react';
|
|
14
|
+
import type { RiskLevel, RiskType } from '../core/types.ts';
|
|
15
|
+
/** What {@link RiskSquare} needs. */
|
|
16
|
+
export interface RiskSquareProps {
|
|
17
|
+
/** Which of the four risks this shows. */
|
|
18
|
+
risk: RiskType;
|
|
19
|
+
/** How it came back, or `undefined` when it has not been assessed. */
|
|
20
|
+
level: RiskLevel | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether a prediction is running for this molecule. It is what tells an
|
|
23
|
+
* unassessed square to say it is working rather than that there is nothing
|
|
24
|
+
* to work on.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
pending?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether this risk's explanation is the one open.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Called with the risk when the square is clicked. Without it the square is
|
|
35
|
+
* not a button.
|
|
36
|
+
* @default undefined
|
|
37
|
+
*/
|
|
38
|
+
onSelect?: (risk: RiskType) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Draw the square alone, for a cell of a table.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
compact?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One risk's square.
|
|
47
|
+
* @param props - See {@link RiskSquareProps}.
|
|
48
|
+
* @returns The square, as a button when the page can explain it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function RiskSquare(props: RiskSquareProps): ReactElement;
|
|
51
|
+
//# sourceMappingURL=RiskSquare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiskSquare.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/RiskSquare.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5D,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,sEAAsE;IACtE,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAoD/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { RISK_LABELS } from "../core/constants.js";
|
|
3
|
+
import { riskAppearance } from "../core/riskAppearance.js";
|
|
4
|
+
/**
|
|
5
|
+
* One risk's square.
|
|
6
|
+
* @param props - See {@link RiskSquareProps}.
|
|
7
|
+
* @returns The square, as a button when the page can explain it.
|
|
8
|
+
*/
|
|
9
|
+
export function RiskSquare(props) {
|
|
10
|
+
const { risk, level, pending = false, selected = false, onSelect, compact = false, } = props;
|
|
11
|
+
const { tone, label, explainable } = riskAppearance(level, pending);
|
|
12
|
+
const name = RISK_LABELS[risk];
|
|
13
|
+
const description = `${name}: ${label}`;
|
|
14
|
+
const clickable = onSelect !== undefined && explainable;
|
|
15
|
+
const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "risk-square__swatch", "data-level": tone }), compact ? null : (_jsxs("span", { className: "risk-square__text", children: [_jsx("span", { className: "risk-square__name", children: name }), _jsx("span", { className: "risk-square__level", children: label })] }))] }));
|
|
16
|
+
if (!clickable) {
|
|
17
|
+
return (_jsx("span", { className: compact ? 'risk-square risk-square--compact' : 'risk-square', title: description, "aria-label": compact ? description : undefined, children: body }));
|
|
18
|
+
}
|
|
19
|
+
return (_jsx("button", { type: "button", className: compact ? 'risk-square risk-square--compact' : 'risk-square', title: `${description} — why?`, "aria-label": compact ? description : undefined, "aria-pressed": selected, onClick: () => {
|
|
20
|
+
onSelect(risk);
|
|
21
|
+
}, children: body }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=RiskSquare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RiskSquare.js","sourceRoot":"","sources":["../../../src/osiris/ui/RiskSquare.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAkC3D;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,GAAG,KAAK,GAChB,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,WAAW,GAAG,GAAG,IAAI,KAAK,KAAK,EAAE,CAAC;IACxC,MAAM,SAAS,GAAG,QAAQ,KAAK,SAAS,IAAI,WAAW,CAAC;IAExD,MAAM,IAAI,GAAG,CACX,8BACE,eAAM,SAAS,EAAC,qBAAqB,gBAAa,IAAI,GAAI,EACzD,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAChB,gBAAM,SAAS,EAAC,mBAAmB,aACjC,eAAM,SAAS,EAAC,mBAAmB,YAAE,IAAI,GAAQ,EACjD,eAAM,SAAS,EAAC,oBAAoB,YAAE,KAAK,GAAQ,IAC9C,CACR,IACA,CACJ,CAAC;IAEF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CACL,eACE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,aAAa,EACvE,KAAK,EAAE,WAAW,gBACN,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,YAE5C,IAAI,GACA,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,aAAa,EACvE,KAAK,EAAE,GAAG,WAAW,SAAS,gBAClB,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,kBAC/B,QAAQ,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,YAEA,IAAI,GACE,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type { PropertyBarProps } from './PropertyBar.tsx';
|
|
2
|
+
export { PropertyBar } from './PropertyBar.tsx';
|
|
3
|
+
export type { PropertyPanelProps } from './PropertyPanel.tsx';
|
|
4
|
+
export { PropertyPanel } from './PropertyPanel.tsx';
|
|
5
|
+
export type { PropertyRowsProps } from './PropertyRows.tsx';
|
|
6
|
+
export { PropertyRows } from './PropertyRows.tsx';
|
|
7
|
+
export type { RiskFindingsProps } from './RiskFindings.tsx';
|
|
8
|
+
export { RiskFindings } from './RiskFindings.tsx';
|
|
9
|
+
export type { RiskPanelProps } from './RiskPanel.tsx';
|
|
10
|
+
export { RiskPanel } from './RiskPanel.tsx';
|
|
11
|
+
export type { RiskSquareProps } from './RiskSquare.tsx';
|
|
12
|
+
export { RiskSquare } from './RiskSquare.tsx';
|
|
13
|
+
export type { UsePredictionsOptions, UsePredictionsResult, } from './usePredictions.ts';
|
|
14
|
+
export { usePredictions } from './usePredictions.ts';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { PropertyBar } from "./PropertyBar.js";
|
|
2
|
+
export { PropertyPanel } from "./PropertyPanel.js";
|
|
3
|
+
export { PropertyRows } from "./PropertyRows.js";
|
|
4
|
+
export { RiskFindings } from "./RiskFindings.js";
|
|
5
|
+
export { RiskPanel } from "./RiskPanel.js";
|
|
6
|
+
export { RiskSquare } from "./RiskSquare.js";
|
|
7
|
+
export { usePredictions } from "./usePredictions.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/osiris/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|