@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,47 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {memo, type ReactNode} from 'react';
|
|
4
|
+
import {
|
|
5
|
+
useVisibleBlogSidebarItems,
|
|
6
|
+
BlogSidebarItemList,
|
|
7
|
+
} from '@docusaurus/plugin-content-blog/client';
|
|
8
|
+
import {NavbarSecondaryMenuFiller} from '@docusaurus/theme-common';
|
|
9
|
+
import BlogSidebarContent from '@theme/BlogSidebar/Content';
|
|
10
|
+
import type {Props} from '@theme/BlogSidebar/Mobile';
|
|
11
|
+
import type {Props as BlogSidebarContentProps} from '@theme/BlogSidebar/Content';
|
|
12
|
+
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
|
|
15
|
+
const ListComponent: BlogSidebarContentProps['ListComponent'] = ({items}) => {
|
|
16
|
+
return (
|
|
17
|
+
<BlogSidebarItemList
|
|
18
|
+
items={items}
|
|
19
|
+
ulClassName="menu__list"
|
|
20
|
+
liClassName="menu__list-item"
|
|
21
|
+
linkClassName="menu__link"
|
|
22
|
+
linkActiveClassName="menu__link--active"
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function BlogSidebarMobileSecondaryMenu({sidebar}: Props): ReactNode {
|
|
28
|
+
const items = useVisibleBlogSidebarItems(sidebar.items);
|
|
29
|
+
return (
|
|
30
|
+
<BlogSidebarContent
|
|
31
|
+
items={items}
|
|
32
|
+
ListComponent={ListComponent}
|
|
33
|
+
yearGroupHeadingClassName={styles.yearGroupHeading}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function BlogSidebarMobile(props: Props): ReactNode {
|
|
39
|
+
return (
|
|
40
|
+
<NavbarSecondaryMenuFiller
|
|
41
|
+
component={BlogSidebarMobileSecondaryMenu}
|
|
42
|
+
props={props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default memo(BlogSidebarMobile);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import {useWindowSize} from '@docusaurus/theme-common';
|
|
5
|
+
import BlogSidebarDesktop from '@theme/BlogSidebar/Desktop';
|
|
6
|
+
import BlogSidebarMobile from '@theme/BlogSidebar/Mobile';
|
|
7
|
+
import type {Props} from '@theme/BlogSidebar';
|
|
8
|
+
|
|
9
|
+
export default function BlogSidebar({sidebar}: Props): ReactNode {
|
|
10
|
+
const windowSize = useWindowSize();
|
|
11
|
+
if (!sidebar?.items.length) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
// Mobile sidebar doesn't need to be server-rendered
|
|
15
|
+
if (windowSize === 'mobile') {
|
|
16
|
+
return <BlogSidebarMobile sidebar={sidebar} />;
|
|
17
|
+
}
|
|
18
|
+
return <BlogSidebarDesktop sidebar={sidebar} />;
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 BlogLayout from '@theme/BlogLayout';
|
|
12
|
+
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
13
|
+
import type {Props} from '@theme/BlogTagsListPage';
|
|
14
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
15
|
+
import Heading from '@theme/Heading';
|
|
16
|
+
|
|
17
|
+
export default function BlogTagsListPage({tags, sidebar}: Props): ReactNode {
|
|
18
|
+
const title = translateTagsPageTitle();
|
|
19
|
+
return (
|
|
20
|
+
<HtmlClassNameProvider
|
|
21
|
+
className={clsx(
|
|
22
|
+
ThemeClassNames.wrapper.blogPages,
|
|
23
|
+
ThemeClassNames.page.blogTagsListPage,
|
|
24
|
+
)}>
|
|
25
|
+
<PageMetadata title={title} />
|
|
26
|
+
<SearchMetadata tag="blog_tags_list" />
|
|
27
|
+
<BlogLayout sidebar={sidebar}>
|
|
28
|
+
<Heading as="h1">{title}</Heading>
|
|
29
|
+
<TagsListByLetter tags={tags} />
|
|
30
|
+
</BlogLayout>
|
|
31
|
+
</HtmlClassNameProvider>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import Translate from '@docusaurus/Translate';
|
|
6
|
+
import {
|
|
7
|
+
PageMetadata,
|
|
8
|
+
HtmlClassNameProvider,
|
|
9
|
+
ThemeClassNames,
|
|
10
|
+
} from '@docusaurus/theme-common';
|
|
11
|
+
import {useBlogTagsPostsPageTitle} from '@docusaurus/theme-common/internal';
|
|
12
|
+
import Link from '@docusaurus/Link';
|
|
13
|
+
import BlogLayout from '@theme/BlogLayout';
|
|
14
|
+
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
15
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
16
|
+
import type {Props} from '@theme/BlogTagsPostsPage';
|
|
17
|
+
import BlogPostItems from '@theme/BlogPostItems';
|
|
18
|
+
import Unlisted from '@theme/ContentVisibility/Unlisted';
|
|
19
|
+
import Heading from '@theme/Heading';
|
|
20
|
+
|
|
21
|
+
function BlogTagsPostsPageMetadata({tag}: Props): ReactNode {
|
|
22
|
+
const title = useBlogTagsPostsPageTitle(tag);
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<PageMetadata title={title} description={tag.description} />
|
|
26
|
+
<SearchMetadata tag="blog_tags_posts" />
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function BlogTagsPostsPageContent({
|
|
32
|
+
tag,
|
|
33
|
+
items,
|
|
34
|
+
sidebar,
|
|
35
|
+
listMetadata,
|
|
36
|
+
}: Props): ReactNode {
|
|
37
|
+
const title = useBlogTagsPostsPageTitle(tag);
|
|
38
|
+
return (
|
|
39
|
+
<BlogLayout sidebar={sidebar}>
|
|
40
|
+
{tag.unlisted && <Unlisted />}
|
|
41
|
+
<header className="margin-bottom--xl">
|
|
42
|
+
<Heading as="h1">{title}</Heading>
|
|
43
|
+
{tag.description && <p>{tag.description}</p>}
|
|
44
|
+
<Link href={tag.allTagsPath}>
|
|
45
|
+
<Translate
|
|
46
|
+
id="theme.tags.tagsPageLink"
|
|
47
|
+
description="The label of the link targeting the tag list page">
|
|
48
|
+
View All Tags
|
|
49
|
+
</Translate>
|
|
50
|
+
</Link>
|
|
51
|
+
</header>
|
|
52
|
+
<BlogPostItems items={items} />
|
|
53
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
54
|
+
</BlogLayout>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export default function BlogTagsPostsPage(props: Props): ReactNode {
|
|
58
|
+
return (
|
|
59
|
+
<HtmlClassNameProvider
|
|
60
|
+
className={clsx(
|
|
61
|
+
ThemeClassNames.wrapper.blogPages,
|
|
62
|
+
ThemeClassNames.page.blogTagPostListPage,
|
|
63
|
+
)}>
|
|
64
|
+
<BlogTagsPostsPageMetadata {...props} />
|
|
65
|
+
<BlogTagsPostsPageContent {...props} />
|
|
66
|
+
</HtmlClassNameProvider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import type {Props} from '@theme/CodeBlock/Buttons/Button';
|
|
6
|
+
|
|
7
|
+
export default function CodeBlockButton({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: Props): ReactNode {
|
|
11
|
+
return (
|
|
12
|
+
<button type="button" {...props} className={clsx('clean-btn', className)} />
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {
|
|
4
|
+
useCallback,
|
|
5
|
+
useState,
|
|
6
|
+
useRef,
|
|
7
|
+
useEffect,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import {translate} from '@docusaurus/Translate';
|
|
12
|
+
import {useCodeBlockContext} from '@docusaurus/theme-common/internal';
|
|
13
|
+
import Button from '@theme/CodeBlock/Buttons/Button';
|
|
14
|
+
import type {Props} from '@theme/CodeBlock/Buttons/CopyButton';
|
|
15
|
+
import IconCopy from '@theme/Icon/Copy';
|
|
16
|
+
import IconSuccess from '@theme/Icon/Success';
|
|
17
|
+
|
|
18
|
+
import styles from './styles.module.css';
|
|
19
|
+
|
|
20
|
+
function title() {
|
|
21
|
+
return translate({
|
|
22
|
+
id: 'theme.CodeBlock.copy',
|
|
23
|
+
message: 'Copy',
|
|
24
|
+
description: 'The copy button label on code blocks',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ariaLabel(isCopied: boolean) {
|
|
29
|
+
return isCopied
|
|
30
|
+
? translate({
|
|
31
|
+
id: 'theme.CodeBlock.copied',
|
|
32
|
+
message: 'Copied',
|
|
33
|
+
description: 'The copied button label on code blocks',
|
|
34
|
+
})
|
|
35
|
+
: translate({
|
|
36
|
+
id: 'theme.CodeBlock.copyButtonAriaLabel',
|
|
37
|
+
message: 'Copy code to clipboard',
|
|
38
|
+
description: 'The ARIA label for copy code blocks button',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function useCopyButton() {
|
|
43
|
+
const {
|
|
44
|
+
metadata: {code},
|
|
45
|
+
} = useCodeBlockContext();
|
|
46
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
47
|
+
const copyTimeout = useRef<number | undefined>(undefined);
|
|
48
|
+
|
|
49
|
+
const copyCode = useCallback(() => {
|
|
50
|
+
navigator.clipboard.writeText(code).then(() => {
|
|
51
|
+
setIsCopied(true);
|
|
52
|
+
copyTimeout.current = window.setTimeout(() => {
|
|
53
|
+
setIsCopied(false);
|
|
54
|
+
}, 1000);
|
|
55
|
+
});
|
|
56
|
+
}, [code]);
|
|
57
|
+
|
|
58
|
+
useEffect(() => () => window.clearTimeout(copyTimeout.current), []);
|
|
59
|
+
|
|
60
|
+
return {copyCode, isCopied};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default function CopyButton({className}: Props): ReactNode {
|
|
64
|
+
const {copyCode, isCopied} = useCopyButton();
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Button
|
|
68
|
+
aria-label={ariaLabel(isCopied)}
|
|
69
|
+
title={title()}
|
|
70
|
+
className={clsx(
|
|
71
|
+
className,
|
|
72
|
+
styles.copyButton,
|
|
73
|
+
isCopied && styles.copyButtonCopied,
|
|
74
|
+
)}
|
|
75
|
+
onClick={copyCode}>
|
|
76
|
+
<span className={styles.copyButtonIcons} aria-hidden="true">
|
|
77
|
+
<IconCopy className={styles.copyButtonIcon} />
|
|
78
|
+
<IconSuccess className={styles.copyButtonSuccessIcon} />
|
|
79
|
+
</span>
|
|
80
|
+
</Button>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
:global(.theme-code-block:hover) .copyButtonCopied {
|
|
4
|
+
opacity: 1 !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.copyButtonIcons {
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 1.125rem;
|
|
10
|
+
height: 1.125rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.copyButtonIcon,
|
|
14
|
+
.copyButtonSuccessIcon {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
fill: currentColor;
|
|
19
|
+
opacity: inherit;
|
|
20
|
+
width: inherit;
|
|
21
|
+
height: inherit;
|
|
22
|
+
transition: all var(--ifm-transition-fast) ease;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.copyButtonSuccessIcon {
|
|
26
|
+
top: 50%;
|
|
27
|
+
left: 50%;
|
|
28
|
+
transform: translate(-50%, -50%) scale(0.33);
|
|
29
|
+
opacity: 0;
|
|
30
|
+
color: #00d600;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.copyButtonCopied .copyButtonIcon {
|
|
34
|
+
transform: scale(0.33);
|
|
35
|
+
opacity: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.copyButtonCopied .copyButtonSuccessIcon {
|
|
39
|
+
transform: translate(-50%, -50%) scale(1);
|
|
40
|
+
opacity: 1;
|
|
41
|
+
transition-delay: 0.075s;
|
|
42
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import {translate} from '@docusaurus/Translate';
|
|
6
|
+
import {useCodeBlockContext} from '@docusaurus/theme-common/internal';
|
|
7
|
+
import Button from '@theme/CodeBlock/Buttons/Button';
|
|
8
|
+
import type {Props} from '@theme/CodeBlock/Buttons/WordWrapButton';
|
|
9
|
+
import IconWordWrap from '@theme/Icon/WordWrap';
|
|
10
|
+
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
|
|
13
|
+
export default function WordWrapButton({className}: Props): ReactNode {
|
|
14
|
+
const {wordWrap} = useCodeBlockContext();
|
|
15
|
+
|
|
16
|
+
const canShowButton = wordWrap.isEnabled || wordWrap.isCodeScrollable;
|
|
17
|
+
if (!canShowButton) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const title = translate({
|
|
22
|
+
id: 'theme.CodeBlock.wordWrapToggle',
|
|
23
|
+
message: 'Toggle word wrap',
|
|
24
|
+
description:
|
|
25
|
+
'The title attribute for toggle word wrapping button of code block lines',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Button
|
|
30
|
+
onClick={() => wordWrap.toggle()}
|
|
31
|
+
className={clsx(
|
|
32
|
+
className,
|
|
33
|
+
wordWrap.isEnabled && styles.wordWrapButtonEnabled,
|
|
34
|
+
)}
|
|
35
|
+
aria-label={title}
|
|
36
|
+
title={title}>
|
|
37
|
+
<IconWordWrap className={styles.wordWrapButtonIcon} aria-hidden="true" />
|
|
38
|
+
</Button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
6
|
+
|
|
7
|
+
import CopyButton from '@theme/CodeBlock/Buttons/CopyButton';
|
|
8
|
+
import WordWrapButton from '@theme/CodeBlock/Buttons/WordWrapButton';
|
|
9
|
+
import type {Props} from '@theme/CodeBlock/Buttons';
|
|
10
|
+
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
|
|
13
|
+
// Code block buttons are not server-rendered on purpose
|
|
14
|
+
// Adding them to the initial HTML is useless and expensive (due to JSX SVG)
|
|
15
|
+
// They are hidden by default and require React to become interactive
|
|
16
|
+
export default function CodeBlockButtons({className}: Props): ReactNode {
|
|
17
|
+
return (
|
|
18
|
+
<BrowserOnly>
|
|
19
|
+
{() => (
|
|
20
|
+
<div className={clsx(className, styles.buttonGroup)}>
|
|
21
|
+
<WordWrapButton />
|
|
22
|
+
<CopyButton />
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
25
|
+
</BrowserOnly>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.buttonGroup {
|
|
4
|
+
display: flex;
|
|
5
|
+
column-gap: 0.2rem;
|
|
6
|
+
position: absolute;
|
|
7
|
+
/* rtl:ignore */
|
|
8
|
+
right: calc(var(--ifm-pre-padding) / 2);
|
|
9
|
+
top: calc(var(--ifm-pre-padding) / 2);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.buttonGroup button {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background: var(--prism-background-color);
|
|
16
|
+
color: var(--prism-color);
|
|
17
|
+
border: 1px solid var(--ifm-color-emphasis-300);
|
|
18
|
+
border-radius: var(--ifm-global-radius);
|
|
19
|
+
padding: 0.4rem;
|
|
20
|
+
line-height: 0;
|
|
21
|
+
transition: opacity var(--ifm-transition-fast) ease-in-out;
|
|
22
|
+
opacity: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.buttonGroup button:focus-visible,
|
|
26
|
+
.buttonGroup button:hover {
|
|
27
|
+
opacity: 1 !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:global(.theme-code-block:hover) .buttonGroup button {
|
|
31
|
+
opacity: 0.4;
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ComponentProps, type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import {ThemeClassNames, usePrismTheme} from '@docusaurus/theme-common';
|
|
6
|
+
import {getPrismCssVariables} from '@docusaurus/theme-common/internal';
|
|
7
|
+
import styles from './styles.module.css';
|
|
8
|
+
|
|
9
|
+
export default function CodeBlockContainer<T extends 'div' | 'pre'>({
|
|
10
|
+
as: As,
|
|
11
|
+
...props
|
|
12
|
+
}: {as: T} & ComponentProps<T>): ReactNode {
|
|
13
|
+
const prismTheme = usePrismTheme();
|
|
14
|
+
const prismCssVariables = getPrismCssVariables(prismTheme);
|
|
15
|
+
return (
|
|
16
|
+
<As
|
|
17
|
+
// Polymorphic components are hard to type, without `oneOf` generics
|
|
18
|
+
{...(props as any)}
|
|
19
|
+
style={prismCssVariables}
|
|
20
|
+
className={clsx(
|
|
21
|
+
props.className,
|
|
22
|
+
styles.codeBlockContainer,
|
|
23
|
+
ThemeClassNames.common.codeBlock,
|
|
24
|
+
)}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import Container from '@theme/CodeBlock/Container';
|
|
6
|
+
import type {Props} from '@theme/CodeBlock/Content/Element';
|
|
7
|
+
|
|
8
|
+
import styles from './styles.module.css';
|
|
9
|
+
|
|
10
|
+
// TODO Docusaurus v4: move this component at the root?
|
|
11
|
+
// This component only handles a rare edge-case: <pre><MyComp/></pre> in MDX
|
|
12
|
+
// <pre> tags in markdown map to CodeBlocks. They may contain JSX children.
|
|
13
|
+
// When children is not a simple string, we just return a styled block without
|
|
14
|
+
// actually highlighting.
|
|
15
|
+
export default function CodeBlockJSX({children, className}: Props): ReactNode {
|
|
16
|
+
return (
|
|
17
|
+
<Container
|
|
18
|
+
as="pre"
|
|
19
|
+
tabIndex={0}
|
|
20
|
+
className={clsx(styles.codeBlockStandalone, 'thin-scrollbar', className)}>
|
|
21
|
+
<code className={styles.codeBlockLines}>{children}</code>
|
|
22
|
+
</Container>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
5
|
+
import {
|
|
6
|
+
CodeBlockContextProvider,
|
|
7
|
+
type CodeBlockMetadata,
|
|
8
|
+
createCodeBlockMetadata,
|
|
9
|
+
useCodeWordWrap,
|
|
10
|
+
} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import type {Props} from '@theme/CodeBlock/Content/String';
|
|
12
|
+
import CodeBlockLayout from '@theme/CodeBlock/Layout';
|
|
13
|
+
|
|
14
|
+
function useCodeBlockMetadata(props: Props): CodeBlockMetadata {
|
|
15
|
+
const {prism} = useThemeConfig();
|
|
16
|
+
return createCodeBlockMetadata({
|
|
17
|
+
code: props.children,
|
|
18
|
+
className: props.className,
|
|
19
|
+
metastring: props.metastring,
|
|
20
|
+
magicComments: prism.magicComments,
|
|
21
|
+
defaultLanguage: prism.defaultLanguage,
|
|
22
|
+
language: props.language,
|
|
23
|
+
title: props.title,
|
|
24
|
+
showLineNumbers: props.showLineNumbers,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// TODO Docusaurus v4: move this component at the root?
|
|
29
|
+
export default function CodeBlockString(props: Props): ReactNode {
|
|
30
|
+
const metadata = useCodeBlockMetadata(props);
|
|
31
|
+
const wordWrap = useCodeWordWrap();
|
|
32
|
+
return (
|
|
33
|
+
<CodeBlockContextProvider metadata={metadata} wordWrap={wordWrap}>
|
|
34
|
+
<CodeBlockLayout />
|
|
35
|
+
</CodeBlockContextProvider>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ComponentProps, type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import {useCodeBlockContext} from '@docusaurus/theme-common/internal';
|
|
6
|
+
import {usePrismTheme} from '@docusaurus/theme-common';
|
|
7
|
+
import {Highlight} from 'prism-react-renderer';
|
|
8
|
+
import type {Props} from '@theme/CodeBlock/Content';
|
|
9
|
+
import Line from '@theme/CodeBlock/Line';
|
|
10
|
+
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
|
|
13
|
+
// TODO Docusaurus v4: remove useless forwardRef
|
|
14
|
+
const Pre = React.forwardRef<HTMLPreElement, ComponentProps<'pre'>>(
|
|
15
|
+
(props, ref) => {
|
|
16
|
+
return (
|
|
17
|
+
<pre
|
|
18
|
+
ref={ref}
|
|
19
|
+
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
20
|
+
tabIndex={0}
|
|
21
|
+
{...props}
|
|
22
|
+
className={clsx(props.className, styles.codeBlock, 'thin-scrollbar')}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
function Code(props: ComponentProps<'code'>) {
|
|
29
|
+
const {metadata} = useCodeBlockContext();
|
|
30
|
+
return (
|
|
31
|
+
<code
|
|
32
|
+
{...props}
|
|
33
|
+
className={clsx(
|
|
34
|
+
props.className,
|
|
35
|
+
styles.codeBlockLines,
|
|
36
|
+
metadata.lineNumbersStart !== undefined &&
|
|
37
|
+
styles.codeBlockLinesWithNumbering,
|
|
38
|
+
)}
|
|
39
|
+
style={{
|
|
40
|
+
...props.style,
|
|
41
|
+
counterReset:
|
|
42
|
+
metadata.lineNumbersStart === undefined
|
|
43
|
+
? undefined
|
|
44
|
+
: `line-count ${metadata.lineNumbersStart - 1}`,
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default function CodeBlockContent({
|
|
51
|
+
className: classNameProp,
|
|
52
|
+
}: Props): ReactNode {
|
|
53
|
+
const {metadata, wordWrap} = useCodeBlockContext();
|
|
54
|
+
const prismTheme = usePrismTheme();
|
|
55
|
+
const {code, language, lineNumbersStart, lineClassNames} = metadata;
|
|
56
|
+
return (
|
|
57
|
+
<Highlight theme={prismTheme} code={code} language={language}>
|
|
58
|
+
{({className, style, tokens: lines, getLineProps, getTokenProps}) => (
|
|
59
|
+
<Pre
|
|
60
|
+
ref={wordWrap.codeBlockRef}
|
|
61
|
+
className={clsx(classNameProp, className)}
|
|
62
|
+
style={style}>
|
|
63
|
+
<Code>
|
|
64
|
+
{lines.map((line, i) => (
|
|
65
|
+
<Line
|
|
66
|
+
key={i}
|
|
67
|
+
line={line}
|
|
68
|
+
getLineProps={getLineProps}
|
|
69
|
+
getTokenProps={getTokenProps}
|
|
70
|
+
classNames={lineClassNames[i]}
|
|
71
|
+
showLineNumbers={lineNumbersStart !== undefined}
|
|
72
|
+
/>
|
|
73
|
+
))}
|
|
74
|
+
</Code>
|
|
75
|
+
</Pre>
|
|
76
|
+
)}
|
|
77
|
+
</Highlight>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.codeBlock {
|
|
4
|
+
--ifm-pre-background: var(--prism-background-color);
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.codeBlockStandalone {
|
|
10
|
+
padding: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.codeBlockLines {
|
|
14
|
+
font: inherit;
|
|
15
|
+
/* rtl:ignore */
|
|
16
|
+
float: left;
|
|
17
|
+
min-width: 100%;
|
|
18
|
+
padding: var(--ifm-pre-padding);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.codeBlockLinesWithNumbering {
|
|
22
|
+
display: table;
|
|
23
|
+
padding: var(--ifm-pre-padding) 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media print {
|
|
27
|
+
.codeBlockLines {
|
|
28
|
+
white-space: pre-wrap;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, {type ReactNode} from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import {useCodeBlockContext} from '@docusaurus/theme-common/internal';
|
|
6
|
+
import Container from '@theme/CodeBlock/Container';
|
|
7
|
+
import Title from '@theme/CodeBlock/Title';
|
|
8
|
+
import Content from '@theme/CodeBlock/Content';
|
|
9
|
+
import type {Props} from '@theme/CodeBlock/Layout';
|
|
10
|
+
import Buttons from '@theme/CodeBlock/Buttons';
|
|
11
|
+
|
|
12
|
+
import styles from './styles.module.css';
|
|
13
|
+
|
|
14
|
+
export default function CodeBlockLayout({className}: Props): ReactNode {
|
|
15
|
+
const {metadata} = useCodeBlockContext();
|
|
16
|
+
return (
|
|
17
|
+
<Container as="div" className={clsx(className, metadata.className)}>
|
|
18
|
+
{metadata.title && (
|
|
19
|
+
<div className={styles.codeBlockTitle}>
|
|
20
|
+
<Title>{metadata.title}</Title>
|
|
21
|
+
</div>
|
|
22
|
+
)}
|
|
23
|
+
<div className={styles.codeBlockContent}>
|
|
24
|
+
<Content />
|
|
25
|
+
<Buttons />
|
|
26
|
+
</div>
|
|
27
|
+
</Container>
|
|
28
|
+
);
|
|
29
|
+
}
|