@docusaurus/theme-classic 3.8.1-canary-6352 → 3.8.1-canary-6355

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.
@@ -0,0 +1,36 @@
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 Link from '@docusaurus/Link';
10
+ import {useThemeConfig} from '@docusaurus/theme-common';
11
+ import styles from './styles.module.css';
12
+ function isFootnoteRef(props) {
13
+ return props['data-footnote-ref'] === true;
14
+ }
15
+ function FootnoteRefLink(props) {
16
+ const {
17
+ navbar: {hideOnScroll},
18
+ } = useThemeConfig();
19
+ return (
20
+ <Link
21
+ {...props}
22
+ className={clsx(
23
+ hideOnScroll
24
+ ? styles.footnoteRefHideOnScrollNavbar
25
+ : styles.footnoteRefStickyNavbar,
26
+ props.className,
27
+ )}
28
+ />
29
+ );
30
+ }
31
+ export default function MDXA(props) {
32
+ if (isFootnoteRef(props)) {
33
+ return <FootnoteRefLink {...props} />;
34
+ }
35
+ return <Link {...props} />;
36
+ }
@@ -0,0 +1,20 @@
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
+ /*
9
+ When the navbar is sticky, ensure that on footnote click,
10
+ the browser does not scroll to the ref behind the navbar
11
+ See https://github.com/facebook/docusaurus/issues/11232
12
+ See also headings case https://x.com/JoshWComeau/status/1332015868725891076
13
+ */
14
+ .footnoteRefStickyNavbar {
15
+ scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
16
+ }
17
+
18
+ .footnoteRefHideOnScrollNavbar {
19
+ scroll-margin-top: 0.5rem;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "3.8.1-canary-6352",
3
+ "version": "3.8.1-canary-6355",
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.8.1-canary-6352",
24
- "@docusaurus/logger": "3.8.1-canary-6352",
25
- "@docusaurus/mdx-loader": "3.8.1-canary-6352",
26
- "@docusaurus/module-type-aliases": "3.8.1-canary-6352",
27
- "@docusaurus/plugin-content-blog": "3.8.1-canary-6352",
28
- "@docusaurus/plugin-content-docs": "3.8.1-canary-6352",
29
- "@docusaurus/plugin-content-pages": "3.8.1-canary-6352",
30
- "@docusaurus/theme-common": "3.8.1-canary-6352",
31
- "@docusaurus/theme-translations": "3.8.1-canary-6352",
32
- "@docusaurus/types": "3.8.1-canary-6352",
33
- "@docusaurus/utils": "3.8.1-canary-6352",
34
- "@docusaurus/utils-common": "3.8.1-canary-6352",
35
- "@docusaurus/utils-validation": "3.8.1-canary-6352",
23
+ "@docusaurus/core": "3.8.1-canary-6355",
24
+ "@docusaurus/logger": "3.8.1-canary-6355",
25
+ "@docusaurus/mdx-loader": "3.8.1-canary-6355",
26
+ "@docusaurus/module-type-aliases": "3.8.1-canary-6355",
27
+ "@docusaurus/plugin-content-blog": "3.8.1-canary-6355",
28
+ "@docusaurus/plugin-content-docs": "3.8.1-canary-6355",
29
+ "@docusaurus/plugin-content-pages": "3.8.1-canary-6355",
30
+ "@docusaurus/theme-common": "3.8.1-canary-6355",
31
+ "@docusaurus/theme-translations": "3.8.1-canary-6355",
32
+ "@docusaurus/types": "3.8.1-canary-6355",
33
+ "@docusaurus/utils": "3.8.1-canary-6355",
34
+ "@docusaurus/utils-common": "3.8.1-canary-6355",
35
+ "@docusaurus/utils-validation": "3.8.1-canary-6355",
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": "a3190d2cdcb4d4ab6704dbd8de92868ef67165cb"
65
+ "gitHead": "7ae9abedad811ceda2541c11789266cb66abfbb6"
66
66
  }
@@ -0,0 +1,42 @@
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, {type ReactNode} from 'react';
9
+ import clsx from 'clsx';
10
+ import Link from '@docusaurus/Link';
11
+ import {useThemeConfig} from '@docusaurus/theme-common';
12
+ import type {Props} from '@theme/MDXComponents/A';
13
+ import styles from './styles.module.css';
14
+
15
+ function isFootnoteRef(props: Props) {
16
+ return props['data-footnote-ref'] === true;
17
+ }
18
+
19
+ function FootnoteRefLink(props: Props) {
20
+ const {
21
+ navbar: {hideOnScroll},
22
+ } = useThemeConfig();
23
+ return (
24
+ <Link
25
+ {...props}
26
+ className={clsx(
27
+ hideOnScroll
28
+ ? styles.footnoteRefHideOnScrollNavbar
29
+ : styles.footnoteRefStickyNavbar,
30
+
31
+ props.className,
32
+ )}
33
+ />
34
+ );
35
+ }
36
+
37
+ export default function MDXA(props: Props): ReactNode {
38
+ if (isFootnoteRef(props)) {
39
+ return <FootnoteRefLink {...props} />;
40
+ }
41
+ return <Link {...props} />;
42
+ }
@@ -0,0 +1,20 @@
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
+ /*
9
+ When the navbar is sticky, ensure that on footnote click,
10
+ the browser does not scroll to the ref behind the navbar
11
+ See https://github.com/facebook/docusaurus/issues/11232
12
+ See also headings case https://x.com/JoshWComeau/status/1332015868725891076
13
+ */
14
+ .footnoteRefStickyNavbar {
15
+ scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
16
+ }
17
+
18
+ .footnoteRefHideOnScrollNavbar {
19
+ scroll-margin-top: 0.5rem;
20
+ }
@@ -1040,7 +1040,9 @@ declare module '@theme/SkipToContent' {
1040
1040
  declare module '@theme/MDXComponents/A' {
1041
1041
  import type {ComponentProps, ReactNode} from 'react';
1042
1042
 
1043
- export interface Props extends ComponentProps<'a'> {}
1043
+ export interface Props extends ComponentProps<'a'> {
1044
+ 'data-footnote-ref'?: true;
1045
+ }
1044
1046
 
1045
1047
  export default function MDXA(props: Props): ReactNode;
1046
1048
  }
@@ -1,11 +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
- import React from 'react';
8
- import Link from '@docusaurus/Link';
9
- export default function MDXA(props) {
10
- return <Link {...props} />;
11
- }
@@ -1,14 +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
- import React, {type ReactNode} from 'react';
9
- import Link from '@docusaurus/Link';
10
- import type {Props} from '@theme/MDXComponents/A';
11
-
12
- export default function MDXA(props: Props): ReactNode {
13
- return <Link {...props} />;
14
- }