create-trellis-docs 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/bin/index.js +29 -0
- package/lib/index.js +178 -0
- package/package.json +23 -0
- package/template/_gitignore +6 -0
- package/template/blog/2025-01-01-welcome.md +15 -0
- package/template/design-tokens.json +218 -0
- package/template/docs/faq/general.mdx +16 -0
- package/template/docs/faq/index.mdx +13 -0
- package/template/docs/getting-started.mdx +54 -0
- package/template/docs/guides/writing-docs.mdx +90 -0
- package/template/docusaurus.config.js.tpl +200 -0
- package/template/package.json.tpl +60 -0
- package/template/packages/faq-index-plugin/README.md +104 -0
- package/template/packages/faq-index-plugin/index.js +91 -0
- package/template/packages/faq-index-plugin/package.json +15 -0
- package/template/packages/redirects-plugin/README.md +186 -0
- package/template/packages/redirects-plugin/index.js +167 -0
- package/template/packages/redirects-plugin/package.json +15 -0
- package/template/packages/redirects-plugin/yarn.lock +31 -0
- package/template/redirects.json +1 -0
- package/template/scripts/build-tokens.js +34 -0
- package/template/sidebars.js +17 -0
- package/template/src/components/CustomSearch/CustomSearch.js +241 -0
- package/template/src/components/CustomSearch/CustomSearchContent.js +171 -0
- package/template/src/components/CustomSearch/NavbarSearch.js +211 -0
- package/template/src/components/CustomSearch/SearchContext.js +26 -0
- package/template/src/components/CustomSearch/styles.module.css +171 -0
- package/template/src/components/CustomSearch/wrapperInit.js +11 -0
- package/template/src/components/FaqTableOfContents/index.jsx +176 -0
- package/template/src/components/FaqTableOfContents/styles.module.css +167 -0
- package/template/src/components/Feedback/Feedback.js +310 -0
- package/template/src/components/Feedback/api.js +77 -0
- package/template/src/components/FlippingCard/FlippingCard.js +197 -0
- package/template/src/components/FlippingCard/styles.module.css +248 -0
- package/template/src/components/Glossary.js +57 -0
- package/template/src/css/custom.css +765 -0
- package/template/src/data/glossary.json +1 -0
- package/template/src/pages/index.js.tpl +38 -0
- package/template/src/theme/Admonition/Icon/Danger.js +11 -0
- package/template/src/theme/Admonition/Icon/Info.js +11 -0
- package/template/src/theme/Admonition/Icon/Note.js +11 -0
- package/template/src/theme/Admonition/Icon/Tip.js +11 -0
- package/template/src/theme/Admonition/Icon/Warning.js +11 -0
- package/template/src/theme/Admonition/Layout/index.js +39 -0
- package/template/src/theme/Admonition/Layout/styles.module.css +36 -0
- package/template/src/theme/Admonition/Type/Caution.js +28 -0
- package/template/src/theme/Admonition/Type/Danger.js +26 -0
- package/template/src/theme/Admonition/Type/Info.js +26 -0
- package/template/src/theme/Admonition/Type/Note.js +26 -0
- package/template/src/theme/Admonition/Type/Tip.js +26 -0
- package/template/src/theme/Admonition/Type/Warning.js +26 -0
- package/template/src/theme/Admonition/Types.js +27 -0
- package/template/src/theme/Admonition/index.js +18 -0
- package/template/src/theme/AnnouncementBar/CloseButton/index.js +20 -0
- package/template/src/theme/AnnouncementBar/CloseButton/styles.module.css +4 -0
- package/template/src/theme/AnnouncementBar/Content/index.js +17 -0
- package/template/src/theme/AnnouncementBar/Content/styles.module.css +10 -0
- package/template/src/theme/AnnouncementBar/index.js +33 -0
- package/template/src/theme/AnnouncementBar/styles.module.css +55 -0
- package/template/src/theme/BlogSidebar/Content/index.js +35 -0
- package/template/src/theme/BlogSidebar/Desktop/index.js +44 -0
- package/template/src/theme/BlogSidebar/Desktop/styles.module.css +60 -0
- package/template/src/theme/BlogSidebar/Mobile/index.js +38 -0
- package/template/src/theme/BlogSidebar/Mobile/styles.module.css +3 -0
- package/template/src/theme/BlogSidebar/index.js +15 -0
- package/template/src/theme/Details/index.js +23 -0
- package/template/src/theme/Details/styles.module.css +52 -0
- package/template/src/theme/DocBreadcrumbs/Items/Home/index.js +22 -0
- package/template/src/theme/DocBreadcrumbs/Items/Home/styles.module.css +7 -0
- package/template/src/theme/DocBreadcrumbs/StructuredData/index.js +15 -0
- package/template/src/theme/DocBreadcrumbs/index.js +75 -0
- package/template/src/theme/DocBreadcrumbs/styles.module.css +5 -0
- package/template/src/theme/DocCard/index.js +93 -0
- package/template/src/theme/DocCard/styles.module.css +53 -0
- package/template/src/theme/DocCardList/index.js +27 -0
- package/template/src/theme/DocCardList/styles.module.css +7 -0
- package/template/src/theme/DocItem/Content/index.js +121 -0
- package/template/src/theme/DocItem/Content/styles.module.css +96 -0
- package/template/src/theme/DocItem/Footer/index.js +43 -0
- package/template/src/theme/DocItem/Footer/styles.module.css +19 -0
- package/template/src/theme/DocItem/Layout/index.js +55 -0
- package/template/src/theme/DocItem/Layout/styles.module.css +14 -0
- package/template/src/theme/DocItem/Metadata/index.js +17 -0
- package/template/src/theme/DocItem/Paginator/index.js +17 -0
- package/template/src/theme/DocItem/TOC/Desktop/index.js +15 -0
- package/template/src/theme/DocItem/TOC/Mobile/index.js +17 -0
- package/template/src/theme/DocItem/TOC/Mobile/styles.module.css +12 -0
- package/template/src/theme/DocItem/index.js +19 -0
- package/template/src/theme/DocItem/styles.module.css +28 -0
- package/template/src/theme/DocRoot/Layout/Main/index.js +23 -0
- package/template/src/theme/DocRoot/Layout/Main/styles.module.css +31 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/ExpandButton/index.js +28 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/ExpandButton/styles.module.css +27 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/index.js +70 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/styles.module.css +32 -0
- package/template/src/theme/DocRoot/Layout/index.js +27 -0
- package/template/src/theme/DocRoot/Layout/styles.module.css +9 -0
- package/template/src/theme/DocRoot/index.js +25 -0
- package/template/src/theme/DocSidebar/Desktop/CollapseButton/index.js +28 -0
- package/template/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +40 -0
- package/template/src/theme/DocSidebar/Desktop/Content/index.js +44 -0
- package/template/src/theme/DocSidebar/Desktop/Content/styles.module.css +16 -0
- package/template/src/theme/DocSidebar/Desktop/index.js +28 -0
- package/template/src/theme/DocSidebar/Desktop/styles.module.css +37 -0
- package/template/src/theme/DocSidebar/Mobile/index.js +39 -0
- package/template/src/theme/DocSidebar/index.js +18 -0
- package/template/src/theme/DocSidebarItem/Category/index.js +203 -0
- package/template/src/theme/DocSidebarItem/Html/index.js +20 -0
- package/template/src/theme/DocSidebarItem/Html/styles.module.css +6 -0
- package/template/src/theme/DocSidebarItem/Link/index.js +49 -0
- package/template/src/theme/DocSidebarItem/Link/styles.module.css +3 -0
- package/template/src/theme/DocSidebarItem/index.js +15 -0
- package/template/src/theme/EditMetaRow/index.js +25 -0
- package/template/src/theme/EditMetaRow/styles.module.css +11 -0
- package/template/src/theme/EditThisPage/index.js +29 -0
- package/template/src/theme/ErrorPageContent.js +34 -0
- package/template/src/theme/Footer/Copyright/index.js +11 -0
- package/template/src/theme/Footer/Layout/index.js +21 -0
- package/template/src/theme/Footer/LinkItem/index.js +26 -0
- package/template/src/theme/Footer/Links/MultiColumn/index.js +44 -0
- package/template/src/theme/Footer/Links/Simple/index.js +32 -0
- package/template/src/theme/Footer/Links/index.js +11 -0
- package/template/src/theme/Footer/Logo/index.js +35 -0
- package/template/src/theme/Footer/Logo/styles.module.css +9 -0
- package/template/src/theme/Footer/index.js +22 -0
- package/template/src/theme/MDXComponents/Heading.js +120 -0
- package/template/src/theme/MDXComponents/index.js +17 -0
- package/template/src/theme/MDXComponents/styles.module.css +110 -0
- package/template/src/theme/MDXContent/index.js +6 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/Desktop/index.js +110 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/Mobile/index.js +136 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/Mobile/styles.module.css +3 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/index.js +7 -0
- package/template/src/theme/NotFound/Content/index.js +46 -0
- package/template/src/theme/NotFound/index.js +19 -0
- package/template/src/theme/NotFound.js +49 -0
- package/template/src/theme/PaginatorNavLink/index.js +17 -0
- package/template/src/theme/TOC/index.js +19 -0
- package/template/src/theme/TOC/styles.module.css +16 -0
- package/template/src/theme/TOCItems/Tree.js +30 -0
- package/template/src/theme/TOCItems/index.js +47 -0
- package/template/src/theme/TabItem/index.js +15 -0
- package/template/src/theme/TabItem/styles.module.css +10 -0
- package/template/src/theme/Tabs/index.js +189 -0
- package/template/src/theme/Tabs/styles.module.css +74 -0
- package/template/static/img/favicon.svg +4 -0
- package/template/static/img/oops-404.svg +11 -0
- package/template/static/searchIndex.json +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--docusaurus-collapse-button-bg: transparent;
|
|
3
|
+
--docusaurus-collapse-button-bg-hover: rgb(0 0 0 / 10%);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[data-theme='dark']:root {
|
|
7
|
+
--docusaurus-collapse-button-bg: rgb(255 255 255 / 5%);
|
|
8
|
+
--docusaurus-collapse-button-bg-hover: rgb(255 255 255 / 10%);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (min-width: 997px) {
|
|
12
|
+
.collapseSidebarButton {
|
|
13
|
+
display: block !important;
|
|
14
|
+
background-color: var(--docusaurus-collapse-button-bg);
|
|
15
|
+
height: 40px;
|
|
16
|
+
position: sticky;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
border-radius: 0;
|
|
19
|
+
border: 1px solid var(--ifm-toc-border-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.collapseSidebarButtonIcon {
|
|
23
|
+
transform: rotate(180deg);
|
|
24
|
+
margin-top: 4px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[dir='rtl'] .collapseSidebarButtonIcon {
|
|
28
|
+
transform: rotate(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.collapseSidebarButton:hover,
|
|
32
|
+
.collapseSidebarButton:focus {
|
|
33
|
+
background-color: var(--docusaurus-collapse-button-bg-hover);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.collapseSidebarButton {
|
|
38
|
+
display: none;
|
|
39
|
+
margin: 0;
|
|
40
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
import {
|
|
5
|
+
useAnnouncementBar,
|
|
6
|
+
useScrollPosition,
|
|
7
|
+
} from '@docusaurus/theme-common/internal';
|
|
8
|
+
import {translate} from '@docusaurus/Translate';
|
|
9
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
function useShowAnnouncementBar() {
|
|
12
|
+
const {isActive} = useAnnouncementBar();
|
|
13
|
+
const [showAnnouncementBar, setShowAnnouncementBar] = useState(isActive);
|
|
14
|
+
useScrollPosition(
|
|
15
|
+
({scrollY}) => {
|
|
16
|
+
if (isActive) {
|
|
17
|
+
setShowAnnouncementBar(scrollY === 0);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
[isActive],
|
|
21
|
+
);
|
|
22
|
+
return isActive && showAnnouncementBar;
|
|
23
|
+
}
|
|
24
|
+
export default function DocSidebarDesktopContent({path, sidebar, className}) {
|
|
25
|
+
const showAnnouncementBar = useShowAnnouncementBar();
|
|
26
|
+
return (
|
|
27
|
+
<nav
|
|
28
|
+
aria-label={translate({
|
|
29
|
+
id: 'theme.docs.sidebar.navAriaLabel',
|
|
30
|
+
message: 'Docs sidebar',
|
|
31
|
+
description: 'The ARIA label for the sidebar navigation',
|
|
32
|
+
})}
|
|
33
|
+
className={clsx(
|
|
34
|
+
'menu thin-scrollbar',
|
|
35
|
+
styles.menu,
|
|
36
|
+
showAnnouncementBar && styles.menuWithAnnouncementBar,
|
|
37
|
+
className,
|
|
38
|
+
)}>
|
|
39
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
40
|
+
<DocSidebarItems items={sidebar} activePath={path} level={1} />
|
|
41
|
+
</ul>
|
|
42
|
+
</nav>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@media (min-width: 997px) {
|
|
2
|
+
.menu {
|
|
3
|
+
flex-grow: 1;
|
|
4
|
+
padding: 0.5rem;
|
|
5
|
+
}
|
|
6
|
+
@supports (scrollbar-gutter: stable) {
|
|
7
|
+
.menu {
|
|
8
|
+
padding: 0.5rem 0 0.5rem 0.5rem;
|
|
9
|
+
scrollbar-gutter: stable;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.menuWithAnnouncementBar {
|
|
14
|
+
margin-bottom: var(--docusaurus-announcement-bar-height);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
4
|
+
import Logo from '@theme/Logo';
|
|
5
|
+
import CollapseButton from '@theme/DocSidebar/Desktop/CollapseButton';
|
|
6
|
+
import Content from '@theme/DocSidebar/Desktop/Content';
|
|
7
|
+
import styles from './styles.module.css';
|
|
8
|
+
function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
|
|
9
|
+
const {
|
|
10
|
+
navbar: {hideOnScroll},
|
|
11
|
+
docs: {
|
|
12
|
+
sidebar: {hideable},
|
|
13
|
+
},
|
|
14
|
+
} = useThemeConfig();
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={clsx(
|
|
18
|
+
styles.sidebar,
|
|
19
|
+
hideOnScroll && styles.sidebarWithHideableNavbar,
|
|
20
|
+
isHidden && styles.sidebarHidden,
|
|
21
|
+
)}>
|
|
22
|
+
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
|
|
23
|
+
<Content path={path} sidebar={sidebar} />
|
|
24
|
+
{hideable && <CollapseButton onClick={onCollapse} />}
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export default React.memo(DocSidebarDesktop);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@media (min-width: 997px) {
|
|
2
|
+
.sidebar {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
height: 100%;
|
|
6
|
+
padding-top: var(--ifm-navbar-height);
|
|
7
|
+
width: var(--doc-sidebar-width);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sidebarWithHideableNavbar {
|
|
11
|
+
padding-top: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sidebarHidden {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
visibility: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sidebarLogo {
|
|
20
|
+
display: flex !important;
|
|
21
|
+
align-items: center;
|
|
22
|
+
margin: 0 var(--ifm-navbar-padding-horizontal);
|
|
23
|
+
min-height: var(--ifm-navbar-height);
|
|
24
|
+
max-height: var(--ifm-navbar-height);
|
|
25
|
+
color: inherit !important;
|
|
26
|
+
text-decoration: none !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sidebarLogo img {
|
|
30
|
+
margin-right: 0.5rem;
|
|
31
|
+
height: 2rem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sidebarLogo {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
NavbarSecondaryMenuFiller,
|
|
5
|
+
ThemeClassNames,
|
|
6
|
+
} from '@docusaurus/theme-common';
|
|
7
|
+
import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
|
|
8
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
9
|
+
// eslint-disable-next-line react/function-component-definition
|
|
10
|
+
const DocSidebarMobileSecondaryMenu = ({sidebar, path}) => {
|
|
11
|
+
const mobileSidebar = useNavbarMobileSidebar();
|
|
12
|
+
return (
|
|
13
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
14
|
+
<DocSidebarItems
|
|
15
|
+
items={sidebar}
|
|
16
|
+
activePath={path}
|
|
17
|
+
onItemClick={(item) => {
|
|
18
|
+
// Mobile sidebar should only be closed if the category has a link
|
|
19
|
+
if (item.type === 'category' && item.href) {
|
|
20
|
+
mobileSidebar.toggle();
|
|
21
|
+
}
|
|
22
|
+
if (item.type === 'link') {
|
|
23
|
+
mobileSidebar.toggle();
|
|
24
|
+
}
|
|
25
|
+
}}
|
|
26
|
+
level={1}
|
|
27
|
+
/>
|
|
28
|
+
</ul>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
function DocSidebarMobile(props) {
|
|
32
|
+
return (
|
|
33
|
+
<NavbarSecondaryMenuFiller
|
|
34
|
+
component={DocSidebarMobileSecondaryMenu}
|
|
35
|
+
props={props}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export default React.memo(DocSidebarMobile);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {useWindowSize} from '@docusaurus/theme-common';
|
|
3
|
+
import DocSidebarDesktop from '@theme/DocSidebar/Desktop';
|
|
4
|
+
import DocSidebarMobile from '@theme/DocSidebar/Mobile';
|
|
5
|
+
export default function DocSidebar(props) {
|
|
6
|
+
const windowSize = useWindowSize();
|
|
7
|
+
// Desktop sidebar visible on hydration: need SSR rendering
|
|
8
|
+
const shouldRenderSidebarDesktop =
|
|
9
|
+
windowSize === 'desktop' || windowSize === 'ssr';
|
|
10
|
+
// Mobile sidebar not visible on hydration: can avoid SSR rendering
|
|
11
|
+
const shouldRenderSidebarMobile = windowSize === 'mobile';
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{shouldRenderSidebarDesktop && <DocSidebarDesktop {...props} />}
|
|
15
|
+
{shouldRenderSidebarMobile && <DocSidebarMobile {...props} />}
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React, {useEffect, useMemo} from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
ThemeClassNames,
|
|
5
|
+
useThemeConfig,
|
|
6
|
+
usePrevious,
|
|
7
|
+
Collapsible,
|
|
8
|
+
useCollapsible,
|
|
9
|
+
} from '@docusaurus/theme-common';
|
|
10
|
+
import {isSamePath} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import {
|
|
12
|
+
isActiveSidebarItem,
|
|
13
|
+
findFirstSidebarItemLink,
|
|
14
|
+
useDocSidebarItemsExpandedState,
|
|
15
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
16
|
+
import Link from '@docusaurus/Link';
|
|
17
|
+
import {translate} from '@docusaurus/Translate';
|
|
18
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
19
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
20
|
+
// If we navigate to a category and it becomes active, it should automatically
|
|
21
|
+
// expand itself
|
|
22
|
+
function useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed}) {
|
|
23
|
+
const wasActive = usePrevious(isActive);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const justBecameActive = isActive && !wasActive;
|
|
26
|
+
if (justBecameActive && collapsed) {
|
|
27
|
+
updateCollapsed(false);
|
|
28
|
+
}
|
|
29
|
+
}, [isActive, wasActive, collapsed, updateCollapsed]);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* When a collapsible category has no link, we still link it to its first child
|
|
33
|
+
* during SSR as a temporary fallback. This allows to be able to navigate inside
|
|
34
|
+
* the category even when JS fails to load, is delayed or simply disabled
|
|
35
|
+
* React hydration becomes an optional progressive enhancement
|
|
36
|
+
* see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
|
|
37
|
+
* see https://github.com/facebook/docusaurus/issues/3030
|
|
38
|
+
*/
|
|
39
|
+
function useCategoryHrefWithSSRFallback(item) {
|
|
40
|
+
const isBrowser = useIsBrowser();
|
|
41
|
+
return useMemo(() => {
|
|
42
|
+
if (item.href && !item.linkUnlisted) {
|
|
43
|
+
return item.href;
|
|
44
|
+
}
|
|
45
|
+
// In these cases, it's not necessary to render a fallback
|
|
46
|
+
// We skip the "findFirstCategoryLink" computation
|
|
47
|
+
if (isBrowser || !item.collapsible) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return findFirstSidebarItemLink(item);
|
|
51
|
+
}, [item, isBrowser]);
|
|
52
|
+
}
|
|
53
|
+
function CollapseButton({collapsed, categoryLabel, onClick}) {
|
|
54
|
+
return (
|
|
55
|
+
<button
|
|
56
|
+
aria-label={
|
|
57
|
+
collapsed
|
|
58
|
+
? translate(
|
|
59
|
+
{
|
|
60
|
+
id: 'theme.DocSidebarItem.expandCategoryAriaLabel',
|
|
61
|
+
message: "Expand sidebar category '{label}'",
|
|
62
|
+
description: 'The ARIA label to expand the sidebar category',
|
|
63
|
+
},
|
|
64
|
+
{label: categoryLabel},
|
|
65
|
+
)
|
|
66
|
+
: translate(
|
|
67
|
+
{
|
|
68
|
+
id: 'theme.DocSidebarItem.collapseCategoryAriaLabel',
|
|
69
|
+
message: "Collapse sidebar category '{label}'",
|
|
70
|
+
description: 'The ARIA label to collapse the sidebar category',
|
|
71
|
+
},
|
|
72
|
+
{label: categoryLabel},
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
aria-expanded={!collapsed}
|
|
76
|
+
type="button"
|
|
77
|
+
className="clean-btn menu__caret"
|
|
78
|
+
onClick={onClick}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
export default function DocSidebarItemCategory({
|
|
83
|
+
item,
|
|
84
|
+
onItemClick,
|
|
85
|
+
activePath,
|
|
86
|
+
level,
|
|
87
|
+
index,
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
const {items, label, collapsible, className, href} = item;
|
|
91
|
+
const {
|
|
92
|
+
docs: {
|
|
93
|
+
sidebar: {autoCollapseCategories},
|
|
94
|
+
},
|
|
95
|
+
} = useThemeConfig();
|
|
96
|
+
const hrefWithSSRFallback = useCategoryHrefWithSSRFallback(item);
|
|
97
|
+
const isActive = isActiveSidebarItem(item, activePath);
|
|
98
|
+
const isCurrentPage = isSamePath(href, activePath);
|
|
99
|
+
const {collapsed, setCollapsed} = useCollapsible({
|
|
100
|
+
// Active categories are always initialized as expanded. The default
|
|
101
|
+
// (`item.collapsed`) is only used for non-active categories.
|
|
102
|
+
initialState: () => {
|
|
103
|
+
if (!collapsible) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return isActive ? false : item.collapsed;
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
const {expandedItem, setExpandedItem} = useDocSidebarItemsExpandedState();
|
|
110
|
+
// Use this instead of `setCollapsed`, because it is also reactive
|
|
111
|
+
const updateCollapsed = (toCollapsed = !collapsed) => {
|
|
112
|
+
setExpandedItem(toCollapsed ? null : index);
|
|
113
|
+
setCollapsed(toCollapsed);
|
|
114
|
+
};
|
|
115
|
+
useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed});
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (
|
|
118
|
+
collapsible &&
|
|
119
|
+
expandedItem != null &&
|
|
120
|
+
expandedItem !== index &&
|
|
121
|
+
autoCollapseCategories
|
|
122
|
+
) {
|
|
123
|
+
setCollapsed(true);
|
|
124
|
+
}
|
|
125
|
+
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);
|
|
126
|
+
return (
|
|
127
|
+
<li
|
|
128
|
+
className={clsx(
|
|
129
|
+
ThemeClassNames.docs.docSidebarItemCategory,
|
|
130
|
+
ThemeClassNames.docs.docSidebarItemCategoryLevel(level),
|
|
131
|
+
'menu__list-item',
|
|
132
|
+
{
|
|
133
|
+
'menu__list-item--collapsed': collapsed,
|
|
134
|
+
},
|
|
135
|
+
className,
|
|
136
|
+
)}>
|
|
137
|
+
<div
|
|
138
|
+
className={clsx('menu__list-item-collapsible', {
|
|
139
|
+
'menu__list-item-collapsible--active': isCurrentPage,
|
|
140
|
+
})}>
|
|
141
|
+
<Link
|
|
142
|
+
className={clsx('menu__link', {
|
|
143
|
+
'menu__link--sublist': collapsible,
|
|
144
|
+
'menu__link--sublist-caret': !href && collapsible,
|
|
145
|
+
'menu__link--active': isActive,
|
|
146
|
+
})}
|
|
147
|
+
onClick={
|
|
148
|
+
collapsible
|
|
149
|
+
? (e) => {
|
|
150
|
+
onItemClick?.(item);
|
|
151
|
+
if (href) {
|
|
152
|
+
// When already on the category's page, we collapse it
|
|
153
|
+
// We don't use "isActive" because it would collapse the
|
|
154
|
+
// category even when we browse a children element
|
|
155
|
+
// See https://github.com/facebook/docusaurus/issues/11213
|
|
156
|
+
if (isCurrentPage) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
updateCollapsed();
|
|
159
|
+
} else {
|
|
160
|
+
// When navigating to a new category, we always expand
|
|
161
|
+
// see https://github.com/facebook/docusaurus/issues/10854#issuecomment-2609616182
|
|
162
|
+
updateCollapsed(false);
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
updateCollapsed();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
: () => {
|
|
170
|
+
onItemClick?.(item);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
aria-current={isCurrentPage ? 'page' : undefined}
|
|
174
|
+
role={collapsible && !href ? 'button' : undefined}
|
|
175
|
+
aria-expanded={collapsible && !href ? !collapsed : undefined}
|
|
176
|
+
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
177
|
+
{...props}>
|
|
178
|
+
{label}
|
|
179
|
+
</Link>
|
|
180
|
+
{href && collapsible && (
|
|
181
|
+
<CollapseButton
|
|
182
|
+
collapsed={collapsed}
|
|
183
|
+
categoryLabel={label}
|
|
184
|
+
onClick={(e) => {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
updateCollapsed();
|
|
187
|
+
}}
|
|
188
|
+
/>
|
|
189
|
+
)}
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
|
|
193
|
+
<DocSidebarItems
|
|
194
|
+
items={items}
|
|
195
|
+
tabIndex={collapsed ? -1 : 0}
|
|
196
|
+
onItemClick={onItemClick}
|
|
197
|
+
activePath={activePath}
|
|
198
|
+
level={level + 1}
|
|
199
|
+
/>
|
|
200
|
+
</Collapsible>
|
|
201
|
+
</li>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
import styles from './styles.module.css';
|
|
5
|
+
export default function DocSidebarItemHtml({item, level, index}) {
|
|
6
|
+
const {value, defaultStyle, className} = item;
|
|
7
|
+
return (
|
|
8
|
+
<li
|
|
9
|
+
className={clsx(
|
|
10
|
+
ThemeClassNames.docs.docSidebarItemLink,
|
|
11
|
+
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
12
|
+
defaultStyle && [styles.menuHtmlItem, 'menu__list-item'],
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
key={index}
|
|
16
|
+
// eslint-disable-next-line react/no-danger
|
|
17
|
+
dangerouslySetInnerHTML={{__html: value}}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React 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 styles from './styles.module.css';
|
|
9
|
+
export default function DocSidebarItemLink({
|
|
10
|
+
item,
|
|
11
|
+
onItemClick,
|
|
12
|
+
activePath,
|
|
13
|
+
level,
|
|
14
|
+
index,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const {href, label, className, autoAddBaseUrl} = item;
|
|
18
|
+
const isActive = isActiveSidebarItem(item, activePath);
|
|
19
|
+
const isInternalLink = isInternalUrl(href);
|
|
20
|
+
return (
|
|
21
|
+
<li
|
|
22
|
+
className={clsx(
|
|
23
|
+
ThemeClassNames.docs.docSidebarItemLink,
|
|
24
|
+
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
25
|
+
'menu__list-item',
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
key={label}>
|
|
29
|
+
<Link
|
|
30
|
+
className={clsx(
|
|
31
|
+
'menu__link',
|
|
32
|
+
!isInternalLink && styles.menuExternalLink,
|
|
33
|
+
{
|
|
34
|
+
'menu__link--active': isActive,
|
|
35
|
+
},
|
|
36
|
+
)}
|
|
37
|
+
autoAddBaseUrl={autoAddBaseUrl}
|
|
38
|
+
aria-current={isActive ? 'page' : undefined}
|
|
39
|
+
to={href}
|
|
40
|
+
{...(isInternalLink && {
|
|
41
|
+
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
42
|
+
})}
|
|
43
|
+
{...props}>
|
|
44
|
+
{label}
|
|
45
|
+
{!isInternalLink && <IconExternalLink />}
|
|
46
|
+
</Link>
|
|
47
|
+
</li>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DocSidebarItemCategory from '@theme/DocSidebarItem/Category';
|
|
3
|
+
import DocSidebarItemLink from '@theme/DocSidebarItem/Link';
|
|
4
|
+
import DocSidebarItemHtml from '@theme/DocSidebarItem/Html';
|
|
5
|
+
export default function DocSidebarItem({item, ...props}) {
|
|
6
|
+
switch (item.type) {
|
|
7
|
+
case 'category':
|
|
8
|
+
return <DocSidebarItemCategory item={item} {...props} />;
|
|
9
|
+
case 'html':
|
|
10
|
+
return <DocSidebarItemHtml item={item} {...props} />;
|
|
11
|
+
case 'link':
|
|
12
|
+
default:
|
|
13
|
+
return <DocSidebarItemLink item={item} {...props} />;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import EditThisPage from '@theme/EditThisPage';
|
|
4
|
+
import LastUpdated from '@theme/LastUpdated';
|
|
5
|
+
import styles from './styles.module.css';
|
|
6
|
+
export default function EditMetaRow({
|
|
7
|
+
className,
|
|
8
|
+
editUrl,
|
|
9
|
+
lastUpdatedAt,
|
|
10
|
+
lastUpdatedBy,
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<div className={clsx('row', className)}>
|
|
14
|
+
<div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
|
|
15
|
+
<div className={clsx('col', styles.lastUpdated)}>
|
|
16
|
+
{(lastUpdatedAt || lastUpdatedBy) && (
|
|
17
|
+
<LastUpdated
|
|
18
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
19
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
20
|
+
/>
|
|
21
|
+
)}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Translate from '@docusaurus/Translate';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
|
|
5
|
+
function EditIcon() {
|
|
6
|
+
return (
|
|
7
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" style={{ marginRight: 6 }}>
|
|
8
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
9
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
10
|
+
</svg>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function EditThisPage({editUrl}) {
|
|
15
|
+
return (
|
|
16
|
+
<a
|
|
17
|
+
href={editUrl}
|
|
18
|
+
target="_blank"
|
|
19
|
+
rel="noreferrer noopener"
|
|
20
|
+
className={ThemeClassNames.common.editThisPage}>
|
|
21
|
+
<EditIcon />
|
|
22
|
+
<Translate
|
|
23
|
+
id="theme.common.editThisPage"
|
|
24
|
+
description="The link label to edit the current page">
|
|
25
|
+
Edit this page
|
|
26
|
+
</Translate>
|
|
27
|
+
</a>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Translate from '@docusaurus/Translate';
|
|
3
|
+
import {
|
|
4
|
+
ErrorBoundaryError,
|
|
5
|
+
ErrorBoundaryTryAgainButton,
|
|
6
|
+
} from '@docusaurus/theme-common';
|
|
7
|
+
export default function ErrorPageContent({ error, tryAgain }) {
|
|
8
|
+
return (
|
|
9
|
+
<main className="container margin-vert--xl">
|
|
10
|
+
<div className="row">
|
|
11
|
+
<div className="col col--6 col--offset-3">
|
|
12
|
+
<h1 className="hero__title">
|
|
13
|
+
<Translate
|
|
14
|
+
id="theme.ErrorPageContent.title"
|
|
15
|
+
description="The title of the fallback page when the page crashed"
|
|
16
|
+
>
|
|
17
|
+
This page crashed.
|
|
18
|
+
</Translate>
|
|
19
|
+
</h1>
|
|
20
|
+
<div className="margin-vert--lg">
|
|
21
|
+
<ErrorBoundaryTryAgainButton
|
|
22
|
+
onClick={tryAgain}
|
|
23
|
+
className="button button--primary shadow--lw"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<hr />
|
|
27
|
+
<div className="margin-vert--md">
|
|
28
|
+
<ErrorBoundaryError error={error} />
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</main>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function FooterCopyright({copyright}) {
|
|
3
|
+
return (
|
|
4
|
+
<div
|
|
5
|
+
className="footer__copyright"
|
|
6
|
+
// Developer provided the HTML, so assume it's safe.
|
|
7
|
+
// eslint-disable-next-line react/no-danger
|
|
8
|
+
dangerouslySetInnerHTML={{__html: copyright}}
|
|
9
|
+
/>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
export default function FooterLayout({style, links, logo, copyright}) {
|
|
5
|
+
return (
|
|
6
|
+
<footer
|
|
7
|
+
className={clsx(ThemeClassNames.layout.footer.container, 'footer', {
|
|
8
|
+
'footer--dark': style === 'dark',
|
|
9
|
+
})}>
|
|
10
|
+
<div className="container container-fluid">
|
|
11
|
+
{links}
|
|
12
|
+
{(logo || copyright) && (
|
|
13
|
+
<div className="footer__bottom text--center">
|
|
14
|
+
{logo && <div className="margin-bottom--sm">{logo}</div>}
|
|
15
|
+
{copyright}
|
|
16
|
+
</div>
|
|
17
|
+
)}
|
|
18
|
+
</div>
|
|
19
|
+
</footer>
|
|
20
|
+
);
|
|
21
|
+
}
|