@docusaurus/theme-classic 2.0.0-beta.15d451942 → 2.0.0-beta.18
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/admonitions.css +35 -0
- package/lib/deps.d.ts +13 -0
- package/lib/getSwizzleConfig.js +236 -0
- package/lib/index.js +63 -52
- package/lib/prism-include-languages.js +9 -5
- package/lib/theme-classic.d.ts +997 -0
- package/lib/translations.js +52 -36
- package/lib/types.d.ts +0 -589
- package/lib/validateThemeConfig.js +242 -250
- package/lib-next/theme/Admonition/index.js +101 -0
- package/lib-next/theme/AnnouncementBar/index.js +10 -22
- package/lib-next/theme/AnnouncementBar/styles.module.css +26 -35
- package/lib-next/theme/BackToTopButton/index.js +129 -0
- package/lib-next/theme/BackToTopButton/styles.module.css +44 -0
- package/lib-next/theme/BlogArchivePage/index.js +84 -0
- package/lib-next/theme/BlogLayout/index.js +37 -0
- package/lib-next/theme/BlogListPage/index.js +45 -35
- package/lib-next/theme/BlogListPaginator/index.js +13 -16
- package/lib-next/theme/BlogPostAuthor/index.js +52 -0
- package/lib-next/theme/BlogPostAuthor/styles.module.css +12 -0
- package/lib-next/theme/BlogPostAuthors/index.js +44 -0
- package/lib-next/theme/BlogPostAuthors/styles.module.css +21 -0
- package/lib-next/theme/BlogPostItem/index.js +112 -97
- package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
- package/lib-next/theme/BlogPostPage/index.js +84 -41
- package/lib-next/theme/BlogPostPaginator/index.js +13 -20
- package/lib-next/theme/BlogSidebar/index.js +23 -16
- package/lib-next/theme/BlogSidebar/styles.module.css +8 -8
- package/lib-next/theme/BlogTagsListPage/index.js +24 -70
- package/lib-next/theme/BlogTagsPostsPage/index.js +57 -62
- package/lib-next/theme/CodeBlock/CopyButton/index.js +60 -0
- package/lib-next/theme/CodeBlock/CopyButton/styles.module.css +66 -0
- package/lib-next/theme/CodeBlock/index.js +74 -195
- package/lib-next/theme/CodeBlock/styles.module.css +13 -28
- package/lib-next/theme/ColorModeToggle/index.js +62 -0
- package/lib-next/theme/ColorModeToggle/styles.module.css +35 -0
- package/lib-next/theme/Details/index.js +21 -0
- package/lib-next/theme/Details/styles.module.css +13 -0
- package/lib-next/theme/DocBreadcrumbs/index.js +93 -0
- package/{lib/theme/Heading → lib-next/theme/DocBreadcrumbs}/styles.module.css +3 -2
- package/lib-next/theme/DocCard/index.js +93 -0
- package/lib-next/theme/DocCard/styles.module.css +34 -0
- package/lib-next/theme/DocCardList/index.js +31 -0
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +75 -0
- package/lib-next/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/lib-next/theme/DocItem/index.js +99 -86
- package/lib-next/theme/DocItem/styles.module.css +7 -13
- package/lib-next/theme/DocItemFooter/index.js +79 -0
- package/{lib/theme/Layout/styles.css → lib-next/theme/DocItemFooter/styles.module.css} +8 -11
- package/lib-next/theme/DocPage/index.js +124 -99
- package/lib-next/theme/DocPage/styles.module.css +14 -30
- package/lib-next/theme/DocPaginator/index.js +16 -25
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
- package/{lib/theme/Footer → lib-next/theme/DocSidebar/Desktop/Content}/styles.module.css +8 -6
- package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/lib-next/theme/DocSidebar/Mobile/index.js +49 -0
- package/lib-next/theme/DocSidebar/index.js +13 -333
- package/lib-next/theme/DocSidebarItem/index.js +265 -0
- package/lib-next/theme/DocSidebarItem/styles.module.css +17 -0
- package/lib-next/theme/DocSidebarItems/index.js +28 -0
- package/lib-next/theme/DocTagDocListPage/index.js +96 -0
- package/lib-next/theme/DocTagsListPage/index.js +40 -0
- package/lib-next/theme/DocVersionBadge/index.js +34 -0
- package/lib-next/theme/{DocVersionSuggestions → DocVersionBanner}/index.js +54 -36
- package/lib-next/theme/EditThisPage/index.js +6 -1
- package/lib-next/theme/ErrorPageContent.js +35 -0
- package/lib-next/theme/Footer/Copyright/index.js +18 -0
- package/lib-next/theme/Footer/Layout/index.js +26 -0
- package/lib-next/theme/Footer/LinkItem/index.js +33 -0
- package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
- package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
- package/lib-next/theme/Footer/Links/index.js +17 -0
- package/lib-next/theme/Footer/Logo/index.js +38 -0
- package/{src/theme/Footer → lib-next/theme/Footer/Logo}/styles.module.css +2 -1
- package/lib-next/theme/Footer/index.js +12 -100
- package/lib-next/theme/Heading/index.js +42 -33
- package/lib-next/theme/Heading/styles.module.css +27 -2
- package/lib-next/theme/IconArrow/index.js +3 -6
- package/lib-next/theme/IconClose/index.js +23 -0
- package/lib-next/theme/IconDarkMode/index.js +17 -0
- package/lib-next/theme/IconEdit/index.js +5 -10
- package/lib-next/theme/IconExternalLink/index.js +23 -0
- package/lib-next/theme/{LastUpdated → IconExternalLink}/styles.module.css +2 -2
- package/lib-next/theme/IconLanguage/index.js +5 -8
- package/lib-next/theme/IconLightMode/index.js +17 -0
- package/lib-next/theme/IconMenu/index.js +8 -9
- package/lib-next/theme/LastUpdated/index.js +35 -39
- package/lib-next/theme/Layout/index.js +19 -16
- package/lib-next/theme/Layout/styles.css +6 -0
- package/lib-next/theme/LayoutProviders/index.js +22 -10
- package/lib-next/theme/Logo/index.js +21 -16
- package/lib-next/theme/{ThemeContext.js → MDXComponents/A.js} +4 -2
- package/lib-next/theme/MDXComponents/Code.js +28 -0
- package/lib-next/theme/MDXComponents/Details.js +20 -0
- package/lib-next/theme/MDXComponents/Head.js +26 -0
- package/lib-next/theme/{hooks/styles.css → MDXComponents/Heading.js} +4 -3
- package/lib-next/theme/MDXComponents/Img.js +24 -0
- package/{lib/theme/LastUpdated/styles.module.css → lib-next/theme/MDXComponents/Img.module.css} +2 -2
- package/lib-next/theme/MDXComponents/Pre.js +18 -0
- package/lib-next/theme/MDXComponents/Ul.js +23 -0
- package/lib-next/theme/MDXComponents/Ul.module.css +11 -0
- package/lib-next/theme/MDXComponents/index.js +22 -42
- package/lib-next/theme/MDXContent/index.js +12 -0
- package/lib-next/theme/MDXPage/index.js +38 -39
- package/{lib/theme/IconEdit → lib-next/theme/MDXPage}/styles.module.css +2 -3
- package/lib-next/theme/Navbar/ColorModeToggle/index.js +25 -0
- package/lib-next/theme/Navbar/Content/index.js +70 -0
- package/lib-next/theme/Navbar/Content/styles.module.css +15 -0
- package/lib-next/theme/Navbar/Layout/index.js +54 -0
- package/{src/theme/Navbar → lib-next/theme/Navbar/Layout}/styles.module.css +1 -7
- package/lib-next/theme/Navbar/Logo/index.js +17 -0
- package/lib-next/theme/Navbar/MobileSidebar/Header/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/Layout/index.js +28 -0
- package/lib-next/theme/Navbar/MobileSidebar/PrimaryMenu/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/SecondaryMenu/index.js +36 -0
- package/lib-next/theme/Navbar/MobileSidebar/Toggle/index.js +23 -0
- package/lib-next/theme/Navbar/MobileSidebar/index.js +31 -0
- package/lib-next/theme/Navbar/index.js +7 -137
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +33 -186
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +31 -14
- package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +73 -0
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +38 -24
- package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +4 -1
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +164 -0
- package/lib-next/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +12 -13
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +66 -0
- package/lib-next/theme/NavbarItem/index.js +27 -15
- package/lib-next/theme/{UserPreferencesContext.js → NavbarItem/utils.js} +3 -3
- package/lib-next/theme/NotFound.js +40 -34
- package/lib-next/theme/PaginatorNavLink/index.js +17 -0
- package/lib-next/theme/SearchBar.js +1 -1
- package/lib-next/theme/SearchMetadata/index.js +34 -0
- package/lib-next/theme/{LayoutHead → SiteMetadata}/index.js +25 -45
- package/lib-next/theme/SkipToContent/index.js +9 -8
- package/lib-next/theme/SkipToContent/styles.module.css +8 -3
- package/lib-next/theme/TOC/index.js +12 -39
- package/lib-next/theme/TOC/styles.module.css +2 -2
- package/lib-next/theme/TOCCollapsible/index.js +52 -0
- package/lib-next/theme/TOCCollapsible/styles.module.css +50 -0
- package/lib-next/theme/TOCInline/index.js +10 -31
- package/lib-next/theme/TOCItems/index.js +85 -0
- package/lib-next/theme/TabItem/index.js +1 -4
- package/lib-next/theme/Tabs/__tests__/index.test.js +146 -0
- package/lib-next/theme/Tabs/index.js +108 -50
- package/lib-next/theme/Tabs/styles.module.css +0 -13
- package/lib-next/theme/Tag/index.js +24 -0
- package/lib-next/theme/Tag/styles.module.css +70 -0
- package/lib-next/theme/TagsListByLetter/index.js +40 -0
- package/lib-next/theme/TagsListByLetter/styles.module.css +11 -0
- package/lib-next/theme/TagsListInline/index.js +31 -0
- package/{lib/theme/BlogPostItem → lib-next/theme/TagsListInline}/styles.module.css +5 -4
- package/lib-next/theme/ThemedImage/index.js +10 -14
- package/lib-next/theme/ThemedImage/styles.module.css +9 -2
- package/lib-next/theme/prism-include-languages.js +17 -15
- package/package.json +32 -31
- package/src/admonitions.css +35 -0
- package/src/deps.d.ts +13 -0
- package/src/getSwizzleConfig.ts +244 -0
- package/src/index.ts +72 -72
- package/{lib-next/prism-include-languages.js → src/prism-include-languages.ts} +0 -0
- package/src/theme/Admonition/index.tsx +106 -0
- package/src/theme/AnnouncementBar/index.tsx +11 -20
- package/src/theme/AnnouncementBar/styles.module.css +26 -35
- package/src/theme/BackToTopButton/index.tsx +141 -0
- package/src/theme/BackToTopButton/styles.module.css +44 -0
- package/src/theme/BlogArchivePage/index.tsx +92 -0
- package/src/theme/BlogLayout/index.tsx +42 -0
- package/src/theme/BlogListPage/index.tsx +45 -35
- package/src/theme/BlogListPaginator/index.tsx +13 -15
- package/src/theme/BlogPostAuthor/index.tsx +54 -0
- package/src/theme/BlogPostAuthor/styles.module.css +12 -0
- package/src/theme/BlogPostAuthors/index.tsx +49 -0
- package/src/theme/BlogPostAuthors/styles.module.css +21 -0
- package/src/theme/BlogPostItem/index.tsx +103 -93
- package/src/theme/BlogPostItem/styles.module.css +5 -1
- package/src/theme/BlogPostPage/index.tsx +84 -42
- package/src/theme/BlogPostPaginator/index.tsx +13 -19
- package/src/theme/BlogSidebar/index.tsx +23 -16
- package/src/theme/BlogSidebar/styles.module.css +8 -8
- package/src/theme/BlogTagsListPage/index.tsx +24 -70
- package/src/theme/BlogTagsPostsPage/index.tsx +54 -65
- package/src/theme/CodeBlock/CopyButton/index.tsx +66 -0
- package/src/theme/CodeBlock/CopyButton/styles.module.css +66 -0
- package/src/theme/CodeBlock/index.tsx +77 -196
- package/src/theme/CodeBlock/styles.module.css +13 -28
- package/src/theme/ColorModeToggle/index.tsx +67 -0
- package/src/theme/ColorModeToggle/styles.module.css +35 -0
- package/src/theme/Details/index.tsx +25 -0
- package/src/theme/Details/styles.module.css +13 -0
- package/src/theme/DocBreadcrumbs/index.tsx +110 -0
- package/src/theme/DocBreadcrumbs/styles.module.css +11 -0
- package/src/theme/DocCard/index.tsx +116 -0
- package/src/theme/DocCard/styles.module.css +34 -0
- package/src/theme/DocCardList/index.tsx +38 -0
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +86 -0
- package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/src/theme/DocItem/index.tsx +93 -79
- package/src/theme/DocItem/styles.module.css +7 -13
- package/src/theme/DocItemFooter/index.tsx +91 -0
- package/src/theme/DocItemFooter/styles.module.css +18 -0
- package/src/theme/DocPage/index.tsx +124 -101
- package/src/theme/DocPage/styles.module.css +14 -30
- package/src/theme/DocPaginator/index.tsx +16 -24
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
- package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/src/theme/DocSidebar/Mobile/index.tsx +54 -0
- package/src/theme/DocSidebar/index.tsx +14 -343
- package/src/theme/DocSidebarItem/index.tsx +282 -0
- package/src/theme/DocSidebarItem/styles.module.css +17 -0
- package/src/theme/DocSidebarItems/index.tsx +32 -0
- package/src/theme/DocTagDocListPage/index.tsx +97 -0
- package/src/theme/DocTagsListPage/index.tsx +44 -0
- package/src/theme/DocVersionBadge/index.tsx +35 -0
- package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +76 -47
- package/src/theme/EditThisPage/index.tsx +6 -1
- package/src/theme/ErrorPageContent.tsx +41 -0
- package/src/theme/Footer/Copyright/index.tsx +20 -0
- package/src/theme/Footer/Layout/index.tsx +34 -0
- package/src/theme/Footer/LinkItem/index.tsx +36 -0
- package/src/theme/Footer/Links/MultiColumn/index.tsx +51 -0
- package/src/theme/Footer/Links/Simple/index.tsx +42 -0
- package/src/theme/Footer/Links/index.tsx +21 -0
- package/src/theme/Footer/Logo/index.tsx +41 -0
- package/{lib-next/theme/Footer → src/theme/Footer/Logo}/styles.module.css +2 -1
- package/src/theme/Footer/index.tsx +13 -113
- package/src/theme/Heading/index.tsx +43 -35
- package/src/theme/Heading/styles.module.css +27 -2
- package/src/theme/IconArrow/index.tsx +3 -5
- package/src/theme/IconClose/index.tsx +26 -0
- package/src/theme/IconDarkMode/index.tsx +20 -0
- package/src/theme/IconEdit/index.tsx +8 -9
- package/src/theme/IconExternalLink/index.tsx +30 -0
- package/src/theme/IconExternalLink/styles.module.css +10 -0
- package/src/theme/IconLanguage/index.tsx +6 -8
- package/src/theme/IconLightMode/index.tsx +20 -0
- package/src/theme/IconMenu/index.tsx +4 -9
- package/src/theme/LastUpdated/index.tsx +35 -39
- package/src/theme/Layout/index.tsx +19 -15
- package/src/theme/Layout/styles.css +6 -0
- package/src/theme/LayoutProviders/index.tsx +22 -10
- package/src/theme/Logo/index.tsx +21 -15
- package/src/theme/{ThemeContext.ts → MDXComponents/A.tsx} +5 -6
- package/src/theme/MDXComponents/Code.tsx +37 -0
- package/src/theme/MDXComponents/Details.tsx +26 -0
- package/src/theme/MDXComponents/Head.tsx +29 -0
- package/src/theme/MDXComponents/Heading.tsx +14 -0
- package/src/theme/{LastUpdated/styles.module.css → MDXComponents/Img.module.css} +2 -2
- package/src/theme/MDXComponents/Img.tsx +26 -0
- package/src/theme/MDXComponents/Pre.tsx +22 -0
- package/src/theme/MDXComponents/Ul.module.css +11 -0
- package/src/theme/MDXComponents/Ul.tsx +28 -0
- package/src/theme/MDXComponents/index.tsx +23 -42
- package/src/theme/MDXContent/index.tsx +15 -0
- package/src/theme/MDXPage/index.tsx +39 -39
- package/src/theme/MDXPage/styles.module.css +10 -0
- package/src/theme/Navbar/ColorModeToggle/index.tsx +30 -0
- package/src/theme/Navbar/Content/index.tsx +81 -0
- package/src/theme/Navbar/Content/styles.module.css +15 -0
- package/src/theme/Navbar/Layout/index.tsx +57 -0
- package/{lib/theme/Navbar → src/theme/Navbar/Layout}/styles.module.css +1 -7
- package/src/theme/Navbar/Logo/index.tsx +19 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +34 -0
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +31 -0
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +25 -0
- package/src/theme/Navbar/MobileSidebar/index.tsx +33 -0
- package/src/theme/Navbar/index.tsx +7 -147
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +37 -194
- package/src/theme/NavbarItem/DocNavbarItem.tsx +33 -15
- package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +84 -0
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +44 -28
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +7 -3
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +190 -0
- package/src/theme/NavbarItem/{LocaleDropdownNavbarItem.tsx → LocaleDropdownNavbarItem/index.tsx} +17 -11
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/src/theme/NavbarItem/NavbarNavLink.tsx +64 -0
- package/src/theme/NavbarItem/index.tsx +41 -19
- package/src/theme/NavbarItem/utils.ts +10 -0
- package/src/theme/NotFound.tsx +40 -33
- package/src/theme/PaginatorNavLink/index.tsx +20 -0
- package/src/theme/SearchBar.tsx +2 -1
- package/src/theme/SearchMetadata/index.tsx +43 -0
- package/src/theme/{LayoutHead → SiteMetadata}/index.tsx +25 -38
- package/src/theme/SkipToContent/index.tsx +9 -8
- package/src/theme/SkipToContent/styles.module.css +8 -3
- package/src/theme/TOC/index.tsx +13 -44
- package/src/theme/TOC/styles.module.css +2 -2
- package/src/theme/TOCCollapsible/index.tsx +56 -0
- package/src/theme/TOCCollapsible/styles.module.css +50 -0
- package/src/theme/TOCInline/index.tsx +14 -35
- package/src/theme/TOCItems/index.tsx +100 -0
- package/src/theme/TabItem/index.tsx +5 -3
- package/src/theme/Tabs/index.tsx +117 -59
- package/src/theme/Tabs/styles.module.css +0 -13
- package/src/theme/Tag/index.tsx +29 -0
- package/src/theme/Tag/styles.module.css +70 -0
- package/src/theme/TagsListByLetter/index.tsx +43 -0
- package/src/theme/TagsListByLetter/styles.module.css +11 -0
- package/src/theme/TagsListInline/index.tsx +35 -0
- package/src/theme/TagsListInline/styles.module.css +15 -0
- package/src/theme/ThemedImage/index.tsx +12 -13
- package/src/theme/ThemedImage/styles.module.css +9 -2
- package/src/theme/prism-include-languages.ts +20 -15
- package/src/theme-classic.d.ts +997 -0
- package/src/translations.ts +84 -58
- package/src/types.d.ts +0 -589
- package/src/validateThemeConfig.ts +381 -0
- package/babel.config.js +0 -35
- package/codeTranslations/README.md +0 -20
- package/codeTranslations/ar.json +0 -55
- package/codeTranslations/base.json +0 -108
- package/codeTranslations/da.json +0 -55
- package/codeTranslations/de.json +0 -55
- package/codeTranslations/es.json +0 -55
- package/codeTranslations/fa.json +0 -55
- package/codeTranslations/fil.json +0 -55
- package/codeTranslations/fr.json +0 -55
- package/codeTranslations/he.json +0 -55
- package/codeTranslations/hi.json +0 -55
- package/codeTranslations/ja.json +0 -55
- package/codeTranslations/ko.json +0 -55
- package/codeTranslations/pl.json +0 -55
- package/codeTranslations/pt-BR.json +0 -55
- package/codeTranslations/pt-PT.json +0 -55
- package/codeTranslations/ru.json +0 -55
- package/codeTranslations/tr.json +0 -55
- package/codeTranslations/vi.json +0 -55
- package/codeTranslations/zh-Hans.json +0 -55
- package/codeTranslations/zh-Hant.json +0 -55
- package/lib/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/lib/__tests__/translations.test.js +0 -112
- package/lib/__tests__/validateThemeConfig.test.js +0 -333
- package/lib/theme/AnnouncementBar/index.js +0 -74
- package/lib/theme/AnnouncementBar/styles.module.css +0 -72
- package/lib/theme/BlogListPage/index.js +0 -71
- package/lib/theme/BlogListPaginator/index.js +0 -63
- package/lib/theme/BlogPostItem/index.js +0 -152
- package/lib/theme/BlogPostPage/index.js +0 -75
- package/lib/theme/BlogPostPaginator/index.js +0 -64
- package/lib/theme/BlogSidebar/index.js +0 -43
- package/lib/theme/BlogSidebar/styles.module.css +0 -46
- package/lib/theme/BlogTagsListPage/index.js +0 -81
- package/lib/theme/BlogTagsPostsPage/index.js +0 -104
- package/lib/theme/CodeBlock/index.js +0 -253
- package/lib/theme/CodeBlock/styles.module.css +0 -71
- package/lib/theme/DocItem/index.js +0 -120
- package/lib/theme/DocItem/styles.module.css +0 -28
- package/lib/theme/DocPage/index.js +0 -141
- package/lib/theme/DocPage/styles.module.css +0 -98
- package/lib/theme/DocPaginator/index.js +0 -63
- package/lib/theme/DocSidebar/index.js +0 -307
- package/lib/theme/DocSidebar/styles.module.css +0 -138
- package/lib/theme/DocVersionSuggestions/index.js +0 -111
- package/lib/theme/EditThisPage/index.js +0 -31
- package/lib/theme/Footer/index.js +0 -108
- package/lib/theme/Heading/index.js +0 -60
- package/lib/theme/Heading/styles.css +0 -23
- package/lib/theme/IconArrow/index.js +0 -28
- package/lib/theme/IconEdit/index.js +0 -34
- package/lib/theme/IconLanguage/index.js +0 -29
- package/lib/theme/IconMenu/index.js +0 -31
- package/lib/theme/LastUpdated/index.js +0 -65
- package/lib/theme/Layout/index.js +0 -64
- package/lib/theme/LayoutHead/index.js +0 -144
- package/lib/theme/LayoutProviders/index.js +0 -34
- package/lib/theme/Logo/index.js +0 -59
- package/lib/theme/MDXComponents/index.js +0 -65
- package/lib/theme/MDXPage/index.js +0 -68
- package/lib/theme/Navbar/index.js +0 -147
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +0 -195
- package/lib/theme/NavbarItem/DocNavbarItem.js +0 -55
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +0 -75
- package/lib/theme/NavbarItem/DocsVersionNavbarItem.js +0 -43
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem.js +0 -72
- package/lib/theme/NavbarItem/SearchNavbarItem.js +0 -28
- package/lib/theme/NavbarItem/index.js +0 -54
- package/lib/theme/NotFound.js +0 -50
- package/lib/theme/SearchBar.js +0 -15
- package/lib/theme/SearchMetadatas/index.js +0 -33
- package/lib/theme/Seo/index.js +0 -49
- package/lib/theme/SkipToContent/index.js +0 -61
- package/lib/theme/SkipToContent/styles.module.css +0 -16
- package/lib/theme/TOC/index.js +0 -59
- package/lib/theme/TOC/styles.module.css +0 -23
- package/lib/theme/TOCInline/index.js +0 -53
- package/lib/theme/TOCInline/styles.module.css +0 -12
- package/lib/theme/TabItem/index.js +0 -32
- package/lib/theme/Tabs/index.js +0 -150
- package/lib/theme/Tabs/styles.module.css +0 -23
- package/lib/theme/ThemeContext.js +0 -21
- package/lib/theme/ThemeProvider/index.js +0 -38
- package/lib/theme/ThemedImage/index.js +0 -48
- package/lib/theme/ThemedImage/styles.module.css +0 -11
- package/lib/theme/Toggle/index.js +0 -106
- package/lib/theme/Toggle/styles.module.css +0 -114
- package/lib/theme/UserPreferencesContext.js +0 -18
- package/lib/theme/UserPreferencesProvider/index.js +0 -44
- package/lib/theme/hooks/styles.css +0 -10
- package/lib/theme/hooks/useAnnouncementBar.js +0 -63
- package/lib/theme/hooks/useContextualSearchFilters.js +0 -47
- package/lib/theme/hooks/useDocs.js +0 -18
- package/lib/theme/hooks/useHideableNavbar.js +0 -92
- package/lib/theme/hooks/useKeyboardNavigation.js +0 -45
- package/lib/theme/hooks/useLocationHash.js +0 -28
- package/lib/theme/hooks/useLockBodyScroll.js +0 -26
- package/lib/theme/hooks/usePrismTheme.js +0 -36
- package/lib/theme/hooks/useScrollPosition.js +0 -49
- package/lib/theme/hooks/useTOCHighlight.js +0 -87
- package/lib/theme/hooks/useTabGroupChoice.js +0 -53
- package/lib/theme/hooks/useTheme.js +0 -99
- package/lib/theme/hooks/useThemeContext.js +0 -31
- package/lib/theme/hooks/useUserPreferencesContext.js +0 -31
- package/lib/theme/hooks/useWindowSize.js +0 -55
- package/lib/theme/prism-include-languages.js +0 -39
- package/lib-next/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/lib-next/__tests__/translations.test.js +0 -128
- package/lib-next/__tests__/validateThemeConfig.test.js +0 -333
- package/lib-next/index.js +0 -198
- package/lib-next/theme/DocSidebar/styles.module.css +0 -138
- package/lib-next/theme/Heading/styles.css +0 -23
- package/lib-next/theme/Navbar/styles.module.css +0 -20
- package/lib-next/theme/SearchMetadatas/index.js +0 -20
- package/lib-next/theme/Seo/index.js +0 -36
- package/lib-next/theme/ThemeProvider/index.js +0 -25
- package/lib-next/theme/Toggle/index.js +0 -95
- package/lib-next/theme/Toggle/styles.module.css +0 -114
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -28
- package/lib-next/theme/hooks/useAnnouncementBar.js +0 -49
- package/lib-next/theme/hooks/useContextualSearchFilters.js +0 -41
- package/lib-next/theme/hooks/useDocs.js +0 -10
- package/lib-next/theme/hooks/useHideableNavbar.js +0 -79
- package/lib-next/theme/hooks/useKeyboardNavigation.js +0 -35
- package/lib-next/theme/hooks/useLocationHash.js +0 -20
- package/lib-next/theme/hooks/useLockBodyScroll.js +0 -18
- package/lib-next/theme/hooks/usePrismTheme.js +0 -20
- package/lib-next/theme/hooks/useScrollPosition.js +0 -38
- package/lib-next/theme/hooks/useTOCHighlight.js +0 -84
- package/lib-next/theme/hooks/useTabGroupChoice.js +0 -41
- package/lib-next/theme/hooks/useTheme.js +0 -82
- package/lib-next/theme/hooks/useThemeContext.js +0 -22
- package/lib-next/theme/hooks/useUserPreferencesContext.js +0 -22
- package/lib-next/theme/hooks/useWindowSize.js +0 -45
- package/lib-next/translations.js +0 -145
- package/lib-next/types.d.ts +0 -600
- package/lib-next/validateThemeConfig.js +0 -317
- package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/src/__tests__/translations.test.ts +0 -116
- package/src/__tests__/validateThemeConfig.test.js +0 -333
- package/src/prism-include-languages.js +0 -11
- package/src/theme/DocSidebar/styles.module.css +0 -138
- package/src/theme/Heading/styles.css +0 -23
- package/src/theme/SearchMetadatas/index.tsx +0 -28
- package/src/theme/Seo/index.tsx +0 -46
- package/src/theme/ThemeProvider/index.tsx +0 -24
- package/src/theme/Toggle/index.tsx +0 -113
- package/src/theme/Toggle/styles.module.css +0 -114
- package/src/theme/UserPreferencesContext.ts +0 -12
- package/src/theme/UserPreferencesProvider/index.tsx +0 -32
- package/src/theme/hooks/styles.css +0 -10
- package/src/theme/hooks/useAnnouncementBar.ts +0 -58
- package/src/theme/hooks/useContextualSearchFilters.ts +0 -52
- package/src/theme/hooks/useDocs.ts +0 -11
- package/src/theme/hooks/useHideableNavbar.ts +0 -85
- package/src/theme/hooks/useKeyboardNavigation.ts +0 -39
- package/src/theme/hooks/useLocationHash.ts +0 -25
- package/src/theme/hooks/useLockBodyScroll.ts +0 -20
- package/src/theme/hooks/usePrismTheme.ts +0 -22
- package/src/theme/hooks/useScrollPosition.ts +0 -45
- package/src/theme/hooks/useTOCHighlight.ts +0 -98
- package/src/theme/hooks/useTabGroupChoice.ts +0 -46
- package/src/theme/hooks/useTheme.ts +0 -92
- package/src/theme/hooks/useThemeContext.ts +0 -23
- package/src/theme/hooks/useUserPreferencesContext.ts +0 -25
- package/src/theme/hooks/useWindowSize.ts +0 -51
- package/src/validateThemeConfig.js +0 -317
- package/tsconfig.json +0 -12
- package/update-code-translations.js +0 -239
- package/update-code-translations.test.js +0 -33
|
@@ -1,98 +0,0 @@
|
|
|
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 {useEffect, useState} from 'react';
|
|
9
|
-
|
|
10
|
-
function useTOCHighlight(
|
|
11
|
-
linkClassName: string,
|
|
12
|
-
linkActiveClassName: string,
|
|
13
|
-
topOffset: number,
|
|
14
|
-
): void {
|
|
15
|
-
const [lastActiveLink, setLastActiveLink] = useState<
|
|
16
|
-
HTMLAnchorElement | undefined
|
|
17
|
-
>(undefined);
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
function setActiveLink() {
|
|
21
|
-
function getActiveHeaderAnchor(): Element | null {
|
|
22
|
-
const headersAnchors: Element[] = Array.from(
|
|
23
|
-
document.getElementsByClassName('anchor'),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const firstAnchorUnderViewportTop = headersAnchors.find((anchor) => {
|
|
27
|
-
const {top} = anchor.getBoundingClientRect();
|
|
28
|
-
return top >= topOffset;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (firstAnchorUnderViewportTop) {
|
|
32
|
-
// If first anchor in viewport is under a certain threshold, we consider it's not the active anchor.
|
|
33
|
-
// In such case, the active anchor is the previous one (if it exists), that may be above the viewport
|
|
34
|
-
if (
|
|
35
|
-
firstAnchorUnderViewportTop.getBoundingClientRect().top >= topOffset
|
|
36
|
-
) {
|
|
37
|
-
const previousAnchor =
|
|
38
|
-
headersAnchors[
|
|
39
|
-
headersAnchors.indexOf(firstAnchorUnderViewportTop) - 1
|
|
40
|
-
];
|
|
41
|
-
return previousAnchor ?? firstAnchorUnderViewportTop;
|
|
42
|
-
}
|
|
43
|
-
// If the anchor is at the top of the viewport, we consider it's the first anchor
|
|
44
|
-
else {
|
|
45
|
-
return firstAnchorUnderViewportTop;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// no anchor under viewport top? (ie we are at the bottom of the page)
|
|
49
|
-
else {
|
|
50
|
-
// highlight the last anchor found
|
|
51
|
-
return headersAnchors[headersAnchors.length - 1];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const activeHeaderAnchor = getActiveHeaderAnchor();
|
|
56
|
-
|
|
57
|
-
if (activeHeaderAnchor) {
|
|
58
|
-
let index = 0;
|
|
59
|
-
let itemHighlighted = false;
|
|
60
|
-
|
|
61
|
-
// @ts-expect-error: Must be <a> tags.
|
|
62
|
-
const links: HTMLCollectionOf<HTMLAnchorElement> = document.getElementsByClassName(
|
|
63
|
-
linkClassName,
|
|
64
|
-
);
|
|
65
|
-
while (index < links.length && !itemHighlighted) {
|
|
66
|
-
const link = links[index];
|
|
67
|
-
const {href} = link;
|
|
68
|
-
const anchorValue = decodeURIComponent(
|
|
69
|
-
href.substring(href.indexOf('#') + 1),
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (activeHeaderAnchor.id === anchorValue) {
|
|
73
|
-
if (lastActiveLink) {
|
|
74
|
-
lastActiveLink.classList.remove(linkActiveClassName);
|
|
75
|
-
}
|
|
76
|
-
link.classList.add(linkActiveClassName);
|
|
77
|
-
setLastActiveLink(link);
|
|
78
|
-
itemHighlighted = true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
index += 1;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
document.addEventListener('scroll', setActiveLink);
|
|
87
|
-
document.addEventListener('resize', setActiveLink);
|
|
88
|
-
|
|
89
|
-
setActiveLink();
|
|
90
|
-
|
|
91
|
-
return () => {
|
|
92
|
-
document.removeEventListener('scroll', setActiveLink);
|
|
93
|
-
document.removeEventListener('resize', setActiveLink);
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export default useTOCHighlight;
|
|
@@ -1,46 +0,0 @@
|
|
|
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 {useState, useCallback, useEffect} from 'react';
|
|
9
|
-
import type {useTabGroupChoiceReturns} from '@theme/hooks/useTabGroupChoice';
|
|
10
|
-
import {createStorageSlot, listStorageKeys} from '@docusaurus/theme-common';
|
|
11
|
-
|
|
12
|
-
const TAB_CHOICE_PREFIX = 'docusaurus.tab.';
|
|
13
|
-
|
|
14
|
-
const useTabGroupChoice = (): useTabGroupChoiceReturns => {
|
|
15
|
-
const [tabGroupChoices, setChoices] = useState<{
|
|
16
|
-
readonly [groupId: string]: string;
|
|
17
|
-
}>({});
|
|
18
|
-
const setChoiceSyncWithLocalStorage = useCallback((groupId, newChoice) => {
|
|
19
|
-
createStorageSlot(`${TAB_CHOICE_PREFIX}${groupId}`).set(newChoice);
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
try {
|
|
24
|
-
const localStorageChoices = {};
|
|
25
|
-
for (const storageKey of listStorageKeys()) {
|
|
26
|
-
if (storageKey.startsWith(TAB_CHOICE_PREFIX)) {
|
|
27
|
-
const groupId = storageKey.substring(TAB_CHOICE_PREFIX.length);
|
|
28
|
-
localStorageChoices[groupId] = createStorageSlot(storageKey).get();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
setChoices(localStorageChoices);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
console.error(err);
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
tabGroupChoices,
|
|
39
|
-
setTabGroupChoices: (groupId: string, newChoice: string) => {
|
|
40
|
-
setChoices((oldChoices) => ({...oldChoices, [groupId]: newChoice}));
|
|
41
|
-
setChoiceSyncWithLocalStorage(groupId, newChoice);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default useTabGroupChoice;
|
|
@@ -1,92 +0,0 @@
|
|
|
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 {useState, useCallback, useEffect} from 'react';
|
|
9
|
-
|
|
10
|
-
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
|
11
|
-
import type {useThemeReturns} from '@theme/hooks/useTheme';
|
|
12
|
-
import {useThemeConfig, createStorageSlot} from '@docusaurus/theme-common';
|
|
13
|
-
|
|
14
|
-
const ThemeStorage = createStorageSlot('theme');
|
|
15
|
-
|
|
16
|
-
const themes = {
|
|
17
|
-
light: 'light',
|
|
18
|
-
dark: 'dark',
|
|
19
|
-
} as const;
|
|
20
|
-
|
|
21
|
-
type Themes = typeof themes[keyof typeof themes];
|
|
22
|
-
|
|
23
|
-
// Ensure to always return a valid theme even if input is invalid
|
|
24
|
-
const coerceToTheme = (theme?: string | null): Themes => {
|
|
25
|
-
return theme === themes.dark ? themes.dark : themes.light;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const getInitialTheme = (defaultMode: Themes | undefined): Themes => {
|
|
29
|
-
if (!ExecutionEnvironment.canUseDOM) {
|
|
30
|
-
return coerceToTheme(defaultMode);
|
|
31
|
-
}
|
|
32
|
-
return coerceToTheme(document.documentElement.getAttribute('data-theme'));
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const storeTheme = (newTheme: Themes) => {
|
|
36
|
-
createStorageSlot('theme').set(coerceToTheme(newTheme));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const useTheme = (): useThemeReturns => {
|
|
40
|
-
const {
|
|
41
|
-
colorMode: {defaultMode, disableSwitch, respectPrefersColorScheme},
|
|
42
|
-
} = useThemeConfig();
|
|
43
|
-
const [theme, setTheme] = useState(getInitialTheme(defaultMode));
|
|
44
|
-
|
|
45
|
-
const setLightTheme = useCallback(() => {
|
|
46
|
-
setTheme(themes.light);
|
|
47
|
-
storeTheme(themes.light);
|
|
48
|
-
}, []);
|
|
49
|
-
const setDarkTheme = useCallback(() => {
|
|
50
|
-
setTheme(themes.dark);
|
|
51
|
-
storeTheme(themes.dark);
|
|
52
|
-
}, []);
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
document.documentElement.setAttribute('data-theme', coerceToTheme(theme));
|
|
56
|
-
}, [theme]);
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (disableSwitch) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
const storedTheme = ThemeStorage.get();
|
|
65
|
-
if (storedTheme !== null) {
|
|
66
|
-
setTheme(coerceToTheme(storedTheme));
|
|
67
|
-
}
|
|
68
|
-
} catch (err) {
|
|
69
|
-
console.error(err);
|
|
70
|
-
}
|
|
71
|
-
}, [setTheme]);
|
|
72
|
-
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (disableSwitch && !respectPrefersColorScheme) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
window
|
|
79
|
-
.matchMedia('(prefers-color-scheme: dark)')
|
|
80
|
-
.addListener(({matches}) => {
|
|
81
|
-
setTheme(matches ? themes.dark : themes.light);
|
|
82
|
-
});
|
|
83
|
-
}, []);
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
isDarkTheme: theme === themes.dark,
|
|
87
|
-
setLightTheme,
|
|
88
|
-
setDarkTheme,
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default useTheme;
|
|
@@ -1,23 +0,0 @@
|
|
|
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 {useContext} from 'react';
|
|
9
|
-
|
|
10
|
-
import ThemeContext from '@theme/ThemeContext';
|
|
11
|
-
import type {ThemeContextProps} from '@theme/hooks/useThemeContext';
|
|
12
|
-
|
|
13
|
-
function useThemeContext(): ThemeContextProps {
|
|
14
|
-
const context = useContext<ThemeContextProps | undefined>(ThemeContext);
|
|
15
|
-
if (context == null) {
|
|
16
|
-
throw new Error(
|
|
17
|
-
'`useThemeContext` is used outside of `Layout` Component. See https://docusaurus.io/docs/api/themes/configuration#usethemecontext.',
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default useThemeContext;
|
|
@@ -1,25 +0,0 @@
|
|
|
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 {useContext} from 'react';
|
|
9
|
-
|
|
10
|
-
import UserPreferencesContext from '@theme/UserPreferencesContext';
|
|
11
|
-
import type {UserPreferencesContextProps} from '@theme/hooks/useUserPreferencesContext';
|
|
12
|
-
|
|
13
|
-
function useUserPreferencesContext(): UserPreferencesContextProps {
|
|
14
|
-
const context = useContext<UserPreferencesContextProps | undefined>(
|
|
15
|
-
UserPreferencesContext,
|
|
16
|
-
);
|
|
17
|
-
if (context == null) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
'`useUserPreferencesContext` is used outside of `Layout` Component.',
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
return context;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default useUserPreferencesContext;
|
|
@@ -1,51 +0,0 @@
|
|
|
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 {useEffect, useState} from 'react';
|
|
9
|
-
|
|
10
|
-
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
|
11
|
-
import type {WindowSize} from '@theme/hooks/useWindowSize';
|
|
12
|
-
|
|
13
|
-
const desktopThresholdWidth = 996;
|
|
14
|
-
|
|
15
|
-
const windowSizes = {
|
|
16
|
-
desktop: 'desktop',
|
|
17
|
-
mobile: 'mobile',
|
|
18
|
-
} as const;
|
|
19
|
-
|
|
20
|
-
function useWindowSize(): WindowSize | undefined {
|
|
21
|
-
const isClient = ExecutionEnvironment.canUseDOM;
|
|
22
|
-
|
|
23
|
-
function getSize() {
|
|
24
|
-
if (!isClient) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
return window.innerWidth > desktopThresholdWidth
|
|
28
|
-
? windowSizes.desktop
|
|
29
|
-
: windowSizes.mobile;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const [windowSize, setWindowSize] = useState(getSize);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!isClient) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function handleResize() {
|
|
40
|
-
setWindowSize(getSize());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
window.addEventListener('resize', handleResize);
|
|
44
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
45
|
-
}, []);
|
|
46
|
-
|
|
47
|
-
return windowSize;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {windowSizes};
|
|
51
|
-
export default useWindowSize;
|
|
@@ -1,317 +0,0 @@
|
|
|
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
|
-
const {Joi, URISchema} = require('@docusaurus/utils-validation');
|
|
9
|
-
|
|
10
|
-
const DEFAULT_DOCS_CONFIG = {
|
|
11
|
-
versionPersistence: 'localStorage',
|
|
12
|
-
};
|
|
13
|
-
const DocsSchema = Joi.object({
|
|
14
|
-
versionPersistence: Joi.string()
|
|
15
|
-
.equal('localStorage', 'none')
|
|
16
|
-
.default(DEFAULT_DOCS_CONFIG.versionPersistence),
|
|
17
|
-
}).default(DEFAULT_DOCS_CONFIG);
|
|
18
|
-
|
|
19
|
-
const DEFAULT_COLOR_MODE_CONFIG = {
|
|
20
|
-
defaultMode: 'light',
|
|
21
|
-
disableSwitch: false,
|
|
22
|
-
respectPrefersColorScheme: false,
|
|
23
|
-
switchConfig: {
|
|
24
|
-
darkIcon: '🌜',
|
|
25
|
-
darkIconStyle: {},
|
|
26
|
-
lightIcon: '🌞',
|
|
27
|
-
lightIconStyle: {},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const DEFAULT_CONFIG = {
|
|
32
|
-
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
|
33
|
-
docs: DEFAULT_DOCS_CONFIG,
|
|
34
|
-
metadatas: [],
|
|
35
|
-
prism: {
|
|
36
|
-
additionalLanguages: [],
|
|
37
|
-
},
|
|
38
|
-
navbar: {
|
|
39
|
-
hideOnScroll: false,
|
|
40
|
-
items: [],
|
|
41
|
-
},
|
|
42
|
-
hideableSidebar: false,
|
|
43
|
-
};
|
|
44
|
-
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
|
45
|
-
|
|
46
|
-
const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
|
47
|
-
|
|
48
|
-
const BaseNavbarItemSchema = Joi.object({
|
|
49
|
-
to: Joi.string(),
|
|
50
|
-
href: URISchema,
|
|
51
|
-
label: Joi.string(),
|
|
52
|
-
className: Joi.string(),
|
|
53
|
-
prependBaseUrlToHref: Joi.string(),
|
|
54
|
-
})
|
|
55
|
-
// We allow any unknown attributes on the links
|
|
56
|
-
// (users may need additional attributes like target, aria-role, data-customAttribute...)
|
|
57
|
-
.unknown();
|
|
58
|
-
|
|
59
|
-
// TODO we should probably create a custom navbar item type "dropdown"
|
|
60
|
-
// having this recursive structure is bad because we only support 2 levels
|
|
61
|
-
// + parent/child don't have exactly the same props
|
|
62
|
-
const DefaultNavbarItemSchema = BaseNavbarItemSchema.append({
|
|
63
|
-
items: Joi.array().optional().items(BaseNavbarItemSchema),
|
|
64
|
-
position: NavbarItemPosition,
|
|
65
|
-
activeBasePath: Joi.string(),
|
|
66
|
-
activeBaseRegex: Joi.string(),
|
|
67
|
-
});
|
|
68
|
-
// TODO the dropdown parent item can have no href/to
|
|
69
|
-
// should check should not apply to dropdown parent item
|
|
70
|
-
// .xor('href', 'to');
|
|
71
|
-
|
|
72
|
-
const DocsVersionNavbarItemSchema = Joi.object({
|
|
73
|
-
type: Joi.string().equal('docsVersion').required(),
|
|
74
|
-
position: NavbarItemPosition,
|
|
75
|
-
label: Joi.string(),
|
|
76
|
-
to: Joi.string(),
|
|
77
|
-
docsPluginId: Joi.string(),
|
|
78
|
-
className: Joi.string(),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const DocsVersionDropdownNavbarItemSchema = Joi.object({
|
|
82
|
-
type: Joi.string().equal('docsVersionDropdown').required(),
|
|
83
|
-
position: NavbarItemPosition,
|
|
84
|
-
docsPluginId: Joi.string(),
|
|
85
|
-
dropdownActiveClassDisabled: Joi.boolean(),
|
|
86
|
-
dropdownItemsBefore: Joi.array().items(BaseNavbarItemSchema).default([]),
|
|
87
|
-
dropdownItemsAfter: Joi.array().items(BaseNavbarItemSchema).default([]),
|
|
88
|
-
className: Joi.string(),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const DocItemSchema = Joi.object({
|
|
92
|
-
type: Joi.string().equal('doc').required(),
|
|
93
|
-
position: NavbarItemPosition,
|
|
94
|
-
docId: Joi.string().required(),
|
|
95
|
-
label: Joi.string(),
|
|
96
|
-
docsPluginId: Joi.string(),
|
|
97
|
-
activeSidebarClassName: Joi.string().default('navbar__link--active'),
|
|
98
|
-
className: Joi.string(),
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const LocaleDropdownNavbarItemSchema = Joi.object({
|
|
102
|
-
type: Joi.string().equal('localeDropdown').required(),
|
|
103
|
-
position: NavbarItemPosition,
|
|
104
|
-
dropdownItemsBefore: Joi.array().items(BaseNavbarItemSchema).default([]),
|
|
105
|
-
dropdownItemsAfter: Joi.array().items(BaseNavbarItemSchema).default([]),
|
|
106
|
-
className: Joi.string(),
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const SearchItemSchema = Joi.object({
|
|
110
|
-
type: Joi.string().equal('search').required(),
|
|
111
|
-
position: NavbarItemPosition,
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// Can this be made easier? :/
|
|
115
|
-
const isOfType = (type) => {
|
|
116
|
-
let typeSchema = Joi.string().required();
|
|
117
|
-
// because equal(undefined) is not supported :/
|
|
118
|
-
if (type) {
|
|
119
|
-
typeSchema = typeSchema.equal(type);
|
|
120
|
-
}
|
|
121
|
-
return Joi.object({
|
|
122
|
-
type: typeSchema,
|
|
123
|
-
})
|
|
124
|
-
.unknown()
|
|
125
|
-
.required();
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const NavbarItemSchema = Joi.object().when({
|
|
129
|
-
switch: [
|
|
130
|
-
{
|
|
131
|
-
is: isOfType('docsVersion'),
|
|
132
|
-
then: DocsVersionNavbarItemSchema,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
is: isOfType('docsVersionDropdown'),
|
|
136
|
-
then: DocsVersionDropdownNavbarItemSchema,
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
is: isOfType('doc'),
|
|
140
|
-
then: DocItemSchema,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
is: isOfType('localeDropdown'),
|
|
144
|
-
then: LocaleDropdownNavbarItemSchema,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
is: isOfType('search'),
|
|
148
|
-
then: SearchItemSchema,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
is: isOfType(undefined),
|
|
152
|
-
then: Joi.forbidden().messages({
|
|
153
|
-
'any.unknown': 'Bad navbar item type {.type}',
|
|
154
|
-
}),
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
otherwise: DefaultNavbarItemSchema,
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
/*
|
|
161
|
-
const NavbarItemSchema = Joi.object({
|
|
162
|
-
type: Joi.string().only(['docsVersion'])
|
|
163
|
-
})
|
|
164
|
-
.when(Joi.object({ type: 'docsVersion' }).unknown(), {
|
|
165
|
-
then: Joi.object({ pepperoni: Joi.boolean() })
|
|
166
|
-
})
|
|
167
|
-
.when(Joi.object().unknown(), {
|
|
168
|
-
then: Joi.object({ croutons: Joi.boolean() })
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
/*
|
|
174
|
-
const NavbarItemSchema = Joi.object().when('type', {
|
|
175
|
-
is: Joi.valid('docsVersion'),
|
|
176
|
-
then: DocsVersionNavbarItemSchema,
|
|
177
|
-
otherwise: DefaultNavbarItemSchema,
|
|
178
|
-
});
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
const ColorModeSchema = Joi.object({
|
|
182
|
-
defaultMode: Joi.string()
|
|
183
|
-
.equal('dark', 'light')
|
|
184
|
-
.default(DEFAULT_COLOR_MODE_CONFIG.defaultMode),
|
|
185
|
-
disableSwitch: Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.disableSwitch),
|
|
186
|
-
respectPrefersColorScheme: Joi.bool().default(
|
|
187
|
-
DEFAULT_COLOR_MODE_CONFIG.respectPrefersColorScheme,
|
|
188
|
-
),
|
|
189
|
-
switchConfig: Joi.object({
|
|
190
|
-
darkIcon: Joi.string().default(
|
|
191
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIcon,
|
|
192
|
-
),
|
|
193
|
-
darkIconStyle: Joi.object().default(
|
|
194
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIconStyle,
|
|
195
|
-
),
|
|
196
|
-
lightIcon: Joi.string().default(
|
|
197
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIcon,
|
|
198
|
-
),
|
|
199
|
-
lightIconStyle: Joi.object().default(
|
|
200
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIconStyle,
|
|
201
|
-
),
|
|
202
|
-
}).default(DEFAULT_COLOR_MODE_CONFIG.switchConfig),
|
|
203
|
-
}).default(DEFAULT_COLOR_MODE_CONFIG);
|
|
204
|
-
|
|
205
|
-
// schema can probably be improved
|
|
206
|
-
const HtmlMetadataSchema = Joi.object({
|
|
207
|
-
id: Joi.string(),
|
|
208
|
-
name: Joi.string(),
|
|
209
|
-
property: Joi.string(),
|
|
210
|
-
content: Joi.string(),
|
|
211
|
-
itemprop: Joi.string(),
|
|
212
|
-
}).unknown();
|
|
213
|
-
|
|
214
|
-
const FooterLinkItemSchema = Joi.object({
|
|
215
|
-
to: Joi.string(),
|
|
216
|
-
href: URISchema,
|
|
217
|
-
html: Joi.string(),
|
|
218
|
-
label: Joi.string(),
|
|
219
|
-
})
|
|
220
|
-
.xor('to', 'href', 'html')
|
|
221
|
-
.with('to', 'label')
|
|
222
|
-
.with('href', 'label')
|
|
223
|
-
.nand('html', 'label')
|
|
224
|
-
// We allow any unknown attributes on the links
|
|
225
|
-
// (users may need additional attributes like target, aria-role, data-customAttribute...)
|
|
226
|
-
.unknown();
|
|
227
|
-
|
|
228
|
-
const CustomCssSchema = Joi.alternatives()
|
|
229
|
-
.try(Joi.array().items(Joi.string().required()), Joi.string().required())
|
|
230
|
-
.optional();
|
|
231
|
-
|
|
232
|
-
const ThemeConfigSchema = Joi.object({
|
|
233
|
-
// TODO temporary (@alpha-58)
|
|
234
|
-
disableDarkMode: Joi.any().forbidden(false).messages({
|
|
235
|
-
'any.unknown':
|
|
236
|
-
'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true',
|
|
237
|
-
}),
|
|
238
|
-
// TODO temporary (@alpha-58)
|
|
239
|
-
defaultDarkMode: Joi.any().forbidden(false).messages({
|
|
240
|
-
'any.unknown':
|
|
241
|
-
'defaultDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.defaultMode = "dark"',
|
|
242
|
-
}),
|
|
243
|
-
customCss: CustomCssSchema,
|
|
244
|
-
colorMode: ColorModeSchema,
|
|
245
|
-
image: Joi.string(),
|
|
246
|
-
docs: DocsSchema,
|
|
247
|
-
metadatas: Joi.array()
|
|
248
|
-
.items(HtmlMetadataSchema)
|
|
249
|
-
.default(DEFAULT_CONFIG.metadatas),
|
|
250
|
-
announcementBar: Joi.object({
|
|
251
|
-
id: Joi.string().default('announcement-bar'),
|
|
252
|
-
content: Joi.string(),
|
|
253
|
-
backgroundColor: Joi.string().default('#fff'),
|
|
254
|
-
textColor: Joi.string().default('#000'),
|
|
255
|
-
isCloseable: Joi.bool().default(true),
|
|
256
|
-
}).optional(),
|
|
257
|
-
navbar: Joi.object({
|
|
258
|
-
style: Joi.string().equal('dark', 'primary'),
|
|
259
|
-
hideOnScroll: Joi.bool().default(DEFAULT_CONFIG.navbar.hideOnScroll),
|
|
260
|
-
// TODO temporary (@alpha-58)
|
|
261
|
-
links: Joi.any().forbidden().messages({
|
|
262
|
-
'any.unknown':
|
|
263
|
-
'themeConfig.navbar.links has been renamed as themeConfig.navbar.items',
|
|
264
|
-
}),
|
|
265
|
-
items: Joi.array()
|
|
266
|
-
.items(NavbarItemSchema)
|
|
267
|
-
.default(DEFAULT_CONFIG.navbar.items),
|
|
268
|
-
title: Joi.string().allow('', null),
|
|
269
|
-
logo: Joi.object({
|
|
270
|
-
alt: Joi.string().allow(''),
|
|
271
|
-
src: Joi.string().required(),
|
|
272
|
-
srcDark: Joi.string(),
|
|
273
|
-
href: Joi.string(),
|
|
274
|
-
target: Joi.string(),
|
|
275
|
-
}),
|
|
276
|
-
}).default(DEFAULT_CONFIG.navbar),
|
|
277
|
-
footer: Joi.object({
|
|
278
|
-
style: Joi.string().equal('dark', 'light').default('light'),
|
|
279
|
-
logo: Joi.object({
|
|
280
|
-
alt: Joi.string().allow(''),
|
|
281
|
-
src: Joi.string(),
|
|
282
|
-
srcDark: Joi.string(),
|
|
283
|
-
href: Joi.string(),
|
|
284
|
-
}),
|
|
285
|
-
copyright: Joi.string(),
|
|
286
|
-
links: Joi.array()
|
|
287
|
-
.items(
|
|
288
|
-
Joi.object({
|
|
289
|
-
title: Joi.string().allow(null),
|
|
290
|
-
items: Joi.array().items(FooterLinkItemSchema).default([]),
|
|
291
|
-
}),
|
|
292
|
-
)
|
|
293
|
-
.default([]),
|
|
294
|
-
}).optional(),
|
|
295
|
-
prism: Joi.object({
|
|
296
|
-
theme: Joi.object({
|
|
297
|
-
plain: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
|
298
|
-
styles: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
|
299
|
-
}),
|
|
300
|
-
darkTheme: Joi.object({
|
|
301
|
-
plain: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
|
302
|
-
styles: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
|
303
|
-
}),
|
|
304
|
-
defaultLanguage: Joi.string(),
|
|
305
|
-
additionalLanguages: Joi.array()
|
|
306
|
-
.items(Joi.string())
|
|
307
|
-
.default(DEFAULT_CONFIG.prism.additionalLanguages),
|
|
308
|
-
})
|
|
309
|
-
.default(DEFAULT_CONFIG.prism)
|
|
310
|
-
.unknown(),
|
|
311
|
-
hideableSidebar: Joi.bool().default(DEFAULT_CONFIG.hideableSidebar),
|
|
312
|
-
});
|
|
313
|
-
exports.ThemeConfigSchema = ThemeConfigSchema;
|
|
314
|
-
|
|
315
|
-
exports.validateThemeConfig = ({validate, themeConfig}) => {
|
|
316
|
-
return validate(ThemeConfigSchema, themeConfig);
|
|
317
|
-
};
|