@docusaurus/theme-classic 0.0.0-5076 → 0.0.0-5081

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.
@@ -61,9 +61,7 @@ function BlogPostPageContent(props) {
61
61
  <BlogLayout
62
62
  sidebar={sidebar}
63
63
  toc={
64
- !hideTableOfContents &&
65
- BlogPostContents.toc &&
66
- BlogPostContents.toc.length > 0 ? (
64
+ !hideTableOfContents && BlogPostContents.toc.length > 0 ? (
67
65
  <TOC
68
66
  toc={BlogPostContents.toc}
69
67
  minHeadingLevel={tocMinHeadingLevel}
@@ -22,7 +22,7 @@ export default function DocCardList({items, className}) {
22
22
  <section className={clsx('row', className)}>
23
23
  {filterItems(items).map((item, index) => (
24
24
  <article key={index} className="col col--6 margin-bottom--lg">
25
- <DocCard key={index} item={item} />
25
+ <DocCard item={item} />
26
26
  </article>
27
27
  ))}
28
28
  </section>
@@ -46,8 +46,7 @@ function DocItemContent(props) {
46
46
  const shouldAddTitle =
47
47
  !hideTitle && typeof DocContent.contentTitle === 'undefined';
48
48
  const windowSize = useWindowSize();
49
- const canRenderTOC =
50
- !hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;
49
+ const canRenderTOC = !hideTableOfContents && DocContent.toc.length > 0;
51
50
  const renderTocDesktop =
52
51
  canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
53
52
  return (
@@ -22,7 +22,7 @@ export default function MDXCode(props) {
22
22
  const shouldBeInline = React.Children.toArray(props.children).every(
23
23
  (el) =>
24
24
  (typeof el === 'string' && !el.includes('\n')) ||
25
- (isValidElement(el) && inlineElements.includes(el.props.mdxType)),
25
+ (isValidElement(el) && inlineElements.includes(el.props?.mdxType)),
26
26
  );
27
27
  return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
28
28
  }
@@ -37,7 +37,7 @@ export default function MDXPage(props) {
37
37
  <MDXPageContent />
38
38
  </MDXContent>
39
39
  </div>
40
- {!hideTableOfContents && MDXPageContent.toc && (
40
+ {!hideTableOfContents && MDXPageContent.toc.length > 0 && (
41
41
  <div className="col col--2">
42
42
  <TOC
43
43
  toc={MDXPageContent.toc}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5076",
3
+ "version": "0.0.0-5081",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,18 +20,18 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "0.0.0-5076",
24
- "@docusaurus/mdx-loader": "0.0.0-5076",
25
- "@docusaurus/module-type-aliases": "0.0.0-5076",
26
- "@docusaurus/plugin-content-blog": "0.0.0-5076",
27
- "@docusaurus/plugin-content-docs": "0.0.0-5076",
28
- "@docusaurus/plugin-content-pages": "0.0.0-5076",
29
- "@docusaurus/theme-common": "0.0.0-5076",
30
- "@docusaurus/theme-translations": "0.0.0-5076",
31
- "@docusaurus/types": "0.0.0-5076",
32
- "@docusaurus/utils": "0.0.0-5076",
33
- "@docusaurus/utils-common": "0.0.0-5076",
34
- "@docusaurus/utils-validation": "0.0.0-5076",
23
+ "@docusaurus/core": "0.0.0-5081",
24
+ "@docusaurus/mdx-loader": "0.0.0-5081",
25
+ "@docusaurus/module-type-aliases": "0.0.0-5081",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-5081",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-5081",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-5081",
29
+ "@docusaurus/theme-common": "0.0.0-5081",
30
+ "@docusaurus/theme-translations": "0.0.0-5081",
31
+ "@docusaurus/types": "0.0.0-5081",
32
+ "@docusaurus/utils": "0.0.0-5081",
33
+ "@docusaurus/utils-common": "0.0.0-5081",
34
+ "@docusaurus/utils-validation": "0.0.0-5081",
35
35
  "@mdx-js/react": "^1.6.22",
36
36
  "clsx": "^1.1.1",
37
37
  "copy-text-to-clipboard": "^3.0.1",
@@ -64,5 +64,5 @@
64
64
  "engines": {
65
65
  "node": ">=16.14"
66
66
  },
67
- "gitHead": "818667514c2990bdfe900ce5e9eebc9f23dafd95"
67
+ "gitHead": "aff92b3be3392360acf68ef8e5eb8a7170f56aac"
68
68
  }
@@ -65,9 +65,7 @@ function BlogPostPageContent(props: Props): JSX.Element {
65
65
  <BlogLayout
66
66
  sidebar={sidebar}
67
67
  toc={
68
- !hideTableOfContents &&
69
- BlogPostContents.toc &&
70
- BlogPostContents.toc.length > 0 ? (
68
+ !hideTableOfContents && BlogPostContents.toc.length > 0 ? (
71
69
  <TOC
72
70
  toc={BlogPostContents.toc}
73
71
  minHeadingLevel={tocMinHeadingLevel}
@@ -27,7 +27,7 @@ export default function DocCardList({items, className}: Props): JSX.Element {
27
27
  <section className={clsx('row', className)}>
28
28
  {filterItems(items).map((item, index) => (
29
29
  <article key={index} className="col col--6 margin-bottom--lg">
30
- <DocCard key={index} item={item} />
30
+ <DocCard item={item} />
31
31
  </article>
32
32
  ))}
33
33
  </section>
@@ -55,8 +55,7 @@ function DocItemContent(props: Props): JSX.Element {
55
55
 
56
56
  const windowSize = useWindowSize();
57
57
 
58
- const canRenderTOC =
59
- !hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;
58
+ const canRenderTOC = !hideTableOfContents && DocContent.toc.length > 0;
60
59
 
61
60
  const renderTocDesktop =
62
61
  canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
@@ -11,7 +11,7 @@ import CodeBlock from '@theme/CodeBlock';
11
11
  import type {Props} from '@theme/MDXComponents/Code';
12
12
 
13
13
  export default function MDXCode(props: Props): JSX.Element {
14
- const inlineElements = [
14
+ const inlineElements: (string | undefined)[] = [
15
15
  'a',
16
16
  'b',
17
17
  'big',
@@ -26,7 +26,10 @@ export default function MDXCode(props: Props): JSX.Element {
26
26
  const shouldBeInline = React.Children.toArray(props.children).every(
27
27
  (el) =>
28
28
  (typeof el === 'string' && !el.includes('\n')) ||
29
- (isValidElement(el) && inlineElements.includes(el.props.mdxType)),
29
+ (isValidElement(el) &&
30
+ inlineElements.includes(
31
+ (el.props as {mdxType: string} | null)?.mdxType,
32
+ )),
30
33
  );
31
34
 
32
35
  return shouldBeInline ? (
@@ -15,7 +15,8 @@ export default function MDXDetails(props: Props): JSX.Element {
15
15
  // Details theme component
16
16
  const summary = items.find(
17
17
  (item): item is ReactElement<ComponentProps<'summary'>> =>
18
- React.isValidElement(item) && item.props?.mdxType === 'summary',
18
+ React.isValidElement(item) &&
19
+ (item.props as {mdxType: string} | null)?.mdxType === 'summary',
19
20
  );
20
21
  const children = <>{items.filter((item) => item !== summary)}</>;
21
22
 
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {type ReactElement, type ComponentProps} from 'react';
9
- import Head from '@docusaurus/Head';
8
+ import React, {type ReactElement} from 'react';
9
+ import Head, {type Props as HeadProps} from '@docusaurus/Head';
10
10
  import type {Props} from '@theme/MDXComponents/Head';
11
11
 
12
12
  // MDX elements are wrapped through the MDX pragma. In some cases (notably usage
@@ -25,7 +25,5 @@ export default function MDXHead(props: Props): JSX.Element {
25
25
  const unwrappedChildren = React.Children.map(props.children, (child) =>
26
26
  React.isValidElement(child) ? unwrapMDXElement(child) : child,
27
27
  );
28
- return (
29
- <Head {...(props as ComponentProps<typeof Head>)}>{unwrappedChildren}</Head>
30
- );
28
+ return <Head {...(props as HeadProps)}>{unwrappedChildren}</Head>;
31
29
  }
@@ -14,7 +14,8 @@ export default function MDXPre(props: Props): JSX.Element {
14
14
  <CodeBlock
15
15
  // If this pre is created by a ``` fenced codeblock, unwrap the children
16
16
  {...(isValidElement(props.children) &&
17
- props.children.props?.originalType === 'code'
17
+ (props.children.props as {originalType: string} | null)?.originalType ===
18
+ 'code'
18
19
  ? props.children.props
19
20
  : {...props})}
20
21
  />
@@ -42,7 +42,7 @@ export default function MDXPage(props: Props): JSX.Element {
42
42
  <MDXPageContent />
43
43
  </MDXContent>
44
44
  </div>
45
- {!hideTableOfContents && MDXPageContent.toc && (
45
+ {!hideTableOfContents && MDXPageContent.toc.length > 0 && (
46
46
  <div className="col col--2">
47
47
  <TOC
48
48
  toc={MDXPageContent.toc}
@@ -328,8 +328,6 @@ declare module '@theme/DocSidebar' {
328
328
  readonly sidebar: readonly PropSidebarItem[];
329
329
  readonly onCollapse: () => void;
330
330
  readonly isHidden: boolean;
331
- // MobileSecondaryFilter expects Record<string, unknown>
332
- readonly [key: string]: unknown;
333
331
  }
334
332
 
335
333
  export default function DocSidebar(props: Props): JSX.Element;