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,60 @@
|
|
|
1
|
+
import { MISSING_VALUE } from './missing.ts';
|
|
2
|
+
|
|
3
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'] as const;
|
|
4
|
+
const BYTES_PER_UNIT = 1024;
|
|
5
|
+
const SECONDS_PER_MINUTE = 60;
|
|
6
|
+
const MINUTES_PER_HOUR = 60;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A byte count in the largest unit that keeps it under a thousand: `512 B`,
|
|
10
|
+
* `1.5 kB`, `240 MB`.
|
|
11
|
+
*
|
|
12
|
+
* Bytes are whole; every larger unit keeps one decimal until the number
|
|
13
|
+
* reaches a hundred, where the decimal stops carrying information.
|
|
14
|
+
* @param bytes - The size in bytes.
|
|
15
|
+
* @returns The size and its unit, or the missing marker when there is no finite, non-negative size.
|
|
16
|
+
*/
|
|
17
|
+
export function formatBytes(bytes: number | undefined): string {
|
|
18
|
+
if (bytes === undefined || !Number.isFinite(bytes) || bytes < 0) {
|
|
19
|
+
return MISSING_VALUE;
|
|
20
|
+
}
|
|
21
|
+
let value = bytes;
|
|
22
|
+
let unitIndex = 0;
|
|
23
|
+
while (value >= BYTES_PER_UNIT && unitIndex < BYTE_UNITS.length - 1) {
|
|
24
|
+
value /= BYTES_PER_UNIT;
|
|
25
|
+
unitIndex += 1;
|
|
26
|
+
}
|
|
27
|
+
const digits = unitIndex === 0 || value >= 100 ? 0 : 1;
|
|
28
|
+
return `${value.toFixed(digits)} ${BYTE_UNITS[unitIndex] ?? 'B'}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A duration written with its two largest units: `45s`, `3m 20s`, `2h 05m`.
|
|
33
|
+
* @param milliseconds - The duration in milliseconds.
|
|
34
|
+
* @returns The duration, or the missing marker when there is no finite, non-negative duration.
|
|
35
|
+
*/
|
|
36
|
+
export function formatDuration(milliseconds: number | undefined): string {
|
|
37
|
+
if (
|
|
38
|
+
milliseconds === undefined ||
|
|
39
|
+
!Number.isFinite(milliseconds) ||
|
|
40
|
+
milliseconds < 0
|
|
41
|
+
) {
|
|
42
|
+
return MISSING_VALUE;
|
|
43
|
+
}
|
|
44
|
+
const seconds = Math.round(milliseconds / 1000);
|
|
45
|
+
if (seconds < SECONDS_PER_MINUTE) return `${seconds}s`;
|
|
46
|
+
|
|
47
|
+
const minutes = Math.floor(seconds / SECONDS_PER_MINUTE);
|
|
48
|
+
const remainingSeconds = seconds % SECONDS_PER_MINUTE;
|
|
49
|
+
if (minutes < MINUTES_PER_HOUR) {
|
|
50
|
+
return `${minutes}m ${pad(remainingSeconds)}s`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const hours = Math.floor(minutes / MINUTES_PER_HOUR);
|
|
54
|
+
const remainingMinutes = minutes % MINUTES_PER_HOUR;
|
|
55
|
+
return `${hours}h ${pad(remainingMinutes)}m`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function pad(value: number): string {
|
|
59
|
+
return value.toString().padStart(2, '0');
|
|
60
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The noun that agrees with a count.
|
|
3
|
+
*
|
|
4
|
+
* Only the noun comes back, never the number, so the caller decides how the
|
|
5
|
+
* count itself is written: `${formatInteger(n)} ${pluralize(n, 'structure')}`.
|
|
6
|
+
* @param count - How many there are.
|
|
7
|
+
* @param singular - The noun for exactly one.
|
|
8
|
+
* @param plural - The noun for any other count. Defaults to the singular with an `s`.
|
|
9
|
+
* @returns The singular for a count of one, the plural otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export function pluralize(
|
|
12
|
+
count: number,
|
|
13
|
+
singular: string,
|
|
14
|
+
plural = `${singular}s`,
|
|
15
|
+
): string {
|
|
16
|
+
return count === 1 ? singular : plural;
|
|
17
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** A worked example under a piece of help: the construct, and what it does. */
|
|
4
|
+
export interface HelpExample {
|
|
5
|
+
/** The construct itself, shown in monospace. */
|
|
6
|
+
code: string;
|
|
7
|
+
/**
|
|
8
|
+
* What the construct is applied to, when showing it alone is half a
|
|
9
|
+
* demonstration.
|
|
10
|
+
* @default undefined
|
|
11
|
+
*/
|
|
12
|
+
input?: string;
|
|
13
|
+
/**
|
|
14
|
+
* One line saying what the example demonstrates.
|
|
15
|
+
* @default undefined
|
|
16
|
+
*/
|
|
17
|
+
note?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Everything a piece of help says, wherever it is shown. */
|
|
21
|
+
export interface HelpContent {
|
|
22
|
+
/** First line, in bold: what the thing is, not what its label already says. */
|
|
23
|
+
title: string;
|
|
24
|
+
/** The explanation, one or two sentences. */
|
|
25
|
+
body: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* A concrete case, because a definition without one is what makes a reader
|
|
28
|
+
* give up.
|
|
29
|
+
* @default undefined
|
|
30
|
+
*/
|
|
31
|
+
example?: HelpExample;
|
|
32
|
+
/**
|
|
33
|
+
* Where the full documentation lives, offered as a "Learn more" link.
|
|
34
|
+
* @default undefined
|
|
35
|
+
*/
|
|
36
|
+
link?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What {@link HelpBody} draws. */
|
|
40
|
+
export interface HelpBodyProps {
|
|
41
|
+
/** The help to render. */
|
|
42
|
+
content: HelpContent;
|
|
43
|
+
/**
|
|
44
|
+
* How wide the body is allowed to be, in pixels. A tooltip needs a cap; a
|
|
45
|
+
* dialog does not.
|
|
46
|
+
* @default 280
|
|
47
|
+
*/
|
|
48
|
+
width?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The one rendering of a piece of help.
|
|
53
|
+
*
|
|
54
|
+
* A tooltip, a glyph and a toolbar button all draw this, so a construct
|
|
55
|
+
* documented once reads identically wherever it is referenced and cannot drift
|
|
56
|
+
* between two of its mentions.
|
|
57
|
+
* @param props - See {@link HelpBodyProps}.
|
|
58
|
+
* @returns The help body.
|
|
59
|
+
*/
|
|
60
|
+
export function HelpBody(props: HelpBodyProps): ReactElement {
|
|
61
|
+
const { content, width = DEFAULT_WIDTH } = props;
|
|
62
|
+
const { title, body, example, link } = content;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className="help-body" style={{ ...BODY_STYLE, maxWidth: width }}>
|
|
66
|
+
<div style={TITLE_STYLE}>{title}</div>
|
|
67
|
+
<div style={TEXT_STYLE}>{body}</div>
|
|
68
|
+
{example === undefined ? null : (
|
|
69
|
+
<div style={EXAMPLE_STYLE}>
|
|
70
|
+
<code style={CODE_STYLE}>{example.code}</code>
|
|
71
|
+
{example.input === undefined ? null : (
|
|
72
|
+
<div style={INPUT_STYLE}>
|
|
73
|
+
on <code style={CODE_STYLE}>{example.input}</code>
|
|
74
|
+
</div>
|
|
75
|
+
)}
|
|
76
|
+
{example.note === undefined ? null : (
|
|
77
|
+
<div style={NOTE_STYLE}>{example.note}</div>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
{link === undefined ? null : (
|
|
82
|
+
<a
|
|
83
|
+
href={link}
|
|
84
|
+
target="_blank"
|
|
85
|
+
rel="noopener noreferrer"
|
|
86
|
+
style={LINK_STYLE}
|
|
87
|
+
>
|
|
88
|
+
Learn more
|
|
89
|
+
</a>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** How wide a piece of help is drawn when the caller does not say. */
|
|
96
|
+
const DEFAULT_WIDTH = 280;
|
|
97
|
+
|
|
98
|
+
const BODY_STYLE = {
|
|
99
|
+
display: 'flex',
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
gap: 6,
|
|
102
|
+
} as const satisfies CSSProperties;
|
|
103
|
+
|
|
104
|
+
const TITLE_STYLE = { fontWeight: 600 } as const satisfies CSSProperties;
|
|
105
|
+
|
|
106
|
+
const TEXT_STYLE = {
|
|
107
|
+
fontWeight: 400,
|
|
108
|
+
lineHeight: 1.45,
|
|
109
|
+
} as const satisfies CSSProperties;
|
|
110
|
+
|
|
111
|
+
const EXAMPLE_STYLE = {
|
|
112
|
+
display: 'flex',
|
|
113
|
+
flexDirection: 'column',
|
|
114
|
+
gap: 2,
|
|
115
|
+
fontWeight: 400,
|
|
116
|
+
} as const satisfies CSSProperties;
|
|
117
|
+
|
|
118
|
+
const CODE_STYLE = {
|
|
119
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
|
|
120
|
+
fontSize: 12,
|
|
121
|
+
} as const satisfies CSSProperties;
|
|
122
|
+
|
|
123
|
+
const INPUT_STYLE = { fontSize: 12 } as const satisfies CSSProperties;
|
|
124
|
+
|
|
125
|
+
const NOTE_STYLE = {
|
|
126
|
+
fontSize: 12,
|
|
127
|
+
fontStyle: 'italic',
|
|
128
|
+
} as const satisfies CSSProperties;
|
|
129
|
+
|
|
130
|
+
const LINK_STYLE = { fontWeight: 400 } as const satisfies CSSProperties;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Icon } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { HelpContent } from './HelpBody.tsx';
|
|
5
|
+
import { HelpTooltip } from './HelpTooltip.tsx';
|
|
6
|
+
|
|
7
|
+
/** What {@link HelpIcon} explains, and how big the glyph is. */
|
|
8
|
+
export interface HelpIconProps {
|
|
9
|
+
/** The help the glyph reveals. */
|
|
10
|
+
content: HelpContent;
|
|
11
|
+
/**
|
|
12
|
+
* Size of the glyph in pixels, so it sits on the line of the label it
|
|
13
|
+
* follows.
|
|
14
|
+
* @default 13
|
|
15
|
+
*/
|
|
16
|
+
size?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Which side the help opens on.
|
|
19
|
+
* @default 'right'
|
|
20
|
+
*/
|
|
21
|
+
placement?: 'top' | 'right' | 'bottom' | 'left';
|
|
22
|
+
/**
|
|
23
|
+
* Class the glyph carries, in addition to `help-icon`.
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The small question mark that sits beside a field label.
|
|
31
|
+
*
|
|
32
|
+
* It is reachable by tab, so the explanation is not reserved to whoever is
|
|
33
|
+
* holding a pointer.
|
|
34
|
+
* @param props - See {@link HelpIconProps}.
|
|
35
|
+
* @returns The glyph and its help.
|
|
36
|
+
*/
|
|
37
|
+
export function HelpIcon(props: HelpIconProps): ReactElement {
|
|
38
|
+
const { content, size = 13, placement = 'right', className } = props;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<HelpTooltip content={content} placement={placement}>
|
|
42
|
+
<Icon
|
|
43
|
+
icon="help"
|
|
44
|
+
size={size}
|
|
45
|
+
tabIndex={0}
|
|
46
|
+
aria-label={content.title}
|
|
47
|
+
className={
|
|
48
|
+
className === undefined ? 'help-icon' : `help-icon ${className}`
|
|
49
|
+
}
|
|
50
|
+
/>
|
|
51
|
+
</HelpTooltip>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { IconName } from '@blueprintjs/core';
|
|
2
|
+
import { Button } from '@blueprintjs/core';
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { HelpContent } from './HelpBody.tsx';
|
|
6
|
+
import { HelpTooltip } from './HelpTooltip.tsx';
|
|
7
|
+
|
|
8
|
+
/** What {@link HelpToolbarButton} explains, and what pressing it does. */
|
|
9
|
+
export interface HelpToolbarButtonProps {
|
|
10
|
+
/** The help the button reveals on hover. */
|
|
11
|
+
content: HelpContent;
|
|
12
|
+
/**
|
|
13
|
+
* What pressing the button does — usually opening the guide the tooltip
|
|
14
|
+
* summarises. Left out for a button that only explains itself.
|
|
15
|
+
* @default undefined — the button does nothing when pressed
|
|
16
|
+
*/
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Text beside the glyph. Left out for a toolbar that has run out of room.
|
|
20
|
+
* @default undefined — the button is reduced to its glyph
|
|
21
|
+
*/
|
|
22
|
+
label?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Glyph of the button.
|
|
25
|
+
* @default 'help'
|
|
26
|
+
*/
|
|
27
|
+
icon?: IconName;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the button is the small size a dense toolbar needs.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
small?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Class the button carries.
|
|
35
|
+
* @default undefined
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The help entry of a toolbar: a glyph that explains itself on hover and opens
|
|
42
|
+
* the full guide when pressed.
|
|
43
|
+
*
|
|
44
|
+
* It shows the same body as the glyph beside a field and as any other mention
|
|
45
|
+
* of that help, so a construct is documented in one place.
|
|
46
|
+
* @param props - See {@link HelpToolbarButtonProps}.
|
|
47
|
+
* @returns The toolbar button and its help.
|
|
48
|
+
*/
|
|
49
|
+
export function HelpToolbarButton(props: HelpToolbarButtonProps): ReactElement {
|
|
50
|
+
const {
|
|
51
|
+
content,
|
|
52
|
+
onClick,
|
|
53
|
+
label,
|
|
54
|
+
icon = 'help',
|
|
55
|
+
small = false,
|
|
56
|
+
className,
|
|
57
|
+
} = props;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<HelpTooltip content={content} placement="bottom">
|
|
61
|
+
<Button
|
|
62
|
+
variant="minimal"
|
|
63
|
+
size={small ? 'small' : 'medium'}
|
|
64
|
+
icon={icon}
|
|
65
|
+
text={label}
|
|
66
|
+
aria-label={label ?? content.title}
|
|
67
|
+
className={className}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
/>
|
|
70
|
+
</HelpTooltip>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { TooltipProps } from '@blueprintjs/core';
|
|
2
|
+
import { Tooltip } from '@blueprintjs/core';
|
|
3
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { HelpContent } from './HelpBody.tsx';
|
|
6
|
+
import { HelpBody } from './HelpBody.tsx';
|
|
7
|
+
|
|
8
|
+
/** What {@link HelpTooltip} wraps, and what it says about it. */
|
|
9
|
+
export interface HelpTooltipProps {
|
|
10
|
+
/** The help shown when the pointer rests on the target. */
|
|
11
|
+
content: HelpContent;
|
|
12
|
+
/** What the help is about. */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Which side the tooltip opens on.
|
|
16
|
+
* @default 'top'
|
|
17
|
+
*/
|
|
18
|
+
placement?: TooltipProps['placement'];
|
|
19
|
+
/**
|
|
20
|
+
* How wide the body is allowed to be, in pixels.
|
|
21
|
+
* @default 280
|
|
22
|
+
*/
|
|
23
|
+
width?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Class the tooltip popover carries, in addition to `help-tooltip`.
|
|
26
|
+
* @default undefined
|
|
27
|
+
*/
|
|
28
|
+
popoverClassName?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A piece of help attached to whatever it explains.
|
|
33
|
+
*
|
|
34
|
+
* The delay before it opens is long enough that sweeping the pointer across a
|
|
35
|
+
* row of controls opens nothing, and help carrying a link stays open long
|
|
36
|
+
* enough for the pointer to reach the link.
|
|
37
|
+
* @param props - See {@link HelpTooltipProps}.
|
|
38
|
+
* @returns The target, with its help.
|
|
39
|
+
*/
|
|
40
|
+
export function HelpTooltip(props: HelpTooltipProps): ReactElement {
|
|
41
|
+
const {
|
|
42
|
+
content,
|
|
43
|
+
children,
|
|
44
|
+
placement = 'top',
|
|
45
|
+
width,
|
|
46
|
+
popoverClassName,
|
|
47
|
+
} = props;
|
|
48
|
+
const hasLink = content.link !== undefined;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Tooltip
|
|
52
|
+
content={<HelpBody content={content} width={width} />}
|
|
53
|
+
placement={placement}
|
|
54
|
+
hoverOpenDelay={HOVER_OPEN_DELAY}
|
|
55
|
+
hoverCloseDelay={hasLink ? HOVER_CLOSE_DELAY : 0}
|
|
56
|
+
interactionKind={hasLink ? 'hover' : 'hover-target'}
|
|
57
|
+
targetTagName="span"
|
|
58
|
+
popoverClassName={
|
|
59
|
+
popoverClassName === undefined
|
|
60
|
+
? 'help-tooltip'
|
|
61
|
+
: `help-tooltip ${popoverClassName}`
|
|
62
|
+
}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</Tooltip>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Long enough that sweeping the pointer across a row of controls opens nothing.
|
|
70
|
+
const HOVER_OPEN_DELAY = 250;
|
|
71
|
+
// Help carrying a link has to outlive the pointer leaving its target.
|
|
72
|
+
const HOVER_CLOSE_DELAY = 300;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { HelpBodyProps, HelpContent, HelpExample } from './HelpBody.tsx';
|
|
2
|
+
export { HelpBody } from './HelpBody.tsx';
|
|
3
|
+
export type { HelpIconProps } from './HelpIcon.tsx';
|
|
4
|
+
export { HelpIcon } from './HelpIcon.tsx';
|
|
5
|
+
export type { HelpToolbarButtonProps } from './HelpToolbarButton.tsx';
|
|
6
|
+
export { HelpToolbarButton } from './HelpToolbarButton.tsx';
|
|
7
|
+
export type { HelpTooltipProps } from './HelpTooltip.tsx';
|
|
8
|
+
export { HelpTooltip } from './HelpTooltip.tsx';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useContainerSize } from './useContainerSize.ts';
|
|
2
|
+
export { useDebouncedValue } from './useDebouncedValue.ts';
|
|
3
|
+
export type { ListKeyboardNavigationOptions } from './useListKeyboardNavigation.ts';
|
|
4
|
+
export { useListKeyboardNavigation } from './useListKeyboardNavigation.ts';
|
|
5
|
+
export type { ElementSize } from './useResizeObserver.ts';
|
|
6
|
+
export { useResizeObserver } from './useResizeObserver.ts';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** The default number of entries `PageUp` and `PageDown` move by. */
|
|
2
|
+
export const DEFAULT_PAGE_STEP = 10;
|
|
3
|
+
|
|
4
|
+
/** How a list stands when a key reaches it. */
|
|
5
|
+
export interface ListNavigationOptions {
|
|
6
|
+
/** Number of entries currently displayed. */
|
|
7
|
+
length: number;
|
|
8
|
+
/** Index of the selected entry, or `-1` when nothing is selected. */
|
|
9
|
+
selectedIndex: number;
|
|
10
|
+
/**
|
|
11
|
+
* How many entries `PageUp` and `PageDown` move by. A value below one, or
|
|
12
|
+
* one that is not a number, falls back to the default.
|
|
13
|
+
* @default 10
|
|
14
|
+
*/
|
|
15
|
+
pageStep?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The subset of a keyboard event list navigation reads. */
|
|
19
|
+
export interface ListNavigationKeyEvent {
|
|
20
|
+
/** The key that was pressed. */
|
|
21
|
+
key: string;
|
|
22
|
+
/** What the event was aimed at, used to leave typing alone. */
|
|
23
|
+
target?: EventTarget | null;
|
|
24
|
+
/** Stops the browser scrolling the page under the list. */
|
|
25
|
+
preventDefault: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** What {@link handleListNavigationKey} needs on top of the list's shape. */
|
|
29
|
+
export interface ListNavigationHandlerOptions extends ListNavigationOptions {
|
|
30
|
+
/** Called with the index the key moved the selection to. */
|
|
31
|
+
onSelect: (index: number) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The entry a navigation key selects.
|
|
36
|
+
*
|
|
37
|
+
* `ArrowDown` and `ArrowUp` move one step, `PageDown` and `PageUp` move
|
|
38
|
+
* `pageStep`, `Home` and `End` jump to the ends, and every result is clamped
|
|
39
|
+
* into the list. With nothing selected, moving down enters at the top and
|
|
40
|
+
* moving up enters at the bottom.
|
|
41
|
+
* @param key - The `key` of the keyboard event.
|
|
42
|
+
* @param options - See {@link ListNavigationOptions}.
|
|
43
|
+
* @returns The index to select — which may be the current one — or `null` when
|
|
44
|
+
* the key means nothing to a list.
|
|
45
|
+
*/
|
|
46
|
+
export function nextSelectedIndex(
|
|
47
|
+
key: string,
|
|
48
|
+
options: ListNavigationOptions,
|
|
49
|
+
): number | null {
|
|
50
|
+
const { length, selectedIndex, pageStep } = options;
|
|
51
|
+
if (!Number.isFinite(length) || length <= 0) return null;
|
|
52
|
+
const step =
|
|
53
|
+
typeof pageStep === 'number' && Number.isFinite(pageStep) && pageStep >= 1
|
|
54
|
+
? Math.floor(pageStep)
|
|
55
|
+
: DEFAULT_PAGE_STEP;
|
|
56
|
+
const current =
|
|
57
|
+
selectedIndex >= 0 && selectedIndex < length ? selectedIndex : -1;
|
|
58
|
+
|
|
59
|
+
let target: number;
|
|
60
|
+
switch (key) {
|
|
61
|
+
case 'ArrowDown':
|
|
62
|
+
target = current === -1 ? 0 : current + 1;
|
|
63
|
+
break;
|
|
64
|
+
case 'ArrowUp':
|
|
65
|
+
target = current === -1 ? length - 1 : current - 1;
|
|
66
|
+
break;
|
|
67
|
+
case 'PageDown':
|
|
68
|
+
target = Math.max(current, 0) + step;
|
|
69
|
+
break;
|
|
70
|
+
case 'PageUp':
|
|
71
|
+
target = (current === -1 ? length - 1 : current) - step;
|
|
72
|
+
break;
|
|
73
|
+
case 'Home':
|
|
74
|
+
target = 0;
|
|
75
|
+
break;
|
|
76
|
+
case 'End':
|
|
77
|
+
target = length - 1;
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return Math.min(length - 1, Math.max(0, target));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Move a list's selection from a keyboard event.
|
|
88
|
+
*
|
|
89
|
+
* A key that reaches a text field, a select or an editable region is left
|
|
90
|
+
* alone, so typing a filter inside the list never moves the selection. A key
|
|
91
|
+
* the list acts on has its default suppressed even when the selection does not
|
|
92
|
+
* move, so the page never scrolls out from under the last entry.
|
|
93
|
+
* @param event - The keyboard event, synthetic or native.
|
|
94
|
+
* @param options - See {@link ListNavigationHandlerOptions}.
|
|
95
|
+
*/
|
|
96
|
+
export function handleListNavigationKey(
|
|
97
|
+
event: ListNavigationKeyEvent,
|
|
98
|
+
options: ListNavigationHandlerOptions,
|
|
99
|
+
): void {
|
|
100
|
+
if (isTextEntryTarget(event.target)) return;
|
|
101
|
+
const next = nextSelectedIndex(event.key, options);
|
|
102
|
+
if (next === null) return;
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
if (next !== options.selectedIndex) options.onSelect(next);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const TEXT_ENTRY_TAGS = new Set(['INPUT', 'TEXTAREA', 'SELECT']);
|
|
108
|
+
|
|
109
|
+
function isTextEntryTarget(target: EventTarget | null | undefined): boolean {
|
|
110
|
+
if (target === null || target === undefined) return false;
|
|
111
|
+
const element = target as { tagName?: unknown; isContentEditable?: unknown };
|
|
112
|
+
if (element.isContentEditable === true) return true;
|
|
113
|
+
return (
|
|
114
|
+
typeof element.tagName === 'string' && TEXT_ENTRY_TAGS.has(element.tagName)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { ElementSize } from './useResizeObserver.ts';
|
|
5
|
+
import { useResizeObserver } from './useResizeObserver.ts';
|
|
6
|
+
|
|
7
|
+
const EMPTY_SIZE: ElementSize = { width: 0, height: 0 };
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The current content-box size of an element, as state.
|
|
11
|
+
*
|
|
12
|
+
* The state form of {@link useResizeObserver}, for a chart or a canvas that
|
|
13
|
+
* has to be laid out from the measurement rather than told about it. Both
|
|
14
|
+
* numbers are zero until the element is first measured, and the state is left
|
|
15
|
+
* untouched when a resize reports the same numbers, so a component that sizes
|
|
16
|
+
* itself from the value cannot loop.
|
|
17
|
+
* @param ref - Ref holding the element to measure.
|
|
18
|
+
* @returns Its width and height in CSS pixels.
|
|
19
|
+
*/
|
|
20
|
+
export function useContainerSize(ref: RefObject<Element | null>): ElementSize {
|
|
21
|
+
const [size, setSize] = useState<ElementSize>(EMPTY_SIZE);
|
|
22
|
+
|
|
23
|
+
useResizeObserver(ref, (next) => {
|
|
24
|
+
setSize((current) =>
|
|
25
|
+
current.width === next.width && current.height === next.height
|
|
26
|
+
? current
|
|
27
|
+
: next,
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return size;
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A debounced echo of a fast-changing value.
|
|
5
|
+
*
|
|
6
|
+
* The returned value only catches up once the source has been still for
|
|
7
|
+
* `delayMs`, so a memo, a request or a canvas redraw downstream runs when the
|
|
8
|
+
* user pauses instead of on every keystroke or slider step.
|
|
9
|
+
* @param value - The live value to follow.
|
|
10
|
+
* @param delayMs - Quiet period, in milliseconds, before the value settles. Defaults to `250`.
|
|
11
|
+
* @returns The value as it stood `delayMs` after the last change.
|
|
12
|
+
*/
|
|
13
|
+
export function useDebouncedValue<TValue>(
|
|
14
|
+
value: TValue,
|
|
15
|
+
delayMs = 250,
|
|
16
|
+
): TValue {
|
|
17
|
+
const [debounced, setDebounced] = useState(value);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const handle = setTimeout(() => {
|
|
21
|
+
setDebounced(value);
|
|
22
|
+
}, delayMs);
|
|
23
|
+
return () => {
|
|
24
|
+
clearTimeout(handle);
|
|
25
|
+
};
|
|
26
|
+
}, [value, delayMs]);
|
|
27
|
+
|
|
28
|
+
return debounced;
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { ListNavigationHandlerOptions } from './listNavigation.ts';
|
|
5
|
+
import { handleListNavigationKey } from './listNavigation.ts';
|
|
6
|
+
|
|
7
|
+
/** See {@link ListNavigationHandlerOptions}. */
|
|
8
|
+
export type ListKeyboardNavigationOptions = ListNavigationHandlerOptions;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Keyboard navigation for a list or a table whose selection lives outside it.
|
|
12
|
+
*
|
|
13
|
+
* Put the returned handler on the scrolling container — which needs a
|
|
14
|
+
* `tabIndex` so it can hold the focus — and `ArrowUp` / `ArrowDown` move one
|
|
15
|
+
* entry, `PageUp` / `PageDown` move `pageStep`, and `Home` / `End` jump to the
|
|
16
|
+
* ends. Nothing is stored in the hook: the selection stays wherever the page
|
|
17
|
+
* already keeps it, and `onSelect` fires only when the index actually changes.
|
|
18
|
+
* @param options - See {@link ListNavigationHandlerOptions}.
|
|
19
|
+
* @returns The `onKeyDown` handler for the container.
|
|
20
|
+
*/
|
|
21
|
+
export function useListKeyboardNavigation(
|
|
22
|
+
options: ListKeyboardNavigationOptions,
|
|
23
|
+
): (event: KeyboardEvent<HTMLElement>) => void {
|
|
24
|
+
const { length, selectedIndex, onSelect, pageStep } = options;
|
|
25
|
+
|
|
26
|
+
return useCallback(
|
|
27
|
+
(event: KeyboardEvent<HTMLElement>) => {
|
|
28
|
+
handleListNavigationKey(event, {
|
|
29
|
+
length,
|
|
30
|
+
selectedIndex,
|
|
31
|
+
onSelect,
|
|
32
|
+
pageStep,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
[length, selectedIndex, onSelect, pageStep],
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
/** The content-box size of an element, in CSS pixels. */
|
|
5
|
+
export interface ElementSize {
|
|
6
|
+
/** Content-box width. */
|
|
7
|
+
width: number;
|
|
8
|
+
/** Content-box height. */
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Call `callback` whenever the observed element's content box changes size.
|
|
14
|
+
*
|
|
15
|
+
* The callback is read through a ref, so an inline arrow function may be
|
|
16
|
+
* passed on every render without tearing the observer down and setting it up
|
|
17
|
+
* again. Nothing is observed where `ResizeObserver` is missing — a server
|
|
18
|
+
* render, or a test rendering to a string — so the hook is safe to call there.
|
|
19
|
+
* @param ref - Ref holding the element to watch.
|
|
20
|
+
* @param callback - Receives the new content-box size.
|
|
21
|
+
*/
|
|
22
|
+
export function useResizeObserver(
|
|
23
|
+
ref: RefObject<Element | null>,
|
|
24
|
+
callback: (size: ElementSize) => void,
|
|
25
|
+
): void {
|
|
26
|
+
const callbackRef = useRef(callback);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
callbackRef.current = callback;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const element = ref.current;
|
|
34
|
+
const Observer = globalThis.ResizeObserver as
|
|
35
|
+
typeof ResizeObserver | undefined;
|
|
36
|
+
if (element === null || Observer === undefined) return;
|
|
37
|
+
const observer = new Observer((entries) => {
|
|
38
|
+
const entry = entries.at(-1);
|
|
39
|
+
if (entry === undefined) return;
|
|
40
|
+
callbackRef.current({
|
|
41
|
+
width: entry.contentRect.width,
|
|
42
|
+
height: entry.contentRect.height,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
observer.observe(element);
|
|
46
|
+
return () => {
|
|
47
|
+
observer.disconnect();
|
|
48
|
+
};
|
|
49
|
+
}, [ref]);
|
|
50
|
+
}
|