@docusaurus/theme-classic 2.4.1 → 3.0.0-alpha.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.
Files changed (155) hide show
  1. package/lib/getSwizzleConfig.js +99 -7
  2. package/lib/index.js +20 -6
  3. package/lib/nprogress.d.ts +1 -1
  4. package/lib/options.js +1 -0
  5. package/lib/theme/Admonition/Icon/Caution.d.ts +9 -0
  6. package/lib/theme/Admonition/Icon/Caution.js +17 -0
  7. package/lib/theme/Admonition/Icon/Danger.d.ts +9 -0
  8. package/lib/theme/Admonition/Icon/Danger.js +17 -0
  9. package/lib/theme/Admonition/Icon/Info.d.ts +9 -0
  10. package/lib/theme/Admonition/Icon/Info.js +17 -0
  11. package/lib/theme/Admonition/Icon/Note.d.ts +9 -0
  12. package/lib/theme/Admonition/Icon/Note.js +17 -0
  13. package/lib/theme/Admonition/Icon/Tip.d.ts +9 -0
  14. package/lib/theme/Admonition/Icon/Tip.js +17 -0
  15. package/lib/theme/Admonition/Layout/index.d.ts +9 -0
  16. package/lib/theme/Admonition/Layout/index.js +45 -0
  17. package/lib/theme/Admonition/{styles.module.css → Layout/styles.module.css} +4 -0
  18. package/lib/theme/Admonition/Type/Caution.d.ts +9 -0
  19. package/lib/theme/Admonition/Type/Caution.js +32 -0
  20. package/lib/theme/Admonition/Type/Danger.d.ts +9 -0
  21. package/lib/theme/Admonition/Type/Danger.js +32 -0
  22. package/lib/theme/Admonition/Type/Info.d.ts +9 -0
  23. package/lib/theme/Admonition/Type/Info.js +32 -0
  24. package/lib/theme/Admonition/Type/Note.d.ts +9 -0
  25. package/lib/theme/Admonition/Type/Note.js +32 -0
  26. package/lib/theme/Admonition/Type/Tip.d.ts +9 -0
  27. package/lib/theme/Admonition/Type/Tip.js +32 -0
  28. package/lib/theme/Admonition/Types.d.ts +12 -0
  29. package/lib/theme/Admonition/Types.js +33 -0
  30. package/lib/theme/Admonition/index.d.ts +1 -1
  31. package/lib/theme/Admonition/index.js +12 -171
  32. package/lib/theme/BlogArchivePage/index.js +7 -2
  33. package/lib/theme/BlogPostPage/index.js +3 -1
  34. package/lib/theme/BlogSidebar/Desktop/index.js +3 -1
  35. package/lib/theme/BlogSidebar/Mobile/index.js +3 -1
  36. package/lib/theme/BlogTagsListPage/index.js +2 -1
  37. package/lib/theme/BlogTagsPostsPage/index.js +4 -2
  38. package/lib/theme/DocBreadcrumbs/index.js +6 -2
  39. package/lib/theme/DocCard/index.js +8 -4
  40. package/lib/theme/DocItem/Layout/index.js +5 -0
  41. package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.d.ts +2 -2
  42. package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.js +1 -1
  43. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.d.ts +2 -2
  44. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.js +1 -1
  45. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.d.ts +2 -2
  46. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.js +2 -2
  47. package/lib/theme/{DocPage → DocRoot}/Layout/index.d.ts +2 -2
  48. package/lib/theme/{DocPage → DocRoot}/Layout/index.js +9 -10
  49. package/lib/theme/{DocPage → DocRoot}/Layout/styles.module.css +1 -2
  50. package/lib/theme/{DocPage → DocRoot}/index.d.ts +2 -2
  51. package/lib/theme/DocRoot/index.js +31 -0
  52. package/lib/theme/DocSidebarItem/Category/index.js +3 -3
  53. package/lib/theme/DocSidebarItems/index.js +6 -4
  54. package/lib/theme/DocTagDocListPage/index.d.ts +1 -1
  55. package/lib/theme/DocTagDocListPage/index.js +53 -39
  56. package/lib/theme/DocTagsListPage/index.d.ts +1 -1
  57. package/lib/theme/DocTagsListPage/index.js +26 -17
  58. package/lib/theme/DocVersionRoot/index.d.ts +10 -0
  59. package/lib/theme/DocVersionRoot/index.js +46 -0
  60. package/lib/theme/DocsRoot/index.d.ts +10 -0
  61. package/lib/theme/DocsRoot/index.js +18 -0
  62. package/lib/theme/EditThisPage/index.js +3 -6
  63. package/lib/theme/ErrorPageContent.js +3 -2
  64. package/lib/theme/MDXComponents/Code.js +2 -36
  65. package/lib/theme/MDXComponents/Details.js +1 -1
  66. package/lib/theme/MDXComponents/Pre.d.ts +2 -2
  67. package/lib/theme/MDXComponents/Pre.js +4 -11
  68. package/lib/theme/MDXComponents/index.js +3 -3
  69. package/lib/theme/MDXContent/index.js +1 -0
  70. package/lib/theme/MDXPage/index.js +16 -4
  71. package/lib/theme/NavbarItem/DocNavbarItem.js +4 -3
  72. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.d.ts +1 -1
  73. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +2 -1
  74. package/lib/theme/NotFound/Content/index.d.ts +9 -0
  75. package/lib/theme/NotFound/Content/index.js +42 -0
  76. package/lib/theme/{NotFound.d.ts → NotFound/index.d.ts} +1 -1
  77. package/lib/theme/NotFound/index.js +25 -0
  78. package/lib/theme/TOCItems/Tree.js +3 -4
  79. package/lib/theme/Tabs/index.js +4 -2
  80. package/lib/theme/TagsListByLetter/index.js +4 -1
  81. package/lib/theme/ThemedImage/index.js +8 -24
  82. package/lib/theme/{MDXComponents/Head.d.ts → Unlisted/index.d.ts} +2 -2
  83. package/lib/theme/Unlisted/index.js +38 -0
  84. package/package.json +24 -24
  85. package/src/getSwizzleConfig.ts +107 -8
  86. package/src/index.ts +21 -6
  87. package/src/nprogress.ts +2 -1
  88. package/src/options.ts +1 -0
  89. package/src/theme/Admonition/Icon/Caution.tsx +20 -0
  90. package/src/theme/Admonition/Icon/Danger.tsx +20 -0
  91. package/src/theme/Admonition/Icon/Info.tsx +20 -0
  92. package/src/theme/Admonition/Icon/Note.tsx +20 -0
  93. package/src/theme/Admonition/Icon/Tip.tsx +20 -0
  94. package/src/theme/Admonition/Layout/index.tsx +57 -0
  95. package/src/theme/Admonition/{styles.module.css → Layout/styles.module.css} +4 -0
  96. package/src/theme/Admonition/Type/Caution.tsx +37 -0
  97. package/src/theme/Admonition/Type/Danger.tsx +37 -0
  98. package/src/theme/Admonition/Type/Info.tsx +37 -0
  99. package/src/theme/Admonition/Type/Note.tsx +37 -0
  100. package/src/theme/Admonition/Type/Tip.tsx +37 -0
  101. package/src/theme/Admonition/Types.tsx +38 -0
  102. package/src/theme/Admonition/index.tsx +13 -194
  103. package/src/theme/BlogArchivePage/index.tsx +7 -2
  104. package/src/theme/BlogPostPage/index.tsx +3 -1
  105. package/src/theme/BlogSidebar/Desktop/index.tsx +3 -1
  106. package/src/theme/BlogSidebar/Mobile/index.tsx +3 -1
  107. package/src/theme/BlogTagsListPage/index.tsx +2 -1
  108. package/src/theme/BlogTagsPostsPage/index.tsx +4 -2
  109. package/src/theme/DocBreadcrumbs/index.tsx +6 -2
  110. package/src/theme/DocCard/index.tsx +11 -6
  111. package/src/theme/DocItem/Layout/index.tsx +5 -0
  112. package/src/theme/{DocPage → DocRoot}/Layout/Main/index.tsx +2 -2
  113. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.tsx +2 -2
  114. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/index.tsx +3 -3
  115. package/src/theme/{DocPage → DocRoot}/Layout/index.tsx +10 -11
  116. package/src/theme/{DocPage → DocRoot}/Layout/styles.module.css +1 -2
  117. package/src/theme/DocRoot/index.tsx +34 -0
  118. package/src/theme/DocSidebarItem/Category/index.tsx +3 -3
  119. package/src/theme/DocSidebarItems/index.tsx +6 -4
  120. package/src/theme/DocTagDocListPage/index.tsx +60 -39
  121. package/src/theme/DocTagsListPage/index.tsx +33 -17
  122. package/src/theme/DocVersionRoot/index.tsx +51 -0
  123. package/src/theme/DocsRoot/index.tsx +22 -0
  124. package/src/theme/EditThisPage/index.tsx +3 -6
  125. package/src/theme/ErrorPageContent.tsx +3 -2
  126. package/src/theme/MDXComponents/Code.tsx +2 -39
  127. package/src/theme/MDXComponents/Details.tsx +1 -2
  128. package/src/theme/MDXComponents/Pre.tsx +5 -13
  129. package/src/theme/MDXComponents/index.tsx +3 -3
  130. package/src/theme/MDXContent/index.tsx +1 -0
  131. package/src/theme/MDXPage/index.tsx +16 -4
  132. package/src/theme/NavbarItem/DocNavbarItem.tsx +4 -3
  133. package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +2 -1
  134. package/src/theme/NotFound/Content/index.tsx +45 -0
  135. package/src/theme/NotFound/index.tsx +27 -0
  136. package/src/theme/SkipToContent/index.tsx +0 -1
  137. package/src/theme/TOCItems/Tree.tsx +3 -4
  138. package/src/theme/Tabs/index.tsx +4 -2
  139. package/src/theme/TagsListByLetter/index.tsx +4 -2
  140. package/src/theme/ThemedImage/index.tsx +8 -31
  141. package/src/theme/Unlisted/index.tsx +42 -0
  142. package/src/theme/prism-include-languages.ts +2 -1
  143. package/src/theme-classic.d.ts +130 -20
  144. package/lib/theme/DocPage/index.js +0 -67
  145. package/lib/theme/MDXComponents/Head.js +0 -23
  146. package/lib/theme/NotFound.js +0 -52
  147. package/src/theme/DocPage/index.tsx +0 -71
  148. package/src/theme/MDXComponents/Head.tsx +0 -29
  149. package/src/theme/NotFound.tsx +0 -54
  150. /package/lib/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
  151. /package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
  152. /package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
  153. /package/src/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
  154. /package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
  155. /package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
