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,111 @@
|
|
|
1
|
+
import type { IconName } from '@blueprintjs/core';
|
|
2
|
+
import { Button } from '@blueprintjs/core';
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_COPY_RESET_AFTER,
|
|
7
|
+
useCopyToClipboard,
|
|
8
|
+
} from './useCopyToClipboard.ts';
|
|
9
|
+
|
|
10
|
+
export interface CopyButtonProps {
|
|
11
|
+
/**
|
|
12
|
+
* What to copy. A function is called when the button is pressed, which is
|
|
13
|
+
* what a whole list has to be: writing ten thousand structures out on every
|
|
14
|
+
* render, for a button nobody may press, is a page that stutters as it is
|
|
15
|
+
* scrolled.
|
|
16
|
+
*/
|
|
17
|
+
content: string | (() => string);
|
|
18
|
+
/**
|
|
19
|
+
* Text of the button. Left out for an icon-only button, which is what a
|
|
20
|
+
* dense row of them needs.
|
|
21
|
+
* @default undefined — the button is reduced to its icon
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Text shown while the copy is being confirmed, when there is a label.
|
|
26
|
+
* @default 'Copied'
|
|
27
|
+
*/
|
|
28
|
+
copiedLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the button drops its background, for a toolbar or a code block.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
minimal?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the button is the small size.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
small?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Glyph shown at rest. A tick replaces it while the copy is confirmed.
|
|
41
|
+
* @default 'duplicate'
|
|
42
|
+
*/
|
|
43
|
+
icon?: IconName;
|
|
44
|
+
/**
|
|
45
|
+
* Whether there is nothing to copy.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* How long the button says it copied, in milliseconds.
|
|
51
|
+
* @default 1500
|
|
52
|
+
*/
|
|
53
|
+
resetAfter?: number;
|
|
54
|
+
/**
|
|
55
|
+
* What the pointer and a screen reader are told.
|
|
56
|
+
* @default 'Copy to clipboard'
|
|
57
|
+
*/
|
|
58
|
+
title?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Class the button carries, so a site can reach it from its stylesheet.
|
|
61
|
+
* @default undefined
|
|
62
|
+
*/
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A button that puts a piece of text on the clipboard and says so.
|
|
68
|
+
* @param props - What to copy, what the button reads, and how it looks.
|
|
69
|
+
* @returns The copy button.
|
|
70
|
+
*/
|
|
71
|
+
export function CopyButton(props: CopyButtonProps): ReactElement {
|
|
72
|
+
const {
|
|
73
|
+
content,
|
|
74
|
+
label,
|
|
75
|
+
copiedLabel = 'Copied',
|
|
76
|
+
minimal = false,
|
|
77
|
+
small = false,
|
|
78
|
+
icon = 'duplicate',
|
|
79
|
+
disabled = false,
|
|
80
|
+
resetAfter = DEFAULT_COPY_RESET_AFTER,
|
|
81
|
+
title = 'Copy to clipboard',
|
|
82
|
+
className,
|
|
83
|
+
} = props;
|
|
84
|
+
const { copied, copy } = useCopyToClipboard(resetAfter);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Button
|
|
88
|
+
className={className}
|
|
89
|
+
variant={minimal ? 'minimal' : 'solid'}
|
|
90
|
+
size={small ? 'small' : 'medium'}
|
|
91
|
+
icon={copied ? 'tick' : icon}
|
|
92
|
+
intent={copied ? 'success' : 'none'}
|
|
93
|
+
text={buttonText(label, copiedLabel, copied)}
|
|
94
|
+
disabled={disabled}
|
|
95
|
+
title={title}
|
|
96
|
+
aria-label={label ?? title}
|
|
97
|
+
onClick={() => {
|
|
98
|
+
void copy(typeof content === 'function' ? content() : content);
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function buttonText(
|
|
105
|
+
label: string | undefined,
|
|
106
|
+
copiedLabel: string,
|
|
107
|
+
copied: boolean,
|
|
108
|
+
): string | undefined {
|
|
109
|
+
if (label === undefined) return undefined;
|
|
110
|
+
return copied ? copiedLabel : label;
|
|
111
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { CodeBlockProps, CodeBlockTone } from './CodeBlock.tsx';
|
|
2
|
+
export { CodeBlock } from './CodeBlock.tsx';
|
|
3
|
+
export type { CopyButtonProps } from './CopyButton.tsx';
|
|
4
|
+
export { CopyButton } from './CopyButton.tsx';
|
|
5
|
+
export type { CopyToClipboard } from './useCopyToClipboard.ts';
|
|
6
|
+
export {
|
|
7
|
+
DEFAULT_COPY_RESET_AFTER,
|
|
8
|
+
useCopyToClipboard,
|
|
9
|
+
} from './useCopyToClipboard.ts';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { writeToClipboard } from '../core/writeToClipboard.ts';
|
|
4
|
+
|
|
5
|
+
/** How long a copy is confirmed for, in milliseconds, unless asked otherwise. */
|
|
6
|
+
export const DEFAULT_COPY_RESET_AFTER = 1500;
|
|
7
|
+
|
|
8
|
+
/** A clipboard write and the confirmation it leaves behind for a moment. */
|
|
9
|
+
export interface CopyToClipboard {
|
|
10
|
+
/** Whether the last copy worked and is still being confirmed. */
|
|
11
|
+
copied: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Put text on the clipboard and confirm it.
|
|
14
|
+
* @param text - What to copy.
|
|
15
|
+
* @returns Whether the clipboard took it.
|
|
16
|
+
*/
|
|
17
|
+
copy: (text: string) => Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Copy text and say so for a moment afterwards.
|
|
22
|
+
*
|
|
23
|
+
* The confirmation timer is cleared when the component goes away, and a copy
|
|
24
|
+
* that lands after that confirms nothing, so a button unmounted mid-copy — a
|
|
25
|
+
* row leaving a list, a menu closing — leaves no timer behind.
|
|
26
|
+
* @param resetAfter - How long the confirmation lasts, in milliseconds.
|
|
27
|
+
* @returns The confirmation flag and the copy action.
|
|
28
|
+
*/
|
|
29
|
+
export function useCopyToClipboard(
|
|
30
|
+
resetAfter = DEFAULT_COPY_RESET_AFTER,
|
|
31
|
+
): CopyToClipboard {
|
|
32
|
+
const [copied, setCopied] = useState(false);
|
|
33
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
34
|
+
const isMounted = useRef(true);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
isMounted.current = true;
|
|
38
|
+
return () => {
|
|
39
|
+
isMounted.current = false;
|
|
40
|
+
clearTimeout(timer.current);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const copy = useCallback(
|
|
45
|
+
async (text: string) => {
|
|
46
|
+
const written = await writeToClipboard(text);
|
|
47
|
+
if (!written || !isMounted.current) return written;
|
|
48
|
+
setCopied(true);
|
|
49
|
+
clearTimeout(timer.current);
|
|
50
|
+
timer.current = setTimeout(() => setCopied(false), resetAfter);
|
|
51
|
+
return true;
|
|
52
|
+
},
|
|
53
|
+
[resetAfter],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return { copied, copy };
|
|
57
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { parseHexColor } from './hex.ts';
|
|
2
|
+
|
|
3
|
+
const RED_WEIGHT = 0.2126;
|
|
4
|
+
const GREEN_WEIGHT = 0.7152;
|
|
5
|
+
const BLUE_WEIGHT = 0.0722;
|
|
6
|
+
const LINEAR_THRESHOLD = 0.039_28;
|
|
7
|
+
|
|
8
|
+
/** The ink written on a light background. */
|
|
9
|
+
const DARK_INK = '#182026';
|
|
10
|
+
/** The ink written on a dark background. */
|
|
11
|
+
const LIGHT_INK = '#ffffff';
|
|
12
|
+
|
|
13
|
+
/** Which two inks {@link readableInk} chooses between. */
|
|
14
|
+
export interface ReadableInkOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The ink for a light background.
|
|
17
|
+
* @default '#182026'
|
|
18
|
+
*/
|
|
19
|
+
dark?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The ink for a dark background.
|
|
22
|
+
* @default '#ffffff'
|
|
23
|
+
*/
|
|
24
|
+
light?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The relative luminance of a colour, as WCAG 2 defines it.
|
|
29
|
+
* @param color - A `#rgb` or `#rrggbb` colour.
|
|
30
|
+
* @returns Its luminance, from 0 for black to 1 for white.
|
|
31
|
+
* @throws {Error} When the string is not a hex colour.
|
|
32
|
+
*/
|
|
33
|
+
export function relativeLuminance(color: string): number {
|
|
34
|
+
const { red, green, blue } = parseHexColor(color);
|
|
35
|
+
return (
|
|
36
|
+
RED_WEIGHT * linearize(red) +
|
|
37
|
+
GREEN_WEIGHT * linearize(green) +
|
|
38
|
+
BLUE_WEIGHT * linearize(blue)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The WCAG contrast ratio between two colours, whichever way round they come.
|
|
44
|
+
*
|
|
45
|
+
* Body text needs 4.5, large text and interface parts need 3.
|
|
46
|
+
* @param first - A `#rgb` or `#rrggbb` colour.
|
|
47
|
+
* @param second - The colour it is read against.
|
|
48
|
+
* @returns A ratio from 1 for two identical colours to 21 for black on white.
|
|
49
|
+
* @throws {Error} When either string is not a hex colour.
|
|
50
|
+
*/
|
|
51
|
+
export function contrastRatio(first: string, second: string): number {
|
|
52
|
+
const one = relativeLuminance(first);
|
|
53
|
+
const other = relativeLuminance(second);
|
|
54
|
+
const lighter = Math.max(one, other);
|
|
55
|
+
const darker = Math.min(one, other);
|
|
56
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The ink that stays readable on a background.
|
|
61
|
+
*
|
|
62
|
+
* The two candidates are compared by contrast ratio rather than by a lightness
|
|
63
|
+
* threshold, so the choice is the one WCAG would make and a mid-tone
|
|
64
|
+
* background gets the ink it actually reads better against.
|
|
65
|
+
* @param background - The `#rgb` or `#rrggbb` colour written on.
|
|
66
|
+
* @param options - See {@link ReadableInkOptions}.
|
|
67
|
+
* @returns Whichever of the two inks reaches the higher contrast.
|
|
68
|
+
* @throws {Error} When any of the colours is not a hex colour.
|
|
69
|
+
*/
|
|
70
|
+
export function readableInk(
|
|
71
|
+
background: string,
|
|
72
|
+
options: ReadableInkOptions = {},
|
|
73
|
+
): string {
|
|
74
|
+
const { dark = DARK_INK, light = LIGHT_INK } = options;
|
|
75
|
+
return contrastRatio(background, dark) >= contrastRatio(background, light)
|
|
76
|
+
? dark
|
|
77
|
+
: light;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function linearize(channel: number): number {
|
|
81
|
+
const value = channel / 255;
|
|
82
|
+
return value <= LINEAR_THRESHOLD
|
|
83
|
+
? value / 12.92
|
|
84
|
+
: ((value + 0.055) / 1.055) ** 2.4;
|
|
85
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const HEX_COLOR = /^#(?:[\da-f]{3}|[\da-f]{6})$/i;
|
|
2
|
+
const SHORT_LENGTH = 3;
|
|
3
|
+
const MAXIMUM_CHANNEL = 255;
|
|
4
|
+
|
|
5
|
+
/** The three channels of a colour, each from 0 to 255. */
|
|
6
|
+
export interface RgbColor {
|
|
7
|
+
/** Red channel. */
|
|
8
|
+
red: number;
|
|
9
|
+
/** Green channel. */
|
|
10
|
+
green: number;
|
|
11
|
+
/** Blue channel. */
|
|
12
|
+
blue: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Read a `#rgb` or `#rrggbb` colour into its three channels.
|
|
17
|
+
* @param color - A hex colour with its leading `#`, in either the short or the long form.
|
|
18
|
+
* @returns The three channels, each from 0 to 255.
|
|
19
|
+
* @throws {Error} When the string is not a hex colour, naming the value that was read.
|
|
20
|
+
*/
|
|
21
|
+
export function parseHexColor(color: string): RgbColor {
|
|
22
|
+
const text = typeof color === 'string' ? color.trim() : '';
|
|
23
|
+
if (!HEX_COLOR.test(text)) {
|
|
24
|
+
throw new Error(`not a hex colour: ${color}`);
|
|
25
|
+
}
|
|
26
|
+
const digits = text.slice(1);
|
|
27
|
+
const size = digits.length === SHORT_LENGTH ? 1 : 2;
|
|
28
|
+
return {
|
|
29
|
+
red: channelAt(digits, 0, size),
|
|
30
|
+
green: channelAt(digits, 1, size),
|
|
31
|
+
blue: channelAt(digits, 2, size),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Write three channels back as a `#rrggbb` colour.
|
|
37
|
+
*
|
|
38
|
+
* Each channel is rounded and held inside 0..255, so the result of an
|
|
39
|
+
* interpolation is always a colour a browser accepts.
|
|
40
|
+
* @param color - The three channels.
|
|
41
|
+
* @returns The lower-case six-digit hex colour.
|
|
42
|
+
*/
|
|
43
|
+
export function toHexColor(color: RgbColor): string {
|
|
44
|
+
return `#${channelHex(color.red)}${channelHex(color.green)}${channelHex(color.blue)}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function channelAt(digits: string, index: number, size: number): number {
|
|
48
|
+
const part = digits.slice(index * size, index * size + size);
|
|
49
|
+
return Number.parseInt(size === 1 ? `${part}${part}` : part, 16);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function channelHex(value: number): string {
|
|
53
|
+
const safe = Number.isFinite(value)
|
|
54
|
+
? Math.min(MAXIMUM_CHANNEL, Math.max(0, Math.round(value)))
|
|
55
|
+
: 0;
|
|
56
|
+
return safe.toString(16).padStart(2, '0');
|
|
57
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ReadableInkOptions } from './contrast.ts';
|
|
2
|
+
export { contrastRatio, readableInk, relativeLuminance } from './contrast.ts';
|
|
3
|
+
export type { PositionInRangeOptions, Swatch } from './scale.ts';
|
|
4
|
+
export { VIRIDIS_SCALE, positionInRange, swatchFromScale } from './scale.ts';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ReadableInkOptions } from './contrast.ts';
|
|
2
|
+
import { readableInk } from './contrast.ts';
|
|
3
|
+
import { parseHexColor, toHexColor } from './hex.ts';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Viridis, sampled at nine stops.
|
|
7
|
+
*
|
|
8
|
+
* It stays readable under the common colour deficiencies and is monotone in
|
|
9
|
+
* lightness, so a greyscale print of the same figure still orders the values.
|
|
10
|
+
*/
|
|
11
|
+
export const VIRIDIS_SCALE: readonly string[] = [
|
|
12
|
+
'#440154',
|
|
13
|
+
'#482878',
|
|
14
|
+
'#3e4a89',
|
|
15
|
+
'#31688e',
|
|
16
|
+
'#26828e',
|
|
17
|
+
'#1f9e89',
|
|
18
|
+
'#35b779',
|
|
19
|
+
'#6dcd59',
|
|
20
|
+
'#b4de2c',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
/** A colour, and the ink that stays readable on it. */
|
|
24
|
+
export interface Swatch {
|
|
25
|
+
/** The colour behind the value. */
|
|
26
|
+
background: string;
|
|
27
|
+
/** The ink to write the value in. */
|
|
28
|
+
foreground: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** How {@link positionInRange} places a value. */
|
|
32
|
+
export interface PositionInRangeOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Whether to place the value on a base-10 logarithmic scale, for a quantity
|
|
35
|
+
* — an abundance, a density, a concentration — spread over so many decades
|
|
36
|
+
* that a linear placement gives all but a couple of values the same colour.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
logarithmic?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Where a value sits between two bounds.
|
|
44
|
+
* @param value - The value to place.
|
|
45
|
+
* @param min - The smallest value the range holds.
|
|
46
|
+
* @param max - The largest value it holds.
|
|
47
|
+
* @param options - See {@link PositionInRangeOptions}.
|
|
48
|
+
* @returns A fraction clamped to 0..1; the middle when the range holds a single value, and 0 when any of the three numbers is not finite.
|
|
49
|
+
*/
|
|
50
|
+
export function positionInRange(
|
|
51
|
+
value: number,
|
|
52
|
+
min: number,
|
|
53
|
+
max: number,
|
|
54
|
+
options: PositionInRangeOptions = {},
|
|
55
|
+
): number {
|
|
56
|
+
const { logarithmic = false } = options;
|
|
57
|
+
if (
|
|
58
|
+
!Number.isFinite(value) ||
|
|
59
|
+
!Number.isFinite(min) ||
|
|
60
|
+
!Number.isFinite(max)
|
|
61
|
+
) {
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
if (max === min) return 0.5;
|
|
65
|
+
if (!logarithmic) return clampUnit((value - min) / (max - min));
|
|
66
|
+
|
|
67
|
+
const floor = Math.max(min, smallestPositive(min, max));
|
|
68
|
+
const span = Math.log10(max) - Math.log10(floor);
|
|
69
|
+
if (span === 0) return 0.5;
|
|
70
|
+
return clampUnit(
|
|
71
|
+
(Math.log10(Math.max(value, floor)) - Math.log10(floor)) / span,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The colour a scale takes at a position, interpolated between its stops.
|
|
77
|
+
* @param stops - The scale's colours, from its low end to its high end, as `#rgb` or `#rrggbb`.
|
|
78
|
+
* @param position - Where on the scale to read, from 0 to 1; anything outside is clamped.
|
|
79
|
+
* @returns The colour at that position, as `#rrggbb`.
|
|
80
|
+
* @throws {Error} When the scale has no stops, or a stop is not a hex colour.
|
|
81
|
+
*/
|
|
82
|
+
export function colorFromScale(
|
|
83
|
+
stops: readonly string[],
|
|
84
|
+
position: number,
|
|
85
|
+
): string {
|
|
86
|
+
if (stops.length === 0) {
|
|
87
|
+
throw new Error('a colour scale needs at least one stop');
|
|
88
|
+
}
|
|
89
|
+
const scaled = clampUnit(position) * (stops.length - 1);
|
|
90
|
+
const lowerIndex = Math.floor(scaled);
|
|
91
|
+
const start = stops[lowerIndex];
|
|
92
|
+
const end = stops[Math.min(lowerIndex + 1, stops.length - 1)];
|
|
93
|
+
if (start === undefined || end === undefined) {
|
|
94
|
+
throw new Error(`no colour at position ${String(position)}`);
|
|
95
|
+
}
|
|
96
|
+
const from = parseHexColor(start);
|
|
97
|
+
const to = parseHexColor(end);
|
|
98
|
+
const ratio = scaled - lowerIndex;
|
|
99
|
+
return toHexColor({
|
|
100
|
+
red: from.red + (to.red - from.red) * ratio,
|
|
101
|
+
green: from.green + (to.green - from.green) * ratio,
|
|
102
|
+
blue: from.blue + (to.blue - from.blue) * ratio,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The colour a scale takes at a position, together with the ink to write on it.
|
|
108
|
+
* @param stops - The scale's colours, from its low end to its high end.
|
|
109
|
+
* @param position - Where on the scale to read, from 0 to 1; anything outside is clamped.
|
|
110
|
+
* @param options - See {@link ReadableInkOptions}.
|
|
111
|
+
* @returns The background and the readable ink.
|
|
112
|
+
* @throws {Error} When the scale has no stops, or a stop is not a hex colour.
|
|
113
|
+
*/
|
|
114
|
+
export function swatchFromScale(
|
|
115
|
+
stops: readonly string[],
|
|
116
|
+
position: number,
|
|
117
|
+
options: ReadableInkOptions = {},
|
|
118
|
+
): Swatch {
|
|
119
|
+
const background = colorFromScale(stops, position);
|
|
120
|
+
return { background, foreground: readableInk(background, options) };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function clampUnit(value: number): number {
|
|
124
|
+
if (!Number.isFinite(value)) return 0;
|
|
125
|
+
return Math.min(1, Math.max(0, value));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function smallestPositive(min: number, max: number): number {
|
|
129
|
+
if (min > 0) return min;
|
|
130
|
+
if (max <= 0) return 1;
|
|
131
|
+
return max * 1e-12;
|
|
132
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
|
|
4
|
+
import { formatTrimmed } from '../../format/core/numbers.ts';
|
|
5
|
+
|
|
6
|
+
const FALLBACK_STOPS: readonly string[] = ['#e4e8ee'];
|
|
7
|
+
const BAR_HEIGHT = 12;
|
|
8
|
+
const BAR_WIDTH = 100;
|
|
9
|
+
|
|
10
|
+
/** What {@link ColorScaleLegend} needs to draw a scale. */
|
|
11
|
+
export interface ColorScaleLegendProps {
|
|
12
|
+
/** The scale's colours, from its low end to its high end. */
|
|
13
|
+
stops: readonly string[];
|
|
14
|
+
/** The value the low end stands for. */
|
|
15
|
+
min: number;
|
|
16
|
+
/** The value the high end stands for. */
|
|
17
|
+
max: number;
|
|
18
|
+
/**
|
|
19
|
+
* Unit written after each end value, e.g. `g/mol`.
|
|
20
|
+
* @default '' — no unit is written
|
|
21
|
+
*/
|
|
22
|
+
unit?: string;
|
|
23
|
+
/**
|
|
24
|
+
* What the scale measures, written before it.
|
|
25
|
+
* @default '' — no label is written
|
|
26
|
+
*/
|
|
27
|
+
label?: string;
|
|
28
|
+
/**
|
|
29
|
+
* How an end value is written.
|
|
30
|
+
* @default a rounding to three decimals with the trailing zeros dropped
|
|
31
|
+
*/
|
|
32
|
+
formatValue?: (value: number) => string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The key to a sequential colour scale: its two end values, and the ramp
|
|
37
|
+
* between them.
|
|
38
|
+
*
|
|
39
|
+
* The ramp is a real gradient rather than a row of buckets, and both ends
|
|
40
|
+
* carry their value, so a figure lifted out of the page still says what it is
|
|
41
|
+
* measuring. It is drawn as an SVG, which keeps it crisp in a print and in an
|
|
42
|
+
* exported image.
|
|
43
|
+
* @param props - See {@link ColorScaleLegendProps}.
|
|
44
|
+
* @returns The labelled gradient strip.
|
|
45
|
+
*/
|
|
46
|
+
export function ColorScaleLegend(props: ColorScaleLegendProps): ReactElement {
|
|
47
|
+
const {
|
|
48
|
+
stops,
|
|
49
|
+
min,
|
|
50
|
+
max,
|
|
51
|
+
unit = '',
|
|
52
|
+
label = '',
|
|
53
|
+
formatValue = defaultFormatValue,
|
|
54
|
+
} = props;
|
|
55
|
+
const gradientId = useId();
|
|
56
|
+
|
|
57
|
+
const scale = stops.length === 0 ? FALLBACK_STOPS : stops;
|
|
58
|
+
const low = withUnit(formatValue(min), unit);
|
|
59
|
+
const high = withUnit(formatValue(max), unit);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div style={ROW_STYLE}>
|
|
63
|
+
{label === '' ? null : <span style={LABEL_STYLE}>{label}</span>}
|
|
64
|
+
<span style={VALUE_STYLE}>{low}</span>
|
|
65
|
+
<svg
|
|
66
|
+
style={BAR_STYLE}
|
|
67
|
+
viewBox={`0 0 ${BAR_WIDTH} ${BAR_HEIGHT}`}
|
|
68
|
+
preserveAspectRatio="none"
|
|
69
|
+
role="img"
|
|
70
|
+
aria-label={`${label === '' ? 'Colour scale' : label} from ${low} to ${high}`}
|
|
71
|
+
>
|
|
72
|
+
<defs>
|
|
73
|
+
<linearGradient id={gradientId} x1="0" y1="0" x2="1" y2="0">
|
|
74
|
+
{gradientStops(scale).map((stop) => (
|
|
75
|
+
<stop
|
|
76
|
+
key={stop.offset}
|
|
77
|
+
offset={stop.offset}
|
|
78
|
+
stopColor={stop.color}
|
|
79
|
+
/>
|
|
80
|
+
))}
|
|
81
|
+
</linearGradient>
|
|
82
|
+
</defs>
|
|
83
|
+
<rect
|
|
84
|
+
x="0"
|
|
85
|
+
y="0"
|
|
86
|
+
width={BAR_WIDTH}
|
|
87
|
+
height={BAR_HEIGHT}
|
|
88
|
+
rx="2"
|
|
89
|
+
fill={`url(#${gradientId})`}
|
|
90
|
+
/>
|
|
91
|
+
</svg>
|
|
92
|
+
<span style={VALUE_STYLE}>{high}</span>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function gradientStops(
|
|
98
|
+
stops: readonly string[],
|
|
99
|
+
): Array<{ offset: number; color: string }> {
|
|
100
|
+
const last = stops.length - 1;
|
|
101
|
+
const rendered: Array<{ offset: number; color: string }> = [];
|
|
102
|
+
for (let index = 0; index < stops.length; index++) {
|
|
103
|
+
const color = stops[index];
|
|
104
|
+
if (color === undefined) continue;
|
|
105
|
+
rendered.push({ offset: last === 0 ? index : index / last, color });
|
|
106
|
+
}
|
|
107
|
+
if (rendered.length === 1) {
|
|
108
|
+
const only = rendered[0];
|
|
109
|
+
if (only !== undefined) rendered.push({ offset: 1, color: only.color });
|
|
110
|
+
}
|
|
111
|
+
return rendered;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function defaultFormatValue(value: number): string {
|
|
115
|
+
return formatTrimmed(value, 3);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function withUnit(value: string, unit: string): string {
|
|
119
|
+
return unit === '' ? value : `${value} ${unit}`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const ROW_STYLE = {
|
|
123
|
+
display: 'flex',
|
|
124
|
+
flexWrap: 'wrap',
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
gap: 8,
|
|
127
|
+
} as const satisfies CSSProperties;
|
|
128
|
+
|
|
129
|
+
const LABEL_STYLE = {
|
|
130
|
+
color: 'rgb(95 107 124)',
|
|
131
|
+
fontSize: 12,
|
|
132
|
+
} as const satisfies CSSProperties;
|
|
133
|
+
|
|
134
|
+
const VALUE_STYLE = {
|
|
135
|
+
fontSize: 12,
|
|
136
|
+
fontVariantNumeric: 'tabular-nums',
|
|
137
|
+
} as const satisfies CSSProperties;
|
|
138
|
+
|
|
139
|
+
const BAR_STYLE = {
|
|
140
|
+
display: 'inline-block',
|
|
141
|
+
flex: '1 1 160px',
|
|
142
|
+
maxWidth: 320,
|
|
143
|
+
height: BAR_HEIGHT,
|
|
144
|
+
} as const satisfies CSSProperties;
|
package/src/core.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export * from './citation/core/index.ts';
|
|
2
|
+
export * from './clipboard/core/index.ts';
|
|
3
|
+
export * from './color/core/index.ts';
|
|
4
|
+
export * from './credits/core/index.ts';
|
|
5
|
+
export * from './delimited/core/index.ts';
|
|
6
|
+
export * from './download/core/index.ts';
|
|
2
7
|
export * from './ecosystem/core/index.ts';
|
|
8
|
+
export * from './format/core/index.ts';
|
|
3
9
|
export * from './orbital/core/index.ts';
|
|
10
|
+
export * from './pedagogy/core/index.ts';
|
|
11
|
+
export * from './router/core/index.ts';
|
|
12
|
+
export * from './seo/core/index.ts';
|
|
13
|
+
export * from './share/core/index.ts';
|
|
14
|
+
export * from './worker/core/index.ts';
|