@docusaurus/theme-classic 0.0.0-4705 → 0.0.0-4709

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.
Files changed (45) hide show
  1. package/lib/getSwizzleConfig.js +50 -2
  2. package/lib/theme-classic.d.ts +107 -0
  3. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
  4. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
  5. package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
  6. package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
  7. package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
  8. package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
  9. package/lib-next/theme/DocSidebar/Mobile/index.js +45 -0
  10. package/lib-next/theme/DocSidebar/index.js +6 -113
  11. package/lib-next/theme/Footer/Copyright/index.js +18 -0
  12. package/lib-next/theme/Footer/Layout/index.js +26 -0
  13. package/lib-next/theme/Footer/LinkItem/index.js +35 -0
  14. package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
  15. package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
  16. package/lib-next/theme/Footer/Links/index.js +17 -0
  17. package/lib-next/theme/Footer/Logo/index.js +38 -0
  18. package/lib-next/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
  19. package/lib-next/theme/Footer/index.js +11 -156
  20. package/lib-next/theme/MDXComponents/index.js +1 -1
  21. package/lib-next/theme/Tabs/index.js +2 -2
  22. package/package.json +13 -13
  23. package/src/getSwizzleConfig.ts +52 -1
  24. package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
  25. package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
  26. package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
  27. package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
  28. package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
  29. package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
  30. package/src/theme/DocSidebar/Mobile/index.tsx +51 -0
  31. package/src/theme/DocSidebar/index.tsx +6 -121
  32. package/src/theme/Footer/Copyright/index.tsx +22 -0
  33. package/src/theme/Footer/Layout/index.tsx +34 -0
  34. package/src/theme/Footer/LinkItem/index.tsx +38 -0
  35. package/src/theme/Footer/Links/MultiColumn/index.tsx +53 -0
  36. package/src/theme/Footer/Links/Simple/index.tsx +44 -0
  37. package/src/theme/Footer/Links/index.tsx +21 -0
  38. package/src/theme/Footer/Logo/index.tsx +41 -0
  39. package/src/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
  40. package/src/theme/Footer/index.tsx +12 -170
  41. package/src/theme/MDXComponents/index.tsx +2 -2
  42. package/src/theme/Tabs/index.tsx +1 -2
  43. package/src/theme-classic.d.ts +107 -0
  44. package/lib-next/theme/DocSidebar/styles.module.css +0 -107
  45. package/src/theme/DocSidebar/styles.module.css +0 -107
@@ -6,185 +6,27 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import clsx from 'clsx';
10
9
 
