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 @@
|
|
|
1
|
+
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../../src/credits/core/credits.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,GAAwB;I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ACD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,wDAAwD;QACrE,OAAO,EAAE,YAAY;KACtB;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,+CAA+C;QAC5D,OAAO,EAAE,KAAK;KACf;IACD;QACE,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,oCAAoC;QACjD,OAAO,EAAE,KAAK;KACf;CACwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credits/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/credits/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CreditEntry } from '../core/credits.ts';
|
|
3
|
+
/** What a credits list draws. */
|
|
4
|
+
export interface CreditsListProps {
|
|
5
|
+
/** The works, in the order they are listed. */
|
|
6
|
+
entries: readonly CreditEntry[];
|
|
7
|
+
/**
|
|
8
|
+
* Whether each work's licence is written after its name.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
showLicense?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Class the list carries, in addition to `credits-list`.
|
|
14
|
+
* @default undefined
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Credits section of an About dialog: every borrowed work, what it does
|
|
20
|
+
* here, and under which licence.
|
|
21
|
+
*
|
|
22
|
+
* Naming the licence beside the work is what makes the list a credit rather
|
|
23
|
+
* than a list of links, and it is the part a site is most likely to leave out
|
|
24
|
+
* when it writes its own.
|
|
25
|
+
* @param props - See {@link CreditsListProps}.
|
|
26
|
+
* @returns The list.
|
|
27
|
+
*/
|
|
28
|
+
export declare function CreditsList(props: CreditsListProps): ReactElement;
|
|
29
|
+
//# sourceMappingURL=CreditsList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreditsList.d.ts","sourceRoot":"","sources":["../../../src/credits/ui/CreditsList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CA8BjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The Credits section of an About dialog: every borrowed work, what it does
|
|
4
|
+
* here, and under which licence.
|
|
5
|
+
*
|
|
6
|
+
* Naming the licence beside the work is what makes the list a credit rather
|
|
7
|
+
* than a list of links, and it is the part a site is most likely to leave out
|
|
8
|
+
* when it writes its own.
|
|
9
|
+
* @param props - See {@link CreditsListProps}.
|
|
10
|
+
* @returns The list.
|
|
11
|
+
*/
|
|
12
|
+
export function CreditsList(props) {
|
|
13
|
+
const { entries, showLicense = true, className } = props;
|
|
14
|
+
return (_jsx("ul", { className: className === undefined ? 'credits-list' : `credits-list ${className}`, style: LIST_STYLE, children: entries.map((entry) => (_jsxs("li", { style: ITEM_STYLE, children: [_jsx("a", { href: entry.href, target: "_blank", rel: "noopener noreferrer", style: NAME_STYLE, children: entry.name }), showLicense && entry.license !== undefined ? (_jsx("span", { style: LICENSE_STYLE, children: entry.license })) : (' '), _jsx("span", { children: entry.description })] }, entry.id))) }));
|
|
15
|
+
}
|
|
16
|
+
const LIST_STYLE = {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
gap: 4,
|
|
20
|
+
margin: 0,
|
|
21
|
+
paddingLeft: 18,
|
|
22
|
+
};
|
|
23
|
+
const ITEM_STYLE = {
|
|
24
|
+
fontSize: 13,
|
|
25
|
+
lineHeight: 1.4,
|
|
26
|
+
};
|
|
27
|
+
const NAME_STYLE = { fontWeight: 600 };
|
|
28
|
+
const LICENSE_STYLE = {
|
|
29
|
+
color: '#5f6b7c',
|
|
30
|
+
fontSize: 11,
|
|
31
|
+
margin: '0 6px',
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=CreditsList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreditsList.js","sourceRoot":"","sources":["../../../src/credits/ui/CreditsList.tsx"],"names":[],"mappings":";AAoBA;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAEzD,OAAO,CACL,aACE,SAAS,EACP,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,SAAS,EAAE,EAExE,KAAK,EAAE,UAAU,YAEhB,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,cAAmB,KAAK,EAAE,UAAU,aAClC,YACE,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,KAAK,EAAE,UAAU,YAEhB,KAAK,CAAC,IAAI,GACT,EACH,WAAW,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAC5C,eAAM,KAAK,EAAE,aAAa,YAAG,KAAK,CAAC,OAAO,GAAQ,CACnD,CAAC,CAAC,CAAC,CACF,GAAG,CACJ,EACD,yBAAO,KAAK,CAAC,WAAW,GAAQ,KAdzB,KAAK,CAAC,EAAE,CAeZ,CACN,CAAC,GACC,CACN,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,EAAE;CACiB,CAAC;AAEnC,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,GAAG;CACiB,CAAC;AAEnC,MAAM,UAAU,GAAG,EAAE,UAAU,EAAE,GAAG,EAAmC,CAAC;AAExE,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,OAAO;CACiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credits/ui/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/credits/ui/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The separators a table can be written with. */
|
|
2
|
+
export type DelimiterId = 'tab' | 'comma' | 'semicolon';
|
|
3
|
+
/** One separator, and everything a file written with it needs. */
|
|
4
|
+
export interface DelimiterChoice {
|
|
5
|
+
/** How the choice is named in a link and in a dialog. */
|
|
6
|
+
id: DelimiterId;
|
|
7
|
+
/** What the choice reads in the interface. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** The character itself. */
|
|
10
|
+
delimiter: string;
|
|
11
|
+
/** Extension a file written with it takes, without the dot. */
|
|
12
|
+
extension: string;
|
|
13
|
+
/** What such a file is, so the system opens it with a spreadsheet. */
|
|
14
|
+
mimeType: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The separator a choice stands for, whatever a link or a stored preference
|
|
18
|
+
* carries.
|
|
19
|
+
*
|
|
20
|
+
* An unknown id falls back to the tab rather than throwing: this value comes
|
|
21
|
+
* out of an address or a stored setting, and a link written two years ago must
|
|
22
|
+
* still open.
|
|
23
|
+
* @param id - The named choice.
|
|
24
|
+
* @returns The choice, or the tab one when the name is not known.
|
|
25
|
+
*/
|
|
26
|
+
export declare function delimiterChoice(id: string | undefined): DelimiterChoice;
|
|
27
|
+
/** Every separator offered, in the order a dialog lists them. */
|
|
28
|
+
export declare const DELIMITER_CHOICES: readonly DelimiterChoice[];
|
|
29
|
+
/** The separator used when a caller does not name one. */
|
|
30
|
+
export declare const DEFAULT_DELIMITER = "\t";
|
|
31
|
+
//# sourceMappingURL=delimiters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delimiters.d.ts","sourceRoot":"","sources":["../../../src/delimited/core/delimiters.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC;AAExD,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,EAAE,EAAE,WAAW,CAAC;IAChB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,CAKvE;AAWD,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAgBvD,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,OAAO,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The separator a choice stands for, whatever a link or a stored preference
|
|
3
|
+
* carries.
|
|
4
|
+
*
|
|
5
|
+
* An unknown id falls back to the tab rather than throwing: this value comes
|
|
6
|
+
* out of an address or a stored setting, and a link written two years ago must
|
|
7
|
+
* still open.
|
|
8
|
+
* @param id - The named choice.
|
|
9
|
+
* @returns The choice, or the tab one when the name is not known.
|
|
10
|
+
*/
|
|
11
|
+
export function delimiterChoice(id) {
|
|
12
|
+
for (const choice of DELIMITER_CHOICES) {
|
|
13
|
+
if (choice.id === id)
|
|
14
|
+
return choice;
|
|
15
|
+
}
|
|
16
|
+
return TAB_CHOICE;
|
|
17
|
+
}
|
|
18
|
+
/** The tab, which is what a table is written with unless asked otherwise. */
|
|
19
|
+
const TAB_CHOICE = {
|
|
20
|
+
id: 'tab',
|
|
21
|
+
label: 'Tab',
|
|
22
|
+
delimiter: '\t',
|
|
23
|
+
extension: 'tsv',
|
|
24
|
+
mimeType: 'text/tab-separated-values',
|
|
25
|
+
};
|
|
26
|
+
/** Every separator offered, in the order a dialog lists them. */
|
|
27
|
+
export const DELIMITER_CHOICES = [
|
|
28
|
+
TAB_CHOICE,
|
|
29
|
+
{
|
|
30
|
+
id: 'comma',
|
|
31
|
+
label: 'Comma',
|
|
32
|
+
delimiter: ',',
|
|
33
|
+
extension: 'csv',
|
|
34
|
+
mimeType: 'text/csv',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'semicolon',
|
|
38
|
+
label: 'Semicolon',
|
|
39
|
+
delimiter: ';',
|
|
40
|
+
extension: 'csv',
|
|
41
|
+
mimeType: 'text/csv',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
/** The separator used when a caller does not name one. */
|
|
45
|
+
export const DEFAULT_DELIMITER = '\t';
|
|
46
|
+
//# sourceMappingURL=delimiters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delimiters.js","sourceRoot":"","sources":["../../../src/delimited/core/delimiters.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,EAAsB;IACpD,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE;YAAE,OAAO,MAAM,CAAC;IACtC,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,GAAoB;IAClC,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,2BAA2B;CACtC,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAA+B;IAC3D,UAAU;IACV;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC;AAEF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 { DelimitedColumn, RowsToDelimitedOptions, } from './rowsToDelimited.ts';
|
|
6
|
+
export { rowsToDelimited } from './rowsToDelimited.ts';
|
|
7
|
+
export type { ToDelimitedOptions } from './toDelimited.ts';
|
|
8
|
+
export { toDelimited } from './toDelimited.ts';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/delimited/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EACV,eAAe,EACf,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DEFAULT_DELIMITER, DELIMITER_CHOICES } from "./delimiters.js";
|
|
2
|
+
export { detectDelimiter, readDelimited } from "./readDelimited.js";
|
|
3
|
+
export { rowsToDelimited } from "./rowsToDelimited.js";
|
|
4
|
+
export { toDelimited } from "./toDelimited.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/delimited/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** How a table is read back. */
|
|
2
|
+
export interface ReadDelimitedOptions {
|
|
3
|
+
/**
|
|
4
|
+
* What separates two cells. Left out, the separator is guessed from the text.
|
|
5
|
+
* @default undefined — the separator is detected
|
|
6
|
+
*/
|
|
7
|
+
delimiter?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Read delimited text back into rows.
|
|
11
|
+
*
|
|
12
|
+
* Quoting is honoured, so a cell holding the separator, a newline or a doubled
|
|
13
|
+
* quote comes back as it went in. A byte-order mark is dropped, `\r\n` and `\n`
|
|
14
|
+
* both end a line, and a blank line — the trailing one included — is skipped
|
|
15
|
+
* rather than read as a row carrying one empty cell.
|
|
16
|
+
* @param text - The file, as text.
|
|
17
|
+
* @param options - See {@link ReadDelimitedOptions}.
|
|
18
|
+
* @returns The rows, each an array of cells.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readDelimited(text: string, options?: ReadDelimitedOptions): string[][];
|
|
21
|
+
/**
|
|
22
|
+
* Guess what separates the cells of a piece of delimited text.
|
|
23
|
+
*
|
|
24
|
+
* The candidates are counted outside quotes over the first few lines, so a
|
|
25
|
+
* comma inside a compound name does not win against the tabs actually
|
|
26
|
+
* separating the columns.
|
|
27
|
+
* @param text - The file, as text.
|
|
28
|
+
* @returns The separator, falling back to the tab when nothing separates
|
|
29
|
+
* anything.
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectDelimiter(text: string): string;
|
|
32
|
+
//# sourceMappingURL=readDelimited.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readDelimited.d.ts","sourceRoot":"","sources":["../../../src/delimited/core/readDelimited.ts"],"names":[],"mappings":"AAEA,gCAAgC;AAChC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,oBAAyB,GACjC,MAAM,EAAE,EAAE,CA4CZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWpD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { DEFAULT_DELIMITER } from "./delimiters.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read delimited text back into rows.
|
|
4
|
+
*
|
|
5
|
+
* Quoting is honoured, so a cell holding the separator, a newline or a doubled
|
|
6
|
+
* quote comes back as it went in. A byte-order mark is dropped, `\r\n` and `\n`
|
|
7
|
+
* both end a line, and a blank line — the trailing one included — is skipped
|
|
8
|
+
* rather than read as a row carrying one empty cell.
|
|
9
|
+
* @param text - The file, as text.
|
|
10
|
+
* @param options - See {@link ReadDelimitedOptions}.
|
|
11
|
+
* @returns The rows, each an array of cells.
|
|
12
|
+
*/
|
|
13
|
+
export function readDelimited(text, options = {}) {
|
|
14
|
+
const content = text.codePointAt(0) === 0xfe_ff ? text.slice(1) : text;
|
|
15
|
+
if (content === '')
|
|
16
|
+
return [];
|
|
17
|
+
const delimiter = options.delimiter ?? detectDelimiter(content);
|
|
18
|
+
const rows = [];
|
|
19
|
+
let row = [];
|
|
20
|
+
let cell = '';
|
|
21
|
+
let quoted = false;
|
|
22
|
+
for (let index = 0; index < content.length; index++) {
|
|
23
|
+
const character = content.charAt(index);
|
|
24
|
+
if (quoted) {
|
|
25
|
+
if (character !== '"') {
|
|
26
|
+
cell += character;
|
|
27
|
+
}
|
|
28
|
+
else if (content[index + 1] === '"') {
|
|
29
|
+
cell += '"';
|
|
30
|
+
index++;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
quoted = false;
|
|
34
|
+
}
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (character === '"' && cell === '') {
|
|
38
|
+
quoted = true;
|
|
39
|
+
}
|
|
40
|
+
else if (character === delimiter) {
|
|
41
|
+
row.push(cell);
|
|
42
|
+
cell = '';
|
|
43
|
+
}
|
|
44
|
+
else if (character === '\n' || character === '\r') {
|
|
45
|
+
if (character === '\r' && content[index + 1] === '\n')
|
|
46
|
+
index++;
|
|
47
|
+
row.push(cell);
|
|
48
|
+
if (!isBlank(row))
|
|
49
|
+
rows.push(row);
|
|
50
|
+
row = [];
|
|
51
|
+
cell = '';
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
cell += character;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
row.push(cell);
|
|
58
|
+
if (!isBlank(row))
|
|
59
|
+
rows.push(row);
|
|
60
|
+
return rows;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Guess what separates the cells of a piece of delimited text.
|
|
64
|
+
*
|
|
65
|
+
* The candidates are counted outside quotes over the first few lines, so a
|
|
66
|
+
* comma inside a compound name does not win against the tabs actually
|
|
67
|
+
* separating the columns.
|
|
68
|
+
* @param text - The file, as text.
|
|
69
|
+
* @returns The separator, falling back to the tab when nothing separates
|
|
70
|
+
* anything.
|
|
71
|
+
*/
|
|
72
|
+
export function detectDelimiter(text) {
|
|
73
|
+
let best = DEFAULT_DELIMITER;
|
|
74
|
+
let bestCount = 0;
|
|
75
|
+
for (const candidate of CANDIDATES) {
|
|
76
|
+
const count = countOutsideQuotes(text, candidate);
|
|
77
|
+
if (count > bestCount) {
|
|
78
|
+
best = candidate;
|
|
79
|
+
bestCount = count;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return best;
|
|
83
|
+
}
|
|
84
|
+
function isBlank(row) {
|
|
85
|
+
return row.length === 1 && row[0] === '';
|
|
86
|
+
}
|
|
87
|
+
/** The separators a file we read is allowed to use, in order of preference. */
|
|
88
|
+
const CANDIDATES = ['\t', ',', ';'];
|
|
89
|
+
/** How many lines of the file the guess is made from. */
|
|
90
|
+
const SAMPLED_LINES = 10;
|
|
91
|
+
function countOutsideQuotes(text, delimiter) {
|
|
92
|
+
let count = 0;
|
|
93
|
+
let lines = 0;
|
|
94
|
+
let quoted = false;
|
|
95
|
+
for (let index = 0; index < text.length; index++) {
|
|
96
|
+
const character = text.charAt(index);
|
|
97
|
+
if (quoted) {
|
|
98
|
+
if (character === '"') {
|
|
99
|
+
if (text[index + 1] === '"') {
|
|
100
|
+
index++;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
quoted = false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (character === '"') {
|
|
109
|
+
quoted = true;
|
|
110
|
+
}
|
|
111
|
+
else if (character === delimiter) {
|
|
112
|
+
count++;
|
|
113
|
+
}
|
|
114
|
+
else if (character === '\n') {
|
|
115
|
+
lines++;
|
|
116
|
+
if (lines >= SAMPLED_LINES)
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return count;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=readDelimited.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readDelimited.js","sourceRoot":"","sources":["../../../src/delimited/core/readDelimited.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA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,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEvD,yDAAyD;AACzD,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,SAAS,kBAAkB,CAAC,IAAY,EAAE,SAAiB;IACzD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;gBACtB,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC5B,KAAK,EAAE,CAAC;gBACV,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,KAAK,CAAC;gBACjB,CAAC;YACH,CAAC;YACD,SAAS;QACX,CAAC;QACD,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACtB,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;aAAM,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YACnC,KAAK,EAAE,CAAC;QACV,CAAC;aAAM,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YAC9B,KAAK,EAAE,CAAC;YACR,IAAI,KAAK,IAAI,aAAa;gBAAE,MAAM;QACpC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** One column of a table written from objects. */
|
|
2
|
+
export interface DelimitedColumn {
|
|
3
|
+
/** Property of each object this column reads. */
|
|
4
|
+
key: string;
|
|
5
|
+
/**
|
|
6
|
+
* What the column is called in the header line.
|
|
7
|
+
* @default the key
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* How a value of this column is written.
|
|
12
|
+
* @default {@link formatCell}
|
|
13
|
+
*/
|
|
14
|
+
format?: (value: unknown) => string;
|
|
15
|
+
}
|
|
16
|
+
/** How a table of objects is written out. */
|
|
17
|
+
export interface RowsToDelimitedOptions {
|
|
18
|
+
/**
|
|
19
|
+
* What separates two cells.
|
|
20
|
+
* @default '\t'
|
|
21
|
+
*/
|
|
22
|
+
delimiter?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the column names are written as the first line.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
header?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* What ends a line.
|
|
30
|
+
* @default '\n'
|
|
31
|
+
*/
|
|
32
|
+
newline?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Write a list of objects out as delimited text, one column per named field.
|
|
36
|
+
*
|
|
37
|
+
* The columns are what makes the file readable: they fix the order, they name
|
|
38
|
+
* the header, and they are the only fields written — a row carrying more is not
|
|
39
|
+
* silently widened, and one carrying less gets an empty cell rather than
|
|
40
|
+
* shifting every column after it.
|
|
41
|
+
* @param rows - The objects, one per line.
|
|
42
|
+
* @param columns - The columns, in order; a plain string names a column that
|
|
43
|
+
* reads the property of the same name.
|
|
44
|
+
* @param options - See {@link RowsToDelimitedOptions}.
|
|
45
|
+
* @returns The text.
|
|
46
|
+
*/
|
|
47
|
+
export declare function rowsToDelimited(rows: ReadonlyArray<Readonly<Record<string, unknown>>>, columns: ReadonlyArray<string | DelimitedColumn>, options?: RowsToDelimitedOptions): string;
|
|
48
|
+
/**
|
|
49
|
+
* Write one value the way a spreadsheet reads it.
|
|
50
|
+
*
|
|
51
|
+
* Nothing at all — `undefined`, `null`, or a number that is not one — becomes
|
|
52
|
+
* an empty cell, which is what a spreadsheet means by a missing value; a date
|
|
53
|
+
* becomes its ISO form, a list becomes its entries separated by `; `, and
|
|
54
|
+
* anything else becomes its JSON, which at least says what was there.
|
|
55
|
+
* @param value - The value.
|
|
56
|
+
* @returns The cell.
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatCell(value: unknown): string;
|
|
59
|
+
//# sourceMappingURL=rowsToDelimited.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowsToDelimited.d.ts","sourceRoot":"","sources":["../../../src/delimited/core/rowsToDelimited.ts"],"names":[],"mappings":"AAGA,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CACrC;AAED,6CAA6C;AAC7C,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EACtD,OAAO,EAAE,aAAa,CAAC,MAAM,GAAG,eAAe,CAAC,EAChD,OAAO,GAAE,sBAA2B,GACnC,MAAM,CAsBR;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBjD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DEFAULT_DELIMITER } from "./delimiters.js";
|
|
2
|
+
import { toDelimited } from "./toDelimited.js";
|
|
3
|
+
/**
|
|
4
|
+
* Write a list of objects out as delimited text, one column per named field.
|
|
5
|
+
*
|
|
6
|
+
* The columns are what makes the file readable: they fix the order, they name
|
|
7
|
+
* the header, and they are the only fields written — a row carrying more is not
|
|
8
|
+
* silently widened, and one carrying less gets an empty cell rather than
|
|
9
|
+
* shifting every column after it.
|
|
10
|
+
* @param rows - The objects, one per line.
|
|
11
|
+
* @param columns - The columns, in order; a plain string names a column that
|
|
12
|
+
* reads the property of the same name.
|
|
13
|
+
* @param options - See {@link RowsToDelimitedOptions}.
|
|
14
|
+
* @returns The text.
|
|
15
|
+
*/
|
|
16
|
+
export function rowsToDelimited(rows, columns, options = {}) {
|
|
17
|
+
const { delimiter = DEFAULT_DELIMITER, header = true, newline = '\n', } = options;
|
|
18
|
+
const resolved = resolveColumns(columns);
|
|
19
|
+
const cells = [];
|
|
20
|
+
for (const row of rows) {
|
|
21
|
+
const line = [];
|
|
22
|
+
for (const { key, format } of resolved) {
|
|
23
|
+
line.push(format(row[key]));
|
|
24
|
+
}
|
|
25
|
+
cells.push(line);
|
|
26
|
+
}
|
|
27
|
+
return toDelimited(cells, {
|
|
28
|
+
delimiter,
|
|
29
|
+
newline,
|
|
30
|
+
header: header ? resolved.map((column) => column.label) : undefined,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Write one value the way a spreadsheet reads it.
|
|
35
|
+
*
|
|
36
|
+
* Nothing at all — `undefined`, `null`, or a number that is not one — becomes
|
|
37
|
+
* an empty cell, which is what a spreadsheet means by a missing value; a date
|
|
38
|
+
* becomes its ISO form, a list becomes its entries separated by `; `, and
|
|
39
|
+
* anything else becomes its JSON, which at least says what was there.
|
|
40
|
+
* @param value - The value.
|
|
41
|
+
* @returns The cell.
|
|
42
|
+
*/
|
|
43
|
+
export function formatCell(value) {
|
|
44
|
+
if (value === undefined || value === null)
|
|
45
|
+
return '';
|
|
46
|
+
if (typeof value === 'string')
|
|
47
|
+
return value;
|
|
48
|
+
if (typeof value === 'number') {
|
|
49
|
+
return Number.isFinite(value) ? String(value) : '';
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === 'boolean')
|
|
52
|
+
return value ? 'true' : 'false';
|
|
53
|
+
if (value instanceof Date)
|
|
54
|
+
return value.toISOString();
|
|
55
|
+
if (typeof value === 'bigint')
|
|
56
|
+
return value.toString();
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
const parts = [];
|
|
59
|
+
for (const entry of value) {
|
|
60
|
+
parts.push(formatCell(entry));
|
|
61
|
+
}
|
|
62
|
+
return parts.join('; ');
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
return JSON.stringify(value) ?? '';
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function resolveColumns(columns) {
|
|
72
|
+
const resolved = [];
|
|
73
|
+
for (const column of columns) {
|
|
74
|
+
if (typeof column === 'string') {
|
|
75
|
+
resolved.push({ key: column, label: column, format: formatCell });
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
resolved.push({
|
|
79
|
+
key: column.key,
|
|
80
|
+
label: column.label ?? column.key,
|
|
81
|
+
format: column.format ?? formatCell,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return resolved;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=rowsToDelimited.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowsToDelimited.js","sourceRoot":"","sources":["../../../src/delimited/core/rowsToDelimited.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqC/C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAsD,EACtD,OAAgD,EAChD,UAAkC,EAAE;IAEpC,MAAM,EACJ,SAAS,GAAG,iBAAiB,EAC7B,MAAM,GAAG,IAAI,EACb,OAAO,GAAG,IAAI,GACf,GAAG,OAAO,CAAC;IACZ,MAAM,QAAQ,GAAG,cA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/**
|
|
9
|
+
* Column names, written as the first line.
|
|
10
|
+
* @default undefined — the table is written without a header line
|
|
11
|
+
*/
|
|
12
|
+
header?: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* What ends a line.
|
|
15
|
+
* @default '\n'
|
|
16
|
+
*/
|
|
17
|
+
newline?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Write a table out as delimited text.
|
|
21
|
+
*
|
|
22
|
+
* Every cell is escaped, whatever the separator: a value holding the separator,
|
|
23
|
+
* a quote or a newline is quoted and its quotes doubled, per RFC 4180. Joining
|
|
24
|
+
* on a tab and hoping no cell holds one is what silently corrupts a file the
|
|
25
|
+
* day a compound name carries a comma or a source a line break.
|
|
26
|
+
* @param rows - The cells, one array per line.
|
|
27
|
+
* @param options - See {@link ToDelimitedOptions}.
|
|
28
|
+
* @returns The text, header line first when there is one.
|
|
29
|
+
*/
|
|
30
|
+
export declare function toDelimited(rows: ReadonlyArray<readonly string[]>, options?: ToDelimitedOptions): string;
|
|
31
|
+
/**
|
|
32
|
+
* Write one cell so reading it back gives exactly what went in.
|
|
33
|
+
* @param value - The cell.
|
|
34
|
+
* @param delimiter - What separates two cells in this file.
|
|
35
|
+
* @returns The cell, quoted when it has to be.
|
|
36
|
+
*/
|
|
37
|
+
export declare function escapeCell(value: string, delimiter: string): string;
|
|
38
|
+
//# sourceMappingURL=toDelimited.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toDelimited.d.ts","sourceRoot":"","sources":["../../../src/delimited/core/toDelimited.ts"],"names":[],"mappings":"AAEA,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,EACtC,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CASR;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQnE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DEFAULT_DELIMITER } from "./delimiters.js";
|
|
2
|
+
/**
|
|
3
|
+
* Write a table out as delimited text.
|
|
4
|
+
*
|
|
5
|
+
* Every cell is escaped, whatever the separator: a value holding the separator,
|
|
6
|
+
* a quote or a newline is quoted and its quotes doubled, per RFC 4180. Joining
|
|
7
|
+
* on a tab and hoping no cell holds one is what silently corrupts a file the
|
|
8
|
+
* day a compound name carries a comma or a source a line break.
|
|
9
|
+
* @param rows - The cells, one array per line.
|
|
10
|
+
* @param options - See {@link ToDelimitedOptions}.
|
|
11
|
+
* @returns The text, header line first when there is one.
|
|
12
|
+
*/
|
|
13
|
+
export function toDelimited(rows, options = {}) {
|
|
14
|
+
const { delimiter = DEFAULT_DELIMITER, header, newline = '\n' } = options;
|
|
15
|
+
const lines = [];
|
|
16
|
+
if (header !== undefined)
|
|
17
|
+
lines.push(writeLine(header, delimiter));
|
|
18
|
+
for (const row of rows) {
|
|
19
|
+
lines.push(writeLine(row, delimiter));
|
|
20
|
+
}
|
|
21
|
+
return lines.join(newline);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Write one cell so reading it back gives exactly what went in.
|
|
25
|
+
* @param value - The cell.
|
|
26
|
+
* @param delimiter - What separates two cells in this file.
|
|
27
|
+
* @returns The cell, quoted when it has to be.
|
|
28
|
+
*/
|
|
29
|
+
export function escapeCell(value, delimiter) {
|
|
30
|
+
const mustQuote = value.includes(delimiter) ||
|
|
31
|
+
value.includes('"') ||
|
|
32
|
+
value.includes('\n') ||
|
|
33
|
+
value.includes('\r');
|
|
34
|
+
if (!mustQuote)
|
|
35
|
+
return value;
|
|
36
|
+
return `"${value.replaceAll('"', '""')}"`;
|
|
37
|
+
}
|
|
38
|
+
function writeLine(cells, delimiter) {
|
|
39
|
+
const escaped = [];
|
|
40
|
+
for (const cell of cells) {
|
|
41
|
+
escaped.push(escapeCell(cell, delimiter));
|
|
42
|
+
}
|
|
43
|
+
return escaped.join(delimiter);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=toDelimited.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toDelimited.js","sourceRoot":"","sources":["../../../src/delimited/core/toDelimited.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAqBpD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CACzB,IAAsC,EACtC,UAA8B,EAAE;IAEhC,MAAM,EAAE,SAAS,GAAG,iBAAiB,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE1E,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,MAAM,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACnE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,SAAiB;IACzD,MAAM,SAAS,GACb,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;QACzB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QACnB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACpB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC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