@@ -1,71 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import React from 'react';
9
- import clsx from 'clsx';
10
- import {
11
- HtmlClassNameProvider,
12
- ThemeClassNames,
13
- PageMetadata,
14
- } from '@docusaurus/theme-common';
15
- import {
16
- docVersionSearchTag,
17
- DocsSidebarProvider,
18
- DocsVersionProvider,
19
- useDocRouteMetadata,
20
- } from '@docusaurus/theme-common/internal';
21
- import DocPageLayout from '@theme/DocPage/Layout';
22
- import NotFound from '@theme/NotFound';
23
- import SearchMetadata from '@theme/SearchMetadata';
24
- import type {Props} from '@theme/DocPage';
25
-
26
- function DocPageMetadata(props: Props): JSX.Element {
27
- const {versionMetadata} = props;
28
- return (
29
- <>
30
- <SearchMetadata
31
- version={versionMetadata.version}
32
- tag={docVersionSearchTag(
33
- versionMetadata.pluginId,
34
- versionMetadata.version,
35
- )}
36
- />
37
- <PageMetadata>
38
- {versionMetadata.noIndex && (
39
- <meta name="robots" content="noindex, nofollow" />
40
- )}
41
- </PageMetadata>
42
- </>
43
- );
44
- }
45
-
46
- export default function DocPage(props: Props): JSX.Element {
47
- const {versionMetadata} = props;
48
- const currentDocRouteMetadata = useDocRouteMetadata(props);
49
- if (!currentDocRouteMetadata) {
50
- return <NotFound />;
51
- }
52
- const {docElement, sidebarName, sidebarItems} = currentDocRouteMetadata;
53
- return (
54
- <>
55
- <DocPageMetadata {...props} />
56
- <HtmlClassNameProvider
57
- className={clsx(
58
- // TODO: it should be removed from here
59
- ThemeClassNames.wrapper.docsPages,
60
- ThemeClassNames.page.docsDocPage,
61
- props.versionMetadata.className,
62
- )}>
63
- <DocsVersionProvider version={versionMetadata}>
64
- <DocsSidebarProvider name={sidebarName} items={sidebarItems}>
65
- <DocPageLayout>{docElement}</DocPageLayout>
66
- </DocsSidebarProvider>
67
- </DocsVersionProvider>
68
- </HtmlClassNameProvider>
69
- </>
70
- );
71
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import React, {type ReactElement} from 'react';
9
- import Head, {type Props as HeadProps} from '@docusaurus/Head';
10
- import type {Props} from '@theme/MDXComponents/Head';
11
-
12
- // MDX elements are wrapped through the MDX pragma. In some cases (notably usage
13
- // with Head/Helmet) we need to unwrap those elements.
14
- function unwrapMDXElement(
15
- element: ReactElement<{mdxType?: string; originalType?: string} | undefined>,
16
- ) {
17
- if (element.props?.mdxType && element.props.originalType) {
18
- const {mdxType, originalType, ...newProps} = element.props;
19
- return React.createElement(element.props.originalType, newProps);
20
- }
21
- return element;
22
- }
23
-
24
- export default function MDXHead(props: Props): JSX.Element {
25
- const unwrappedChildren = React.Children.map(props.children, (child) =>
26
- React.isValidElement(child) ? unwrapMDXElement(child) : child,
27
- );
28
- return <Head {...(props as HeadProps)}>{unwrappedChildren}</Head>;
29
- }
@@ -1,54 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import React from 'react';
9
- import Translate, {translate} from '@docusaurus/Translate';
10
- import {PageMetadata} from '@docusaurus/theme-common';
11
- import Layout from '@theme/Layout';
12
-
13
- export default function NotFound(): JSX.Element {
14
- return (
15
- <>
16
- <PageMetadata
17
- title={translate({
18
- id: 'theme.NotFound.title',
19
- message: 'Page Not Found',
20
- })}
21
- />
22
- <Layout>
23
- <main className="container margin-vert--xl">
24
- <div className="row">
25
- <div className="col col--6 col--offset-3">
26
- <h1 className="hero__title">
27
- <Translate
28
- id="theme.NotFound.title"
29
- description="The title of the 404 page">
30
- Page Not Found
31
- </Translate>
32
- </h1>
33
- <p>
34
- <Translate
35
- id="theme.NotFound.p1"
36
- description="The first paragraph of the 404 page">
37
- We could not find what you were looking for.
38
- </Translate>
39
- </p>
40
- <p>
41
- <Translate
42
- id="theme.NotFound.p2"
43
- description="The 2nd paragraph of the 404 page">
44
- Please contact the owner of the site that linked you to the
45
- original URL and let them know their link is broken.
46
- </Translate>
47
- </p>
48
- </div>
49
- </div>
50
- </main>
51
- </Layout>
52
- </>
53
- );
54
- }