@docusaurus/theme-classic 3.5.1 → 3.5.2-canary-6122

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.
package/lib/index.js CHANGED
@@ -10,13 +10,10 @@ exports.validateOptions = exports.validateThemeConfig = exports.getSwizzleConfig
10
10
  exports.default = themeClassic;
11
11
  const tslib_1 = require("tslib");
12
12
  const path_1 = tslib_1.__importDefault(require("path"));
13
- const module_1 = require("module");
14
13
  const rtlcss_1 = tslib_1.__importDefault(require("rtlcss"));
15
14
  const theme_translations_1 = require("@docusaurus/theme-translations");
16
15
  const translations_1 = require("./translations");
17
16
  const inlineScripts_1 = require("./inlineScripts");
18
- const requireFromDocusaurusCore = (0, module_1.createRequire)(require.resolve('@docusaurus/core/package.json'));
19
- const ContextReplacementPlugin = requireFromDocusaurusCore('webpack/lib/ContextReplacementPlugin');
20
17
  function getInfimaCSSFile(direction) {
21
18
  return `infima/dist/css/default/default${direction === 'rtl' ? '-rtl' : ''}.css`;
22
19
  }
@@ -54,7 +51,7 @@ function themeClassic(context, options) {
54
51
  modules.push(...customCss.map((p) => path_1.default.resolve(context.siteDir, p)));
55
52
  return modules;
56
53
  },
57
- configureWebpack() {
54
+ configureWebpack(__config, __isServer, { currentBundler }) {
58
55
  const prismLanguages = additionalLanguages
59
56
  .map((lang) => `prism-${lang}`)
60
57
  .join('|');
@@ -63,7 +60,7 @@ function themeClassic(context, options) {
63
60
  // This allows better optimization by only bundling those components
64
61
  // that the user actually needs, because the modules are dynamically
65
62
  // required and can't be known during compile time.
66
- new ContextReplacementPlugin(/prismjs[\\/]components$/, new RegExp(`^./(${prismLanguages})$`)),
63
+ new currentBundler.instance.ContextReplacementPlugin(/prismjs[\\/]components$/, new RegExp(`^./(${prismLanguages})$`)),
67
64
  ],
68
65
  };
69
66
  },
@@ -70,7 +70,7 @@ export default function BlogAuthor({as, author, className, count}) {
70
70
  <AuthorName name={name} as={as} />
71
71
  </MaybeLink>
72
72
  )}
73
- {count && <AuthorBlogPostCount count={count} />}
73
+ {count !== undefined && <AuthorBlogPostCount count={count} />}
74
74
  </div>
75
75
  {!!title && <AuthorTitle title={title} />}
76
76
 
@@ -45,7 +45,7 @@
45
45
 
