react-cheminfo 0.37.0 → 0.39.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 +77 -1
- package/bin/check-seo.mjs +43 -1
- package/lib/chart/ui/Axes.d.ts +19 -0
- package/lib/chart/ui/Axes.d.ts.map +1 -1
- package/lib/chart/ui/Axes.js +25 -5
- package/lib/chart/ui/Axes.js.map +1 -1
- package/lib/chrome/ui/NavMenuButton.d.ts.map +1 -1
- package/lib/chrome/ui/NavMenuButton.js +41 -11
- package/lib/chrome/ui/NavMenuButton.js.map +1 -1
- package/lib/chrome/ui/SiteHeader.js +24 -1
- package/lib/chrome/ui/SiteHeader.js.map +1 -1
- package/lib/chrome/ui/navItem.d.ts +7 -0
- package/lib/chrome/ui/navItem.d.ts.map +1 -1
- package/lib/chrome/ui/navItem.js.map +1 -1
- package/lib/citation/ui/entries.d.ts.map +1 -1
- package/lib/citation/ui/entries.js +6 -1
- package/lib/citation/ui/entries.js.map +1 -1
- package/lib/clipboard/ui/ClickToCopy.d.ts +11 -0
- package/lib/clipboard/ui/ClickToCopy.d.ts.map +1 -1
- package/lib/clipboard/ui/ClickToCopy.js +28 -10
- package/lib/clipboard/ui/ClickToCopy.js.map +1 -1
- package/lib/clipboard/ui/CopyButton.d.ts +2 -1
- package/lib/clipboard/ui/CopyButton.d.ts.map +1 -1
- package/lib/clipboard/ui/CopyButton.js +2 -1
- package/lib/clipboard/ui/CopyButton.js.map +1 -1
- package/lib/clipboard/ui/CopyableValue.d.ts +24 -4
- package/lib/clipboard/ui/CopyableValue.d.ts.map +1 -1
- package/lib/clipboard/ui/CopyableValue.js +35 -3
- package/lib/clipboard/ui/CopyableValue.js.map +1 -1
- package/lib/clipboard/ui/index.d.ts +1 -1
- package/lib/clipboard/ui/index.d.ts.map +1 -1
- package/lib/clipboard/ui/index.js.map +1 -1
- package/lib/confirm/ui/ConfirmButton.d.ts.map +1 -1
- package/lib/confirm/ui/ConfirmButton.js +2 -1
- package/lib/confirm/ui/ConfirmButton.js.map +1 -1
- package/lib/core.d.ts +1 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +1 -0
- package/lib/core.js.map +1 -1
- package/lib/delimited/ui/TableDataButton.d.ts.map +1 -1
- package/lib/delimited/ui/TableDataButton.js +2 -1
- package/lib/delimited/ui/TableDataButton.js.map +1 -1
- package/lib/download/core/figureSvg.d.ts.map +1 -1
- package/lib/download/core/figureSvg.js +37 -12
- package/lib/download/core/figureSvg.js.map +1 -1
- package/lib/help/ui/HelpToolbarButton.d.ts.map +1 -1
- package/lib/help/ui/HelpToolbarButton.js +2 -1
- package/lib/help/ui/HelpToolbarButton.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/locales/de.json +48 -5
- package/lib/locales/en.json +48 -5
- package/lib/locales/es.json +48 -5
- package/lib/locales/fr.json +48 -5
- package/lib/locales/it.json +48 -5
- package/lib/number/core/index.d.ts +1 -1
- package/lib/number/core/index.d.ts.map +1 -1
- package/lib/number/core/index.js +1 -1
- package/lib/number/core/index.js.map +1 -1
- package/lib/number/core/numberText.d.ts +13 -0
- package/lib/number/core/numberText.d.ts.map +1 -1
- package/lib/number/core/numberText.js +20 -0
- package/lib/number/core/numberText.js.map +1 -1
- package/lib/number/ui/NumberInput.js +1 -1
- package/lib/number/ui/NumberInput.js.map +1 -1
- package/lib/overlay/ui/OverlayIconButton.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayIconButton.js +1 -1
- package/lib/overlay/ui/OverlayIconButton.js.map +1 -1
- package/lib/panel/ui/ClearButton.d.ts.map +1 -1
- package/lib/panel/ui/ClearButton.js +1 -1
- package/lib/panel/ui/ClearButton.js.map +1 -1
- package/lib/pedagogy/core/inlineMarks.d.ts +9 -5
- package/lib/pedagogy/core/inlineMarks.d.ts.map +1 -1
- package/lib/pedagogy/core/inlineMarks.js +14 -6
- package/lib/pedagogy/core/inlineMarks.js.map +1 -1
- package/lib/pedagogy/ui/GlossaryDefinition.d.ts +4 -10
- package/lib/pedagogy/ui/GlossaryDefinition.d.ts.map +1 -1
- package/lib/pedagogy/ui/GlossaryDefinition.js +7 -7
- package/lib/pedagogy/ui/GlossaryDefinition.js.map +1 -1
- package/lib/pedagogy/ui/GlossaryIndex.d.ts.map +1 -1
- package/lib/pedagogy/ui/GlossaryIndex.js +1 -1
- package/lib/pedagogy/ui/GlossaryIndex.js.map +1 -1
- package/lib/pedagogy/ui/GlossaryProvider.d.ts +7 -0
- package/lib/pedagogy/ui/GlossaryProvider.d.ts.map +1 -1
- package/lib/pedagogy/ui/GlossaryProvider.js +3 -2
- package/lib/pedagogy/ui/GlossaryProvider.js.map +1 -1
- package/lib/pedagogy/ui/GlossaryText.d.ts +7 -2
- package/lib/pedagogy/ui/GlossaryText.d.ts.map +1 -1
- package/lib/pedagogy/ui/GlossaryText.js +3 -2
- package/lib/pedagogy/ui/GlossaryText.js.map +1 -1
- package/lib/pedagogy/ui/InlineText.d.ts +8 -2
- package/lib/pedagogy/ui/InlineText.d.ts.map +1 -1
- package/lib/pedagogy/ui/InlineText.js +7 -2
- package/lib/pedagogy/ui/InlineText.js.map +1 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts +4 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts.map +1 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.js +2 -1
- package/lib/pedagogy/ui/ReferenceSectionBlock.js.map +1 -1
- package/lib/pedagogy/ui/SyntaxTooltip.d.ts.map +1 -1
- package/lib/pedagogy/ui/SyntaxTooltip.js +11 -10
- package/lib/pedagogy/ui/SyntaxTooltip.js.map +1 -1
- package/lib/pedagogy/ui/TutorialStepStrip.d.ts.map +1 -1
- package/lib/pedagogy/ui/TutorialStepStrip.js +18 -4
- package/lib/pedagogy/ui/TutorialStepStrip.js.map +1 -1
- package/lib/pedagogy/ui/glossaryContext.d.ts +7 -0
- package/lib/pedagogy/ui/glossaryContext.d.ts.map +1 -1
- package/lib/pedagogy/ui/glossaryContext.js.map +1 -1
- package/lib/pedagogy/ui/index.d.ts +1 -1
- package/lib/pedagogy/ui/index.d.ts.map +1 -1
- package/lib/pedagogy/ui/inlineSegments.d.ts +5 -0
- package/lib/pedagogy/ui/inlineSegments.d.ts.map +1 -1
- package/lib/pedagogy/ui/inlineSegments.js +2 -0
- package/lib/pedagogy/ui/inlineSegments.js.map +1 -1
- package/lib/pedagogy/ui/pedagogyStyle.d.ts +8 -9
- package/lib/pedagogy/ui/pedagogyStyle.d.ts.map +1 -1
- package/lib/pedagogy/ui/pedagogyStyle.js +10 -18
- package/lib/pedagogy/ui/pedagogyStyle.js.map +1 -1
- package/lib/range/core/index.d.ts +4 -0
- package/lib/range/core/index.d.ts.map +1 -0
- package/lib/range/core/index.js +3 -0
- package/lib/range/core/index.js.map +1 -0
- package/lib/range/core/rangeBounds.d.ts +79 -0
- package/lib/range/core/rangeBounds.d.ts.map +1 -0
- package/lib/range/core/rangeBounds.js +110 -0
- package/lib/range/core/rangeBounds.js.map +1 -0
- package/lib/range/core/rangeHistogram.d.ts +13 -0
- package/lib/range/core/rangeHistogram.d.ts.map +1 -0
- package/lib/range/core/rangeHistogram.js +39 -0
- package/lib/range/core/rangeHistogram.js.map +1 -0
- package/lib/range/ui/RangeHistogram.d.ts +20 -0
- package/lib/range/ui/RangeHistogram.d.ts.map +1 -0
- package/lib/range/ui/RangeHistogram.js +18 -0
- package/lib/range/ui/RangeHistogram.js.map +1 -0
- package/lib/range/ui/RangeSlider.d.ts +77 -0
- package/lib/range/ui/RangeSlider.d.ts.map +1 -0
- package/lib/range/ui/RangeSlider.js +60 -0
- package/lib/range/ui/RangeSlider.js.map +1 -0
- package/lib/range/ui/RangeValue.d.ts +41 -0
- package/lib/range/ui/RangeValue.d.ts.map +1 -0
- package/lib/range/ui/RangeValue.js +73 -0
- package/lib/range/ui/RangeValue.js.map +1 -0
- package/lib/range/ui/index.d.ts +3 -0
- package/lib/range/ui/index.d.ts.map +1 -0
- package/lib/range/ui/index.js +2 -0
- package/lib/range/ui/index.js.map +1 -0
- package/lib/seo/core/documentMeta.d.ts +16 -0
- package/lib/seo/core/documentMeta.d.ts.map +1 -1
- package/lib/seo/core/documentMeta.js +18 -0
- package/lib/seo/core/documentMeta.js.map +1 -1
- package/lib/seo/core/index.d.ts +3 -1
- package/lib/seo/core/index.d.ts.map +1 -1
- package/lib/seo/core/index.js +2 -1
- package/lib/seo/core/index.js.map +1 -1
- package/lib/seo/core/noscript.d.ts +8 -0
- package/lib/seo/core/noscript.d.ts.map +1 -1
- package/lib/seo/core/noscript.js +10 -3
- package/lib/seo/core/noscript.js.map +1 -1
- package/lib/seo/core/pageMeta.d.ts +10 -2
- package/lib/seo/core/pageMeta.d.ts.map +1 -1
- package/lib/seo/core/pageMeta.js +12 -3
- package/lib/seo/core/pageMeta.js.map +1 -1
- package/lib/seo/core/plainDescription.d.ts +2 -2
- package/lib/seo/core/plainDescription.js +5 -2
- package/lib/seo/core/plainDescription.js.map +1 -1
- package/lib/seo/core/siteFiles.d.ts +32 -3
- package/lib/seo/core/siteFiles.d.ts.map +1 -1
- package/lib/seo/core/siteFiles.js +13 -4
- package/lib/seo/core/siteFiles.js.map +1 -1
- package/lib/seo/core/startDocumentMeta.js +8 -7
- package/lib/seo/core/startDocumentMeta.js.map +1 -1
- package/lib/seo/vite/prerender.d.ts +26 -4
- package/lib/seo/vite/prerender.d.ts.map +1 -1
- package/lib/seo/vite/prerender.js +100 -30
- package/lib/seo/vite/prerender.js.map +1 -1
- package/lib/share/core/devices.d.ts +41 -0
- package/lib/share/core/devices.d.ts.map +1 -0
- package/lib/share/core/devices.js +58 -0
- package/lib/share/core/devices.js.map +1 -0
- package/lib/share/core/index.d.ts +4 -0
- package/lib/share/core/index.d.ts.map +1 -1
- package/lib/share/core/index.js +2 -0
- package/lib/share/core/index.js.map +1 -1
- package/lib/share/core/regions.d.ts +43 -0
- package/lib/share/core/regions.d.ts.map +1 -0
- package/lib/share/core/regions.js +71 -0
- package/lib/share/core/regions.js.map +1 -0
- package/lib/share/ui/HiddenPartsProvider.d.ts.map +1 -1
- package/lib/share/ui/HiddenPartsProvider.js +4 -1
- package/lib/share/ui/HiddenPartsProvider.js.map +1 -1
- package/lib/share/ui/PagePart.d.ts.map +1 -1
- package/lib/share/ui/PagePart.js +10 -1
- package/lib/share/ui/PagePart.js.map +1 -1
- package/lib/share/ui/ShareButton.d.ts.map +1 -1
- package/lib/share/ui/ShareButton.js +3 -4
- package/lib/share/ui/ShareButton.js.map +1 -1
- package/lib/share/ui/ShareConfigOptions.d.ts +6 -1
- package/lib/share/ui/ShareConfigOptions.d.ts.map +1 -1
- package/lib/share/ui/ShareConfigOptions.js +6 -13
- package/lib/share/ui/ShareConfigOptions.js.map +1 -1
- package/lib/share/ui/ShareDialog.d.ts +14 -0
- package/lib/share/ui/ShareDialog.d.ts.map +1 -1
- package/lib/share/ui/ShareDialog.js +3 -3
- package/lib/share/ui/ShareDialog.js.map +1 -1
- package/lib/share/ui/ShareDialogContent.d.ts +2 -2
- package/lib/share/ui/ShareDialogContent.d.ts.map +1 -1
- package/lib/share/ui/ShareDialogContent.js +36 -30
- package/lib/share/ui/ShareDialogContent.js.map +1 -1
- package/lib/share/ui/ShareLinkBar.d.ts +21 -0
- package/lib/share/ui/ShareLinkBar.d.ts.map +1 -0
- package/lib/share/ui/ShareLinkBar.js +32 -0
- package/lib/share/ui/ShareLinkBar.js.map +1 -0
- package/lib/share/ui/SharePanes.d.ts +17 -0
- package/lib/share/ui/SharePanes.d.ts.map +1 -0
- package/lib/share/ui/SharePanes.js +27 -0
- package/lib/share/ui/SharePanes.js.map +1 -0
- package/lib/share/ui/SharePartOptions.d.ts +9 -3
- package/lib/share/ui/SharePartOptions.d.ts.map +1 -1
- package/lib/share/ui/SharePartOptions.js +12 -16
- package/lib/share/ui/SharePartOptions.js.map +1 -1
- package/lib/share/ui/SharePartRow.d.ts +37 -0
- package/lib/share/ui/SharePartRow.d.ts.map +1 -0
- package/lib/share/ui/SharePartRow.js +25 -0
- package/lib/share/ui/SharePartRow.js.map +1 -0
- package/lib/share/ui/SharePresetTabs.d.ts +10 -7
- package/lib/share/ui/SharePresetTabs.d.ts.map +1 -1
- package/lib/share/ui/SharePresetTabs.js +17 -17
- package/lib/share/ui/SharePresetTabs.js.map +1 -1
- package/lib/share/ui/SharePreview.d.ts +32 -0
- package/lib/share/ui/SharePreview.d.ts.map +1 -0
- package/lib/share/ui/SharePreview.js +104 -0
- package/lib/share/ui/SharePreview.js.map +1 -0
- package/lib/share/ui/SharePreviewDevices.d.ts +20 -0
- package/lib/share/ui/SharePreviewDevices.d.ts.map +1 -0
- package/lib/share/ui/SharePreviewDevices.js +40 -0
- package/lib/share/ui/SharePreviewDevices.js.map +1 -0
- package/lib/share/ui/index.d.ts +1 -0
- package/lib/share/ui/index.d.ts.map +1 -1
- package/lib/share/ui/index.js.map +1 -1
- package/lib/share/ui/shareMarking.d.ts +14 -0
- package/lib/share/ui/shareMarking.d.ts.map +1 -0
- package/lib/share/ui/shareMarking.js +17 -0
- package/lib/share/ui/shareMarking.js.map +1 -0
- package/lib/share/ui/useShareRegionReports.d.ts +12 -0
- package/lib/share/ui/useShareRegionReports.d.ts.map +1 -0
- package/lib/share/ui/useShareRegionReports.js +73 -0
- package/lib/share/ui/useShareRegionReports.js.map +1 -0
- package/lib/shared/ui/ActionTooltip.d.ts +42 -0
- package/lib/shared/ui/ActionTooltip.d.ts.map +1 -0
- package/lib/shared/ui/ActionTooltip.js +21 -0
- package/lib/shared/ui/ActionTooltip.js.map +1 -0
- package/lib/shared/ui/index.d.ts +4 -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/shared/ui/useActionTooltip.d.ts +48 -0
- package/lib/shared/ui/useActionTooltip.d.ts.map +1 -0
- package/lib/shared/ui/useActionTooltip.js +78 -0
- package/lib/shared/ui/useActionTooltip.js.map +1 -0
- package/lib/structure/core/index.d.ts +2 -0
- package/lib/structure/core/index.d.ts.map +1 -1
- package/lib/structure/core/index.js +1 -0
- package/lib/structure/core/index.js.map +1 -1
- package/lib/structure/core/sourceMolecule.d.ts +18 -0
- package/lib/structure/core/sourceMolecule.d.ts.map +1 -0
- package/lib/structure/core/sourceMolecule.js +26 -0
- package/lib/structure/core/sourceMolecule.js.map +1 -0
- package/lib/structure/core/structureNotations.d.ts +57 -0
- package/lib/structure/core/structureNotations.d.ts.map +1 -0
- package/lib/structure/core/structureNotations.js +74 -0
- package/lib/structure/core/structureNotations.js.map +1 -0
- package/lib/structure/core/structurePicture.d.ts +49 -0
- package/lib/structure/core/structurePicture.d.ts.map +1 -0
- package/lib/structure/core/structurePicture.js +83 -0
- package/lib/structure/core/structurePicture.js.map +1 -0
- package/lib/structure/ui/EditorExportButton.d.ts +23 -0
- package/lib/structure/ui/EditorExportButton.d.ts.map +1 -0
- package/lib/structure/ui/EditorExportButton.js +23 -0
- package/lib/structure/ui/EditorExportButton.js.map +1 -0
- package/lib/structure/ui/EditorHelpButton.d.ts +5 -2
- package/lib/structure/ui/EditorHelpButton.d.ts.map +1 -1
- package/lib/structure/ui/EditorHelpButton.js +8 -9
- package/lib/structure/ui/EditorHelpButton.js.map +1 -1
- package/lib/structure/ui/StructureEditor.d.ts +8 -0
- package/lib/structure/ui/StructureEditor.d.ts.map +1 -1
- package/lib/structure/ui/StructureEditor.js +26 -3
- package/lib/structure/ui/StructureEditor.js.map +1 -1
- package/lib/structure/ui/StructureExportDialog.d.ts +34 -0
- package/lib/structure/ui/StructureExportDialog.d.ts.map +1 -0
- package/lib/structure/ui/StructureExportDialog.js +43 -0
- package/lib/structure/ui/StructureExportDialog.js.map +1 -0
- package/lib/structure/ui/StructureExportPanel.d.ts +37 -0
- package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -0
- package/lib/structure/ui/StructureExportPanel.js +75 -0
- package/lib/structure/ui/StructureExportPanel.js.map +1 -0
- package/lib/structure/ui/StructureNotationRow.d.ts +22 -0
- package/lib/structure/ui/StructureNotationRow.d.ts.map +1 -0
- package/lib/structure/ui/StructureNotationRow.js +34 -0
- package/lib/structure/ui/StructureNotationRow.js.map +1 -0
- package/lib/structure/ui/StructurePicturePane.d.ts +23 -0
- package/lib/structure/ui/StructurePicturePane.d.ts.map +1 -0
- package/lib/structure/ui/StructurePicturePane.js +113 -0
- package/lib/structure/ui/StructurePicturePane.js.map +1 -0
- package/lib/structure/ui/StructureSvg.d.ts.map +1 -1
- package/lib/structure/ui/StructureSvg.js +2 -18
- package/lib/structure/ui/StructureSvg.js.map +1 -1
- package/lib/structure/ui/ToolbarTooltip.d.ts.map +1 -1
- package/lib/structure/ui/ToolbarTooltip.js +1 -2
- package/lib/structure/ui/ToolbarTooltip.js.map +1 -1
- package/lib/structure/ui/index.d.ts +7 -3
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js +5 -3
- package/lib/structure/ui/index.js.map +1 -1
- package/lib/structure/ui/structureNotationText.d.ts +23 -0
- package/lib/structure/ui/structureNotationText.d.ts.map +1 -0
- package/lib/structure/ui/structureNotationText.js +42 -0
- package/lib/structure/ui/structureNotationText.js.map +1 -0
- package/lib/structure/ui/useEditorStructure.d.ts +37 -0
- package/lib/structure/ui/useEditorStructure.d.ts.map +1 -0
- package/lib/structure/ui/useEditorStructure.js +70 -0
- package/lib/structure/ui/useEditorStructure.js.map +1 -0
- package/lib/ui.d.ts +1 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +1 -0
- package/lib/ui.js.map +1 -1
- package/package.json +1 -1
- package/src/chart/ui/Axes.tsx +53 -5
- package/src/chrome/ui/NavMenuButton.tsx +61 -18
- package/src/chrome/ui/SiteHeader.tsx +37 -1
- package/src/chrome/ui/navItem.ts +7 -0
- package/src/citation/ui/entries.tsx +10 -2
- package/src/clipboard/ui/ClickToCopy.tsx +47 -13
- package/src/clipboard/ui/CopyButton.tsx +4 -2
- package/src/clipboard/ui/CopyableValue.tsx +88 -13
- package/src/clipboard/ui/index.ts +5 -1
- package/src/confirm/ui/ConfirmButton.tsx +2 -0
- package/src/core.ts +1 -0
- package/src/delimited/ui/TableDataButton.tsx +2 -1
- package/src/download/core/figureSvg.ts +42 -10
- package/src/help/ui/HelpToolbarButton.tsx +2 -1
- package/src/locales/de.json +48 -5
- package/src/locales/en.json +48 -5
- package/src/locales/es.json +48 -5
- package/src/locales/fr.json +48 -5
- package/src/locales/it.json +48 -5
- package/src/number/core/index.ts +1 -0
- package/src/number/core/numberText.ts +20 -0
- package/src/number/ui/NumberInput.tsx +1 -1
- package/src/overlay/ui/OverlayIconButton.tsx +1 -0
- package/src/panel/ui/ClearButton.tsx +1 -0
- package/src/pedagogy/core/inlineMarks.ts +15 -7
- package/src/pedagogy/ui/GlossaryDefinition.tsx +8 -18
- package/src/pedagogy/ui/GlossaryIndex.tsx +0 -1
- package/src/pedagogy/ui/GlossaryProvider.tsx +10 -2
- package/src/pedagogy/ui/GlossaryText.tsx +10 -2
- package/src/pedagogy/ui/InlineText.tsx +21 -4
- package/src/pedagogy/ui/ReferenceSectionBlock.tsx +8 -2
- package/src/pedagogy/ui/SyntaxTooltip.tsx +11 -9
- package/src/pedagogy/ui/TutorialStepStrip.tsx +50 -18
- package/src/pedagogy/ui/glossaryContext.ts +7 -0
- package/src/pedagogy/ui/index.ts +1 -1
- package/src/pedagogy/ui/inlineSegments.tsx +7 -0
- package/src/pedagogy/ui/pedagogyStyle.ts +12 -24
- package/src/range/core/index.ts +11 -0
- package/src/range/core/rangeBounds.ts +143 -0
- package/src/range/core/rangeHistogram.ts +38 -0
- package/src/range/ui/RangeHistogram.tsx +49 -0
- package/src/range/ui/RangeSlider.tsx +209 -0
- package/src/range/ui/RangeValue.tsx +166 -0
- package/src/range/ui/index.ts +2 -0
- package/src/seo/core/documentMeta.ts +22 -0
- package/src/seo/core/index.ts +8 -1
- package/src/seo/core/noscript.ts +20 -2
- package/src/seo/core/pageMeta.ts +29 -5
- package/src/seo/core/plainDescription.ts +4 -2
- package/src/seo/core/siteFiles.ts +45 -10
- package/src/seo/core/startDocumentMeta.ts +9 -9
- package/src/seo/vite/prerender.ts +160 -36
- package/src/share/core/devices.ts +80 -0
- package/src/share/core/index.ts +14 -0
- package/src/share/core/regions.ts +87 -0
- package/src/share/ui/HiddenPartsProvider.tsx +6 -1
- package/src/share/ui/PagePart.tsx +12 -1
- package/src/share/ui/ShareButton.tsx +3 -6
- package/src/share/ui/ShareConfigOptions.tsx +25 -16
- package/src/share/ui/ShareDialog.tsx +17 -3
- package/src/share/ui/ShareDialogContent.tsx +80 -77
- package/src/share/ui/ShareLinkBar.tsx +70 -0
- package/src/share/ui/SharePanes.tsx +62 -0
- package/src/share/ui/SharePartOptions.tsx +25 -26
- package/src/share/ui/SharePartRow.tsx +78 -0
- package/src/share/ui/SharePresetTabs.tsx +36 -43
- package/src/share/ui/SharePreview.tsx +204 -0
- package/src/share/ui/SharePreviewDevices.tsx +70 -0
- package/src/share/ui/index.ts +1 -0
- package/src/share/ui/shareMarking.ts +18 -0
- package/src/share/ui/useShareRegionReports.ts +84 -0
- package/src/shared/ui/ActionTooltip.tsx +70 -0
- package/src/shared/ui/index.ts +7 -0
- package/src/shared/ui/useActionTooltip.ts +103 -0
- package/src/structure/core/index.ts +5 -0
- package/src/structure/core/sourceMolecule.ts +26 -0
- package/src/structure/core/structureNotations.ts +125 -0
- package/src/structure/core/structurePicture.ts +119 -0
- package/src/structure/ui/EditorExportButton.tsx +62 -0
- package/src/structure/ui/EditorHelpButton.tsx +26 -30
- package/src/structure/ui/StructureEditor.tsx +51 -5
- package/src/structure/ui/StructureExportDialog.tsx +90 -0
- package/src/structure/ui/StructureExportPanel.tsx +156 -0
- package/src/structure/ui/StructureNotationRow.tsx +74 -0
- package/src/structure/ui/StructurePicturePane.tsx +208 -0
- package/src/structure/ui/StructureSvg.tsx +3 -12
- package/src/structure/ui/ToolbarTooltip.tsx +1 -1
- package/src/structure/ui/index.ts +7 -3
- package/src/structure/ui/structureNotationText.ts +56 -0
- package/src/structure/ui/useEditorStructure.ts +119 -0
- package/src/ui.ts +1 -0
- package/styles/chrome.css +546 -11
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { SHARE_REGIONS_MESSAGE, isShareRegionsRequest } from "../core/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Report where each part of this page sits, while a share dialog is looking at
|
|
5
|
+
* it through its preview.
|
|
6
|
+
*
|
|
7
|
+
* Nothing happens on a page nobody frames, and nothing happens in a frame
|
|
8
|
+
* whose host never asks — a page embedded in a course is framed too, and owes
|
|
9
|
+
* its host nothing.
|
|
10
|
+
* @param hidden - The parts the link switches off, so the boxes are measured again when they change.
|
|
11
|
+
* @returns Whether the page should mark its parts for the dialog to find.
|
|
12
|
+
*/
|
|
13
|
+
export function useShareRegionReports(hidden) {
|
|
14
|
+
const [marking, setMarking] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const host = globalThis.parent;
|
|
17
|
+
if (host === globalThis.self)
|
|
18
|
+
return undefined;
|
|
19
|
+
function onMessage(event) {
|
|
20
|
+
if (isShareRegionsRequest(event.data))
|
|
21
|
+
setMarking(true);
|
|
22
|
+
}
|
|
23
|
+
globalThis.addEventListener('message', onMessage);
|
|
24
|
+
return () => {
|
|
25
|
+
globalThis.removeEventListener('message', onMessage);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!marking)
|
|
30
|
+
return undefined;
|
|
31
|
+
const host = globalThis.parent;
|
|
32
|
+
function report() {
|
|
33
|
+
host.postMessage({ type: SHARE_REGIONS_MESSAGE, regions: measureRegions() }, '*');
|
|
34
|
+
}
|
|
35
|
+
// A chart, a web font or a structure drawn after mount all move the boxes,
|
|
36
|
+
// so the page is measured again whenever anything in it resizes rather
|
|
37
|
+
// than once, on a deadline it would lose.
|
|
38
|
+
const observer = new ResizeObserver(report);
|
|
39
|
+
observer.observe(document.documentElement);
|
|
40
|
+
globalThis.addEventListener('resize', report);
|
|
41
|
+
report();
|
|
42
|
+
return () => {
|
|
43
|
+
observer.disconnect();
|
|
44
|
+
globalThis.removeEventListener('resize', report);
|
|
45
|
+
};
|
|
46
|
+
}, [marking, hidden]);
|
|
47
|
+
return marking;
|
|
48
|
+
}
|
|
49
|
+
function measureRegions() {
|
|
50
|
+
const markers = document.querySelectorAll('[data-share-part]');
|
|
51
|
+
const range = document.createRange();
|
|
52
|
+
const regions = [];
|
|
53
|
+
for (const marker of markers) {
|
|
54
|
+
const { sharePart: part } = marker.dataset;
|
|
55
|
+
if (part === undefined)
|
|
56
|
+
continue;
|
|
57
|
+
// The marker lays out as `display: contents`, so it has no box of its own.
|
|
58
|
+
// A range over what it holds has the box its contents occupy.
|
|
59
|
+
range.selectNodeContents(marker);
|
|
60
|
+
const box = range.getBoundingClientRect();
|
|
61
|
+
if (box.width === 0 || box.height === 0)
|
|
62
|
+
continue;
|
|
63
|
+
regions.push({
|
|
64
|
+
part,
|
|
65
|
+
x: box.x + globalThis.scrollX,
|
|
66
|
+
y: box.y + globalThis.scrollY,
|
|
67
|
+
width: box.width,
|
|
68
|
+
height: box.height,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return regions;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=useShareRegionReports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareRegionReports.js","sourceRoot":"","sources":["../../../src/share/ui/useShareRegionReports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA2B;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC;QAC/B,IAAI,IAAI,KAAK,UAAU,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAE/C,SAAS,SAAS,CAAC,KAAmB;YACpC,IAAI,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC;QAED,UAAU,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAClD,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC;QAE/B,SAAS,MAAM;YACb,IAAI,CAAC,WAAW,CACd,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAC1D,GAAG,CACJ,CAAC;QACJ,CAAC;QAED,2EAA2E;QAC3E,uEAAuE;QACvE,0CAA0C;QAC1C,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5C,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC3C,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,EAAE,CAAC;QAET,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtB,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAc,mBAAmB,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,OAAO,GAAkB,EAAE,CAAC;IAElC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3C,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS;QACjC,2EAA2E;QAC3E,8DAA8D;QAC9D,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,GAAG,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;QAC1C,IAAI,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAClD,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO;YAC7B,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO;YAC7B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Placement } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
/** What {@link ActionTooltip} explains, and what it steps aside for. */
|
|
4
|
+
export interface ActionTooltipProps {
|
|
5
|
+
/** What the control is for, read on hover. */
|
|
6
|
+
content: string | ReactElement;
|
|
7
|
+
/** The control. */
|
|
8
|
+
children: ReactElement;
|
|
9
|
+
/**
|
|
10
|
+
* Whether what the control opens is on screen. While it is, the tooltip
|
|
11
|
+
* stays shut.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
opened?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Which side of the control the tooltip is drawn on.
|
|
17
|
+
* @default 'bottom'
|
|
18
|
+
*/
|
|
19
|
+
placement?: Placement;
|
|
20
|
+
/**
|
|
21
|
+
* Class the popover carries, for a card that is not the chrome's own.
|
|
22
|
+
* @default 'help-tooltip'
|
|
23
|
+
*/
|
|
24
|
+
popoverClassName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* How long the pointer rests on the control before the card is drawn, in
|
|
27
|
+
* milliseconds.
|
|
28
|
+
* @default 250
|
|
29
|
+
*/
|
|
30
|
+
delay?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A tooltip on a control that opens something — a dialog, a popover, a menu.
|
|
34
|
+
*
|
|
35
|
+
* It is the wrapper form of {@link useActionTooltip}, which is where the whole
|
|
36
|
+
* argument is written; a tooltip whose target cannot take a wrapping element —
|
|
37
|
+
* a menu item, a table cell — uses the hook directly.
|
|
38
|
+
* @param props - See {@link ActionTooltipProps}.
|
|
39
|
+
* @returns The control, with its tooltip.
|
|
40
|
+
*/
|
|
41
|
+
export declare function ActionTooltip(props: ActionTooltipProps): ReactElement;
|
|
42
|
+
//# sourceMappingURL=ActionTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionTooltip.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/ActionTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IAC/B,mBAAmB;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAsBrE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip } from '@blueprintjs/core';
|
|
3
|
+
import { useActionTooltip } from "./useActionTooltip.js";
|
|
4
|
+
/**
|
|
5
|
+
* A tooltip on a control that opens something — a dialog, a popover, a menu.
|
|
6
|
+
*
|
|
7
|
+
* It is the wrapper form of {@link useActionTooltip}, which is where the whole
|
|
8
|
+
* argument is written; a tooltip whose target cannot take a wrapping element —
|
|
9
|
+
* a menu item, a table cell — uses the hook directly.
|
|
10
|
+
* @param props - See {@link ActionTooltipProps}.
|
|
11
|
+
* @returns The control, with its tooltip.
|
|
12
|
+
*/
|
|
13
|
+
export function ActionTooltip(props) {
|
|
14
|
+
const { content, children, opened = false } = props;
|
|
15
|
+
const { placement = 'bottom', popoverClassName = 'help-tooltip' } = props;
|
|
16
|
+
const { delay } = props;
|
|
17
|
+
const { isOpen, target } = useActionTooltip(opened, delay);
|
|
18
|
+
return (_jsx(Tooltip, { content: content, placement: placement, popoverClassName: popoverClassName, isOpen: isOpen, children: _jsx("span", { style: WRAP_STYLE, ...target, children: children }) }));
|
|
19
|
+
}
|
|
20
|
+
const WRAP_STYLE = { display: 'inline-flex' };
|
|
21
|
+
//# sourceMappingURL=ActionTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionTooltip.js","sourceRoot":"","sources":["../../../src/shared/ui/ActionTooltip.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAgCzD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IACpD,MAAM,EAAE,SAAS,GAAG,QAAQ,EAAE,gBAAgB,GAAG,cAAc,EAAE,GAAG,KAAK,CAAC;IAC1E,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,OAAO,IACN,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,YAMd,eAAM,KAAK,EAAE,UAAU,KAAM,MAAM,YAChC,QAAQ,GACJ,GACC,CACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG,EAAE,OAAO,EAAE,aAAa,EAAmC,CAAC"}
|
package/lib/shared/ui/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export type { ActionTooltipProps } from './ActionTooltip.tsx';
|
|
2
|
+
export { ActionTooltip } from './ActionTooltip.tsx';
|
|
1
3
|
export type { HeaderButtonProps, MenuButtonProps } from './MenuButton.tsx';
|
|
2
4
|
export { MenuButton } from './MenuButton.tsx';
|
|
5
|
+
export type { ActionTooltipState, ActionTooltipTarget, } from './useActionTooltip.ts';
|
|
6
|
+
export { ACTION_TOOLTIP_DELAY, useActionTooltip } from './useActionTooltip.ts';
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/shared/ui/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAK9C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a tooltip on a control that is pressed should be on screen.
|
|
3
|
+
*
|
|
4
|
+
* Such a control is where a hover tooltip goes wrong, in two ways that look
|
|
5
|
+
* like one. What it opens lands over the control, so the `mouseleave` that
|
|
6
|
+
* would close the card is never delivered and the card is left on screen, over
|
|
7
|
+
* the thing it was explaining. And the open is *scheduled*: a press within the
|
|
8
|
+
* hover delay cancels nothing, so the card appears after the press, outlives
|
|
9
|
+
* what was opened, and comes back when it is closed — with the pointer long
|
|
10
|
+
* gone.
|
|
11
|
+
*
|
|
12
|
+
* Blueprint's own hover handling cannot be told either of those, so the state
|
|
13
|
+
* is held here and Blueprint is told only when to draw.
|
|
14
|
+
*
|
|
15
|
+
* The card is a pointer affordance only, and deliberately does not open on
|
|
16
|
+
* focus: what a control opens hands the focus back as it closes, which would
|
|
17
|
+
* put the card on screen with the pointer long gone. Nothing is lost by it —
|
|
18
|
+
* the control carries the same words as its accessible name, which is what a
|
|
19
|
+
* screen reader reads.
|
|
20
|
+
*/
|
|
21
|
+
/** The handlers the target carries, which decide when the card is drawn. */
|
|
22
|
+
export interface ActionTooltipTarget {
|
|
23
|
+
onPointerEnter: () => void;
|
|
24
|
+
onPointerLeave: () => void;
|
|
25
|
+
onPointerDownCapture: () => void;
|
|
26
|
+
onClickCapture: () => void;
|
|
27
|
+
onBlurCapture: () => void;
|
|
28
|
+
}
|
|
29
|
+
/** Whether the card is drawn, and what decides it. */
|
|
30
|
+
export interface ActionTooltipState {
|
|
31
|
+
/** What to give the tooltip as `isOpen`. */
|
|
32
|
+
isOpen: boolean;
|
|
33
|
+
/** What to give the target, or the element wrapping it. */
|
|
34
|
+
target: ActionTooltipTarget;
|
|
35
|
+
}
|
|
36
|
+
/** Long enough that sweeping the pointer across a row of controls opens none. */
|
|
37
|
+
export declare const ACTION_TOOLTIP_DELAY = 250;
|
|
38
|
+
/**
|
|
39
|
+
* Hold a tooltip's hover, so a press closes it and nothing reopens it until
|
|
40
|
+
* the pointer leaves the control and comes back.
|
|
41
|
+
* @param opened - Whether what the control opens is on screen; while it is,
|
|
42
|
+
* the card stays shut.
|
|
43
|
+
* @param delay - How long the pointer rests before the card is drawn, in
|
|
44
|
+
* milliseconds. A card heavier than a line of text asks for longer.
|
|
45
|
+
* @returns Whether to draw the card, and the handlers that decide it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useActionTooltip(opened?: boolean, delay?: number): ActionTooltipState;
|
|
48
|
+
//# sourceMappingURL=useActionTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActionTooltip.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/useActionTooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,sDAAsD;AACtD,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,UAAQ,EACd,KAAK,SAAuB,GAC3B,kBAAkB,CA+CpB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a tooltip on a control that is pressed should be on screen.
|
|
3
|
+
*
|
|
4
|
+
* Such a control is where a hover tooltip goes wrong, in two ways that look
|
|
5
|
+
* like one. What it opens lands over the control, so the `mouseleave` that
|
|
6
|
+
* would close the card is never delivered and the card is left on screen, over
|
|
7
|
+
* the thing it was explaining. And the open is *scheduled*: a press within the
|
|
8
|
+
* hover delay cancels nothing, so the card appears after the press, outlives
|
|
9
|
+
* what was opened, and comes back when it is closed — with the pointer long
|
|
10
|
+
* gone.
|
|
11
|
+
*
|
|
12
|
+
* Blueprint's own hover handling cannot be told either of those, so the state
|
|
13
|
+
* is held here and Blueprint is told only when to draw.
|
|
14
|
+
*
|
|
15
|
+
* The card is a pointer affordance only, and deliberately does not open on
|
|
16
|
+
* focus: what a control opens hands the focus back as it closes, which would
|
|
17
|
+
* put the card on screen with the pointer long gone. Nothing is lost by it —
|
|
18
|
+
* the control carries the same words as its accessible name, which is what a
|
|
19
|
+
* screen reader reads.
|
|
20
|
+
*/
|
|
21
|
+
import { useEffect, useRef, useState } from 'react';
|
|
22
|
+
/** Long enough that sweeping the pointer across a row of controls opens none. */
|
|
23
|
+
export const ACTION_TOOLTIP_DELAY = 250;
|
|
24
|
+
/**
|
|
25
|
+
* Hold a tooltip's hover, so a press closes it and nothing reopens it until
|
|
26
|
+
* the pointer leaves the control and comes back.
|
|
27
|
+
* @param opened - Whether what the control opens is on screen; while it is,
|
|
28
|
+
* the card stays shut.
|
|
29
|
+
* @param delay - How long the pointer rests before the card is drawn, in
|
|
30
|
+
* milliseconds. A card heavier than a line of text asks for longer.
|
|
31
|
+
* @returns Whether to draw the card, and the handlers that decide it.
|
|
32
|
+
*/
|
|
33
|
+
export function useActionTooltip(opened = false, delay = ACTION_TOOLTIP_DELAY) {
|
|
34
|
+
const [shown, setShown] = useState(false);
|
|
35
|
+
const waiting = useRef(null);
|
|
36
|
+
// Set by the press, and cleared only by the pointer actually leaving. It is
|
|
37
|
+
// what the pointer never leaving looks like: the dialog lands over the
|
|
38
|
+
// control, and removing it again makes the browser hand the control a fresh
|
|
39
|
+
// `pointerenter` — with the pointer never having moved. Clearing the latch
|
|
40
|
+
// there, or on the focus the dialog gives back as it closes, is what made
|
|
41
|
+
// the card reappear the moment the dialog was dismissed.
|
|
42
|
+
const pressed = useRef(false);
|
|
43
|
+
function cancel() {
|
|
44
|
+
if (waiting.current !== null)
|
|
45
|
+
clearTimeout(waiting.current);
|
|
46
|
+
waiting.current = null;
|
|
47
|
+
}
|
|
48
|
+
function hide() {
|
|
49
|
+
cancel();
|
|
50
|
+
setShown(false);
|
|
51
|
+
}
|
|
52
|
+
function press() {
|
|
53
|
+
pressed.current = true;
|
|
54
|
+
hide();
|
|
55
|
+
}
|
|
56
|
+
useEffect(() => cancel, []);
|
|
57
|
+
return {
|
|
58
|
+
isOpen: shown && !opened,
|
|
59
|
+
target: {
|
|
60
|
+
onPointerEnter: () => {
|
|
61
|
+
if (pressed.current)
|
|
62
|
+
return;
|
|
63
|
+
cancel();
|
|
64
|
+
waiting.current = setTimeout(() => setShown(true), delay);
|
|
65
|
+
},
|
|
66
|
+
onPointerLeave: () => {
|
|
67
|
+
pressed.current = false;
|
|
68
|
+
hide();
|
|
69
|
+
},
|
|
70
|
+
onPointerDownCapture: press,
|
|
71
|
+
// Enter and Space fire no pointer event, so a control worked from the
|
|
72
|
+
// keyboard is let go of here instead.
|
|
73
|
+
onClickCapture: press,
|
|
74
|
+
onBlurCapture: hide,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=useActionTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActionTooltip.js","sourceRoot":"","sources":["../../../src/shared/ui/useActionTooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAmBpD,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAM,GAAG,KAAK,EACd,KAAK,GAAG,oBAAoB;IAE5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IACnE,4EAA4E;IAC5E,uEAAuE;IACvE,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,yDAAyD;IACzD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9B,SAAS,MAAM;QACb,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI;YAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5D,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,SAAS,IAAI;QACX,MAAM,EAAE,CAAC;QACT,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IAED,SAAS,KAAK;QACZ,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,IAAI,EAAE,CAAC;IACT,CAAC;IAED,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE5B,OAAO;QACL,MAAM,EAAE,KAAK,IAAI,CAAC,MAAM;QACxB,MAAM,EAAE;YACN,cAAc,EAAE,GAAG,EAAE;gBACnB,IAAI,OAAO,CAAC,OAAO;oBAAE,OAAO;gBAC5B,MAAM,EAAE,CAAC;gBACT,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;YACD,cAAc,EAAE,GAAG,EAAE;gBACnB,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;gBACxB,IAAI,EAAE,CAAC;YACT,CAAC;YACD,oBAAoB,EAAE,KAAK;YAC3B,sEAAsE;YACtE,sCAAsC;YACtC,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,IAAI;SACpB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -24,6 +24,8 @@ export type { ReadStructureResult, StructureKind } from './readStructure.ts';
|
|
|
24
24
|
export { looksLikeSmarts, readStructure } from './readStructure.ts';
|
|
25
25
|
export type { StructureError } from './structureError.ts';
|
|
26
26
|
export { structureError } from './structureError.ts';
|
|
27
|
+
export type { StructurePicture, StructurePictureOptions, } from './structurePicture.ts';
|
|
28
|
+
export { STRUCTURE_BOND_LENGTH, structurePicture } from './structurePicture.ts';
|
|
27
29
|
export type { StructureSource, StructureSourceInput, } from './structureSource.ts';
|
|
28
30
|
export { structureSource } from './structureSource.ts';
|
|
29
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/structure/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/structure/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,YAAY,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -11,5 +11,6 @@ export { classifyMolfile, looksLikeMolfile, molfileAtomCount, } from "./molfile.
|
|
|
11
11
|
export { readMolfileExport, toMolfileExport } from "./molfileExport.js";
|
|
12
12
|
export { looksLikeSmarts, readStructure } from "./readStructure.js";
|
|
13
13
|
export { structureError } from "./structureError.js";
|
|
14
|
+
export { STRUCTURE_BOND_LENGTH, structurePicture } from "./structurePicture.js";
|
|
14
15
|
export { structureSource } from "./structureSource.js";
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structure/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAOtE,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/structure/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAOtE,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKhF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the notation a depiction was handed into the molecule it draws.
|
|
3
|
+
*
|
|
4
|
+
* **Not exported from `core/index.ts`**: it value-imports `openchemlib`, so a
|
|
5
|
+
* barrel carrying it would pull the whole library into every site that imports
|
|
6
|
+
* `react-cheminfo/core`. The depiction and the export dialog both load it
|
|
7
|
+
* lazily, which is where openchemlib already is.
|
|
8
|
+
*/
|
|
9
|
+
import { Molecule } from 'openchemlib';
|
|
10
|
+
import type { StructureSource } from './structureSource.ts';
|
|
11
|
+
/**
|
|
12
|
+
* Parse one picked notation.
|
|
13
|
+
* @param source - The notation, as `structureSource` picked it.
|
|
14
|
+
* @returns The molecule, which holds no atom for an empty source.
|
|
15
|
+
* @throws {Error} Whatever OpenChemLib throws on a notation it cannot read.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sourceMolecule(source: StructureSource): Molecule;
|
|
18
|
+
//# sourceMappingURL=sourceMolecule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceMolecule.d.ts","sourceRoot":"","sources":["../../../src/structure/core/sourceMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,QAAQ,CAMhE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the notation a depiction was handed into the molecule it draws.
|
|
3
|
+
*
|
|
4
|
+
* **Not exported from `core/index.ts`**: it value-imports `openchemlib`, so a
|
|
5
|
+
* barrel carrying it would pull the whole library into every site that imports
|
|
6
|
+
* `react-cheminfo/core`. The depiction and the export dialog both load it
|
|
7
|
+
* lazily, which is where openchemlib already is.
|
|
8
|
+
*/
|
|
9
|
+
import { Molecule } from 'openchemlib';
|
|
10
|
+
/**
|
|
11
|
+
* Parse one picked notation.
|
|
12
|
+
* @param source - The notation, as `structureSource` picked it.
|
|
13
|
+
* @returns The molecule, which holds no atom for an empty source.
|
|
14
|
+
* @throws {Error} Whatever OpenChemLib throws on a notation it cannot read.
|
|
15
|
+
*/
|
|
16
|
+
export function sourceMolecule(source) {
|
|
17
|
+
const { kind, value, coordinates } = source;
|
|
18
|
+
if (kind === 'idcode')
|
|
19
|
+
return Molecule.fromIDCode(value, coordinates);
|
|
20
|
+
if (kind === 'molfile')
|
|
21
|
+
return Molecule.fromMolfile(value);
|
|
22
|
+
if (kind === 'smiles')
|
|
23
|
+
return Molecule.fromSmiles(value);
|
|
24
|
+
return new Molecule(0, 0);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=sourceMolecule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceMolecule.js","sourceRoot":"","sources":["../../../src/structure/core/sourceMolecule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAuB;IACpD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC5C,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACtE,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every way this package writes a drawn structure out.
|
|
3
|
+
*
|
|
4
|
+
* **Not exported from `core/index.ts`, and it must not be.** It is the one
|
|
5
|
+
* structure module that value-imports `openchemlib`, because the canonical
|
|
6
|
+
* forms below are `CanonizerUtil`'s and nothing on `Molecule` reaches them, so
|
|
7
|
+
* a barrel carrying it would pull openchemlib into every site that imports
|
|
8
|
+
* `react-cheminfo/core` for a formatter. The export dialog loads it lazily
|
|
9
|
+
* instead, next to the editor that already has openchemlib.
|
|
10
|
+
*/
|
|
11
|
+
import type { Molecule } from 'openchemlib';
|
|
12
|
+
/** The notations offered, in the order they are offered in. */
|
|
13
|
+
export type StructureNotationKind = 'smiles' | 'molfileV3000' | 'molfileV2000' | 'idCode' | 'noStereoIdCode' | 'noStereoTautomerIdCode';
|
|
14
|
+
/** How a notation leaves the page as a file. */
|
|
15
|
+
export interface StructureNotationFile {
|
|
16
|
+
/** Added to the structure's own name, so two molfiles do not collide. */
|
|
17
|
+
suffix: string;
|
|
18
|
+
/** The extension, without its dot. */
|
|
19
|
+
extension: string;
|
|
20
|
+
/** What the file holds, so the system opens it with the right application. */
|
|
21
|
+
mimeType: string;
|
|
22
|
+
}
|
|
23
|
+
/** One way of writing a structure. */
|
|
24
|
+
export interface StructureNotation {
|
|
25
|
+
/** Which notation it is. */
|
|
26
|
+
kind: StructureNotationKind;
|
|
27
|
+
/** The notation itself, empty when OpenChemLib would not write it. */
|
|
28
|
+
value: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether it is one of the canonical identifiers — a string that names the
|
|
31
|
+
* molecule rather than describes the drawing, and that a record is looked up
|
|
32
|
+
* by. They answer a database question rather than a drawing one, so they are
|
|
33
|
+
* shown apart from the rest.
|
|
34
|
+
*/
|
|
35
|
+
canonical: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The file it is saved as. Absent for a notation that is only ever copied.
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
file?: StructureNotationFile;
|
|
41
|
+
/**
|
|
42
|
+
* Whether it runs over several lines, so it is shown as a block rather than
|
|
43
|
+
* on the label's own line.
|
|
44
|
+
*/
|
|
45
|
+
block: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Write a structure every way the export dialog offers.
|
|
49
|
+
*
|
|
50
|
+
* A notation OpenChemLib refuses — a query fragment has no SMILES, a generic
|
|
51
|
+
* tautomer cannot always be canonized — comes back empty rather than taking
|
|
52
|
+
* the rest of the list down with it.
|
|
53
|
+
* @param molecule - The structure, as the editor handed it over. Not modified.
|
|
54
|
+
* @returns One entry per notation, in the order they are shown.
|
|
55
|
+
*/
|
|
56
|
+
export declare function structureNotations(molecule: Molecule): StructureNotation[];
|
|
57
|
+
//# sourceMappingURL=structureNotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structureNotations.d.ts","sourceRoot":"","sources":["../../../src/structure/core/structureNotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,cAAc,GACd,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,wBAAwB,CAAC;AAE7B,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAKD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,EAAE,CAyC1E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every way this package writes a drawn structure out.
|
|
3
|
+
*
|
|
4
|
+
* **Not exported from `core/index.ts`, and it must not be.** It is the one
|
|
5
|
+
* structure module that value-imports `openchemlib`, because the canonical
|
|
6
|
+
* forms below are `CanonizerUtil`'s and nothing on `Molecule` reaches them, so
|
|
7
|
+
* a barrel carrying it would pull openchemlib into every site that imports
|
|
8
|
+
* `react-cheminfo/core` for a formatter. The export dialog loads it lazily
|
|
9
|
+
* instead, next to the editor that already has openchemlib.
|
|
10
|
+
*/
|
|
11
|
+
import { CanonizerUtil } from 'openchemlib';
|
|
12
|
+
/** What a molfile is, for the application that opens one. */
|
|
13
|
+
const MOLFILE_TYPE = 'chemical/x-mdl-molfile';
|
|
14
|
+
/**
|
|
15
|
+
* Write a structure every way the export dialog offers.
|
|
16
|
+
*
|
|
17
|
+
* A notation OpenChemLib refuses — a query fragment has no SMILES, a generic
|
|
18
|
+
* tautomer cannot always be canonized — comes back empty rather than taking
|
|
19
|
+
* the rest of the list down with it.
|
|
20
|
+
* @param molecule - The structure, as the editor handed it over. Not modified.
|
|
21
|
+
* @returns One entry per notation, in the order they are shown.
|
|
22
|
+
*/
|
|
23
|
+
export function structureNotations(molecule) {
|
|
24
|
+
const idCode = written(() => molecule.getIDCode());
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
kind: 'smiles',
|
|
28
|
+
value: written(() => molecule.toIsomericSmiles()),
|
|
29
|
+
canonical: false,
|
|
30
|
+
block: false,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
kind: 'molfileV3000',
|
|
34
|
+
value: written(() => molecule.toMolfileV3()),
|
|
35
|
+
canonical: false,
|
|
36
|
+
file: { suffix: '-v3000', extension: 'mol', mimeType: MOLFILE_TYPE },
|
|
37
|
+
block: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: 'molfileV2000',
|
|
41
|
+
value: written(() => molecule.toMolfile()),
|
|
42
|
+
canonical: false,
|
|
43
|
+
file: { suffix: '-v2000', extension: 'mol', mimeType: MOLFILE_TYPE },
|
|
44
|
+
block: true,
|
|
45
|
+
},
|
|
46
|
+
{ kind: 'idCode', value: idCode, canonical: true, block: false },
|
|
47
|
+
{
|
|
48
|
+
kind: 'noStereoIdCode',
|
|
49
|
+
value: written(() => CanonizerUtil.getIDCode(molecule, CanonizerUtil.NOSTEREO)),
|
|
50
|
+
canonical: true,
|
|
51
|
+
block: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
kind: 'noStereoTautomerIdCode',
|
|
55
|
+
value: written(() => CanonizerUtil.getIDCode(molecule, CanonizerUtil.NOSTEREO_TAUTOMER)),
|
|
56
|
+
canonical: true,
|
|
57
|
+
block: false,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One notation, or nothing when OpenChemLib will not write it.
|
|
63
|
+
* @param write - What writes it.
|
|
64
|
+
* @returns The notation, empty on a refusal.
|
|
65
|
+
*/
|
|
66
|
+
function written(write) {
|
|
67
|
+
try {
|
|
68
|
+
return write();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=structureNotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structureNotations.js","sourceRoot":"","sources":["../../../src/structure/core/structureNotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA8C5C,6DAA6D;AAC7D,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACnD,OAAO;QACL;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YACjD,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,KAAK;SACb;QACD;YACE,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC5C,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE;YACpE,KAAK,EAAE,IAAI;SACZ;QACD;YACE,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YAC1C,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE;YACpE,KAAK,EAAE,IAAI;SACZ;QACD,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;QAChE;YACE,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAClB,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,CAC1D;YACD,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,KAAK;SACb;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAClB,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CACnE;YACD,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,KAAK;SACb;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,IAAI,CAAC;QACH,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A structure as a picture, drawn at the size it is saved at.
|
|
3
|
+
*
|
|
4
|
+
* The resolution is a bond length rather than a canvas: OpenChemLib caps the
|
|
5
|
+
* bond it draws at 24 pixels whatever box it is given, so asking for a canvas
|
|
6
|
+
* four times larger produces the same small drawing with more white around it
|
|
7
|
+
* — a resolution control that changes the file and not the picture. Lifting
|
|
8
|
+
* the cap and cropping to the structure is what makes `4×` genuinely four
|
|
9
|
+
* times the drawing.
|
|
10
|
+
*/
|
|
11
|
+
import type { Molecule } from 'openchemlib';
|
|
12
|
+
import type { FigurePixels } from '../../download/core/figureScale.ts';
|
|
13
|
+
/** How the picture is drawn. */
|
|
14
|
+
export interface StructurePictureOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The longest bond drawn, in pixels, which is what sets the size of
|
|
17
|
+
* everything else — the picture is cropped to the structure afterwards.
|
|
18
|
+
* @default 60
|
|
19
|
+
*/
|
|
20
|
+
bondLength?: number;
|
|
21
|
+
/**
|
|
22
|
+
* What is painted behind the structure. An SVG left unpainted opens
|
|
23
|
+
* transparent, and a structure is drawn in black, so it disappears in
|
|
24
|
+
* anything with a dark background — a slide, a reader in dark mode.
|
|
25
|
+
* @default '#ffffff'
|
|
26
|
+
*/
|
|
27
|
+
background?: string;
|
|
28
|
+
}
|
|
29
|
+
/** A structure drawn, and how big it came out. */
|
|
30
|
+
export interface StructurePicture extends FigurePixels {
|
|
31
|
+
/** The SVG document, ready to be saved or rasterized. */
|
|
32
|
+
markup: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The bond length a picture is drawn at before the resolution multiplies it.
|
|
36
|
+
*
|
|
37
|
+
* Chosen so a drug-sized molecule comes out around 300 pixels wide, which is
|
|
38
|
+
* what a note or a chat window wants; two or three times that is a slide, and
|
|
39
|
+
* four is print.
|
|
40
|
+
*/
|
|
41
|
+
export declare const STRUCTURE_BOND_LENGTH = 60;
|
|
42
|
+
/**
|
|
43
|
+
* Draw a structure as a standalone SVG document, cropped to the structure.
|
|
44
|
+
* @param molecule - The structure. Not modified.
|
|
45
|
+
* @param options - How large to draw it, and what to paint behind it.
|
|
46
|
+
* @returns The document and the size it came out at.
|
|
47
|
+
*/
|
|
48
|
+
export declare function structurePicture(molecule: Molecule, options?: StructurePictureOptions): StructurePicture;
|
|
49
|
+
//# sourceMappingURL=structurePicture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structurePicture.d.ts","sourceRoot":"","sources":["../../../src/structure/core/structurePicture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,gCAAgC;AAChC,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,kDAAkD;AAClD,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAgBxC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAUlB"}
|