@docusaurus/theme-classic 0.0.0-5042 → 0.0.0-5047

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
@@ -131,7 +131,7 @@ function themeClassic(context, options) {
131
131
  const plugin = {
132
132
  postcssPlugin: 'RtlCssPlugin',
133
133
  prepare: (result) => {
134
- const file = result.root?.source?.input?.file;
134
+ const file = result.root.source?.input.file;
135
135
  // Skip Infima as we are using the its RTL version.
136
136
  if (file === resolvedInfimaFile) {
137
137
  return {};
@@ -46,7 +46,7 @@ export default function CodeBlockString({
46
46
  magicComments,
47
47
  });
48
48
  const showLineNumbers =
49
- showLineNumbersProp || containsLineNumbers(metastring);
49
+ showLineNumbersProp ?? containsLineNumbers(metastring);
50
50
  return (
51
51
  <Container
52
52
  as="div"
@@ -15,7 +15,7 @@ export default function DocSidebarItemHtml({item, level, index}) {
15
15
  className={clsx(
16
16
  ThemeClassNames.docs.docSidebarItemLink,
17
17
  ThemeClassNames.docs.docSidebarItemLinkLevel(level),
18
- defaultStyle && `${styles.menuHtmlItem} menu__list-item`,
18
+ defaultStyle && [styles.menuHtmlItem, 'menu__list-item'],
19
19
  className,
20
20
  )}
21
21
  key={index}
@@ -15,7 +15,7 @@ function ColumnLinkItem({item}) {
15
15
  dangerouslySetInnerHTML={{__html: item.html}}
16
16
  />
17
17
  ) : (
18
- <li key={item.href || item.to} className="footer__item">
18
+ <li key={item.href ?? item.to} className="footer__item">
19
19
  <LinkItem item={item} />
20
20
  </li>
21
21
  );
@@ -5,64 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Joi } from '@docusaurus/utils-validation';
8
- import type { ThemeConfig, ThemeConfigValidationContext } from '@docusaurus/types';
9
- export declare const DEFAULT_CONFIG: {
10
- colorMode: {
11
- defaultMode: string;
12
- disableSwitch: boolean;
13
- respectPrefersColorScheme: boolean;
14
- };
15
- docs: {
16
- versionPersistence: string;
17
- sidebar: {
18
- hideable: boolean;
19
- autoCollapseCategories: boolean;
20
- };
21
- };
22
- metadata: never[];
23
- prism: {
24
- additionalLanguages: never[];
25
- theme: {
26
- plain: {
27
- [styleKey: string]: string | number | void;
28
- color?: string | undefined;
29
- backgroundColor?: string | undefined;
30
- fontStyle?: "normal" | "italic" | undefined;
31
- fontWeight?: "bold" | "normal" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
32
- textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
33
- opacity?: number | undefined;
34
- };
35
- styles: {
36
- types: string[];
37
- style: {
38
- [styleKey: string]: string | number | void;
39
- color?: string | undefined;
40
- backgroundColor?: string | undefined;
41
- fontStyle?: "normal" | "italic" | undefined;
42
- fontWeight?: "bold" | "normal" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
43
- textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
44
- opacity?: number | undefined;
45
- };
46
- languages?: ("markup" | "bash" | "clike" | "c" | "cpp" | "css" | "javascript" | "jsx" | "coffeescript" | "actionscript" | "css-extr" | "diff" | "git" | "go" | "graphql" | "handlebars" | "json" | "less" | "makefile" | "markdown" | "objectivec" | "ocaml" | "python" | "reason" | "sass" | "scss" | "sql" | "stylus" | "tsx" | "typescript" | "wasm" | "yaml")[] | undefined;
47
- }[];
48
- };
49
- magicComments: {
50
- className: string;
51
- line: string;
52
- block: {
53
- start: string;
54
- end: string;
55
- };
56
- }[];
57
- };
58
- navbar: {
59
- hideOnScroll: boolean;
60
- items: never[];
61
- };
62
- tableOfContents: {
63
- minHeadingLevel: number;
64
- maxHeadingLevel: number;
65
- };
66
- };
67
- export declare const ThemeConfigSchema: Joi.ObjectSchema<any>;
8
+ import type { ThemeConfig } from '@docusaurus/theme-common';
9
+ import type { ThemeConfigValidationContext } from '@docusaurus/types';
10
+ export declare const DEFAULT_CONFIG: ThemeConfig;
11
+ export declare const ThemeConfigSchema: Joi.ObjectSchema<ThemeConfig>;
68
12
  export declare function validateThemeConfig({ validate, themeConfig, }: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig;
@@ -269,6 +269,7 @@ const CustomCssSchema = utils_validation_1.Joi.alternatives()
269
269
  .optional();
270
270
  exports.ThemeConfigSchema = utils_validation_1.Joi.object({
271
271
  // TODO temporary (@alpha-58)
272
+ // @ts-expect-error: forbidden
272
273
  disableDarkMode: utils_validation_1.Joi.any().forbidden().messages({
273
274
  'any.unknown': 'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true',
274
275
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5042",
3
+ "version": "0.0.0-5047",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,15 +20,15 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "0.0.0-5042",
24
- "@docusaurus/plugin-content-blog": "0.0.0-5042",
25
- "@docusaurus/plugin-content-docs": "0.0.0-5042",
26
- "@docusaurus/plugin-content-pages": "0.0.0-5042",
27
- "@docusaurus/theme-common": "0.0.0-5042",
28
- "@docusaurus/theme-translations": "0.0.0-5042",
29
- "@docusaurus/utils": "0.0.0-5042",
30
- "@docusaurus/utils-common": "0.0.0-5042",
31
- "@docusaurus/utils-validation": "0.0.0-5042",
23
+ "@docusaurus/core": "0.0.0-5047",
24
+ "@docusaurus/plugin-content-blog": "0.0.0-5047",
25
+ "@docusaurus/plugin-content-docs": "0.0.0-5047",
26
+ "@docusaurus/plugin-content-pages": "0.0.0-5047",
27
+ "@docusaurus/theme-common": "0.0.0-5047",
28
+ "@docusaurus/theme-translations": "0.0.0-5047",
29
+ "@docusaurus/utils": "0.0.0-5047",
30
+ "@docusaurus/utils-common": "0.0.0-5047",
31
+ "@docusaurus/utils-validation": "0.0.0-5047",
32
32
  "@mdx-js/react": "^1.6.22",
33
33
  "clsx": "^1.1.1",
34
34
  "copy-text-to-clipboard": "^3.0.1",
@@ -43,8 +43,8 @@
43
43
  "tslib": "^2.4.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@docusaurus/module-type-aliases": "0.0.0-5042",
47
- "@docusaurus/types": "0.0.0-5042",
46
+ "@docusaurus/module-type-aliases": "0.0.0-5047",
47
+ "@docusaurus/types": "0.0.0-5047",
48
48
  "@types/mdx-js__react": "^1.5.5",
49
49
  "@types/nprogress": "^0.2.0",
50
50
  "@types/prismjs": "^1.26.0",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=14"
62
62
  },
63
- "gitHead": "af5fa0b311db8cf3934d437d74435966eb456c38"
63
+ "gitHead": "67ac297469d98ac3eb8482d8636aee4648586f33"
64
64
  }
package/src/index.ts CHANGED
@@ -177,7 +177,7 @@ export default function themeClassic(
177
177
  const plugin: PostCssPlugin = {
178
178
  postcssPlugin: 'RtlCssPlugin',
179
179
  prepare: (result) => {
180
- const file = result.root?.source?.input?.file;
180
+ const file = result.root.source?.input.file;
181
181
  // Skip Infima as we are using the its RTL version.
182
182
  if (file === resolvedInfimaFile) {
183
183
  return {};
@@ -52,7 +52,7 @@ export default function CodeBlockString({
52
52
  magicComments,
53
53
  });
54
54
  const showLineNumbers =
55
- showLineNumbersProp || containsLineNumbers(metastring);
55
+ showLineNumbersProp ?? containsLineNumbers(metastring);
56
56
 
57
57
  return (
58
58
  <Container
@@ -23,7 +23,7 @@ export default function DocSidebarItemHtml({
23
23
  className={clsx(
24
24
  ThemeClassNames.docs.docSidebarItemLink,
25
25
  ThemeClassNames.docs.docSidebarItemLinkLevel(level),
26
- defaultStyle && `${styles.menuHtmlItem} menu__list-item`,
26
+ defaultStyle && [styles.menuHtmlItem, 'menu__list-item'],
27
27
  className,
28
28
  )}
29
29
  key={index}
@@ -21,7 +21,7 @@ function ColumnLinkItem({item}: {item: ColumnItemType}) {
21
21
  dangerouslySetInnerHTML={{__html: item.html}}
22
22
  />
23
23
  ) : (
24
- <li key={item.href || item.to} className="footer__item">
24
+ <li key={item.href ?? item.to} className="footer__item">
25
25
  <LinkItem item={item} />
26
26
  </li>
27
27
  );
@@ -21,12 +21,14 @@
21
21
  // in their tsconfig.
22
22
 
23
23
  declare module '@docusaurus/theme-classic' {
24
- import type {LoadContext, Plugin} from '@docusaurus/types';
24
+ import type {LoadContext, Plugin, PluginModule} from '@docusaurus/types';
25
25
 
26
26
  export type Options = {
27
27
  customCss?: string | string[];
28
28
  };
29
29
 
30
+ export const getSwizzleConfig: PluginModule['getSwizzleConfig'];
31
+
30
32
  export default function themeClassic(
31
33
  context: LoadContext,
32
34
  options: Options,
@@ -7,12 +7,10 @@
7
7
 
8
8
  import defaultPrismTheme from 'prism-react-renderer/themes/palenight';
9
9
  import {Joi, URISchema} from '@docusaurus/utils-validation';
10
- import type {
11
- ThemeConfig,
12
- ThemeConfigValidationContext,
13
- } from '@docusaurus/types';
10
+ import type {ThemeConfig} from '@docusaurus/theme-common';
11
+ import type {ThemeConfigValidationContext} from '@docusaurus/types';
14
12
 
15
- const DEFAULT_DOCS_CONFIG = {
13
+ const DEFAULT_DOCS_CONFIG: ThemeConfig['docs'] = {
16
14
  versionPersistence: 'localStorage',
17
15
  sidebar: {
18
16
  hideable: false,
@@ -31,13 +29,13 @@ const DocsSchema = Joi.object({
31
29
  }).default(DEFAULT_DOCS_CONFIG.sidebar),
32
30
  }).default(DEFAULT_DOCS_CONFIG);
33
31
 
34
- const DEFAULT_COLOR_MODE_CONFIG = {
32
+ const DEFAULT_COLOR_MODE_CONFIG: ThemeConfig['colorMode'] = {
35
33
  defaultMode: 'light',
36
34
  disableSwitch: false,
37
35
  respectPrefersColorScheme: false,
38
36
  };
39
37
 
40
- export const DEFAULT_CONFIG = {
38
+ export const DEFAULT_CONFIG: ThemeConfig = {
41
39
  colorMode: DEFAULT_COLOR_MODE_CONFIG,
42
40
  docs: DEFAULT_DOCS_CONFIG,
43
41
  metadata: [],
@@ -301,8 +299,9 @@ const CustomCssSchema = Joi.alternatives()
301
299
  .try(Joi.array().items(Joi.string().required()), Joi.string().required())
302
300
  .optional();
303
301
 
304
- export const ThemeConfigSchema = Joi.object({
302
+ export const ThemeConfigSchema = Joi.object<ThemeConfig>({
305
303
  // TODO temporary (@alpha-58)
304
+ // @ts-expect-error: forbidden
306
305
  disableDarkMode: Joi.any().forbidden().messages({
307
306
  'any.unknown':
308
307
  'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true',