@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
package/src/index.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
/*
|
|
9
|
+
* APIs to document
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
useThemeConfig,
|
|
14
|
+
type ThemeConfig,
|
|
15
|
+
type UserThemeConfig,
|
|
16
|
+
type Navbar,
|
|
17
|
+
type NavbarItem,
|
|
18
|
+
type NavbarLogo,
|
|
19
|
+
type MultiColumnFooter,
|
|
20
|
+
type SimpleFooter,
|
|
21
|
+
type Footer,
|
|
22
|
+
type FooterColumnItem,
|
|
23
|
+
type FooterLogo,
|
|
24
|
+
type FooterLinkItem,
|
|
25
|
+
type ColorModeConfig,
|
|
26
|
+
} from './utils/useThemeConfig';
|
|
27
|
+
|
|
28
|
+
export {default as ThemedComponent} from './components/ThemedComponent';
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
createStorageSlot,
|
|
32
|
+
useStorageSlot,
|
|
33
|
+
listStorageKeys,
|
|
34
|
+
} from './utils/storageUtils';
|
|
35
|
+
|
|
36
|
+
export {usePluralForm} from './utils/usePluralForm';
|
|
37
|
+
|
|
38
|
+
export {useCollapsible, Collapsible} from './components/Collapsible';
|
|
39
|
+
|
|
40
|
+
export {ThemeClassNames} from './utils/ThemeClassNames';
|
|
41
|
+
|
|
42
|
+
export {prefersReducedMotion} from './utils/accessibilityUtils';
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
useEvent,
|
|
46
|
+
usePrevious,
|
|
47
|
+
composeProviders,
|
|
48
|
+
ReactContextError,
|
|
49
|
+
} from './utils/reactUtils';
|
|
50
|
+
|
|
51
|
+
export {PageMetadata, HtmlClassNameProvider} from './utils/metadataUtils';
|
|
52
|
+
|
|
53
|
+
export {useColorMode, type ColorMode} from './contexts/colorMode';
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
NavbarSecondaryMenuFiller,
|
|
57
|
+
type NavbarSecondaryMenuComponent,
|
|
58
|
+
} from './contexts/navbarSecondaryMenu/content';
|
|
59
|
+
|
|
60
|
+
export {useWindowSize} from './hooks/useWindowSize';
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* APIs kept undocumented, on purpose
|
|
64
|
+
* Note: we still guarantee retro-compatibility on those
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
translateTagsPageTitle,
|
|
69
|
+
TagsPageLinkLabel,
|
|
70
|
+
listTagsByLetters,
|
|
71
|
+
type TagLetterEntry,
|
|
72
|
+
} from './utils/tagsUtils';
|
|
73
|
+
|
|
74
|
+
export {useAnchorTargetClassName} from './utils/anchorUtils';
|
|
75
|
+
|
|
76
|
+
export {isMultiColumnFooterLinks} from './utils/footerUtils';
|
|
77
|
+
|
|
78
|
+
export {isRegexpStringMatch} from './utils/regexpUtils';
|
|
79
|
+
|
|
80
|
+
export {duplicates, uniq, groupBy} from './utils/jsUtils';
|
|
81
|
+
|
|
82
|
+
export {usePrismTheme} from './hooks/usePrismTheme';
|
|
83
|
+
|
|
84
|
+
export {processAdmonitionProps} from './utils/admonitionUtils';
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
useHistorySelector,
|
|
88
|
+
useQueryString,
|
|
89
|
+
useQueryStringList,
|
|
90
|
+
useClearQueryString,
|
|
91
|
+
mergeSearchParams,
|
|
92
|
+
mergeSearchStrings,
|
|
93
|
+
} from './utils/historyUtils';
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
SkipToContentFallbackId,
|
|
97
|
+
SkipToContentLink,
|
|
98
|
+
} from './utils/skipToContentUtils';
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
UnlistedBannerTitle,
|
|
102
|
+
UnlistedBannerMessage,
|
|
103
|
+
DraftBannerTitle,
|
|
104
|
+
DraftBannerMessage,
|
|
105
|
+
} from './translations/contentVisibilityTranslations';
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
ErrorBoundaryTryAgainButton,
|
|
109
|
+
ErrorBoundaryError,
|
|
110
|
+
ErrorBoundaryErrorMessageFallback,
|
|
111
|
+
ErrorCauseBoundary,
|
|
112
|
+
} from './utils/errorBoundaryUtils';
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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 re-export permits to handle some level of retro-compatibility. Users
|
|
9
|
+
// might swizzle unsafe components and expose these internal imports. When we
|
|
10
|
+
// move an API from internal to public, former internal imports should keep
|
|
11
|
+
// working, so that the change doesn't become breaking.
|
|
12
|
+
//
|
|
13
|
+
// Important: this line is removed from build output with the
|
|
14
|
+
// "removeThemeInternalReexport" script for CI checks. This ensures that none of
|
|
15
|
+
// our internal code relies on this re-export and that we don't forget to
|
|
16
|
+
// migrate theme internal imports to public imports.
|
|
17
|
+
//
|
|
18
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
19
|
+
export * from './index';
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
AnnouncementBarProvider,
|
|
23
|
+
useAnnouncementBar,
|
|
24
|
+
} from './contexts/announcementBar';
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
sanitizeTabsChildren,
|
|
28
|
+
TabsProvider,
|
|
29
|
+
useTabs,
|
|
30
|
+
useTabsContextValue,
|
|
31
|
+
} from './utils/tabsUtils';
|
|
32
|
+
export type {TabValue, TabsProps, TabItemProps} from './utils/tabsUtils';
|
|
33
|
+
|
|
34
|
+
export {useNavbarMobileSidebar} from './contexts/navbarMobileSidebar';
|
|
35
|
+
export {useNavbarSecondaryMenu} from './contexts/navbarSecondaryMenu/display';
|
|
36
|
+
|
|
37
|
+
export {ColorModeProvider} from './contexts/colorMode';
|
|
38
|
+
|
|
39
|
+
export {useAlternatePageUtils} from './utils/useAlternatePageUtils';
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
type CodeBlockMetadata,
|
|
43
|
+
createCodeBlockMetadata,
|
|
44
|
+
getPrismCssVariables,
|
|
45
|
+
CodeBlockContextProvider,
|
|
46
|
+
useCodeBlockContext,
|
|
47
|
+
} from './utils/codeBlockUtils';
|
|
48
|
+
|
|
49
|
+
export {DEFAULT_SEARCH_TAG} from './utils/searchUtils';
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
TitleFormatterProvider,
|
|
53
|
+
useTitleFormatter,
|
|
54
|
+
} from './utils/titleFormatterUtils';
|
|
55
|
+
|
|
56
|
+
export {useLocationChange} from './utils/useLocationChange';
|
|
57
|
+
|
|
58
|
+
export {useLocalPathname} from './utils/useLocalPathname';
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
useHistoryPopHandler,
|
|
62
|
+
useHistorySelector,
|
|
63
|
+
useQueryStringValue,
|
|
64
|
+
} from './utils/historyUtils';
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
useFilteredAndTreeifiedTOC,
|
|
68
|
+
useTreeifiedTOC,
|
|
69
|
+
type TOCTreeNode,
|
|
70
|
+
} from './utils/tocUtils';
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
ScrollControllerProvider,
|
|
74
|
+
useScrollController,
|
|
75
|
+
useScrollPosition,
|
|
76
|
+
useScrollPositionBlocker,
|
|
77
|
+
useSmoothScrollTo,
|
|
78
|
+
} from './utils/scrollUtils';
|
|
79
|
+
|
|
80
|
+
export {useHomePageRoute, isSamePath} from './utils/routesUtils';
|
|
81
|
+
|
|
82
|
+
export {PluginHtmlClassNameProvider} from './utils/metadataUtils';
|
|
83
|
+
|
|
84
|
+
export {splitNavbarItems, NavbarProvider} from './utils/navbarUtils';
|
|
85
|
+
|
|
86
|
+
export {extractLeadingEmoji} from './utils/emojiUtils';
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
useTOCHighlight,
|
|
90
|
+
type TOCHighlightConfig,
|
|
91
|
+
} from './hooks/useTOCHighlight';
|
|
92
|
+
|
|
93
|
+
export {useDateTimeFormat} from './utils/IntlUtils';
|
|
94
|
+
|
|
95
|
+
export {useHideableNavbar} from './hooks/useHideableNavbar';
|
|
96
|
+
export {useLockBodyScroll} from './hooks/useLockBodyScroll';
|
|
97
|
+
export {useCodeWordWrap} from './hooks/useCodeWordWrap';
|
|
98
|
+
export {useBackToTopButton} from './hooks/useBackToTopButton';
|
|
99
|
+
|
|
100
|
+
export {useDocCardDescriptionCategoryItemsPlural} from './translations/docsTranslations';
|
|
101
|
+
export {
|
|
102
|
+
useBlogTagsPostsPageTitle,
|
|
103
|
+
useBlogAuthorPageTitle,
|
|
104
|
+
translateBlogAuthorsListPageTitle,
|
|
105
|
+
BlogAuthorsListViewAllLabel,
|
|
106
|
+
BlogAuthorNoPostsLabel,
|
|
107
|
+
} from './translations/blogTranslations';
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
import type {ReactNode} from 'react';
|
|
9
|
+
import Translate, {translate} from '@docusaurus/Translate';
|
|
10
|
+
import {usePluralForm} from '../utils/usePluralForm';
|
|
11
|
+
|
|
12
|
+
// Only used locally
|
|
13
|
+
function useBlogPostsPlural(): (count: number) => string {
|
|
14
|
+
const {selectMessage} = usePluralForm();
|
|
15
|
+
return (count: number) =>
|
|
16
|
+
selectMessage(
|
|
17
|
+
count,
|
|
18
|
+
translate(
|
|
19
|
+
{
|
|
20
|
+
id: 'theme.blog.post.plurals',
|
|
21
|
+
description:
|
|
22
|
+
'Pluralized label for "{count} posts". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',
|
|
23
|
+
message: 'One post|{count} posts',
|
|
24
|
+
},
|
|
25
|
+
{count},
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function useBlogTagsPostsPageTitle(tag: {
|
|
31
|
+
label: string;
|
|
32
|
+
count: number;
|
|
33
|
+
}): string {
|
|
34
|
+
const blogPostsPlural = useBlogPostsPlural();
|
|
35
|
+
return translate(
|
|
36
|
+
{
|
|
37
|
+
id: 'theme.blog.tagTitle',
|
|
38
|
+
description: 'The title of the page for a blog tag',
|
|
39
|
+
message: '{nPosts} tagged with "{tagName}"',
|
|
40
|
+
},
|
|
41
|
+
{nPosts: blogPostsPlural(tag.count), tagName: tag.label},
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function useBlogAuthorPageTitle(author: {
|
|
46
|
+
key: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
count: number;
|
|
49
|
+
}): string {
|
|
50
|
+
const blogPostsPlural = useBlogPostsPlural();
|
|
51
|
+
return translate(
|
|
52
|
+
{
|
|
53
|
+
id: 'theme.blog.author.pageTitle',
|
|
54
|
+
description: 'The title of the page for a blog author',
|
|
55
|
+
message: '{authorName} - {nPosts}',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
nPosts: blogPostsPlural(author.count),
|
|
59
|
+
authorName: author.name || author.key,
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const translateBlogAuthorsListPageTitle = (): string =>
|
|
65
|
+
translate({
|
|
66
|
+
id: 'theme.blog.authorsList.pageTitle',
|
|
67
|
+
message: 'Authors',
|
|
68
|
+
description: 'The title of the authors page',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export function BlogAuthorsListViewAllLabel(): ReactNode {
|
|
72
|
+
return (
|
|
73
|
+
<Translate
|
|
74
|
+
id="theme.blog.authorsList.viewAll"
|
|
75
|
+
description="The label of the link targeting the blog authors page">
|
|
76
|
+
View all authors
|
|
77
|
+
</Translate>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function BlogAuthorNoPostsLabel(): ReactNode {
|
|
82
|
+
return (
|
|
83
|
+
<Translate
|
|
84
|
+
id="theme.blog.author.noPosts"
|
|
85
|
+
description="The text for authors with 0 blog post">
|
|
86
|
+
This author has not written any posts yet.
|
|
87
|
+
</Translate>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
import type {ReactNode} from 'react';
|
|
9
|
+
import Translate from '@docusaurus/Translate';
|
|
10
|
+
|
|
11
|
+
export function UnlistedBannerTitle(): ReactNode {
|
|
12
|
+
return (
|
|
13
|
+
<Translate
|
|
14
|
+
id="theme.contentVisibility.unlistedBanner.title"
|
|
15
|
+
description="The unlisted content banner title">
|
|
16
|
+
Unlisted page
|
|
17
|
+
</Translate>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function UnlistedBannerMessage(): ReactNode {
|
|
22
|
+
return (
|
|
23
|
+
<Translate
|
|
24
|
+
id="theme.contentVisibility.unlistedBanner.message"
|
|
25
|
+
description="The unlisted content banner message">
|
|
26
|
+
This page is unlisted. Search engines will not index it, and only users
|
|
27
|
+
having a direct link can access it.
|
|
28
|
+
</Translate>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function DraftBannerTitle(): ReactNode {
|
|
33
|
+
return (
|
|
34
|
+
<Translate
|
|
35
|
+
id="theme.contentVisibility.draftBanner.title"
|
|
36
|
+
description="The draft content banner title">
|
|
37
|
+
Draft page
|
|
38
|
+
</Translate>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function DraftBannerMessage(): ReactNode {
|
|
43
|
+
return (
|
|
44
|
+
<Translate
|
|
45
|
+
id="theme.contentVisibility.draftBanner.message"
|
|
46
|
+
description="The draft content banner message">
|
|
47
|
+
This page is a draft. It will only be visible in dev and be excluded from
|
|
48
|
+
the production build.
|
|
49
|
+
</Translate>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import {translate} from '@docusaurus/Translate';
|
|
9
|
+
import {usePluralForm} from '../utils/usePluralForm';
|
|
10
|
+
|
|
11
|
+
export function useDocCardDescriptionCategoryItemsPlural(): (
|
|
12
|
+
count: number,
|
|
13
|
+
) => string {
|
|
14
|
+
const {selectMessage} = usePluralForm();
|
|
15
|
+
return (count: number) =>
|
|
16
|
+
selectMessage(
|
|
17
|
+
count,
|
|
18
|
+
translate(
|
|
19
|
+
{
|
|
20
|
+
message: '1 item|{count} items',
|
|
21
|
+
id: 'theme.docs.DocCard.categoryDescription.plurals',
|
|
22
|
+
description:
|
|
23
|
+
'The default description for a category card in the generated index about how many items this category includes',
|
|
24
|
+
},
|
|
25
|
+
{count},
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
8
|
+
|
|
9
|
+
function useCalendar(): string {
|
|
10
|
+
const {
|
|
11
|
+
i18n: {currentLocale, localeConfigs},
|
|
12
|
+
} = useDocusaurusContext();
|
|
13
|
+
return localeConfigs[currentLocale]!.calendar;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function useDateTimeFormat(
|
|
17
|
+
options: Intl.DateTimeFormatOptions = {},
|
|
18
|
+
): Intl.DateTimeFormat {
|
|
19
|
+
const {
|
|
20
|
+
i18n: {currentLocale},
|
|
21
|
+
} = useDocusaurusContext();
|
|
22
|
+
const calendar = useCalendar();
|
|
23
|
+
return new Intl.DateTimeFormat(currentLocale, {
|
|
24
|
+
calendar,
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
// Please do not modify the classnames! This is a breaking change, and annoying
|
|
9
|
+
// for users!
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* These class names are used to style page layouts in Docusaurus, meant to be
|
|
13
|
+
* targeted by user-provided custom CSS selectors.
|
|
14
|
+
*/
|
|
15
|
+
export const ThemeClassNames = {
|
|
16
|
+
page: {
|
|
17
|
+
blogListPage: 'blog-list-page',
|
|
18
|
+
blogPostPage: 'blog-post-page',
|
|
19
|
+
blogTagsListPage: 'blog-tags-list-page',
|
|
20
|
+
blogTagPostListPage: 'blog-tags-post-list-page',
|
|
21
|
+
blogAuthorsListPage: 'blog-authors-list-page',
|
|
22
|
+
blogAuthorsPostsPage: 'blog-authors-posts-page',
|
|
23
|
+
|
|
24
|
+
docsDocPage: 'docs-doc-page',
|
|
25
|
+
docsTagsListPage: 'docs-tags-list-page',
|
|
26
|
+
docsTagDocListPage: 'docs-tags-doc-list-page',
|
|
27
|
+
|
|
28
|
+
mdxPage: 'mdx-page',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// TODO Docusaurus v4: remove old classes?
|
|
32
|
+
wrapper: {
|
|
33
|
+
main: 'main-wrapper', // replaced by theme-layout-main
|
|
34
|
+
// TODO these wrapper class names are now quite useless
|
|
35
|
+
// TODO do breaking change later in 3.0
|
|
36
|
+
// we already add plugin name/id class on <html>: that's enough
|
|
37
|
+
blogPages: 'blog-wrapper',
|
|
38
|
+
docsPages: 'docs-wrapper',
|
|
39
|
+
mdxPages: 'mdx-wrapper',
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
common: {
|
|
43
|
+
editThisPage: 'theme-edit-this-page',
|
|
44
|
+
lastUpdated: 'theme-last-updated',
|
|
45
|
+
backToTopButton: 'theme-back-to-top-button',
|
|
46
|
+
codeBlock: 'theme-code-block',
|
|
47
|
+
admonition: 'theme-admonition',
|
|
48
|
+
unlistedBanner: 'theme-unlisted-banner',
|
|
49
|
+
draftBanner: 'theme-draft-banner',
|
|
50
|
+
|
|
51
|
+
admonitionType: (type: string) => `theme-admonition-${type}`,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
announcementBar: {
|
|
55
|
+
container: 'theme-announcement-bar',
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
tabs: {
|
|
59
|
+
container: 'theme-tabs-container',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
layout: {
|
|
63
|
+
navbar: {
|
|
64
|
+
container: 'theme-layout-navbar',
|
|
65
|
+
containerLeft: 'theme-layout-navbar-left',
|
|
66
|
+
containerRight: 'theme-layout-navbar-right',
|
|
67
|
+
mobileSidebar: {
|
|
68
|
+
container: 'theme-layout-navbar-sidebar',
|
|
69
|
+
panel: 'theme-layout-navbar-sidebar-panel',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
main: {
|
|
73
|
+
container: 'theme-layout-main',
|
|
74
|
+
},
|
|
75
|
+
footer: {
|
|
76
|
+
container: 'theme-layout-footer',
|
|
77
|
+
column: 'theme-layout-footer-column',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Follows the naming convention "theme-{blog,doc,version,page}?-<suffix>"
|
|
83
|
+
*/
|
|
84
|
+
docs: {
|
|
85
|
+
docVersionBanner: 'theme-doc-version-banner',
|
|
86
|
+
docVersionBadge: 'theme-doc-version-badge',
|
|
87
|
+
docBreadcrumbs: 'theme-doc-breadcrumbs',
|
|
88
|
+
docMarkdown: 'theme-doc-markdown',
|
|
89
|
+
docTocMobile: 'theme-doc-toc-mobile',
|
|
90
|
+
docTocDesktop: 'theme-doc-toc-desktop',
|
|
91
|
+
docFooter: 'theme-doc-footer',
|
|
92
|
+
docFooterTagsRow: 'theme-doc-footer-tags-row',
|
|
93
|
+
docFooterEditMetaRow: 'theme-doc-footer-edit-meta-row',
|
|
94
|
+
docSidebarContainer: 'theme-doc-sidebar-container',
|
|
95
|
+
docSidebarMenu: 'theme-doc-sidebar-menu',
|
|
96
|
+
docSidebarItemCategory: 'theme-doc-sidebar-item-category',
|
|
97
|
+
docSidebarItemLink: 'theme-doc-sidebar-item-link',
|
|
98
|
+
docSidebarItemCategoryLevel: (level: number) =>
|
|
99
|
+
`theme-doc-sidebar-item-category-level-${level}` as const,
|
|
100
|
+
docSidebarItemLinkLevel: (level: number) =>
|
|
101
|
+
`theme-doc-sidebar-item-link-level-${level}` as const,
|
|
102
|
+
// TODO add other stable classNames here
|
|
103
|
+
docCard: {
|
|
104
|
+
container: 'theme-doc-card-container',
|
|
105
|
+
heading: 'theme-doc-card-heading',
|
|
106
|
+
icon: 'theme-doc-card-icon',
|
|
107
|
+
title: 'theme-doc-card-title',
|
|
108
|
+
description: 'theme-doc-card-description',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
blog: {
|
|
112
|
+
// TODO add other stable classNames here
|
|
113
|
+
blogFooterTagsRow: 'theme-blog-footer-tags-row',
|
|
114
|
+
blogFooterEditMetaRow: 'theme-blog-footer-edit-meta-row',
|
|
115
|
+
},
|
|
116
|
+
pages: {
|
|
117
|
+
pageFooterEditMetaRow: 'theme-pages-footer-edit-meta-row',
|
|
118
|
+
},
|
|
119
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export function prefersReducedMotion(): boolean {
|
|
9
|
+
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
10
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
import React, {type ReactNode, type ReactElement} from 'react';
|
|
9
|
+
|
|
10
|
+
// Workaround because it's difficult in MDX v1 to provide a MDX title as props
|
|
11
|
+
// See https://github.com/facebook/docusaurus/pull/7152#issuecomment-1145779682
|
|
12
|
+
function extractMDXAdmonitionTitle(children: ReactNode): {
|
|
13
|
+
mdxAdmonitionTitle: ReactNode | undefined;
|
|
14
|
+
rest: ReactNode;
|
|
15
|
+
} {
|
|
16
|
+
const items = React.Children.toArray(children);
|
|
17
|
+
const mdxAdmonitionTitleWrapper = items.find(
|
|
18
|
+
(item) => React.isValidElement(item) && item.type === 'mdxAdmonitionTitle',
|
|
19
|
+
) as ReactElement<{children: ReactNode}> | undefined;
|
|
20
|
+
|
|
21
|
+
const rest = items.filter((item) => item !== mdxAdmonitionTitleWrapper);
|
|
22
|
+
|
|
23
|
+
const mdxAdmonitionTitle = mdxAdmonitionTitleWrapper?.props.children;
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
mdxAdmonitionTitle,
|
|
27
|
+
rest: rest.length > 0 ? <>{rest}</> : null,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function processAdmonitionProps<
|
|
32
|
+
Props extends {readonly children: ReactNode; readonly title?: ReactNode},
|
|
33
|
+
>(props: Props): Props {
|
|
34
|
+
const {mdxAdmonitionTitle, rest} = extractMDXAdmonitionTitle(props.children);
|
|
35
|
+
const title = props.title ?? mdxAdmonitionTitle;
|
|
36
|
+
return {
|
|
37
|
+
...props,
|
|
38
|
+
// Do not return "title: undefined" prop
|
|
39
|
+
// this might create unwanted props overrides when merging props
|
|
40
|
+
// For example: {...default,...props}
|
|
41
|
+
...(title && {title}),
|
|
42
|
+
children: rest,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -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,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
|
+
|
|
8
|
+
import {useThemeConfig} from './useThemeConfig';
|
|
9
|
+
import styles from './anchorUtils.module.css';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* When the navbar is sticky, this ensures that when clicking a hash link,
|
|
13
|
+
* we do not navigate to an anchor that will appear below the navbar.
|
|
14
|
+
* This happens in particular for MDX headings and footnotes.
|
|
15
|
+
*
|
|
16
|
+
* See https://github.com/facebook/docusaurus/issues/11232
|
|
17
|
+
* See also headings case https://x.com/JoshWComeau/status/1332015868725891076
|
|
18
|
+
*/
|
|
19
|
+
export function useAnchorTargetClassName(
|
|
20
|
+
id: string | undefined,
|
|
21
|
+
): string | undefined {
|
|
22
|
+
const {
|
|
23
|
+
navbar: {hideOnScroll},
|
|
24
|
+
} = useThemeConfig();
|
|
25
|
+
if (typeof id === 'undefined') {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return hideOnScroll
|
|
29
|
+
? styles.anchorTargetHideOnScrollNavbar
|
|
30
|
+
: styles.anchorTargetStickyNavbar;
|
|
31
|
+
}
|