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,230 @@
|
|
|
1
|
+
import { Button, Tag, Tooltip } from '@blueprintjs/core';
|
|
2
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { ExerciseLevel, TutorialStep } from '../core/types.ts';
|
|
5
|
+
|
|
6
|
+
import { LEVEL_ORDER } from './exerciseMeta.ts';
|
|
7
|
+
import type { TutorialLevelColours } from './tutorialLevels.ts';
|
|
8
|
+
import { TUTORIAL_LEVEL_COLOURS } from './tutorialLevels.ts';
|
|
9
|
+
|
|
10
|
+
export interface TutorialStepStripProps {
|
|
11
|
+
/** The whole tour, in teaching order. */
|
|
12
|
+
steps: readonly TutorialStep[];
|
|
13
|
+
/**
|
|
14
|
+
* Which step is open, as its position in `steps`. A position outside the
|
|
15
|
+
* tour is read as one of its ends, so a hand-edited link still opens.
|
|
16
|
+
*/
|
|
17
|
+
activeIndex: number;
|
|
18
|
+
/** Called with the position of the step to open. */
|
|
19
|
+
onSelect: (index: number) => void;
|
|
20
|
+
/**
|
|
21
|
+
* What each strip is called — `Basics`, `π bonds, planarity, conjugation`.
|
|
22
|
+
* @default undefined — the level names its own strip
|
|
23
|
+
*/
|
|
24
|
+
levelLabels?: Partial<Record<ExerciseLevel, string>>;
|
|
25
|
+
/**
|
|
26
|
+
* Whether Previous and Next sit under the strips. Both exist on purpose: the
|
|
27
|
+
* strips show the shape of the course and let a lecturer jump into it, the
|
|
28
|
+
* pager is how a student actually walks through it.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
pager?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A word after the pager, for a tool whose steps also answer the keyboard.
|
|
34
|
+
* @default undefined
|
|
35
|
+
*/
|
|
36
|
+
pagerHint?: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Class the strips carry, so a site can reach them from its stylesheet.
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The numbered steps of the tour, one coloured strip per level, plus a pager.
|
|
46
|
+
* @param props - The tour, the open step, and how to move.
|
|
47
|
+
* @returns The strips and the pager.
|
|
48
|
+
*/
|
|
49
|
+
export function TutorialStepStrip(props: TutorialStepStripProps): ReactElement {
|
|
50
|
+
const {
|
|
51
|
+
steps,
|
|
52
|
+
activeIndex,
|
|
53
|
+
onSelect,
|
|
54
|
+
levelLabels,
|
|
55
|
+
pager = true,
|
|
56
|
+
pagerHint,
|
|
57
|
+
className,
|
|
58
|
+
} = props;
|
|
59
|
+
const active = clampIndex(activeIndex, steps.length);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className={className} style={ROOT_STYLE}>
|
|
63
|
+
{LEVEL_ORDER.map((level) => {
|
|
64
|
+
const positions = positionsOfLevel(steps, level);
|
|
65
|
+
if (positions.length === 0) return null;
|
|
66
|
+
return (
|
|
67
|
+
<LevelStrip
|
|
68
|
+
key={level}
|
|
69
|
+
steps={steps}
|
|
70
|
+
positions={positions}
|
|
71
|
+
colours={TUTORIAL_LEVEL_COLOURS[level]}
|
|
72
|
+
label={levelLabels?.[level] ?? level}
|
|
73
|
+
activeIndex={active}
|
|
74
|
+
onSelect={onSelect}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
|
|
79
|
+
{pager && (
|
|
80
|
+
<div style={PAGER_STYLE}>
|
|
81
|
+
<Button
|
|
82
|
+
size="small"
|
|
83
|
+
icon="chevron-left"
|
|
84
|
+
text="Previous"
|
|
85
|
+
disabled={active === 0}
|
|
86
|
+
onClick={() => {
|
|
87
|
+
onSelect(active - 1);
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
<Tag minimal round>
|
|
91
|
+
{`Step ${active + 1} of ${steps.length}`}
|
|
92
|
+
</Tag>
|
|
93
|
+
<Button
|
|
94
|
+
size="small"
|
|
95
|
+
endIcon="chevron-right"
|
|
96
|
+
text="Next"
|
|
97
|
+
intent="primary"
|
|
98
|
+
disabled={active >= steps.length - 1}
|
|
99
|
+
onClick={() => {
|
|
100
|
+
onSelect(active + 1);
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
{pagerHint !== undefined && (
|
|
104
|
+
<span style={HINT_STYLE}>{pagerHint}</span>
|
|
105
|
+
)}
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface LevelStripProps {
|
|
113
|
+
steps: readonly TutorialStep[];
|
|
114
|
+
positions: readonly number[];
|
|
115
|
+
colours: TutorialLevelColours;
|
|
116
|
+
label: string;
|
|
117
|
+
activeIndex: number;
|
|
118
|
+
onSelect: (index: number) => void;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function LevelStrip(props: LevelStripProps): ReactElement {
|
|
122
|
+
const { steps, positions, colours, label, activeIndex, onSelect } = props;
|
|
123
|
+
const buttons: ReactNode[] = [];
|
|
124
|
+
for (const position of positions) {
|
|
125
|
+
const step = steps[position] as TutorialStep;
|
|
126
|
+
const active = position === activeIndex;
|
|
127
|
+
buttons.push(
|
|
128
|
+
<Tooltip
|
|
129
|
+
key={step.id}
|
|
130
|
+
content={step.title}
|
|
131
|
+
hoverOpenDelay={HOVER_OPEN_DELAY}
|
|
132
|
+
placement="bottom"
|
|
133
|
+
>
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
aria-label={`Step ${position + 1}: ${step.title}`}
|
|
137
|
+
aria-current={active ? 'step' : undefined}
|
|
138
|
+
style={numberStyle(colours, active)}
|
|
139
|
+
onClick={() => {
|
|
140
|
+
onSelect(position);
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{position + 1}
|
|
144
|
+
</button>
|
|
145
|
+
</Tooltip>,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div style={{ ...STRIP_STYLE, background: colours.background }}>
|
|
151
|
+
<span style={LABEL_STYLE}>{label}</span>
|
|
152
|
+
{buttons}
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function positionsOfLevel(
|
|
158
|
+
steps: readonly TutorialStep[],
|
|
159
|
+
level: ExerciseLevel,
|
|
160
|
+
): number[] {
|
|
161
|
+
const positions: number[] = [];
|
|
162
|
+
for (let index = 0; index < steps.length; index++) {
|
|
163
|
+
if (steps[index]?.level === level) positions.push(index);
|
|
164
|
+
}
|
|
165
|
+
return positions;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function clampIndex(index: number, total: number): number {
|
|
169
|
+
if (!Number.isFinite(index) || index <= 0) return 0;
|
|
170
|
+
return Math.min(Math.floor(index), Math.max(total - 1, 0));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The open step takes the darker shade of its own level, plus a border.
|
|
175
|
+
* @param colours - The two shades of the level the step belongs to.
|
|
176
|
+
* @param active - Whether this is the step on screen.
|
|
177
|
+
* @returns The style of one numbered button.
|
|
178
|
+
*/
|
|
179
|
+
function numberStyle(
|
|
180
|
+
colours: TutorialLevelColours,
|
|
181
|
+
active: boolean,
|
|
182
|
+
): CSSProperties {
|
|
183
|
+
return {
|
|
184
|
+
background: active ? colours.activeBackground : '#ffffff',
|
|
185
|
+
border: active ? '2px solid #1c2127' : '1px solid rgb(17 20 24 / 20%)',
|
|
186
|
+
borderRadius: 4,
|
|
187
|
+
color: '#1c2127',
|
|
188
|
+
cursor: 'pointer',
|
|
189
|
+
font: 'inherit',
|
|
190
|
+
fontSize: 12,
|
|
191
|
+
fontWeight: active ? 700 : 500,
|
|
192
|
+
lineHeight: 1,
|
|
193
|
+
minWidth: 26,
|
|
194
|
+
padding: active ? '5px 6px' : '6px 7px',
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Long enough that the pointer can cross the strip without opening a title. */
|
|
199
|
+
const HOVER_OPEN_DELAY = 150;
|
|
200
|
+
|
|
201
|
+
const ROOT_STYLE: CSSProperties = {
|
|
202
|
+
display: 'flex',
|
|
203
|
+
flexDirection: 'column',
|
|
204
|
+
gap: 4,
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const STRIP_STYLE: CSSProperties = {
|
|
208
|
+
display: 'flex',
|
|
209
|
+
flexWrap: 'wrap',
|
|
210
|
+
alignItems: 'center',
|
|
211
|
+
gap: 4,
|
|
212
|
+
borderRadius: 4,
|
|
213
|
+
padding: '4px 6px',
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const LABEL_STYLE: CSSProperties = {
|
|
217
|
+
flex: '0 0 220px',
|
|
218
|
+
fontSize: 12,
|
|
219
|
+
fontWeight: 600,
|
|
220
|
+
color: '#1c2127',
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const PAGER_STYLE: CSSProperties = {
|
|
224
|
+
display: 'flex',
|
|
225
|
+
alignItems: 'center',
|
|
226
|
+
gap: 8,
|
|
227
|
+
paddingTop: 2,
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const HINT_STYLE: CSSProperties = { color: '#5b6875', fontSize: 11 };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a level and a status look like, in one place.
|
|
3
|
+
*
|
|
4
|
+
* A level means the same thing in the tutorial, in the exercise list and on the
|
|
5
|
+
* cheatsheet, so it is coloured from here rather than decided again per page.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { IconName, Intent } from '@blueprintjs/core';
|
|
9
|
+
|
|
10
|
+
import type { ExerciseLevel, ExerciseStatus } from '../core/types.ts';
|
|
11
|
+
|
|
12
|
+
/** Green for a beginner, amber for an intermediate, red for an advanced one. */
|
|
13
|
+
export const LEVEL_INTENT: Record<ExerciseLevel, Intent> = {
|
|
14
|
+
beginner: 'success',
|
|
15
|
+
intermediate: 'warning',
|
|
16
|
+
advanced: 'danger',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** The three levels in teaching order, for a page listing all of them. */
|
|
20
|
+
export const LEVEL_ORDER: readonly ExerciseLevel[] = [
|
|
21
|
+
'beginner',
|
|
22
|
+
'intermediate',
|
|
23
|
+
'advanced',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/** An empty circle, a warning sign, a tick: untouched, handed in, right. */
|
|
27
|
+
export const STATUS_ICON: Record<ExerciseStatus, IconName> = {
|
|
28
|
+
idle: 'circle',
|
|
29
|
+
attempted: 'warning-sign',
|
|
30
|
+
solved: 'tick-circle',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Colour per status.
|
|
35
|
+
*
|
|
36
|
+
* `idle` is the one uncoloured value in the package: an exercise nobody has
|
|
37
|
+
* opened has nothing to report, and painting it would make a fresh list read as
|
|
38
|
+
* a list of mistakes. Every other value keeps its colour wherever it is shown,
|
|
39
|
+
* including on a tag that is switched off.
|
|
40
|
+
*/
|
|
41
|
+
export const STATUS_INTENT: Record<ExerciseStatus, Intent> = {
|
|
42
|
+
idle: 'none',
|
|
43
|
+
attempted: 'warning',
|
|
44
|
+
solved: 'success',
|
|
45
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the terms a site defines are kept while the page is open.
|
|
3
|
+
*
|
|
4
|
+
* Prose is rendered deep inside a card, a callout or a tooltip, and threading
|
|
5
|
+
* the glossary down to each of those as a prop is what makes a site stop
|
|
6
|
+
* linking its jargon. It is read from the surrounding provider instead.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createContext, useContext } from 'react';
|
|
10
|
+
|
|
11
|
+
import type { Glossary } from '../core/glossary.ts';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The glossary the surrounding provider holds.
|
|
15
|
+
* @returns Every term the site defines, and no term at all when nothing wraps
|
|
16
|
+
* the tree — prose then renders its markers as plain words.
|
|
17
|
+
*/
|
|
18
|
+
export function useGlossary(): Glossary {
|
|
19
|
+
return useContext(GlossaryContext);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Holder of the glossary, written by `GlossaryProvider` and read by prose. */
|
|
23
|
+
export const GlossaryContext = createContext<Glossary>({});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type { ExerciseActionsProps } from './ExerciseActions.tsx';
|
|
2
|
+
export { ExerciseActions } from './ExerciseActions.tsx';
|
|
3
|
+
export type { ExerciseProgressHeaderProps } from './ExerciseProgressHeader.tsx';
|
|
4
|
+
export { ExerciseProgressHeader } from './ExerciseProgressHeader.tsx';
|
|
5
|
+
export type {
|
|
6
|
+
ExerciseLevelTagProps,
|
|
7
|
+
ExerciseStatusIconProps,
|
|
8
|
+
} from './ExerciseTags.tsx';
|
|
9
|
+
export { ExerciseLevelTag, ExerciseStatusIcon } from './ExerciseTags.tsx';
|
|
10
|
+
export { LEVEL_INTENT, LEVEL_ORDER, STATUS_ICON } from './exerciseMeta.ts';
|
|
11
|
+
export type { GlossaryProviderProps } from './GlossaryProvider.tsx';
|
|
12
|
+
export { GlossaryProvider } from './GlossaryProvider.tsx';
|
|
13
|
+
export type { GlossaryTextProps } from './GlossaryText.tsx';
|
|
14
|
+
export { GlossaryText } from './GlossaryText.tsx';
|
|
15
|
+
export { useGlossary } from './glossaryContext.ts';
|
|
16
|
+
export type { HintLadderProps } from './HintLadder.tsx';
|
|
17
|
+
export { HintLadder } from './HintLadder.tsx';
|
|
18
|
+
export type { ReferenceGridProps } from './ReferenceGrid.tsx';
|
|
19
|
+
export { ReferenceGrid } from './ReferenceGrid.tsx';
|
|
20
|
+
export type {
|
|
21
|
+
ReferenceRow,
|
|
22
|
+
ReferenceSection,
|
|
23
|
+
ReferenceSectionBlockProps,
|
|
24
|
+
} from './ReferenceSectionBlock.tsx';
|
|
25
|
+
export { ReferenceSectionBlock } from './ReferenceSectionBlock.tsx';
|
|
26
|
+
export type {
|
|
27
|
+
SyntaxTooltipContent,
|
|
28
|
+
SyntaxTooltipExample,
|
|
29
|
+
SyntaxTooltipProps,
|
|
30
|
+
} from './SyntaxTooltip.tsx';
|
|
31
|
+
export { SyntaxTooltip } from './SyntaxTooltip.tsx';
|
|
32
|
+
export type { TestCaseListProps } from './TestCaseList.tsx';
|
|
33
|
+
export { TestCaseList } from './TestCaseList.tsx';
|
|
34
|
+
export type { TutorialStepStripProps } from './TutorialStepStrip.tsx';
|
|
35
|
+
export { TutorialStepStrip } from './TutorialStepStrip.tsx';
|
|
36
|
+
export type { TutorialLevelColours } from './tutorialLevels.ts';
|
|
37
|
+
export { TUTORIAL_LEVEL_COLOURS } from './tutorialLevels.ts';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two shades each level of the guided tour is painted in.
|
|
3
|
+
*
|
|
4
|
+
* Green, amber, pink — the same three the level tags use, in the pale weights a
|
|
5
|
+
* strip of buttons can sit on. They are shared so a student moving from one of
|
|
6
|
+
* our tools to the next reads the shape of the course the same way.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ExerciseLevel } from '../core/types.ts';
|
|
10
|
+
|
|
11
|
+
/** How one level is painted. */
|
|
12
|
+
export interface TutorialLevelColours {
|
|
13
|
+
/** Behind the whole strip. */
|
|
14
|
+
background: string;
|
|
15
|
+
/** Behind the step that is open, which is the darker of the two. */
|
|
16
|
+
activeBackground: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The palette of the three levels. */
|
|
20
|
+
export const TUTORIAL_LEVEL_COLOURS: Record<
|
|
21
|
+
ExerciseLevel,
|
|
22
|
+
TutorialLevelColours
|
|
23
|
+
> = {
|
|
24
|
+
beginner: { background: '#d1fae5', activeBackground: '#6ee7b7' },
|
|
25
|
+
intermediate: { background: '#fef3c7', activeBackground: '#fcd34d' },
|
|
26
|
+
advanced: { background: '#fce7f3', activeBackground: '#f9a8d4' },
|
|
27
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** An address cut into the three parts a router reads separately. */
|
|
2
|
+
export interface AddressParts {
|
|
3
|
+
/** Path of the address, `/` when it carries none. */
|
|
4
|
+
path: string;
|
|
5
|
+
/** Query string, without its leading `?`. */
|
|
6
|
+
search: string;
|
|
7
|
+
/** Fragment, without its leading `#`. */
|
|
8
|
+
fragment: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Cut an address into its path, its query and its fragment.
|
|
13
|
+
*
|
|
14
|
+
* The fragment is taken first, so a `?` inside it — an old hash link of the
|
|
15
|
+
* shape `#/tutorial/3?step=2` — stays part of the fragment rather than being
|
|
16
|
+
* read as the query of the page.
|
|
17
|
+
* @param address - A path, a full address, or a bare query string.
|
|
18
|
+
* @returns The three parts, each without its separator.
|
|
19
|
+
*/
|
|
20
|
+
export function splitAddress(address: string): AddressParts {
|
|
21
|
+
const hashIndex = address.indexOf('#');
|
|
22
|
+
const beforeHash = hashIndex === -1 ? address : address.slice(0, hashIndex);
|
|
23
|
+
const fragment = hashIndex === -1 ? '' : address.slice(hashIndex + 1);
|
|
24
|
+
const queryIndex = beforeHash.indexOf('?');
|
|
25
|
+
if (queryIndex === -1) {
|
|
26
|
+
return { path: beforeHash === '' ? '/' : beforeHash, search: '', fragment };
|
|
27
|
+
}
|
|
28
|
+
const path = beforeHash.slice(0, queryIndex);
|
|
29
|
+
return {
|
|
30
|
+
path: path === '' ? '/' : path,
|
|
31
|
+
search: beforeHash.slice(queryIndex + 1),
|
|
32
|
+
fragment,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The decoded, non-empty segments of a path.
|
|
38
|
+
* @param path - Path of an address, with or without its leading slash.
|
|
39
|
+
* @returns One entry per segment, `[]` for the root.
|
|
40
|
+
*/
|
|
41
|
+
export function splitPath(path: string): string[] {
|
|
42
|
+
const segments: string[] = [];
|
|
43
|
+
for (const raw of path.split('/')) {
|
|
44
|
+
if (raw !== '') segments.push(safeDecode(raw));
|
|
45
|
+
}
|
|
46
|
+
return segments;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A path in the one shape the lookups compare: a leading slash, no trailing
|
|
51
|
+
* one, its segments decoded, and neither query nor fragment.
|
|
52
|
+
* @param path - Path of an address.
|
|
53
|
+
* @returns The same address, normalized.
|
|
54
|
+
*/
|
|
55
|
+
export function normalizePath(path: string): string {
|
|
56
|
+
const segments = splitPath(splitAddress(path).path);
|
|
57
|
+
return segments.length === 0 ? '/' : `/${segments.join('/')}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Decode one component of an address, tolerating an escape that is not one.
|
|
62
|
+
*
|
|
63
|
+
* `decodeURIComponent` throws on a lone `%`, and an address is hand-editable:
|
|
64
|
+
* the raw text is closer to what its author meant than an error page.
|
|
65
|
+
* @param value - Raw, percent-encoded text.
|
|
66
|
+
* @returns The decoded text, or the raw text when it does not decode.
|
|
67
|
+
*/
|
|
68
|
+
export function safeDecode(value: string): string {
|
|
69
|
+
try {
|
|
70
|
+
return decodeURIComponent(value);
|
|
71
|
+
} catch {
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a site is mounted, read off the page rather than off the build.
|
|
3
|
+
*
|
|
4
|
+
* The build is mount-agnostic — vite is given a relative base, so the same
|
|
5
|
+
* `dist` serves `https://surge.cheminfo.org/` and
|
|
6
|
+
* `https://www.cheminfo.org/surge/`. What tells the two apart is the `<base>`
|
|
7
|
+
* the deployment stamps into the page it hands out, and `document.baseURI`
|
|
8
|
+
* resolves it against the address actually opened. So this answers correctly
|
|
9
|
+
* whether or not a slash closes the address, and on an address the SPA
|
|
10
|
+
* fallback answered.
|
|
11
|
+
* @returns The mount path, in the shape {@link normalizeBasePath} returns.
|
|
12
|
+
*/
|
|
13
|
+
export function readMountPath(): string {
|
|
14
|
+
const baseUri = globalThis.document?.baseURI;
|
|
15
|
+
if (!baseUri) return '';
|
|
16
|
+
return normalizeBasePath(new URL(baseUri).pathname);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The path half of a site's address, as a mount path.
|
|
21
|
+
*
|
|
22
|
+
* A deployment names where it serves the site in full — origin and path in one
|
|
23
|
+
* value — because the origin is what the canonical link and the sitemap need.
|
|
24
|
+
* This is the other half of it.
|
|
25
|
+
* @param siteUrl - The absolute address the site is served at.
|
|
26
|
+
* @returns The mount path, in the shape {@link normalizeBasePath} returns.
|
|
27
|
+
*/
|
|
28
|
+
export function basePathOf(siteUrl: string): string {
|
|
29
|
+
return normalizeBasePath(new URL(siteUrl).pathname);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A mount path in the shape the other helpers assume: the empty string when the
|
|
34
|
+
* site owns the root of its host, `/surge` when it is one tool among several on
|
|
35
|
+
* a shared one.
|
|
36
|
+
* @param basePath - The mount path however it was written: `surge`, `/surge`, `/surge/`.
|
|
37
|
+
* @returns The normalized mount path, without a trailing slash.
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeBasePath(basePath: string): string {
|
|
40
|
+
const trimmed = basePath.trim();
|
|
41
|
+
if (trimmed === '' || trimmed === '/') return '';
|
|
42
|
+
const opened = trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
|
|
43
|
+
return opened.replace(/\/+$/, '');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Move one of the site's own addresses under the path it is mounted at.
|
|
48
|
+
* @param basePath - The mount path, in any of the shapes {@link normalizeBasePath} accepts.
|
|
49
|
+
* @param path - An address from the site's own root, e.g. `/exercises`.
|
|
50
|
+
* @returns The address the browser and the server see, e.g. `/surge/exercises`.
|
|
51
|
+
*/
|
|
52
|
+
export function joinBasePath(basePath: string, path: string): string {
|
|
53
|
+
const base = normalizeBasePath(basePath);
|
|
54
|
+
const opened = path === '' || !path.startsWith('/') ? `/${path}` : path;
|
|
55
|
+
if (base === '') return opened;
|
|
56
|
+
return opened === '/' ? `${base}/` : `${base}${opened}`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Read one of the site's own addresses back out of a browser path.
|
|
61
|
+
*
|
|
62
|
+
* A path that does not sit under the mount is handed back untouched, so a
|
|
63
|
+
* deployment served from somewhere else than the build was told still routes.
|
|
64
|
+
* @param basePath - The mount path, in any of the shapes {@link normalizeBasePath} accepts.
|
|
65
|
+
* @param pathname - The path the browser is on, e.g. `/surge/exercises`.
|
|
66
|
+
* @returns The address from the site's own root, `/` for the mount itself.
|
|
67
|
+
*/
|
|
68
|
+
export function stripBasePath(basePath: string, pathname: string): string {
|
|
69
|
+
const base = normalizeBasePath(basePath);
|
|
70
|
+
const path = pathname === '' ? '/' : pathname;
|
|
71
|
+
if (base === '') return path;
|
|
72
|
+
if (path === base || path === `${base}/`) return '/';
|
|
73
|
+
// `/surgeon` is not a page of a site mounted at `/surge`, so the mount only
|
|
74
|
+
// matches when what follows it is a path of its own.
|
|
75
|
+
return path.startsWith(`${base}/`) ? path.slice(base.length) : path;
|
|
76
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export {
|
|
2
|
+
basePathOf,
|
|
3
|
+
joinBasePath,
|
|
4
|
+
normalizeBasePath,
|
|
5
|
+
readMountPath,
|
|
6
|
+
stripBasePath,
|
|
7
|
+
} from './basePath.ts';
|
|
8
|
+
export type {
|
|
9
|
+
AdoptLegacyHashOptions,
|
|
10
|
+
LegacyHashOptions,
|
|
11
|
+
} from './legacyHash.ts';
|
|
12
|
+
export { adoptLegacyHashAddress, pathFromLegacyHash } from './legacyHash.ts';
|
|
13
|
+
export type {
|
|
14
|
+
PageAddresses,
|
|
15
|
+
PageAddressesOptions,
|
|
16
|
+
PageWithPath,
|
|
17
|
+
} from './pageAddresses.ts';
|
|
18
|
+
export { createPageAddresses } from './pageAddresses.ts';
|
|
19
|
+
export type {
|
|
20
|
+
TabDefinition,
|
|
21
|
+
TabRoute,
|
|
22
|
+
TabRouteInput,
|
|
23
|
+
TabRouter,
|
|
24
|
+
TabRouterOptions,
|
|
25
|
+
} from './tabRouter.ts';
|
|
26
|
+
export { createTabRouter } from './tabRouter.ts';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { splitAddress } from './address.ts';
|
|
2
|
+
import { normalizeBasePath, stripBasePath } from './basePath.ts';
|
|
3
|
+
|
|
4
|
+
/** How a legacy hash link is turned into the path it means. */
|
|
5
|
+
export interface LegacyHashOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Carry the query string of the address over to the path. The share
|
|
8
|
+
* configuration lives there, so an embed stays configured across the move.
|
|
9
|
+
* A query written inside the fragment itself always wins over it.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
keepSearch?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** How an address is read when adopting the path a legacy hash link meant. */
|
|
16
|
+
export interface AdoptLegacyHashOptions extends LegacyHashOptions {
|
|
17
|
+
/**
|
|
18
|
+
* The path the site is mounted at, so a legacy link to a tool served under
|
|
19
|
+
* one is recognised as sitting on its root.
|
|
20
|
+
* @default ''
|
|
21
|
+
*/
|
|
22
|
+
basePath?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The path a link written before the site routed by path points at.
|
|
27
|
+
*
|
|
28
|
+
* Those links are in course pages, in bookmarks and inside other people's
|
|
29
|
+
* iframes, so they are answered rather than dropped. Only a fragment shaped
|
|
30
|
+
* like a path is one: an anchor such as `#results` names a place inside a page
|
|
31
|
+
* and comes back `null`.
|
|
32
|
+
* @param address - A full address, or the fragment on its own, e.g. `/#/tutorial/3`.
|
|
33
|
+
* @param options - Whether the query string is carried over.
|
|
34
|
+
* @returns The path form of the address, or `null` when it names no page.
|
|
35
|
+
*/
|
|
36
|
+
export function pathFromLegacyHash(
|
|
37
|
+
address: string,
|
|
38
|
+
options: LegacyHashOptions = {},
|
|
39
|
+
): string | null {
|
|
40
|
+
const outer = splitAddress(address);
|
|
41
|
+
if (outer.fragment === '' || !outer.fragment.startsWith('/')) return null;
|
|
42
|
+
|
|
43
|
+
const inner = splitAddress(outer.fragment);
|
|
44
|
+
if (inner.path === '/') return null;
|
|
45
|
+
|
|
46
|
+
const keepSearch = options.keepSearch ?? true;
|
|
47
|
+
const search = inner.search || (keepSearch ? outer.search : '');
|
|
48
|
+
return search === '' ? inner.path : `${inner.path}?${search}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The address to put in the bar in place of a legacy hash link, before anything
|
|
53
|
+
* reads it.
|
|
54
|
+
*
|
|
55
|
+
* Called once at startup with `location.pathname + location.search +
|
|
56
|
+
* location.hash`, so nothing downstream has to know the site ever routed by the
|
|
57
|
+
* hash. Only a visitor sitting on the site's root is moved: a fragment on a
|
|
58
|
+
* real page is an anchor of that page, not an address of its own.
|
|
59
|
+
* @param address - The address the browser is on.
|
|
60
|
+
* @param options - Whether the query is carried over, and the site's mount path.
|
|
61
|
+
* @returns The address to replace it with, or `null` when there is nothing to adopt.
|
|
62
|
+
*/
|
|
63
|
+
export function adoptLegacyHashAddress(
|
|
64
|
+
address: string,
|
|
65
|
+
options: AdoptLegacyHashOptions = {},
|
|
66
|
+
): string | null {
|
|
67
|
+
const basePath = normalizeBasePath(options.basePath ?? '');
|
|
68
|
+
if (stripBasePath(basePath, splitAddress(address).path) !== '/') return null;
|
|
69
|
+
|
|
70
|
+
const path = pathFromLegacyHash(address, options);
|
|
71
|
+
if (path === null) return null;
|
|
72
|
+
if (basePath === '') return path;
|
|
73
|
+
|
|
74
|
+
const { path: adopted, search } = splitAddress(path);
|
|
75
|
+
const mounted = `${basePath}${adopted}`;
|
|
76
|
+
return search === '' ? mounted : `${mounted}?${search}`;
|
|
77
|
+
}
|