react-cheminfo 0.3.0 → 0.4.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 +111 -23
- package/lib/capsule/ui/CapsuleFilter.d.ts +61 -0
- package/lib/capsule/ui/CapsuleFilter.d.ts.map +1 -0
- package/lib/capsule/ui/CapsuleFilter.js +33 -0
- package/lib/capsule/ui/CapsuleFilter.js.map +1 -0
- package/lib/capsule/ui/index.d.ts +3 -0
- package/lib/capsule/ui/index.d.ts.map +1 -0
- package/lib/capsule/ui/index.js +2 -0
- package/lib/capsule/ui/index.js.map +1 -0
- package/lib/chrome/ui/NavLink.d.ts +27 -0
- package/lib/chrome/ui/NavLink.d.ts.map +1 -0
- package/lib/chrome/ui/NavLink.js +36 -0
- package/lib/chrome/ui/NavLink.js.map +1 -0
- package/lib/chrome/ui/NavMenuButton.d.ts +40 -0
- package/lib/chrome/ui/NavMenuButton.d.ts.map +1 -0
- package/lib/chrome/ui/NavMenuButton.js +26 -0
- package/lib/chrome/ui/NavMenuButton.js.map +1 -0
- package/lib/chrome/ui/SiteFooter.d.ts +39 -0
- package/lib/chrome/ui/SiteFooter.d.ts.map +1 -0
- package/lib/chrome/ui/SiteFooter.js +17 -0
- package/lib/chrome/ui/SiteFooter.js.map +1 -0
- package/lib/chrome/ui/SiteHeader.d.ts +59 -0
- package/lib/chrome/ui/SiteHeader.d.ts.map +1 -0
- package/lib/chrome/ui/SiteHeader.js +28 -0
- package/lib/chrome/ui/SiteHeader.js.map +1 -0
- package/lib/chrome/ui/index.d.ts +12 -0
- package/lib/chrome/ui/index.d.ts.map +1 -0
- package/lib/chrome/ui/index.js +6 -0
- package/lib/chrome/ui/index.js.map +1 -0
- package/lib/chrome/ui/navItem.d.ts +57 -0
- package/lib/chrome/ui/navItem.d.ts.map +1 -0
- package/lib/chrome/ui/navItem.js +10 -0
- package/lib/chrome/ui/navItem.js.map +1 -0
- package/lib/chrome/ui/useCompactHeader.d.ts +31 -0
- package/lib/chrome/ui/useCompactHeader.d.ts.map +1 -0
- package/lib/chrome/ui/useCompactHeader.js +50 -0
- package/lib/chrome/ui/useCompactHeader.js.map +1 -0
- package/lib/citation/core/clipboard.d.ts +12 -3
- package/lib/citation/core/clipboard.d.ts.map +1 -1
- package/lib/citation/core/clipboard.js +21 -10
- package/lib/citation/core/clipboard.js.map +1 -1
- package/lib/citation/core/download.d.ts +11 -3
- package/lib/citation/core/download.d.ts.map +1 -1
- package/lib/citation/core/download.js +17 -13
- package/lib/citation/core/download.js.map +1 -1
- package/lib/citation/core/index.d.ts +4 -3
- package/lib/citation/core/index.d.ts.map +1 -1
- package/lib/citation/core/index.js +3 -3
- package/lib/citation/core/index.js.map +1 -1
- package/lib/citation/core/works.d.ts +44 -0
- package/lib/citation/core/works.d.ts.map +1 -0
- package/lib/citation/core/works.js +51 -0
- package/lib/citation/core/works.js.map +1 -0
- package/lib/citation/ui/CitationMenu.d.ts +20 -3
- package/lib/citation/ui/CitationMenu.d.ts.map +1 -1
- package/lib/citation/ui/CitationMenu.js +60 -49
- package/lib/citation/ui/CitationMenu.js.map +1 -1
- package/lib/citation/ui/CitationPreview.d.ts +5 -2
- package/lib/citation/ui/CitationPreview.d.ts.map +1 -1
- package/lib/citation/ui/CitationPreview.js +9 -4
- package/lib/citation/ui/CitationPreview.js.map +1 -1
- package/lib/citation/ui/CiteButton.d.ts +13 -6
- package/lib/citation/ui/CiteButton.d.ts.map +1 -1
- package/lib/citation/ui/CiteButton.js +5 -4
- package/lib/citation/ui/CiteButton.js.map +1 -1
- package/lib/citation/ui/CopyFormatEntries.d.ts +31 -0
- package/lib/citation/ui/CopyFormatEntries.d.ts.map +1 -0
- package/lib/citation/ui/CopyFormatEntries.js +29 -0
- package/lib/citation/ui/CopyFormatEntries.js.map +1 -0
- package/lib/citation/ui/WorkEntry.d.ts +18 -0
- package/lib/citation/ui/WorkEntry.d.ts.map +1 -0
- package/lib/citation/ui/WorkEntry.js +32 -0
- package/lib/citation/ui/WorkEntry.js.map +1 -0
- package/lib/citation/ui/entries.d.ts +7 -7
- package/lib/citation/ui/entries.d.ts.map +1 -1
- package/lib/citation/ui/entries.js +11 -13
- package/lib/citation/ui/entries.js.map +1 -1
- package/lib/citation/ui/index.d.ts +2 -2
- package/lib/citation/ui/index.d.ts.map +1 -1
- package/lib/citation/ui/index.js.map +1 -1
- package/lib/citation/ui/useCopyFeedback.d.ts +20 -0
- package/lib/citation/ui/useCopyFeedback.d.ts.map +1 -0
- package/lib/citation/ui/useCopyFeedback.js +49 -0
- package/lib/citation/ui/useCopyFeedback.js.map +1 -0
- package/lib/clipboard/core/index.d.ts +2 -0
- package/lib/clipboard/core/index.d.ts.map +1 -0
- package/lib/clipboard/core/index.js +2 -0
- package/lib/clipboard/core/index.js.map +1 -0
- package/lib/clipboard/core/writeToClipboard.d.ts +12 -0
- package/lib/clipboard/core/writeToClipboard.d.ts.map +1 -0
- package/lib/clipboard/core/writeToClipboard.js +49 -0
- package/lib/clipboard/core/writeToClipboard.js.map +1 -0
- package/lib/clipboard/ui/CodeBlock.d.ts +43 -0
- package/lib/clipboard/ui/CodeBlock.d.ts.map +1 -0
- package/lib/clipboard/ui/CodeBlock.js +49 -0
- package/lib/clipboard/ui/CodeBlock.js.map +1 -0
- package/lib/clipboard/ui/CopyButton.d.ts +64 -0
- package/lib/clipboard/ui/CopyButton.d.ts.map +1 -0
- package/lib/clipboard/ui/CopyButton.js +21 -0
- package/lib/clipboard/ui/CopyButton.js.map +1 -0
- package/lib/clipboard/ui/index.d.ts +7 -0
- package/lib/clipboard/ui/index.d.ts.map +1 -0
- package/lib/clipboard/ui/index.js +4 -0
- package/lib/clipboard/ui/index.js.map +1 -0
- package/lib/clipboard/ui/useCopyToClipboard.d.ts +24 -0
- package/lib/clipboard/ui/useCopyToClipboard.d.ts.map +1 -0
- package/lib/clipboard/ui/useCopyToClipboard.js +36 -0
- package/lib/clipboard/ui/useCopyToClipboard.js.map +1 -0
- package/lib/color/core/contrast.d.ts +43 -0
- package/lib/color/core/contrast.d.ts.map +1 -0
- package/lib/color/core/contrast.js +61 -0
- package/lib/color/core/contrast.js.map +1 -0
- package/lib/color/core/hex.d.ts +26 -0
- package/lib/color/core/hex.d.ts.map +1 -0
- package/lib/color/core/hex.js +44 -0
- package/lib/color/core/hex.js.map +1 -0
- package/lib/color/core/index.d.ts +5 -0
- package/lib/color/core/index.d.ts.map +1 -0
- package/lib/color/core/index.js +3 -0
- package/lib/color/core/index.js.map +1 -0
- package/lib/color/core/scale.d.ts +52 -0
- package/lib/color/core/scale.d.ts.map +1 -0
- package/lib/color/core/scale.js +96 -0
- package/lib/color/core/scale.js.map +1 -0
- package/lib/color/ui/ColorScaleLegend.d.ts +38 -0
- package/lib/color/ui/ColorScaleLegend.d.ts.map +1 -0
- package/lib/color/ui/ColorScaleLegend.js +68 -0
- package/lib/color/ui/ColorScaleLegend.js.map +1 -0
- package/lib/color/ui/index.d.ts +3 -0
- package/lib/color/ui/index.d.ts.map +1 -0
- package/lib/color/ui/index.js +2 -0
- package/lib/color/ui/index.js.map +1 -0
- package/lib/core.d.ts +11 -0
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +11 -0
- package/lib/core.js.map +1 -1
- package/lib/credits/core/credits.d.ts +144 -0
- package/lib/credits/core/credits.d.ts.map +1 -0
- package/lib/credits/core/credits.js +156 -0
- package/lib/credits/core/credits.js.map +1 -0
- package/lib/credits/core/index.d.ts +3 -0
- package/lib/credits/core/index.d.ts.map +1 -0
- package/lib/credits/core/index.js +2 -0
- package/lib/credits/core/index.js.map +1 -0
- package/lib/credits/ui/CreditsList.d.ts +29 -0
- package/lib/credits/ui/CreditsList.d.ts.map +1 -0
- package/lib/credits/ui/CreditsList.js +33 -0
- package/lib/credits/ui/CreditsList.js.map +1 -0
- package/lib/credits/ui/index.d.ts +3 -0
- package/lib/credits/ui/index.d.ts.map +1 -0
- package/lib/credits/ui/index.js +2 -0
- package/lib/credits/ui/index.js.map +1 -0
- package/lib/delimited/core/delimiters.d.ts +31 -0
- package/lib/delimited/core/delimiters.d.ts.map +1 -0
- package/lib/delimited/core/delimiters.js +46 -0
- package/lib/delimited/core/delimiters.js.map +1 -0
- package/lib/delimited/core/index.d.ts +9 -0
- package/lib/delimited/core/index.d.ts.map +1 -0
- package/lib/delimited/core/index.js +5 -0
- package/lib/delimited/core/index.js.map +1 -0
- package/lib/delimited/core/readDelimited.d.ts +32 -0
- package/lib/delimited/core/readDelimited.d.ts.map +1 -0
- package/lib/delimited/core/readDelimited.js +122 -0
- package/lib/delimited/core/readDelimited.js.map +1 -0
- package/lib/delimited/core/rowsToDelimited.d.ts +59 -0
- package/lib/delimited/core/rowsToDelimited.d.ts.map +1 -0
- package/lib/delimited/core/rowsToDelimited.js +87 -0
- package/lib/delimited/core/rowsToDelimited.js.map +1 -0
- package/lib/delimited/core/toDelimited.d.ts +38 -0
- package/lib/delimited/core/toDelimited.d.ts.map +1 -0
- package/lib/delimited/core/toDelimited.js +45 -0
- package/lib/delimited/core/toDelimited.js.map +1 -0
- package/lib/delimited/ui/DelimitedTextDialog.d.ts +22 -0
- package/lib/delimited/ui/DelimitedTextDialog.d.ts.map +1 -0
- package/lib/delimited/ui/DelimitedTextDialog.js +17 -0
- package/lib/delimited/ui/DelimitedTextDialog.js.map +1 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts +56 -0
- package/lib/delimited/ui/DelimitedTextPanel.d.ts.map +1 -0
- package/lib/delimited/ui/DelimitedTextPanel.js +55 -0
- package/lib/delimited/ui/DelimitedTextPanel.js.map +1 -0
- package/lib/delimited/ui/index.d.ts +5 -0
- package/lib/delimited/ui/index.d.ts.map +1 -0
- package/lib/delimited/ui/index.js +3 -0
- package/lib/delimited/ui/index.js.map +1 -0
- package/lib/disclosure/ui/CollapsibleSection.d.ts +57 -0
- package/lib/disclosure/ui/CollapsibleSection.d.ts.map +1 -0
- package/lib/disclosure/ui/CollapsibleSection.js +60 -0
- package/lib/disclosure/ui/CollapsibleSection.js.map +1 -0
- package/lib/disclosure/ui/index.d.ts +5 -0
- package/lib/disclosure/ui/index.d.ts.map +1 -0
- package/lib/disclosure/ui/index.js +3 -0
- package/lib/disclosure/ui/index.js.map +1 -0
- package/lib/disclosure/ui/useDisclosure.d.ts +22 -0
- package/lib/disclosure/ui/useDisclosure.d.ts.map +1 -0
- package/lib/disclosure/ui/useDisclosure.js +18 -0
- package/lib/disclosure/ui/useDisclosure.js.map +1 -0
- package/lib/download/core/downloadBlob.d.ts +10 -0
- package/lib/download/core/downloadBlob.d.ts.map +1 -0
- package/lib/download/core/downloadBlob.js +20 -0
- package/lib/download/core/downloadBlob.js.map +1 -0
- package/lib/download/core/downloadText.d.ts +9 -0
- package/lib/download/core/downloadText.d.ts.map +1 -0
- package/lib/download/core/downloadText.js +14 -0
- package/lib/download/core/downloadText.js.map +1 -0
- package/lib/download/core/index.d.ts +4 -0
- package/lib/download/core/index.d.ts.map +1 -0
- package/lib/download/core/index.js +4 -0
- package/lib/download/core/index.js.map +1 -0
- package/lib/download/core/sanitizeFileName.d.ts +15 -0
- package/lib/download/core/sanitizeFileName.d.ts.map +1 -0
- package/lib/download/core/sanitizeFileName.js +33 -0
- package/lib/download/core/sanitizeFileName.js.map +1 -0
- package/lib/ecosystem/core/index.d.ts +3 -0
- package/lib/ecosystem/core/index.d.ts.map +1 -1
- package/lib/ecosystem/core/index.js +3 -0
- package/lib/ecosystem/core/index.js.map +1 -1
- package/lib/ecosystem/core/links.d.ts +11 -0
- package/lib/ecosystem/core/links.d.ts.map +1 -0
- package/lib/ecosystem/core/links.js +28 -0
- package/lib/ecosystem/core/links.js.map +1 -0
- package/lib/ecosystem/core/lookup.d.ts +21 -0
- package/lib/ecosystem/core/lookup.d.ts.map +1 -0
- package/lib/ecosystem/core/lookup.js +40 -0
- package/lib/ecosystem/core/lookup.js.map +1 -0
- package/lib/ecosystem/core/sites.d.ts +2 -0
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +15 -0
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/tokens.d.ts +21 -0
- package/lib/ecosystem/core/tokens.d.ts.map +1 -0
- package/lib/ecosystem/core/tokens.js +42 -0
- package/lib/ecosystem/core/tokens.js.map +1 -0
- package/lib/ecosystem/ui/SiteTheme.d.ts +18 -0
- package/lib/ecosystem/ui/SiteTheme.d.ts.map +1 -0
- package/lib/ecosystem/ui/SiteTheme.js +16 -0
- package/lib/ecosystem/ui/SiteTheme.js.map +1 -0
- package/lib/ecosystem/ui/Wordmark.d.ts +30 -0
- package/lib/ecosystem/ui/Wordmark.d.ts.map +1 -0
- package/lib/ecosystem/ui/Wordmark.js +26 -0
- package/lib/ecosystem/ui/Wordmark.js.map +1 -0
- package/lib/ecosystem/ui/index.d.ts +4 -0
- package/lib/ecosystem/ui/index.d.ts.map +1 -1
- package/lib/ecosystem/ui/index.js +2 -0
- package/lib/ecosystem/ui/index.js.map +1 -1
- package/lib/ecosystem/ui/marks.d.ts +30 -4
- package/lib/ecosystem/ui/marks.d.ts.map +1 -1
- package/lib/ecosystem/ui/marks.js +13 -3
- package/lib/ecosystem/ui/marks.js.map +1 -1
- package/lib/error/ui/ErrorBoundary.d.ts +60 -0
- package/lib/error/ui/ErrorBoundary.d.ts.map +1 -0
- package/lib/error/ui/ErrorBoundary.js +59 -0
- package/lib/error/ui/ErrorBoundary.js.map +1 -0
- package/lib/error/ui/ErrorFallback.d.ts +38 -0
- package/lib/error/ui/ErrorFallback.d.ts.map +1 -0
- package/lib/error/ui/ErrorFallback.js +16 -0
- package/lib/error/ui/ErrorFallback.js.map +1 -0
- package/lib/error/ui/index.d.ts +5 -0
- package/lib/error/ui/index.d.ts.map +1 -0
- package/lib/error/ui/index.js +3 -0
- package/lib/error/ui/index.js.map +1 -0
- package/lib/error/ui/toError.d.ts +11 -0
- package/lib/error/ui/toError.d.ts.map +1 -0
- package/lib/error/ui/toError.js +35 -0
- package/lib/error/ui/toError.js.map +1 -0
- package/lib/format/core/index.d.ts +5 -0
- package/lib/format/core/index.d.ts.map +1 -0
- package/lib/format/core/index.js +5 -0
- package/lib/format/core/index.js.map +1 -0
- package/lib/format/core/missing.d.ts +7 -0
- package/lib/format/core/missing.d.ts.map +1 -0
- package/lib/format/core/missing.js +7 -0
- package/lib/format/core/missing.js.map +1 -0
- package/lib/format/core/numbers.d.ts +40 -0
- package/lib/format/core/numbers.d.ts.map +1 -0
- package/lib/format/core/numbers.js +81 -0
- package/lib/format/core/numbers.js.map +1 -0
- package/lib/format/core/units.d.ts +17 -0
- package/lib/format/core/units.d.ts.map +1 -0
- package/lib/format/core/units.js +54 -0
- package/lib/format/core/units.js.map +1 -0
- package/lib/format/core/words.d.ts +12 -0
- package/lib/format/core/words.d.ts.map +1 -0
- package/lib/format/core/words.js +14 -0
- package/lib/format/core/words.js.map +1 -0
- package/lib/help/ui/HelpBody.d.ts +57 -0
- package/lib/help/ui/HelpBody.d.ts.map +1 -0
- package/lib/help/ui/HelpBody.js +44 -0
- package/lib/help/ui/HelpBody.js.map +1 -0
- package/lib/help/ui/HelpIcon.d.ts +33 -0
- package/lib/help/ui/HelpIcon.d.ts.map +1 -0
- package/lib/help/ui/HelpIcon.js +16 -0
- package/lib/help/ui/HelpIcon.js.map +1 -0
- package/lib/help/ui/HelpToolbarButton.d.ts +45 -0
- package/lib/help/ui/HelpToolbarButton.d.ts.map +1 -0
- package/lib/help/ui/HelpToolbarButton.js +17 -0
- package/lib/help/ui/HelpToolbarButton.js.map +1 -0
- package/lib/help/ui/HelpTooltip.d.ts +36 -0
- package/lib/help/ui/HelpTooltip.d.ts.map +1 -0
- package/lib/help/ui/HelpTooltip.js +24 -0
- package/lib/help/ui/HelpTooltip.js.map +1 -0
- package/lib/help/ui/index.d.ts +9 -0
- package/lib/help/ui/index.d.ts.map +1 -0
- package/lib/help/ui/index.js +5 -0
- package/lib/help/ui/index.js.map +1 -0
- package/lib/hooks/ui/index.d.ts +7 -0
- package/lib/hooks/ui/index.d.ts.map +1 -0
- package/lib/hooks/ui/index.js +5 -0
- package/lib/hooks/ui/index.js.map +1 -0
- package/lib/hooks/ui/listNavigation.d.ts +54 -0
- package/lib/hooks/ui/listNavigation.d.ts.map +1 -0
- package/lib/hooks/ui/listNavigation.js +77 -0
- package/lib/hooks/ui/listNavigation.js.map +1 -0
- package/lib/hooks/ui/useContainerSize.d.ts +15 -0
- package/lib/hooks/ui/useContainerSize.d.ts.map +1 -0
- package/lib/hooks/ui/useContainerSize.js +24 -0
- package/lib/hooks/ui/useContainerSize.js.map +1 -0
- package/lib/hooks/ui/useDebouncedValue.d.ts +12 -0
- package/lib/hooks/ui/useDebouncedValue.d.ts.map +1 -0
- package/lib/hooks/ui/useDebouncedValue.js +24 -0
- package/lib/hooks/ui/useDebouncedValue.js.map +1 -0
- package/lib/hooks/ui/useListKeyboardNavigation.d.ts +17 -0
- package/lib/hooks/ui/useListKeyboardNavigation.d.ts.map +1 -0
- package/lib/hooks/ui/useListKeyboardNavigation.js +25 -0
- package/lib/hooks/ui/useListKeyboardNavigation.js.map +1 -0
- package/lib/hooks/ui/useResizeObserver.d.ts +20 -0
- package/lib/hooks/ui/useResizeObserver.d.ts.map +1 -0
- package/lib/hooks/ui/useResizeObserver.js +37 -0
- package/lib/hooks/ui/useResizeObserver.js.map +1 -0
- package/lib/orbital/core/atomicGrid.d.ts +27 -0
- package/lib/orbital/core/atomicGrid.d.ts.map +1 -1
- package/lib/orbital/core/atomicGrid.js +37 -1
- package/lib/orbital/core/atomicGrid.js.map +1 -1
- package/lib/orbital/core/index.d.ts +9 -7
- package/lib/orbital/core/index.d.ts.map +1 -1
- package/lib/orbital/core/index.js +7 -6
- package/lib/orbital/core/index.js.map +1 -1
- package/lib/orbital/core/isovalue.d.ts +60 -0
- package/lib/orbital/core/isovalue.d.ts.map +1 -0
- package/lib/orbital/core/isovalue.js +128 -0
- package/lib/orbital/core/isovalue.js.map +1 -0
- package/lib/orbital/core/sample.d.ts +15 -1
- package/lib/orbital/core/sample.d.ts.map +1 -1
- package/lib/orbital/core/sample.js +10 -3
- package/lib/orbital/core/sample.js.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts +6 -1
- package/lib/orbital/ui/AtomicOrbitalCanvas.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalCanvas.js +12 -2
- package/lib/orbital/ui/AtomicOrbitalCanvas.js.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.d.ts +5 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.d.ts.map +1 -1
- package/lib/orbital/ui/AtomicOrbitalViewer.js.map +1 -1
- package/lib/orbital/ui/renderVolume.d.ts +6 -3
- package/lib/orbital/ui/renderVolume.d.ts.map +1 -1
- package/lib/orbital/ui/renderVolume.js +14 -15
- package/lib/orbital/ui/renderVolume.js.map +1 -1
- package/lib/orbital/ui/viewer.d.ts +3 -1
- package/lib/orbital/ui/viewer.d.ts.map +1 -1
- package/lib/orbital/ui/viewer.js +3 -2
- package/lib/orbital/ui/viewer.js.map +1 -1
- package/lib/orbital/ui/volumeField.d.ts +5 -21
- package/lib/orbital/ui/volumeField.d.ts.map +1 -1
- package/lib/orbital/ui/volumeField.js +5 -45
- package/lib/orbital/ui/volumeField.js.map +1 -1
- package/lib/pedagogy/core/glossary.d.ts +79 -0
- package/lib/pedagogy/core/glossary.d.ts.map +1 -0
- package/lib/pedagogy/core/glossary.js +71 -0
- package/lib/pedagogy/core/glossary.js.map +1 -0
- package/lib/pedagogy/core/index.d.ts +8 -0
- package/lib/pedagogy/core/index.d.ts.map +1 -0
- package/lib/pedagogy/core/index.js +4 -0
- package/lib/pedagogy/core/index.js.map +1 -0
- package/lib/pedagogy/core/jsonStorage.d.ts +21 -0
- package/lib/pedagogy/core/jsonStorage.d.ts.map +1 -0
- package/lib/pedagogy/core/jsonStorage.js +55 -0
- package/lib/pedagogy/core/jsonStorage.js.map +1 -0
- package/lib/pedagogy/core/progress.d.ts +116 -0
- package/lib/pedagogy/core/progress.d.ts.map +1 -0
- package/lib/pedagogy/core/progress.js +122 -0
- package/lib/pedagogy/core/progress.js.map +1 -0
- package/lib/pedagogy/core/types.d.ts +74 -0
- package/lib/pedagogy/core/types.d.ts.map +1 -0
- package/lib/pedagogy/core/types.js +8 -0
- package/lib/pedagogy/core/types.js.map +1 -0
- package/lib/pedagogy/core/validation.d.ts +79 -0
- package/lib/pedagogy/core/validation.d.ts.map +1 -0
- package/lib/pedagogy/core/validation.js +47 -0
- package/lib/pedagogy/core/validation.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseActions.d.ts +74 -0
- package/lib/pedagogy/ui/ExerciseActions.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseActions.js +22 -0
- package/lib/pedagogy/ui/ExerciseActions.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseProgressHeader.d.ts +43 -0
- package/lib/pedagogy/ui/ExerciseProgressHeader.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseProgressHeader.js +43 -0
- package/lib/pedagogy/ui/ExerciseProgressHeader.js.map +1 -0
- package/lib/pedagogy/ui/ExerciseTags.d.ts +49 -0
- package/lib/pedagogy/ui/ExerciseTags.d.ts.map +1 -0
- package/lib/pedagogy/ui/ExerciseTags.js +22 -0
- package/lib/pedagogy/ui/ExerciseTags.js.map +1 -0
- package/lib/pedagogy/ui/GlossaryProvider.d.ts +19 -0
- package/lib/pedagogy/ui/GlossaryProvider.d.ts.map +1 -0
- package/lib/pedagogy/ui/GlossaryProvider.js +16 -0
- package/lib/pedagogy/ui/GlossaryProvider.js.map +1 -0
- package/lib/pedagogy/ui/GlossaryText.d.ts +50 -0
- package/lib/pedagogy/ui/GlossaryText.d.ts.map +1 -0
- package/lib/pedagogy/ui/GlossaryText.js +79 -0
- package/lib/pedagogy/ui/GlossaryText.js.map +1 -0
- package/lib/pedagogy/ui/HintLadder.d.ts +38 -0
- package/lib/pedagogy/ui/HintLadder.d.ts.map +1 -0
- package/lib/pedagogy/ui/HintLadder.js +33 -0
- package/lib/pedagogy/ui/HintLadder.js.map +1 -0
- package/lib/pedagogy/ui/ReferenceGrid.d.ts +31 -0
- package/lib/pedagogy/ui/ReferenceGrid.d.ts.map +1 -0
- package/lib/pedagogy/ui/ReferenceGrid.js +25 -0
- package/lib/pedagogy/ui/ReferenceGrid.js.map +1 -0
- package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts +64 -0
- package/lib/pedagogy/ui/ReferenceSectionBlock.d.ts.map +1 -0
- package/lib/pedagogy/ui/ReferenceSectionBlock.js +78 -0
- package/lib/pedagogy/ui/ReferenceSectionBlock.js.map +1 -0
- package/lib/pedagogy/ui/SyntaxTooltip.d.ts +94 -0
- package/lib/pedagogy/ui/SyntaxTooltip.d.ts.map +1 -0
- package/lib/pedagogy/ui/SyntaxTooltip.js +79 -0
- package/lib/pedagogy/ui/SyntaxTooltip.js.map +1 -0
- package/lib/pedagogy/ui/TestCaseList.d.ts +35 -0
- package/lib/pedagogy/ui/TestCaseList.d.ts.map +1 -0
- package/lib/pedagogy/ui/TestCaseList.js +63 -0
- package/lib/pedagogy/ui/TestCaseList.js.map +1 -0
- package/lib/pedagogy/ui/TutorialStepStrip.d.ts +42 -0
- package/lib/pedagogy/ui/TutorialStepStrip.d.ts.map +1 -0
- package/lib/pedagogy/ui/TutorialStepStrip.js +98 -0
- package/lib/pedagogy/ui/TutorialStepStrip.js.map +1 -0
- package/lib/pedagogy/ui/exerciseMeta.d.ts +24 -0
- package/lib/pedagogy/ui/exerciseMeta.d.ts.map +1 -0
- package/lib/pedagogy/ui/exerciseMeta.js +38 -0
- package/lib/pedagogy/ui/exerciseMeta.js.map +1 -0
- package/lib/pedagogy/ui/glossaryContext.d.ts +17 -0
- package/lib/pedagogy/ui/glossaryContext.d.ts.map +1 -0
- package/lib/pedagogy/ui/glossaryContext.js +19 -0
- package/lib/pedagogy/ui/glossaryContext.js.map +1 -0
- package/lib/pedagogy/ui/index.d.ts +27 -0
- package/lib/pedagogy/ui/index.d.ts.map +1 -0
- package/lib/pedagogy/ui/index.js +15 -0
- package/lib/pedagogy/ui/index.js.map +1 -0
- package/lib/pedagogy/ui/tutorialLevels.d.ts +18 -0
- package/lib/pedagogy/ui/tutorialLevels.d.ts.map +1 -0
- package/lib/pedagogy/ui/tutorialLevels.js +14 -0
- package/lib/pedagogy/ui/tutorialLevels.js.map +1 -0
- package/lib/router/core/address.d.ts +42 -0
- package/lib/router/core/address.d.ts.map +1 -0
- package/lib/router/core/address.js +64 -0
- package/lib/router/core/address.js.map +1 -0
- package/lib/router/core/basePath.d.ts +49 -0
- package/lib/router/core/basePath.d.ts.map +1 -0
- package/lib/router/core/basePath.js +78 -0
- package/lib/router/core/basePath.js.map +1 -0
- package/lib/router/core/index.d.ts +8 -0
- package/lib/router/core/index.d.ts.map +1 -0
- package/lib/router/core/index.js +5 -0
- package/lib/router/core/index.js.map +1 -0
- package/lib/router/core/legacyHash.d.ts +45 -0
- package/lib/router/core/legacyHash.d.ts.map +1 -0
- package/lib/router/core/legacyHash.js +50 -0
- package/lib/router/core/legacyHash.js.map +1 -0
- package/lib/router/core/pageAddresses.d.ts +50 -0
- package/lib/router/core/pageAddresses.d.ts.map +1 -0
- package/lib/router/core/pageAddresses.js +56 -0
- package/lib/router/core/pageAddresses.js.map +1 -0
- package/lib/router/core/query.d.ts +41 -0
- package/lib/router/core/query.d.ts.map +1 -0
- package/lib/router/core/query.js +64 -0
- package/lib/router/core/query.js.map +1 -0
- package/lib/router/core/tabRouter.d.ts +111 -0
- package/lib/router/core/tabRouter.d.ts.map +1 -0
- package/lib/router/core/tabRouter.js +87 -0
- package/lib/router/core/tabRouter.js.map +1 -0
- package/lib/seo/core/documentMeta.d.ts +45 -0
- package/lib/seo/core/documentMeta.d.ts.map +1 -0
- package/lib/seo/core/documentMeta.js +69 -0
- package/lib/seo/core/documentMeta.js.map +1 -0
- package/lib/seo/core/index.d.ts +3 -0
- package/lib/seo/core/index.d.ts.map +1 -0
- package/lib/seo/core/index.js +2 -0
- package/lib/seo/core/index.js.map +1 -0
- package/lib/share/core/config.d.ts +63 -0
- package/lib/share/core/config.d.ts.map +1 -0
- package/lib/share/core/config.js +125 -0
- package/lib/share/core/config.js.map +1 -0
- package/lib/share/core/escape.d.ts +15 -0
- package/lib/share/core/escape.d.ts.map +1 -0
- package/lib/share/core/escape.js +22 -0
- package/lib/share/core/escape.js.map +1 -0
- package/lib/share/core/index.d.ts +9 -0
- package/lib/share/core/index.d.ts.map +1 -0
- package/lib/share/core/index.js +5 -0
- package/lib/share/core/index.js.map +1 -0
- package/lib/share/core/params.d.ts +93 -0
- package/lib/share/core/params.d.ts.map +1 -0
- package/lib/share/core/params.js +111 -0
- package/lib/share/core/params.js.map +1 -0
- package/lib/share/core/query.d.ts +30 -0
- package/lib/share/core/query.d.ts.map +1 -0
- package/lib/share/core/query.js +68 -0
- package/lib/share/core/query.js.map +1 -0
- package/lib/share/core/url.d.ts +57 -0
- package/lib/share/core/url.d.ts.map +1 -0
- package/lib/share/core/url.js +49 -0
- package/lib/share/core/url.js.map +1 -0
- package/lib/share/core/vocabulary.d.ts +51 -0
- package/lib/share/core/vocabulary.d.ts.map +1 -0
- package/lib/share/core/vocabulary.js +2 -0
- package/lib/share/core/vocabulary.js.map +1 -0
- package/lib/share/ui/HiddenPartsProvider.d.ts +19 -0
- package/lib/share/ui/HiddenPartsProvider.d.ts.map +1 -0
- package/lib/share/ui/HiddenPartsProvider.js +15 -0
- package/lib/share/ui/HiddenPartsProvider.js.map +1 -0
- package/lib/share/ui/PagePart.d.ts +18 -0
- package/lib/share/ui/PagePart.d.ts.map +1 -0
- package/lib/share/ui/PagePart.js +16 -0
- package/lib/share/ui/PagePart.js.map +1 -0
- package/lib/share/ui/ShareButton.d.ts +42 -0
- package/lib/share/ui/ShareButton.d.ts.map +1 -0
- package/lib/share/ui/ShareButton.js +18 -0
- package/lib/share/ui/ShareButton.js.map +1 -0
- package/lib/share/ui/ShareDialog.d.ts +73 -0
- package/lib/share/ui/ShareDialog.d.ts.map +1 -0
- package/lib/share/ui/ShareDialog.js +19 -0
- package/lib/share/ui/ShareDialog.js.map +1 -0
- package/lib/share/ui/ShareDialogContent.d.ts +13 -0
- package/lib/share/ui/ShareDialogContent.d.ts.map +1 -0
- package/lib/share/ui/ShareDialogContent.js +71 -0
- package/lib/share/ui/ShareDialogContent.js.map +1 -0
- package/lib/share/ui/SharePartOptions.d.ts +18 -0
- package/lib/share/ui/SharePartOptions.d.ts.map +1 -0
- package/lib/share/ui/SharePartOptions.js +22 -0
- package/lib/share/ui/SharePartOptions.js.map +1 -0
- package/lib/share/ui/draft.d.ts +13 -0
- package/lib/share/ui/draft.d.ts.map +1 -0
- package/lib/share/ui/draft.js +16 -0
- package/lib/share/ui/draft.js.map +1 -0
- package/lib/share/ui/hiddenParts.d.ts +17 -0
- package/lib/share/ui/hiddenParts.d.ts.map +1 -0
- package/lib/share/ui/hiddenParts.js +21 -0
- package/lib/share/ui/hiddenParts.js.map +1 -0
- package/lib/share/ui/index.d.ts +10 -0
- package/lib/share/ui/index.d.ts.map +1 -0
- package/lib/share/ui/index.js +6 -0
- package/lib/share/ui/index.js.map +1 -0
- package/lib/shared/ui/index.d.ts +2 -1
- package/lib/shared/ui/index.d.ts.map +1 -1
- package/lib/shared/ui/index.js +1 -1
- package/lib/shared/ui/index.js.map +1 -1
- package/lib/state/ui/index.d.ts +3 -0
- package/lib/state/ui/index.d.ts.map +1 -0
- package/lib/state/ui/index.js +2 -0
- package/lib/state/ui/index.js.map +1 -0
- package/lib/state/ui/mergeStored.d.ts +27 -0
- package/lib/state/ui/mergeStored.d.ts.map +1 -0
- package/lib/state/ui/mergeStored.js +82 -0
- package/lib/state/ui/mergeStored.js.map +1 -0
- package/lib/state/ui/persistBucket.d.ts +65 -0
- package/lib/state/ui/persistBucket.d.ts.map +1 -0
- package/lib/state/ui/persistBucket.js +90 -0
- package/lib/state/ui/persistBucket.js.map +1 -0
- package/lib/structure/core/editorValue.d.ts +69 -0
- package/lib/structure/core/editorValue.d.ts.map +1 -0
- package/lib/structure/core/editorValue.js +72 -0
- package/lib/structure/core/editorValue.js.map +1 -0
- package/lib/structure/core/fragmentQuery.d.ts +33 -0
- package/lib/structure/core/fragmentQuery.d.ts.map +1 -0
- package/lib/structure/core/fragmentQuery.js +37 -0
- package/lib/structure/core/fragmentQuery.js.map +1 -0
- package/lib/structure/core/index.d.ts +11 -0
- package/lib/structure/core/index.d.ts.map +1 -0
- package/lib/structure/core/index.js +6 -0
- package/lib/structure/core/index.js.map +1 -0
- package/lib/structure/core/molfile.d.ts +42 -0
- package/lib/structure/core/molfile.d.ts.map +1 -0
- package/lib/structure/core/molfile.js +74 -0
- package/lib/structure/core/molfile.js.map +1 -0
- package/lib/structure/core/readStructure.d.ts +37 -0
- package/lib/structure/core/readStructure.d.ts.map +1 -0
- package/lib/structure/core/readStructure.js +59 -0
- package/lib/structure/core/readStructure.js.map +1 -0
- package/lib/structure/core/structureSource.d.ts +34 -0
- package/lib/structure/core/structureSource.d.ts.map +1 -0
- package/lib/structure/core/structureSource.js +32 -0
- package/lib/structure/core/structureSource.js.map +1 -0
- package/lib/structure/core/toolbarFloor.d.ts +16 -0
- package/lib/structure/core/toolbarFloor.d.ts.map +1 -0
- package/lib/structure/core/toolbarFloor.js +27 -0
- package/lib/structure/core/toolbarFloor.js.map +1 -0
- package/lib/structure/ui/EditorCanvas.d.ts +55 -0
- package/lib/structure/ui/EditorCanvas.d.ts.map +1 -0
- package/lib/structure/ui/EditorCanvas.js +41 -0
- package/lib/structure/ui/EditorCanvas.js.map +1 -0
- package/lib/structure/ui/Structure.d.ts +122 -0
- package/lib/structure/ui/Structure.d.ts.map +1 -0
- package/lib/structure/ui/Structure.js +28 -0
- package/lib/structure/ui/Structure.js.map +1 -0
- package/lib/structure/ui/StructureEditor.d.ts +75 -0
- package/lib/structure/ui/StructureEditor.d.ts.map +1 -0
- package/lib/structure/ui/StructureEditor.js +83 -0
- package/lib/structure/ui/StructureEditor.js.map +1 -0
- package/lib/structure/ui/StructurePlaceholder.d.ts +29 -0
- package/lib/structure/ui/StructurePlaceholder.d.ts.map +1 -0
- package/lib/structure/ui/StructurePlaceholder.js +19 -0
- package/lib/structure/ui/StructurePlaceholder.js.map +1 -0
- package/lib/structure/ui/StructureSvg.d.ts +58 -0
- package/lib/structure/ui/StructureSvg.d.ts.map +1 -0
- package/lib/structure/ui/StructureSvg.js +33 -0
- package/lib/structure/ui/StructureSvg.js.map +1 -0
- package/lib/structure/ui/index.d.ts +19 -0
- package/lib/structure/ui/index.d.ts.map +1 -0
- package/lib/structure/ui/index.js +15 -0
- package/lib/structure/ui/index.js.map +1 -0
- package/lib/structure/ui/useToolbarFloor.d.ts +26 -0
- package/lib/structure/ui/useToolbarFloor.d.ts.map +1 -0
- package/lib/structure/ui/useToolbarFloor.js +70 -0
- package/lib/structure/ui/useToolbarFloor.js.map +1 -0
- package/lib/structure.d.ts +3 -0
- package/lib/structure.d.ts.map +1 -0
- package/lib/structure.js +3 -0
- package/lib/structure.js.map +1 -0
- package/lib/ui.d.ts +13 -0
- package/lib/ui.d.ts.map +1 -1
- package/lib/ui.js +13 -0
- package/lib/ui.js.map +1 -1
- package/lib/worker/core/errors.d.ts +15 -0
- package/lib/worker/core/errors.d.ts.map +1 -0
- package/lib/worker/core/errors.js +15 -0
- package/lib/worker/core/errors.js.map +1 -0
- package/lib/worker/core/index.d.ts +5 -0
- package/lib/worker/core/index.d.ts.map +1 -0
- package/lib/worker/core/index.js +3 -0
- package/lib/worker/core/index.js.map +1 -0
- package/lib/worker/core/messages.d.ts +48 -0
- package/lib/worker/core/messages.d.ts.map +1 -0
- package/lib/worker/core/messages.js +2 -0
- package/lib/worker/core/messages.js.map +1 -0
- package/lib/worker/core/workerChannel.d.ts +69 -0
- package/lib/worker/core/workerChannel.d.ts.map +1 -0
- package/lib/worker/core/workerChannel.js +121 -0
- package/lib/worker/core/workerChannel.js.map +1 -0
- package/package.json +18 -5
- package/src/capsule/ui/CapsuleFilter.tsx +119 -0
- package/src/capsule/ui/index.ts +2 -0
- package/src/chrome/ui/NavLink.tsx +88 -0
- package/src/chrome/ui/NavMenuButton.tsx +95 -0
- package/src/chrome/ui/SiteFooter.tsx +65 -0
- package/src/chrome/ui/SiteHeader.tsx +119 -0
- package/src/chrome/ui/index.ts +11 -0
- package/src/chrome/ui/navItem.ts +60 -0
- package/src/chrome/ui/useCompactHeader.ts +81 -0
- package/src/citation/core/clipboard.ts +27 -11
- package/src/citation/core/download.ts +25 -15
- package/src/citation/core/index.ts +8 -3
- package/src/citation/core/works.ts +81 -0
- package/src/citation/ui/CitationMenu.tsx +104 -89
- package/src/citation/ui/CitationPreview.tsx +18 -8
- package/src/citation/ui/CiteButton.tsx +24 -9
- package/src/citation/ui/CopyFormatEntries.tsx +84 -0
- package/src/citation/ui/WorkEntry.tsx +80 -0
- package/src/citation/ui/entries.tsx +18 -20
- package/src/citation/ui/index.ts +10 -2
- package/src/citation/ui/useCopyFeedback.ts +76 -0
- package/src/clipboard/core/index.ts +1 -0
- package/src/clipboard/core/writeToClipboard.ts +47 -0
- package/src/clipboard/ui/CodeBlock.tsx +110 -0
- package/src/clipboard/ui/CopyButton.tsx +111 -0
- package/src/clipboard/ui/index.ts +9 -0
- package/src/clipboard/ui/useCopyToClipboard.ts +57 -0
- package/src/color/core/contrast.ts +85 -0
- package/src/color/core/hex.ts +57 -0
- package/src/color/core/index.ts +4 -0
- package/src/color/core/scale.ts +132 -0
- package/src/color/ui/ColorScaleLegend.tsx +144 -0
- package/src/color/ui/index.ts +2 -0
- package/src/core.ts +11 -0
- package/src/credits/core/credits.ts +183 -0
- package/src/credits/core/index.ts +2 -0
- package/src/credits/ui/CreditsList.tsx +82 -0
- package/src/credits/ui/index.ts +2 -0
- package/src/delimited/core/delimiters.ts +64 -0
- package/src/delimited/core/index.ts +11 -0
- package/src/delimited/core/readDelimited.ts +132 -0
- package/src/delimited/core/rowsToDelimited.ts +135 -0
- package/src/delimited/core/toDelimited.ts +69 -0
- package/src/delimited/ui/DelimitedTextDialog.tsx +49 -0
- package/src/delimited/ui/DelimitedTextPanel.tsx +161 -0
- package/src/delimited/ui/index.ts +4 -0
- package/src/disclosure/ui/CollapsibleSection.tsx +150 -0
- package/src/disclosure/ui/index.ts +4 -0
- package/src/disclosure/ui/useDisclosure.ts +35 -0
- package/src/download/core/downloadBlob.ts +19 -0
- package/src/download/core/downloadText.ts +19 -0
- package/src/download/core/index.ts +3 -0
- package/src/download/core/sanitizeFileName.ts +33 -0
- package/src/ecosystem/core/index.ts +3 -0
- package/src/ecosystem/core/links.ts +29 -0
- package/src/ecosystem/core/lookup.ts +41 -0
- package/src/ecosystem/core/sites.ts +17 -0
- package/src/ecosystem/core/tokens.ts +47 -0
- package/src/ecosystem/ui/SiteTheme.tsx +23 -0
- package/src/ecosystem/ui/Wordmark.tsx +65 -0
- package/src/ecosystem/ui/index.ts +4 -0
- package/src/ecosystem/ui/marks.tsx +54 -15
- package/src/error/ui/ErrorBoundary.tsx +94 -0
- package/src/error/ui/ErrorFallback.tsx +64 -0
- package/src/error/ui/index.ts +4 -0
- package/src/error/ui/toError.ts +33 -0
- package/src/format/core/index.ts +9 -0
- package/src/format/core/missing.ts +6 -0
- package/src/format/core/numbers.ts +84 -0
- package/src/format/core/units.ts +60 -0
- package/src/format/core/words.ts +17 -0
- package/src/help/ui/HelpBody.tsx +130 -0
- package/src/help/ui/HelpIcon.tsx +53 -0
- package/src/help/ui/HelpToolbarButton.tsx +72 -0
- package/src/help/ui/HelpTooltip.tsx +72 -0
- package/src/help/ui/index.ts +8 -0
- package/src/hooks/ui/index.ts +6 -0
- package/src/hooks/ui/listNavigation.ts +116 -0
- package/src/hooks/ui/useContainerSize.ts +32 -0
- package/src/hooks/ui/useDebouncedValue.ts +29 -0
- package/src/hooks/ui/useListKeyboardNavigation.ts +37 -0
- package/src/hooks/ui/useResizeObserver.ts +50 -0
- package/src/orbital/core/atomicGrid.ts +53 -1
- package/src/orbital/core/index.ts +7 -16
- package/src/orbital/core/isovalue.ts +146 -0
- package/src/orbital/core/sample.ts +25 -5
- package/src/orbital/ui/AtomicOrbitalCanvas.tsx +19 -3
- package/src/orbital/ui/AtomicOrbitalViewer.tsx +5 -1
- package/src/orbital/ui/renderVolume.ts +29 -16
- package/src/orbital/ui/viewer.ts +6 -1
- package/src/orbital/ui/volumeField.ts +5 -49
- package/src/pedagogy/core/glossary.ts +122 -0
- package/src/pedagogy/core/index.ts +28 -0
- package/src/pedagogy/core/jsonStorage.ts +51 -0
- package/src/pedagogy/core/progress.ts +205 -0
- package/src/pedagogy/core/types.ts +78 -0
- package/src/pedagogy/core/validation.ts +109 -0
- package/src/pedagogy/ui/ExerciseActions.tsx +129 -0
- package/src/pedagogy/ui/ExerciseProgressHeader.tsx +135 -0
- package/src/pedagogy/ui/ExerciseTags.tsx +85 -0
- package/src/pedagogy/ui/GlossaryProvider.tsx +31 -0
- package/src/pedagogy/ui/GlossaryText.tsx +164 -0
- package/src/pedagogy/ui/HintLadder.tsx +95 -0
- package/src/pedagogy/ui/ReferenceGrid.tsx +69 -0
- package/src/pedagogy/ui/ReferenceSectionBlock.tsx +175 -0
- package/src/pedagogy/ui/SyntaxTooltip.tsx +222 -0
- package/src/pedagogy/ui/TestCaseList.tsx +122 -0
- package/src/pedagogy/ui/TutorialStepStrip.tsx +230 -0
- package/src/pedagogy/ui/exerciseMeta.ts +45 -0
- package/src/pedagogy/ui/glossaryContext.ts +23 -0
- package/src/pedagogy/ui/index.ts +37 -0
- package/src/pedagogy/ui/tutorialLevels.ts +27 -0
- package/src/router/core/address.ts +74 -0
- package/src/router/core/basePath.ts +76 -0
- package/src/router/core/index.ts +26 -0
- package/src/router/core/legacyHash.ts +77 -0
- package/src/router/core/pageAddresses.ts +106 -0
- package/src/router/core/query.ts +87 -0
- package/src/router/core/tabRouter.ts +214 -0
- package/src/seo/core/documentMeta.ts +92 -0
- package/src/seo/core/index.ts +6 -0
- package/src/share/core/config.ts +165 -0
- package/src/share/core/escape.ts +22 -0
- package/src/share/core/index.ts +31 -0
- package/src/share/core/params.ts +176 -0
- package/src/share/core/query.ts +72 -0
- package/src/share/core/url.ts +105 -0
- package/src/share/core/vocabulary.ts +60 -0
- package/src/share/ui/HiddenPartsProvider.tsx +34 -0
- package/src/share/ui/PagePart.tsx +26 -0
- package/src/share/ui/ShareButton.tsx +84 -0
- package/src/share/ui/ShareDialog.tsx +114 -0
- package/src/share/ui/ShareDialogContent.tsx +189 -0
- package/src/share/ui/SharePartOptions.tsx +51 -0
- package/src/share/ui/draft.ts +19 -0
- package/src/share/ui/hiddenParts.ts +22 -0
- package/src/share/ui/index.ts +9 -0
- package/src/shared/ui/index.ts +2 -1
- package/src/state/ui/index.ts +6 -0
- package/src/state/ui/mergeStored.ts +87 -0
- package/src/state/ui/persistBucket.ts +147 -0
- package/src/structure/core/editorValue.ts +116 -0
- package/src/structure/core/fragmentQuery.ts +50 -0
- package/src/structure/core/index.ts +13 -0
- package/src/structure/core/molfile.ts +90 -0
- package/src/structure/core/readStructure.ts +73 -0
- package/src/structure/core/structureSource.ts +57 -0
- package/src/structure/core/toolbarFloor.ts +31 -0
- package/src/structure/ui/EditorCanvas.tsx +130 -0
- package/src/structure/ui/Structure.tsx +183 -0
- package/src/structure/ui/StructureEditor.tsx +196 -0
- package/src/structure/ui/StructurePlaceholder.tsx +48 -0
- package/src/structure/ui/StructureSvg.tsx +110 -0
- package/src/structure/ui/index.ts +22 -0
- package/src/structure/ui/useToolbarFloor.ts +93 -0
- package/src/structure.ts +2 -0
- package/src/ui.ts +13 -0
- package/src/worker/core/errors.ts +15 -0
- package/src/worker/core/index.ts +8 -0
- package/src/worker/core/messages.ts +47 -0
- package/src/worker/core/workerChannel.ts +218 -0
- package/styles/chrome.css +223 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { looksLikeMolfile } from "./molfile.js";
|
|
2
|
+
/**
|
|
3
|
+
* Decide what a piece of text is, without parsing it.
|
|
4
|
+
*
|
|
5
|
+
* Nothing is asked of the user, because the answer is in the text: a molfile
|
|
6
|
+
* carries a version stamp and several lines, a query carries syntax that only
|
|
7
|
+
* exists in SMARTS, and whatever is left is a SMILES. Text that holds nothing
|
|
8
|
+
* is the third answer, so a field can tell "not typed yet" from "typed
|
|
9
|
+
* something wrong" and only complain about the second.
|
|
10
|
+
* @param text - The structure, as typed, pasted or dropped.
|
|
11
|
+
* @returns The notation and the text to read it with.
|
|
12
|
+
*/
|
|
13
|
+
export function readStructure(text) {
|
|
14
|
+
const trimmed = text.trim();
|
|
15
|
+
if (trimmed === '')
|
|
16
|
+
return { kind: 'empty', value: '' };
|
|
17
|
+
if (looksLikeMolfile(text))
|
|
18
|
+
return { kind: 'molfile', value: text };
|
|
19
|
+
if (looksLikeSmarts(trimmed))
|
|
20
|
+
return { kind: 'smarts', value: trimmed };
|
|
21
|
+
return { kind: 'smiles', value: trimmed };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Whether a line notation uses syntax that exists in SMARTS and not in SMILES.
|
|
25
|
+
*
|
|
26
|
+
* Only the inside of a bracket atom is inspected for the primitives, because
|
|
27
|
+
* `#` is a triple bond outside one and `D`, `X`, `R`, `v` and `h` are the
|
|
28
|
+
* start of real element symbols. `~`, `&`, `,`, `;`, `!` and `$(` are SMARTS
|
|
29
|
+
* anywhere they appear.
|
|
30
|
+
* @param text - The line notation, already trimmed.
|
|
31
|
+
* @returns True when it can only be a query.
|
|
32
|
+
*/
|
|
33
|
+
export function looksLikeSmarts(text) {
|
|
34
|
+
if (/[~&;,!]/.test(text) || text.includes('$('))
|
|
35
|
+
return true;
|
|
36
|
+
for (const match of text.matchAll(BRACKET_ATOM)) {
|
|
37
|
+
if (QUERY_PRIMITIVE.test(match.groups?.atom ?? ''))
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return BARE_WILDCARD.test(text.replaceAll(BRACKET_ATOM, ''));
|
|
41
|
+
}
|
|
42
|
+
const BRACKET_ATOM = /\[(?<atom>[^\]]*)\]/g;
|
|
43
|
+
/**
|
|
44
|
+
* `#6` (atomic number), `X3` / `D2` / `R1` / `r5` / `v4` / `h1` / `x2`
|
|
45
|
+
* (counts), and the `a` / `A` wildcards. A digit is required after the letter,
|
|
46
|
+
* so `[Xe]` and `[Rn]` stay elements. The wildcard is anchored to the start of
|
|
47
|
+
* the atom, after an optional isotope: unanchored it matches the `a` of
|
|
48
|
+
* `[Na+]`, and every bracketed element holding a lowercase a — Na, Ca, Ba, La,
|
|
49
|
+
* Ta — would then read as a query rather than as the atom it is.
|
|
50
|
+
*/
|
|
51
|
+
const QUERY_PRIMITIVE = /#\d|[DXRrvhx]\d|^\*|^\d*[aA](?![a-z])/;
|
|
52
|
+
/**
|
|
53
|
+
* Outside a bracket the wildcard has to stand on its own: a letter on either
|
|
54
|
+
* side and it is part of a word, not a pattern. Widening this to any `a` or
|
|
55
|
+
* `A` reads the header `CAS` as the three-atom SMARTS `C`,`A`,`S`, and a
|
|
56
|
+
* spreadsheet's header row stops being recognised as one.
|
|
57
|
+
*/
|
|
58
|
+
const BARE_WILDCARD = /(?:^|[^A-Za-z])[aA](?![a-z])/;
|
|
59
|
+
//# sourceMappingURL=readStructure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readStructure.js","sourceRoot":"","sources":["../../../src/structure/core/readStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAiBhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACxD,IAAI,gBAAgB,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACpE,IAAI,eAAe,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACxE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAChD,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IAClE,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,uCAAuC,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,aAAa,GAAG,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Every notation a read-only depiction may be handed. */
|
|
2
|
+
export interface StructureSourceInput {
|
|
3
|
+
/** A canonical openchemlib idCode, coordinates included or not. */
|
|
4
|
+
idCode?: string;
|
|
5
|
+
/** Encoded 2D coordinates, when they did not travel with the idCode. */
|
|
6
|
+
coordinates?: string;
|
|
7
|
+
/** A molfile, V2000 or V3000. */
|
|
8
|
+
molfile?: string;
|
|
9
|
+
/** A SMILES. */
|
|
10
|
+
smiles?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The one notation a depiction should be drawn from. */
|
|
13
|
+
export interface StructureSource {
|
|
14
|
+
/** Which notation was picked; `empty` when none of them holds a structure. */
|
|
15
|
+
kind: 'idcode' | 'molfile' | 'smiles' | 'empty';
|
|
16
|
+
/** The text to draw, empty when there is nothing to draw. */
|
|
17
|
+
value: string;
|
|
18
|
+
/** Encoded 2D coordinates, only ever set beside an idCode. */
|
|
19
|
+
coordinates?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Pick the notation a depiction is drawn from when several were supplied.
|
|
23
|
+
*
|
|
24
|
+
* The most exact one wins: an idCode says precisely which structure, a molfile
|
|
25
|
+
* additionally carries the layout its author chose, and a SMILES leaves the
|
|
26
|
+
* layout to be invented. A notation that describes nothing — a blank string, a
|
|
27
|
+
* molfile with an empty atom block, the idCode an erased canvas leaves behind
|
|
28
|
+
* — is skipped rather than drawn, which is what turns a broken box into the
|
|
29
|
+
* next best picture, or into an honest placeholder.
|
|
30
|
+
* @param input - Whatever notations the caller has.
|
|
31
|
+
* @returns The notation to draw, and the text to draw it from.
|
|
32
|
+
*/
|
|
33
|
+
export declare function structureSource(input: StructureSourceInput): StructureSource;
|
|
34
|
+
//# sourceMappingURL=structureSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structureSource.d.ts","sourceRoot":"","sources":["../../../src/structure/core/structureSource.ts"],"names":[],"mappings":"AAGA,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAChD,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAmB5E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isEmptyIdCode, splitIdCode } from "./editorValue.js";
|
|
2
|
+
import { molfileAtomCount } from "./molfile.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pick the notation a depiction is drawn from when several were supplied.
|
|
5
|
+
*
|
|
6
|
+
* The most exact one wins: an idCode says precisely which structure, a molfile
|
|
7
|
+
* additionally carries the layout its author chose, and a SMILES leaves the
|
|
8
|
+
* layout to be invented. A notation that describes nothing — a blank string, a
|
|
9
|
+
* molfile with an empty atom block, the idCode an erased canvas leaves behind
|
|
10
|
+
* — is skipped rather than drawn, which is what turns a broken box into the
|
|
11
|
+
* next best picture, or into an honest placeholder.
|
|
12
|
+
* @param input - Whatever notations the caller has.
|
|
13
|
+
* @returns The notation to draw, and the text to draw it from.
|
|
14
|
+
*/
|
|
15
|
+
export function structureSource(input) {
|
|
16
|
+
const { idCode, coordinates, molfile, smiles } = input;
|
|
17
|
+
if (idCode !== undefined && !isEmptyIdCode(idCode)) {
|
|
18
|
+
const split = splitIdCode(idCode);
|
|
19
|
+
const layout = split.coordinates ?? coordinates;
|
|
20
|
+
return layout === undefined || layout === ''
|
|
21
|
+
? { kind: 'idcode', value: split.idCode }
|
|
22
|
+
: { kind: 'idcode', value: split.idCode, coordinates: layout };
|
|
23
|
+
}
|
|
24
|
+
if (molfile !== undefined && molfileAtomCount(molfile) > 0) {
|
|
25
|
+
return { kind: 'molfile', value: molfile };
|
|
26
|
+
}
|
|
27
|
+
const line = smiles?.trim() ?? '';
|
|
28
|
+
if (line !== '')
|
|
29
|
+
return { kind: 'smiles', value: line };
|
|
30
|
+
return { kind: 'empty', value: '' };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=structureSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structureSource.js","sourceRoot":"","sources":["../../../src/structure/core/structureSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAwBhD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEvD,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,IAAI,WAAW,CAAC;QAChD,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE;YAC1C,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE;YACzC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IACnE,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAClC,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAExD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The two 1px borders of a container that sizes itself border-box. */
|
|
2
|
+
export declare const TOOLBAR_BORDERS = 2;
|
|
3
|
+
/**
|
|
4
|
+
* The smallest height a drawing editor's container may take.
|
|
5
|
+
*
|
|
6
|
+
* The editor's toolbar is a canvas of a fixed height, drawn from a sprite of a
|
|
7
|
+
* fixed number of buttons: a container any shorter than that does not scroll,
|
|
8
|
+
* it simply cuts the last buttons off. So the floor is whichever is taller,
|
|
9
|
+
* the height the caller asked for or the toolbar plus the borders around it.
|
|
10
|
+
* @param toolbarHeight - Height the toolbar was measured at, in pixels.
|
|
11
|
+
* @param minHeight - Smallest height the caller asked for, in pixels.
|
|
12
|
+
* @param borders - Borders the container adds around the toolbar, in pixels.
|
|
13
|
+
* @returns The height to give the container, in pixels.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toolbarFloorHeight(toolbarHeight: number, minHeight: number, borders?: number): number;
|
|
16
|
+
//# sourceMappingURL=toolbarFloor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarFloor.d.ts","sourceRoot":"","sources":["../../../src/structure/core/toolbarFloor.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAwB,GAChC,MAAM,CAOR"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The two 1px borders of a container that sizes itself border-box. */
|
|
2
|
+
export const TOOLBAR_BORDERS = 2;
|
|
3
|
+
/**
|
|
4
|
+
* The smallest height a drawing editor's container may take.
|
|
5
|
+
*
|
|
6
|
+
* The editor's toolbar is a canvas of a fixed height, drawn from a sprite of a
|
|
7
|
+
* fixed number of buttons: a container any shorter than that does not scroll,
|
|
8
|
+
* it simply cuts the last buttons off. So the floor is whichever is taller,
|
|
9
|
+
* the height the caller asked for or the toolbar plus the borders around it.
|
|
10
|
+
* @param toolbarHeight - Height the toolbar was measured at, in pixels.
|
|
11
|
+
* @param minHeight - Smallest height the caller asked for, in pixels.
|
|
12
|
+
* @param borders - Borders the container adds around the toolbar, in pixels.
|
|
13
|
+
* @returns The height to give the container, in pixels.
|
|
14
|
+
*/
|
|
15
|
+
export function toolbarFloorHeight(toolbarHeight, minHeight, borders = TOOLBAR_BORDERS) {
|
|
16
|
+
const asked = positive(minHeight);
|
|
17
|
+
const measured = positive(toolbarHeight);
|
|
18
|
+
// A toolbar with no layout yet measures zero, and a floor of two pixels of
|
|
19
|
+
// border would collapse the editor before it has had a chance to draw.
|
|
20
|
+
if (measured === 0)
|
|
21
|
+
return asked;
|
|
22
|
+
return Math.max(asked, measured + positive(borders));
|
|
23
|
+
}
|
|
24
|
+
function positive(value) {
|
|
25
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=toolbarFloor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarFloor.js","sourceRoot":"","sources":["../../../src/structure/core/toolbarFloor.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,aAAqB,EACrB,SAAiB,EACjB,UAAkB,eAAe;IAEjC,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACzC,2EAA2E;IAC3E,uEAAuE;IACvE,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CanvasEditorInputFormat } from 'react-ocl';
|
|
3
|
+
/** What the editor draws: one structure, or a reaction with its arrow. */
|
|
4
|
+
export type StructureEditorMode = 'molecule' | 'reaction';
|
|
5
|
+
/** Everything the editor holds at the moment it changed. */
|
|
6
|
+
export interface StructureEditorChange {
|
|
7
|
+
/** Which kind of editor produced it. */
|
|
8
|
+
mode: StructureEditorMode;
|
|
9
|
+
/**
|
|
10
|
+
* The idCode, with the coordinates the editor laid out written after a
|
|
11
|
+
* space. `splitIdCode` takes the two apart.
|
|
12
|
+
*/
|
|
13
|
+
idCode: string;
|
|
14
|
+
/** The V2000 molfile of a molecule, or the RXN file of a reaction. */
|
|
15
|
+
molfile: string;
|
|
16
|
+
/** The SMILES of a molecule, or the reaction SMILES. */
|
|
17
|
+
smiles: string;
|
|
18
|
+
}
|
|
19
|
+
export interface EditorCanvasProps {
|
|
20
|
+
/** Called on every stroke, with the editor read out synchronously. */
|
|
21
|
+
onChange: (change: StructureEditorChange) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Draw a query fragment rather than a whole structure, which is what a
|
|
24
|
+
* substructure filter needs.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
fragment?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* How `value` is written.
|
|
30
|
+
* @default 'idcode'
|
|
31
|
+
*/
|
|
32
|
+
inputFormat?: CanvasEditorInputFormat;
|
|
33
|
+
/**
|
|
34
|
+
* What the canvas holds when it appears. Read once, at mount: the editor is
|
|
35
|
+
* uncontrolled, so feeding a later value back would replace the structure
|
|
36
|
+
* and reset every coordinate under the pen.
|
|
37
|
+
* @default ''
|
|
38
|
+
*/
|
|
39
|
+
value?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the editor draws one structure or a reaction.
|
|
42
|
+
* @default 'molecule'
|
|
43
|
+
*/
|
|
44
|
+
mode?: StructureEditorMode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The react-ocl canvas, filling whatever box it is put in.
|
|
48
|
+
*
|
|
49
|
+
* Its value is frozen at mount, so the caller remounts it — by changing its
|
|
50
|
+
* `key` — to load a different structure into it.
|
|
51
|
+
* @param props - What to draw, how it is written, and where to send it.
|
|
52
|
+
* @returns The canvas.
|
|
53
|
+
*/
|
|
54
|
+
export declare function EditorCanvas(props: EditorCanvasProps): ReactElement;
|
|
55
|
+
//# sourceMappingURL=EditorCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorCanvas.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/EditorCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,WAAW,CAAC;AAGnB,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1D,4DAA4D;AAC5D,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA2DnE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { CanvasMoleculeEditor, CanvasReactionEditor } from 'react-ocl';
|
|
4
|
+
/**
|
|
5
|
+
* The react-ocl canvas, filling whatever box it is put in.
|
|
6
|
+
*
|
|
7
|
+
* Its value is frozen at mount, so the caller remounts it — by changing its
|
|
8
|
+
* `key` — to load a different structure into it.
|
|
9
|
+
* @param props - What to draw, how it is written, and where to send it.
|
|
10
|
+
* @returns The canvas.
|
|
11
|
+
*/
|
|
12
|
+
export function EditorCanvas(props) {
|
|
13
|
+
const { onChange, fragment = false, inputFormat = 'idcode', value = '', mode = 'molecule', } = props;
|
|
14
|
+
const [initialValue] = useState(value);
|
|
15
|
+
const handleMolecule = useCallback((event) => {
|
|
16
|
+
// The event describes the editor only while the callback runs, so every
|
|
17
|
+
// notation is read now and whatever waiting there is happens afterwards.
|
|
18
|
+
onChange({
|
|
19
|
+
mode: 'molecule',
|
|
20
|
+
idCode: event.getIdcode(),
|
|
21
|
+
molfile: event.getMolfile(),
|
|
22
|
+
smiles: event.getSmiles(),
|
|
23
|
+
});
|
|
24
|
+
}, [onChange]);
|
|
25
|
+
const handleReaction = useCallback((event) => {
|
|
26
|
+
onChange({
|
|
27
|
+
mode: 'reaction',
|
|
28
|
+
idCode: event.getIdcode(),
|
|
29
|
+
molfile: event.getRxn(),
|
|
30
|
+
smiles: event.getSmiles(),
|
|
31
|
+
});
|
|
32
|
+
}, [onChange]);
|
|
33
|
+
return (_jsx("div", { style: CANVAS_STYLE, children: mode === 'reaction' ? (_jsx(CanvasReactionEditor, { width: "100%", height: "100%", fragment: fragment, inputFormat: inputFormat, inputValue: initialValue, onChange: handleReaction })) : (_jsx(CanvasMoleculeEditor, { width: "100%", height: "100%", fragment: fragment, inputFormat: inputFormat, inputValue: initialValue, onChange: handleMolecule })) }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The canvas measures its container in pixels, so it is taken out of the
|
|
37
|
+
* height computation: otherwise the container and the canvas grow each other
|
|
38
|
+
* without ever settling.
|
|
39
|
+
*/
|
|
40
|
+
const CANVAS_STYLE = { position: 'absolute', inset: 0 };
|
|
41
|
+
//# sourceMappingURL=EditorCanvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorCanvas.js","sourceRoot":"","sources":["../../../src/structure/ui/EditorCanvas.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM9C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAgDvE;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EACJ,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,QAAQ,EACtB,KAAK,GAAG,EAAE,EACV,IAAI,GAAG,UAAU,GAClB,GAAG,KAAK,CAAC;IACV,MAAM,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAAmC,EAAE,EAAE;QACtC,wEAAwE;QACxE,yEAAyE;QACzE,QAAQ,CAAC;YACP,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE;YACzB,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE;YAC3B,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAAmC,EAAE,EAAE;QACtC,QAAQ,CAAC;YACP,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE;YACzB,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE;YACvB,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,cAAK,KAAK,EAAE,YAAY,YACrB,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CACrB,KAAC,oBAAoB,IACnB,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,cAAc,GACxB,CACH,CAAC,CAAC,CAAC,CACF,KAAC,oBAAoB,IACnB,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,cAAc,GACxB,CACH,GACG,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A read-only depiction of a structure, whichever notation the caller has.
|
|
3
|
+
*
|
|
4
|
+
* Which notation is drawn, and what is shown when there is nothing to draw, is
|
|
5
|
+
* decided here; the drawing itself sits behind `React.lazy`, so a page that
|
|
6
|
+
* never renders a structure never downloads react-ocl and openchemlib for one.
|
|
7
|
+
* That is also what lets `react-cheminfo/structure` be imported at all when
|
|
8
|
+
* those optional peers are not installed.
|
|
9
|
+
*/
|
|
10
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
11
|
+
/** What is written on a depiction besides the atoms and the bonds. */
|
|
12
|
+
export interface StructureLabels {
|
|
13
|
+
/**
|
|
14
|
+
* Write the index of every atom next to it.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
atoms?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Write the index of every bond next to it.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
bonds?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Write the reaction mapping number of every mapped atom.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
mapping?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* A caption drawn inside the picture, under the structure.
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
32
|
+
caption?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface StructureProps {
|
|
35
|
+
/**
|
|
36
|
+
* A canonical openchemlib idCode, coordinates included or not. The most
|
|
37
|
+
* exact notation, so it is drawn in preference to the others.
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
idCode?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Encoded 2D coordinates, when they did not travel with the idCode.
|
|
43
|
+
* @default undefined
|
|
44
|
+
*/
|
|
45
|
+
coordinates?: string;
|
|
46
|
+
/**
|
|
47
|
+
* A molfile, V2000 or V3000, drawn when there is no usable idCode.
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
50
|
+
molfile?: string;
|
|
51
|
+
/**
|
|
52
|
+
* A SMILES, drawn when there is neither an idCode nor a molfile. The layout
|
|
53
|
+
* is invented, so two depictions of the same molecule may differ.
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
smiles?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Width of the picture, in pixels.
|
|
59
|
+
* @default 200
|
|
60
|
+
*/
|
|
61
|
+
width?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Height of the picture, in pixels.
|
|
64
|
+
* @default 140
|
|
65
|
+
*/
|
|
66
|
+
height?: number;
|
|
67
|
+
/**
|
|
68
|
+
* What is written on the picture besides the structure itself.
|
|
69
|
+
* @default {}
|
|
70
|
+
*/
|
|
71
|
+
labels?: StructureLabels;
|
|
72
|
+
/**
|
|
73
|
+
* Crop the picture to the atoms rather than centring them in the box.
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
autoCrop?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Blank space kept around the structure when it is cropped, in pixels.
|
|
79
|
+
* @default 4
|
|
80
|
+
*/
|
|
81
|
+
autoCropMargin?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Atoms to paint, which is how a substructure match is shown.
|
|
84
|
+
* @default undefined
|
|
85
|
+
*/
|
|
86
|
+
atomHighlight?: number[];
|
|
87
|
+
/**
|
|
88
|
+
* The colour the highlighted atoms are painted.
|
|
89
|
+
* @default '#a5d8ff'
|
|
90
|
+
*/
|
|
91
|
+
atomHighlightColor?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Bonds to paint.
|
|
94
|
+
* @default undefined
|
|
95
|
+
*/
|
|
96
|
+
bondHighlight?: number[];
|
|
97
|
+
/**
|
|
98
|
+
* The colour the highlighted bonds are painted.
|
|
99
|
+
* @default '#ffd8a8'
|
|
100
|
+
*/
|
|
101
|
+
bondHighlightColor?: string;
|
|
102
|
+
/**
|
|
103
|
+
* What is shown when there is no structure, or when the one supplied cannot
|
|
104
|
+
* be read. An em dash rather than a red box: a missing structure is a row of
|
|
105
|
+
* a table far more often than it is a bug worth shouting about.
|
|
106
|
+
* @default '—'
|
|
107
|
+
*/
|
|
108
|
+
fallback?: ReactNode;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Draw a structure, from whichever notation the caller has.
|
|
112
|
+
*
|
|
113
|
+
* Nothing here throws and nothing renders a broken box: a blank value, a
|
|
114
|
+
* molfile with an empty atom block and a SMILES with a typo in it all come out
|
|
115
|
+
* as the same quiet placeholder, sized like the picture that would have been
|
|
116
|
+
* drawn so a list of structures keeps its rhythm. The box the renderers load
|
|
117
|
+
* into is that same placeholder, so nothing moves once they arrive.
|
|
118
|
+
* @param props - The structure, its size and what is written on it.
|
|
119
|
+
* @returns The picture, or the placeholder.
|
|
120
|
+
*/
|
|
121
|
+
export declare function Structure(props: StructureProps): ReactElement;
|
|
122
|
+
//# sourceMappingURL=Structure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Structure.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/Structure.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYrD,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAgD7D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, lazy } from 'react';
|
|
3
|
+
import { structureSource } from "../core/structureSource.js";
|
|
4
|
+
import { StructurePlaceholder } from "./StructurePlaceholder.js";
|
|
5
|
+
const StructureSvg = lazy(async () => {
|
|
6
|
+
const module = await import("./StructureSvg.js");
|
|
7
|
+
return { default: module.StructureSvg };
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Draw a structure, from whichever notation the caller has.
|
|
11
|
+
*
|
|
12
|
+
* Nothing here throws and nothing renders a broken box: a blank value, a
|
|
13
|
+
* molfile with an empty atom block and a SMILES with a typo in it all come out
|
|
14
|
+
* as the same quiet placeholder, sized like the picture that would have been
|
|
15
|
+
* drawn so a list of structures keeps its rhythm. The box the renderers load
|
|
16
|
+
* into is that same placeholder, so nothing moves once they arrive.
|
|
17
|
+
* @param props - The structure, its size and what is written on it.
|
|
18
|
+
* @returns The picture, or the placeholder.
|
|
19
|
+
*/
|
|
20
|
+
export function Structure(props) {
|
|
21
|
+
const { idCode, coordinates, molfile, smiles, width = 200, height = 140, labels = {}, autoCrop = true, autoCropMargin = 4, atomHighlight, atomHighlightColor = '#a5d8ff', bondHighlight, bondHighlightColor = '#ffd8a8', fallback = '—', } = props;
|
|
22
|
+
const source = structureSource({ idCode, coordinates, molfile, smiles });
|
|
23
|
+
if (source.kind === 'empty') {
|
|
24
|
+
return (_jsx(StructurePlaceholder, { width: width, height: height, children: fallback }));
|
|
25
|
+
}
|
|
26
|
+
return (_jsx(Suspense, { fallback: _jsx(StructurePlaceholder, { width: width, height: height }), children: _jsx(StructureSvg, { source: source, width: width, height: height, autoCrop: autoCrop, autoCropMargin: autoCropMargin, atomHighlight: atomHighlight, atomHighlightColor: atomHighlightColor, bondHighlight: bondHighlight, bondHighlightColor: bondHighlightColor, showAtomNumber: labels.atoms ?? false, showBondNumber: labels.bonds ?? false, showMapping: labels.mapping ?? false, label: labels.caption, fallback: fallback }) }));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=Structure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Structure.js","sourceRoot":"","sources":["../../../src/structure/ui/Structure.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA4B,CAAC;AAElE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;IACnC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,mBAAoB,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;AAC1C,CAAC,CAAC,CAAC;AAuGH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EACJ,MAAM,EACN,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,MAAM,GAAG,EAAE,EACX,QAAQ,GAAG,IAAI,EACf,cAAc,GAAG,CAAC,EAClB,aAAa,EACb,kBAAkB,GAAG,SAAS,EAC9B,aAAa,EACb,kBAAkB,GAAG,SAAS,EAC9B,QAAQ,GAAG,GAAG,GACf,GAAG,KAAK,CAAC;IAEV,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAEzE,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO,CACL,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAC/C,QAAQ,GACY,CACxB,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,QAAQ,IAAC,QAAQ,EAAE,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,YACxE,KAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK,EACrC,cAAc,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK,EACrC,WAAW,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK,EACpC,KAAK,EAAE,MAAM,CAAC,OAAO,EACrB,QAAQ,EAAE,QAAQ,GAClB,GACO,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canvas structure editor and the box it is drawn in.
|
|
3
|
+
*
|
|
4
|
+
* The canvas itself sits behind `React.lazy`: it is the half that imports
|
|
5
|
+
* react-ocl, so a page that never opens an editor never downloads openchemlib,
|
|
6
|
+
* and `react-cheminfo/structure` stays importable when those optional peers
|
|
7
|
+
* are absent.
|
|
8
|
+
*/
|
|
9
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
10
|
+
import type { CanvasEditorInputFormat } from 'react-ocl';
|
|
11
|
+
import type { StructureEditorChange, StructureEditorMode } from './EditorCanvas.tsx';
|
|
12
|
+
export interface StructureEditorProps {
|
|
13
|
+
/**
|
|
14
|
+
* Called after every edit, once the drawing has been still for `debounce`
|
|
15
|
+
* milliseconds, with every notation read out of the editor.
|
|
16
|
+
*/
|
|
17
|
+
onChange: (change: StructureEditorChange) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Draw a query fragment rather than a whole structure, which is what a
|
|
20
|
+
* substructure filter needs.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
fragment?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* How `value` is written.
|
|
26
|
+
* @default 'idcode'
|
|
27
|
+
*/
|
|
28
|
+
inputFormat?: CanvasEditorInputFormat;
|
|
29
|
+
/**
|
|
30
|
+
* What the canvas holds. Read once, when the editor appears and again on
|
|
31
|
+
* every change of `revision`: the editor is uncontrolled, so feeding the
|
|
32
|
+
* drawing back into it would replace the structure and reset every
|
|
33
|
+
* coordinate under the pen.
|
|
34
|
+
* @default ''
|
|
35
|
+
*/
|
|
36
|
+
value?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Bumped by the caller to load `value` into the canvas again, which is what
|
|
39
|
+
* an example, a share link or a Clear button does. Changing it discards
|
|
40
|
+
* whatever was being drawn.
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
revision?: number;
|
|
44
|
+
/**
|
|
45
|
+
* How long the drawing has to be still before `onChange` is called, in
|
|
46
|
+
* milliseconds. Long enough that drawing a ring does not publish six
|
|
47
|
+
* structures; `0` reports every stroke.
|
|
48
|
+
* @default 300
|
|
49
|
+
*/
|
|
50
|
+
debounce?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Smallest height of the drawing area, in pixels. Raised to whatever the
|
|
53
|
+
* toolbar needs, which is usually more.
|
|
54
|
+
* @default 320
|
|
55
|
+
*/
|
|
56
|
+
minHeight?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the editor draws one structure or a reaction. A reaction canvas
|
|
59
|
+
* has its own toolbar and its own arrow.
|
|
60
|
+
* @default 'molecule'
|
|
61
|
+
*/
|
|
62
|
+
mode?: StructureEditorMode;
|
|
63
|
+
/** Class the container carries, so a site can reach it from its stylesheet. */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Extra style for the container, merged over the packaged one. */
|
|
66
|
+
style?: CSSProperties;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The canvas structure editor, sized to fill its container and never to hide
|
|
70
|
+
* part of its toolbar.
|
|
71
|
+
* @param props - What to draw, when to reload it, and where to send it.
|
|
72
|
+
* @returns The editor.
|
|
73
|
+
*/
|
|
74
|
+
export declare function StructureEditor(props: StructureEditorProps): ReactElement;
|
|
75
|
+
//# sourceMappingURL=StructureEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureEditor.d.ts","sourceRoot":"","sources":["../../../src/structure/ui/StructureEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAQ5B,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAmCzE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, lazy, useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { useToolbarFloor } from "./useToolbarFloor.js";
|
|
4
|
+
const EditorCanvas = lazy(async () => {
|
|
5
|
+
const module = await import("./EditorCanvas.js");
|
|
6
|
+
return { default: module.EditorCanvas };
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* The canvas structure editor, sized to fill its container and never to hide
|
|
10
|
+
* part of its toolbar.
|
|
11
|
+
* @param props - What to draw, when to reload it, and where to send it.
|
|
12
|
+
* @returns The editor.
|
|
13
|
+
*/
|
|
14
|
+
export function StructureEditor(props) {
|
|
15
|
+
const { onChange, fragment = false, inputFormat = 'idcode', value = '', revision = 0, debounce = 300, minHeight = 320, mode = 'molecule', className, style, } = props;
|
|
16
|
+
const containerRef = useToolbarFloor({ minHeight, revision });
|
|
17
|
+
const handleChange = useDebounced(onChange, debounce, revision);
|
|
18
|
+
return (_jsx("div", { ref: containerRef, className: className, style: { ...ROOT_STYLE, minHeight, ...style }, children: _jsx(Suspense, { fallback: _jsx("div", { style: LOADING_STYLE, children: "Loading the editor\u2026" }), children: _jsx(EditorCanvas, { onChange: handleChange, fragment: fragment, inputFormat: inputFormat, value: value, mode: mode }, revision) }) }));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Report the last edit of a burst rather than every one of them.
|
|
22
|
+
*
|
|
23
|
+
* The editor's own event is read out before the wait starts, so what arrives
|
|
24
|
+
* late is a plain object rather than a handle on an editor that has moved on.
|
|
25
|
+
* @param onChange - What the caller wants told.
|
|
26
|
+
* @param delay - How long the drawing has to be still, in milliseconds.
|
|
27
|
+
* @param resetKey - Dropped edits: a burst still waiting when the caller
|
|
28
|
+
* replaces the structure describes a canvas that no longer exists.
|
|
29
|
+
* @returns The handler to give the canvas.
|
|
30
|
+
*/
|
|
31
|
+
function useDebounced(onChange, delay, resetKey) {
|
|
32
|
+
const timerRef = useRef(null);
|
|
33
|
+
const onChangeRef = useRef(onChange);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
onChangeRef.current = onChange;
|
|
36
|
+
});
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
return () => {
|
|
39
|
+
if (timerRef.current !== null) {
|
|
40
|
+
clearTimeout(timerRef.current);
|
|
41
|
+
timerRef.current = null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, [resetKey]);
|
|
45
|
+
return useCallback((change) => {
|
|
46
|
+
if (timerRef.current !== null)
|
|
47
|
+
clearTimeout(timerRef.current);
|
|
48
|
+
if (delay <= 0) {
|
|
49
|
+
onChangeRef.current(change);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
timerRef.current = setTimeout(() => {
|
|
53
|
+
timerRef.current = null;
|
|
54
|
+
onChangeRef.current(change);
|
|
55
|
+
}, delay);
|
|
56
|
+
}, [delay]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The canvas is positioned out of the height computation, so the container's
|
|
60
|
+
* own height is what the measured toolbar floor writes on it. The `minHeight`
|
|
61
|
+
* prop is applied on top of this at first render: without a height before the
|
|
62
|
+
* toolbar has been measured, the editor is built at zero size and never paints
|
|
63
|
+
* the structure it was given.
|
|
64
|
+
*/
|
|
65
|
+
const ROOT_STYLE = {
|
|
66
|
+
position: 'relative',
|
|
67
|
+
overflow: 'hidden',
|
|
68
|
+
boxSizing: 'border-box',
|
|
69
|
+
border: '1px solid #d3d8de',
|
|
70
|
+
borderRadius: 6,
|
|
71
|
+
background: '#fff',
|
|
72
|
+
};
|
|
73
|
+
/** The box the canvas will fill, so its arrival moves nothing. */
|
|
74
|
+
const LOADING_STYLE = {
|
|
75
|
+
position: 'absolute',
|
|
76
|
+
inset: 0,
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
color: '#8a96a3',
|
|
81
|
+
fontSize: 13,
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=StructureEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureEditor.js","sourceRoot":"","sources":["../../../src/structure/ui/StructureEditor.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAOvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;IACnC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,mBAAoB,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;AAC1C,CAAC,CAAC,CAAC;AA2DH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,QAAQ,EACtB,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,SAAS,GAAG,GAAG,EACf,IAAI,GAAG,UAAU,EACjB,SAAS,EACT,KAAK,GACN,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEhE,OAAO,CACL,cACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,YAE7C,KAAC,QAAQ,IAAC,QAAQ,EAAE,cAAK,KAAK,EAAE,aAAa,yCAA2B,YACtE,KAAC,YAAY,IAEX,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,IALL,QAAQ,CAMb,GACO,GACP,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,YAAY,CACnB,QAAiD,EACjD,KAAa,EACb,QAAgB;IAEhB,MAAM,QAAQ,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;gBAC9B,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBAC/B,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,WAAW,CAChB,CAAC,MAA6B,EAAE,EAAE;QAChC,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI;YAAE,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACf,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC5B,OAAO;QACT,CAAC;QACD,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YACxB,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,GAAkB;IAChC,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,mBAAmB;IAC3B,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,MAAM;CACnB,CAAC;AAEF,kEAAkE;AAClE,MAAM,aAAa,GAAkB;IACnC,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,EAAE;CACb,CAAC"}
|