11
- import Link from '@docusaurus/Link';
12
- import {
13
- type FooterLinkItem,
14
- useThemeConfig,
15
- type MultiColumnFooter,
16
- type SimpleFooter,
17
- } from '@docusaurus/theme-common';
18
- import useBaseUrl, {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
19
- import isInternalUrl from '@docusaurus/isInternalUrl';
20
- import styles from './styles.module.css';
21
- import ThemedImage from '@theme/ThemedImage';
22
- import IconExternalLink from '@theme/IconExternalLink';
23
-
24
- function FooterLink({
25
- to,
26
- href,
27
- label,
28
- prependBaseUrlToHref,
29
- ...props
30
- }: FooterLinkItem) {
31
- const toUrl = useBaseUrl(to);
32
- const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
33
-
34
- return (
35
- <Link
36
- className="footer__link-item"
37
- {...(href
38
- ? {
39
- href: prependBaseUrlToHref ? normalizedHref : href,
40
- }
41
- : {
42
- to: toUrl,
43
- })}
44
- {...props}>
45
- <span>
46
- {label}
47
- {href && !isInternalUrl(href) && <IconExternalLink />}
48
- </span>
49
- </Link>
50
- );
51
- }
52
-
53
- function FooterLogo({logo}: {logo: SimpleFooter['logo']}) {
54
- const {withBaseUrl} = useBaseUrlUtils();
55
- if (!logo?.src) {
56
- return null;
57
- }
58
- const sources = {
59
- light: withBaseUrl(logo.src),
60
- dark: withBaseUrl(logo.srcDark ?? logo.src),
61
- };
62
- const image = (
63
- <ThemedImage
64
- className="footer__logo"
65
- alt={logo.alt}
66
- sources={sources}
67
- width={logo.width}
68
- height={logo.height}
69
- />
70
- );
71
- return (
72
- <div className="margin-bottom--sm">
73
- {logo.href ? (
74
- <Link href={logo.href} className={styles.footerLogoLink}>
75
- {image}
76
- </Link>
77
- ) : (
78
- image
79
- )}
80
- </div>
81
- );
82
- }
83
-
84
- function MultiColumnLinks({links}: {links: MultiColumnFooter['links']}) {
85
- return (
86
- <>
87
- {links.map((linkItem, i) => (
88
- <div key={i} className="col footer__col">
89
- <div className="footer__title">{linkItem.title}</div>
90
- <ul className="footer__items">
91
- {linkItem.items.map((item, key) =>
92
- item.html ? (
93
- <li
94
- key={key}
95
- className="footer__item"
96
- // Developer provided the HTML, so assume it's safe.
97
- // eslint-disable-next-line react/no-danger
98
- dangerouslySetInnerHTML={{
99
- __html: item.html,
100
- }}
101
- />
102
- ) : (
103
- <li key={item.href || item.to} className="footer__item">
104
- <FooterLink {...item} />
105
- </li>
106
- ),
107
- )}
108
- </ul>
109
- </div>
110
- ))}
111
- </>
112
- );
113
- }
114
-
115
- function SimpleLinks({links}: {links: SimpleFooter['links']}) {
116
- return (
117
- <div className="footer__links">
118
- {links.map((item, key) => (
119
- <React.Fragment key={key}>
120
- {item.html ? (
121
- <span
122
- className="footer__link-item"
123
- // Developer provided the HTML, so assume it's safe.
124
- // eslint-disable-next-line react/no-danger
125
- dangerouslySetInnerHTML={{
126
- __html: item.html,
127
- }}
128
- />
129
- ) : (
130
- <FooterLink {...item} />
131
- )}
132
- {links.length !== key + 1 && (
133
- <span className="footer__link-separator">·</span>
134
- )}
135
- </React.Fragment>
136
- ))}
137
- </div>
138
- );
139
- }
140
-
141
- function isMultiColumnFooterLinks(
142
- links: MultiColumnFooter['links'] | SimpleFooter['links'],
143
- ): links is MultiColumnFooter['links'] {
144
- return 'title' in links[0]!;
145
- }
10
+ import {useThemeConfig} from '@docusaurus/theme-common';
11
+ import FooterLinks from '@theme/Footer/Links';
12
+ import FooterLogo from '@theme/Footer/Logo';
13
+ import FooterCopyright from '@theme/Footer/Copyright';
14
+ import FooterLayout from '@theme/Footer/Layout';
146
15
 
147
16
  function Footer(): JSX.Element | null {
148
17
  const {footer} = useThemeConfig();
149
18
  if (!footer) {
150
19
  return null;
151
20
  }
152
- const {copyright, links, logo} = footer;
21
+ const {copyright, links, logo, style} = footer;
153
22
 
154
23
  return (
155
- <footer
156
- className={clsx('footer', {
157
- 'footer--dark': footer.style === 'dark',
158
- })}>
159
- <div className="container container-fluid">
160
- {links &&
161
- links.length > 0 &&
162
- (isMultiColumnFooterLinks(links) ? (
163
- <div className="row footer__links">
164
- <MultiColumnLinks links={links} />
165
- </div>
166
- ) : (
167
- <div className="footer__links text--center">
168
- <SimpleLinks links={links} />
169
- </div>
170
- ))}
171
- {(logo || copyright) && (
172
- <div className="footer__bottom text--center">
173
- <FooterLogo logo={logo} />
174
- {copyright && (
175
- <div
176
- className="footer__copyright"
177
- // Developer provided the HTML, so assume it's safe.
178
- // eslint-disable-next-line react/no-danger
179
- dangerouslySetInnerHTML={{
180
- __html: copyright,
181
- }}
182
- />
183
- )}
184
- </div>
185
- )}
186
- </div>
187
- </footer>
24
+ <FooterLayout
25
+ style={style}
26
+ links={links && links.length > 0 && <FooterLinks links={links} />}
27
+ logo={logo && <FooterLogo logo={logo} />}
28
+ copyright={copyright && <FooterCopyright copyright={copyright} />}
29
+ />
188
30
  );
189
31
  }
190
32
 
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import React, {
9
- type ComponentProps,
10
9
  isValidElement,
10
+ type ComponentProps,
11
11
  type ReactElement,
12
12
  } from 'react';
13
13
  import Head from '@docusaurus/Head';
@@ -52,7 +52,7 @@ const MDXComponents: MDXComponentsObject = {
52
52
  const shouldBeInline = React.Children.toArray(props.children).every(
53
53
  (el) =>
54
54
  (typeof el === 'string' && !el.includes('\n')) ||
55
- (React.isValidElement(el) && inlineElements.includes(el.props.mdxType)),
55
+ (isValidElement(el) && inlineElements.includes(el.props.mdxType)),
56
56
  );
57
57
 
58
58
  return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
@@ -8,7 +8,6 @@
8
8
  import React, {
9
9
  useState,
10
10
  cloneElement,
11
- Children,
12
11
  isValidElement,
13
12
  type ReactElement,
14
13
  } from 'react';
@@ -40,7 +39,7 @@ function TabsComponent(props: Props): JSX.Element {
40
39
  groupId,
41
40
  className,
42
41
  } = props;
43
- const children = Children.map(props.children, (child) => {
42
+ const children = React.Children.map(props.children, (child) => {
44
43
  if (isValidElement(child) && isTabItem(child)) {
45
44
  return child;
46
45
  }
@@ -180,6 +180,42 @@ declare module '@theme/DocSidebar' {
180
180
  export default function DocSidebar(props: Props): JSX.Element;
181
181
  }
182
182
 
183
+ declare module '@theme/DocSidebar/Mobile' {
184
+ import type {Props as DocSidebarProps} from '@theme/DocSidebar';
185
+
186
+ export interface Props extends DocSidebarProps {}
187
+
188
+ export default function DocSidebarMobile(props: Props): JSX.Element;
189
+ }
190
+
191
+ declare module '@theme/DocSidebar/Desktop' {
192
+ import type {Props as DocSidebarProps} from '@theme/DocSidebar';
193
+
194
+ export interface Props extends DocSidebarProps {}
195
+
196
+ export default function DocSidebarDesktop(props: Props): JSX.Element;
197
+ }
198
+
199
+ declare module '@theme/DocSidebar/Desktop/Content' {
200
+ import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
201
+
202
+ export interface Props {
203
+ readonly className?: string;
204
+ readonly path: string;
205
+ readonly sidebar: readonly PropSidebarItem[];
206
+ }
207
+
208
+ export default function Content(props: Props): JSX.Element;
209
+ }
210
+
211
+ declare module '@theme/DocSidebar/Desktop/CollapseButton' {
212
+ export interface Props {
213
+ onClick: React.MouseEventHandler;
214
+ }
215
+
216
+ export default function CollapseButton(props: Props): JSX.Element;
217
+ }
218
+
183
219
  declare module '@theme/DocSidebarItem' {
184
220
  import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
185
221
 
@@ -244,6 +280,77 @@ declare module '@theme/Footer' {
244
280
  export default function Footer(): JSX.Element | null;
245
281
  }
246
282
 
283
+ declare module '@theme/Footer/Logo' {
284
+ import type {FooterLogo} from '@docusaurus/theme-common';
285
+
286
+ export interface Props {
287
+ logo: FooterLogo;
288
+ }
289
+
290
+ export default function FooterLogo(props: Props): JSX.Element;
291
+ }
292
+
293
+ declare module '@theme/Footer/Copyright' {
294
+ export interface Props {
295
+ copyright: string;
296
+ }
297
+
298
+ export default function FooterCopyright(props: Props): JSX.Element;
299
+ }
300
+
301
+ declare module '@theme/Footer/LinkItem' {
302
+ import type {FooterLinkItem} from '@docusaurus/theme-common';
303
+
304
+ export interface Props {
305
+ item: FooterLinkItem;
306
+ }
307
+
308
+ export default function FooterLinkItem(props: Props): JSX.Element;
309
+ }
310
+
311
+ declare module '@theme/Footer/Layout' {
312
+ import type {ReactNode} from 'react';
313
+
314
+ export interface Props {
315
+ style: 'light' | 'dark';
316
+ links: ReactNode;
317
+ logo: ReactNode;
318
+ copyright: ReactNode;
319
+ }
320
+
321
+ export default function FooterLayout(props: Props): JSX.Element;
322
+ }
323
+
324
+ declare module '@theme/Footer/Links' {
325
+ import type {Footer} from '@docusaurus/theme-common';
326
+
327
+ export interface Props {
328
+ links: Footer['links'];
329
+ }
330
+
331
+ export default function FooterLinks(props: Props): JSX.Element;
332
+ }
333
+
334
+ declare module '@theme/Footer/Links/MultiColumn' {
335
+ import type {MultiColumnFooter} from '@docusaurus/theme-common';
336
+
337
+ export interface Props {
338
+ columns: MultiColumnFooter['links'];
339
+ }
340
+
341
+ export default function FooterLinksMultiColumn(props: Props): JSX.Element;
342
+ }
343
+
344
+ declare module '@theme/Footer/Links/Simple' {
345
+ import type {SimpleFooter} from '@docusaurus/theme-common';
346
+
347
+ export interface Props {
348
+ links: SimpleFooter['links'];
349
+ }
350
+
351
+ export default function FooterLinksSimple(props: Props): JSX.Element;
352
+ }
353
+
247
354
  declare module '@theme/Heading' {
248
355
  import type {ComponentProps} from 'react';
249
356
 
@@ -1,107 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- :root {
9
- --collapse-button-bg-color-dark: #2e333a;
10
- }
11
-
12
- @media (min-width: 997px) {
13
- .sidebar {
14
- display: flex;
15
- flex-direction: column;
16
- max-height: 100vh;
17
- height: 100%;
18
- position: sticky;
19
- top: 0;
20
- padding-top: var(--ifm-navbar-height);
21
- width: var(--doc-sidebar-width);
22
- transition: opacity 50ms ease;
23
- }
24
-
25
- .sidebarWithHideableNavbar {
26
- padding-top: 0;
27
- }
28
-
29
- .sidebarHidden {
30
- opacity: 0;
31
- height: 0;
32
- overflow: hidden;
33
- visibility: hidden;
34
- }
35
-
36
- .sidebarLogo {
37
- display: flex !important;
38
- align-items: center;
39
- margin: 0 var(--ifm-navbar-padding-horizontal);
40
- min-height: var(--ifm-navbar-height);
41
- max-height: var(--ifm-navbar-height);
42
- color: inherit !important;
43
- text-decoration: none !important;
44
- }
45
-
46
- .sidebarLogo img {
47
- margin-right: 0.5rem;
48
- height: 2rem;
49
- }
50
-
51
- .menu {
52
- flex-grow: 1;
53
- padding: 0.5rem;
54
- }
55
-
56
- .menuWithAnnouncementBar {
57
- margin-bottom: var(--docusaurus-announcement-bar-height);
58
- }
59
-
60
- .collapseSidebarButton {
61
- display: block !important;
62
- background-color: var(--ifm-button-background-color);
63
- height: 40px;
64
- position: sticky;
65
- bottom: 0;
66
- border-radius: 0;
67
- border: 1px solid var(--ifm-toc-border-color);
68
- }
69
-
70
- .collapseSidebarButtonIcon {
71
- transform: rotate(180deg);
72
- margin-top: 4px;
73
- }
74
-
75
- [dir='rtl'] .collapseSidebarButtonIcon {
76
- transform: rotate(0);
77
- }
78
-
79
- [data-theme='dark'] .collapseSidebarButton {
80
- background-color: var(--collapse-button-bg-color-dark);
81
- }
82
-
83
- [data-theme='dark'] .collapseSidebarButton:hover,
84
- [data-theme='dark'] .collapseSidebarButton:focus {
85
- background-color: var(--ifm-color-emphasis-200);
86
- }
87
- }
88
-
89
- .sidebarLogo,
90
- .collapseSidebarButton {
91
- display: none;
92
- }
93
-
94
- .sidebarMenuIcon {
95
- vertical-align: middle;
96
- }
97
-
98
- .sidebarMenuCloseIcon {
99
- display: inline-flex;
100
- justify-content: center;
101
- align-items: center;
102
- height: 24px;
103
- font-size: 1.5rem;
104
- font-weight: var(--ifm-font-weight-bold);
105
- line-height: 0.9;
106
- width: 24px;
107
- }
@@ -1,107 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- :root {
9
- --collapse-button-bg-color-dark: #2e333a;
10
- }
11
-
12
- @media (min-width: 997px) {
13
- .sidebar {
14
- display: flex;
15
- flex-direction: column;
16
- max-height: 100vh;
17
- height: 100%;
18
- position: sticky;
19
- top: 0;
20
- padding-top: var(--ifm-navbar-height);
21
- width: var(--doc-sidebar-width);
22
- transition: opacity 50ms ease;
23
- }
24
-
25
- .sidebarWithHideableNavbar {
26
- padding-top: 0;
27
- }
28
-
29
- .sidebarHidden {
30
- opacity: 0;
31
- height: 0;
32
- overflow: hidden;
33
- visibility: hidden;
34
- }
35
-
36
- .sidebarLogo {
37
- display: flex !important;
38
- align-items: center;
39
- margin: 0 var(--ifm-navbar-padding-horizontal);
40
- min-height: var(--ifm-navbar-height);
41
- max-height: var(--ifm-navbar-height);
42
- color: inherit !important;
43
- text-decoration: none !important;
44
- }
45
-
46
- .sidebarLogo img {
47
- margin-right: 0.5rem;
48
- height: 2rem;
49
- }
50
-
51
- .menu {
52
- flex-grow: 1;
53
- padding: 0.5rem;
54
- }
55
-
56
- .menuWithAnnouncementBar {
57
- margin-bottom: var(--docusaurus-announcement-bar-height);
58
- }
59
-
60
- .collapseSidebarButton {
61
- display: block !important;
62
- background-color: var(--ifm-button-background-color);
63
- height: 40px;
64
- position: sticky;
65
- bottom: 0;
66
- border-radius: 0;
67
- border: 1px solid var(--ifm-toc-border-color);
68
- }
69
-
70
- .collapseSidebarButtonIcon {
71
- transform: rotate(180deg);
72
- margin-top: 4px;
73
- }
74
-
75
- [dir='rtl'] .collapseSidebarButtonIcon {
76
- transform: rotate(0);
77
- }
78
-
79
- [data-theme='dark'] .collapseSidebarButton {
80
- background-color: var(--collapse-button-bg-color-dark);
81
- }
82
-
83
- [data-theme='dark'] .collapseSidebarButton:hover,
84
- [data-theme='dark'] .collapseSidebarButton:focus {
85
- background-color: var(--ifm-color-emphasis-200);
86
- }
87
- }
88
-
89
- .sidebarLogo,
90
- .collapseSidebarButton {
91
- display: none;
92
- }
93
-
94
- .sidebarMenuIcon {
95
- vertical-align: middle;
96
- }
97
-
98
- .sidebarMenuCloseIcon {
99
- display: inline-flex;
100
- justify-content: center;
101
- align-items: center;
102
- height: 24px;
103
- font-size: 1.5rem;
104
- font-weight: var(--ifm-font-weight-bold);
105
- line-height: 0.9;
106
- width: 24px;
107
- }