@docusaurus/theme-classic 2.0.0-beta.18 → 2.0.0-beta.19

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 (204) hide show
  1. package/lib/admonitions.css +4 -0
  2. package/lib/default.css +3038 -0
  3. package/lib/getSwizzleConfig.js +9 -2
  4. package/lib/index.js +4 -4
  5. package/lib/nprogress.css +41 -0
  6. package/lib/nprogress.js +46 -0
  7. package/lib/theme-classic.d.ts +315 -33
  8. package/lib/validateThemeConfig.js +72 -14
  9. package/lib-next/theme/BackToTopButton/index.js +6 -102
  10. package/lib-next/theme/BlogLayout/index.js +1 -5
  11. package/lib-next/theme/BlogListPaginator/index.js +25 -28
  12. package/lib-next/theme/BlogPostAuthor/index.js +3 -6
  13. package/lib-next/theme/BlogPostItem/styles.module.css +9 -0
  14. package/lib-next/theme/BlogPostPaginator/index.js +25 -28
  15. package/lib-next/theme/BlogSidebar/Desktop/index.js +41 -0
  16. package/lib-next/theme/BlogSidebar/{styles.module.css → Desktop/styles.module.css} +1 -2
  17. package/lib-next/theme/BlogSidebar/Mobile/index.js +36 -0
  18. package/lib-next/theme/BlogSidebar/index.js +11 -31
  19. package/lib-next/theme/BlogTagsListPage/index.js +2 -3
  20. package/lib-next/theme/BlogTagsPostsPage/index.js +4 -6
  21. package/lib-next/theme/CodeBlock/Container/index.js +29 -0
  22. package/lib-next/theme/CodeBlock/Container/styles.module.css +14 -0
  23. package/lib-next/theme/CodeBlock/Content/Element.js +23 -0
  24. package/lib-next/theme/CodeBlock/Content/String.js +104 -0
  25. package/{src/theme/CodeBlock → lib-next/theme/CodeBlock/Content}/styles.module.css +39 -9
  26. package/lib-next/theme/CodeBlock/CopyButton/index.js +3 -2
  27. package/lib-next/theme/CodeBlock/CopyButton/styles.module.css +0 -19
  28. package/lib-next/theme/CodeBlock/Line/index.js +49 -0
  29. package/lib-next/theme/CodeBlock/Line/styles.module.css +51 -0
  30. package/lib-next/theme/CodeBlock/WordWrapButton/index.js +40 -0
  31. package/lib-next/theme/CodeBlock/WordWrapButton/styles.module.css +15 -0
  32. package/lib-next/theme/CodeBlock/index.js +27 -133
  33. package/lib-next/theme/Details/index.js +1 -1
  34. package/lib-next/theme/DocBreadcrumbs/index.js +50 -23
  35. package/lib-next/theme/DocBreadcrumbs/styles.module.css +8 -0
  36. package/lib-next/theme/DocCardList/index.js +6 -4
  37. package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +3 -3
  38. package/lib-next/theme/DocCategoryGeneratedIndexPage/styles.module.css +8 -0
  39. package/lib-next/theme/DocItem/index.js +1 -1
  40. package/lib-next/theme/DocItem/styles.module.css +6 -0
  41. package/lib-next/theme/DocPage/Layout/Main/index.js +29 -0
  42. package/lib-next/theme/DocPage/Layout/Main/styles.module.css +28 -0
  43. package/lib-next/theme/DocPage/Layout/Sidebar/ExpandButton/index.js +34 -0
  44. package/lib-next/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +33 -0
  45. package/lib-next/theme/DocPage/Layout/Sidebar/index.js +68 -0
  46. package/lib-next/theme/DocPage/Layout/Sidebar/index.module.css +32 -0
  47. package/lib-next/theme/DocPage/Layout/index.js +34 -0
  48. package/lib-next/theme/{BlogPostAuthor/styles.module.css → DocPage/Layout/index.module.css} +6 -3
  49. package/lib-next/theme/DocPage/index.js +28 -146
  50. package/lib-next/theme/DocPaginator/index.js +25 -28
  51. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +11 -9
  52. package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +6 -0
  53. package/lib-next/theme/DocSidebar/Desktop/index.js +4 -2
  54. package/lib-next/theme/DocSidebarItem/Category.js +197 -0
  55. package/lib-next/theme/DocSidebarItem/Html.js +27 -0
  56. package/{src/theme/DocSidebarItem/styles.module.css → lib-next/theme/DocSidebarItem/Html.module.css} +0 -4
  57. package/lib-next/theme/DocSidebarItem/Link.js +53 -0
  58. package/{src/theme/MDXComponents/Ul.module.css → lib-next/theme/DocSidebarItem/Link.module.css} +2 -3
  59. package/lib-next/theme/DocSidebarItem/index.js +4 -246
  60. package/lib-next/theme/DocSidebarItems/index.js +1 -6
  61. package/lib-next/theme/DocTagDocListPage/index.js +3 -3
  62. package/lib-next/theme/DocVersionBanner/index.js +2 -2
  63. package/lib-next/theme/Footer/Links/MultiColumn/index.js +1 -1
  64. package/lib-next/theme/Heading/index.js +4 -20
  65. package/lib-next/theme/IconHome/index.js +17 -0
  66. package/lib-next/theme/LastUpdated/index.js +1 -0
  67. package/lib-next/theme/Layout/index.js +1 -1
  68. package/lib-next/theme/MDXComponents/Ul.js +2 -4
  69. package/lib-next/theme/Navbar/Content/index.js +6 -1
  70. package/lib-next/theme/Navbar/Logo/index.js +1 -1
  71. package/lib-next/theme/Navbar/Search/index.js +11 -0
  72. package/lib-next/theme/Navbar/Search/styles.module.css +20 -0
  73. package/lib-next/theme/NavbarItem/ComponentTypes.js +27 -0
  74. package/lib-next/theme/NavbarItem/DocNavbarItem.js +11 -28
  75. package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +10 -42
  76. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +25 -29
  77. package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +2 -9
  78. package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +4 -1
  79. package/lib-next/theme/NavbarItem/HtmlNavbarItem.js +30 -0
  80. package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +5 -10
  81. package/lib-next/theme/NavbarItem/NavbarNavLink.js +49 -31
  82. package/lib-next/theme/NavbarItem/SearchNavbarItem.js +6 -1
  83. package/lib-next/theme/NavbarItem/index.js +4 -23
  84. package/lib-next/theme/NavbarItem/utils.js +2 -1
  85. package/lib-next/theme/PaginatorNavLink/index.js +8 -2
  86. package/lib-next/theme/SiteMetadata/index.js +8 -7
  87. package/lib-next/theme/SkipToContent/index.js +3 -29
  88. package/lib-next/theme/TOCCollapsible/CollapseButton.js +29 -0
  89. package/{src/theme/TOCCollapsible/styles.module.css → lib-next/theme/TOCCollapsible/CollapseButton.module.css} +1 -22
  90. package/lib-next/theme/TOCCollapsible/index.js +3 -13
  91. package/lib-next/theme/TOCCollapsible/index.module.css +31 -0
  92. package/lib-next/theme/TOCItems/Tree.js +40 -0
  93. package/lib-next/theme/TOCItems/index.js +3 -34
  94. package/lib-next/theme/TabItem/index.js +3 -1
  95. package/lib-next/theme/{MDXComponents/Ul.module.css → TabItem/styles.module.css} +2 -3
  96. package/lib-next/theme/Tabs/__tests__/index.test.js +3 -3
  97. package/lib-next/theme/Tabs/index.js +3 -3
  98. package/lib-next/theme/Tabs/styles.module.css +4 -0
  99. package/lib-next/theme/Tag/index.js +2 -3
  100. package/lib-next/theme/TagsListInline/index.js +1 -1
  101. package/package.json +23 -18
  102. package/src/admonitions.css +4 -0
  103. package/src/getSwizzleConfig.ts +10 -2
  104. package/src/index.ts +4 -3
  105. package/src/nprogress.css +41 -0
  106. package/src/nprogress.ts +31 -0
  107. package/src/theme/BackToTopButton/index.tsx +5 -112
  108. package/src/theme/BlogLayout/index.tsx +1 -5
  109. package/src/theme/BlogListPaginator/index.tsx +25 -28
  110. package/src/theme/BlogPostAuthor/index.tsx +3 -7
  111. package/src/theme/BlogPostItem/styles.module.css +9 -0
  112. package/src/theme/BlogPostPaginator/index.tsx +25 -28
  113. package/src/theme/BlogSidebar/Desktop/index.tsx +45 -0
  114. package/src/theme/BlogSidebar/{styles.module.css → Desktop/styles.module.css} +1 -2
  115. package/src/theme/BlogSidebar/Mobile/index.tsx +38 -0
  116. package/src/theme/BlogSidebar/index.tsx +10 -31
  117. package/src/theme/BlogTagsListPage/index.tsx +2 -3
  118. package/src/theme/BlogTagsPostsPage/index.tsx +8 -5
  119. package/src/theme/CodeBlock/Container/index.tsx +35 -0
  120. package/src/theme/CodeBlock/Container/styles.module.css +14 -0
  121. package/src/theme/CodeBlock/Content/Element.tsx +30 -0
  122. package/src/theme/CodeBlock/Content/String.tsx +111 -0
  123. package/{lib-next/theme/CodeBlock → src/theme/CodeBlock/Content}/styles.module.css +39 -9
  124. package/src/theme/CodeBlock/CopyButton/index.tsx +3 -2
  125. package/src/theme/CodeBlock/CopyButton/styles.module.css +0 -19
  126. package/src/theme/CodeBlock/Line/index.tsx +48 -0
  127. package/src/theme/CodeBlock/Line/styles.module.css +51 -0
  128. package/src/theme/CodeBlock/WordWrapButton/index.tsx +49 -0
  129. package/src/theme/CodeBlock/WordWrapButton/styles.module.css +15 -0
  130. package/src/theme/CodeBlock/index.tsx +29 -133
  131. package/src/theme/Details/index.tsx +1 -1
  132. package/src/theme/DocBreadcrumbs/index.tsx +50 -20
  133. package/src/theme/DocBreadcrumbs/styles.module.css +8 -0
  134. package/src/theme/DocCardList/index.tsx +5 -7
  135. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +3 -3
  136. package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +8 -0
  137. package/src/theme/DocItem/index.tsx +1 -1
  138. package/src/theme/DocItem/styles.module.css +6 -0
  139. package/src/theme/DocPage/Layout/Main/index.tsx +37 -0
  140. package/src/theme/DocPage/Layout/Main/styles.module.css +28 -0
  141. package/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx +40 -0
  142. package/src/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +33 -0
  143. package/src/theme/DocPage/Layout/Sidebar/index.module.css +32 -0
  144. package/src/theme/DocPage/Layout/Sidebar/index.tsx +74 -0
  145. package/src/theme/{BlogPostAuthor/styles.module.css → DocPage/Layout/index.module.css} +6 -3
  146. package/src/theme/DocPage/Layout/index.tsx +39 -0
  147. package/src/theme/DocPage/index.tsx +28 -157
  148. package/src/theme/DocPaginator/index.tsx +25 -28
  149. package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +11 -9
  150. package/src/theme/DocSidebar/Desktop/Content/styles.module.css +6 -0
  151. package/src/theme/DocSidebar/Desktop/index.tsx +4 -2
  152. package/src/theme/DocSidebarItem/Category.tsx +210 -0
  153. package/{lib-next/theme/DocSidebarItem/styles.module.css → src/theme/DocSidebarItem/Html.module.css} +0 -4
  154. package/src/theme/DocSidebarItem/Html.tsx +34 -0
  155. package/src/theme/DocSidebarItem/Link.module.css +10 -0
  156. package/src/theme/DocSidebarItem/Link.tsx +58 -0
  157. package/src/theme/DocSidebarItem/index.tsx +4 -259
  158. package/src/theme/DocSidebarItems/index.tsx +1 -6
  159. package/src/theme/DocTagDocListPage/index.tsx +3 -4
  160. package/src/theme/DocVersionBanner/index.tsx +2 -2
  161. package/src/theme/Footer/Links/MultiColumn/index.tsx +1 -1
  162. package/src/theme/Heading/index.tsx +4 -18
  163. package/src/theme/IconHome/index.tsx +20 -0
  164. package/src/theme/LastUpdated/index.tsx +1 -0
  165. package/src/theme/Layout/index.tsx +1 -1
  166. package/src/theme/MDXComponents/Details.tsx +2 -3
  167. package/src/theme/MDXComponents/Ul.tsx +2 -6
  168. package/src/theme/Navbar/Content/index.tsx +6 -1
  169. package/src/theme/Navbar/Logo/index.tsx +1 -1
  170. package/src/theme/Navbar/Search/index.tsx +15 -0
  171. package/src/theme/Navbar/Search/styles.module.css +20 -0
  172. package/src/theme/NavbarItem/ComponentTypes.tsx +32 -0
  173. package/src/theme/NavbarItem/DocNavbarItem.tsx +13 -32
  174. package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +9 -49
  175. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +26 -33
  176. package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +3 -10
  177. package/src/theme/NavbarItem/DropdownNavbarItem.tsx +4 -1
  178. package/src/theme/NavbarItem/HtmlNavbarItem.tsx +32 -0
  179. package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +5 -9
  180. package/src/theme/NavbarItem/NavbarNavLink.tsx +41 -25
  181. package/src/theme/NavbarItem/SearchNavbarItem.tsx +6 -1
  182. package/src/theme/NavbarItem/index.tsx +9 -38
  183. package/src/theme/NavbarItem/utils.ts +5 -2
  184. package/src/theme/PaginatorNavLink/index.tsx +8 -2
  185. package/src/theme/SiteMetadata/index.tsx +8 -8
  186. package/src/theme/SkipToContent/index.tsx +3 -29
  187. package/{lib-next/theme/TOCCollapsible/styles.module.css → src/theme/TOCCollapsible/CollapseButton.module.css} +1 -22
  188. package/src/theme/TOCCollapsible/CollapseButton.tsx +35 -0
  189. package/src/theme/TOCCollapsible/index.module.css +31 -0
  190. package/src/theme/TOCCollapsible/index.tsx +3 -14
  191. package/src/theme/TOCItems/Tree.tsx +46 -0
  192. package/src/theme/TOCItems/index.tsx +2 -41
  193. package/src/theme/TabItem/index.tsx +7 -1
  194. package/src/theme/TabItem/styles.module.css +10 -0
  195. package/src/theme/Tabs/index.tsx +3 -3
  196. package/src/theme/Tabs/styles.module.css +4 -0
  197. package/src/theme/Tag/index.tsx +2 -4
  198. package/src/theme/TagsListInline/index.tsx +1 -1
  199. package/src/theme-classic.d.ts +315 -33
  200. package/src/validateThemeConfig.ts +80 -13
  201. package/lib/types.d.ts +0 -11
  202. package/lib-next/theme/DocPage/styles.module.css +0 -82
  203. package/src/theme/DocPage/styles.module.css +0 -82
  204. package/src/types.d.ts +0 -11
