@docusaurus/theme-classic 0.0.0-4281 → 0.0.0-4282

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.
Files changed (147) hide show
  1. package/lib/theme-classic.d.ts +3 -1
  2. package/package.json +12 -12
  3. package/src/index.ts +2 -5
  4. package/src/theme-classic.d.ts +3 -1
  5. package/babel.config.js +0 -35
  6. package/lib/__tests__/__snapshots__/translations.test.ts.snap +0 -116
  7. package/lib/__tests__/translations.test.js +0 -112
  8. package/lib/__tests__/validateThemeConfig.test.js +0 -607
  9. package/lib/theme/AnnouncementBar/index.js +0 -68
  10. package/lib/theme/AnnouncementBar/styles.module.css +0 -63
  11. package/lib/theme/BackToTopButton/index.js +0 -140
  12. package/lib/theme/BackToTopButton/styles.module.css +0 -42
  13. package/lib/theme/BlogArchivePage/index.js +0 -89
  14. package/lib/theme/BlogLayout/index.js +0 -51
  15. package/lib/theme/BlogListPage/index.js +0 -60
  16. package/lib/theme/BlogListPaginator/index.js +0 -63
  17. package/lib/theme/BlogPostAuthor/index.js +0 -51
  18. package/lib/theme/BlogPostAuthor/styles.module.css +0 -12
  19. package/lib/theme/BlogPostAuthors/index.js +0 -47
  20. package/lib/theme/BlogPostAuthors/styles.module.css +0 -11
  21. package/lib/theme/BlogPostItem/index.js +0 -152
  22. package/lib/theme/BlogPostItem/styles.module.css +0 -18
  23. package/lib/theme/BlogPostPage/index.js +0 -82
  24. package/lib/theme/BlogPostPaginator/index.js +0 -64
  25. package/lib/theme/BlogSidebar/index.js +0 -49
  26. package/lib/theme/BlogSidebar/styles.module.css +0 -44
  27. package/lib/theme/BlogTagsListPage/index.js +0 -40
  28. package/lib/theme/BlogTagsPostsPage/index.js +0 -86
  29. package/lib/theme/CodeBlock/index.js +0 -133
  30. package/lib/theme/CodeBlock/styles.module.css +0 -65
  31. package/lib/theme/Details/index.js +0 -30
  32. package/lib/theme/Details/styles.module.css +0 -13
  33. package/lib/theme/DocCard/index.js +0 -84
  34. package/lib/theme/DocCard/styles.module.css +0 -43
  35. package/lib/theme/DocCardList/index.js +0 -28
  36. package/lib/theme/DocCategoryGeneratedIndexPage/index.js +0 -57
  37. package/lib/theme/DocCategoryGeneratedIndexPage/styles.module.css +0 -18
  38. package/lib/theme/DocItem/index.js +0 -112
  39. package/lib/theme/DocItem/styles.module.css +0 -22
  40. package/lib/theme/DocItemFooter/index.js +0 -79
  41. package/lib/theme/DocItemFooter/styles.module.css +0 -18
  42. package/lib/theme/DocPage/index.js +0 -154
  43. package/lib/theme/DocPage/styles.module.css +0 -85
  44. package/lib/theme/DocPaginator/index.js +0 -62
  45. package/lib/theme/DocSidebar/index.js +0 -134
  46. package/lib/theme/DocSidebar/styles.module.css +0 -106
  47. package/lib/theme/DocSidebarItem/index.js +0 -209
  48. package/lib/theme/DocSidebarItem/styles.module.css +0 -19
  49. package/lib/theme/DocTagDocListPage/index.js +0 -89
  50. package/lib/theme/DocTagsListPage/index.js +0 -44
  51. package/lib/theme/DocVersionBadge/index.js +0 -34
  52. package/lib/theme/DocVersionBanner/index.js +0 -130
  53. package/lib/theme/EditThisPage/index.js +0 -33
  54. package/lib/theme/ErrorPageContent.js +0 -43
  55. package/lib/theme/Footer/index.js +0 -119
  56. package/lib/theme/Footer/styles.module.css +0 -15
  57. package/lib/theme/Heading/index.js +0 -71
  58. package/lib/theme/Heading/styles.css +0 -22
  59. package/lib/theme/Heading/styles.module.css +0 -19
  60. package/lib/theme/IconArrow/index.js +0 -28
  61. package/lib/theme/IconClose/index.js +0 -31
  62. package/lib/theme/IconEdit/index.js +0 -34
  63. package/lib/theme/IconEdit/styles.module.css +0 -11
  64. package/lib/theme/IconExternalLink/index.js +0 -30
  65. package/lib/theme/IconExternalLink/styles.module.css +0 -12
  66. package/lib/theme/IconLanguage/index.js +0 -29
  67. package/lib/theme/IconMenu/index.js +0 -30
  68. package/lib/theme/LastUpdated/index.js +0 -63
  69. package/lib/theme/Layout/index.js +0 -68
  70. package/lib/theme/Layout/styles.css +0 -27
  71. package/lib/theme/LayoutHead/index.js +0 -149
  72. package/lib/theme/LayoutProviders/index.js +0 -40
  73. package/lib/theme/Logo/index.js +0 -62
  74. package/lib/theme/MDXComponents/index.js +0 -106
  75. package/lib/theme/MDXComponents/styles.css +0 -11
  76. package/lib/theme/MDXPage/index.js +0 -67
  77. package/lib/theme/MDXPage/styles.module.css +0 -10
  78. package/lib/theme/Navbar/index.js +0 -267
  79. package/lib/theme/Navbar/styles.module.css +0 -27
  80. package/lib/theme/NavbarItem/DefaultNavbarItem.js +0 -113
  81. package/lib/theme/NavbarItem/DocNavbarItem.js +0 -62
  82. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +0 -83
  83. package/lib/theme/NavbarItem/DocsVersionNavbarItem.js +0 -43
  84. package/lib/theme/NavbarItem/DropdownNavbarItem.js +0 -154
  85. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +0 -68
  86. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +0 -11
  87. package/lib/theme/NavbarItem/SearchNavbarItem.js +0 -28
  88. package/lib/theme/NavbarItem/index.js +0 -74
  89. package/lib/theme/NotFound.js +0 -57
  90. package/lib/theme/SearchBar.js +0 -15
  91. package/lib/theme/SearchMetadata/index.js +0 -33
  92. package/lib/theme/Seo/index.js +0 -52
  93. package/lib/theme/SkipToContent/index.js +0 -71
  94. package/lib/theme/SkipToContent/styles.module.css +0 -14
  95. package/lib/theme/TOC/index.js +0 -39
  96. package/lib/theme/TOC/styles.module.css +0 -23
  97. package/lib/theme/TOCCollapsible/index.js +0 -53
  98. package/lib/theme/TOCCollapsible/styles.module.css +0 -50
  99. package/lib/theme/TOCInline/index.js +0 -33
  100. package/lib/theme/TOCInline/styles.module.css +0 -12
  101. package/lib/theme/TOCItems/index.js +0 -78
  102. package/lib/theme/TabItem/index.js +0 -32
  103. package/lib/theme/Tabs/__tests__/index.test.js +0 -123
  104. package/lib/theme/Tabs/index.js +0 -173
  105. package/lib/theme/Tabs/styles.module.css +0 -10
  106. package/lib/theme/Tag/index.js +0 -40
  107. package/lib/theme/Tag/styles.module.css +0 -70
  108. package/lib/theme/TagsListByLetter/index.js +0 -48
  109. package/lib/theme/TagsListByLetter/styles.module.css +0 -11
  110. package/lib/theme/TagsListInline/index.js +0 -44
  111. package/lib/theme/TagsListInline/styles.module.css +0 -15
  112. package/lib/theme/ThemeContext.js +0 -21
  113. package/lib/theme/ThemeProvider/index.js +0 -43
  114. package/lib/theme/ThemedImage/index.js +0 -47
  115. package/lib/theme/ThemedImage/styles.module.css +0 -18
  116. package/lib/theme/Toggle/index.js +0 -91
  117. package/lib/theme/Toggle/styles.module.css +0 -105
  118. package/lib/theme/UserPreferencesContext.js +0 -18
  119. package/lib/theme/UserPreferencesProvider/index.js +0 -41
  120. package/lib/theme/hooks/styles.css +0 -10
  121. package/lib/theme/hooks/useDocs.js +0 -18
  122. package/lib/theme/hooks/useHideableNavbar.js +0 -74
  123. package/lib/theme/hooks/useKeyboardNavigation.js +0 -45
  124. package/lib/theme/hooks/useLockBodyScroll.js +0 -26
  125. package/lib/theme/hooks/usePrismTheme.js +0 -36
  126. package/lib/theme/hooks/useTabGroupChoice.js +0 -51
  127. package/lib/theme/hooks/useTheme.js +0 -97
  128. package/lib/theme/hooks/useThemeContext.js +0 -31
  129. package/lib/theme/hooks/useUserPreferencesContext.js +0 -31
  130. package/lib/theme/hooks/useWindowSize.js +0 -68
  131. package/lib/theme/prism-include-languages.js +0 -40
  132. package/lib-next/__tests__/__snapshots__/translations.test.ts.snap +0 -116
  133. package/lib-next/__tests__/translations.test.js +0 -128
  134. package/lib-next/__tests__/validateThemeConfig.test.js +0 -607
  135. package/lib-next/admonitions.css +0 -35
  136. package/lib-next/deps.d.ts +0 -13
  137. package/lib-next/index.js +0 -227
  138. package/lib-next/prism-include-languages.js +0 -9
  139. package/lib-next/theme-classic.d.ts +0 -794
  140. package/lib-next/translations.js +0 -141
  141. package/lib-next/types.d.ts +0 -11
  142. package/lib-next/validateThemeConfig.js +0 -344
  143. package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -116
  144. package/src/__tests__/translations.test.ts +0 -116
  145. package/src/__tests__/validateThemeConfig.test.js +0 -607
  146. package/src/theme/Tabs/__tests__/index.test.tsx +0 -129
  147. package/tsconfig.json +0 -11
