@rspress/core 2.0.0-rc.2 → 2.0.0-rc.3

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 (122) hide show
  1. package/dist/{0~7675.989ee664.js → 0~7675.723d12b2.js} +17 -14
  2. package/dist/{5313.6594aba0.js → 3521.56e42d70.js} +0 -7
  3. package/dist/{5485.2a0273cf.js → 5485.077f14ff.js} +1 -1
  4. package/dist/{7805.cadab34e.js → 9643.f109822d.js} +2 -1
  5. package/dist/_private/react/render.js +17 -4
  6. package/dist/cli/config/loadConfigFile.js +1 -1
  7. package/dist/cli/index.js +1 -1
  8. package/dist/eject-theme/components/Badge/index.scss +1 -0
  9. package/dist/eject-theme/components/Banner/index.tsx +3 -1
  10. package/dist/eject-theme/components/Callout/index.tsx +8 -2
  11. package/dist/eject-theme/components/CodeBlock/index.scss +8 -6
  12. package/dist/eject-theme/components/CodeBlock/index.tsx +4 -0
  13. package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +50 -11
  14. package/dist/eject-theme/components/DocContent/doc.scss +1 -1
  15. package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +2 -1
  16. package/dist/eject-theme/components/DocContent/index.tsx +21 -4
  17. package/dist/eject-theme/components/DocFooter/index.tsx +1 -6
  18. package/dist/eject-theme/components/HoverGroup/index.scss +1 -1
  19. package/dist/eject-theme/components/LastUpdated/index.tsx +8 -1
  20. package/dist/eject-theme/components/Link/index.tsx +9 -2
  21. package/dist/eject-theme/components/NavScreen/NavScreenLangs.scss +6 -0
  22. package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +23 -9
  23. package/dist/eject-theme/components/NavScreen/NavScreenVersions.scss +6 -0
  24. package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +22 -9
  25. package/dist/eject-theme/components/Overview/index.tsx +1 -6
  26. package/dist/eject-theme/components/{Overview/OverviewGroup.scss → OverviewGroup/index.scss} +66 -12
  27. package/dist/eject-theme/components/{Overview/OverviewGroup.tsx → OverviewGroup/index.tsx} +50 -3
  28. package/dist/eject-theme/components/Search/logic/util.test.ts +1 -1
  29. package/dist/eject-theme/components/Tabs/index.scss +12 -4
  30. package/dist/eject-theme/components/Tabs/index.tsx +16 -0
  31. package/dist/eject-theme/components/Tag/index.tsx +84 -5
  32. package/dist/index.js +2 -2
  33. package/dist/node/PluginDriver.js +3 -4
  34. package/dist/node/auto-nav-sidebar/index.js +1 -1
  35. package/dist/node/auto-nav-sidebar/normalize.js +11 -9
  36. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  37. package/dist/node/constants.d.ts +1 -0
  38. package/dist/node/constants.js +3 -2
  39. package/dist/node/eject.js +5 -5
  40. package/dist/node/initRsbuild.js +14 -6
  41. package/dist/node/last-updated/index.js +1 -1
  42. package/dist/node/mdx/loader.js +2 -1
  43. package/dist/node/mdx/options.js +7 -4
  44. package/dist/node/mdx/processor.js +1 -1
  45. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  46. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +1 -1
  47. package/dist/node/mdx/remarkPlugins/image.js +1 -1
  48. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  49. package/dist/node/route/RouteService.js +1 -1
  50. package/dist/node/route/extractPageData.js +2 -2
  51. package/dist/node/route/normalizeRoutePath.js +1 -1
  52. package/dist/node/runtimeModule/i18n.js +1 -1
  53. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  54. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  55. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  56. package/dist/node/serve.js +1 -1
  57. package/dist/node/ssg/renderPage.js +1 -1
  58. package/dist/node/ssg/renderPageWorker.js +1 -1
  59. package/dist/node/ssg/renderPages.js +2 -2
  60. package/dist/node/ssg/ssgEnv.js +1 -1
  61. package/dist/node/ssg-md/llms/emitLlmsTxt.js +6 -2
  62. package/dist/node/ssg-md/remarkSplitMdx.js +140 -98
  63. package/dist/node/ssg-md/renderPage.js +1 -1
  64. package/dist/node/ssg-md/renderPages.js +1 -1
  65. package/dist/node/utils/createHash.js +1 -1
  66. package/dist/node/utils/error.js +2 -1
  67. package/dist/node/utils/flattenMdxContent.js +2 -2
  68. package/dist/node/utils/normalizePath.js +1 -1
  69. package/dist/node/utils/reactAlias.js +1 -1
  70. package/dist/runtime/initPageData.js +1 -1
  71. package/dist/theme/assets/deprecated.js +18 -0
  72. package/dist/theme/assets/experimental.js +21 -0
  73. package/dist/theme/components/Badge/index.css +1 -0
  74. package/dist/theme/components/Banner/index.js +2 -2
  75. package/dist/theme/components/Callout/index.js +5 -2
  76. package/dist/theme/components/CodeBlock/index.css +7 -6
  77. package/dist/theme/components/CodeBlock/index.js +4 -1
  78. package/dist/theme/components/CodeBlockRuntime/index.d.ts +1 -1
  79. package/dist/theme/components/CodeBlockRuntime/index.js +38 -8
  80. package/dist/theme/components/DocContent/doc.css +1 -1
  81. package/dist/theme/components/DocContent/docComponents/pre.js +3 -1
  82. package/dist/theme/components/DocContent/index.d.ts +11 -2
  83. package/dist/theme/components/DocContent/index.js +6 -5
  84. package/dist/theme/components/DocFooter/index.js +1 -5
  85. package/dist/theme/components/HoverGroup/index.css +3 -3
  86. package/dist/theme/components/LastUpdated/index.d.ts +1 -1
  87. package/dist/theme/components/LastUpdated/index.js +5 -1
  88. package/dist/theme/components/Link/index.d.ts +1 -1
  89. package/dist/theme/components/Link/index.js +8 -2
  90. package/dist/theme/components/NavScreen/NavScreenLangs.css +6 -0
  91. package/dist/theme/components/NavScreen/NavScreenLangs.js +13 -3
  92. package/dist/theme/components/NavScreen/NavScreenVersions.css +6 -0
  93. package/dist/theme/components/NavScreen/NavScreenVersions.js +12 -3
  94. package/dist/theme/components/Overview/index.d.ts +0 -1
  95. package/dist/theme/components/Overview/index.js +1 -1
  96. package/dist/theme/components/{Overview/OverviewGroup.css → OverviewGroup/index.css} +60 -8
  97. package/dist/theme/components/{Overview/OverviewGroup.d.ts → OverviewGroup/index.d.ts} +1 -1
  98. package/dist/theme/components/OverviewGroup/index.js +88 -0
  99. package/dist/theme/components/Search/logic/util.test.js +1 -1
  100. package/dist/theme/components/Tabs/index.css +6 -5
  101. package/dist/theme/components/Tabs/index.js +9 -0
  102. package/dist/theme/components/Tag/index.d.ts +3 -0
  103. package/dist/theme/components/Tag/index.js +63 -8
  104. package/dist/theme/hooks/useActiveAnchor.js +1 -1
  105. package/dist/theme/icons.d.ts +26 -24
  106. package/dist/theme/icons.js +5 -1
  107. package/dist/theme/index.d.ts +3 -1
  108. package/dist/theme/index.js +4 -2
  109. package/dist/theme/layout/DocLayout/index.css +0 -2
  110. package/dist/theme/layout/Layout/index.js +1 -2
  111. package/dist/theme/layout/NotFountLayout/index.js +1 -1
  112. package/dist/theme/logic/useAppearance.js +1 -1
  113. package/dist/theme/logic/useMediaQuery.js +1 -1
  114. package/dist/theme/styles/base.css +1 -0
  115. package/dist/theme/styles/shiki.css +9 -3
  116. package/dist/theme/styles/vars/base-vars.css +2 -2
  117. package/dist/theme/styles/vars/code-vars.css +2 -0
  118. package/package.json +14 -14
  119. package/dist/1218.3869bad6.js +0 -2
  120. package/dist/theme/components/Overview/OverviewGroup.js +0 -57
  121. /package/dist/eject-theme/components/{Overview → OverviewGroup}/icons/plugin.svg +0 -0
  122. /package/dist/theme/components/{Overview → OverviewGroup}/icons/plugin.js +0 -0