@@ -5,13 +5,15 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import clsx from 'clsx';
9
+ import styles from './styles.module.css';
8
10
  export default function TabItem({children, hidden, className}) {
9
11
  return (
10
12
  <div
11
13
  role="tabpanel"
14
+ className={clsx(styles.tabItem, className)}
12
15
  {...{
13
16
  hidden,
14
- className,
15
17
  }}>
16
18
  {children}
17
19
  </div>
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- .contains-task-list {
9
- padding-left: 0;
10
- list-style: none;
8
+ .tabItem > *:last-child {
9
+ margin-bottom: 0;
11
10
  }
@@ -22,7 +22,7 @@ describe('Tabs', () => {
22
22
  </Tabs>,
23
23
  );
24
24
  }).toThrowErrorMatchingInlineSnapshot(
25
- `"Docusaurus error: Bad <Tabs> child <div>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique \\"value\\" prop."`,
25
+ `"Docusaurus error: Bad <Tabs> child <div>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop."`,
26
26
  );
27
27
  });
28
28
  it('rejects bad Tabs defaultValue', () => {
@@ -34,7 +34,7 @@ describe('Tabs', () => {
34
34
  </Tabs>,
35
35
  );
36
36
  }).toThrowErrorMatchingInlineSnapshot(
37
- `"Docusaurus error: The <Tabs> has a defaultValue \\"bad\\" but none of its children has the corresponding value. Available values are: v1, v2. If you intend to show no default tab, use defaultValue={null} instead."`,
37
+ `"Docusaurus error: The <Tabs> has a defaultValue "bad" but none of its children has the corresponding value. Available values are: v1, v2. If you intend to show no default tab, use defaultValue={null} instead."`,
38
38
  );
39
39
  });