@@ -6,7 +6,9 @@
6
6
  */
7
7
 
8
8
  declare module '@docusaurus/theme-classic' {
9
- export type Options = Partial<import('./index').PluginOptions>;
9
+ export type Options = {
10
+ customCss?: string | string[];
11
+ };
10
12
  }
11
13
 
12
14
  declare module '@theme/AnnouncementBar' {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4281",
3
+ "version": "0.0.0-4282",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -23,14 +23,14 @@
23
23
  "update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
24
24
  },
25
25
  "dependencies": {
26
- "@docusaurus/core": "0.0.0-4281",
27
- "@docusaurus/plugin-content-blog": "0.0.0-4281",
28
- "@docusaurus/plugin-content-docs": "0.0.0-4281",
29
- "@docusaurus/plugin-content-pages": "0.0.0-4281",
30
- "@docusaurus/theme-common": "0.0.0-4281",
31
- "@docusaurus/theme-translations": "0.0.0-4281",
32
- "@docusaurus/utils": "0.0.0-4281",
33
- "@docusaurus/utils-validation": "0.0.0-4281",
26
+ "@docusaurus/core": "0.0.0-4282",
27
+ "@docusaurus/plugin-content-blog": "0.0.0-4282",
28
+ "@docusaurus/plugin-content-docs": "0.0.0-4282",
29
+ "@docusaurus/plugin-content-pages": "0.0.0-4282",
30
+ "@docusaurus/theme-common": "0.0.0-4282",
31
+ "@docusaurus/theme-translations": "0.0.0-4282",
32
+ "@docusaurus/utils": "0.0.0-4282",
33
+ "@docusaurus/utils-validation": "0.0.0-4282",
34
34
  "@mdx-js/mdx": "^1.6.21",
35
35
  "@mdx-js/react": "^1.6.21",
36
36
  "chalk": "^4.1.2",
@@ -46,8 +46,8 @@
46
46
  "rtlcss": "^3.3.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@docusaurus/module-type-aliases": "0.0.0-4281",
50
- "@docusaurus/types": "0.0.0-4281",
49
+ "@docusaurus/module-type-aliases": "0.0.0-4282",
50
+ "@docusaurus/types": "0.0.0-4282",
51
51
  "@types/mdx-js__react": "^1.5.4",
52
52
  "@types/parse-numeric-range": "^0.0.1",
53
53
  "@types/rtlcss": "^3.1.1",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=14"
64
64
  },
