@seqera/docusaurus-theme-seqera 1.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 +26 -0
- package/package.json +66 -0
- package/src/getSwizzleConfig.ts +433 -0
- package/src/index.ts +154 -0
- package/src/inlineScripts.ts +95 -0
- package/src/inlineSvgSprites.ts +7 -0
- package/src/main-styles.css +322 -0
- package/src/nprogress.css +36 -0
- package/src/nprogress.ts +27 -0
- package/src/options.ts +503 -0
- package/src/prism-include-languages.ts +6 -0
- package/src/styles/api.css +42 -0
- package/src/styles/typography.css +342 -0
- package/src/theme/Admonition/Icon/Danger.tsx +15 -0
- package/src/theme/Admonition/Icon/Info.tsx +15 -0
- package/src/theme/Admonition/Icon/Note.tsx +15 -0
- package/src/theme/Admonition/Icon/Tip.tsx +15 -0
- package/src/theme/Admonition/Icon/Warning.tsx +15 -0
- package/src/theme/Admonition/Layout/index.tsx +53 -0
- package/src/theme/Admonition/Layout/styles.module.css +39 -0
- package/src/theme/Admonition/Type/Caution.tsx +34 -0
- package/src/theme/Admonition/Type/Danger.tsx +32 -0
- package/src/theme/Admonition/Type/Info.tsx +32 -0
- package/src/theme/Admonition/Type/Note.tsx +32 -0
- package/src/theme/Admonition/Type/Tip.tsx +32 -0
- package/src/theme/Admonition/Type/Warning.tsx +32 -0
- package/src/theme/Admonition/Types.tsx +33 -0
- package/src/theme/Admonition/index.tsx +23 -0
- package/src/theme/AdmonitionVersioned/AddedInVersion.tsx +14 -0
- package/src/theme/AdmonitionVersioned/AdmonitionVersioned.tsx +66 -0
- package/src/theme/AdmonitionVersioned/ChangedInVersion.tsx +14 -0
- package/src/theme/AdmonitionVersioned/DeprecatedInVersion.tsx +15 -0
- package/src/theme/AdmonitionVersioned/getStableVersion.ts +30 -0
- package/src/theme/AdmonitionVersioned/index.ts +1 -0
- package/src/theme/AdmonitionVersioned/stableVersions.ts +119 -0
- package/src/theme/AnnouncementBar/CloseButton/index.tsx +24 -0
- package/src/theme/AnnouncementBar/CloseButton/styles.module.css +6 -0
- package/src/theme/AnnouncementBar/Content/index.tsx +21 -0
- package/src/theme/AnnouncementBar/Content/styles.module.css +12 -0
- package/src/theme/AnnouncementBar/index.tsx +37 -0
- package/src/theme/AnnouncementBar/styles.module.css +57 -0
- package/src/theme/BackToTopButton/index.tsx +30 -0
- package/src/theme/BackToTopButton/styles.module.css +39 -0
- package/src/theme/Blog/Components/Author/Socials/index.tsx +75 -0
- package/src/theme/Blog/Components/Author/Socials/styles.module.css +34 -0
- package/src/theme/Blog/Components/Author/index.tsx +98 -0
- package/src/theme/Blog/Components/Author/styles.module.css +69 -0
- package/src/theme/Blog/Pages/BlogAuthorsListPage/index.tsx +57 -0
- package/src/theme/Blog/Pages/BlogAuthorsListPage/styles.module.css +6 -0
- package/src/theme/Blog/Pages/BlogAuthorsPostsPage/index.tsx +77 -0
- package/src/theme/BlogArchivePage/index.tsx +102 -0
- package/src/theme/BlogLayout/index.tsx +31 -0
- package/src/theme/BlogListPage/StructuredData/index.tsx +17 -0
- package/src/theme/BlogListPage/index.tsx +57 -0
- package/src/theme/BlogListPaginator/index.tsx +47 -0
- package/src/theme/BlogPostItem/Container/index.tsx +11 -0
- package/src/theme/BlogPostItem/Content/index.tsx +23 -0
- package/src/theme/BlogPostItem/Footer/ReadMoreLink/index.tsx +39 -0
- package/src/theme/BlogPostItem/Footer/index.tsx +85 -0
- package/src/theme/BlogPostItem/Header/Authors/index.tsx +49 -0
- package/src/theme/BlogPostItem/Header/Authors/styles.module.css +15 -0
- package/src/theme/BlogPostItem/Header/Info/index.tsx +77 -0
- package/src/theme/BlogPostItem/Header/Info/styles.module.css +5 -0
- package/src/theme/BlogPostItem/Header/Title/index.tsx +20 -0
- package/src/theme/BlogPostItem/Header/Title/styles.module.css +14 -0
- package/src/theme/BlogPostItem/Header/index.tsx +16 -0
- package/src/theme/BlogPostItem/index.tsx +27 -0
- package/src/theme/BlogPostItems/index.tsx +25 -0
- package/src/theme/BlogPostPage/Metadata/index.tsx +39 -0
- package/src/theme/BlogPostPage/StructuredData/index.tsx +16 -0
- package/src/theme/BlogPostPage/index.tsx +74 -0
- package/src/theme/BlogPostPaginator/index.tsx +46 -0
- package/src/theme/BlogSidebar/Content/index.tsx +52 -0
- package/src/theme/BlogSidebar/Desktop/index.tsx +52 -0
- package/src/theme/BlogSidebar/Desktop/styles.module.css +46 -0
- package/src/theme/BlogSidebar/Mobile/index.tsx +47 -0
- package/src/theme/BlogSidebar/Mobile/styles.module.css +5 -0
- package/src/theme/BlogSidebar/index.tsx +19 -0
- package/src/theme/BlogTagsListPage/index.tsx +33 -0
- package/src/theme/BlogTagsPostsPage/index.tsx +68 -0
- package/src/theme/CodeBlock/Buttons/Button/index.tsx +14 -0
- package/src/theme/CodeBlock/Buttons/CopyButton/index.tsx +82 -0
- package/src/theme/CodeBlock/Buttons/CopyButton/styles.module.css +42 -0
- package/src/theme/CodeBlock/Buttons/WordWrapButton/index.tsx +40 -0
- package/src/theme/CodeBlock/Buttons/WordWrapButton/styles.module.css +10 -0
- package/src/theme/CodeBlock/Buttons/index.tsx +27 -0
- package/src/theme/CodeBlock/Buttons/styles.module.css +32 -0
- package/src/theme/CodeBlock/Container/index.tsx +27 -0
- package/src/theme/CodeBlock/Container/styles.module.css +9 -0
- package/src/theme/CodeBlock/Content/Element.tsx +24 -0
- package/src/theme/CodeBlock/Content/String.tsx +37 -0
- package/src/theme/CodeBlock/Content/index.tsx +79 -0
- package/src/theme/CodeBlock/Content/styles.module.css +30 -0
- package/src/theme/CodeBlock/Layout/index.tsx +29 -0
- package/src/theme/CodeBlock/Layout/styles.module.css +22 -0
- package/src/theme/CodeBlock/Line/Token/index.tsx +13 -0
- package/src/theme/CodeBlock/Line/index.tsx +61 -0
- package/src/theme/CodeBlock/Line/styles.module.css +47 -0
- package/src/theme/CodeBlock/Title/index.tsx +10 -0
- package/src/theme/CodeBlock/index.tsx +40 -0
- package/src/theme/CodeInline/index.tsx +11 -0
- package/src/theme/ColorModeToggle/index.tsx +140 -0
- package/src/theme/ColorModeToggle/styles.module.css +35 -0
- package/src/theme/ContentVisibility/Draft/index.tsx +22 -0
- package/src/theme/ContentVisibility/Unlisted/index.tsx +37 -0
- package/src/theme/ContentVisibility/index.tsx +20 -0
- package/src/theme/Details/index.tsx +21 -0
- package/src/theme/Details/styles.module.css +8 -0
- package/src/theme/DocBreadcrumbs/Items/Home/index.tsx +29 -0
- package/src/theme/DocBreadcrumbs/Items/Home/styles.module.css +9 -0
- package/src/theme/DocBreadcrumbs/StructuredData/index.tsx +19 -0
- package/src/theme/DocBreadcrumbs/index.tsx +98 -0
- package/src/theme/DocBreadcrumbs/styles.module.css +14 -0
- package/src/theme/DocCard/index.tsx +133 -0
- package/src/theme/DocCard/styles.module.css +29 -0
- package/src/theme/DocCardList/index.tsx +43 -0
- package/src/theme/DocCardList/styles.module.css +9 -0
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +68 -0
- package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +13 -0
- package/src/theme/DocItem/Content/index.tsx +43 -0
- package/src/theme/DocItem/Footer/index.tsx +51 -0
- package/src/theme/DocItem/Layout/index.tsx +66 -0
- package/src/theme/DocItem/Layout/styles.module.css +12 -0
- package/src/theme/DocItem/Metadata/index.tsx +17 -0
- package/src/theme/DocItem/Paginator/index.tsx +20 -0
- package/src/theme/DocItem/TOC/Desktop/index.tsx +19 -0
- package/src/theme/DocItem/TOC/Mobile/index.tsx +22 -0
- package/src/theme/DocItem/TOC/Mobile/styles.module.css +26 -0
- package/src/theme/DocItem/index.tsx +23 -0
- package/src/theme/DocPaginator/index.tsx +46 -0
- package/src/theme/DocRoot/Layout/Main/index.tsx +31 -0
- package/src/theme/DocRoot/Layout/Main/styles.module.css +23 -0
- package/src/theme/DocRoot/Layout/Sidebar/ExpandButton/index.tsx +36 -0
- package/src/theme/DocRoot/Layout/Sidebar/ExpandButton/styles.module.css +29 -0
- package/src/theme/DocRoot/Layout/Sidebar/index.tsx +79 -0
- package/src/theme/DocRoot/Layout/Sidebar/styles.module.css +34 -0
- package/src/theme/DocRoot/Layout/index.tsx +32 -0
- package/src/theme/DocRoot/Layout/styles.module.css +11 -0
- package/src/theme/DocRoot/index.tsx +29 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +34 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +42 -0
- package/src/theme/DocSidebar/Desktop/Content/index.tsx +56 -0
- package/src/theme/DocSidebar/Desktop/Content/styles.module.css +18 -0
- package/src/theme/DocSidebar/Desktop/index.tsx +36 -0
- package/src/theme/DocSidebar/Desktop/styles.module.css +39 -0
- package/src/theme/DocSidebar/Mobile/index.tsx +49 -0
- package/src/theme/DocSidebar/index.tsx +25 -0
- package/src/theme/DocSidebarItem/Category/index.tsx +309 -0
- package/src/theme/DocSidebarItem/Category/styles.module.css +35 -0
- package/src/theme/DocSidebarItem/Html/index.tsx +30 -0
- package/src/theme/DocSidebarItem/Html/styles.module.css +8 -0
- package/src/theme/DocSidebarItem/Link/index.tsx +62 -0
- package/src/theme/DocSidebarItem/Link/styles.module.css +13 -0
- package/src/theme/DocSidebarItem/index.tsx +19 -0
- package/src/theme/DocSidebarItems/index.tsx +24 -0
- package/src/theme/DocTagDocListPage/index.tsx +113 -0
- package/src/theme/DocTagsListPage/index.tsx +52 -0
- package/src/theme/DocVersionBadge/index.tsx +29 -0
- package/src/theme/DocVersionBanner/index.tsx +171 -0
- package/src/theme/DocVersionRoot/index.tsx +46 -0
- package/src/theme/DocsRoot/index.tsx +17 -0
- package/src/theme/EditMetaRow/index.tsx +31 -0
- package/src/theme/EditMetaRow/styles.module.css +19 -0
- package/src/theme/EditThisPage/index.tsx +21 -0
- package/src/theme/ErrorPageContent.tsx +38 -0
- package/src/theme/Footer/Copyright/index.tsx +15 -0
- package/src/theme/Footer/Layout/index.tsx +42 -0
- package/src/theme/Footer/LinkItem/index.tsx +31 -0
- package/src/theme/Footer/Links/MultiColumn/index.tsx +53 -0
- package/src/theme/Footer/Links/Simple/index.tsx +38 -0
- package/src/theme/Footer/Links/index.tsx +16 -0
- package/src/theme/Footer/Logo/index.tsx +41 -0
- package/src/theme/Footer/Logo/styles.module.css +11 -0
- package/src/theme/Footer/index.tsx +28 -0
- package/src/theme/Heading/index.tsx +50 -0
- package/src/theme/Heading/styles.module.css +17 -0
- package/src/theme/Homepage/index.tsx +178 -0
- package/src/theme/Icon/AI/index.tsx +21 -0
- package/src/theme/Icon/AWS/index.tsx +22 -0
- package/src/theme/Icon/Arrow/index.tsx +15 -0
- package/src/theme/Icon/Azure/index.tsx +28 -0
- package/src/theme/Icon/Changelog/index.tsx +26 -0
- package/src/theme/Icon/ChatBubble/index.tsx +29 -0
- package/src/theme/Icon/ChatBubbles/index.tsx +42 -0
- package/src/theme/Icon/Close/index.tsx +21 -0
- package/src/theme/Icon/Cog/index.tsx +45 -0
- package/src/theme/Icon/Copy/index.tsx +15 -0
- package/src/theme/Icon/DarkMode/index.tsx +15 -0
- package/src/theme/Icon/Edit/index.tsx +24 -0
- package/src/theme/Icon/Edit/styles.module.css +6 -0
- package/src/theme/Icon/Envelope/index.tsx +33 -0
- package/src/theme/Icon/ExternalLink/index.tsx +30 -0
- package/src/theme/Icon/ExternalLink/styles.module.css +5 -0
- package/src/theme/Icon/Fusion/index.tsx +32 -0
- package/src/theme/Icon/GoogleCloud/index.tsx +56 -0
- package/src/theme/Icon/Home/index.tsx +15 -0
- package/src/theme/Icon/Language/index.tsx +24 -0
- package/src/theme/Icon/LightMode/index.tsx +15 -0
- package/src/theme/Icon/MCP/index.tsx +84 -0
- package/src/theme/Icon/Menu/index.tsx +29 -0
- package/src/theme/Icon/MultiQC/index.tsx +25 -0
- package/src/theme/Icon/Nextflow/index.tsx +25 -0
- package/src/theme/Icon/QuestionMark/index.tsx +46 -0
- package/src/theme/Icon/SeqeraCloud/index.tsx +35 -0
- package/src/theme/Icon/SeqeraEnterprise/index.tsx +372 -0
- package/src/theme/Icon/SeqeraLogo/index.tsx +22 -0
- package/src/theme/Icon/ServiceStatus/index.tsx +101 -0
- package/src/theme/Icon/Sidebar/index.tsx +8 -0
- package/src/theme/Icon/Socials/Bluesky/index.tsx +23 -0
- package/src/theme/Icon/Socials/Bluesky/styles.module.css +9 -0
- package/src/theme/Icon/Socials/Default/index.tsx +28 -0
- package/src/theme/Icon/Socials/Email/index.tsx +23 -0
- package/src/theme/Icon/Socials/GitHub/index.tsx +24 -0
- package/src/theme/Icon/Socials/GitHub/styles.module.css +9 -0
- package/src/theme/Icon/Socials/Instagram/index.tsx +23 -0
- package/src/theme/Icon/Socials/Instagram/styles.module.css +9 -0
- package/src/theme/Icon/Socials/LinkedIn/index.tsx +23 -0
- package/src/theme/Icon/Socials/LinkedIn/styles.module.css +9 -0
- package/src/theme/Icon/Socials/Mastodon/index.tsx +40 -0
- package/src/theme/Icon/Socials/StackOverflow/index.tsx +25 -0
- package/src/theme/Icon/Socials/Threads/index.tsx +25 -0
- package/src/theme/Icon/Socials/Threads/styles.module.css +9 -0
- package/src/theme/Icon/Socials/Twitch/index.tsx +32 -0
- package/src/theme/Icon/Socials/Twitter/index.tsx +22 -0
- package/src/theme/Icon/Socials/X/index.tsx +24 -0
- package/src/theme/Icon/Socials/X/styles.module.css +9 -0
- package/src/theme/Icon/Socials/YouTube/index.tsx +22 -0
- package/src/theme/Icon/Success/index.tsx +15 -0
- package/src/theme/Icon/SystemColorMode/index.tsx +15 -0
- package/src/theme/Icon/Wave/index.tsx +32 -0
- package/src/theme/Icon/WordWrap/index.tsx +15 -0
- package/src/theme/LastUpdated/index.tsx +91 -0
- package/src/theme/Layout/Provider/index.tsx +26 -0
- package/src/theme/Layout/index.tsx +59 -0
- package/src/theme/Layout/styles.module.css +23 -0
- package/src/theme/Logo/index.tsx +78 -0
- package/src/theme/MDXComponents/A/index.tsx +16 -0
- package/src/theme/MDXComponents/Button/index.tsx +43 -0
- package/src/theme/MDXComponents/Code.tsx +26 -0
- package/src/theme/MDXComponents/Details.tsx +26 -0
- package/src/theme/MDXComponents/Heading.tsx +9 -0
- package/src/theme/MDXComponents/Img/index.tsx +23 -0
- package/src/theme/MDXComponents/Img/styles.module.css +5 -0
- package/src/theme/MDXComponents/Li.tsx +17 -0
- package/src/theme/MDXComponents/Pre.tsx +10 -0
- package/src/theme/MDXComponents/Ul/index.tsx +25 -0
- package/src/theme/MDXComponents/Ul/styles.module.css +9 -0
- package/src/theme/MDXComponents/index.tsx +47 -0
- package/src/theme/MDXContent/index.tsx +10 -0
- package/src/theme/MDXPage/index.tsx +87 -0
- package/src/theme/MDXPage/styles.module.css +5 -0
- package/src/theme/Mermaid.tsx +11 -0
- package/src/theme/Navbar/ColorModeToggle/index.tsx +29 -0
- package/src/theme/Navbar/ColorModeToggle/styles.module.css +5 -0
- package/src/theme/Navbar/Content/index.tsx +152 -0
- package/src/theme/Navbar/Content/styles.module.css +19 -0
- package/src/theme/Navbar/Layout/index.tsx +59 -0
- package/src/theme/Navbar/Layout/styles.module.css +9 -0
- package/src/theme/Navbar/Logo/index.tsx +14 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +37 -0
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +72 -0
- package/src/theme/Navbar/MobileSidebar/Layout/styles.module.css +11 -0
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +90 -0
- package/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx +34 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +25 -0
- package/src/theme/Navbar/MobileSidebar/index.tsx +28 -0
- package/src/theme/Navbar/Search/index.tsx +15 -0
- package/src/theme/Navbar/Search/styles.module.css +22 -0
- package/src/theme/Navbar/Submenu/SubmenuLinks.tsx +136 -0
- package/src/theme/Navbar/Submenu/index.tsx +84 -0
- package/src/theme/Navbar/Submenu/styles.module.css +82 -0
- package/src/theme/Navbar/index.tsx +13 -0
- package/src/theme/NavbarItem/ComponentTypes.tsx +27 -0
- package/src/theme/NavbarItem/DefaultNavbarItem/Desktop/index.tsx +29 -0
- package/src/theme/NavbarItem/DefaultNavbarItem/Mobile/index.tsx +18 -0
- package/src/theme/NavbarItem/DefaultNavbarItem/index.tsx +23 -0
- package/src/theme/NavbarItem/DocNavbarItem.tsx +38 -0
- package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +33 -0
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +189 -0
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +22 -0
- package/src/theme/NavbarItem/DropdownNavbarItem/Desktop/index.tsx +81 -0
- package/src/theme/NavbarItem/DropdownNavbarItem/Mobile/index.tsx +161 -0
- package/src/theme/NavbarItem/DropdownNavbarItem/Mobile/styles.module.css +5 -0
- package/src/theme/NavbarItem/DropdownNavbarItem/index.tsx +14 -0
- package/src/theme/NavbarItem/HtmlNavbarItem.tsx +27 -0
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +128 -0
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +6 -0
- package/src/theme/NavbarItem/NavbarNavLink.tsx +69 -0
- package/src/theme/NavbarItem/SearchNavbarItem.tsx +21 -0
- package/src/theme/NavbarItem/index.tsx +23 -0
- package/src/theme/NotFound/Content/index.tsx +34 -0
- package/src/theme/NotFound/index.tsx +22 -0
- package/src/theme/PaginatorNavLink/index.tsx +21 -0
- package/src/theme/SearchBar.tsx +8 -0
- package/src/theme/SearchMetadata/index.tsx +38 -0
- package/src/theme/SiteMetadata/index.tsx +153 -0
- package/src/theme/SkipToContent/index.tsx +9 -0
- package/src/theme/SkipToContent/styles.module.css +16 -0
- package/src/theme/TOC/index.tsx +26 -0
- package/src/theme/TOC/styles.module.css +23 -0
- package/src/theme/TOCCollapsible/CollapseButton/index.tsx +30 -0
- package/src/theme/TOCCollapsible/CollapseButton/styles.module.css +27 -0
- package/src/theme/TOCCollapsible/index.tsx +42 -0
- package/src/theme/TOCCollapsible/styles.module.css +26 -0
- package/src/theme/TOCInline/index.tsx +25 -0
- package/src/theme/TOCInline/styles.module.css +7 -0
- package/src/theme/TOCItems/Tree.tsx +40 -0
- package/src/theme/TOCItems/index.tsx +56 -0
- package/src/theme/TabItem/index.tsx +22 -0
- package/src/theme/TabItem/styles.module.css +5 -0
- package/src/theme/Tabs/index.tsx +167 -0
- package/src/theme/Tabs/styles.module.css +9 -0
- package/src/theme/Tag/index.tsx +30 -0
- package/src/theme/Tag/styles.module.css +65 -0
- package/src/theme/TagsListByLetter/index.tsx +40 -0
- package/src/theme/TagsListByLetter/styles.module.css +6 -0
- package/src/theme/TagsListInline/index.tsx +30 -0
- package/src/theme/TagsListInline/styles.module.css +10 -0
- package/src/theme/ThemeProvider/TitleFormatter/index.tsx +22 -0
- package/src/theme/ThemeProvider/index.tsx +9 -0
- package/src/theme/ThemedImage/index.tsx +21 -0
- package/src/theme/ThemedImage/styles.module.css +13 -0
- package/src/theme/pages/Home/index.tsx +19 -0
- package/src/theme/prism-include-languages.ts +39 -0
- package/src/theme-seqera.d.ts +2277 -0
- package/src/translations.ts +240 -0
- package/tailwind.config.js +7 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
useEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {
|
|
11
|
+
ThemeClassNames,
|
|
12
|
+
useThemeConfig,
|
|
13
|
+
usePrevious,
|
|
14
|
+
Collapsible,
|
|
15
|
+
useCollapsible,
|
|
16
|
+
} from '@docusaurus/theme-common';
|
|
17
|
+
import {isSamePath} from '@docusaurus/theme-common/internal';
|
|
18
|
+
import {
|
|
19
|
+
isActiveSidebarItem,
|
|
20
|
+
findFirstSidebarItemLink,
|
|
21
|
+
useDocSidebarItemsExpandedState,
|
|
22
|
+
useVisibleSidebarItems,
|
|
23
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
24
|
+
import Link from '@docusaurus/Link';
|
|
25
|
+
import {translate} from '@docusaurus/Translate';
|
|
26
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
27
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
28
|
+
import DocSidebarItemLink from '@theme/DocSidebarItem/Link';
|
|
29
|
+
import type {Props} from '@theme/DocSidebarItem/Category';
|
|
30
|
+
|
|
31
|
+
import type {
|
|
32
|
+
PropSidebarItemCategory,
|
|
33
|
+
PropSidebarItemLink,
|
|
34
|
+
} from '@docusaurus/plugin-content-docs';
|
|
35
|
+
import styles from './styles.module.css';
|
|
36
|
+
|
|
37
|
+
// If we navigate to a category and it becomes active, it should automatically
|
|
38
|
+
// expand itself
|
|
39
|
+
function useAutoExpandActiveCategory({
|
|
40
|
+
isActive,
|
|
41
|
+
collapsed,
|
|
42
|
+
updateCollapsed,
|
|
43
|
+
activePath,
|
|
44
|
+
}: {
|
|
45
|
+
isActive: boolean;
|
|
46
|
+
collapsed: boolean;
|
|
47
|
+
updateCollapsed: (b: boolean) => void;
|
|
48
|
+
activePath: string;
|
|
49
|
+
}) {
|
|
50
|
+
const wasActive = usePrevious(isActive);
|
|
51
|
+
const previousActivePath = usePrevious(activePath);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const justBecameActive = isActive && !wasActive;
|
|
54
|
+
const stillActiveButPathChanged =
|
|
55
|
+
isActive && wasActive && activePath !== previousActivePath;
|
|
56
|
+
if ((justBecameActive || stillActiveButPathChanged) && collapsed) {
|
|
57
|
+
updateCollapsed(false);
|
|
58
|
+
}
|
|
59
|
+
}, [
|
|
60
|
+
isActive,
|
|
61
|
+
wasActive,
|
|
62
|
+
collapsed,
|
|
63
|
+
updateCollapsed,
|
|
64
|
+
activePath,
|
|
65
|
+
previousActivePath,
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* When a collapsible category has no link, we still link it to its first child
|
|
71
|
+
* during SSR as a temporary fallback. This allows to be able to navigate inside
|
|
72
|
+
* the category even when JS fails to load, is delayed or simply disabled
|
|
73
|
+
* React hydration becomes an optional progressive enhancement
|
|
74
|
+
* see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
|
|
75
|
+
* see https://github.com/facebook/docusaurus/issues/3030
|
|
76
|
+
*/
|
|
77
|
+
function useCategoryHrefWithSSRFallback(
|
|
78
|
+
item: Props['item'],
|
|
79
|
+
): string | undefined {
|
|
80
|
+
const isBrowser = useIsBrowser();
|
|
81
|
+
return useMemo(() => {
|
|
82
|
+
if (item.href && !item.linkUnlisted) {
|
|
83
|
+
return item.href;
|
|
84
|
+
}
|
|
85
|
+
// In these cases, it's not necessary to render a fallback
|
|
86
|
+
// We skip the "findFirstCategoryLink" computation
|
|
87
|
+
if (isBrowser || !item.collapsible) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
return findFirstSidebarItemLink(item);
|
|
91
|
+
}, [item, isBrowser]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function CollapseButton({
|
|
95
|
+
collapsed,
|
|
96
|
+
categoryLabel,
|
|
97
|
+
onClick,
|
|
98
|
+
}: {
|
|
99
|
+
collapsed: boolean;
|
|
100
|
+
categoryLabel: string;
|
|
101
|
+
onClick: ComponentProps<'button'>['onClick'];
|
|
102
|
+
}) {
|
|
103
|
+
return (
|
|
104
|
+
<button
|
|
105
|
+
aria-label={
|
|
106
|
+
collapsed
|
|
107
|
+
? translate(
|
|
108
|
+
{
|
|
109
|
+
id: 'theme.DocSidebarItem.expandCategoryAriaLabel',
|
|
110
|
+
message: "Expand sidebar category '{label}'",
|
|
111
|
+
description: 'The ARIA label to expand the sidebar category',
|
|
112
|
+
},
|
|
113
|
+
{label: categoryLabel},
|
|
114
|
+
)
|
|
115
|
+
: translate(
|
|
116
|
+
{
|
|
117
|
+
id: 'theme.DocSidebarItem.collapseCategoryAriaLabel',
|
|
118
|
+
message: "Collapse sidebar category '{label}'",
|
|
119
|
+
description: 'The ARIA label to collapse the sidebar category',
|
|
120
|
+
},
|
|
121
|
+
{label: categoryLabel},
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
aria-expanded={!collapsed}
|
|
125
|
+
type="button"
|
|
126
|
+
className="clean-btn menu__caret"
|
|
127
|
+
onClick={onClick}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function CategoryLinkLabel({label}: {label: string}) {
|
|
133
|
+
return (
|
|
134
|
+
<div title={label} className={`${styles.categoryLinkLabel}`}>
|
|
135
|
+
{label}
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export default function DocSidebarItemCategory(props: Props): ReactNode {
|
|
141
|
+
const visibleChildren = useVisibleSidebarItems(
|
|
142
|
+
props.item.items,
|
|
143
|
+
props.activePath,
|
|
144
|
+
);
|
|
145
|
+
if (visibleChildren.length === 0) {
|
|
146
|
+
return <DocSidebarItemCategoryEmpty {...props} />;
|
|
147
|
+
} else {
|
|
148
|
+
return <DocSidebarItemCategoryCollapsible {...props} />;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function isCategoryWithHref(
|
|
153
|
+
category: PropSidebarItemCategory,
|
|
154
|
+
): category is PropSidebarItemCategory & {href: string} {
|
|
155
|
+
return typeof category.href === 'string';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// If a category doesn't have any visible children, we render it as a link
|
|
159
|
+
function DocSidebarItemCategoryEmpty({item, ...props}: Props): ReactNode {
|
|
160
|
+
// If the category has no link, we don't render anything
|
|
161
|
+
// It's not super useful to render a category you can't open nor click
|
|
162
|
+
if (!isCategoryWithHref(item)) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
// We remove props that don't make sense for a link and forward the rest
|
|
166
|
+
const {
|
|
167
|
+
type,
|
|
168
|
+
collapsed,
|
|
169
|
+
collapsible,
|
|
170
|
+
items,
|
|
171
|
+
linkUnlisted,
|
|
172
|
+
...forwardableProps
|
|
173
|
+
} = item;
|
|
174
|
+
const linkItem: PropSidebarItemLink = {
|
|
175
|
+
type: 'link',
|
|
176
|
+
...forwardableProps,
|
|
177
|
+
};
|
|
178
|
+
return <DocSidebarItemLink item={linkItem} {...props} />;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function DocSidebarItemCategoryCollapsible({
|
|
182
|
+
item,
|
|
183
|
+
onItemClick,
|
|
184
|
+
activePath,
|
|
185
|
+
level,
|
|
186
|
+
index,
|
|
187
|
+
...props
|
|
188
|
+
}: Props): ReactNode {
|
|
189
|
+
const {items, label, collapsible, className, href} = item;
|
|
190
|
+
const {
|
|
191
|
+
docs: {
|
|
192
|
+
sidebar: {autoCollapseCategories},
|
|
193
|
+
},
|
|
194
|
+
} = useThemeConfig();
|
|
195
|
+
const hrefWithSSRFallback = useCategoryHrefWithSSRFallback(item);
|
|
196
|
+
|
|
197
|
+
const isActive = isActiveSidebarItem(item, activePath);
|
|
198
|
+
const isCurrentPage = isSamePath(href, activePath);
|
|
199
|
+
|
|
200
|
+
const {collapsed, setCollapsed} = useCollapsible({
|
|
201
|
+
// Active categories are always initialized as expanded. The default
|
|
202
|
+
// (`item.collapsed`) is only used for non-active categories.
|
|
203
|
+
initialState: () => {
|
|
204
|
+
if (!collapsible) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
return isActive ? false : item.collapsed;
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const {expandedItem, setExpandedItem} = useDocSidebarItemsExpandedState();
|
|
212
|
+
// Use this instead of `setCollapsed`, because it is also reactive
|
|
213
|
+
const updateCollapsed = (toCollapsed: boolean = !collapsed) => {
|
|
214
|
+
setExpandedItem(toCollapsed ? null : index);
|
|
215
|
+
setCollapsed(toCollapsed);
|
|
216
|
+
};
|
|
217
|
+
useAutoExpandActiveCategory({
|
|
218
|
+
isActive,
|
|
219
|
+
collapsed,
|
|
220
|
+
updateCollapsed,
|
|
221
|
+
activePath,
|
|
222
|
+
});
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
if (
|
|
225
|
+
collapsible &&
|
|
226
|
+
expandedItem != null &&
|
|
227
|
+
expandedItem !== index &&
|
|
228
|
+
autoCollapseCategories
|
|
229
|
+
) {
|
|
230
|
+
setCollapsed(true);
|
|
231
|
+
}
|
|
232
|
+
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);
|
|
233
|
+
|
|
234
|
+
const handleItemClick: ComponentProps<'a'>['onClick'] = (e) => {
|
|
235
|
+
onItemClick?.(item);
|
|
236
|
+
if (collapsible) {
|
|
237
|
+
if (href) {
|
|
238
|
+
// When already on the category's page, we collapse it
|
|
239
|
+
// We don't use "isActive" because it would collapse the
|
|
240
|
+
// category even when we browse a children element
|
|
241
|
+
// See https://github.com/facebook/docusaurus/issues/11213
|
|
242
|
+
if (isCurrentPage) {
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
updateCollapsed();
|
|
245
|
+
} else {
|
|
246
|
+
// When navigating to a new category, we always expand
|
|
247
|
+
// see https://github.com/facebook/docusaurus/issues/10854#issuecomment-2609616182
|
|
248
|
+
updateCollapsed(false);
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
e.preventDefault();
|
|
252
|
+
updateCollapsed();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
return (
|
|
258
|
+
<li
|
|
259
|
+
className={clsx(
|
|
260
|
+
ThemeClassNames.docs.docSidebarItemCategory,
|
|
261
|
+
ThemeClassNames.docs.docSidebarItemCategoryLevel(level),
|
|
262
|
+
'menu__list-item',
|
|
263
|
+
{
|
|
264
|
+
'menu__list-item--collapsed': collapsed,
|
|
265
|
+
},
|
|
266
|
+
className,
|
|
267
|
+
)}>
|
|
268
|
+
<div
|
|
269
|
+
className={clsx('w-full flex flex-row bg-transparent hover:bg-transparent focus:bg-transparent active:bg-transparent hover:text-primary menu__list-item-collapsible', {
|
|
270
|
+
'menu__list-item-collapsible--active': isCurrentPage,
|
|
271
|
+
})}>
|
|
272
|
+
<Link
|
|
273
|
+
className={clsx(styles.categoryLink, 'menu__link w-full hover:bg-transparent hover:text-primary', {
|
|
274
|
+
'menu__link--sublist ': collapsible,
|
|
275
|
+
'menu__link--sublist-caret': !href && collapsible,
|
|
276
|
+
'menu__link--active': isActive,
|
|
277
|
+
})}
|
|
278
|
+
onClick={handleItemClick}
|
|
279
|
+
aria-current={isCurrentPage ? 'page' : undefined}
|
|
280
|
+
role={collapsible && !href ? 'button' : undefined}
|
|
281
|
+
aria-expanded={collapsible && !href ? !collapsed : undefined}
|
|
282
|
+
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
283
|
+
{...props}>
|
|
284
|
+
<CategoryLinkLabel label={label} />
|
|
285
|
+
</Link>
|
|
286
|
+
{href && collapsible && (
|
|
287
|
+
<CollapseButton
|
|
288
|
+
collapsed={collapsed}
|
|
289
|
+
categoryLabel={label}
|
|
290
|
+
onClick={(e) => {
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
updateCollapsed();
|
|
293
|
+
}}
|
|
294
|
+
/>
|
|
295
|
+
)}
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
|
|
299
|
+
<DocSidebarItems
|
|
300
|
+
items={items}
|
|
301
|
+
tabIndex={collapsed ? -1 : 0}
|
|
302
|
+
onItemClick={onItemClick}
|
|
303
|
+
activePath={activePath}
|
|
304
|
+
level={level + 1}
|
|
305
|
+
/>
|
|
306
|
+
</Collapsible>
|
|
307
|
+
</li>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.categoryLink {
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:global(.menu__link--sublist-caret)::after {
|
|
8
|
+
margin-left: var(--ifm-menu-link-padding-vertical);
|
|
9
|
+
background-image: url("data:image/svg+xml,%3Csvg width='25' height='24' viewBox='0 0 25 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.4943 10.4038L7.7174 15.1615L7.16162 14.6057L12.4943 9.29225L17.8078 14.6057L17.252 15.1615L12.4943 10.4038Z' fill='%23160F26'/%3E%3C/svg%3E%0A");
|
|
10
|
+
background-repeat: no-repeat;
|
|
11
|
+
background-size: 120%;
|
|
12
|
+
transform: rotateZ(180deg);
|
|
13
|
+
}
|
|
14
|
+
:global(.menu__link--sublist-caret[aria-expanded="true"])::after {
|
|
15
|
+
transform: rotateZ(0deg);
|
|
16
|
+
}
|
|
17
|
+
:global(.menu__caret)::before {
|
|
18
|
+
background-image: url("data:image/svg+xml,%3Csvg width='25' height='24' viewBox='0 0 25 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.4943 10.4038L7.7174 15.1615L7.16162 14.6057L12.4943 9.29225L17.8078 14.6057L17.252 15.1615L12.4943 10.4038Z' fill='%23160F26'/%3E%3C/svg%3E%0A");
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
background-size: 120%;
|
|
21
|
+
transform: rotateZ(180deg);
|
|
22
|
+
margin-left: -1rem;
|
|
23
|
+
}
|
|
24
|
+
:global(.menu__caret[aria-expanded="true"]):before {
|
|
25
|
+
transform: rotateZ(0deg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.categoryLinkLabel {
|
|
29
|
+
flex: 1;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
display: -webkit-box;
|
|
32
|
+
line-clamp: 2;
|
|
33
|
+
-webkit-box-orient: vertical;
|
|
34
|
+
-webkit-line-clamp: 2;
|
|
35
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, {type ReactNode} from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
import type {Props} from '@theme/DocSidebarItem/Html';
|
|
5
|
+
|
|
6
|
+
import styles from './styles.module.css';
|
|
7
|
+
|
|
8
|
+
export default function DocSidebarItemHtml({
|
|
9
|
+
item,
|
|
10
|
+
level,
|
|
11
|
+
index,
|
|
12
|
+
}: Props): ReactNode {
|
|
13
|
+
const {value, defaultStyle, className} = item;
|
|
14
|
+
return (
|
|
15
|
+
<li
|
|
16
|
+
className={clsx(
|
|
17
|
+
ThemeClassNames.docs.docSidebarItemLink,
|
|
18
|
+
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
19
|
+
level > 1 &&
|
|
20
|
+
ThemeClassNames.docs.docSidebarItemLinkLevel(level) &&
|
|
21
|
+
'ml-2',
|
|
22
|
+
defaultStyle && [styles.menuHtmlItem, 'menu__list-item '],
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
key={index}
|
|
26
|
+
// eslint-disable-next-line react/no-danger
|
|
27
|
+
dangerouslySetInnerHTML={{__html: value}}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, {type ReactNode} from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
import {isActiveSidebarItem} from '@docusaurus/plugin-content-docs/client';
|
|
5
|
+
import Link from '@docusaurus/Link';
|
|
6
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
7
|
+
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
8
|
+
import type {Props} from '@theme/DocSidebarItem/Link';
|
|
9
|
+
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
|
|
12
|
+
function LinkLabel({label}: {label: string}) {
|
|
13
|
+
return (
|
|
14
|
+
<span title={label} className={styles.linkLabel}>
|
|
15
|
+
{label}
|
|
16
|
+
</span>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function DocSidebarItemLink({
|
|
21
|
+
item,
|
|
22
|
+
onItemClick,
|
|
23
|
+
activePath,
|
|
24
|
+
level,
|
|
25
|
+
index,
|
|
26
|
+
...props
|
|
27
|
+
}: Props): ReactNode {
|
|
28
|
+
const {href, label, className, autoAddBaseUrl} = item;
|
|
29
|
+
const isActive = isActiveSidebarItem(item, activePath);
|
|
30
|
+
const isInternalLink = isInternalUrl(href);
|
|
31
|
+
return (
|
|
32
|
+
<li
|
|
33
|
+
className={clsx(
|
|
34
|
+
ThemeClassNames.docs.docSidebarItemLink,
|
|
35
|
+
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
36
|
+
level > 1 && ThemeClassNames.docs.docSidebarItemLinkLevel(level) && 'ml-2',
|
|
37
|
+
'menu__list-item',
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
key={label}>
|
|
41
|
+
<Link
|
|
42
|
+
className={clsx(
|
|
43
|
+
'menu__link hover:bg-transparent hover:text-primary',
|
|
44
|
+
!isInternalLink && styles.menuExternalLink,
|
|
45
|
+
{
|
|
46
|
+
'text-primary hover:bg-transparent focus:bg-transparent active:bg-transparent':
|
|
47
|
+
isActive,
|
|
48
|
+
},
|
|
49
|
+
)}
|
|
50
|
+
autoAddBaseUrl={autoAddBaseUrl}
|
|
51
|
+
aria-current={isActive ? 'page' : undefined}
|
|
52
|
+
to={href}
|
|
53
|
+
{...(isInternalLink && {
|
|
54
|
+
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
55
|
+
})}
|
|
56
|
+
{...props}>
|
|
57
|
+
<LinkLabel label={label} />
|
|
58
|
+
{!isInternalLink && <IconExternalLink />}
|
|
59
|
+
</Link>
|
|
60
|
+
</li>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import DocSidebarItemCategory from '@theme/DocSidebarItem/Category';
|
|
5
|
+
import DocSidebarItemLink from '@theme/DocSidebarItem/Link';
|
|
6
|
+
import DocSidebarItemHtml from '@theme/DocSidebarItem/Html';
|
|
7
|
+
import type {Props} from '@theme/DocSidebarItem';
|
|
8
|
+
|
|
9
|
+
export default function DocSidebarItem({item, ...props}: Props): ReactNode {
|
|
10
|
+
switch (item.type) {
|
|
11
|
+
case 'category':
|
|
12
|
+
return <div className="mt-3 md:mt-0"><DocSidebarItemCategory item={item} {...props} /></div>;
|
|
13
|
+
case 'html':
|
|
14
|
+
return <div className="mt-3 md:mt-0"><DocSidebarItemHtml item={item} {...props} /></div>;
|
|
15
|
+
case 'link':
|
|
16
|
+
default:
|
|
17
|
+
return <div className="mt-3 md:mt-0"><DocSidebarItemLink item={item} {...props} /></div>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {memo, type ReactNode} from 'react';
|
|
4
|
+
import {
|
|
5
|
+
DocSidebarItemsExpandedStateProvider,
|
|
6
|
+
useVisibleSidebarItems,
|
|
7
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
8
|
+
import DocSidebarItem from '@theme/DocSidebarItem';
|
|
9
|
+
|
|
10
|
+
import type {Props} from '@theme/DocSidebarItems';
|
|
11
|
+
|
|
12
|
+
function DocSidebarItems({items, ...props}: Props): ReactNode {
|
|
13
|
+
const visibleItems = useVisibleSidebarItems(items, props.activePath);
|
|
14
|
+
return (
|
|
15
|
+
<DocSidebarItemsExpandedStateProvider>
|
|
16
|
+
{visibleItems.map((item, index) => (
|
|
17
|
+
<DocSidebarItem key={index} item={item} index={index} {...props} />
|
|
18
|
+
))}
|
|
19
|
+
</DocSidebarItemsExpandedStateProvider>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Optimize sidebar at each "level"
|
|
24
|
+
export default memo(DocSidebarItems);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import Link from '@docusaurus/Link';
|
|
6
|
+
import {
|
|
7
|
+
PageMetadata,
|
|
8
|
+
HtmlClassNameProvider,
|
|
9
|
+
ThemeClassNames,
|
|
10
|
+
usePluralForm,
|
|
11
|
+
} from '@docusaurus/theme-common';
|
|
12
|
+
import Translate, {translate} from '@docusaurus/Translate';
|
|
13
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
14
|
+
import type {Props} from '@theme/DocTagDocListPage';
|
|
15
|
+
import Unlisted from '@theme/ContentVisibility/Unlisted';
|
|
16
|
+
import Heading from '@theme/Heading';
|
|
17
|
+
|
|
18
|
+
// Very simple pluralization: probably good enough for now
|
|
19
|
+
function useNDocsTaggedPlural() {
|
|
20
|
+
const {selectMessage} = usePluralForm();
|
|
21
|
+
return (count: number) =>
|
|
22
|
+
selectMessage(
|
|
23
|
+
count,
|
|
24
|
+
translate(
|
|
25
|
+
{
|
|
26
|
+
id: 'theme.docs.tagDocListPageTitle.nDocsTagged',
|
|
27
|
+
description:
|
|
28
|
+
'Pluralized label for "{count} docs tagged". 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)',
|
|
29
|
+
message: 'One doc tagged|{count} docs tagged',
|
|
30
|
+
},
|
|
31
|
+
{count},
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function usePageTitle(props: Props): string {
|
|
37
|
+
const nDocsTaggedPlural = useNDocsTaggedPlural();
|
|
38
|
+
return translate(
|
|
39
|
+
{
|
|
40
|
+
id: 'theme.docs.tagDocListPageTitle',
|
|
41
|
+
description: 'The title of the page for a docs tag',
|
|
42
|
+
message: '{nDocsTagged} with "{tagName}"',
|
|
43
|
+
},
|
|
44
|
+
{nDocsTagged: nDocsTaggedPlural(props.tag.count), tagName: props.tag.label},
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function DocItem({doc}: {doc: Props['tag']['items'][number]}): ReactNode {
|
|
49
|
+
return (
|
|
50
|
+
<article className="margin-vert--lg">
|
|
51
|
+
<Link to={doc.permalink}>
|
|
52
|
+
<Heading as="h2">{doc.title}</Heading>
|
|
53
|
+
</Link>
|
|
54
|
+
{doc.description && <p>{doc.description}</p>}
|
|
55
|
+
</article>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function DocTagDocListPageMetadata({
|
|
60
|
+
title,
|
|
61
|
+
tag,
|
|
62
|
+
}: Props & {title: string}): ReactNode {
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<PageMetadata title={title} description={tag.description} />
|
|
66
|
+
<SearchMetadata tag="doc_tag_doc_list" />
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function DocTagDocListPageContent({
|
|
72
|
+
tag,
|
|
73
|
+
title,
|
|
74
|
+
}: Props & {title: string}): ReactNode {
|
|
75
|
+
return (
|
|
76
|
+
<HtmlClassNameProvider
|
|
77
|
+
className={clsx(ThemeClassNames.page.docsTagDocListPage)}>
|
|
78
|
+
<div className="container margin-vert--lg">
|
|
79
|
+
<div className="row">
|
|
80
|
+
<main className="col col--8 col--offset-2">
|
|
81
|
+
{tag.unlisted && <Unlisted />}
|
|
82
|
+
<header className="margin-bottom--xl">
|
|
83
|
+
<Heading as="h1">{title}</Heading>
|
|
84
|
+
{tag.description && <p>{tag.description}</p>}
|
|
85
|
+
<Link href={tag.allTagsPath}>
|
|
86
|
+
<Translate
|
|
87
|
+
id="theme.tags.tagsPageLink"
|
|
88
|
+
description="The label of the link targeting the tag list page">
|
|
89
|
+
View all tags
|
|
90
|
+
</Translate>
|
|
91
|
+
</Link>
|
|
92
|
+
</header>
|
|
93
|
+
<section className="margin-vert--lg">
|
|
94
|
+
{tag.items.map((doc) => (
|
|
95
|
+
<DocItem key={doc.id} doc={doc} />
|
|
96
|
+
))}
|
|
97
|
+
</section>
|
|
98
|
+
</main>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</HtmlClassNameProvider>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default function DocTagDocListPage(props: Props): ReactNode {
|
|
106
|
+
const title = usePageTitle(props);
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<DocTagDocListPageMetadata {...props} title={title} />
|
|
110
|
+
<DocTagDocListPageContent {...props} title={title} />
|
|
111
|
+
</>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import {
|
|
6
|
+
PageMetadata,
|
|
7
|
+
HtmlClassNameProvider,
|
|
8
|
+
ThemeClassNames,
|
|
9
|
+
translateTagsPageTitle,
|
|
10
|
+
} from '@docusaurus/theme-common';
|
|
11
|
+
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
12
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
13
|
+
import type {Props} from '@theme/DocTagsListPage';
|
|
14
|
+
import Heading from '@theme/Heading';
|
|
15
|
+
|
|
16
|
+
function DocTagsListPageMetadata({title}: Props & {title: string}): ReactNode {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<PageMetadata title={title} />
|
|
20
|
+
<SearchMetadata tag="doc_tags_list" />
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function DocTagsListPageContent({
|
|
26
|
+
tags,
|
|
27
|
+
title,
|
|
28
|
+
}: Props & {title: string}): ReactNode {
|
|
29
|
+
return (
|
|
30
|
+
<HtmlClassNameProvider
|
|
31
|
+
className={clsx(ThemeClassNames.page.docsTagsListPage)}>
|
|
32
|
+
<div className="container margin-vert--lg">
|
|
33
|
+
<div className="row">
|
|
34
|
+
<main className="col col--8 col--offset-2">
|
|
35
|
+
<Heading as="h1">{title}</Heading>
|
|
36
|
+
<TagsListByLetter tags={tags} />
|
|
37
|
+
</main>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</HtmlClassNameProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function DocTagsListPage(props: Props): ReactNode {
|
|
45
|
+
const title = translateTagsPageTitle();
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<DocTagsListPageMetadata {...props} title={title} />
|
|
49
|
+
<DocTagsListPageContent {...props} title={title} />
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
}
|