@@ -24,7 +24,7 @@ async function initPageData(routePath) {
24
24
  }
25
25
  let lang = virtual_site_data.lang || '';
26
26
  let version = virtual_site_data.multiVersion?.default || '';
27
- if (virtual_site_data.lang && 'undefined' != typeof window) {
27
+ if (virtual_site_data.lang && "u" > typeof window) {
28
28
  const path = window.location.pathname.replace(virtual_site_data.base, '').split('/').slice(0, 2);
29
29
  if (virtual_site_data.locales.length) {
30
30
  const result = virtual_site_data.locales.find(({ lang })=>path.includes(lang));
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgDeprecated = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ strokeLinejoin: "round",
7
+ "aria-hidden": "true",
8
+ viewBox: "0 0 16 16",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fill: "currentColor",
12
+ fillRule: "evenodd",
13
+ d: "M6.75 2.75a1.25 1.25 0 1 1 2.5 0V3h-2.5zM5.25 3v-.25a2.75 2.75 0 0 1 5.5 0V3H15v1.5h-1.115l-.707 9.192A2.5 2.5 0 0 1 10.685 16h-5.37a2.5 2.5 0 0 1-2.493-2.308L2.115 4.5H1V3h4.25m-.932 10.577L3.62 4.5h8.76l-.698 9.077a1 1 0 0 1-.997.923h-5.37a1 1 0 0 1-.997-.923",
14
+ clipRule: "evenodd"
15
+ })
16
+ });
17
+ var deprecated = SvgDeprecated;
18
+ export { deprecated as default };
@@ -0,0 +1,21 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgExperimental = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ strokeLinejoin: "round",
7
+ "data-testid": "geist-icon",
8
+ style: {
9
+ color: "currentcolor"
10
+ },
11
+ viewBox: "0 0 16 16",
12
+ ...props,
13
+ children: /*#__PURE__*/ jsx("path", {
14
+ fill: "currentColor",
15
+ fillRule: "evenodd",
16
+ d: "M9 7.674V2.5H7v5.174l-.503.447L4.383 10h7.234L9.503 8.121zM5.5 2.5H4V1h8v1.5h-1.5V7l3.573 3.177A2.76 2.76 0 0 1 12.24 15H3.76a2.76 2.76 0 0 1-1.834-4.823L5.5 7zm-3 9.74c0-.268.085-.527.24-.74h10.52a1.26 1.26 0 0 1-1.02 2H3.76a1.26 1.26 0 0 1-1.26-1.26",
17
+ clipRule: "evenodd"
18
+ })
19
+ });
20
+ var experimental = SvgExperimental;
21
+ export { experimental as default };
@@ -1,5 +1,6 @@
1
1
  .rp-badge {
2
2
  border-radius: var(--rp-radius-small);
3
+ white-space: nowrap;
3
4
  justify-content: center;
4
5
  align-items: center;
5
6
  gap: .25rem;
@@ -7,11 +7,11 @@ const Banner = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
7
7
  const { href, message, display = true, className, storageKey = 'rp-banner-closed', storage = 'localStorage', customChildren } = props;
8
8
  const [height, setHeight] = useState(36);
9
9
  const ref = mergeRefs(forwardedRef, (element)=>{
10
- element?.offsetHeight && setHeight(element?.offsetHeight);
10
+ if (element?.offsetHeight) setHeight(element?.offsetHeight);
11
11
  });
12
12
  const [disable, setDisable] = useState(false);
13
13
  useEffect(()=>{
14
- if ('undefined' == typeof window || !storage || !storageKey) return;
14
+ if ("u" < typeof window || !storage || !storageKey) return;
15
15
  setDisable(Boolean(window[storage].getItem(storageKey)));
16
16
  }, []);
17
17
  if (!display || disable) return null;
@@ -1,5 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "./index.css";
3
+ function capitalize(type) {
4
+ return type.charAt(0).toUpperCase() + type.slice(1);
5
+ }
3
6
  function Callout({ type, title, children }) {
4
7
  const isDetails = 'details' === type;
5
8
  if (isDetails) return /*#__PURE__*/ jsxs("details", {
@@ -7,7 +10,7 @@ function Callout({ type, title, children }) {
7
10
  children: [
8
11
  /*#__PURE__*/ jsx("summary", {
9
12
  className: "rp-callout__title",
10
- children: title
13
+ children: title ?? capitalize(type)
11
14
  }),
12
15
  /*#__PURE__*/ jsx("div", {
13
16
  className: "rp-callout__content",
@@ -20,7 +23,7 @@ function Callout({ type, title, children }) {
20
23
  children: [
21
24
  /*#__PURE__*/ jsx("div", {
22
25
  className: "rp-callout__title",
23
- children: title
26
+ children: title ?? capitalize(type)
24
27
  }),
25
28
  /*#__PURE__*/ jsx("div", {
26
29
  className: "rp-callout__content",
@@ -1,7 +1,8 @@
1
1
  .rp-codeblock {
2
2
  border: var(--rp-code-block-border);
3
+ box-shadow: var(--rp-code-block-shadow);
3
4
  border-radius: var(--rp-radius);
4
- margin: 16px 0;
5
+ margin: 1rem 0;
5
6
  transition: none;
6
7
  position: relative;
7
8
  overflow-x: auto;
@@ -10,7 +11,7 @@
10
11
  @media (width <= 640px) {
11
12
  .rp-codeblock {
12
13
  contain: content;
13
- margin: 24px 0;
14
+ margin: 1.5rem 0;
14
15
  }
15
16
  }
16
17
 
@@ -19,7 +20,7 @@
19
20
  font-size: var(--rp-code-font-size);
20
21
  background-color: var(--rp-code-title-bg);
21
22
  border-bottom: var(--rp-code-block-border);
22
- padding: 12px 16px;
23
+ padding: .75rem 1rem;
23
24
  }
24
25
 
25
26
  .rp-codeblock__content {
@@ -52,7 +53,7 @@
52
53
  font-family: var(--rp-font-family-mono);
53
54
  width: fit-content;
54
55
  min-width: 100%;
55
- padding: 16px 0;
56
+ padding: 1rem 0;
56
57
  line-height: 1.7;
57
58
  display: inline-block;
58
59
  }
@@ -72,8 +73,8 @@
72
73
  counter-increment: step;
73
74
  text-align: right;
74
75
  color: #738a9466;
75
- width: 15px;
76
- margin-right: 15px;
76
+ width: 1rem;
77
+ margin-right: 1rem;
77
78
  display: inline-block;
78
79
  }
79
80
 
@@ -1,8 +1,11 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { CodeButtonGroup, useCodeButtonGroup } from "@theme";
3
3
  import clsx from "clsx";
4
4
  import "./index.css";
5
5
  function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: wrapCodeProp = false, lineNumbers: lineNumbersProp = false, codeButtonGroupProps, children }) {
6
+ if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
7
+ children: children
8
+ });
6
9
  const { codeWrap, toggleCodeWrap, copyElementRef } = useCodeButtonGroup(wrapCodeProp);
7
10
  return /*#__PURE__*/ jsxs("div", {
8
11
  className: clsx('rp-codeblock', `language-${lang}`, containerElementClassName),
@@ -11,4 +11,4 @@ export interface CodeBlockRuntimeProps extends CodeBlockProps {
11
11
  */
12
12
  onRendered?: () => void;
13
13
  }
14
- export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, ...otherProps }: CodeBlockRuntimeProps): ReactNode;
14
+ export declare function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers, }: CodeBlockRuntimeProps): ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { getCustomMDXComponent } from "@theme";
3
3
  import { toJsxRuntime } from "hast-util-to-jsx-runtime";
4
- import { Fragment, useEffect, useRef, useState } from "react";
4
+ import { Fragment, useEffect, useMemo, useRef, useState } from "react";
5
5
  import { codeToHast, createCssVariablesTheme } from "shiki";
6
6
  const cssVariablesTheme = createCssVariablesTheme({
7
7
  name: 'css-variables',
@@ -14,8 +14,33 @@ const useLatest = (value)=>{
14
14
  ref.current = value;
15
15
  return ref;
16
16
  };
17
- function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, ...otherProps }) {
18
- const [child, setChild] = useState(null);
17
+ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProps, children: _, containerElementClassName, onRendered, wrapCode, lineNumbers }) {
18
+ const mdxComponents = useMemo(()=>getCustomMDXComponent(), []);
19
+ const { pre: ShikiPre, code: Code, ...otherMdxComponents } = mdxComponents;
20
+ const fallback = useMemo(()=>/*#__PURE__*/ jsx(ShikiPre, {
21
+ title: title,
22
+ lang: lang,
23
+ wrapCode: wrapCode,
24
+ lineNumbers: lineNumbers,
25
+ containerElementClassName: containerElementClassName,
26
+ codeButtonGroupProps: codeButtonGroupProps,
27
+ className: "shiki css-variables",
28
+ children: /*#__PURE__*/ jsx(Code, {
29
+ style: {
30
+ padding: '1rem 1.25rem'
31
+ },
32
+ children: code
33
+ })
34
+ }), [
35
+ title,
36
+ lang,
37
+ wrapCode,
38
+ lineNumbers,
39
+ containerElementClassName,
40
+ codeButtonGroupProps,
41
+ code
42
+ ]);
43
+ const [child, setChild] = useState(fallback);
19
44
  const codeRef = useLatest(code);
20
45
  useEffect(()=>{
21
46
  const highlightCode = async ()=>{
@@ -25,7 +50,6 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
25
50
  ...shikiOptions
26
51
  });
27
52
  if (codeRef.current.length !== code.length) return;
28
- const { pre: ShikiPre, code: Code, ...otherMdxComponents } = getCustomMDXComponent();
29
53
  const reactNode = toJsxRuntime(hast, {
30
54
  jsx: jsx,
31
55
  jsxs: jsxs,
@@ -37,8 +61,9 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
37
61
  lang: lang,
38
62
  containerElementClassName: containerElementClassName,
39
63
  codeButtonGroupProps: codeButtonGroupProps,
40
- ...props,
41
- ...otherProps
64
+ wrapCode: wrapCode,
65
+ lineNumbers: lineNumbers,
66
+ ...props
42
67
  }),
43
68
  code: (props)=>/*#__PURE__*/ jsx(Code, {
44
69
  ...props
@@ -50,9 +75,14 @@ function CodeBlockRuntime({ lang, title, code, shikiOptions, codeButtonGroupProp
50
75
  };
51
76
  highlightCode();
52
77
  }, [
53
- lang,
54
78
  code,
55
- shikiOptions
79
+ codeButtonGroupProps,
80
+ containerElementClassName,
81
+ lang,
82
+ lineNumbers,
83
+ shikiOptions,
84
+ title,
85
+ wrapCode
56
86
  ]);
57
87
  useEffect(()=>{
58
88
  if (child) onRendered?.();
@@ -157,7 +157,7 @@
157
157
  table-layout: auto;
158
158
  border-collapse: separate;
159
159
  border-spacing: 0;
160
- border: 1px solid var(--rp-c-divider-light);
160
+ border: var(--rp-code-block-border);
161
161
  border-radius: var(--rp-radius);
162
162
  width: 100%;
163
163
  overflow: hidden;
@@ -9,7 +9,9 @@ function ShikiPre({ title, lang, wrapCode, lineNumbers, containerElementClassNam
9
9
  containerElementClassName: containerElementClassName,
10
10
  codeButtonGroupProps: codeButtonGroupProps,
11
11
  children: /*#__PURE__*/ jsx("pre", {
12
- ...otherProps
12
+ ...otherProps,
13
+ "data-lang": lang,
14
+ "data-title": title
13
15
  })
14
16
  });
15
17
  }
@@ -1,6 +1,15 @@
1
1
  import './doc.scss';
2
- export declare function FallbackTitle(): false | import("react/jsx-runtime").JSX.Element;
3
- export declare function DocContent({ components, isOverviewPage, }: {
2
+ export declare function DocContent({ components, isOverviewPage, afterDocContent, beforeDocContent, }: {
4
3
  components: Record<string, React.FC<any>> | undefined;
5
4
  isOverviewPage?: boolean;
5
+ /**
6
+ * Optional React node rendered before the main document content.
7
+ * Can be used for banners, notices, or custom elements at the top of the page.
8
+ */
9
+ beforeDocContent?: React.ReactNode;
10
+ /**
11
+ * Optional React node rendered after the main document content.
12
+ * Can be used for footers, navigation, or other content at the bottom of the page.
13
+ */
14
+ afterDocContent?: React.ReactNode;
6
15
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { MDXProvider } from "@mdx-js/react";
3
3
  import { Content, usePage, useSite } from "@rspress/core/runtime";
4
- import { Callout, FallbackHeading, getCustomMDXComponent } from "@theme";
5
- import { useScrollAfterNav } from "../../logic/useScrollAfterNav.js";
4
+ import { Callout, FallbackHeading, getCustomMDXComponent, useScrollAfterNav } from "@theme";
6
5
  import "./doc.css";
7
6
  function FallbackTitle() {
8
7
  const { site } = useSite();
@@ -13,7 +12,7 @@ function FallbackTitle() {
13
12
  title: title
14
13
  });
15
14
  }
16
- function DocContent({ components, isOverviewPage = false }) {
15
+ function DocContent({ components, isOverviewPage = false, afterDocContent, beforeDocContent }) {
17
16
  useScrollAfterNav();
18
17
  const mdxComponents = {
19
18
  ...getCustomMDXComponent(),
@@ -23,9 +22,11 @@ function DocContent({ components, isOverviewPage = false }) {
23
22
  return /*#__PURE__*/ jsxs(MDXProvider, {
24
23
  components: mdxComponents,
25
24
  children: [
25
+ beforeDocContent,
26
26
  !isOverviewPage && /*#__PURE__*/ jsx(FallbackTitle, {}),
27
- /*#__PURE__*/ jsx(Content, {})
27
+ /*#__PURE__*/ jsx(Content, {}),
28
+ afterDocContent
28
29
  ]
29
30
  });
30
31
  }
31
- export { DocContent, FallbackTitle };
32
+ export { DocContent };
@@ -1,11 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useSite } from "@rspress/core/runtime";
3
2
  import { EditLink, LastUpdated, PrevNextPage } from "@theme";
4
3
  import "./index.css";
5
4
  function DocFooter() {
6
- const { site } = useSite();
7
- const { themeConfig } = site;
8
- const showLastUpdated = themeConfig.lastUpdated;
9
5
  return /*#__PURE__*/ jsxs("footer", {
10
6
  className: "rp-doc-footer",
11
7
  children: [
@@ -13,7 +9,7 @@ function DocFooter() {
13
9
  className: "rp-doc-footer__edit",
14
10
  children: [
15
11
  /*#__PURE__*/ jsx(EditLink, {}),
16
- showLastUpdated && /*#__PURE__*/ jsx(LastUpdated, {})
12
+ /*#__PURE__*/ jsx(LastUpdated, {})
17
13
  ]
18
14
  }),
19
15
  /*#__PURE__*/ jsx("div", {
@@ -1,19 +1,19 @@
1
1
  .rp-hover-group {
2
2
  border: var(--rp-code-block-border);
3
3
  background: var(--rp-c-bg);
4
+ width: auto;
5
+ min-width: 80px;
6
+ box-shadow: var(--rp-shadow-2);
4
7
  z-index: 999;
5
8
  border-radius: 8px;
6
9
  flex-direction: column;
7
10
  align-items: flex-start;
8
- width: auto;
9
- min-width: 80px;
10
11
  padding: 8px;
11
12
  list-style: none;
12
13
  transition: opacity .3s ease-in-out;
13
14
  display: flex;
14
15
  position: absolute;
15
16
  top: 80%;
16
- box-shadow: 0 4px 16px #0000000a;
17
17
  }
18
18
 
19
19
  .rp-hover-group--center {
@@ -1,2 +1,2 @@
1
1
  import './index.scss';
2
- export declare function LastUpdated(): import("react/jsx-runtime").JSX.Element;
2
+ export declare function LastUpdated(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useI18n, usePage } from "@rspress/core/runtime";
2
+ import { useI18n, usePage, useSite } from "@rspress/core/runtime";
3
3
  import "./index.css";
4
4
  function LastUpdated() {
5
5
  const { page: { lastUpdatedTime } } = usePage();
6
+ const { site } = useSite();
7
+ const { themeConfig } = site;
8
+ const showLastUpdated = themeConfig.lastUpdated;
6
9
  const t = useI18n();
10
+ if (!showLastUpdated) return null;
7
11
  return /*#__PURE__*/ jsx("div", {
8
12
  className: "rp-last-updated",
9
13
  children: /*#__PURE__*/ jsxs("p", {
@@ -32,4 +32,4 @@ export interface LinkProps extends ComponentProps<'a'> {
32
32
  * 3. If inCurrentSite, it will navigate and scroll to anchor, preload the asyncChunk onHover the link
33
33
  * 4. Link is styled.
34
34
  */
35
- export declare function Link(props: LinkProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
@@ -2,18 +2,20 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { preloadLink } from "@rspress/core/runtime";
3
3
  import clsx from "clsx";
4
4
  import nprogress from "nprogress";
5
+ import { forwardRef } from "react";
5
6
  import "./index.css";
6
7
  import { getHref, useLinkNavigate } from "./useLinkNavigate.js";
7
8
  nprogress.configure({
8
9
  showSpinner: false
9
10
  });
10
- function Link(props) {
11
+ const Link = /*#__PURE__*/ forwardRef((props, ref)=>{
11
12
  const { href = '/', children, className = '', onClick, onMouseEnter, startTransition, ...otherProps } = props;
12
13
  const { linkType, removeBaseHref, withBaseHref } = getHref(href);
13
14
  const navigate = useLinkNavigate({
14
15
  startTransition
15
16
  });
16
17
  if ('external' === linkType) return /*#__PURE__*/ jsx("a", {
18
+ ref: ref,
17
19
  href: href,
18
20
  target: "_blank",
19
21
  rel: "noopener noreferrer",
@@ -24,6 +26,7 @@ function Link(props) {
24
26
  children: children
25
27
  });
26
28
  if ('hashOnly' === linkType) return /*#__PURE__*/ jsx("a", {
29
+ ref: ref,
27
30
  href: href,
28
31
  className: clsx(className, 'rp-link'),
29
32
  onClick: onClick,
@@ -32,6 +35,7 @@ function Link(props) {
32
35
  children: children
33
36
  });
34
37
  if ('relative' === linkType) return /*#__PURE__*/ jsx("a", {
38
+ ref: ref,
35
39
  href: href,
36
40
  className: clsx(className, 'rp-link'),
37
41
  onMouseEnter: (event)=>{
@@ -48,6 +52,7 @@ function Link(props) {
48
52
  children: children
49
53
  });
50
54
  return /*#__PURE__*/ jsx("a", {
55
+ ref: ref,
51
56
  href: withBaseHref,
52
57
  className: clsx(className, 'rp-link'),
53
58
  onMouseEnter: (event)=>{
@@ -63,5 +68,6 @@ function Link(props) {
63
68
  ...otherProps,
64
69
  children: children
65
70
  });
66
- }
71
+ });
72
+ Link.displayName = 'Link';
67
73
  export { Link };
@@ -46,3 +46,9 @@
46
46
  padding: 0 24px;
47
47
  }
48
48
 
49
+ .rp-nav-screen-langs-group__item--active {
50
+ color: var(--rp-c-text-2);
51
+ cursor: default;
52
+ pointer-events: none;
53
+ }
54
+
@@ -4,6 +4,7 @@ import { useLangsMenu } from "../Nav/hooks.js";
4
4
  import "./NavScreenLangs.css";
5
5
  import { useI18n } from "@rspress/core/runtime";
6
6
  import { Link } from "@theme";
7
+ import clsx from "clsx";
7
8
  import { SvgDown } from "./NavScreenMenuItem.js";
8
9
  function NavScreenLangs() {
9
10
  const { items, activeValue } = useLangsMenu();
@@ -39,11 +40,20 @@ function NavScreenLangs() {
39
40
  },
40
41
  children: /*#__PURE__*/ jsx("div", {
41
42
  className: "rp-nav-screen-langs-group__inner",
42
- children: items.map((item)=>/*#__PURE__*/ jsx(Link, {
43
+ children: items.map((item)=>{
44
+ const isActive = item.text === activeValue;
45
+ const className = clsx('rp-nav-screen-langs-group__item', isActive && 'rp-nav-screen-langs-group__item--active');
46
+ return isActive ? /*#__PURE__*/ jsx("span", {
47
+ className: className,
48
+ "aria-current": "page",
49
+ "aria-disabled": true,
50
+ children: item.text
51
+ }, item.text) : /*#__PURE__*/ jsx(Link, {
43
52
  href: item.link,
44
- className: "rp-nav-screen-langs-group__item",
53
+ className: className,
45
54
  children: item.text
46
- }, item.text))
55
+ }, item.text);
56
+ })
47
57
  })
48
58
  })
49
59
  ]
@@ -45,6 +45,12 @@
45
45
  padding: 0 24px;
46
46
  }
47
47
 
48
+ .rp-nav-screen-versions-group__item--active {
49
+ color: var(--rp-c-text-2);
50
+ cursor: default;
51
+ pointer-events: none;
52
+ }
53
+
48
54
  .rp-nav-screen-versions-group--open {
49
55
  height: auto;
50
56
  }
@@ -35,11 +35,20 @@ function NavScreenVersions() {
35
35
  }),
36
36
  /*#__PURE__*/ jsx("div", {
37
37
  className: clsx('rp-nav-screen-versions-group', isOpen && 'rp-nav-screen-versions-group--open'),
38
- children: items.map((item)=>/*#__PURE__*/ jsx(Link, {
38
+ children: items.map((item)=>{
39
+ const isActive = item.text === activeValue;
40
+ const className = clsx('rp-nav-screen-versions-group__item', isActive && 'rp-nav-screen-versions-group__item--active');
41
+ return isActive ? /*#__PURE__*/ jsx("span", {
42
+ className: className,
43
+ "aria-current": "page",
44
+ "aria-disabled": true,
45
+ children: item.text
46
+ }, item.text) : /*#__PURE__*/ jsx(Link, {
39
47
  href: item.link,
40
- className: "rp-nav-screen-versions-group__item",
48
+ className: className,
41
49
  children: item.text
42
- }, item.text))
50
+ }, item.text);
51
+ })
43
52
  })
44
53
  ]
45
54
  }) : null;
@@ -3,6 +3,5 @@ import './index.scss';
3
3
  export declare function Overview(props: {
4
4
  content?: React.ReactNode;
5
5
  groups?: Group[];
6
- defaultGroupTitle?: string;
7
6
  overviewHeaders?: number[];
8
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -31,7 +31,7 @@ const OverviewSearchInput = ({ query, setQuery, searchRef })=>{
31
31
  };
32
32
  function Overview(props) {
33
33
  const { siteData, page: { routePath, title, frontmatter } } = usePageData();
34
- const { content, groups: customGroups, defaultGroupTitle: _ = 'Others' } = props;
34
+ const { content, groups: customGroups } = props;
35
35
  const t = useI18n();
36
36
  const [query, setQuery] = useState('');
37
37
  const searchRef = useRef(null);
@@ -1,3 +1,9 @@
1
+ :root {
2
+ --rp-c-overview-group-bg: var(--rp-c-bg-soft);
3
+ --rp-c-overview-group-bg-hover: color-mix(in srgb, var(--rp-c-brand-lighter) 30%, transparent);
4
+ --rp-c-overview-group-border: 1px solid var(--rp-c-divider-light);
5
+ }
6
+
1
7
  .rp-overview-group {
2
8
  flex-direction: column;
3
9
  gap: 20px;
@@ -6,7 +12,7 @@
6
12
  }
7
13
 
8
14
  .rp-overview-group__item {
9
- border: 1px solid var(--rp-c-divider-light);
15
+ border: var(--rp-c-overview-group-border);
10
16
  border-radius: var(--rp-radius);
11
17
  flex-direction: row;
12
18
  width: 100%;
@@ -21,7 +27,7 @@
21
27
  }
22
28
 
23
29
  .rp-overview-group__item:hover .rp-overview-group__item__title {
24
- background-color: color-mix(in srgb, var(--rp-c-brand-lighter) 30%, transparent) !important;
30
+ background-color: var(--rp-c-overview-group-bg-hover);
25
31
  }
26
32
 
27
33
  .rp-overview-group__item:hover .rp-overview-group__item__title .rp-overview-group__item__title__icon {
@@ -41,10 +47,10 @@
41
47
 
42
48
  .rp-overview-group__item__title {
43
49
  word-break: break-all;
44
- background-color: var(--rp-c-bg-soft);
45
- width: 20%;
50
+ width: 25%;
46
51
  color: var(--rp-c-text-1);
47
- flex: 0 0 20%;
52
+ background-color: var(--rp-c-overview-group-bg);
53
+ flex: 0 0 25%;
48
54
  padding: 16px 20px;
49
55
  font-size: 18px;
50
56
  font-weight: 600;
@@ -53,12 +59,12 @@
53
59
  overflow: hidden;
54
60
  }
55
61
 
56
- .rp-overview-group__item__title a {
62
+ .rp-overview-group__item__title__link, .rp-overview-group__item__title__text {
57
63
  color: inherit;
58
64
  text-decoration: none;
59
65
  }
60
66
 
61
- .rp-overview-group__item__title a:hover {
67
+ .rp-overview-group__item__title__link:hover, .rp-overview-group__item__title__text:hover {
62
68
  color: var(--rp-c-brand);
63
69
  }
64
70
 
@@ -118,7 +124,53 @@
118
124
  background-color: var(--rp-c-bg);
119
125
  }
120
126
 
121
- html.rp-dark .rp-overview-group__item:hover .rp-overview-group__item__title__icon {
127
+ .rp-overview-group__grid {
128
+ grid-template-columns: repeat(4, 1fr);
129
+ gap: 20px;
130
+ width: 100%;
131
+ display: grid;
132
+ }
133
+
134
+ @media (width <= 1280px) {
135
+ .rp-overview-group__grid {
136
+ grid-template-columns: repeat(3, 1fr);
137
+ }
138
+ }
139
+
140
+ @media (width <= 768px) {
141
+ .rp-overview-group__grid {
142
+ grid-template-columns: repeat(2, 1fr);
143
+ }
144
+ }
145
+
146
+ @media (width <= 480px) {
147
+ .rp-overview-group__grid {
148
+ grid-template-columns: 1fr;
149
+ }
150
+ }
151
+
152
+ .rp-overview-group__grid-item {
153
+ border: 1px solid var(--rp-c-divider-light);
154
+ border-radius: var(--rp-radius);
155
+ transition: border-color .2s, box-shadow .2s, background-color .2s;
156
+ }
157
+
158
+ .rp-overview-group__grid-item.rp-overview-group__item__title {
159
+ flex: none;
160
+ width: 100%;
161
+ }
162
+
163
+ .rp-overview-group__grid-item:hover {
164
+ border-color: var(--rp-c-brand-light);
165
+ background-color: var(--rp-c-overview-group-bg-hover);
166
+ box-shadow: 0 4px 6px #0000000a;
167
+ }
168
+
169
+ .rp-overview-group__grid-item:hover .rp-overview-group__item__title__icon {
170
+ color: var(--rp-c-brand-dark);
171
+ }
172
+
173
+ html.rp-dark .rp-overview-group__item:hover .rp-overview-group__item__title__icon, html.rp-dark .rp-overview-group__grid-item:hover .rp-overview-group__item__title__icon {
122
174
  color: #fff;
123
175
  }
124
176