@azerion/bunosaurus-theme-common 0.0.0-stage → 4.0.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 +2 -2
- package/lib/components/Collapsible/index.d.ts +59 -0
- package/lib/components/Collapsible/index.d.ts.map +1 -0
- package/lib/components/Collapsible/index.js +145 -0
- package/lib/components/Collapsible/index.js.map +1 -0
- package/lib/components/Details/index.d.ts +20 -0
- package/lib/components/Details/index.d.ts.map +1 -0
- package/lib/components/Details/index.js +86 -0
- package/lib/components/Details/index.js.map +1 -0
- package/lib/components/Details/styles.module.css +66 -0
- package/lib/components/ThemedComponent/index.d.ts +31 -0
- package/lib/components/ThemedComponent/index.d.ts.map +1 -0
- package/lib/components/ThemedComponent/index.js +47 -0
- package/lib/components/ThemedComponent/index.js.map +1 -0
- package/lib/components/ThemedComponent/styles.module.css +26 -0
- package/lib/contexts/announcementBar.d.ts +21 -0
- package/lib/contexts/announcementBar.d.ts.map +1 -0
- package/lib/contexts/announcementBar.js +72 -0
- package/lib/contexts/announcementBar.js.map +1 -0
- package/lib/contexts/colorMode.d.ts +23 -0
- package/lib/contexts/colorMode.d.ts.map +1 -0
- package/lib/contexts/colorMode.js +163 -0
- package/lib/contexts/colorMode.js.map +1 -0
- package/lib/contexts/navbarMobileSidebar.d.ts +31 -0
- package/lib/contexts/navbarMobileSidebar.d.ts.map +1 -0
- package/lib/contexts/navbarMobileSidebar.js +65 -0
- package/lib/contexts/navbarMobileSidebar.js.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/content.d.ts +37 -0
- package/lib/contexts/navbarSecondaryMenu/content.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/content.js +50 -0
- package/lib/contexts/navbarSecondaryMenu/content.js.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/display.d.ts +24 -0
- package/lib/contexts/navbarSecondaryMenu/display.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/display.js +62 -0
- package/lib/contexts/navbarSecondaryMenu/display.js.map +1 -0
- package/lib/hooks/useBackToTopButton.d.ts +27 -0
- package/lib/hooks/useBackToTopButton.d.ts.map +1 -0
- package/lib/hooks/useBackToTopButton.js +50 -0
- package/lib/hooks/useBackToTopButton.js.map +1 -0
- package/lib/hooks/useCodeWordWrap.d.ts +15 -0
- package/lib/hooks/useCodeWordWrap.d.ts.map +1 -0
- package/lib/hooks/useCodeWordWrap.js +67 -0
- package/lib/hooks/useCodeWordWrap.js.map +1 -0
- package/lib/hooks/useHideableNavbar.d.ts +17 -0
- package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
- package/lib/hooks/useHideableNavbar.js +65 -0
- package/lib/hooks/useHideableNavbar.js.map +1 -0
- package/lib/hooks/useLockBodyScroll.d.ts +12 -0
- package/lib/hooks/useLockBodyScroll.d.ts.map +1 -0
- package/lib/hooks/useLockBodyScroll.js +20 -0
- package/lib/hooks/useLockBodyScroll.js.map +1 -0
- package/lib/hooks/useMutationObserver.d.ts +4 -0
- package/lib/hooks/useMutationObserver.d.ts.map +1 -0
- package/lib/hooks/useMutationObserver.js +29 -0
- package/lib/hooks/useMutationObserver.js.map +1 -0
- package/lib/hooks/usePrismTheme.d.ts +13 -0
- package/lib/hooks/usePrismTheme.d.ts.map +1 -0
- package/lib/hooks/usePrismTheme.js +21 -0
- package/lib/hooks/usePrismTheme.js.map +1 -0
- package/lib/hooks/useTOCHighlight.d.ts +25 -0
- package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
- package/lib/hooks/useTOCHighlight.js +130 -0
- package/lib/hooks/useTOCHighlight.js.map +1 -0
- package/lib/hooks/useWindowSize.d.ts +27 -0
- package/lib/hooks/useWindowSize.d.ts.map +1 -0
- package/lib/hooks/useWindowSize.js +49 -0
- package/lib/hooks/useWindowSize.js.map +1 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +37 -0
- package/lib/index.js.map +1 -0
- package/lib/internal.d.ts +35 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +45 -0
- package/lib/internal.js.map +1 -0
- package/lib/translations/blogTranslations.d.ts +20 -0
- package/lib/translations/blogTranslations.d.ts.map +1 -0
- package/lib/translations/blogTranslations.js +52 -0
- package/lib/translations/blogTranslations.js.map +1 -0
- package/lib/translations/contentVisibilityTranslations.d.ts +12 -0
- package/lib/translations/contentVisibilityTranslations.d.ts.map +1 -0
- package/lib/translations/contentVisibilityTranslations.js +30 -0
- package/lib/translations/contentVisibilityTranslations.js.map +1 -0
- package/lib/translations/docsTranslations.d.ts +8 -0
- package/lib/translations/docsTranslations.d.ts.map +1 -0
- package/lib/translations/docsTranslations.js +17 -0
- package/lib/translations/docsTranslations.js.map +1 -0
- package/lib/utils/IntlUtils.d.ts +2 -0
- package/lib/utils/IntlUtils.d.ts.map +1 -0
- package/lib/utils/IntlUtils.js +20 -0
- package/lib/utils/IntlUtils.js.map +1 -0
- package/lib/utils/ThemeClassNames.d.ts +99 -0
- package/lib/utils/ThemeClassNames.d.ts.map +1 -0
- package/lib/utils/ThemeClassNames.js +107 -0
- package/lib/utils/ThemeClassNames.js.map +1 -0
- package/lib/utils/accessibilityUtils.d.ts +8 -0
- package/lib/utils/accessibilityUtils.d.ts.map +1 -0
- package/lib/utils/accessibilityUtils.js +10 -0
- package/lib/utils/accessibilityUtils.js.map +1 -0
- package/lib/utils/admonitionUtils.d.ts +12 -0
- package/lib/utils/admonitionUtils.d.ts.map +1 -0
- package/lib/utils/admonitionUtils.js +32 -0
- package/lib/utils/admonitionUtils.js.map +1 -0
- package/lib/utils/anchorUtils.d.ts +16 -0
- package/lib/utils/anchorUtils.d.ts.map +1 -0
- package/lib/utils/anchorUtils.js +26 -0
- package/lib/utils/anchorUtils.js.map +1 -0
- package/lib/utils/anchorUtils.module.css +14 -0
- package/lib/utils/codeBlockUtils.d.ts +101 -0
- package/lib/utils/codeBlockUtils.d.ts.map +1 -0
- package/lib/utils/codeBlockUtils.js +310 -0
- package/lib/utils/codeBlockUtils.js.map +1 -0
- package/lib/utils/emojiUtils.d.ts +20 -0
- package/lib/utils/emojiUtils.d.ts.map +1 -0
- package/lib/utils/emojiUtils.js +32 -0
- package/lib/utils/emojiUtils.js.map +1 -0
- package/lib/utils/errorBoundaryUtils.d.ts +31 -0
- package/lib/utils/errorBoundaryUtils.d.ts.map +1 -0
- package/lib/utils/errorBoundaryUtils.js +48 -0
- package/lib/utils/errorBoundaryUtils.js.map +1 -0
- package/lib/utils/errorBoundaryUtils.module.css +16 -0
- package/lib/utils/footerUtils.d.ts +13 -0
- package/lib/utils/footerUtils.d.ts.map +1 -0
- package/lib/utils/footerUtils.js +14 -0
- package/lib/utils/footerUtils.js.map +1 -0
- package/lib/utils/historyUtils.d.ts +39 -0
- package/lib/utils/historyUtils.d.ts.map +1 -0
- package/lib/utils/historyUtils.js +148 -0
- package/lib/utils/historyUtils.js.map +1 -0
- package/lib/utils/jsUtils.d.ts +24 -0
- package/lib/utils/jsUtils.d.ts.map +1 -0
- package/lib/utils/jsUtils.js +43 -0
- package/lib/utils/jsUtils.js.map +1 -0
- package/lib/utils/metadataUtils.d.ts +38 -0
- package/lib/utils/metadataUtils.d.ts.map +1 -0
- package/lib/utils/metadataUtils.js +87 -0
- package/lib/utils/metadataUtils.js.map +1 -0
- package/lib/utils/navbarUtils.d.ts +21 -0
- package/lib/utils/navbarUtils.d.ts.map +1 -0
- package/lib/utils/navbarUtils.js +35 -0
- package/lib/utils/navbarUtils.js.map +1 -0
- package/lib/utils/reactUtils.d.ts +60 -0
- package/lib/utils/reactUtils.d.ts.map +1 -0
- package/lib/utils/reactUtils.js +91 -0
- package/lib/utils/reactUtils.js.map +1 -0
- package/lib/utils/regexpUtils.d.ts +12 -0
- package/lib/utils/regexpUtils.d.ts.map +1 -0
- package/lib/utils/regexpUtils.js +18 -0
- package/lib/utils/regexpUtils.js.map +1 -0
- package/lib/utils/routesUtils.d.ts +26 -0
- package/lib/utils/routesUtils.d.ts.map +1 -0
- package/lib/utils/routesUtils.js +54 -0
- package/lib/utils/routesUtils.js.map +1 -0
- package/lib/utils/scrollUtils.d.ts +83 -0
- package/lib/utils/scrollUtils.d.ts.map +1 -0
- package/lib/utils/scrollUtils.js +201 -0
- package/lib/utils/scrollUtils.js.map +1 -0
- package/lib/utils/searchUtils.d.ts +8 -0
- package/lib/utils/searchUtils.d.ts.map +1 -0
- package/lib/utils/searchUtils.js +8 -0
- package/lib/utils/searchUtils.js.map +1 -0
- package/lib/utils/skipToContentUtils.d.ts +20 -0
- package/lib/utils/skipToContentUtils.d.ts.map +1 -0
- package/lib/utils/skipToContentUtils.js +75 -0
- package/lib/utils/skipToContentUtils.js.map +1 -0
- package/lib/utils/storageUtils.d.ts +36 -0
- package/lib/utils/storageUtils.d.ts.map +1 -0
- package/lib/utils/storageUtils.js +193 -0
- package/lib/utils/storageUtils.js.map +1 -0
- package/lib/utils/tabsUtils.d.ts +55 -0
- package/lib/utils/tabsUtils.d.ts.map +1 -0
- package/lib/utils/tabsUtils.js +179 -0
- package/lib/utils/tabsUtils.js.map +1 -0
- package/lib/utils/tagsUtils.d.ts +20 -0
- package/lib/utils/tagsUtils.d.ts.map +1 -0
- package/lib/utils/tagsUtils.js +41 -0
- package/lib/utils/tagsUtils.js.map +1 -0
- package/lib/utils/titleFormatterUtils.d.ts +59 -0
- package/lib/utils/titleFormatterUtils.d.ts.map +1 -0
- package/lib/utils/titleFormatterUtils.js +49 -0
- package/lib/utils/titleFormatterUtils.js.map +1 -0
- package/lib/utils/tocUtils.d.ts +36 -0
- package/lib/utils/tocUtils.d.ts.map +1 -0
- package/lib/utils/tocUtils.js +84 -0
- package/lib/utils/tocUtils.js.map +1 -0
- package/lib/utils/useAlternatePageUtils.d.ts +32 -0
- package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
- package/lib/utils/useAlternatePageUtils.js +42 -0
- package/lib/utils/useAlternatePageUtils.js.map +1 -0
- package/lib/utils/useLocalPathname.d.ts +13 -0
- package/lib/utils/useLocalPathname.d.ts.map +1 -0
- package/lib/utils/useLocalPathname.js +19 -0
- package/lib/utils/useLocalPathname.js.map +1 -0
- package/lib/utils/useLocationChange.d.ts +17 -0
- package/lib/utils/useLocationChange.d.ts.map +1 -0
- package/lib/utils/useLocationChange.js +31 -0
- package/lib/utils/useLocationChange.js.map +1 -0
- package/lib/utils/usePluralForm.d.ts +21 -0
- package/lib/utils/usePluralForm.d.ts.map +1 -0
- package/lib/utils/usePluralForm.js +93 -0
- package/lib/utils/usePluralForm.js.map +1 -0
- package/lib/utils/useThemeConfig.d.ts +120 -0
- package/lib/utils/useThemeConfig.d.ts.map +1 -0
- package/lib/utils/useThemeConfig.js +14 -0
- package/lib/utils/useThemeConfig.js.map +1 -0
- package/package.json +58 -4
- package/src/components/Collapsible/index.tsx +250 -0
- package/src/components/Details/index.tsx +130 -0
- package/src/components/Details/styles.module.css +66 -0
- package/src/components/ThemedComponent/index.tsx +75 -0
- package/src/components/ThemedComponent/styles.module.css +26 -0
- package/src/contexts/announcementBar.tsx +117 -0
- package/src/contexts/colorMode.tsx +257 -0
- package/src/contexts/navbarMobileSidebar.tsx +119 -0
- package/src/contexts/navbarSecondaryMenu/content.tsx +100 -0
- package/src/contexts/navbarSecondaryMenu/display.tsx +102 -0
- package/src/hooks/useBackToTopButton.ts +73 -0
- package/src/hooks/useCodeWordWrap.ts +107 -0
- package/src/hooks/useHideableNavbar.ts +81 -0
- package/src/hooks/useLockBodyScroll.ts +21 -0
- package/src/hooks/useMutationObserver.ts +38 -0
- package/src/hooks/usePrismTheme.ts +24 -0
- package/src/hooks/useTOCHighlight.ts +189 -0
- package/src/hooks/useWindowSize.ts +67 -0
- package/src/index.ts +112 -0
- package/src/internal.ts +107 -0
- package/src/translations/blogTranslations.tsx +89 -0
- package/src/translations/contentVisibilityTranslations.tsx +51 -0
- package/src/translations/docsTranslations.tsx +28 -0
- package/src/types.d.ts +8 -0
- package/src/utils/IntlUtils.ts +27 -0
- package/src/utils/ThemeClassNames.ts +119 -0
- package/src/utils/accessibilityUtils.ts +10 -0
- package/src/utils/admonitionUtils.tsx +44 -0
- package/src/utils/anchorUtils.module.css +14 -0
- package/src/utils/anchorUtils.ts +31 -0
- package/src/utils/codeBlockUtils.tsx +494 -0
- package/src/utils/emojiUtils.ts +40 -0
- package/src/utils/errorBoundaryUtils.module.css +16 -0
- package/src/utils/errorBoundaryUtils.tsx +71 -0
- package/src/utils/footerUtils.ts +18 -0
- package/src/utils/historyUtils.ts +199 -0
- package/src/utils/jsUtils.ts +54 -0
- package/src/utils/metadataUtils.tsx +145 -0
- package/src/utils/navbarUtils.tsx +45 -0
- package/src/utils/reactUtils.tsx +120 -0
- package/src/utils/regexpUtils.ts +24 -0
- package/src/utils/routesUtils.ts +75 -0
- package/src/utils/scrollUtils.tsx +303 -0
- package/src/utils/searchUtils.ts +8 -0
- package/src/utils/skipToContentUtils.tsx +108 -0
- package/src/utils/storageUtils.ts +260 -0
- package/src/utils/tabsUtils.tsx +307 -0
- package/src/utils/tagsUtils.tsx +61 -0
- package/src/utils/titleFormatterUtils.tsx +120 -0
- package/src/utils/tocUtils.ts +119 -0
- package/src/utils/useAlternatePageUtils.ts +80 -0
- package/src/utils/useLocalPathname.ts +22 -0
- package/src/utils/useLocationChange.ts +41 -0
- package/src/utils/usePluralForm.ts +131 -0
- package/src/utils/useThemeConfig.ts +147 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { useThemeConfig } from './useThemeConfig';
|
|
8
|
+
import styles from './anchorUtils.module.css';
|
|
9
|
+
/**
|
|
10
|
+
* When the navbar is sticky, this ensures that when clicking a hash link,
|
|
11
|
+
* we do not navigate to an anchor that will appear below the navbar.
|
|
12
|
+
* This happens in particular for MDX headings and footnotes.
|
|
13
|
+
*
|
|
14
|
+
* See https://github.com/facebook/docusaurus/issues/11232
|
|
15
|
+
* See also headings case https://x.com/JoshWComeau/status/1332015868725891076
|
|
16
|
+
*/
|
|
17
|
+
export function useAnchorTargetClassName(id) {
|
|
18
|
+
const { navbar: { hideOnScroll }, } = useThemeConfig();
|
|
19
|
+
if (typeof id === 'undefined') {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return hideOnScroll
|
|
23
|
+
? styles.anchorTargetHideOnScrollNavbar
|
|
24
|
+
: styles.anchorTargetStickyNavbar;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=anchorUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchorUtils.js","sourceRoot":"","sources":["../../src/utils/anchorUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,EAAsB;IAEtB,MAAM,EACJ,MAAM,EAAE,EAAC,YAAY,EAAC,GACvB,GAAG,cAAc,EAAE,CAAC;IACrB,IAAI,OAAO,EAAE,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,YAAY;QACjB,CAAC,CAAC,MAAM,CAAC,8BAA8B;QACvC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.anchorTargetStickyNavbar {
|
|
9
|
+
scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.anchorTargetHideOnScrollNavbar {
|
|
13
|
+
scroll-margin-top: 0.5rem;
|
|
14
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
8
|
+
import type { PrismTheme } from 'prism-react-renderer';
|
|
9
|
+
import type { WordWrap } from '../hooks/useCodeWordWrap';
|
|
10
|
+
export type MagicCommentConfig = {
|
|
11
|
+
className: string;
|
|
12
|
+
line?: string;
|
|
13
|
+
block?: {
|
|
14
|
+
start: string;
|
|
15
|
+
end: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function parseCodeBlockTitle(metastring?: string): string;
|
|
19
|
+
export declare function getLineNumbersStart({ showLineNumbers, metastring, }: {
|
|
20
|
+
showLineNumbers: boolean | number | undefined;
|
|
21
|
+
metastring: string | undefined;
|
|
22
|
+
}): number | undefined;
|
|
23
|
+
type ParseCodeLinesParam = {
|
|
24
|
+
/**
|
|
25
|
+
* The full metastring, as received from MDX. Line ranges declared here
|
|
26
|
+
* start at 1.
|
|
27
|
+
*/
|
|
28
|
+
metastring: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Language of the code block, used to determine which kinds of magic
|
|
31
|
+
* comment styles to enable.
|
|
32
|
+
*/
|
|
33
|
+
language: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Magic comment types that we should try to parse. Each entry would
|
|
36
|
+
* correspond to one class name to apply to each line.
|
|
37
|
+
*/
|
|
38
|
+
magicComments: MagicCommentConfig[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The highlighted lines, 0-indexed. e.g. `{ 0: ["highlight", "sample"] }`
|
|
42
|
+
* means the 1st line should have `highlight` and `sample` as class names.
|
|
43
|
+
*/
|
|
44
|
+
type CodeLineClassNames = {
|
|
45
|
+
[lineIndex: number]: string[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Code lines after applying magic comments or metastring highlight ranges
|
|
49
|
+
*/
|
|
50
|
+
type ParsedCodeLines = {
|
|
51
|
+
code: string;
|
|
52
|
+
lineClassNames: CodeLineClassNames;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Parses the code content, strips away any magic comments, and returns the
|
|
56
|
+
* clean content and the highlighted lines marked by the comments or metastring.
|
|
57
|
+
*
|
|
58
|
+
* If the metastring contains a range, the `content` will be returned as-is
|
|
59
|
+
* without any parsing. The returned `lineClassNames` will be a map from that
|
|
60
|
+
* number range to the first magic comment config entry (which _should_ be for
|
|
61
|
+
* line highlight directives.)
|
|
62
|
+
*/
|
|
63
|
+
export declare function parseLines(code: string, params: ParseCodeLinesParam): ParsedCodeLines;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the language name from the class name (set by MDX).
|
|
66
|
+
* e.g. `"language-javascript"` => `"javascript"`.
|
|
67
|
+
* Returns undefined if there is no language class name.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseClassNameLanguage(className: string | undefined): string | undefined;
|
|
70
|
+
export interface CodeBlockMetadata {
|
|
71
|
+
codeInput: string;
|
|
72
|
+
code: string;
|
|
73
|
+
className: string;
|
|
74
|
+
language: string;
|
|
75
|
+
title: ReactNode;
|
|
76
|
+
lineNumbersStart: number | undefined;
|
|
77
|
+
lineClassNames: CodeLineClassNames;
|
|
78
|
+
}
|
|
79
|
+
export declare function createCodeBlockMetadata(params: {
|
|
80
|
+
code: string;
|
|
81
|
+
className: string | undefined;
|
|
82
|
+
language: string | undefined;
|
|
83
|
+
defaultLanguage: string | undefined;
|
|
84
|
+
metastring: string | undefined;
|
|
85
|
+
magicComments: MagicCommentConfig[];
|
|
86
|
+
title: ReactNode;
|
|
87
|
+
showLineNumbers: boolean | number | undefined;
|
|
88
|
+
}): CodeBlockMetadata;
|
|
89
|
+
export declare function getPrismCssVariables(prismTheme: PrismTheme): CSSProperties;
|
|
90
|
+
type CodeBlockContextValue = {
|
|
91
|
+
metadata: CodeBlockMetadata;
|
|
92
|
+
wordWrap: WordWrap;
|
|
93
|
+
};
|
|
94
|
+
export declare function CodeBlockContextProvider({ metadata, wordWrap, children, }: {
|
|
95
|
+
metadata: CodeBlockMetadata;
|
|
96
|
+
wordWrap: WordWrap;
|
|
97
|
+
children: ReactNode;
|
|
98
|
+
}): ReactNode;
|
|
99
|
+
export declare function useCodeBlockContext(): CodeBlockContextValue;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=codeBlockUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlockUtils.d.ts","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAKpD,OAAO,KAAK,EAAC,UAAU,EAAkB,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAiCvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CAAC;CACtC,CAAC;AAuGF,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D;AAkBD,wBAAgB,mBAAmB,CAAC,EAClC,eAAe,EACf,UAAU,GACX,EAAE;IACD,eAAe,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C,UAAU,EAAE,MAAM,GAAG,SAAS,C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AAE,SAAS,CAAC;IACjB,eAAe,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CAC/C,GAAG,iBAAiB,CAkCpB;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,CAc1E;AAED,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAIF,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAOZ;AAED,wBAAgB,mBAAmB,IAAI,qBAAqB,CAM3D"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import rangeParser from 'parse-numeric-range';
|
|
10
|
+
import { ReactContextError } from './reactUtils';
|
|
11
|
+
const codeBlockTitleRegex = /title=(?<quote>["'])(?<title>.*?)\1/;
|
|
12
|
+
const metastringLinesRangeRegex = /\{(?<range>[\d,-]+)\}/;
|
|
13
|
+
// Supported types of highlight comments
|
|
14
|
+
const popularCommentPatterns = {
|
|
15
|
+
js: { start: '\\/\\/', end: '' },
|
|
16
|
+
jsBlock: { start: '\\/\\*', end: '\\*\\/' },
|
|
17
|
+
jsx: { start: '\\{\\s*\\/\\*', end: '\\*\\/\\s*\\}' },
|
|
18
|
+
bash: { start: '#', end: '' },
|
|
19
|
+
html: { start: '<!--', end: '-->' },
|
|
20
|
+
};
|
|
21
|
+
const commentPatterns = {
|
|
22
|
+
...popularCommentPatterns, // shallow copy is sufficient
|
|
23
|
+
// minor comment styles
|
|
24
|
+
lua: { start: '--', end: '' },
|
|
25
|
+
wasm: { start: '\\;\\;', end: '' },
|
|
26
|
+
tex: { start: '%', end: '' },
|
|
27
|
+
vb: { start: "['‘’]", end: '' },
|
|
28
|
+
vbnet: { start: "(?:_\\s*)?['‘’]", end: '' }, // Visual Studio 2019 or later
|
|
29
|
+
rem: { start: '[Rr][Ee][Mm]\\b', end: '' },
|
|
30
|
+
f90: { start: '!', end: '' }, // Free format only
|
|
31
|
+
ml: { start: '\\(\\*', end: '\\*\\)' },
|
|
32
|
+
cobol: { start: '\\*>', end: '' }, // Free format only
|
|
33
|
+
};
|
|
34
|
+
const popularCommentTypes = Object.keys(popularCommentPatterns);
|
|
35
|
+
function getCommentPattern(languages, magicCommentDirectives) {
|
|
36
|
+
// To be more reliable, the opening and closing comment must match
|
|
37
|
+
const commentPattern = languages
|
|
38
|
+
.map((lang) => {
|
|
39
|
+
const { start, end } = commentPatterns[lang];
|
|
40
|
+
return `(?:${start}\\s*(${magicCommentDirectives
|
|
41
|
+
.flatMap((d) => [d.line, d.block?.start, d.block?.end].filter(Boolean))
|
|
42
|
+
.join('|')})\\s*${end})`;
|
|
43
|
+
})
|
|
44
|
+
.join('|');
|
|
45
|
+
// White space is allowed, but otherwise it should be on it's own line
|
|
46
|
+
return new RegExp(`^\\s*(?:${commentPattern})\\s*$`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Select comment styles based on language
|
|
50
|
+
*/
|
|
51
|
+
function getAllMagicCommentDirectiveStyles(lang, magicCommentDirectives) {
|
|
52
|
+
switch (lang) {
|
|
53
|
+
case 'js':
|
|
54
|
+
case 'javascript':
|
|
55
|
+
case 'ts':
|
|
56
|
+
case 'typescript':
|
|
57
|
+
return getCommentPattern(['js', 'jsBlock'], magicCommentDirectives);
|
|
58
|
+
case 'jsx':
|
|
59
|
+
case 'tsx':
|
|
60
|
+
return getCommentPattern(['js', 'jsBlock', 'jsx'], magicCommentDirectives);
|
|
61
|
+
case 'html':
|
|
62
|
+
return getCommentPattern(['js', 'jsBlock', 'html'], magicCommentDirectives);
|
|
63
|
+
case 'python':
|
|
64
|
+
case 'py':
|
|
65
|
+
case 'bash':
|
|
66
|
+
return getCommentPattern(['bash'], magicCommentDirectives);
|
|
67
|
+
case 'markdown':
|
|
68
|
+
case 'md':
|
|
69
|
+
// Text uses HTML, front matter uses bash
|
|
70
|
+
return getCommentPattern(['html', 'jsx', 'bash'], magicCommentDirectives);
|
|
71
|
+
case 'tex':
|
|
72
|
+
case 'latex':
|
|
73
|
+
case 'matlab':
|
|
74
|
+
return getCommentPattern(['tex'], magicCommentDirectives);
|
|
75
|
+
case 'lua':
|
|
76
|
+
case 'haskell':
|
|
77
|
+
return getCommentPattern(['lua'], magicCommentDirectives);
|
|
78
|
+
case 'sql':
|
|
79
|
+
return getCommentPattern(['lua', 'jsBlock'], magicCommentDirectives);
|
|
80
|
+
case 'wasm':
|
|
81
|
+
return getCommentPattern(['wasm'], magicCommentDirectives);
|
|
82
|
+
case 'vb':
|
|
83
|
+
case 'vba':
|
|
84
|
+
case 'visual-basic':
|
|
85
|
+
return getCommentPattern(['vb', 'rem'], magicCommentDirectives);
|
|
86
|
+
case 'vbnet':
|
|
87
|
+
return getCommentPattern(['vbnet', 'rem'], magicCommentDirectives);
|
|
88
|
+
case 'batch':
|
|
89
|
+
return getCommentPattern(['rem'], magicCommentDirectives);
|
|
90
|
+
case 'basic': // https://github.com/PrismJS/prism/blob/master/components/prism-basic.js#L3
|
|
91
|
+
return getCommentPattern(['rem', 'f90'], magicCommentDirectives);
|
|
92
|
+
case 'fsharp':
|
|
93
|
+
return getCommentPattern(['js', 'ml'], magicCommentDirectives);
|
|
94
|
+
case 'ocaml':
|
|
95
|
+
case 'sml':
|
|
96
|
+
return getCommentPattern(['ml'], magicCommentDirectives);
|
|
97
|
+
case 'fortran':
|
|
98
|
+
return getCommentPattern(['f90'], magicCommentDirectives);
|
|
99
|
+
case 'cobol':
|
|
100
|
+
return getCommentPattern(['cobol'], magicCommentDirectives);
|
|
101
|
+
default:
|
|
102
|
+
// All popular comment types
|
|
103
|
+
return getCommentPattern(popularCommentTypes, magicCommentDirectives);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function parseCodeBlockTitle(metastring) {
|
|
107
|
+
return metastring?.match(codeBlockTitleRegex)?.groups.title ?? '';
|
|
108
|
+
}
|
|
109
|
+
function getMetaLineNumbersStart(metastring) {
|
|
110
|
+
const showLineNumbersMeta = metastring
|
|
111
|
+
?.split(' ')
|
|
112
|
+
.find((str) => str.startsWith('showLineNumbers'));
|
|
113
|
+
if (showLineNumbersMeta) {
|
|
114
|
+
if (showLineNumbersMeta.startsWith('showLineNumbers=')) {
|
|
115
|
+
const value = showLineNumbersMeta.replace('showLineNumbers=', '');
|
|
116
|
+
return parseInt(value, 10);
|
|
117
|
+
}
|
|
118
|
+
return 1;
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
export function getLineNumbersStart({ showLineNumbers, metastring, }) {
|
|
123
|
+
const defaultStart = 1;
|
|
124
|
+
if (typeof showLineNumbers === 'boolean') {
|
|
125
|
+
return showLineNumbers ? defaultStart : undefined;
|
|
126
|
+
}
|
|
127
|
+
if (typeof showLineNumbers === 'number') {
|
|
128
|
+
return showLineNumbers;
|
|
129
|
+
}
|
|
130
|
+
return getMetaLineNumbersStart(metastring);
|
|
131
|
+
}
|
|
132
|
+
function parseCodeLinesFromMetastring(code, { metastring, magicComments }) {
|
|
133
|
+
// Highlighted lines specified in props: don't parse the content
|
|
134
|
+
if (metastring && metastringLinesRangeRegex.test(metastring)) {
|
|
135
|
+
const linesRange = metastring.match(metastringLinesRangeRegex).groups
|
|
136
|
+
.range;
|
|
137
|
+
if (magicComments.length === 0) {
|
|
138
|
+
throw new Error(`A highlight range has been given in code block's metastring (\`\`\` ${metastring}), but no magic comment config is available. Docusaurus applies the first magic comment entry's className for metastring ranges.`);
|
|
139
|
+
}
|
|
140
|
+
const metastringRangeClassName = magicComments[0].className;
|
|
141
|
+
const lines = rangeParser(linesRange)
|
|
142
|
+
.filter((n) => n > 0)
|
|
143
|
+
.map((n) => [n - 1, [metastringRangeClassName]]);
|
|
144
|
+
return { lineClassNames: Object.fromEntries(lines), code };
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
function parseCodeLinesFromContent(code, params) {
|
|
149
|
+
const { language, magicComments } = params;
|
|
150
|
+
if (language === undefined) {
|
|
151
|
+
return { lineClassNames: {}, code };
|
|
152
|
+
}
|
|
153
|
+
const directiveRegex = getAllMagicCommentDirectiveStyles(language, magicComments);
|
|
154
|
+
// Go through line by line
|
|
155
|
+
const lines = code.split(/\r?\n/);
|
|
156
|
+
const blocks = Object.fromEntries(magicComments.map((d) => [d.className, { start: 0, range: '' }]));
|
|
157
|
+
const lineToClassName = Object.fromEntries(magicComments
|
|
158
|
+
.filter((d) => d.line)
|
|
159
|
+
.map(({ className, line }) => [line, className]));
|
|
160
|
+
const blockStartToClassName = Object.fromEntries(magicComments
|
|
161
|
+
.filter((d) => d.block)
|
|
162
|
+
.map(({ className, block }) => [block.start, className]));
|
|
163
|
+
const blockEndToClassName = Object.fromEntries(magicComments
|
|
164
|
+
.filter((d) => d.block)
|
|
165
|
+
.map(({ className, block }) => [block.end, className]));
|
|
166
|
+
for (let lineNumber = 0; lineNumber < lines.length;) {
|
|
167
|
+
const line = lines[lineNumber];
|
|
168
|
+
const match = line.match(directiveRegex);
|
|
169
|
+
if (!match) {
|
|
170
|
+
// Lines without directives are unchanged
|
|
171
|
+
lineNumber += 1;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const directive = match
|
|
175
|
+
.slice(1)
|
|
176
|
+
.find((item) => item !== undefined);
|
|
177
|
+
if (lineToClassName[directive]) {
|
|
178
|
+
blocks[lineToClassName[directive]].range += `${lineNumber},`;
|
|
179
|
+
}
|
|
180
|
+
else if (blockStartToClassName[directive]) {
|
|
181
|
+
blocks[blockStartToClassName[directive]].start = lineNumber;
|
|
182
|
+
}
|
|
183
|
+
else if (blockEndToClassName[directive]) {
|
|
184
|
+
blocks[blockEndToClassName[directive]].range += `${blocks[blockEndToClassName[directive]].start}-${lineNumber - 1},`;
|
|
185
|
+
}
|
|
186
|
+
lines.splice(lineNumber, 1);
|
|
187
|
+
}
|
|
188
|
+
const lineClassNames = {};
|
|
189
|
+
Object.entries(blocks).forEach(([className, { range }]) => {
|
|
190
|
+
rangeParser(range).forEach((l) => {
|
|
191
|
+
lineClassNames[l] ??= [];
|
|
192
|
+
lineClassNames[l].push(className);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
return { code: lines.join('\n'), lineClassNames };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Parses the code content, strips away any magic comments, and returns the
|
|
199
|
+
* clean content and the highlighted lines marked by the comments or metastring.
|
|
200
|
+
*
|
|
201
|
+
* If the metastring contains a range, the `content` will be returned as-is
|
|
202
|
+
* without any parsing. The returned `lineClassNames` will be a map from that
|
|
203
|
+
* number range to the first magic comment config entry (which _should_ be for
|
|
204
|
+
* line highlight directives.)
|
|
205
|
+
*/
|
|
206
|
+
export function parseLines(code, params) {
|
|
207
|
+
// Historical behavior: we remove last line break
|
|
208
|
+
const newCode = code.replace(/\r?\n$/, '');
|
|
209
|
+
// Historical behavior: we try one strategy after the other
|
|
210
|
+
// we don't support mixing metastring ranges + magic comments
|
|
211
|
+
return (parseCodeLinesFromMetastring(newCode, { ...params }) ??
|
|
212
|
+
parseCodeLinesFromContent(newCode, { ...params }));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Gets the language name from the class name (set by MDX).
|
|
216
|
+
* e.g. `"language-javascript"` => `"javascript"`.
|
|
217
|
+
* Returns undefined if there is no language class name.
|
|
218
|
+
*/
|
|
219
|
+
export function parseClassNameLanguage(className) {
|
|
220
|
+
if (!className) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
const languageClassName = className
|
|
224
|
+
.split(' ')
|
|
225
|
+
.find((str) => str.startsWith('language-'));
|
|
226
|
+
return languageClassName?.replace(/language-/, '');
|
|
227
|
+
}
|
|
228
|
+
// Prism languages are always lowercase
|
|
229
|
+
// We want to fail-safe and allow both "php" and "PHP"
|
|
230
|
+
// See https://github.com/facebook/docusaurus/issues/9012
|
|
231
|
+
function normalizeLanguage(language) {
|
|
232
|
+
return language?.toLowerCase();
|
|
233
|
+
}
|
|
234
|
+
function getLanguage(params) {
|
|
235
|
+
return (normalizeLanguage(params.language ??
|
|
236
|
+
parseClassNameLanguage(params.className) ??
|
|
237
|
+
params.defaultLanguage) ?? 'text'); // There's always a language, required by Prism;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* This ensures that we always have the code block language as className
|
|
241
|
+
* For MDX code blocks this is provided automatically by MDX
|
|
242
|
+
* For JSX code blocks, the language gets added by this function
|
|
243
|
+
* This ensures both cases lead to a consistent HTML output
|
|
244
|
+
*/
|
|
245
|
+
function ensureLanguageClassName({ className, language, }) {
|
|
246
|
+
return clsx(className, language &&
|
|
247
|
+
!className?.includes(`language-${language}`) &&
|
|
248
|
+
`language-${language}`);
|
|
249
|
+
}
|
|
250
|
+
export function createCodeBlockMetadata(params) {
|
|
251
|
+
const language = getLanguage({
|
|
252
|
+
language: params.language,
|
|
253
|
+
defaultLanguage: params.defaultLanguage,
|
|
254
|
+
className: params.className,
|
|
255
|
+
});
|
|
256
|
+
const { lineClassNames, code } = parseLines(params.code, {
|
|
257
|
+
metastring: params.metastring,
|
|
258
|
+
magicComments: params.magicComments,
|
|
259
|
+
language,
|
|
260
|
+
});
|
|
261
|
+
const className = ensureLanguageClassName({
|
|
262
|
+
className: params.className,
|
|
263
|
+
language,
|
|
264
|
+
});
|
|
265
|
+
const title = parseCodeBlockTitle(params.metastring) || params.title;
|
|
266
|
+
const lineNumbersStart = getLineNumbersStart({
|
|
267
|
+
showLineNumbers: params.showLineNumbers,
|
|
268
|
+
metastring: params.metastring,
|
|
269
|
+
});
|
|
270
|
+
return {
|
|
271
|
+
codeInput: params.code,
|
|
272
|
+
code,
|
|
273
|
+
className,
|
|
274
|
+
language,
|
|
275
|
+
title,
|
|
276
|
+
lineNumbersStart,
|
|
277
|
+
lineClassNames,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
export function getPrismCssVariables(prismTheme) {
|
|
281
|
+
const mapping = {
|
|
282
|
+
color: '--prism-color',
|
|
283
|
+
backgroundColor: '--prism-background-color',
|
|
284
|
+
};
|
|
285
|
+
const properties = {};
|
|
286
|
+
Object.entries(prismTheme.plain).forEach(([key, value]) => {
|
|
287
|
+
const varName = mapping[key];
|
|
288
|
+
if (varName && typeof value === 'string') {
|
|
289
|
+
properties[varName] = value;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return properties;
|
|
293
|
+
}
|
|
294
|
+
const CodeBlockContext = createContext(null);
|
|
295
|
+
export function CodeBlockContextProvider({ metadata, wordWrap, children, }) {
|
|
296
|
+
// Should we optimize this in 2 contexts?
|
|
297
|
+
// Unlike metadata, wordWrap is stateful and likely to trigger re-renders
|
|
298
|
+
const value = useMemo(() => {
|
|
299
|
+
return { metadata, wordWrap };
|
|
300
|
+
}, [metadata, wordWrap]);
|
|
301
|
+
return <CodeBlockContext value={value}>{children}</CodeBlockContext>;
|
|
302
|
+
}
|
|
303
|
+
export function useCodeBlockContext() {
|
|
304
|
+
const value = useContext(CodeBlockContext);
|
|
305
|
+
if (value === null) {
|
|
306
|
+
throw new ReactContextError('CodeBlockContextProvider');
|
|
307
|
+
}
|
|
308
|
+
return value;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=codeBlockUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlockUtils.js","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.t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mB;IACjC,MAAM,KAAK,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC3C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* This method splits "⚠️ Hello World" into "⚠️" + " Hello World".
|
|
9
|
+
* It is quite strict and dumb, only useful to handle best-effort heuristics.
|
|
10
|
+
* It only extracts a leading emoji if it is the first grapheme of the string.
|
|
11
|
+
* It only extracts one emoji, even if multiples are present.
|
|
12
|
+
* It doesn't trim the remaining string.
|
|
13
|
+
* If you need something more clever, it should be built on top.
|
|
14
|
+
* @param input
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractLeadingEmoji(input: string): {
|
|
17
|
+
emoji: string | null;
|
|
18
|
+
rest: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=emojiUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emojiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/emojiUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG;IAClD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAkBA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
8
|
+
/**
|
|
9
|
+
* This method splits "⚠️ Hello World" into "⚠️" + " Hello World".
|
|
10
|
+
* It is quite strict and dumb, only useful to handle best-effort heuristics.
|
|
11
|
+
* It only extracts a leading emoji if it is the first grapheme of the string.
|
|
12
|
+
* It only extracts one emoji, even if multiples are present.
|
|
13
|
+
* It doesn't trim the remaining string.
|
|
14
|
+
* If you need something more clever, it should be built on top.
|
|
15
|
+
* @param input
|
|
16
|
+
*/
|
|
17
|
+
export function extractLeadingEmoji(input) {
|
|
18
|
+
const it = segmenter.segment(input)[Symbol.iterator]();
|
|
19
|
+
// const first = segmenter.segment(input).containing(0)?.segment;
|
|
20
|
+
const grapheme = it.next().value?.segment;
|
|
21
|
+
if (!grapheme) {
|
|
22
|
+
return { emoji: null, rest: input };
|
|
23
|
+
}
|
|
24
|
+
// Leading grapheme contains an emoji
|
|
25
|
+
// Covers flags/ZWJ/skin tones, excludes digits
|
|
26
|
+
// See https://github.com/facebook/docusaurus/pull/12072
|
|
27
|
+
if (!/^\p{RGI_Emoji}$/v.test(grapheme)) {
|
|
28
|
+
return { emoji: null, rest: input };
|
|
29
|
+
}
|
|
30
|
+
return { emoji: grapheme, rest: input.slice(grapheme.length) };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=emojiUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emojiUtils.js","sourceRoot":"","sources":["../../src/utils/emojiUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAC,WAAW,EAAE,UAAU,EAAC,CAAC,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAI/C,MAAM,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IAEvD,iEAAiE;IACjE,MAAM,QAAQ,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;IAE1C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC;IACpC,CAAC;IAED,qCAAqC;IACrC,+CAA+C;IAC/C,wDAAwD;IACxD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC;IACpC,CAAC;IAED,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { type ComponentProps, type ReactNode } from 'react';
|
|
8
|
+
import type { Props as ErrorProps } from '@theme/Error';
|
|
9
|
+
export declare function ErrorBoundaryTryAgainButton(props: ComponentProps<'button'>): ReactNode;
|
|
10
|
+
export declare function ErrorBoundaryErrorMessageFallback({ error, tryAgain, }: ErrorProps): ReactNode;
|
|
11
|
+
export declare function ErrorBoundaryError({ error }: {
|
|
12
|
+
error: Error;
|
|
13
|
+
}): ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* This component is useful to wrap a low-level error into a more meaningful
|
|
16
|
+
* error with extra context, using the ES error-cause feature.
|
|
17
|
+
*
|
|
18
|
+
* <ErrorCauseBoundary
|
|
19
|
+
* onError={(error) => new Error("extra context message",{cause: error})}
|
|
20
|
+
* >
|
|
21
|
+
* <RiskyComponent>
|
|
22
|
+
* </ErrorCauseBoundary>
|
|
23
|
+
*/
|
|
24
|
+
export declare class ErrorCauseBoundary extends React.Component<{
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
onError: (error: Error, errorInfo: React.ErrorInfo) => Error;
|
|
27
|
+
}, unknown> {
|
|
28
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): never;
|
|
29
|
+
render(): React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=errorBoundaryUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorBoundaryUtils.d.ts","sourceRoot":"","sources":["../../src/utils/errorBoundaryUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;AAGtD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,GAC9B,SAAS,CAUX;AAGD,wBAAgB,iCAAiC,CAAC,EAChD,KAAK,EACL,QAAQ,GACT,EAAE,UAAU,GAAG,SAAS,CAOxB;AAED,wBAAgB,kBAAkB,CAAC,EAAC,KAAK,EAAC,EAAE;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,GAAG,SAAS,CAIrE;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CACrD;IACE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC;CAC9D,EACD,OAAO,CACR;IACU,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAE1E;IAEQ,MAAM,IAAI,KAAK,CAAC,SAAS,CAEjC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import Translate from '@docusaurus/Translate';
|
|
9
|
+
import { getErrorCausalChain } from '@docusaurus/utils-common';
|
|
10
|
+
import styles from './errorBoundaryUtils.module.css';
|
|
11
|
+
export function ErrorBoundaryTryAgainButton(props) {
|
|
12
|
+
return (<button type="button" {...props}>
|
|
13
|
+
<Translate id="theme.ErrorPageContent.tryAgain" description="The label of the button to try again rendering when the React error boundary captures an error">
|
|
14
|
+
Try again
|
|
15
|
+
</Translate>
|
|
16
|
+
</button>);
|
|
17
|
+
}
|
|
18
|
+
// A very simple reusable ErrorBoundary fallback component
|
|
19
|
+
export function ErrorBoundaryErrorMessageFallback({ error, tryAgain, }) {
|
|
20
|
+
return (<div className={styles.errorBoundaryFallback}>
|
|
21
|
+
<p>{error.message}</p>
|
|
22
|
+
<ErrorBoundaryTryAgainButton onClick={tryAgain}/>
|
|
23
|
+
</div>);
|
|
24
|
+
}
|
|
25
|
+
export function ErrorBoundaryError({ error }) {
|
|
26
|
+
const causalChain = getErrorCausalChain(error);
|
|
27
|
+
const fullMessage = causalChain.map((e) => e.message).join('\n\nCause:\n');
|
|
28
|
+
return <p className={styles.errorBoundaryError}>{fullMessage}</p>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* This component is useful to wrap a low-level error into a more meaningful
|
|
32
|
+
* error with extra context, using the ES error-cause feature.
|
|
33
|
+
*
|
|
34
|
+
* <ErrorCauseBoundary
|
|
35
|
+
* onError={(error) => new Error("extra context message",{cause: error})}
|
|
36
|
+
* >
|
|
37
|
+
* <RiskyComponent>
|
|
38
|
+
* </ErrorCauseBoundary>
|
|
39
|
+
*/
|
|
40
|
+
export class ErrorCauseBoundary extends React.Component {
|
|
41
|
+
componentDidCatch(error, errorInfo) {
|
|
42
|
+
throw this.props.onError(error, errorInfo);
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return this.props.children;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=errorBoundaryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorBoundaryUtils.js","sourceRoot":"","sources":["../../src/utils/errorBoundaryUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAE7D,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAErD,MAAM,UAAU,2BAA2B,CACzC,KAA+B;IAE/B,OAAO,CACL,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,CAC9B;MAAA,CAAC,SAAS,CACR,EAAE,CAAC,iCAAiC,CACpC,WAAW,CAAC,gGAAgG,CAC5G;;MACF,EAAE,SAAS,CACb;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,iCAAiC,CAAC,EAChD,KAAK,EACL,QAAQ,GACG;IACX,OAAO,CACL,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAC3C;MAAA,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CACrB;MAAA,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,EACjD;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EAAC,KAAK,EAAiB;IACxD,MAAM,WAAW,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3E,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK,CAAC,SAM7C;IACU,iBAAiB,CAAC,KAAY,EAAE,SAA0B;QACjE,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7C,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.errorBoundaryError {
|
|
9
|
+
white-space: pre-wrap;
|
|
10
|
+
color: red;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.errorBoundaryFallback {
|
|
14
|
+
color: red;
|
|
15
|
+
padding: 0.55rem;
|
|
16
|
+
}
|