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,183 @@
|
|
|
1
|
+
/** One borrowed work a site credits. */
|
|
2
|
+
export interface CreditEntry {
|
|
3
|
+
/** How a site names the work in its own list. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** What the work is called, spelled the way its authors spell it. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Where the work lives. */
|
|
8
|
+
href: string;
|
|
9
|
+
/** What it does for the site, in one line. */
|
|
10
|
+
description: string;
|
|
11
|
+
/**
|
|
12
|
+
* Licence it is distributed under.
|
|
13
|
+
* @default undefined — the work carries no licence of its own here
|
|
14
|
+
*/
|
|
15
|
+
license?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** An id the registry answers to. */
|
|
19
|
+
export type CreditId = (typeof CREDITS)[number]['id'];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The borrowed works a site names, in the order it names them.
|
|
23
|
+
*
|
|
24
|
+
* An About dialog lists what the page stands on, and every site had been
|
|
25
|
+
* writing that list itself — which is how two of them came to credit the same
|
|
26
|
+
* project to two different organisations. One registry, one answer.
|
|
27
|
+
* @param ids - Which works to list, in display order.
|
|
28
|
+
* @returns The entries, in that order.
|
|
29
|
+
* @throws {Error} When an id is not in the registry: a credits list that
|
|
30
|
+
* silently drops a work credits nobody.
|
|
31
|
+
*/
|
|
32
|
+
export function credits(ids: readonly CreditId[]): CreditEntry[] {
|
|
33
|
+
const listed: CreditEntry[] = [];
|
|
34
|
+
for (const id of ids) {
|
|
35
|
+
const entry = creditOf(id);
|
|
36
|
+
if (entry === undefined) {
|
|
37
|
+
throw new Error(`unknown credit: ${id}`);
|
|
38
|
+
}
|
|
39
|
+
listed.push(entry);
|
|
40
|
+
}
|
|
41
|
+
return listed;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* One borrowed work of the registry, for a site checking whether it holds one.
|
|
46
|
+
* @param id - Which work.
|
|
47
|
+
* @returns Its entry, or `undefined` when the registry does not hold it.
|
|
48
|
+
*/
|
|
49
|
+
export function creditOf(id: string): CreditEntry | undefined {
|
|
50
|
+
return CREDITS.find((candidate) => candidate.id === id);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Every work our sites borrow, with the organisation that actually publishes
|
|
55
|
+
* it — checked against the package each site installs, not against habit.
|
|
56
|
+
*/
|
|
57
|
+
export const CREDITS = [
|
|
58
|
+
{
|
|
59
|
+
id: 'openchemlib',
|
|
60
|
+
name: 'OpenChemLib',
|
|
61
|
+
href: 'https://github.com/cheminfo/openchemlib-js',
|
|
62
|
+
description:
|
|
63
|
+
'reads and writes structures, and computes their properties in the browser.',
|
|
64
|
+
license: 'BSD-3-Clause',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'openchemlib-utils',
|
|
68
|
+
name: 'openchemlib-utils',
|
|
69
|
+
href: 'https://github.com/cheminfo/openchemlib-utils',
|
|
70
|
+
description: 'the structure helpers built on top of OpenChemLib.',
|
|
71
|
+
license: 'MIT',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'react-ocl',
|
|
75
|
+
name: 'react-ocl',
|
|
76
|
+
href: 'https://github.com/zakodium-oss/react-ocl',
|
|
77
|
+
description: 'the structure editor you draw in, and the 2D renderer.',
|
|
78
|
+
license: 'MIT',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'react-mf',
|
|
82
|
+
name: 'react-mf',
|
|
83
|
+
href: 'https://github.com/zakodium-oss/react-mf',
|
|
84
|
+
description:
|
|
85
|
+
'typesets a molecular formula, subscripts, isotopes and charges included.',
|
|
86
|
+
license: 'MIT',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'mass-tools',
|
|
90
|
+
name: 'mass-tools',
|
|
91
|
+
href: 'https://github.com/cheminfo/mass-tools',
|
|
92
|
+
description:
|
|
93
|
+
'parses molecular formulas and computes masses and isotopic distributions.',
|
|
94
|
+
license: 'MIT',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'chem-equilibrium',
|
|
98
|
+
name: 'chem-equilibrium',
|
|
99
|
+
href: 'https://github.com/cheminfo/chem-equilibrium',
|
|
100
|
+
description:
|
|
101
|
+
'builds the mass-balance system of a solution and finds its root.',
|
|
102
|
+
license: 'MIT',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'ml-matrix',
|
|
106
|
+
name: 'ml-matrix',
|
|
107
|
+
href: 'https://github.com/mljs/matrix',
|
|
108
|
+
description: 'the linear algebra behind the numbers on the page.',
|
|
109
|
+
license: 'MIT',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 'ml-spectra-processing',
|
|
113
|
+
name: 'ml-spectra-processing',
|
|
114
|
+
href: 'https://github.com/mljs/spectra-processing',
|
|
115
|
+
description: 'the array and spectrum operations the data goes through.',
|
|
116
|
+
license: 'MIT',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'molstar',
|
|
120
|
+
name: 'Mol*',
|
|
121
|
+
href: 'https://molstar.org/',
|
|
122
|
+
description: 'the 3D viewer, its representations and its surfaces.',
|
|
123
|
+
license: 'MIT',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'blueprint',
|
|
127
|
+
name: 'Blueprint',
|
|
128
|
+
href: 'https://blueprintjs.com/',
|
|
129
|
+
description:
|
|
130
|
+
'the interface components — cards, dialogs, inputs, tables and tags.',
|
|
131
|
+
license: 'Apache-2.0',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 'react-science',
|
|
135
|
+
name: 'react-science',
|
|
136
|
+
href: 'https://github.com/zakodium-oss/react-science',
|
|
137
|
+
description:
|
|
138
|
+
'the scientific application shell this family of sites shares.',
|
|
139
|
+
license: 'MIT',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: 'react-cheminfo',
|
|
143
|
+
name: 'react-cheminfo',
|
|
144
|
+
href: 'https://github.com/cheminfo/react-cheminfo',
|
|
145
|
+
description: 'the shared chrome and conventions of the cheminfo sites.',
|
|
146
|
+
license: 'MIT',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: 'cheminfo-font',
|
|
150
|
+
name: 'cheminfo-font',
|
|
151
|
+
href: 'https://github.com/cheminfo/font',
|
|
152
|
+
description: 'the chemistry glyphs the toolbars are drawn with.',
|
|
153
|
+
license: 'CC-BY-4.0',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: 'nivo',
|
|
157
|
+
name: 'nivo',
|
|
158
|
+
href: 'https://nivo.rocks/',
|
|
159
|
+
description: 'draws the charts — the curves, the diagrams and the axes.',
|
|
160
|
+
license: 'MIT',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: 'mathjax',
|
|
164
|
+
name: 'MathJax',
|
|
165
|
+
href: 'https://www.mathjax.org/',
|
|
166
|
+
description: 'typesets the mathematics, from LaTeX to what you read.',
|
|
167
|
+
license: 'Apache-2.0',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 'react',
|
|
171
|
+
name: 'React',
|
|
172
|
+
href: 'https://react.dev/',
|
|
173
|
+
description: 'the component model the pages are written in.',
|
|
174
|
+
license: 'MIT',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'vite',
|
|
178
|
+
name: 'Vite',
|
|
179
|
+
href: 'https://vite.dev/',
|
|
180
|
+
description: 'builds and serves the static site.',
|
|
181
|
+
license: 'MIT',
|
|
182
|
+
},
|
|
183
|
+
] as const satisfies readonly CreditEntry[];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { CreditEntry } from '../core/credits.ts';
|
|
4
|
+
|
|
5
|
+
/** What a credits list draws. */
|
|
6
|
+
export interface CreditsListProps {
|
|
7
|
+
/** The works, in the order they are listed. */
|
|
8
|
+
entries: readonly CreditEntry[];
|
|
9
|
+
/**
|
|
10
|
+
* Whether each work's licence is written after its name.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
showLicense?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Class the list carries, in addition to `credits-list`.
|
|
16
|
+
* @default undefined
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Credits section of an About dialog: every borrowed work, what it does
|
|
23
|
+
* here, and under which licence.
|
|
24
|
+
*
|
|
25
|
+
* Naming the licence beside the work is what makes the list a credit rather
|
|
26
|
+
* than a list of links, and it is the part a site is most likely to leave out
|
|
27
|
+
* when it writes its own.
|
|
28
|
+
* @param props - See {@link CreditsListProps}.
|
|
29
|
+
* @returns The list.
|
|
30
|
+
*/
|
|
31
|
+
export function CreditsList(props: CreditsListProps): ReactElement {
|
|
32
|
+
const { entries, showLicense = true, className } = props;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ul
|
|
36
|
+
className={
|
|
37
|
+
className === undefined ? 'credits-list' : `credits-list ${className}`
|
|
38
|
+
}
|
|
39
|
+
style={LIST_STYLE}
|
|
40
|
+
>
|
|
41
|
+
{entries.map((entry) => (
|
|
42
|
+
<li key={entry.id} style={ITEM_STYLE}>
|
|
43
|
+
<a
|
|
44
|
+
href={entry.href}
|
|
45
|
+
target="_blank"
|
|
46
|
+
rel="noopener noreferrer"
|
|
47
|
+
style={NAME_STYLE}
|
|
48
|
+
>
|
|
49
|
+
{entry.name}
|
|
50
|
+
</a>
|
|
51
|
+
{showLicense && entry.license !== undefined ? (
|
|
52
|
+
<span style={LICENSE_STYLE}>{entry.license}</span>
|
|
53
|
+
) : (
|
|
54
|
+
' '
|
|
55
|
+
)}
|
|
56
|
+
<span>{entry.description}</span>
|
|
57
|
+
</li>
|
|
58
|
+
))}
|
|
59
|
+
</ul>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const LIST_STYLE = {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
flexDirection: 'column',
|
|
66
|
+
gap: 4,
|
|
67
|
+
margin: 0,
|
|
68
|
+
paddingLeft: 18,
|
|
69
|
+
} as const satisfies CSSProperties;
|
|
70
|
+
|
|
71
|
+
const ITEM_STYLE = {
|
|
72
|
+
fontSize: 13,
|
|
73
|
+
lineHeight: 1.4,
|
|
74
|
+
} as const satisfies CSSProperties;
|
|
75
|
+
|
|
76
|
+
const NAME_STYLE = { fontWeight: 600 } as const satisfies CSSProperties;
|
|
77
|
+
|
|
78
|
+
const LICENSE_STYLE = {
|
|
79
|
+
color: '#5f6b7c',
|
|
80
|
+
fontSize: 11,
|
|
81
|
+
margin: '0 6px',
|
|
82
|
+
} as const satisfies CSSProperties;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** The separators a table can be written with. */
|
|
2
|
+
export type DelimiterId = 'tab' | 'comma' | 'semicolon';
|
|
3
|
+
|
|
4
|
+
/** One separator, and everything a file written with it needs. */
|
|
5
|
+
export interface DelimiterChoice {
|
|
6
|
+
/** How the choice is named in a link and in a dialog. */
|
|
7
|
+
id: DelimiterId;
|
|
8
|
+
/** What the choice reads in the interface. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** The character itself. */
|
|
11
|
+
delimiter: string;
|
|
12
|
+
/** Extension a file written with it takes, without the dot. */
|
|
13
|
+
extension: string;
|
|
14
|
+
/** What such a file is, so the system opens it with a spreadsheet. */
|
|
15
|
+
mimeType: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The separator a choice stands for, whatever a link or a stored preference
|
|
20
|
+
* carries.
|
|
21
|
+
*
|
|
22
|
+
* An unknown id falls back to the tab rather than throwing: this value comes
|
|
23
|
+
* out of an address or a stored setting, and a link written two years ago must
|
|
24
|
+
* still open.
|
|
25
|
+
* @param id - The named choice.
|
|
26
|
+
* @returns The choice, or the tab one when the name is not known.
|
|
27
|
+
*/
|
|
28
|
+
export function delimiterChoice(id: string | undefined): DelimiterChoice {
|
|
29
|
+
for (const choice of DELIMITER_CHOICES) {
|
|
30
|
+
if (choice.id === id) return choice;
|
|
31
|
+
}
|
|
32
|
+
return TAB_CHOICE;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The tab, which is what a table is written with unless asked otherwise. */
|
|
36
|
+
const TAB_CHOICE: DelimiterChoice = {
|
|
37
|
+
id: 'tab',
|
|
38
|
+
label: 'Tab',
|
|
39
|
+
delimiter: '\t',
|
|
40
|
+
extension: 'tsv',
|
|
41
|
+
mimeType: 'text/tab-separated-values',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Every separator offered, in the order a dialog lists them. */
|
|
45
|
+
export const DELIMITER_CHOICES: readonly DelimiterChoice[] = [
|
|
46
|
+
TAB_CHOICE,
|
|
47
|
+
{
|
|
48
|
+
id: 'comma',
|
|
49
|
+
label: 'Comma',
|
|
50
|
+
delimiter: ',',
|
|
51
|
+
extension: 'csv',
|
|
52
|
+
mimeType: 'text/csv',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'semicolon',
|
|
56
|
+
label: 'Semicolon',
|
|
57
|
+
delimiter: ';',
|
|
58
|
+
extension: 'csv',
|
|
59
|
+
mimeType: 'text/csv',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/** The separator used when a caller does not name one. */
|
|
64
|
+
export const DEFAULT_DELIMITER = '\t';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { DelimiterChoice, DelimiterId } from './delimiters.ts';
|
|
2
|
+
export { DEFAULT_DELIMITER, DELIMITER_CHOICES } from './delimiters.ts';
|
|
3
|
+
export type { ReadDelimitedOptions } from './readDelimited.ts';
|
|
4
|
+
export { detectDelimiter, readDelimited } from './readDelimited.ts';
|
|
5
|
+
export type {
|
|
6
|
+
DelimitedColumn,
|
|
7
|
+
RowsToDelimitedOptions,
|
|
8
|
+
} from './rowsToDelimited.ts';
|
|
9
|
+
export { rowsToDelimited } from './rowsToDelimited.ts';
|
|
10
|
+
export type { ToDelimitedOptions } from './toDelimited.ts';
|
|
11
|
+
export { toDelimited } from './toDelimited.ts';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { DEFAULT_DELIMITER } from './delimiters.ts';
|
|
2
|
+
|
|
3
|
+
/** How a table is read back. */
|
|
4
|
+
export interface ReadDelimitedOptions {
|
|
5
|
+
/**
|
|
6
|
+
* What separates two cells. Left out, the separator is guessed from the text.
|
|
7
|
+
* @default undefined — the separator is detected
|
|
8
|
+
*/
|
|
9
|
+
delimiter?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Read delimited text back into rows.
|
|
14
|
+
*
|
|
15
|
+
* Quoting is honoured, so a cell holding the separator, a newline or a doubled
|
|
16
|
+
* quote comes back as it went in. A byte-order mark is dropped, `\r\n` and `\n`
|
|
17
|
+
* both end a line, and a blank line — the trailing one included — is skipped
|
|
18
|
+
* rather than read as a row carrying one empty cell.
|
|
19
|
+
* @param text - The file, as text.
|
|
20
|
+
* @param options - See {@link ReadDelimitedOptions}.
|
|
21
|
+
* @returns The rows, each an array of cells.
|
|
22
|
+
*/
|
|
23
|
+
export function readDelimited(
|
|
24
|
+
text: string,
|
|
25
|
+
options: ReadDelimitedOptions = {},
|
|
26
|
+
): string[][] {
|
|
27
|
+
const content = text.codePointAt(0) === 0xfe_ff ? text.slice(1) : text;
|
|
28
|
+
if (content === '') return [];
|
|
29
|
+
const delimiter = options.delimiter ?? detectDelimiter(content);
|
|
30
|
+
|
|
31
|
+
const rows: string[][] = [];
|
|
32
|
+
let row: string[] = [];
|
|
33
|
+
let cell = '';
|
|
34
|
+
let quoted = false;
|
|
35
|
+
|
|
36
|
+
for (let index = 0; index < content.length; index++) {
|
|
37
|
+
const character = content.charAt(index);
|
|
38
|
+
|
|
39
|
+
if (quoted) {
|
|
40
|
+
if (character !== '"') {
|
|
41
|
+
cell += character;
|
|
42
|
+
} else if (content[index + 1] === '"') {
|
|
43
|
+
cell += '"';
|
|
44
|
+
index++;
|
|
45
|
+
} else {
|
|
46
|
+
quoted = false;
|
|
47
|
+
}
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (character === '"' && cell === '') {
|
|
52
|
+
quoted = true;
|
|
53
|
+
} else if (character === delimiter) {
|
|
54
|
+
row.push(cell);
|
|
55
|
+
cell = '';
|
|
56
|
+
} else if (character === '\n' || character === '\r') {
|
|
57
|
+
if (character === '\r' && content[index + 1] === '\n') index++;
|
|
58
|
+
row.push(cell);
|
|
59
|
+
if (!isBlank(row)) rows.push(row);
|
|
60
|
+
row = [];
|
|
61
|
+
cell = '';
|
|
62
|
+
} else {
|
|
63
|
+
cell += character;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
row.push(cell);
|
|
68
|
+
if (!isBlank(row)) rows.push(row);
|
|
69
|
+
return rows;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Guess what separates the cells of a piece of delimited text.
|
|
74
|
+
*
|
|
75
|
+
* The candidates are counted outside quotes over the first few lines, so a
|
|
76
|
+
* comma inside a compound name does not win against the tabs actually
|
|
77
|
+
* separating the columns.
|
|
78
|
+
* @param text - The file, as text.
|
|
79
|
+
* @returns The separator, falling back to the tab when nothing separates
|
|
80
|
+
* anything.
|
|
81
|
+
*/
|
|
82
|
+
export function detectDelimiter(text: string): string {
|
|
83
|
+
let best = DEFAULT_DELIMITER;
|
|
84
|
+
let bestCount = 0;
|
|
85
|
+
for (const candidate of CANDIDATES) {
|
|
86
|
+
const count = countOutsideQuotes(text, candidate);
|
|
87
|
+
if (count > bestCount) {
|
|
88
|
+
best = candidate;
|
|
89
|
+
bestCount = count;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return best;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function isBlank(row: readonly string[]): boolean {
|
|
96
|
+
return row.length === 1 && row[0] === '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The separators a file we read is allowed to use, in order of preference. */
|
|
100
|
+
const CANDIDATES: readonly string[] = ['\t', ',', ';'];
|
|
101
|
+
|
|
102
|
+
/** How many lines of the file the guess is made from. */
|
|
103
|
+
const SAMPLED_LINES = 10;
|
|
104
|
+
|
|
105
|
+
function countOutsideQuotes(text: string, delimiter: string): number {
|
|
106
|
+
let count = 0;
|
|
107
|
+
let lines = 0;
|
|
108
|
+
let quoted = false;
|
|
109
|
+
|
|
110
|
+
for (let index = 0; index < text.length; index++) {
|
|
111
|
+
const character = text.charAt(index);
|
|
112
|
+
if (quoted) {
|
|
113
|
+
if (character === '"') {
|
|
114
|
+
if (text[index + 1] === '"') {
|
|
115
|
+
index++;
|
|
116
|
+
} else {
|
|
117
|
+
quoted = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (character === '"') {
|
|
123
|
+
quoted = true;
|
|
124
|
+
} else if (character === delimiter) {
|
|
125
|
+
count++;
|
|
126
|
+
} else if (character === '\n') {
|
|
127
|
+
lines++;
|
|
128
|
+
if (lines >= SAMPLED_LINES) break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return count;
|
|
132
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { DEFAULT_DELIMITER } from './delimiters.ts';
|
|
2
|
+
import { toDelimited } from './toDelimited.ts';
|
|
3
|
+
|
|
4
|
+
/** One column of a table written from objects. */
|
|
5
|
+
export interface DelimitedColumn {
|
|
6
|
+
/** Property of each object this column reads. */
|
|
7
|
+
key: string;
|
|
8
|
+
/**
|
|
9
|
+
* What the column is called in the header line.
|
|
10
|
+
* @default the key
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* How a value of this column is written.
|
|
15
|
+
* @default {@link formatCell}
|
|
16
|
+
*/
|
|
17
|
+
format?: (value: unknown) => string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** How a table of objects is written out. */
|
|
21
|
+
export interface RowsToDelimitedOptions {
|
|
22
|
+
/**
|
|
23
|
+
* What separates two cells.
|
|
24
|
+
* @default '\t'
|
|
25
|
+
*/
|
|
26
|
+
delimiter?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the column names are written as the first line.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
header?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* What ends a line.
|
|
34
|
+
* @default '\n'
|
|
35
|
+
*/
|
|
36
|
+
newline?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Write a list of objects out as delimited text, one column per named field.
|
|
41
|
+
*
|
|
42
|
+
* The columns are what makes the file readable: they fix the order, they name
|
|
43
|
+
* the header, and they are the only fields written — a row carrying more is not
|
|
44
|
+
* silently widened, and one carrying less gets an empty cell rather than
|
|
45
|
+
* shifting every column after it.
|
|
46
|
+
* @param rows - The objects, one per line.
|
|
47
|
+
* @param columns - The columns, in order; a plain string names a column that
|
|
48
|
+
* reads the property of the same name.
|
|
49
|
+
* @param options - See {@link RowsToDelimitedOptions}.
|
|
50
|
+
* @returns The text.
|
|
51
|
+
*/
|
|
52
|
+
export function rowsToDelimited(
|
|
53
|
+
rows: ReadonlyArray<Readonly<Record<string, unknown>>>,
|
|
54
|
+
columns: ReadonlyArray<string | DelimitedColumn>,
|
|
55
|
+
options: RowsToDelimitedOptions = {},
|
|
56
|
+
): string {
|
|
57
|
+
const {
|
|
58
|
+
delimiter = DEFAULT_DELIMITER,
|
|
59
|
+
header = true,
|
|
60
|
+
newline = '\n',
|
|
61
|
+
} = options;
|
|
62
|
+
const resolved = resolveColumns(columns);
|
|
63
|
+
|
|
64
|
+
const cells: string[][] = [];
|
|
65
|
+
for (const row of rows) {
|
|
66
|
+
const line: string[] = [];
|
|
67
|
+
for (const { key, format } of resolved) {
|
|
68
|
+
line.push(format(row[key]));
|
|
69
|
+
}
|
|
70
|
+
cells.push(line);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return toDelimited(cells, {
|
|
74
|
+
delimiter,
|
|
75
|
+
newline,
|
|
76
|
+
header: header ? resolved.map((column) => column.label) : undefined,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Write one value the way a spreadsheet reads it.
|
|
82
|
+
*
|
|
83
|
+
* Nothing at all — `undefined`, `null`, or a number that is not one — becomes
|
|
84
|
+
* an empty cell, which is what a spreadsheet means by a missing value; a date
|
|
85
|
+
* becomes its ISO form, a list becomes its entries separated by `; `, and
|
|
86
|
+
* anything else becomes its JSON, which at least says what was there.
|
|
87
|
+
* @param value - The value.
|
|
88
|
+
* @returns The cell.
|
|
89
|
+
*/
|
|
90
|
+
export function formatCell(value: unknown): string {
|
|
91
|
+
if (value === undefined || value === null) return '';
|
|
92
|
+
if (typeof value === 'string') return value;
|
|
93
|
+
if (typeof value === 'number') {
|
|
94
|
+
return Number.isFinite(value) ? String(value) : '';
|
|
95
|
+
}
|
|
96
|
+
if (typeof value === 'boolean') return value ? 'true' : 'false';
|
|
97
|
+
if (value instanceof Date) return value.toISOString();
|
|
98
|
+
if (typeof value === 'bigint') return value.toString();
|
|
99
|
+
if (Array.isArray(value)) {
|
|
100
|
+
const parts: string[] = [];
|
|
101
|
+
for (const entry of value) {
|
|
102
|
+
parts.push(formatCell(entry));
|
|
103
|
+
}
|
|
104
|
+
return parts.join('; ');
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return JSON.stringify(value) ?? '';
|
|
108
|
+
} catch {
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface ResolvedColumn {
|
|
114
|
+
key: string;
|
|
115
|
+
label: string;
|
|
116
|
+
format: (value: unknown) => string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function resolveColumns(
|
|
120
|
+
columns: ReadonlyArray<string | DelimitedColumn>,
|
|
121
|
+
): ResolvedColumn[] {
|
|
122
|
+
const resolved: ResolvedColumn[] = [];
|
|
123
|
+
for (const column of columns) {
|
|
124
|
+
if (typeof column === 'string') {
|
|
125
|
+
resolved.push({ key: column, label: column, format: formatCell });
|
|
126
|
+
} else {
|
|
127
|
+
resolved.push({
|
|
128
|
+
key: column.key,
|
|
129
|
+
label: column.label ?? column.key,
|
|
130
|
+
format: column.format ?? formatCell,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return resolved;
|
|
135
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DEFAULT_DELIMITER } from './delimiters.ts';
|
|
2
|
+
|
|
3
|
+
/** How a table is written out. */
|
|
4
|
+
export interface ToDelimitedOptions {
|
|
5
|
+
/**
|
|
6
|
+
* What separates two cells.
|
|
7
|
+
* @default '\t'
|
|
8
|
+
*/
|
|
9
|
+
delimiter?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Column names, written as the first line.
|
|
12
|
+
* @default undefined — the table is written without a header line
|
|
13
|
+
*/
|
|
14
|
+
header?: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* What ends a line.
|
|
17
|
+
* @default '\n'
|
|
18
|
+
*/
|
|
19
|
+
newline?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Write a table out as delimited text.
|
|
24
|
+
*
|
|
25
|
+
* Every cell is escaped, whatever the separator: a value holding the separator,
|
|
26
|
+
* a quote or a newline is quoted and its quotes doubled, per RFC 4180. Joining
|
|
27
|
+
* on a tab and hoping no cell holds one is what silently corrupts a file the
|
|
28
|
+
* day a compound name carries a comma or a source a line break.
|
|
29
|
+
* @param rows - The cells, one array per line.
|
|
30
|
+
* @param options - See {@link ToDelimitedOptions}.
|
|
31
|
+
* @returns The text, header line first when there is one.
|
|
32
|
+
*/
|
|
33
|
+
export function toDelimited(
|
|
34
|
+
rows: ReadonlyArray<readonly string[]>,
|
|
35
|
+
options: ToDelimitedOptions = {},
|
|
36
|
+
): string {
|
|
37
|
+
const { delimiter = DEFAULT_DELIMITER, header, newline = '\n' } = options;
|
|
38
|
+
|
|
39
|
+
const lines: string[] = [];
|
|
40
|
+
if (header !== undefined) lines.push(writeLine(header, delimiter));
|
|
41
|
+
for (const row of rows) {
|
|
42
|
+
lines.push(writeLine(row, delimiter));
|
|
43
|
+
}
|
|
44
|
+
return lines.join(newline);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Write one cell so reading it back gives exactly what went in.
|
|
49
|
+
* @param value - The cell.
|
|
50
|
+
* @param delimiter - What separates two cells in this file.
|
|
51
|
+
* @returns The cell, quoted when it has to be.
|
|
52
|
+
*/
|
|
53
|
+
export function escapeCell(value: string, delimiter: string): string {
|
|
54
|
+
const mustQuote =
|
|
55
|
+
value.includes(delimiter) ||
|
|
56
|
+
value.includes('"') ||
|
|
57
|
+
value.includes('\n') ||
|
|
58
|
+
value.includes('\r');
|
|
59
|
+
if (!mustQuote) return value;
|
|
60
|
+
return `"${value.replaceAll('"', '""')}"`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function writeLine(cells: readonly string[], delimiter: string): string {
|
|
64
|
+
const escaped: string[] = [];
|
|
65
|
+
for (const cell of cells) {
|
|
66
|
+
escaped.push(escapeCell(cell, delimiter));
|
|
67
|
+
}
|
|
68
|
+
return escaped.join(delimiter);
|
|
69
|
+
}
|