65
- "gitHead": "a0020d6db26fec01f5205ba5920bd6a90e4c6c1a"
65
+ "gitHead": "68b81527266ab2384915b60f4f58640d76f759cb"
66
66
  }
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ import {createRequire} from 'module';
13
13
  import type {Plugin as PostCssPlugin} from 'postcss';
14
14
  import rtlcss from 'rtlcss';
15
15
  import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
16
+ import type {Options} from '@docusaurus/theme-classic';
16
17
 
17
18
  const requireFromDocusaurusCore = createRequire(
18
19
  require.resolve('@docusaurus/core/package.json'),
@@ -89,13 +90,9 @@ function getInfimaCSSFile(direction: string) {
89
90
  }.css`;
90
91
  }
91
92
 
92
- export type PluginOptions = {
93
- customCss?: string | string[];
94
- };
95
-
96
93
  export default function docusaurusThemeClassic(
97
94
  context: DocusaurusContext, // TODO: LoadContext is missing some of properties
98
- options: PluginOptions,
95
+ options: Options,
99
96
  ): Plugin<void> {
100
97
  const {
101
98
  siteConfig: {themeConfig: roughlyTypedThemeConfig},
@@ -6,7 +6,9 @@
6
6
  */
7
7
 
8
8
  declare module '@docusaurus/theme-classic' {
9
- export type Options = Partial<import('./index').PluginOptions>;
9
+ export type Options = {
10
+ customCss?: string | string[];
11
+ };
10
12
  }
11
13
 
12
14
  declare module '@theme/AnnouncementBar' {
package/babel.config.js DELETED
@@ -1,35 +0,0 @@
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
- module.exports = {
9
- env: {
10
- // USED FOR NODE/RUNTIME
11
- // maybe we should differenciate both cases because
12
- // we mostly need to transpile some features so that node does not crash...
13
- lib: {
14
- presets: [
15
- ['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
16
- ],
17
- // Useful to transpile for older node versions
18
- plugins: [
19
- '@babel/plugin-transform-modules-commonjs',
20
- '@babel/plugin-proposal-nullish-coalescing-operator',
21
- '@babel/plugin-proposal-optional-chaining',
22
- ],
23
- },
24
-
25
- // USED FOR JS SWIZZLE
26
- // /lib-next folder is used as source to swizzle JS source code
27
- // This JS code is created from TS source code
28
- // This source code should look clean/human readable to be usable
29
- 'lib-next': {
30
- presets: [
31
- ['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
32
- ],
33
- },
34
- },
35
- };
@@ -1,116 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`getTranslationFiles should return translation files matching snapshot 1`] = `
4
- Array [
5
- Object {
6
- "content": Object {
7
- "item.label.Dropdown": Object {
8
- "description": "Navbar item with label Dropdown",
9
- "message": "Dropdown",
10
- },
11
- "item.label.Dropdown item 1": Object {
12
- "description": "Navbar item with label Dropdown item 1",
13
- "message": "Dropdown item 1",
14
- },
15
- "item.label.Dropdown item 2": Object {
16
- "description": "Navbar item with label Dropdown item 2",
17
- "message": "Dropdown item 2",
18
- },
19
- "title": Object {
20
- "description": "The title in the navbar",
21
- "message": "navbar title",
22
- },
23
- },
24
- "path": "navbar",
25
- },
26
- Object {
27
- "content": Object {
28
- "copyright": Object {
29
- "description": "The footer copyright",
30
- "message": "Copyright FB",
31
- },
32
- "link.item.label.Link 1": Object {
33
- "description": "The label of footer link with label=Link 1 linking to https://facebook.com",
34
- "message": "Link 1",
35
- },
36
- "link.item.label.Link 2": Object {
37
- "description": "The label of footer link with label=Link 2 linking to https://facebook.com",
38
- "message": "Link 2",
39
- },
40
- "link.item.label.Link 3": Object {
41
- "description": "The label of footer link with label=Link 3 linking to https://facebook.com",
42
- "message": "Link 3",
43
- },
44
- "link.title.Footer link column 1": Object {
45
- "description": "The title of the footer links column with title=Footer link column 1 in the footer",
46
- "message": "Footer link column 1",
47
- },
48
- "link.title.Footer link column 2": Object {
49
- "description": "The title of the footer links column with title=Footer link column 2 in the footer",
50
- "message": "Footer link column 2",
51
- },
52
- },
53
- "path": "footer",
54
- },
55
- ]
56
- `;
57
-
58
- exports[`translateThemeConfig should return translated themeConfig matching snapshot 1`] = `
59
- Object {
60
- "announcementBar": Object {},
61
- "colorMode": Object {},
62
- "docs": Object {
63
- "versionPersistence": "none",
64
- },
65
- "footer": Object {
66
- "copyright": "Copyright FB (translated)",
67
- "links": Array [
68
- Object {
69
- "items": Array [
70
- Object {
71
- "label": "Link 1 (translated)",
72
- "to": "https://facebook.com",
73
- },
74
- Object {
75
- "label": "Link 2 (translated)",
76
- "to": "https://facebook.com",
77
- },
78
- ],
79
- "title": "Footer link column 1 (translated)",
80
- },
81
- Object {
82
- "items": Array [
83
- Object {
84
- "label": "Link 3 (translated)",
85
- "to": "https://facebook.com",
86
- },
87
- ],
88
- "title": "Footer link column 2 (translated)",
89
- },
90
- ],
91
- "style": "light",
92
- },
93
- "hideableSidebar": true,
94
- "navbar": Object {
95
- "hideOnScroll": false,
96
- "items": Array [
97
- Object {
98
- "items": Array [
99
- Object {
100
- "items": Array [],
101
- "label": "Dropdown item 1 (translated)",
102
- },
103
- Object {
104
- "items": Array [],
105
- "label": "Dropdown item 2 (translated)",
106
- },
107
- ],
108
- "label": "Dropdown (translated)",
109
- },
110
- ],
111
- "style": "dark",
112
- "title": "navbar title (translated)",
113
- },
114
- "prism": Object {},
115
- }
116
- `;
@@ -1,112 +0,0 @@
1
- "use strict";
2
-
3
- var _translations = require("../translations");
4
-
5
- var _utils = require("@docusaurus/utils");
6
-
7
- /**
8
- * Copyright (c) Facebook, Inc. and its affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- const ThemeConfigSample = {
14
- colorMode: {},
15
- announcementBar: {},
16
- prism: {},
17
- docs: {
18
- versionPersistence: 'none'
19
- },
20
- hideableSidebar: true,
21
- navbar: {
22
- title: 'navbar title',
23
- style: 'dark',
24
- hideOnScroll: false,
25
- items: [{
26
- label: 'Dropdown',
27
- items: [{
28
- label: 'Dropdown item 1',
29
- items: []
30
- }, {
31
- label: 'Dropdown item 2',
32
- items: []
33
- }]
34
- }]
35
- },
36
- footer: {
37
- copyright: 'Copyright FB',
38
- style: 'light',
39
- links: [{
40
- title: 'Footer link column 1',
41
- items: [{
42
- label: 'Link 1',
43
- to: 'https://facebook.com'
44
- }, {
45
- label: 'Link 2',
46
- to: 'https://facebook.com'
47
- }]
48
- }, {
49
- title: 'Footer link column 2',
50
- items: [{
51
- label: 'Link 3',
52
- to: 'https://facebook.com'
53
- }]
54
- }]
55
- }
56
- };
57
-
58
- function getSampleTranslationFiles() {
59
- return (0, _translations.getTranslationFiles)({
60
- themeConfig: ThemeConfigSample
61
- });
62
- }
63
-
64
- function getSampleTranslationFilesTranslated() {
65
- const translationFiles = getSampleTranslationFiles();
66
- return translationFiles.map(translationFile => (0, _utils.updateTranslationFileMessages)(translationFile, message => `${message} (translated)`));
67
- }
68
-
69
- describe('getTranslationFiles', () => {
70
- test('should return translation files matching snapshot', () => {
71
- expect(getSampleTranslationFiles()).toMatchSnapshot();
72
- });
73
- });
74
- describe('translateThemeConfig', () => {
75
- test('should not translate anything if translation files are untranslated', () => {
76
- const translationFiles = getSampleTranslationFiles();
77
- expect((0, _translations.translateThemeConfig)({
78
- themeConfig: ThemeConfigSample,
79
- translationFiles
80
- })).toEqual(ThemeConfigSample);
81
- });
82
- test('should return translated themeConfig matching snapshot', () => {
83
- const translationFiles = getSampleTranslationFilesTranslated();
84
- expect((0, _translations.translateThemeConfig)({
85
- themeConfig: ThemeConfigSample,
86
- translationFiles
87
- })).toMatchSnapshot();
88
- });
89
- });
90
- describe('getTranslationFiles and translateThemeConfig isomorphism', () => {
91
- function verifyIsomorphism(themeConfig) {
92
- const translationFiles = (0, _translations.getTranslationFiles)({
93
- themeConfig
94
- });
95
- const translatedThemeConfig = (0, _translations.translateThemeConfig)({
96
- themeConfig,
97
- translationFiles
98
- });
99
- expect(translatedThemeConfig).toEqual(themeConfig);
100
- }
101
-
102
- test('should be verified for main sample', () => {
103
- verifyIsomorphism(ThemeConfigSample);
104
- }); // undefined footer should not make the translation code crash
105
- // See https://github.com/facebook/docusaurus/issues/3936
106
-
107
- test('should be verified for sample without footer', () => {
108
- verifyIsomorphism({ ...ThemeConfigSample,
109
- footer: undefined
110
- });
111
- });
112
- });