@docusaurus/theme-classic 0.0.0-6016 → 0.0.0-6019

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.
@@ -17,10 +17,10 @@ import BlogPostPaginator from '@theme/BlogPostPaginator';
17
17
  import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
18
18
  import BlogPostPageStructuredData from '@theme/BlogPostPage/StructuredData';
19
19
  import TOC from '@theme/TOC';
20
- import Unlisted from '@theme/Unlisted';
20
+ import ContentVisibility from '@theme/ContentVisibility';
21
21
  function BlogPostPageContent({sidebar, children}) {
22
22
  const {metadata, toc} = useBlogPost();
23
- const {nextItem, prevItem, frontMatter, unlisted} = metadata;
23
+ const {nextItem, prevItem, frontMatter} = metadata;
24
24
  const {
25
25
  hide_table_of_contents: hideTableOfContents,
26
26
  toc_min_heading_level: tocMinHeadingLevel,
@@ -38,7 +38,7 @@ function BlogPostPageContent({sidebar, children}) {
38
38
  />
39
39
  ) : undefined
40
40
  }>
41
- {unlisted && <Unlisted />}
41
+ <ContentVisibility metadata={metadata} />
42
42
 
43
43
  <BlogPostItem>{children}</BlogPostItem>
44
44
 
@@ -18,7 +18,7 @@ import BlogLayout from '@theme/BlogLayout';
18
18
  import BlogListPaginator from '@theme/BlogListPaginator';
19
19
  import SearchMetadata from '@theme/SearchMetadata';
20
20
  import BlogPostItems from '@theme/BlogPostItems';
21
- import Unlisted from '@theme/Unlisted';
21
+ import Unlisted from '@theme/ContentVisibility/Unlisted';
22
22
  import Heading from '@theme/Heading';
23
23
  function BlogTagsPostsPageMetadata({tag}) {
24
24
  const title = useBlogTagsPostsPageTitle(tag);
@@ -0,0 +1,8 @@
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
+ import type { Props } from '@theme/ContentVisibility/Draft';
8
+ export default function Draft({ className }: Props): JSX.Element | null;
@@ -0,0 +1,24 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import {
10
+ ThemeClassNames,
11
+ DraftBannerTitle,
12
+ DraftBannerMessage,
13
+ } from '@docusaurus/theme-common';
14
+ import Admonition from '@theme/Admonition';
15
+ export default function Draft({className}) {
16
+ return (
17
+ <Admonition
18
+ type="caution"
19
+ title={<DraftBannerTitle />}
20
+ className={clsx(className, ThemeClassNames.common.draftBanner)}>
21
+ <DraftBannerMessage />
22
+ </Admonition>
23
+ );
24
+ }
@@ -4,5 +4,5 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { Props } from '@theme/Unlisted';
7
+ import type { Props } from '@theme/ContentVisibility/Unlisted';
8
8
  export default function Unlisted(props: Props): JSX.Element | null;
@@ -0,0 +1,8 @@
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
+ import type { Props } from '@theme/ContentVisibility';
8
+ export default function ContentVisibility({ metadata, }: Props): JSX.Element | null;
@@ -0,0 +1,21 @@
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
+ import React from 'react';
8
+ import Draft from '@theme/ContentVisibility/Draft';
9
+ import Unlisted from '@theme/ContentVisibility/Unlisted';
10
+ export default function ContentVisibility({metadata}) {
11
+ const {unlisted, frontMatter} = metadata;
12
+ // Reading draft/unlisted status from frontMatter is useful to display
13
+ // the banners in dev mode (in dev, metadata.unlisted is always false)
14
+ // See https://github.com/facebook/docusaurus/issues/8285
15
+ return (
16
+ <>
17
+ {(unlisted || frontMatter.unlisted) && <Unlisted />}
18
+ {frontMatter.draft && <Draft />}
19
+ </>
20
+ );
21
+ }
@@ -16,7 +16,7 @@ import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
16
16
  import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
17
17
  import DocItemContent from '@theme/DocItem/Content';
18
18
  import DocBreadcrumbs from '@theme/DocBreadcrumbs';
19
- import Unlisted from '@theme/Unlisted';
19
+ import ContentVisibility from '@theme/ContentVisibility';
20
20
  import styles from './styles.module.css';
21
21
  /**
22
22
  * Decide if the toc should be rendered, on mobile or desktop viewports
@@ -39,13 +39,11 @@ function useDocTOC() {
39
39
  }
40
40
  export default function DocItemLayout({children}) {
41
41
  const docTOC = useDocTOC();
42
- const {
43
- metadata: {unlisted},
44
- } = useDoc();
42
+ const {metadata} = useDoc();
45
43
  return (
46
44
  <div className="row">
47
45
  <div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
48
- {unlisted && <Unlisted />}
46
+ <ContentVisibility metadata={metadata} />
49
47
  <DocVersionBanner />
50
48
  <div className={styles.docItemContainer}>
51
49
  <article>
@@ -15,7 +15,7 @@ import {
15
15
  } from '@docusaurus/theme-common';
16
16
  import Translate, {translate} from '@docusaurus/Translate';
17
17
  import SearchMetadata from '@theme/SearchMetadata';
18
- import Unlisted from '@theme/Unlisted';
18
+ import Unlisted from '@theme/ContentVisibility/Unlisted';
19
19
  import Heading from '@theme/Heading';
20
20
  // Very simple pluralization: probably good enough for now
21
21
  function useNDocsTaggedPlural() {
@@ -14,23 +14,20 @@ import {
14
14
  import Layout from '@theme/Layout';
15
15
  import MDXContent from '@theme/MDXContent';
16
16
  import TOC from '@theme/TOC';
17
- import Unlisted from '@theme/Unlisted';
17
+ import ContentVisibility from '@theme/ContentVisibility';
18
18
  import EditMetaRow from '@theme/EditMetaRow';
19
19
  import styles from './styles.module.css';
20
20
  export default function MDXPage(props) {
21
21
  const {content: MDXPageContent} = props;
22
+ const {metadata, assets} = MDXPageContent;
22
23
  const {
23
- metadata: {
24
- title,
25
- editUrl,
26
- description,
27
- frontMatter,
28
- unlisted,
29
- lastUpdatedBy,
30
- lastUpdatedAt,
31
- },
32
- assets,
33
- } = MDXPageContent;
24
+ title,
25
+ editUrl,
26
+ description,
27
+ frontMatter,
28
+ lastUpdatedBy,
29
+ lastUpdatedAt,
30
+ } = metadata;
34
31
  const {
35
32
  keywords,
36
33
  wrapperClassName,
@@ -54,7 +51,7 @@ export default function MDXPage(props) {
54
51
  <main className="container container--fluid margin-vert--lg">
55
52
  <div className={clsx('row', styles.mdxPageWrapper)}>
56
53
  <div className={clsx('col', !hideTableOfContents && 'col--8')}>
57
- {unlisted && <Unlisted />}
54
+ <ContentVisibility metadata={metadata} />
58
55
  <article>
59
56
  <MDXContent>
60
57
  <MDXPageContent />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-6016",
3
+ "version": "0.0.0-6019",
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-6016",
24
- "@docusaurus/mdx-loader": "0.0.0-6016",
25
- "@docusaurus/module-type-aliases": "0.0.0-6016",
26
- "@docusaurus/plugin-content-blog": "0.0.0-6016",
27
- "@docusaurus/plugin-content-docs": "0.0.0-6016",
28
- "@docusaurus/plugin-content-pages": "0.0.0-6016",
29
- "@docusaurus/theme-common": "0.0.0-6016",
30
- "@docusaurus/theme-translations": "0.0.0-6016",
31
- "@docusaurus/types": "0.0.0-6016",
32
- "@docusaurus/utils": "0.0.0-6016",
33
- "@docusaurus/utils-common": "0.0.0-6016",
34
- "@docusaurus/utils-validation": "0.0.0-6016",
23
+ "@docusaurus/core": "0.0.0-6019",
24
+ "@docusaurus/mdx-loader": "0.0.0-6019",
25
+ "@docusaurus/module-type-aliases": "0.0.0-6019",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-6019",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-6019",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-6019",
29
+ "@docusaurus/theme-common": "0.0.0-6019",
30
+ "@docusaurus/theme-translations": "0.0.0-6019",
31
+ "@docusaurus/types": "0.0.0-6019",
32
+ "@docusaurus/utils": "0.0.0-6019",
33
+ "@docusaurus/utils-common": "0.0.0-6019",
34
+ "@docusaurus/utils-validation": "0.0.0-6019",
35
35
  "@mdx-js/react": "^3.0.0",
36
36
  "clsx": "^2.0.0",
37
37
  "copy-text-to-clipboard": "^3.2.0",
@@ -61,5 +61,5 @@
61
61
  "engines": {
62
62
  "node": ">=18.0"
63
63
  },
64
- "gitHead": "c51435db0c58b94667da1c745f1635de65240c63"
64
+ "gitHead": "9b3ca6607004589c61b00374dcf694bdbee1c844"
65
65
  }
@@ -18,8 +18,8 @@ import BlogPostPaginator from '@theme/BlogPostPaginator';
18
18
  import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
19
19
  import BlogPostPageStructuredData from '@theme/BlogPostPage/StructuredData';
20
20
  import TOC from '@theme/TOC';
21
+ import ContentVisibility from '@theme/ContentVisibility';
21
22
  import type {Props} from '@theme/BlogPostPage';
22
- import Unlisted from '@theme/Unlisted';
23
23
  import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
24
24
 
25
25
  function BlogPostPageContent({
@@ -30,7 +30,7 @@ function BlogPostPageContent({
30
30
  children: ReactNode;
31
31
  }): JSX.Element {
32
32
  const {metadata, toc} = useBlogPost();
33
- const {nextItem, prevItem, frontMatter, unlisted} = metadata;
33
+ const {nextItem, prevItem, frontMatter} = metadata;
34
34
  const {
35
35
  hide_table_of_contents: hideTableOfContents,
36
36
  toc_min_heading_level: tocMinHeadingLevel,
@@ -48,7 +48,7 @@ function BlogPostPageContent({
48
48
  />
49
49
  ) : undefined
50
50
  }>
51
- {unlisted && <Unlisted />}
51
+ <ContentVisibility metadata={metadata} />
52
52
 
53
53
  <BlogPostItem>{children}</BlogPostItem>
54
54
 
@@ -20,7 +20,7 @@ import BlogListPaginator from '@theme/BlogListPaginator';
20
20
  import SearchMetadata from '@theme/SearchMetadata';
21
21
  import type {Props} from '@theme/BlogTagsPostsPage';
22
22
  import BlogPostItems from '@theme/BlogPostItems';
23
- import Unlisted from '@theme/Unlisted';
23
+ import Unlisted from '@theme/ContentVisibility/Unlisted';
24
24
  import Heading from '@theme/Heading';
25
25
 
26
26
  function BlogTagsPostsPageMetadata({tag}: Props): JSX.Element {
@@ -0,0 +1,27 @@
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
+ ThemeClassNames,
12
+ DraftBannerTitle,
13
+ DraftBannerMessage,
14
+ } from '@docusaurus/theme-common';
15
+ import Admonition from '@theme/Admonition';
16
+ import type {Props} from '@theme/ContentVisibility/Draft';
17
+
18
+ export default function Draft({className}: Props): JSX.Element | null {
19
+ return (
20
+ <Admonition
21
+ type="caution"
22
+ title={<DraftBannerTitle />}
23
+ className={clsx(className, ThemeClassNames.common.draftBanner)}>
24
+ <DraftBannerMessage />
25
+ </Admonition>
26
+ );
27
+ }
@@ -14,7 +14,7 @@ import {
14
14
  UnlistedMetadata,
15
15
  } from '@docusaurus/theme-common';
16
16
  import Admonition from '@theme/Admonition';
17
- import type {Props} from '@theme/Unlisted';
17
+ import type {Props} from '@theme/ContentVisibility/Unlisted';
18
18
 
19
19
  function UnlistedBanner({className}: Props) {
20
20
  return (
@@ -0,0 +1,27 @@
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
+
10
+ import type {Props} from '@theme/ContentVisibility';
11
+ import Draft from '@theme/ContentVisibility/Draft';
12
+ import Unlisted from '@theme/ContentVisibility/Unlisted';
13
+
14
+ export default function ContentVisibility({
15
+ metadata,
16
+ }: Props): JSX.Element | null {
17
+ const {unlisted, frontMatter} = metadata;
18
+ // Reading draft/unlisted status from frontMatter is useful to display
19
+ // the banners in dev mode (in dev, metadata.unlisted is always false)
20
+ // See https://github.com/facebook/docusaurus/issues/8285
21
+ return (
22
+ <>
23
+ {(unlisted || frontMatter.unlisted) && <Unlisted />}
24
+ {frontMatter.draft && <Draft />}
25
+ </>
26
+ );
27
+ }
@@ -17,7 +17,7 @@ import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
17
17
  import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
18
18
  import DocItemContent from '@theme/DocItem/Content';
19
19
  import DocBreadcrumbs from '@theme/DocBreadcrumbs';
20
- import Unlisted from '@theme/Unlisted';
20
+ import ContentVisibility from '@theme/ContentVisibility';
21
21
  import type {Props} from '@theme/DocItem/Layout';
22
22
 
23
23
  import styles from './styles.module.css';
@@ -48,13 +48,11 @@ function useDocTOC() {
48
48
 
49
49
  export default function DocItemLayout({children}: Props): JSX.Element {
50
50
  const docTOC = useDocTOC();
51
- const {
52
- metadata: {unlisted},
53
- } = useDoc();
51
+ const {metadata} = useDoc();
54
52
  return (
55
53
  <div className="row">
56
54
  <div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
57
- {unlisted && <Unlisted />}
55
+ <ContentVisibility metadata={metadata} />
58
56
  <DocVersionBanner />
59
57
  <div className={styles.docItemContainer}>
60
58
  <article>
@@ -17,7 +17,7 @@ import {
17
17
  import Translate, {translate} from '@docusaurus/Translate';
18
18
  import SearchMetadata from '@theme/SearchMetadata';
19
19
  import type {Props} from '@theme/DocTagDocListPage';
20
- import Unlisted from '@theme/Unlisted';
20
+ import Unlisted from '@theme/ContentVisibility/Unlisted';
21
21
  import Heading from '@theme/Heading';
22
22
 
23
23
  // Very simple pluralization: probably good enough for now
@@ -15,7 +15,7 @@ import {
15
15
  import Layout from '@theme/Layout';
16
16
  import MDXContent from '@theme/MDXContent';
17
17
  import TOC from '@theme/TOC';
18
- import Unlisted from '@theme/Unlisted';
18
+ import ContentVisibility from '@theme/ContentVisibility';
19
19
  import type {Props} from '@theme/MDXPage';
20
20
 
21
21
  import EditMetaRow from '@theme/EditMetaRow';
@@ -23,18 +23,15 @@ import styles from './styles.module.css';
23
23
 
24
24
  export default function MDXPage(props: Props): JSX.Element {
25
25
  const {content: MDXPageContent} = props;
26
+ const {metadata, assets} = MDXPageContent;
26
27
  const {
27
- metadata: {
28
- title,
29
- editUrl,
30
- description,
31
- frontMatter,
32
- unlisted,
33
- lastUpdatedBy,
34
- lastUpdatedAt,
35
- },
36
- assets,
37
- } = MDXPageContent;
28
+ title,
29
+ editUrl,
30
+ description,
31
+ frontMatter,
32
+ lastUpdatedBy,
33
+ lastUpdatedAt,
34
+ } = metadata;
38
35
  const {
39
36
  keywords,
40
37
  wrapperClassName,
@@ -60,7 +57,7 @@ export default function MDXPage(props: Props): JSX.Element {
60
57
  <main className="container container--fluid margin-vert--lg">
61
58
  <div className={clsx('row', styles.mdxPageWrapper)}>
62
59
  <div className={clsx('col', !hideTableOfContents && 'col--8')}>
63
- {unlisted && <Unlisted />}
60
+ <ContentVisibility metadata={metadata} />
64
61
  <article>
65
62
  <MDXContent>
66
63
  <MDXPageContent />
@@ -1602,7 +1602,19 @@ declare module '@theme/Tag' {
1602
1602
  export default function Tag(props: Props): JSX.Element;
1603
1603
  }
1604
1604
 
1605
- declare module '@theme/Unlisted' {
1605
+ declare module '@theme/ContentVisibility' {
1606
+ export interface Props {
1607
+ readonly metadata: {
1608
+ // the visibility metadata our 3 content plugins share in common
1609
+ readonly unlisted: boolean;
1610
+ readonly frontMatter: {draft?: boolean; unlisted?: boolean};
1611
+ };
1612
+ }
1613
+
1614
+ export default function ContentVisibility(props: Props): JSX.Element;
1615
+ }
1616
+
1617
+ declare module '@theme/ContentVisibility/Unlisted' {
1606
1618
  export interface Props {
1607
1619
  className?: string;
1608
1620
  }
@@ -1610,6 +1622,14 @@ declare module '@theme/Unlisted' {
1610
1622
  export default function Unlisted(props: Props): JSX.Element;
1611
1623
  }
1612
1624
 
1625
+ declare module '@theme/ContentVisibility/Draft' {
1626
+ export interface Props {
1627
+ className?: string;
1628
+ }
1629
+
1630
+ export default function Draft(props: Props): JSX.Element;
1631
+ }
1632
+
1613
1633
  declare module '@theme/prism-include-languages' {
1614
1634
  import type * as PrismNamespace from 'prismjs';
1615
1635