46
46
  .authorTitle {
47
47
  font-size: 0.8rem;
48
- line-height: 0.8rem;
48
+ line-height: 1rem;
49
49
  display: -webkit-box;
50
50
  overflow: hidden;
51
51
  line-clamp: 1;
@@ -55,12 +55,12 @@
55
55
 
56
56
  .author-as-h1 .authorTitle {
57
57
  font-size: 1.2rem;
58
- line-height: 1.2rem;
58
+ line-height: 1.6rem;
59
59
  }
60
60
 
61
61
  .author-as-h2 .authorTitle {
62
62
  font-size: 1rem;
63
- line-height: 1rem;
63
+ line-height: 1.3rem;
64
64
  }
65
65
 
66
66
  .authorBlogPostCount {
@@ -14,6 +14,7 @@ import {
14
14
  import {
15
15
  useBlogAuthorPageTitle,
16
16
  BlogAuthorsListViewAllLabel,
17
+ BlogAuthorNoPostsLabel,
17
18
  } from '@docusaurus/theme-common/internal';
18
19
  import Link from '@docusaurus/Link';
19
20
  import {useBlogMetadata} from '@docusaurus/plugin-content-blog/client';
@@ -47,9 +48,17 @@ function Content({author, items, sidebar, listMetadata}) {
47
48
  {author.description && <p>{author.description}</p>}
48
49
  <ViewAllAuthorsLink />
49
50
  </header>
50
- <hr />
51
- <BlogPostItems items={items} />
52
- <BlogListPaginator metadata={listMetadata} />
51
+ {items.length === 0 ? (
52
+ <p>
53
+ <BlogAuthorNoPostsLabel />
54
+ </p>
55
+ ) : (
56
+ <>
57
+ <hr />
58
+ <BlogPostItems items={items} />
59
+ <BlogListPaginator metadata={listMetadata} />
60
+ </>
61
+ )}
53
62
  </BlogLayout>
54
63
  );
55
64
  }
@@ -25,7 +25,7 @@ export default function BlogListPaginator(props) {
25
25
  <Translate
26
26
  id="theme.blog.paginator.newerEntries"
27
27
  description="The label used to navigate to the newer blog posts page (previous page)">
28
- Newer Entries
28
+ Newer entries
29
29
  </Translate>
30
30
  }
31
31
  />
@@ -37,7 +37,7 @@ export default function BlogListPaginator(props) {
37
37
  <Translate
38
38
  id="theme.blog.paginator.olderEntries"
39
39
  description="The label used to navigate to the older blog posts page (next page)">
40
- Older Entries
40
+ Older entries
41
41
  </Translate>
42
42
  }
43
43
  isNext
@@ -13,7 +13,7 @@ function ReadMoreLabel() {
13
13
  <Translate
14
14
  id="theme.blog.post.readMore"
15
15
  description="The label used in blog post item excerpts to link to full blog posts">
16
- Read More
16
+ Read more
17
17
  </Translate>
18
18
  </b>
19
19
  );
@@ -24,7 +24,7 @@ export default function BlogPostPaginator(props) {
24
24
  <Translate
25
25
  id="theme.blog.post.paginator.newerPost"
26
26
  description="The blog post button label to navigate to the newer/previous post">
27
- Newer Post
27
+ Newer post
28
28
  </Translate>
29
29
  }
30
30
  />
@@ -36,7 +36,7 @@ export default function BlogPostPaginator(props) {
36
36
  <Translate
37
37
  id="theme.blog.post.paginator.olderPost"
38
38
  description="The blog post button label to navigate to the older/next post">
39
- Older Post
39
+ Older post
40
40
  </Translate>
41
41
  }
42
42
  isNext
@@ -48,7 +48,8 @@ function ColorModeToggle({className, buttonClassName, value, onChange}) {
48
48
  disabled={!isBrowser}
49
49
  title={title}
50
50
  aria-label={title}
51
- aria-live="polite">
51
+ aria-live="polite"
52
+ aria-pressed={value === 'dark' ? 'true' : 'false'}>
52
53
  <IconLightMode
53
54
  className={clsx(styles.toggleIcon, styles.lightToggleIcon)}
54
55
  />
@@ -78,7 +78,7 @@ function DocTagDocListPageContent({tag, title}) {
78
78
  <Translate
79
79
  id="theme.tags.tagsPageLink"
80
80
  description="The label of the link targeting the tag list page">
81
- View All Tags
81
+ View all tags
82
82
  </Translate>
83
83
  </Link>
84
84
  </header>
@@ -8,7 +8,7 @@
8
8
  /*
9
9
  When the navbar is sticky, ensure that on anchor click,
10
10
  the browser does not scroll that anchor behind the navbar
11
- See https://twitter.com/JoshWComeau/status/1332015868725891076
11
+ See https://x.com/JoshWComeau/status/1332015868725891076
12
12
  */
13
13
  .anchorWithStickyNavbar {
14
14
  scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "3.5.1",
3
+ "version": "3.5.2-canary-6122",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,22 +20,23 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.5.1",
24
- "@docusaurus/mdx-loader": "3.5.1",
25
- "@docusaurus/module-type-aliases": "3.5.1",
26
- "@docusaurus/plugin-content-blog": "3.5.1",
27
- "@docusaurus/plugin-content-docs": "3.5.1",
28
- "@docusaurus/plugin-content-pages": "3.5.1",
29
- "@docusaurus/theme-common": "3.5.1",
30
- "@docusaurus/theme-translations": "3.5.1",
31
- "@docusaurus/types": "3.5.1",
32
- "@docusaurus/utils": "3.5.1",
33
- "@docusaurus/utils-common": "3.5.1",
34
- "@docusaurus/utils-validation": "3.5.1",
23
+ "@docusaurus/core": "3.5.2-canary-6122",
24
+ "@docusaurus/logger": "3.5.2-canary-6122",
25
+ "@docusaurus/mdx-loader": "3.5.2-canary-6122",
26
+ "@docusaurus/module-type-aliases": "3.5.2-canary-6122",
27
+ "@docusaurus/plugin-content-blog": "3.5.2-canary-6122",
28
+ "@docusaurus/plugin-content-docs": "3.5.2-canary-6122",
29
+ "@docusaurus/plugin-content-pages": "3.5.2-canary-6122",
30
+ "@docusaurus/theme-common": "3.5.2-canary-6122",
31
+ "@docusaurus/theme-translations": "3.5.2-canary-6122",
32
+ "@docusaurus/types": "3.5.2-canary-6122",
33
+ "@docusaurus/utils": "3.5.2-canary-6122",
34
+ "@docusaurus/utils-common": "3.5.2-canary-6122",
35
+ "@docusaurus/utils-validation": "3.5.2-canary-6122",
35
36
  "@mdx-js/react": "^3.0.0",
36
37
  "clsx": "^2.0.0",
37
38
  "copy-text-to-clipboard": "^3.2.0",
38
- "infima": "0.2.0-alpha.44",
39
+ "infima": "0.2.0-alpha.45",
39
40
  "lodash": "^4.17.21",
40
41
  "nprogress": "^0.2.0",
41
42
  "postcss": "^8.4.26",
@@ -61,5 +62,5 @@
61
62
  "engines": {
62
63
  "node": ">=18.0"
63
64
  },
64
- "gitHead": "5acbc57bd62f3f808ef72007cd67d4c410d13829"
65
+ "gitHead": "13455a98d6f59bad263db5629d67cbed578c4250"
65
66
  }
package/src/index.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  */
7
7
 
8
8
  import path from 'path';
9
- import {createRequire} from 'module';
10
9
  import rtlcss from 'rtlcss';
11
10
  import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
12
11
  import {getTranslationFiles, translateThemeConfig} from './translations';
@@ -19,14 +18,6 @@ import type {LoadContext, Plugin} from '@docusaurus/types';
19
18
  import type {ThemeConfig} from '@docusaurus/theme-common';
20
19
  import type {Plugin as PostCssPlugin} from 'postcss';
21
20
  import type {PluginOptions} from '@docusaurus/theme-classic';
22
- import type webpack from 'webpack';
23
-
24
- const requireFromDocusaurusCore = createRequire(
25
- require.resolve('@docusaurus/core/package.json'),
26
- );
27
- const ContextReplacementPlugin = requireFromDocusaurusCore(
28
- 'webpack/lib/ContextReplacementPlugin',
29
- ) as typeof webpack.ContextReplacementPlugin;
30
21
 
31
22
  function getInfimaCSSFile(direction: string) {
32
23
  return `infima/dist/css/default/default${
@@ -89,7 +80,7 @@ export default function themeClassic(
89
80
  return modules;
90
81
  },
91
82
 
92
- configureWebpack() {
83
+ configureWebpack(__config, __isServer, {currentBundler}) {
93
84
  const prismLanguages = additionalLanguages
94
85
  .map((lang) => `prism-${lang}`)
95
86
  .join('|');
@@ -99,7 +90,7 @@ export default function themeClassic(
99
90
  // This allows better optimization by only bundling those components
100
91
  // that the user actually needs, because the modules are dynamically
101
92
  // required and can't be known during compile time.
102
- new ContextReplacementPlugin(
93
+ new currentBundler.instance.ContextReplacementPlugin(
103
94
  /prismjs[\\/]components$/,
104
95
  new RegExp(`^./(${prismLanguages})$`),
105
96
  ),
@@ -83,7 +83,7 @@ export default function BlogAuthor({
83
83
  <AuthorName name={name} as={as} />
84
84
  </MaybeLink>
85
85
  )}
86
- {count && <AuthorBlogPostCount count={count} />}
86
+ {count !== undefined && <AuthorBlogPostCount count={count} />}
87
87
  </div>
88
88
  {!!title && <AuthorTitle title={title} />}
89
89
 
@@ -45,7 +45,7 @@
45
45
 
46
46
  .authorTitle {
47
47
  font-size: 0.8rem;
48
- line-height: 0.8rem;
48
+ line-height: 1rem;
49
49
  display: -webkit-box;
50
50
  overflow: hidden;
51
51
  line-clamp: 1;
@@ -55,12 +55,12 @@
55
55
 
56
56
  .author-as-h1 .authorTitle {
57
57
  font-size: 1.2rem;
58
- line-height: 1.2rem;
58
+ line-height: 1.6rem;
59
59
  }
60
60
 
61
61
  .author-as-h2 .authorTitle {
62
62
  font-size: 1rem;
63
- line-height: 1rem;
63
+ line-height: 1.3rem;
64
64
  }
65
65
 
66
66
  .authorBlogPostCount {
@@ -15,6 +15,7 @@ import {
15
15
  import {
16
16
  useBlogAuthorPageTitle,
17
17
  BlogAuthorsListViewAllLabel,
18
+ BlogAuthorNoPostsLabel,
18
19
  } from '@docusaurus/theme-common/internal';
19
20
  import Link from '@docusaurus/Link';
20
21
  import {useBlogMetadata} from '@docusaurus/plugin-content-blog/client';
@@ -52,9 +53,17 @@ function Content({author, items, sidebar, listMetadata}: Props): JSX.Element {
52
53
  {author.description && <p>{author.description}</p>}
53
54
  <ViewAllAuthorsLink />
54
55
  </header>
55
- <hr />
56
- <BlogPostItems items={items} />
57
- <BlogListPaginator metadata={listMetadata} />
56
+ {items.length === 0 ? (
57
+ <p>
58
+ <BlogAuthorNoPostsLabel />
59
+ </p>
60
+ ) : (
61
+ <>
62
+ <hr />
63
+ <BlogPostItems items={items} />
64
+ <BlogListPaginator metadata={listMetadata} />
65
+ </>
66
+ )}
58
67
  </BlogLayout>
59
68
  );
60
69
  }
@@ -29,7 +29,7 @@ export default function BlogListPaginator(props: Props): JSX.Element {
29
29
  <Translate
30
30
  id="theme.blog.paginator.newerEntries"
31
31
  description="The label used to navigate to the newer blog posts page (previous page)">
32
- Newer Entries
32
+ Newer entries
33
33
  </Translate>
34
34
  }
35
35
  />
@@ -41,7 +41,7 @@ export default function BlogListPaginator(props: Props): JSX.Element {
41
41
  <Translate
42
42
  id="theme.blog.paginator.olderEntries"
43
43
  description="The label used to navigate to the older blog posts page (next page)">
44
- Older Entries
44
+ Older entries
45
45
  </Translate>
46
46
  }
47
47
  isNext
@@ -16,7 +16,7 @@ function ReadMoreLabel() {
16
16
  <Translate
17
17
  id="theme.blog.post.readMore"
18
18
  description="The label used in blog post item excerpts to link to full blog posts">
19
- Read More
19
+ Read more
20
20
  </Translate>
21
21
  </b>
22
22
  );
@@ -28,7 +28,7 @@ export default function BlogPostPaginator(props: Props): JSX.Element {
28
28
  <Translate
29
29
  id="theme.blog.post.paginator.newerPost"
30
30
  description="The blog post button label to navigate to the newer/previous post">
31
- Newer Post
31
+ Newer post
32
32
  </Translate>
33
33
  }
34
34
  />
@@ -40,7 +40,7 @@ export default function BlogPostPaginator(props: Props): JSX.Element {
40
40
  <Translate
41
41
  id="theme.blog.post.paginator.olderPost"
42
42
  description="The blog post button label to navigate to the older/next post">
43
- Older Post
43
+ Older post
44
44
  </Translate>
45
45
  }
46
46
  isNext
@@ -59,7 +59,8 @@ function ColorModeToggle({
59
59
  disabled={!isBrowser}
60
60
  title={title}
61
61
  aria-label={title}
62
- aria-live="polite">
62
+ aria-live="polite"
63
+ aria-pressed={value === 'dark' ? 'true' : 'false'}>
63
64
  <IconLightMode
64
65
  className={clsx(styles.toggleIcon, styles.lightToggleIcon)}
65
66
  />
@@ -91,7 +91,7 @@ function DocTagDocListPageContent({
91
91
  <Translate
92
92
  id="theme.tags.tagsPageLink"
93
93
  description="The label of the link targeting the tag list page">
94
- View All Tags
94
+ View all tags
95
95
  </Translate>
96
96
  </Link>
97
97
  </header>
@@ -8,7 +8,7 @@
8
8
  /*
9
9
  When the navbar is sticky, ensure that on anchor click,
10
10
  the browser does not scroll that anchor behind the navbar
11
- See https://twitter.com/JoshWComeau/status/1332015868725891076
11
+ See https://x.com/JoshWComeau/status/1332015868725891076
12
12
  */
13
13
  .anchorWithStickyNavbar {
14
14
  scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);