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
|
@@ -2,13 +2,11 @@ import type { ReactElement } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { HeaderButtonProps } from '../../shared/ui/MenuButton.tsx';
|
|
4
4
|
import { MenuButton } from '../../shared/ui/MenuButton.tsx';
|
|
5
|
-
import type { Reference } from '../core/reference.ts';
|
|
6
5
|
|
|
6
|
+
import type { CitedReferenceProps, CitedWorksProps } from './CitationMenu.tsx';
|
|
7
7
|
import { CitationMenu } from './CitationMenu.tsx';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
/** The work the site asks to be cited. */
|
|
11
|
-
reference: Reference;
|
|
9
|
+
interface CiteButtonBaseProps extends HeaderButtonProps {
|
|
12
10
|
/**
|
|
13
11
|
* Text of the button. In a compact bar it is not written, but it stays what
|
|
14
12
|
* the pointer and a screen reader are told.
|
|
@@ -17,23 +15,40 @@ export interface CiteButtonProps extends HeaderButtonProps {
|
|
|
17
15
|
label?: string;
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
/** The button of a site asking for one work. */
|
|
19
|
+
export interface CiteOneWorkProps
|
|
20
|
+
extends CiteButtonBaseProps, CitedReferenceProps {}
|
|
21
|
+
|
|
22
|
+
/** The button of a site asking for the several works it is built on. */
|
|
23
|
+
export interface CiteWorksProps extends CiteButtonBaseProps, CitedWorksProps {}
|
|
24
|
+
|
|
25
|
+
export type CiteButtonProps = CiteOneWorkProps | CiteWorksProps;
|
|
26
|
+
|
|
20
27
|
/**
|
|
21
28
|
* The Cite entry of a site header: one button opening the article at its DOI,
|
|
22
29
|
* the reference in the style a journal asks for, and the files a reference
|
|
23
|
-
* manager imports.
|
|
24
|
-
*
|
|
30
|
+
* manager imports. A site built on several works passes `works` rather than
|
|
31
|
+
* `reference`, and each is then listed behind what citing it credits.
|
|
32
|
+
* @param props - The work or works being cited, and how the menu opens.
|
|
25
33
|
* @returns The button and its menu.
|
|
26
34
|
*/
|
|
27
35
|
export function CiteButton(props: CiteButtonProps): ReactElement {
|
|
28
|
-
const
|
|
36
|
+
const label = props.label ?? 'Cite';
|
|
29
37
|
|
|
30
38
|
return (
|
|
31
39
|
<MenuButton
|
|
32
|
-
{
|
|
40
|
+
compact={props.compact}
|
|
41
|
+
placement={props.placement}
|
|
33
42
|
className="citation-button"
|
|
34
43
|
icon="citation"
|
|
35
44
|
label={label}
|
|
36
|
-
menu={
|
|
45
|
+
menu={
|
|
46
|
+
'works' in props ? (
|
|
47
|
+
<CitationMenu works={props.works} guidance={props.guidance} />
|
|
48
|
+
) : (
|
|
49
|
+
<CitationMenu reference={props.reference} />
|
|
50
|
+
)
|
|
51
|
+
}
|
|
37
52
|
/>
|
|
38
53
|
);
|
|
39
54
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { MenuItem } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
import { CITATION_FORMATS } from '../core/formats.ts';
|
|
5
|
+
import type { Reference } from '../core/reference.ts';
|
|
6
|
+
import { CITATION_STYLES } from '../core/segments.ts';
|
|
7
|
+
|
|
8
|
+
import { CopyEntry } from './entries.tsx';
|
|
9
|
+
import type { CopyFeedback } from './useCopyFeedback.ts';
|
|
10
|
+
|
|
11
|
+
export interface CopyFormatEntriesProps {
|
|
12
|
+
/** The works the entries copy, in reading order. */
|
|
13
|
+
references: readonly Reference[];
|
|
14
|
+
/** The copy action and the feedback of the menu these entries sit in. */
|
|
15
|
+
feedback: CopyFeedback;
|
|
16
|
+
/**
|
|
17
|
+
* What the feedback keys are prefixed with, so two lists of formats in one
|
|
18
|
+
* menu never light up together.
|
|
19
|
+
* @default ''
|
|
20
|
+
*/
|
|
21
|
+
keyPrefix?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a format written differently by each journal opens its submenu of
|
|
24
|
+
* styles. A list nested in a work's own submenu does not: three levels of
|
|
25
|
+
* menu are more than a reader picking a reference should have to walk, so it
|
|
26
|
+
* copies in the default style instead.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
styled?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* One entry per format the references can be copied in, previewing on hover
|
|
34
|
+
* what each puts on the clipboard.
|
|
35
|
+
* @param props - The references, the feedback, and whether the styles nest.
|
|
36
|
+
* @returns The entries of the copy section.
|
|
37
|
+
*/
|
|
38
|
+
export function CopyFormatEntries(
|
|
39
|
+
props: CopyFormatEntriesProps,
|
|
40
|
+
): ReactElement[] {
|
|
41
|
+
const { references, feedback, keyPrefix = '', styled = true } = props;
|
|
42
|
+
|
|
43
|
+
return CITATION_FORMATS.map((format) => {
|
|
44
|
+
if (!styled || !format.styled) {
|
|
45
|
+
const key = `${keyPrefix}${format.id}`;
|
|
46
|
+
return (
|
|
47
|
+
<CopyEntry
|
|
48
|
+
key={format.id}
|
|
49
|
+
references={references}
|
|
50
|
+
format={format}
|
|
51
|
+
state={feedback.stateOf(key)}
|
|
52
|
+
onCopy={() => {
|
|
53
|
+
feedback.copy(key, references, format.id);
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<MenuItem
|
|
61
|
+
key={format.id}
|
|
62
|
+
icon="clipboard"
|
|
63
|
+
text={format.label}
|
|
64
|
+
label={format.hint}
|
|
65
|
+
>
|
|
66
|
+
{CITATION_STYLES.map((style) => {
|
|
67
|
+
const key = `${keyPrefix}${format.id}:${style.id}`;
|
|
68
|
+
return (
|
|
69
|
+
<CopyEntry
|
|
70
|
+
key={style.id}
|
|
71
|
+
references={references}
|
|
72
|
+
format={format}
|
|
73
|
+
style={style}
|
|
74
|
+
state={feedback.stateOf(key)}
|
|
75
|
+
onCopy={() => {
|
|
76
|
+
feedback.copy(key, references, format.id, style.id);
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
})}
|
|
81
|
+
</MenuItem>
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { MenuDivider, MenuItem } from '@blueprintjs/core';
|
|
2
|
+
import { SvgLogoDoi } from 'cheminfo-font';
|
|
3
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import { CITATION_DOWNLOADS } from '../core/formats.ts';
|
|
6
|
+
import { doiUrl } from '../core/reference.ts';
|
|
7
|
+
import type { CitedWork } from '../core/works.ts';
|
|
8
|
+
|
|
9
|
+
import { CopyFormatEntries } from './CopyFormatEntries.tsx';
|
|
10
|
+
import { DownloadEntry } from './entries.tsx';
|
|
11
|
+
import type { CopyFeedback } from './useCopyFeedback.ts';
|
|
12
|
+
|
|
13
|
+
const DOI_ICON_STYLE: CSSProperties = { width: 16, height: 16 };
|
|
14
|
+
const WHAT_STYLE: CSSProperties = { fontWeight: 600 };
|
|
15
|
+
// The sentence saying what citing the work credits, read under its name: it is
|
|
16
|
+
// a sentence, so it wraps rather than stretching the menu.
|
|
17
|
+
const NOTE_STYLE: CSSProperties = {
|
|
18
|
+
maxWidth: 260,
|
|
19
|
+
opacity: 0.7,
|
|
20
|
+
fontSize: 11.5,
|
|
21
|
+
lineHeight: 1.35,
|
|
22
|
+
whiteSpace: 'normal',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface WorkEntryProps {
|
|
26
|
+
/** The work, and what a reader is citing it for. */
|
|
27
|
+
work: CitedWork;
|
|
28
|
+
/** The copy action and the feedback of the menu this entry sits in. */
|
|
29
|
+
feedback: CopyFeedback;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* One work of a site that asks for several: what it is, what citing it credits,
|
|
34
|
+
* and a submenu holding the article at its DOI and that one reference on its
|
|
35
|
+
* own — in the default style, the styles being offered on the whole set.
|
|
36
|
+
* @param props - The work, and the feedback of its copy entries.
|
|
37
|
+
* @returns The menu entry of the work.
|
|
38
|
+
*/
|
|
39
|
+
export function WorkEntry(props: WorkEntryProps): ReactElement {
|
|
40
|
+
const { work, feedback } = props;
|
|
41
|
+
const { reference, what, note } = work;
|
|
42
|
+
const references = [reference];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<MenuItem
|
|
46
|
+
icon={<SvgLogoDoi style={DOI_ICON_STYLE} />}
|
|
47
|
+
text={
|
|
48
|
+
<span>
|
|
49
|
+
<span style={WHAT_STYLE}>{what}</span>
|
|
50
|
+
{note === undefined ? null : <div style={NOTE_STYLE}>{note}</div>}
|
|
51
|
+
</span>
|
|
52
|
+
}
|
|
53
|
+
label={`${reference.journalAbbreviation} ${reference.year}`}
|
|
54
|
+
>
|
|
55
|
+
<MenuItem
|
|
56
|
+
icon={<SvgLogoDoi style={DOI_ICON_STYLE} />}
|
|
57
|
+
text="Open the article"
|
|
58
|
+
label={reference.doi}
|
|
59
|
+
href={doiUrl(reference)}
|
|
60
|
+
target="_blank"
|
|
61
|
+
rel="noreferrer"
|
|
62
|
+
/>
|
|
63
|
+
<MenuDivider title="Copy this reference as" />
|
|
64
|
+
<CopyFormatEntries
|
|
65
|
+
references={references}
|
|
66
|
+
feedback={feedback}
|
|
67
|
+
keyPrefix={`${reference.doi}:`}
|
|
68
|
+
styled={false}
|
|
69
|
+
/>
|
|
70
|
+
<MenuDivider title="Import this reference" />
|
|
71
|
+
{CITATION_DOWNLOADS.map((download) => (
|
|
72
|
+
<DownloadEntry
|
|
73
|
+
key={download.format}
|
|
74
|
+
references={references}
|
|
75
|
+
download={download}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</MenuItem>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { IconName, Intent } from '@blueprintjs/core';
|
|
|
2
2
|
import { MenuItem, Tooltip } from '@blueprintjs/core';
|
|
3
3
|
import type { CSSProperties, ReactElement } from 'react';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { downloadCitations } from '../core/download.ts';
|
|
6
6
|
import type { CitationDownload, CitationFormat } from '../core/formats.ts';
|
|
7
7
|
import type { Reference } from '../core/reference.ts';
|
|
8
8
|
import type { CitationStyle } from '../core/segments.ts';
|
|
@@ -27,8 +27,8 @@ export interface CopyState {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export interface CopyEntryProps {
|
|
30
|
-
/** The
|
|
31
|
-
|
|
30
|
+
/** The works being cited, in reading order. */
|
|
31
|
+
references: readonly Reference[];
|
|
32
32
|
/** The format the entry copies. */
|
|
33
33
|
format: CitationFormat;
|
|
34
34
|
/**
|
|
@@ -38,21 +38,21 @@ export interface CopyEntryProps {
|
|
|
38
38
|
style?: CitationStyle;
|
|
39
39
|
/** Feedback of the last copy, while it is showing. */
|
|
40
40
|
state: CopyState | null;
|
|
41
|
-
/** Called
|
|
42
|
-
onCopy: (
|
|
41
|
+
/** Called when the entry is clicked. */
|
|
42
|
+
onCopy: () => void;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* One entry that copies, previewing on hover what it puts on the clipboard.
|
|
47
|
-
* @param props - The
|
|
47
|
+
* @param props - The references, the format, and the feedback showing.
|
|
48
48
|
* @returns The menu entry.
|
|
49
49
|
*/
|
|
50
50
|
export function CopyEntry(props: CopyEntryProps): ReactElement {
|
|
51
|
-
const {
|
|
51
|
+
const { references, format, style, state, onCopy } = props;
|
|
52
52
|
const entry = style ?? format;
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
|
-
<PreviewTooltip
|
|
55
|
+
<PreviewTooltip references={references} format={format.id} style={style}>
|
|
56
56
|
{(targetProps) => (
|
|
57
57
|
<MenuItem
|
|
58
58
|
{...targetProps}
|
|
@@ -69,9 +69,7 @@ export function CopyEntry(props: CopyEntryProps): ReactElement {
|
|
|
69
69
|
)
|
|
70
70
|
}
|
|
71
71
|
shouldDismissPopover={false}
|
|
72
|
-
onClick={
|
|
73
|
-
onCopy(format, style);
|
|
74
|
-
}}
|
|
72
|
+
onClick={onCopy}
|
|
75
73
|
/>
|
|
76
74
|
)}
|
|
77
75
|
</PreviewTooltip>
|
|
@@ -79,8 +77,8 @@ export function CopyEntry(props: CopyEntryProps): ReactElement {
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
export interface DownloadEntryProps {
|
|
82
|
-
/** The
|
|
83
|
-
|
|
80
|
+
/** The works being saved, in reading order. */
|
|
81
|
+
references: readonly Reference[];
|
|
84
82
|
/** The file to write, from `CITATION_DOWNLOADS`. */
|
|
85
83
|
download: CitationDownload;
|
|
86
84
|
}
|
|
@@ -91,9 +89,9 @@ export interface DownloadEntryProps {
|
|
|
91
89
|
* @returns The menu entry.
|
|
92
90
|
*/
|
|
93
91
|
export function DownloadEntry(props: DownloadEntryProps): ReactElement {
|
|
94
|
-
const {
|
|
92
|
+
const { references, download } = props;
|
|
95
93
|
return (
|
|
96
|
-
<PreviewTooltip
|
|
94
|
+
<PreviewTooltip references={references} format={download.format}>
|
|
97
95
|
{(targetProps) => (
|
|
98
96
|
<MenuItem
|
|
99
97
|
{...targetProps}
|
|
@@ -102,7 +100,7 @@ export function DownloadEntry(props: DownloadEntryProps): ReactElement {
|
|
|
102
100
|
text={download.label}
|
|
103
101
|
labelElement={download.hint}
|
|
104
102
|
onClick={() => {
|
|
105
|
-
|
|
103
|
+
downloadCitations(references, download);
|
|
106
104
|
}}
|
|
107
105
|
/>
|
|
108
106
|
)}
|
|
@@ -113,19 +111,19 @@ export function DownloadEntry(props: DownloadEntryProps): ReactElement {
|
|
|
113
111
|
/**
|
|
114
112
|
* The hover preview of what an entry copies or saves.
|
|
115
113
|
* @param props - The preview options.
|
|
116
|
-
* @param props.
|
|
114
|
+
* @param props.references - The works being written.
|
|
117
115
|
* @param props.format - The format the entry produces.
|
|
118
116
|
* @param props.style - The journal style, for a format that has one.
|
|
119
117
|
* @param props.children - The entry the preview is anchored on.
|
|
120
118
|
* @returns The entry, wrapped in its preview tooltip.
|
|
121
119
|
*/
|
|
122
120
|
function PreviewTooltip(props: {
|
|
123
|
-
|
|
121
|
+
references: readonly Reference[];
|
|
124
122
|
format: CitationFormat['id'];
|
|
125
123
|
style?: CitationStyle;
|
|
126
124
|
children: (targetProps: Record<string, unknown>) => ReactElement;
|
|
127
125
|
}): ReactElement {
|
|
128
|
-
const {
|
|
126
|
+
const { references, format, style, children } = props;
|
|
129
127
|
return (
|
|
130
128
|
<Tooltip
|
|
131
129
|
placement="left"
|
|
@@ -133,7 +131,7 @@ function PreviewTooltip(props: {
|
|
|
133
131
|
hoverOpenDelay={PREVIEW_OPEN_DELAY}
|
|
134
132
|
content={
|
|
135
133
|
<CitationPreview
|
|
136
|
-
reference={
|
|
134
|
+
reference={references}
|
|
137
135
|
format={format}
|
|
138
136
|
style={style?.id}
|
|
139
137
|
/>
|
package/src/citation/ui/index.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type {
|
|
2
|
+
CitationMenuProps,
|
|
3
|
+
CitedReferenceProps,
|
|
4
|
+
CitedWorksProps,
|
|
5
|
+
} from './CitationMenu.tsx';
|
|
2
6
|
export { CitationMenu } from './CitationMenu.tsx';
|
|
3
7
|
export type { CitationPreviewProps } from './CitationPreview.tsx';
|
|
4
8
|
export { CitationPreview } from './CitationPreview.tsx';
|
|
5
|
-
export type {
|
|
9
|
+
export type {
|
|
10
|
+
CiteButtonProps,
|
|
11
|
+
CiteOneWorkProps,
|
|
12
|
+
CiteWorksProps,
|
|
13
|
+
} from './CiteButton.tsx';
|
|
6
14
|
export { CiteButton } from './CiteButton.tsx';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { copyCitations } from '../core/clipboard.ts';
|
|
4
|
+
import type { CitationFormatId } from '../core/formats.ts';
|
|
5
|
+
import type { Reference } from '../core/reference.ts';
|
|
6
|
+
import type { CitationStyleId } from '../core/segments.ts';
|
|
7
|
+
|
|
8
|
+
import type { CopyState } from './entries.tsx';
|
|
9
|
+
|
|
10
|
+
// How long the tick replaces the clipboard glyph of an entry after a copy.
|
|
11
|
+
const FEEDBACK_MS = 1500;
|
|
12
|
+
|
|
13
|
+
/** Copying, with the feedback the entry that was clicked then shows. */
|
|
14
|
+
export interface CopyFeedback {
|
|
15
|
+
/** The feedback showing on the entry known as `key`, if any. */
|
|
16
|
+
stateOf: (key: string) => CopyState | null;
|
|
17
|
+
/**
|
|
18
|
+
* Copy the references, and announce the outcome on the entry known as `key`.
|
|
19
|
+
*/
|
|
20
|
+
copy: (
|
|
21
|
+
key: string,
|
|
22
|
+
references: readonly Reference[],
|
|
23
|
+
format: CitationFormatId,
|
|
24
|
+
style?: CitationStyleId,
|
|
25
|
+
) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Hold which entry of a citation menu was clicked last and how it went, so the
|
|
30
|
+
* tick — or the cross a denied clipboard leaves — shows on that entry alone.
|
|
31
|
+
* @returns The copy action, and the feedback of the entry that used it.
|
|
32
|
+
*/
|
|
33
|
+
export function useCopyFeedback(): CopyFeedback {
|
|
34
|
+
const [copied, setCopied] = useState<string | null>(null);
|
|
35
|
+
const [hasFailed, setHasFailed] = useState(false);
|
|
36
|
+
const timeout = useRef<number | null>(null);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
return () => {
|
|
40
|
+
if (timeout.current !== null) window.clearTimeout(timeout.current);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
function announce(key: string, failed: boolean): void {
|
|
45
|
+
setCopied(key);
|
|
46
|
+
setHasFailed(failed);
|
|
47
|
+
if (timeout.current !== null) window.clearTimeout(timeout.current);
|
|
48
|
+
timeout.current = window.setTimeout(() => {
|
|
49
|
+
setCopied(null);
|
|
50
|
+
setHasFailed(false);
|
|
51
|
+
}, FEEDBACK_MS);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
stateOf: (key) => (copied === key ? feedback(hasFailed) : null),
|
|
56
|
+
copy: (key, references, format, style) => {
|
|
57
|
+
copyCitations(references, format, style).then(
|
|
58
|
+
() => {
|
|
59
|
+
announce(key, false);
|
|
60
|
+
},
|
|
61
|
+
() => {
|
|
62
|
+
// A denied clipboard permission is the usual cause, and the menu is
|
|
63
|
+
// the only place the user can be told about it.
|
|
64
|
+
announce(key, true);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function feedback(failed: boolean): CopyState {
|
|
72
|
+
if (failed) {
|
|
73
|
+
return { icon: 'cross', intent: 'danger', label: 'copy failed' };
|
|
74
|
+
}
|
|
75
|
+
return { icon: 'tick', intent: 'success', label: 'copied' };
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { writeToClipboard } from './writeToClipboard.ts';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Put a piece of text on the clipboard, without ever throwing at the caller.
|
|
3
|
+
*
|
|
4
|
+
* The async Clipboard API is tried first and a hidden textarea is the fallback,
|
|
5
|
+
* which is what a page served over plain HTTP, an older Safari, or a browser
|
|
6
|
+
* that refused the permission is left with. A refusal is an outcome the caller
|
|
7
|
+
* shows rather than an error it has to catch, so both paths resolve.
|
|
8
|
+
* @param text - What to put on the clipboard.
|
|
9
|
+
* @returns Whether the clipboard now holds the text.
|
|
10
|
+
*/
|
|
11
|
+
export async function writeToClipboard(text: string): Promise<boolean> {
|
|
12
|
+
const clipboard = globalThis.navigator?.clipboard;
|
|
13
|
+
if (clipboard) {
|
|
14
|
+
try {
|
|
15
|
+
await clipboard.writeText(text);
|
|
16
|
+
return true;
|
|
17
|
+
} catch {
|
|
18
|
+
// A denied permission, or a call the browser no longer considers to come
|
|
19
|
+
// from a user gesture. The textarea below still works in both cases.
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return writeWithTextArea(text);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function writeWithTextArea(text: string): boolean {
|
|
26
|
+
if (typeof document === 'undefined') return false;
|
|
27
|
+
|
|
28
|
+
const textArea = document.createElement('textarea');
|
|
29
|
+
textArea.value = text;
|
|
30
|
+
textArea.setAttribute('readonly', '');
|
|
31
|
+
// Off the screen rather than hidden: a `display: none` element selects
|
|
32
|
+
// nothing, and a visible one scrolls the page as it is focused.
|
|
33
|
+
textArea.style.position = 'fixed';
|
|
34
|
+
textArea.style.top = '-9999px';
|
|
35
|
+
textArea.style.opacity = '0';
|
|
36
|
+
document.body.append(textArea);
|
|
37
|
+
textArea.select();
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- the deprecated command is what the fallback is
|
|
41
|
+
return document.execCommand('copy');
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
} finally {
|
|
45
|
+
textArea.remove();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { CopyButton } from './CopyButton.tsx';
|
|
4
|
+
|
|
5
|
+
/** How a code block sits on the page it is shown in. */
|
|
6
|
+
export type CodeBlockTone = 'default' | 'muted' | 'dark';
|
|
7
|
+
|
|
8
|
+
const HOLDER_STYLE: CSSProperties = { position: 'relative' };
|
|
9
|
+
const COPY_STYLE: CSSProperties = { position: 'absolute', top: 4, right: 4 };
|
|
10
|
+
|
|
11
|
+
const BASE_PRE_STYLE: CSSProperties = {
|
|
12
|
+
margin: 0,
|
|
13
|
+
padding: '8px 10px',
|
|
14
|
+
borderRadius: 4,
|
|
15
|
+
fontSize: 12,
|
|
16
|
+
whiteSpace: 'pre-wrap',
|
|
17
|
+
overflowWrap: 'anywhere',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const TONE_STYLE: Record<CodeBlockTone, CSSProperties> = {
|
|
21
|
+
default: {},
|
|
22
|
+
muted: { background: '#f6f7f9', border: '1px solid #d3d8de' },
|
|
23
|
+
dark: {
|
|
24
|
+
background: '#1e293b',
|
|
25
|
+
border: '1px solid #1e293b',
|
|
26
|
+
color: '#e2e8f0',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface CodeBlockProps {
|
|
31
|
+
/** The text shown, and what the copy button hands over. */
|
|
32
|
+
code: string;
|
|
33
|
+
/**
|
|
34
|
+
* What is drawn in place of the plain text — syntax coloured spans, for
|
|
35
|
+
* instance. The code itself is still what gets copied.
|
|
36
|
+
* @default undefined — the code is shown as it is
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* How the block is painted: nothing of its own, a light grey panel, or a
|
|
41
|
+
* dark one.
|
|
42
|
+
* @default 'default'
|
|
43
|
+
*/
|
|
44
|
+
tone?: CodeBlockTone;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a copy button sits in the corner of the block.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
copyable?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Height past which the block scrolls on its own rather than pushing what
|
|
52
|
+
* follows it down the page.
|
|
53
|
+
* @default undefined — the block is as tall as its content
|
|
54
|
+
*/
|
|
55
|
+
maxHeight?: number | string;
|
|
56
|
+
/**
|
|
57
|
+
* Class the holder carries, in addition to `code-block`.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A block of text to hand over: the address of a page, the markup that frames
|
|
65
|
+
* it, or a sample meant to be pasted into an editor and run.
|
|
66
|
+
* @param props - The code, how it is painted, and whether it can be copied.
|
|
67
|
+
* @returns The code block.
|
|
68
|
+
*/
|
|
69
|
+
export function CodeBlock(props: CodeBlockProps): ReactElement {
|
|
70
|
+
const {
|
|
71
|
+
code,
|
|
72
|
+
children,
|
|
73
|
+
tone = 'default',
|
|
74
|
+
copyable = false,
|
|
75
|
+
maxHeight,
|
|
76
|
+
className,
|
|
77
|
+
} = props;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div className={holderClassName(tone, className)} style={HOLDER_STYLE}>
|
|
81
|
+
<pre style={preStyle(tone, copyable, maxHeight)}>{children ?? code}</pre>
|
|
82
|
+
{copyable ? (
|
|
83
|
+
<span style={COPY_STYLE}>
|
|
84
|
+
<CopyButton content={code} minimal small />
|
|
85
|
+
</span>
|
|
86
|
+
) : null}
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function holderClassName(tone: CodeBlockTone, className?: string): string {
|
|
92
|
+
const names = ['code-block'];
|
|
93
|
+
if (tone !== 'default') names.push(`code-block--${tone}`);
|
|
94
|
+
if (className !== undefined) names.push(className);
|
|
95
|
+
return names.join(' ');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function preStyle(
|
|
99
|
+
tone: CodeBlockTone,
|
|
100
|
+
copyable: boolean,
|
|
101
|
+
maxHeight: number | string | undefined,
|
|
102
|
+
): CSSProperties {
|
|
103
|
+
return {
|
|
104
|
+
...BASE_PRE_STYLE,
|
|
105
|
+
...TONE_STYLE[tone],
|
|
106
|
+
// The button floats over the corner, so the text stops before it.
|
|
107
|
+
...(copyable ? { paddingRight: 42 } : {}),
|
|
108
|
+
...(maxHeight === undefined ? {} : { maxHeight, overflowY: 'auto' }),
|
|
109
|
+
};
|
|
110
|
+
}
|