@docusaurus/theme-classic 3.7.0-canary-6213 → 3.7.0-canary-6218

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
@@ -14,6 +14,7 @@ const rtlcss_1 = tslib_1.__importDefault(require("rtlcss"));
14
14
  const theme_translations_1 = require("@docusaurus/theme-translations");
15
15
  const translations_1 = require("./translations");
16
16
  const inlineScripts_1 = require("./inlineScripts");
17
+ const inlineSvgSprites_1 = require("./inlineSvgSprites");
17
18
  function getInfimaCSSFile(direction) {
18
19
  return `infima/dist/css/default/default${direction === 'rtl' ? '-rtl' : ''}.css`;
19
20
  }
@@ -85,6 +86,14 @@ function themeClassic(context, options) {
85
86
  injectHtmlTags() {
86
87
  return {
87
88
  preBodyTags: [
89
+ {
90
+ tagName: 'svg',
91
+ attributes: {
92
+ xmlns: 'http://www.w3.org/2000/svg',
93
+ style: 'display: none;',
94
+ },
95
+ innerHTML: inlineSvgSprites_1.SvgSpriteDefs,
96
+ },
88
97
  {
89
98
  tagName: 'script',
90
99
  innerHTML: `
@@ -0,0 +1,7 @@
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
+ export declare const SvgSpriteDefs = "<defs>\n<symbol id=\"theme-svg-external-link\" viewBox=\"0 0 24 24\"><path fill=\"currentColor\" d=\"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z\" /></symbol>\n</defs>";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SvgSpriteDefs = void 0;
10
+ // For icons that are heavily repeated in the static html output
11
+ // See also https://github.com/facebook/docusaurus/issues/5865
12
+ exports.SvgSpriteDefs = `<defs>
13
+ <symbol id="theme-svg-external-link" viewBox="0 0 24 24"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z" /></symbol>
14
+ </defs>`;
@@ -6,18 +6,17 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import styles from './styles.module.css';
9
+ // References symbol in docusaurus-theme-classic/src/inlineSvgSprites.ts
10
+ // See why: https://github.com/facebook/docusaurus/issues/5865
11
+ const svgSprite = '#theme-svg-external-link';
9
12
  export default function IconExternalLink({width = 13.5, height = 13.5}) {
10
13
  return (
11
14
  <svg
12
15
  width={width}
13
16
  height={height}
14
17
  aria-hidden="true"
15
- viewBox="0 0 24 24"
16
18
  className={styles.iconExternalLink}>
17
- <path
18
- fill="currentColor"
19
- d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"
20
- />
19
+ <use href={svgSprite} />
21
20
  </svg>
22
21
  );
23
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "3.7.0-canary-6213",
3
+ "version": "3.7.0-canary-6218",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,19 +20,19 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.7.0-canary-6213",
24
- "@docusaurus/logger": "3.7.0-canary-6213",
25
- "@docusaurus/mdx-loader": "3.7.0-canary-6213",
26
- "@docusaurus/module-type-aliases": "3.7.0-canary-6213",
27
- "@docusaurus/plugin-content-blog": "3.7.0-canary-6213",
28
- "@docusaurus/plugin-content-docs": "3.7.0-canary-6213",
29
- "@docusaurus/plugin-content-pages": "3.7.0-canary-6213",
30
- "@docusaurus/theme-common": "3.7.0-canary-6213",
31
- "@docusaurus/theme-translations": "3.7.0-canary-6213",
32
- "@docusaurus/types": "3.7.0-canary-6213",
33
- "@docusaurus/utils": "3.7.0-canary-6213",
34
- "@docusaurus/utils-common": "3.7.0-canary-6213",
35
- "@docusaurus/utils-validation": "3.7.0-canary-6213",
23
+ "@docusaurus/core": "3.7.0-canary-6218",
24
+ "@docusaurus/logger": "3.7.0-canary-6218",
25
+ "@docusaurus/mdx-loader": "3.7.0-canary-6218",
26
+ "@docusaurus/module-type-aliases": "3.7.0-canary-6218",
27
+ "@docusaurus/plugin-content-blog": "3.7.0-canary-6218",
28
+ "@docusaurus/plugin-content-docs": "3.7.0-canary-6218",
29
+ "@docusaurus/plugin-content-pages": "3.7.0-canary-6218",
30
+ "@docusaurus/theme-common": "3.7.0-canary-6218",
31
+ "@docusaurus/theme-translations": "3.7.0-canary-6218",
32
+ "@docusaurus/types": "3.7.0-canary-6218",
33
+ "@docusaurus/utils": "3.7.0-canary-6218",
34
+ "@docusaurus/utils-common": "3.7.0-canary-6218",
35
+ "@docusaurus/utils-validation": "3.7.0-canary-6218",
36
36
  "@mdx-js/react": "^3.0.0",
37
37
  "clsx": "^2.0.0",
38
38
  "copy-text-to-clipboard": "^3.2.0",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=18.0"
64
64
  },
65
- "gitHead": "c9fdd7acbf913057cfe0c16c9446875b21592e24"
65
+ "gitHead": "ab76585735ad04818680632edec0f149fd15bbee"
66
66
  }
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  getAnnouncementBarInlineScript,
15
15
  DataAttributeQueryStringInlineJavaScript,
16
16
  } from './inlineScripts';
17
+ import {SvgSpriteDefs} from './inlineSvgSprites';
17
18
  import type {LoadContext, Plugin} from '@docusaurus/types';
18
19
  import type {ThemeConfig} from '@docusaurus/theme-common';
19
20
  import type {Plugin as PostCssPlugin} from 'postcss';
@@ -121,6 +122,14 @@ export default function themeClassic(
121
122
  injectHtmlTags() {
122
123
  return {
123
124
  preBodyTags: [
125
+ {
126
+ tagName: 'svg',
127
+ attributes: {
128
+ xmlns: 'http://www.w3.org/2000/svg',
129
+ style: 'display: none;',
130
+ },
131
+ innerHTML: SvgSpriteDefs,
132
+ },
124
133
  {
125
134
  tagName: 'script',
126
135
  innerHTML: `
@@ -0,0 +1,12 @@
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
+ // For icons that are heavily repeated in the static html output
9
+ // See also https://github.com/facebook/docusaurus/issues/5865
10
+ export const SvgSpriteDefs = `<defs>
11
+ <symbol id="theme-svg-external-link" viewBox="0 0 24 24"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z" /></symbol>
12
+ </defs>`;
@@ -10,6 +10,10 @@ import type {Props} from '@theme/Icon/ExternalLink';
10
10
 
11
11
  import styles from './styles.module.css';
12
12
 
13
+ // References symbol in docusaurus-theme-classic/src/inlineSvgSprites.ts
14
+ // See why: https://github.com/facebook/docusaurus/issues/5865
15
+ const svgSprite = '#theme-svg-external-link';
16
+
13
17
  export default function IconExternalLink({
14
18
  width = 13.5,
15
19
  height = 13.5,
@@ -19,12 +23,8 @@ export default function IconExternalLink({
19
23
  width={width}
20
24
  height={height}
21
25
  aria-hidden="true"
22
- viewBox="0 0 24 24"
23
26
  className={styles.iconExternalLink}>
24
- <path
25
- fill="currentColor"
26
- d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"
27
- />
27
+ <use href={svgSprite} />
28
28
  </svg>
29
29
  );
30
30
  }