40
40
  it('rejects duplicate values', () => {
@@ -50,7 +50,7 @@ describe('Tabs', () => {
50
50
  </Tabs>,
51
51
  );
52
52
  }).toThrowErrorMatchingInlineSnapshot(
53
- `"Docusaurus error: Duplicate values \\"v1, v2\\" found in <Tabs>. Every value needs to be unique."`,
53
+ `"Docusaurus error: Duplicate values "v1, v2" found in <Tabs>. Every value needs to be unique."`,
54
54
  );
55
55
  });
56
56
  it('accepts valid Tabs config', () => {
@@ -132,7 +132,7 @@ function TabsComponent(props) {
132
132
  };
133
133
 
134
134
  return (
135
- <div className="tabs-container">
135
+ <div className={clsx('tabs-container', styles.tabList)}>
136
136
  <ul
137
137
  role="tablist"
138
138
  aria-orientation="horizontal"
@@ -173,11 +173,11 @@ function TabsComponent(props) {
173
173
  (tabItem) => tabItem.props.value === selectedValue,
174
174
  )[0],
175
175
  {
176
- className: 'margin-vert--md',
176
+ className: 'margin-top--md',
177
177
  },
178
178
  )
179
179
  ) : (
180
- <div className="margin-vert--md">
180
+ <div className="margin-top--md">
181
181
  {children.map((tabItem, i) =>
182
182
  cloneElement(tabItem, {
183
183
  key: i,
@@ -5,6 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ .tabList {
9
+ margin-bottom: var(--ifm-leading);
10
+ }
11
+
8
12
  .tabItem {
9
13
  margin-top: 0 !important;
10
14
  }
@@ -8,8 +8,7 @@ import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import Link from '@docusaurus/Link';
10
10
  import styles from './styles.module.css';
11
- export default function Tag(props) {
12
- const {permalink, name, count} = props;
11
+ export default function Tag({permalink, label, count}) {
13
12
  return (
14
13
  <Link
15
14
  href={permalink}
@@ -17,7 +16,7 @@ export default function Tag(props) {
17
16
  styles.tag,
18
17
  count ? styles.tagWithCount : styles.tagRegular,
19
18
  )}>
20
- {name}
19
+ {label}
21
20
  {count && <span>{count}</span>}
22
21
  </Link>
23
22
  );
@@ -22,7 +22,7 @@ export default function TagsListInline({tags}) {
22
22
  <ul className={clsx(styles.tags, 'padding--none', 'margin-left--sm')}>
23
23
  {tags.map(({label, permalink: tagPermalink}) => (
24
24
  <li key={tagPermalink} className={styles.tag}>
25
- <Tag name={label} permalink={tagPermalink} />
25
+ <Tag label={label} permalink={tagPermalink} />
26
26
  </li>
27
27
  ))}
28
28
  </ul>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,34 +21,39 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "2.0.0-beta.18",
25
- "@docusaurus/plugin-content-blog": "2.0.0-beta.18",
26
- "@docusaurus/plugin-content-docs": "2.0.0-beta.18",
27
- "@docusaurus/plugin-content-pages": "2.0.0-beta.18",
28
- "@docusaurus/theme-common": "2.0.0-beta.18",
29
- "@docusaurus/theme-translations": "2.0.0-beta.18",
30
- "@docusaurus/utils": "2.0.0-beta.18",
31
- "@docusaurus/utils-common": "2.0.0-beta.18",
32
- "@docusaurus/utils-validation": "2.0.0-beta.18",
24
+ "@docusaurus/core": "2.0.0-beta.19",
25
+ "@docusaurus/plugin-content-blog": "2.0.0-beta.19",
26
+ "@docusaurus/plugin-content-docs": "2.0.0-beta.19",
27
+ "@docusaurus/plugin-content-pages": "2.0.0-beta.19",
28
+ "@docusaurus/theme-common": "2.0.0-beta.19",
29
+ "@docusaurus/theme-translations": "2.0.0-beta.19",
30
+ "@docusaurus/utils": "2.0.0-beta.19",
31
+ "@docusaurus/utils-common": "2.0.0-beta.19",
32
+ "@docusaurus/utils-validation": "2.0.0-beta.19",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
36
- "infima": "0.2.0-alpha.38",
36
+ "infima": "0.2.0-alpha.39",
37
37
  "lodash": "^4.17.21",
38
- "postcss": "^8.4.12",
38
+ "nprogress": "^0.2.0",
39
+ "postcss": "^8.4.13",
39
40
  "prism-react-renderer": "^1.3.1",
40
- "prismjs": "^1.27.0",
41
+ "prismjs": "^1.28.0",
41
42
  "react-router-dom": "^5.2.0",
42
43
  "rtlcss": "^3.5.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "2.0.0-beta.18",
46
- "@docusaurus/types": "2.0.0-beta.18",
46
+ "@babel/cli": "^7.17.10",
47
+ "@babel/core": "^7.17.10",
48
+ "@babel/preset-typescript": "^7.16.7",
49
+ "@docusaurus/module-type-aliases": "2.0.0-beta.19",
50
+ "@docusaurus/types": "2.0.0-beta.19",
47
51
  "@types/mdx-js__react": "^1.5.5",
52
+ "@types/nprogress": "^0.2.0",
48
53
  "@types/prismjs": "^1.26.0",
49
- "@types/rtlcss": "^3.1.2",
54
+ "@types/rtlcss": "^3.1.4",
50
55
  "cross-env": "^7.0.3",
51
- "fs-extra": "^10.0.1",
56
+ "fs-extra": "^10.1.0",
52
57
  "react-test-renderer": "^17.0.2",
53
58
  "utility-types": "^3.10.0"
54
59
  },
@@ -59,5 +64,5 @@
59
64
  "engines": {
60
65
  "node": ">=14"
61
66
  },
62
- "gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
67
+ "gitHead": "a71e60a49cce93c1006ef10c41ac03187f057102"
63
68
  }
@@ -11,6 +11,10 @@
11
11
  text-transform: uppercase;
12
12
  }
13
13
 
14
+ .admonition h5 code {
15
+ text-transform: none;
16
+ }
17
+
14
18
  .admonition-icon {
15
19
  display: inline-block;
16
20
  vertical-align: middle;
@@ -30,7 +30,7 @@ export default function getSwizzleConfig(): SwizzleConfig {
30
30
  },
31
31
  DocSidebar: {
32
32
  actions: {
33
- eject: 'unsafe', // too much technical code in sidebar, not very safe atm
33
+ eject: 'unsafe', // Too much technical code in sidebar, not very safe atm
34
34
  wrap: 'safe',
35
35
  },
36
36
  description: 'The sidebar component on docs pages',
@@ -206,6 +206,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
206
206
  description:
207
207
  'A component wrapping all MDX content and providing the MDXComponents to the MDX context',
208
208
  },
209
+ 'NavbarItem/ComponentTypes': {
210
+ actions: {
211
+ eject: 'safe',
212
+ wrap: 'forbidden',
213
+ },
214
+ description:
215
+ 'The Navbar item components mapping. Can be ejected to add custom navbar item types. See https://github.com/facebook/docusaurus/issues/7227.',
216
+ },
209
217
  // TODO should probably not even appear here
210
218
  'NavbarItem/utils': {
211
219
  actions: {
@@ -234,7 +242,7 @@ export default function getSwizzleConfig(): SwizzleConfig {
234
242
  'prism-include-languages': {
235
243
  actions: {
236
244
  eject: 'safe',
237
- wrap: 'forbidden', // not a component!
245
+ wrap: 'forbidden', // Not a component!
238
246
  },
239
247
  description:
240
248
  'The Prism languages to include for code block syntax highlighting. Meant to be ejected.',
package/src/index.ts CHANGED
@@ -91,10 +91,10 @@ function getInfimaCSSFile(direction: string) {
91
91
  }.css`;
92
92
  }
93
93
 
94
- export default function docusaurusThemeClassic(
94
+ export default function themeClassic(
95
95
  context: LoadContext,
96
96
  options: Options,
97
- ): Plugin<void> {
97
+ ): Plugin<undefined> {
98
98
  const {
99
99
  i18n: {currentLocale, localeConfigs},
100
100
  } = context;
@@ -118,7 +118,7 @@ export default function docusaurusThemeClassic(
118
118
  return '../src/theme';
119
119
  },
120
120
 
121
- getTranslationFiles: async () => getTranslationFiles({themeConfig}),
121
+ getTranslationFiles: () => getTranslationFiles({themeConfig}),
122
122
 
123
123
  translateThemeConfig: (params) =>
124
124
  translateThemeConfig({
@@ -138,6 +138,7 @@ export default function docusaurusThemeClassic(
138
138
  require.resolve(getInfimaCSSFile(direction)),
139
139
  './prism-include-languages',
140
140
  './admonitions.css',
141
+ './nprogress',
141
142
  ];
142
143
 
143
144
  if (customCss) {
@@ -0,0 +1,41 @@
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
+ /**
9
+ * Styles for NProgress
10
+ * Copied over to remove unused styles for the spinner.
11
+ * https://github.com/rstacruz/nprogress/blob/master/nprogress.css
12
+ */
13
+
14
+ :root {
15
+ --docusaurus-progress-bar-color: var(--ifm-color-primary);
16
+ }
17
+
18
+ #nprogress {
19
+ pointer-events: none;
20
+ }
21
+
22
+ #nprogress .bar {
23
+ background: var(--docusaurus-progress-bar-color);
24
+ position: fixed;
25
+ z-index: 1031;
26
+ top: 0;
27
+ left: 0;
28
+ width: 100%;
29
+ height: 2px;
30
+ }
31
+
32
+ #nprogress .peg {
33
+ position: absolute;
34
+ right: 0;
35
+ width: 100px;
36
+ height: 100%;
37
+ box-shadow: 0 0 10px var(--docusaurus-progress-bar-color),
38
+ 0 0 5px var(--docusaurus-progress-bar-color);
39
+ opacity: 1;
40
+ transform: rotate(3deg) translate(0, -4px);
41
+ }
@@ -0,0 +1,31 @@
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 nprogress from 'nprogress';
9
+ import './nprogress.css';
10
+ import type {ClientModule} from '@docusaurus/types';
11
+
12
+ nprogress.configure({showSpinner: false});
13
+
14
+ const delay = 200;
15
+
16
+ const clientModule: ClientModule = {
17
+ onRouteUpdate({location, previousLocation}) {
18
+ if (previousLocation && location.pathname !== previousLocation.pathname) {
19
+ const progressBarTimeout = window.setTimeout(() => {
20
+ nprogress.start();
21
+ }, delay);
22
+ return () => window.clearTimeout(progressBarTimeout);
23
+ }
24
+ return undefined;
25
+ },
26
+ onRouteDidUpdate() {
27
+ nprogress.done();
28
+ },
29
+ };
30
+
31
+ export default clientModule;
@@ -5,122 +5,15 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {useRef, useState} from 'react';
8
+ import React from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {translate} from '@docusaurus/Translate';
11
+ import {ThemeClassNames, useBackToTopButton} from '@docusaurus/theme-common';
11
12
 
12
13
  import styles from './styles.module.css';
13
- import {
14
- ThemeClassNames,
15
- useScrollPosition,
16
- useLocationChange,
17
- } from '@docusaurus/theme-common';
18
-
19
- const threshold = 300;
20
-
21
- // Not all have support for smooth scrolling (particularly Safari mobile iOS)
22
- // TODO proper detection is currently unreliable!
23
- // see https://github.com/wessberg/scroll-behavior-polyfill/issues/16
24
- const SupportsNativeSmoothScrolling = false;
25
- // const SupportsNativeSmoothScrolling =
26
- // ExecutionEnvironment.canUseDOM &&
27
- // 'scrollBehavior' in document.documentElement.style;
28
-
29
- type CancelScrollTop = () => void;
30
-
31
- function smoothScrollTopNative(): CancelScrollTop {
32
- window.scrollTo({top: 0, behavior: 'smooth'});
33
- return () => {
34
- // Nothing to cancel, it's natively cancelled if user tries to scroll down
35
- };
36
- }
37
-
38
- function smoothScrollTopPolyfill(): CancelScrollTop {
39
- let raf: number | null = null;
40
- function rafRecursion() {
41
- const currentScroll = document.documentElement.scrollTop;
42
- if (currentScroll > 0) {
43
- raf = requestAnimationFrame(rafRecursion);
44
- window.scrollTo(0, Math.floor(currentScroll * 0.85));
45
- }
46
- }
47
- rafRecursion();
48
-
49
- // Break the recursion. Prevents the user from "fighting" against that
50
- // recursion producing a weird UX
51
- return () => raf && cancelAnimationFrame(raf);
52
- }
53
-
54
- type UseSmoothScrollTopReturn = {
55
- // We use a cancel function because the non-native smooth scroll-top
56
- // implementation must be interrupted if user scroll down
57
- smoothScrollTop: () => void;
58
- cancelScrollToTop: CancelScrollTop;
59
- };
60
-
61
- function useSmoothScrollToTop(): UseSmoothScrollTopReturn {
62
- const lastCancelRef = useRef<CancelScrollTop | null>(null);
63
-
64
- function smoothScrollTop(): void {
65
- lastCancelRef.current = SupportsNativeSmoothScrolling
66
- ? smoothScrollTopNative()
67
- : smoothScrollTopPolyfill();
68
- }
69
-
70
- return {
71
- smoothScrollTop,
72
- cancelScrollToTop: () => lastCancelRef.current?.(),
73
- };
74
- }
75
14
 
76
15
  export default function BackToTopButton(): JSX.Element {
77
- const [show, setShow] = useState(false);
78
- const isFocusedAnchor = useRef(false);
79
- const {smoothScrollTop, cancelScrollToTop} = useSmoothScrollToTop();
80
-
81
- useScrollPosition(({scrollY: scrollTop}, lastPosition) => {
82
- const lastScrollTop = lastPosition?.scrollY;
83
-
84
- // No lastScrollTop means component is just being mounted.
85
- // Not really a scroll event from the user, so we ignore it
86
- if (!lastScrollTop) {
87
- return;
88
- }
89
-
90
- if (isFocusedAnchor.current) {
91
- isFocusedAnchor.current = false;
92
- return;
93
- }
94
-
95
- const isScrollingUp = scrollTop < lastScrollTop;
96
-
97
- if (!isScrollingUp) {
98
- cancelScrollToTop();
99
- }
100
-
101
- if (scrollTop < threshold) {
102
- setShow(false);
103
- return;
104
- }
105
-
106
- if (isScrollingUp) {
107
- const documentHeight = document.documentElement.scrollHeight;
108
- const windowHeight = window.innerHeight;
109
- if (scrollTop + windowHeight < documentHeight) {
110
- setShow(true);
111
- }
112
- } else {
113
- setShow(false);
114
- }
115
- });
116
-
117
- useLocationChange((locationChangeEvent) => {
118
- if (locationChangeEvent.location.hash) {
119
- isFocusedAnchor.current = true;
120
- setShow(false);
121
- }
122
- });
123
-
16
+ const {shown, scrollToTop} = useBackToTopButton({threshold: 300});
124
17
  return (
125
18
  <button
126
19
  aria-label={translate({
@@ -132,10 +25,10 @@ export default function BackToTopButton(): JSX.Element {
132
25
  'clean-btn',
133
26
  ThemeClassNames.common.backToTopButton,
134
27
  styles.backToTopButton,
135
- show && styles.backToTopButtonShow,
28
+ shown && styles.backToTopButtonShow,
136
29
  )}
137
30
  type="button"
138
- onClick={() => smoothScrollTop()}
31
+ onClick={scrollToTop}
139
32
  />
140
33
  );
141
34
  }
@@ -20,11 +20,7 @@ export default function BlogLayout(props: Props): JSX.Element {
20
20
  <Layout {...layoutProps}>
21
21
  <div className="container margin-vert--lg">
22
22
  <div className="row">
23
- {hasSidebar && (
24
- <aside className="col col--3">
25
- <BlogSidebar sidebar={sidebar} />
26
- </aside>
27
- )}
23
+ <BlogSidebar sidebar={sidebar} />
28
24
  <main
29
25
  className={clsx('col', {
30
26
  'col--7': hasSidebar,
@@ -22,34 +22,31 @@ export default function BlogListPaginator(props: Props): JSX.Element {
22
22
  message: 'Blog list page navigation',
23
23
  description: 'The ARIA label for the blog pagination',
24
24
  })}>
25
- <div className="pagination-nav__item">
26
- {previousPage && (
27
- <PaginatorNavLink
28
- permalink={previousPage}
29
- title={
30
- <Translate
31
- id="theme.blog.paginator.newerEntries"
32
- description="The label used to navigate to the newer blog posts page (previous page)">
33
- Newer Entries
34
- </Translate>
35
- }
36
- />
37
- )}
38
- </div>
39
- <div className="pagination-nav__item pagination-nav__item--next">
40
- {nextPage && (
41
- <PaginatorNavLink
42
- permalink={nextPage}
43
- title={
44
- <Translate
45
- id="theme.blog.paginator.olderEntries"
46
- description="The label used to navigate to the older blog posts page (next page)">
47
- Older Entries
48
- </Translate>
49
- }
50
- />
51
- )}
52
- </div>
25
+ {previousPage && (
26
+ <PaginatorNavLink
27
+ permalink={previousPage}
28
+ title={
29
+ <Translate
30
+ id="theme.blog.paginator.newerEntries"
31
+ description="The label used to navigate to the newer blog posts page (previous page)">
32
+ Newer Entries
33
+ </Translate>
34
+ }
35
+ />
36
+ )}
37
+ {nextPage && (
38
+ <PaginatorNavLink
39
+ permalink={nextPage}
40
+ title={
41
+ <Translate
42
+ id="theme.blog.paginator.olderEntries"
43
+ description="The label used to navigate to the older blog posts page (next page)">
44
+ Older Entries
45
+ </Translate>
46
+ }
47
+ isNext
48
+ />
49
+ )}
53
50
  </nav>
54
51
  );
55
52
  }
@@ -9,8 +9,6 @@ import React from 'react';
9
9
  import Link, {type Props as LinkProps} from '@docusaurus/Link';
10
10
  import type {Props} from '@theme/BlogPostAuthor';
11
11
 
12
- import styles from './styles.module.css';
13
-
14
12
  function MaybeLink(props: LinkProps): JSX.Element {
15
13
  if (props.href) {
16
14
  return <Link {...props} />;
@@ -24,11 +22,9 @@ export default function BlogPostAuthor({author}: Props): JSX.Element {
24
22
  return (
25
23
  <div className="avatar margin-bottom--sm">
26
24
  {imageURL && (
27
- <span className="avatar__photo-link avatar__photo">
28
- <MaybeLink href={link}>
29
- <img className={styles.image} src={imageURL} alt={name} />
30
- </MaybeLink>
31
- </span>
25
+ <MaybeLink href={link} className="avatar__photo-link">
26
+ <img className="avatar__photo" src={imageURL} alt={name} />
27
+ </MaybeLink>
32
28
  )}
33
29
 
34
30
  {name && (
@@ -9,6 +9,15 @@
9
9
  font-size: 3rem;
10
10
  }
11
11
 
12
+ /**
13
+ Blog post title should be smaller on smaller devices
14
+ **/
15
+ @media (max-width: 576px) {
16
+ .blogPostTitle {
17
+ font-size: 2rem;
18
+ }
19
+ }
20
+
12
21
  .blogPostData {
13
22
  font-size: 0.9rem;
14
23
  }
@@ -21,34 +21,31 @@ export default function BlogPostPaginator(props: Props): JSX.Element {
21
21
  message: 'Blog post page navigation',
22
22
  description: 'The ARIA label for the blog posts pagination',
23
23
  })}>
24
- <div className="pagination-nav__item">
25
- {prevItem && (
26
- <PaginatorNavLink
27
- {...prevItem}
28
- subLabel={
29
- <Translate
30
- id="theme.blog.post.paginator.newerPost"
31
- description="The blog post button label to navigate to the newer/previous post">
32
- Newer Post
33
- </Translate>
34
- }
35
- />
36
- )}
37
- </div>
38
- <div className="pagination-nav__item pagination-nav__item--next">
39
- {nextItem && (
40
- <PaginatorNavLink
41
- {...nextItem}
42
- subLabel={
43
- <Translate
44
- id="theme.blog.post.paginator.olderPost"
45
- description="The blog post button label to navigate to the older/next post">
46
- Older Post
47
- </Translate>
48
- }
49
- />
50
- )}
51
- </div>
24
+ {prevItem && (
25
+ <PaginatorNavLink
26
+ {...prevItem}
27
+ subLabel={
28
+ <Translate
29
+ id="theme.blog.post.paginator.newerPost"
30
+ description="The blog post button label to navigate to the newer/previous post">
31
+ Newer Post
32
+ </Translate>
33
+ }
34
+ />
35
+ )}
36
+ {nextItem && (
37
+ <PaginatorNavLink
38
+ {...nextItem}
39
+ subLabel={
40
+ <Translate
41
+ id="theme.blog.post.paginator.olderPost"
42
+ description="The blog post button label to navigate to the older/next post">
43
+ Older Post
44
+ </Translate>
45
+ }
46
+ isNext
47
+ />
48
+ )}
52
49
  </nav>
53
50
  );
54
51
  }