@docusaurus/theme-classic 0.0.0-4731 → 0.0.0-4734

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.
@@ -833,11 +833,8 @@ declare module '@theme/IconExternalLink' {
833
833
  }
834
834
 
835
835
  declare module '@theme/TagsListByLetter' {
836
- export type TagsListItem = Readonly<{
837
- name: string;
838
- permalink: string;
839
- count: number;
840
- }>;
836
+ import type {TagsListItem} from '@docusaurus/theme-common';
837
+
841
838
  export interface Props {
842
839
  readonly tags: readonly TagsListItem[];
843
840
  }
@@ -853,7 +850,7 @@ declare module '@theme/TagsListInline' {
853
850
  }
854
851
 
855
852
  declare module '@theme/Tag' {
856
- import type {TagsListItem} from '@theme/TagsListByLetter';
853
+ import type {TagsListItem} from '@docusaurus/theme-common';
857
854
  import type {Optional} from 'utility-types';
858
855
 
859
856
  export interface Props extends Optional<TagsListItem, 'count'> {}
@@ -16,7 +16,7 @@ import Link from '@docusaurus/Link';
16
16
  import useBaseUrl from '@docusaurus/useBaseUrl'; // TODO move to design system folder
17
17
 
18
18
  function BreadcrumbsItemLink({children, href}) {
19
- const className = clsx('breadcrumbs__link', styles.breadcrumbsItemLink);
19
+ const className = 'breadcrumbs__link';
20
20
  return href ? (
21
21
  <Link className={className} href={href} itemProp="item">
22
22
  <span itemProp="name">{children}</span>
@@ -81,7 +81,8 @@ export default function DocBreadcrumbs() {
81
81
  key={idx}
82
82
  active={idx === breadcrumbs.length - 1}
83
83
  index={idx}>
84
- <BreadcrumbsItemLink href={item.href}>
84
+ <BreadcrumbsItemLink
85
+ href={idx < breadcrumbs.length - 1 ? item.href : undefined}>
85
86
  {item.label}
86
87
  </BreadcrumbsItemLink>
87
88
  </BreadcrumbsItem>
@@ -6,21 +6,6 @@
6
6
  */
7
7
 
8
8
  .breadcrumbsContainer {
9
- margin-bottom: 0.4rem;
10
- }
11
-
12
- .breadcrumbsItemLink {
13
- --ifm-breadcrumb-size-multiplier: 0.7 !important;
14
- margin-bottom: 0.4rem;
15
- background: var(--ifm-color-gray-100);
16
- }
17
-
18
- html[data-theme='dark'] .breadcrumbsItemLink {
19
- background-color: var(--ifm-color-gray-900);
20
- }
21
-
22
- @media (min-width: 997px) {
23
- .breadcrumbsItemLink {
24
- --ifm-breadcrumb-size-multiplier: 0.8;
25
- }
9
+ --ifm-breadcrumb-size-multiplier: 0.8;
10
+ margin-bottom: 0.8rem;
26
11
  }
@@ -15,7 +15,11 @@ import TOC from '@theme/TOC';
15
15
  import TOCCollapsible from '@theme/TOCCollapsible';
16
16
  import Heading from '@theme/Heading';
17
17
  import styles from './styles.module.css';
18
- import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common';
18
+ import {
19
+ HtmlClassNameProvider,
20
+ ThemeClassNames,
21
+ useWindowSize,
22
+ } from '@docusaurus/theme-common';
19
23
  import DocBreadcrumbs from '@theme/DocBreadcrumbs';
20
24
  import MDXContent from '@theme/MDXContent';
21
25
  export default function DocItem(props) {
@@ -41,7 +45,7 @@ export default function DocItem(props) {
41
45
  const renderTocDesktop =
42
46
  canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
43
47
  return (
44
- <>
48
+ <HtmlClassNameProvider className={`docs-doc-id-${metadata.unversionedId}`}>
45
49
  <Seo
46
50
  {...{
47
51
  title,
@@ -106,6 +110,6 @@ export default function DocItem(props) {
106
110
  </div>
107
111
  )}
108
112
  </div>
109
- </>
113
+ </HtmlClassNameProvider>
110
114
  );
111
115
  }
@@ -16,13 +16,13 @@ import {translate} from '@docusaurus/Translate';
16
16
  import clsx from 'clsx';
17
17
  import styles from './styles.module.css';
18
18
  import {
19
+ HtmlClassNameProvider,
19
20
  ThemeClassNames,
20
21
  docVersionSearchTag,
21
22
  DocsSidebarProvider,
22
23
  useDocsSidebar,
23
24
  DocsVersionProvider,
24
25
  } from '@docusaurus/theme-common';
25
- import Head from '@docusaurus/Head';
26
26
 
27
27
  function DocPageContent({
28
28
  currentDocRoute,
@@ -145,11 +145,7 @@ export default function DocPage(props) {
145
145
  ? versionMetadata.docsSidebars[sidebarName]
146
146
  : null;
147
147
  return (
148
- <>
149
- <Head>
150
- {/* TODO we should add a core addRoute({htmlClassName}) action */}
151
- <html className={versionMetadata.className} />
152
- </Head>
148
+ <HtmlClassNameProvider className={versionMetadata.className}>
153
149
  <DocsVersionProvider version={versionMetadata}>
154
150
  <DocsSidebarProvider sidebar={sidebar ?? null}>
155
151
  <DocPageContent
@@ -162,6 +158,6 @@ export default function DocPage(props) {
162
158
  </DocPageContent>
163
159
  </DocsSidebarProvider>
164
160
  </DocsVersionProvider>
165
- </>
161
+ </HtmlClassNameProvider>
166
162
  );
167
163
  }
@@ -12,6 +12,7 @@ import {
12
12
  DocsPreferredVersionContextProvider,
13
13
  MobileSecondaryMenuProvider,
14
14
  ScrollControllerProvider,
15
+ PluginHtmlClassNameProvider,
15
16
  } from '@docusaurus/theme-common';
16
17
  export default function LayoutProviders({children}) {
17
18
  return (
@@ -21,7 +22,9 @@ export default function LayoutProviders({children}) {
21
22
  <ScrollControllerProvider>
22
23
  <DocsPreferredVersionContextProvider>
23
24
  <MobileSecondaryMenuProvider>
24
- {children}
25
+ <PluginHtmlClassNameProvider>
26
+ {children}
27
+ </PluginHtmlClassNameProvider>
25
28
  </MobileSecondaryMenuProvider>
26
29
  </DocsPreferredVersionContextProvider>
27
30
  </ScrollControllerProvider>
@@ -31,11 +31,7 @@ function DefaultNavbarItemDesktop({
31
31
  return element;
32
32
  }
33
33
 
34
- function DefaultNavbarItemMobile({
35
- className,
36
- isDropdownItem: _isDropdownItem,
37
- ...props
38
- }) {
34
+ function DefaultNavbarItemMobile({className, isDropdownItem, ...props}) {
39
35
  return (
40
36
  <li className="menu__list-item">
41
37
  <NavbarNavLink className={clsx('menu__link', className)} {...props} />
@@ -45,7 +41,7 @@ function DefaultNavbarItemMobile({
45
41
 
46
42
  export default function DefaultNavbarItem({
47
43
  mobile = false,
48
- position: _position,
44
+ position,
49
45
  // Need to destructure position from props so that it doesn't get passed on.
50
46
  ...props
51
47
  }) {
@@ -104,7 +104,7 @@ function DropdownNavbarItemDesktop({items, position, className, ...props}) {
104
104
  function DropdownNavbarItemMobile({
105
105
  items,
106
106
  className,
107
- position: _position,
107
+ position,
108
108
  // Need to destructure position from props so that it doesn't get passed on.
109
109
  ...props
110
110
  }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4731",
3
+ "version": "0.0.0-4734",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4731",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4731",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4731",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4731",
28
- "@docusaurus/theme-common": "0.0.0-4731",
29
- "@docusaurus/theme-translations": "0.0.0-4731",
30
- "@docusaurus/utils": "0.0.0-4731",
31
- "@docusaurus/utils-common": "0.0.0-4731",
32
- "@docusaurus/utils-validation": "0.0.0-4731",
24
+ "@docusaurus/core": "0.0.0-4734",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4734",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4734",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4734",
28
+ "@docusaurus/theme-common": "0.0.0-4734",
29
+ "@docusaurus/theme-translations": "0.0.0-4734",
30
+ "@docusaurus/utils": "0.0.0-4734",
31
+ "@docusaurus/utils-common": "0.0.0-4734",
32
+ "@docusaurus/utils-validation": "0.0.0-4734",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -42,8 +42,8 @@
42
42
  "rtlcss": "^3.5.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4731",
46
- "@docusaurus/types": "0.0.0-4731",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4734",
46
+ "@docusaurus/types": "0.0.0-4734",
47
47
  "@types/mdx-js__react": "^1.5.5",
48
48
  "@types/prismjs": "^1.26.0",
49
49
  "@types/rtlcss": "^3.1.2",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=14"
61
61
  },
62
- "gitHead": "f3787c5cd81d0d934005814e3038d897f5ba58aa"
62
+ "gitHead": "0ca49e19e1c96a7d4a0f2bb72ccfca4b7a3eb9bb"
63
63
  }
@@ -24,7 +24,7 @@ function BreadcrumbsItemLink({
24
24
  children: ReactNode;
25
25
  href?: string;
26
26
  }): JSX.Element {
27
- const className = clsx('breadcrumbs__link', styles.breadcrumbsItemLink);
27
+ const className = 'breadcrumbs__link';
28
28
  return href ? (
29
29
  <Link className={className} href={href} itemProp="item">
30
30
  <span itemProp="name">{children}</span>
@@ -98,7 +98,8 @@ export default function DocBreadcrumbs(): JSX.Element | null {
98
98
  key={idx}
99
99
  active={idx === breadcrumbs.length - 1}
100
100
  index={idx}>
101
- <BreadcrumbsItemLink href={item.href}>
101
+ <BreadcrumbsItemLink
102
+ href={idx < breadcrumbs.length - 1 ? item.href : undefined}>
102
103
  {item.label}
103
104
  </BreadcrumbsItemLink>
104
105
  </BreadcrumbsItem>
@@ -6,21 +6,6 @@
6
6
  */
7
7
 
8
8
  .breadcrumbsContainer {
9
- margin-bottom: 0.4rem;
10
- }
11
-
12
- .breadcrumbsItemLink {
13
- --ifm-breadcrumb-size-multiplier: 0.7 !important;
14
- margin-bottom: 0.4rem;
15
- background: var(--ifm-color-gray-100);
16
- }
17
-
18
- html[data-theme='dark'] .breadcrumbsItemLink {
19
- background-color: var(--ifm-color-gray-900);
20
- }
21
-
22
- @media (min-width: 997px) {
23
- .breadcrumbsItemLink {
24
- --ifm-breadcrumb-size-multiplier: 0.8;
25
- }
9
+ --ifm-breadcrumb-size-multiplier: 0.8;
10
+ margin-bottom: 0.8rem;
26
11
  }
@@ -17,7 +17,11 @@ import TOC from '@theme/TOC';
17
17
  import TOCCollapsible from '@theme/TOCCollapsible';
18
18
  import Heading from '@theme/Heading';
19
19
  import styles from './styles.module.css';
20
- import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common';
20
+ import {
21
+ HtmlClassNameProvider,
22
+ ThemeClassNames,
23
+ useWindowSize,
24
+ } from '@docusaurus/theme-common';
21
25
  import DocBreadcrumbs from '@theme/DocBreadcrumbs';
22
26
  import MDXContent from '@theme/MDXContent';
23
27
 
@@ -49,7 +53,7 @@ export default function DocItem(props: Props): JSX.Element {
49
53
  canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
50
54
 
51
55
  return (
52
- <>
56
+ <HtmlClassNameProvider className={`docs-doc-id-${metadata.unversionedId}`}>
53
57
  <Seo {...{title, description, keywords, image}} />
54
58
 
55
59
  <div className="row">
@@ -107,6 +111,6 @@ export default function DocItem(props: Props): JSX.Element {
107
111
  </div>
108
112
  )}
109
113
  </div>
110
- </>
114
+ </HtmlClassNameProvider>
111
115
  );
112
116
  }
@@ -20,14 +20,15 @@ import {translate} from '@docusaurus/Translate';
20
20
 
21
21
  import clsx from 'clsx';
22
22
  import styles from './styles.module.css';
23
+
23
24
  import {
25
+ HtmlClassNameProvider,
24
26
  ThemeClassNames,
25
27
  docVersionSearchTag,
26
28
  DocsSidebarProvider,
27
29
  useDocsSidebar,
28
30
  DocsVersionProvider,
29
31
  } from '@docusaurus/theme-common';
30
- import Head from '@docusaurus/Head';
31
32
 
32
33
  type DocPageContentProps = {
33
34
  readonly currentDocRoute: DocumentRoute;
@@ -160,11 +161,7 @@ export default function DocPage(props: Props): JSX.Element {
160
161
  : null;
161
162
 
162
163
  return (
163
- <>
164
- <Head>
165
- {/* TODO we should add a core addRoute({htmlClassName}) action */}
166
- <html className={versionMetadata.className} />
167
- </Head>
164
+ <HtmlClassNameProvider className={versionMetadata.className}>
168
165
  <DocsVersionProvider version={versionMetadata}>
169
166
  <DocsSidebarProvider sidebar={sidebar ?? null}>
170
167
  <DocPageContent
@@ -175,6 +172,6 @@ export default function DocPage(props: Props): JSX.Element {
175
172
  </DocPageContent>
176
173
  </DocsSidebarProvider>
177
174
  </DocsVersionProvider>
178
- </>
175
+ </HtmlClassNameProvider>
179
176
  );
180
177
  }
@@ -234,9 +234,7 @@ function DocSidebarItemHtml({
234
234
  )}
235
235
  key={index}
236
236
  // eslint-disable-next-line react/no-danger
237
- dangerouslySetInnerHTML={{
238
- __html: value,
239
- }}
237
+ dangerouslySetInnerHTML={{__html: value}}
240
238
  />
241
239
  );
242
240
  }
@@ -14,9 +14,7 @@ export default function FooterCopyright({copyright}: Props): JSX.Element {
14
14
  className="footer__copyright"
15
15
  // Developer provided the HTML, so assume it's safe.
16
16
  // eslint-disable-next-line react/no-danger
17
- dangerouslySetInnerHTML={{
18
- __html: copyright,
19
- }}
17
+ dangerouslySetInnerHTML={{__html: copyright}}
20
18
  />
21
19
  );
22
20
  }
@@ -18,9 +18,7 @@ function ColumnLinkItem({item}: {item: ColumnItemType}) {
18
18
  className="footer__item"
19
19
  // Developer provided the HTML, so assume it's safe.
20
20
  // eslint-disable-next-line react/no-danger
21
- dangerouslySetInnerHTML={{
22
- __html: item.html,
23
- }}
21
+ dangerouslySetInnerHTML={{__html: item.html}}
24
22
  />
25
23
  ) : (
26
24
  <li key={item.href || item.to} className="footer__item">
@@ -19,9 +19,7 @@ function SimpleLinkItem({item}: {item: Props['links'][number]}) {
19
19
  className="footer__link-item"
20
20
  // Developer provided the HTML, so assume it's safe.
21
21
  // eslint-disable-next-line react/no-danger
22
- dangerouslySetInnerHTML={{
23
- __html: item.html,
24
- }}
22
+ dangerouslySetInnerHTML={{__html: item.html}}
25
23
  />
26
24
  ) : (
27
25
  <LinkItem item={item} />
@@ -13,6 +13,7 @@ import {
13
13
  DocsPreferredVersionContextProvider,
14
14
  MobileSecondaryMenuProvider,
15
15
  ScrollControllerProvider,
16
+ PluginHtmlClassNameProvider,
16
17
  } from '@docusaurus/theme-common';
17
18
  import type {Props} from '@theme/LayoutProviders';
18
19
 
@@ -24,7 +25,9 @@ export default function LayoutProviders({children}: Props): JSX.Element {
24
25
  <ScrollControllerProvider>
25
26
  <DocsPreferredVersionContextProvider>
26
27
  <MobileSecondaryMenuProvider>
27
- {children}
28
+ <PluginHtmlClassNameProvider>
29
+ {children}
30
+ </PluginHtmlClassNameProvider>
28
31
  </MobileSecondaryMenuProvider>
29
32
  </DocsPreferredVersionContextProvider>
30
33
  </ScrollControllerProvider>
@@ -41,7 +41,7 @@ function DefaultNavbarItemDesktop({
41
41
 
42
42
  function DefaultNavbarItemMobile({
43
43
  className,
44
- isDropdownItem: _isDropdownItem,
44
+ isDropdownItem,
45
45
  ...props
46
46
  }: DesktopOrMobileNavBarItemProps) {
47
47
  return (
@@ -53,7 +53,7 @@ function DefaultNavbarItemMobile({
53
53
 
54
54
  export default function DefaultNavbarItem({
55
55
  mobile = false,
56
- position: _position, // Need to destructure position from props so that it doesn't get passed on.
56
+ position, // Need to destructure position from props so that it doesn't get passed on.
57
57
  ...props
58
58
  }: Props): JSX.Element {
59
59
  const Comp = mobile ? DefaultNavbarItemMobile : DefaultNavbarItemDesktop;
@@ -124,7 +124,7 @@ function DropdownNavbarItemDesktop({
124
124
  function DropdownNavbarItemMobile({
125
125
  items,
126
126
  className,
127
- position: _position, // Need to destructure position from props so that it doesn't get passed on.
127
+ position, // Need to destructure position from props so that it doesn't get passed on.
128
128
  ...props
129
129
  }: DesktopOrMobileNavBarItemProps) {
130
130
  const localPathname = useLocalPathname();
@@ -833,11 +833,8 @@ declare module '@theme/IconExternalLink' {
833
833
  }
834
834
 
835
835
  declare module '@theme/TagsListByLetter' {
836
- export type TagsListItem = Readonly<{
837
- name: string;
838
- permalink: string;
839
- count: number;
840
- }>;
836
+ import type {TagsListItem} from '@docusaurus/theme-common';
837
+
841
838
  export interface Props {
842
839
  readonly tags: readonly TagsListItem[];
843
840
  }
@@ -853,7 +850,7 @@ declare module '@theme/TagsListInline' {
853
850
  }
854
851
 
855
852
  declare module '@theme/Tag' {
856
- import type {TagsListItem} from '@theme/TagsListByLetter';
853
+ import type {TagsListItem} from '@docusaurus/theme-common';
857
854
  import type {Optional} from 'utility-types';
858
855
 
859
856
  export interface Props extends Optional<TagsListItem, 'count'> {}