@rspress/core 2.0.3 → 2.0.4

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 (113) hide show
  1. package/dist/{0~7675.872de9ba.js → 0~7675.423f6a06.js} +2 -2
  2. package/dist/{5485.888e77db.js → 5485.7e481fde.js} +1 -1
  3. package/dist/cli/index.js +1 -1
  4. package/dist/config/loadConfigFile.js +1 -1
  5. package/dist/eject-theme/components/Badge/index.tsx +1 -1
  6. package/dist/eject-theme/components/Button/index.tsx +1 -1
  7. package/dist/eject-theme/components/CodeBlock/index.scss +5 -1
  8. package/dist/eject-theme/components/DocContent/docComponents/title.tsx +7 -2
  9. package/dist/eject-theme/components/EditLink/index.scss +10 -8
  10. package/dist/eject-theme/components/EditLink/index.tsx +13 -4
  11. package/dist/eject-theme/components/HoverGroup/index.tsx +8 -2
  12. package/dist/eject-theme/components/Llms/LlmsCopyRow.tsx +51 -0
  13. package/dist/eject-theme/components/Llms/LlmsOpenRow.scss +10 -0
  14. package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +170 -0
  15. package/dist/eject-theme/components/Nav/NavMenu.tsx +7 -1
  16. package/dist/eject-theme/components/Nav/hooks.tsx +2 -0
  17. package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +8 -1
  18. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +0 -1
  19. package/dist/eject-theme/components/Outline/ScrollToTop.tsx +12 -34
  20. package/dist/eject-theme/components/Outline/index.scss +41 -5
  21. package/dist/eject-theme/components/Outline/index.tsx +19 -2
  22. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +10 -2
  23. package/dist/eject-theme/components/Search/SearchPanel.tsx +2 -1
  24. package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +1 -1
  25. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +0 -2
  26. package/dist/eject-theme/components/SourceCode/index.tsx +1 -1
  27. package/dist/eject-theme/components/SvgWrapper/index.tsx +5 -2
  28. package/dist/eject-theme/components/Tabs/index.scss +1 -1
  29. package/dist/eject-theme/components/Tabs/index.tsx +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/node/auto-nav-sidebar/index.js +1 -1
  32. package/dist/node/auto-nav-sidebar/normalize.js +30 -4
  33. package/dist/node/constants.js +1 -1
  34. package/dist/node/initRsbuild.js +11 -9
  35. package/dist/node/last-updated/index.js +1 -1
  36. package/dist/node/logger/hint.d.ts +0 -3
  37. package/dist/node/logger/hint.js +7 -1
  38. package/dist/node/mdx/rehypePlugins/transformers/add-line-numbers.js +3 -2
  39. package/dist/node/mdx/rehypePlugins/transformers/add-wrap-code.js +4 -3
  40. package/dist/node/route/RouteService.js +1 -1
  41. package/dist/node/route/extractPageData.js +23 -2
  42. package/dist/node/route/normalizeRoutePath.js +1 -1
  43. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +4 -4
  44. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +4 -4
  45. package/dist/node/runtimeModule/i18n.js +1 -1
  46. package/dist/node/runtimeModule/pageData/createPageData.js +2 -2
  47. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  48. package/dist/node/serve.js +1 -1
  49. package/dist/node/ssg/renderPage.js +1 -1
  50. package/dist/node/ssg/renderPageWorker.js +1 -1
  51. package/dist/node/ssg/renderPages.js +2 -2
  52. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  53. package/dist/node/ssg-md/remarkSplitMdx.js +11 -1
  54. package/dist/node/ssg-md/renderPage.js +1 -1
  55. package/dist/node/ssg-md/renderPages.js +1 -1
  56. package/dist/node/utils/createHash.js +1 -1
  57. package/dist/node/utils/flattenMdxContent.js +1 -1
  58. package/dist/node/utils/reactAlias.d.ts +1 -0
  59. package/dist/node/utils/reactAlias.js +34 -2
  60. package/dist/runtime/ssrMdServerEntry.js +1 -1
  61. package/dist/theme/assets/copy.js +3 -3
  62. package/dist/theme/assets/edit.js +18 -0
  63. package/dist/theme/assets/scroll-to-top.js +36 -0
  64. package/dist/theme/assets/success.js +3 -2
  65. package/dist/theme/components/Badge/index.d.ts +1 -2
  66. package/dist/theme/components/Button/index.d.ts +1 -2
  67. package/dist/theme/components/CodeBlock/index.css +5 -1
  68. package/dist/theme/components/DocContent/docComponents/title.js +5 -2
  69. package/dist/theme/components/EditLink/index.css +2 -2
  70. package/dist/theme/components/EditLink/index.d.ts +3 -1
  71. package/dist/theme/components/EditLink/index.js +18 -4
  72. package/dist/theme/components/HoverGroup/index.js +8 -1
  73. package/dist/theme/components/Llms/LlmsCopyRow.d.ts +1 -0
  74. package/dist/theme/components/Llms/LlmsCopyRow.js +50 -0
  75. package/dist/theme/components/Llms/LlmsOpenRow.css +11 -0
  76. package/dist/theme/components/Llms/LlmsOpenRow.d.ts +3 -0
  77. package/dist/theme/components/Llms/LlmsOpenRow.js +168 -0
  78. package/dist/theme/components/Nav/NavMenu.js +3 -0
  79. package/dist/theme/components/Nav/hooks.d.ts +2 -0
  80. package/dist/theme/components/Nav/hooks.js +3 -1
  81. package/dist/theme/components/NavScreen/NavScreenLangs.js +3 -0
  82. package/dist/theme/components/NavScreen/NavScreenMenuItem.css +0 -1
  83. package/dist/theme/components/Outline/ScrollToTop.d.ts +1 -2
  84. package/dist/theme/components/Outline/ScrollToTop.js +7 -32
  85. package/dist/theme/components/Outline/index.css +39 -4
  86. package/dist/theme/components/Outline/index.js +16 -4
  87. package/dist/theme/components/PackageManagerTabs/index.js +10 -3
  88. package/dist/theme/components/Search/SearchPanel.js +1 -1
  89. package/dist/theme/components/Search/logic/providers/LocalProvider.js +1 -1
  90. package/dist/theme/components/Sidebar/SidebarItem.css +0 -2
  91. package/dist/theme/components/SourceCode/index.d.ts +1 -2
  92. package/dist/theme/components/SvgWrapper/index.d.ts +1 -2
  93. package/dist/theme/components/SvgWrapper/index.js +2 -1
  94. package/dist/theme/components/Tabs/index.css +1 -1
  95. package/dist/theme/components/Tabs/index.d.ts +1 -1
  96. package/dist/theme/icons.d.ts +2 -0
  97. package/dist/theme/icons.js +5 -1
  98. package/dist/theme/index.d.ts +8 -5
  99. package/dist/theme/index.js +4 -1
  100. package/dist/theme/layout/DocLayout/index.css +3 -3
  101. package/dist/theme/styles/base.css +4 -0
  102. package/nav-json-schema.json +12 -0
  103. package/package.json +14 -16
  104. package/dist/_private/react/index.js +0 -2
  105. package/dist/_private/react/reconciler.js +0 -169
  106. package/dist/_private/react/render.js +0 -168
  107. package/dist/eject-theme/components/Outline/ScrollToTop.scss +0 -13
  108. package/dist/node/ssg-md/react/index.d.ts +0 -1
  109. package/dist/node/ssg-md/react/reconciler.d.ts +0 -18
  110. package/dist/node/ssg-md/react/render.d.ts +0 -2
  111. package/dist/node/ssg-md/react/render.test.d.ts +0 -1
  112. package/dist/theme/components/Outline/ScrollToTop.css +0 -14
  113. /package/dist/{8995.421b464f.js → 7744.421b464f.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useI18n } from "@rspress/core/runtime";
3
- import "./ScrollToTop.css";
3
+ import { IconScrollToTop, SvgWrapper, useReadPercent } from "@theme";
4
4
  function ScrollToTop() {
5
5
  const scrollToTop = ()=>{
6
6
  window.scrollTo({
@@ -9,41 +9,16 @@ function ScrollToTop() {
9
9
  });
10
10
  };
11
11
  const t = useI18n();
12
+ const [, scrollTop] = useReadPercent();
13
+ if (scrollTop < 100) return null;
12
14
  return /*#__PURE__*/ jsxs("button", {
13
- className: "rp-outline__scroll-to-top",
15
+ className: "rp-outline__action-row rp-scroll-to-top",
14
16
  onClick: scrollToTop,
15
17
  children: [
16
- /*#__PURE__*/ jsxs("svg", {
18
+ /*#__PURE__*/ jsx(SvgWrapper, {
19
+ icon: IconScrollToTop,
17
20
  width: "16",
18
- height: "16",
19
- viewBox: "0 0 16 16",
20
- fill: "none",
21
- xmlns: "http://www.w3.org/2000/svg",
22
- children: [
23
- /*#__PURE__*/ jsx("path", {
24
- fillRule: "evenodd",
25
- clipRule: "evenodd",
26
- d: "M7.99967 14.6667C11.6816 14.6667 14.6663 11.6819 14.6663 8.00001C14.6663 4.31811 11.6816 1.33334 7.99967 1.33334C4.31777 1.33334 1.33301 4.31811 1.33301 8.00001C1.33301 11.6819 4.31777 14.6667 7.99967 14.6667Z",
27
- stroke: "currentColor",
28
- strokeOpacity: "0.8",
29
- strokeWidth: "1.33333"
30
- }),
31
- /*#__PURE__*/ jsx("path", {
32
- d: "M7.99967 14.6667C11.6816 14.6667 14.6663 11.6819 14.6663 8.00001C14.6663 4.31811 11.6816 1.33334 7.99967 1.33334C4.31777 1.33334 1.33301 4.31811 1.33301 8.00001C1.33301 11.6819 4.31777 14.6667 7.99967 14.6667Z",
33
- stroke: "currentColor",
34
- strokeOpacity: "0.8",
35
- strokeWidth: "1.33333",
36
- strokeLinejoin: "round"
37
- }),
38
- /*#__PURE__*/ jsx("path", {
39
- d: "M11 9L8 6L5 9",
40
- stroke: "currentColor",
41
- strokeOpacity: "0.8",
42
- strokeWidth: "1.33333",
43
- strokeLinecap: "round",
44
- strokeLinejoin: "round"
45
- })
46
- ]
21
+ height: "16"
47
22
  }),
48
23
  /*#__PURE__*/ jsx("span", {
49
24
  children: t('scrollToTopText')
@@ -13,9 +13,9 @@
13
13
  padding-right: var(--rp-outline-padding-x);
14
14
  height: 32px;
15
15
  color: var(--rp-c-text-1);
16
+ flex-shrink: 0;
16
17
  align-items: center;
17
18
  gap: 4px;
18
- margin-bottom: 4px;
19
19
  font-size: 14px;
20
20
  font-style: normal;
21
21
  font-weight: 700;
@@ -33,28 +33,63 @@
33
33
  margin-left: var(--rp-outline-padding-x);
34
34
  margin-right: var(--rp-outline-padding-x);
35
35
  background: var(--rp-c-divider-light);
36
+ flex-shrink: 0;
36
37
  height: 1px;
37
38
  margin-top: 16px;
38
39
  margin-bottom: 16px;
39
40
  }
40
41
 
41
42
  .rp-outline__toc {
42
- padding-left: var(--rp-outline-padding-x);
43
- padding-right: var(--rp-outline-padding-x);
43
+ padding: 4px var(--rp-outline-padding-x);
44
+ scrollbar-width: none;
44
45
  flex-direction: column;
45
46
  flex: 1;
47
+ min-height: 0;
48
+ max-height: 70vh;
46
49
  display: flex;
50
+ overflow: auto scroll;
51
+ mask-image: linear-gradient(#0000, #fff 12px calc(100% - 12px), #0000);
47
52
  }
48
53
 
49
54
  @media (width <= 1280px) {
50
55
  .rp-outline__toc {
51
56
  max-height: 60vh;
52
- overflow: auto scroll;
53
57
  }
54
58
  }
55
59
 
56
60
  .rp-outline__bottom {
57
61
  padding-left: var(--rp-outline-padding-x);
58
62
  padding-right: var(--rp-outline-padding-x);
63
+ flex-direction: column;
64
+ flex-shrink: 0;
65
+ gap: 10px;
66
+ display: flex;
67
+ }
68
+
69
+ .rp-outline__action-row {
70
+ cursor: pointer;
71
+ color: var(--rp-c-text-2);
72
+ background: none;
73
+ border: none;
74
+ align-items: center;
75
+ gap: 8px;
76
+ padding: 0;
77
+ font-size: .875rem;
78
+ font-style: normal;
79
+ font-weight: 400;
80
+ line-height: 20px;
81
+ text-decoration: none;
82
+ transition: color .2s;
83
+ display: flex;
84
+ }
85
+
86
+ .rp-outline__action-row:hover {
87
+ color: var(--rp-c-text-1);
88
+ }
89
+
90
+ .rp-outline__action-row svg {
91
+ flex-shrink: 0;
92
+ width: 16px;
93
+ height: 16px;
59
94
  }
60
95
 
@@ -1,13 +1,14 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useI18n, useSite } from "@rspress/core/runtime";
3
- import { ReadPercent, Toc, useDynamicToc } from "@theme";
3
+ import { EditLink, LlmsCopyRow, LlmsOpenRow, ReadPercent, Toc, useDynamicToc } from "@theme";
4
4
  import "./index.css";
5
5
  import { ScrollToTop } from "./ScrollToTop.js";
6
6
  function Outline() {
7
7
  const t = useI18n();
8
8
  const headers = useDynamicToc();
9
- const { site: { themeConfig: { enableScrollToTop = true } } } = useSite();
9
+ const { site: { themeConfig: { enableScrollToTop = true, llmsUI } } } = useSite();
10
10
  if (0 === headers.length) return /*#__PURE__*/ jsx(Fragment, {});
11
+ const placement = 'object' == typeof llmsUI ? llmsUI?.placement ?? 'title' : 'title';
11
12
  return /*#__PURE__*/ jsxs("div", {
12
13
  className: "rp-outline",
13
14
  children: [
@@ -28,9 +29,20 @@ function Outline() {
28
29
  /*#__PURE__*/ jsx("div", {
29
30
  className: "rp-outline__divider"
30
31
  }),
31
- /*#__PURE__*/ jsx("div", {
32
+ /*#__PURE__*/ jsxs("div", {
32
33
  className: "rp-outline__bottom",
33
- children: enableScrollToTop && /*#__PURE__*/ jsx(ScrollToTop, {})
34
+ children: [
35
+ /*#__PURE__*/ jsx(EditLink, {
36
+ isOutline: true
37
+ }),
38
+ process.env.ENABLE_LLMS_UI && 'outline' === placement && /*#__PURE__*/ jsxs(Fragment, {
39
+ children: [
40
+ /*#__PURE__*/ jsx(LlmsCopyRow, {}),
41
+ /*#__PURE__*/ jsx(LlmsOpenRow, {})
42
+ ]
43
+ }),
44
+ enableScrollToTop && /*#__PURE__*/ jsx(ScrollToTop, {})
45
+ ]
34
46
  })
35
47
  ]
36
48
  });
@@ -8,8 +8,15 @@ import { Pnpm } from "./icons/Pnpm.js";
8
8
  import { Yarn } from "./icons/Yarn.js";
9
9
  const transformDenoPositional = (cmd)=>{
10
10
  const parts = cmd.split(' ');
11
+ const subcommand = parts[1];
12
+ const isRun = 'run' === subcommand;
13
+ let transformedFirst = false;
11
14
  const transformed = parts.map((tok, idx)=>{
12
- if (idx >= 2 && !tok.startsWith('-') && !tok.includes(':') && !/^https?:/.test(tok)) return `npm:${tok}`;
15
+ if (idx >= 2 && !tok.startsWith('-') && !tok.includes(':') && !/^https?:/.test(tok)) {
16
+ if (isRun && transformedFirst) return tok;
17
+ transformedFirst = true;
18
+ return `npm:${tok}`;
19
+ }
13
20
  return tok;
14
21
  });
15
22
  return transformed.join(' ');
@@ -69,7 +76,7 @@ function PackageManagerTabs({ command, exec, dlx, additionalTabs = [] }) {
69
76
  case 'bun':
70
77
  return 'bunx';
71
78
  case 'deno':
72
- return 'deno run';
79
+ return 'deno run -A';
73
80
  default:
74
81
  return packageManager;
75
82
  }
@@ -84,7 +91,7 @@ function PackageManagerTabs({ command, exec, dlx, additionalTabs = [] }) {
84
91
  case 'bun':
85
92
  return 'bun';
86
93
  case 'deno':
87
- return 'deno run';
94
+ return 'deno run -A';
88
95
  default:
89
96
  return packageManager;
90
97
  }
@@ -58,7 +58,7 @@ function SearchPanel({ focused, setFocused }) {
58
58
  const t = useI18n();
59
59
  const navigate = useLinkNavigate();
60
60
  const { search, title: siteTitle } = siteData;
61
- const versionedSearch = 'boolean' != typeof search && search?.versioned;
61
+ const versionedSearch = 'boolean' != typeof search && (search?.versioned ?? true);
62
62
  const DEFAULT_RESULT = [
63
63
  {
64
64
  group: siteTitle,
@@ -41,7 +41,7 @@ class LocalProvider {
41
41
  async fetchSearchIndex(options) {
42
42
  if (this.#fetchPromise) return this.#fetchPromise;
43
43
  const { currentLang, currentVersion } = options;
44
- const versioned = options.versioned;
44
+ const versioned = options.versioned ?? true;
45
45
  this.#fetchPromise = this.#getPages(currentLang, versioned ? currentVersion : '');
46
46
  return this.#fetchPromise;
47
47
  }
@@ -33,9 +33,7 @@
33
33
  margin-right: .1em;
34
34
  font-size: 1em;
35
35
  font-weight: 400;
36
- transition: transform .2s;
37
36
  display: inline-block;
38
- transform: translate(0, -.2em);
39
37
  }
40
38
 
41
39
  .rp-sidebar-item--active {
@@ -1,7 +1,6 @@
1
1
  import './index.scss';
2
- interface SourceCodeProps {
2
+ export interface SourceCodeProps {
3
3
  href: string;
4
4
  platform?: 'github' | 'gitlab';
5
5
  }
6
6
  export declare function SourceCode(props: SourceCodeProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,4 +1,4 @@
1
- type SvgWrapperProps = {
1
+ export type SvgWrapperProps = {
2
2
  icon: string | React.FC<React.SVGProps<SVGSVGElement>>;
3
3
  } & React.SVGProps<SVGSVGElement>;
4
4
  /**
@@ -11,4 +11,3 @@ type SvgWrapperProps = {
11
11
  * @internal
12
12
  */
13
13
  export declare function SvgWrapper({ icon: Icon, ...rest }: SvgWrapperProps): import("react/jsx-runtime").JSX.Element | null;
14
- export {};
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { normalizeImagePath } from "@rspress/core/runtime";
2
3
  import { renderHtmlOrText } from "@theme";
3
4
  function isUrlOrPath(str) {
4
5
  return str.startsWith('/') || str.startsWith('./') || str.startsWith('../') || str.startsWith('http://') || str.startsWith('https://') || str.startsWith('data:');
@@ -15,7 +16,7 @@ function SvgWrapper({ icon: Icon, ...rest }) {
15
16
  });
16
17
  if (isUrlOrPath(Icon)) return /*#__PURE__*/ jsx("img", {
17
18
  className: className,
18
- src: Icon,
19
+ src: normalizeImagePath(Icon),
19
20
  alt: ""
20
21
  });
21
22
  return /*#__PURE__*/ jsx("span", {
@@ -40,7 +40,7 @@
40
40
  box-sizing: border-box;
41
41
  user-select: none;
42
42
  cursor: pointer;
43
- border-radius: var(--rp-radius-small);
43
+ border-radius: calc(1.5 * var(--rp-radius-small));
44
44
  margin-right: 4px;
45
45
  padding: 4px 12px;
46
46
  font-size: .875rem;
@@ -5,7 +5,7 @@ type TabItem = {
5
5
  disabled?: boolean;
6
6
  content?: ReactNode;
7
7
  };
8
- interface TabsProps {
8
+ export interface TabsProps {
9
9
  values?: ReactNode[] | ReadonlyArray<ReactNode> | TabItem[];
10
10
  /**
11
11
  * @default 0
@@ -6,6 +6,7 @@ export declare const IconArrowRight: Icon;
6
6
  export declare const IconClose: Icon;
7
7
  export declare const IconCopy: Icon;
8
8
  export declare const IconDown: Icon;
9
+ export declare const IconEdit: Icon;
9
10
  export declare const IconEmpty: Icon;
10
11
  export declare const IconFile: Icon;
11
12
  export declare const IconGithub: Icon;
@@ -15,6 +16,7 @@ export declare const IconJump: Icon;
15
16
  export declare const IconLoading: Icon;
16
17
  export declare const IconMenu: Icon;
17
18
  export declare const IconMoon: Icon;
19
+ export declare const IconScrollToTop: Icon;
18
20
  export declare const IconSearch: Icon;
19
21
  export declare const IconSmallMenu: Icon;
20
22
  export declare const IconSuccess: Icon;
@@ -4,6 +4,7 @@ import assets_close from "./assets/close.js";
4
4
  import copy from "./assets/copy.js";
5
5
  import deprecated from "./assets/deprecated.js";
6
6
  import down from "./assets/down.js";
7
+ import edit from "./assets/edit.js";
7
8
  import empty from "./assets/empty.js";
8
9
  import experimental from "./assets/experimental.js";
9
10
  import external_link from "./assets/external-link.js";
@@ -16,6 +17,7 @@ import assets_link from "./assets/link.js";
16
17
  import loading from "./assets/loading.js";
17
18
  import menu from "./assets/menu.js";
18
19
  import moon from "./assets/moon.js";
20
+ import scroll_to_top from "./assets/scroll-to-top.js";
19
21
  import search from "./assets/search.js";
20
22
  import small_menu from "./assets/small-menu.js";
21
23
  import success from "./assets/success.js";
@@ -30,6 +32,7 @@ const IconArrowRight = arrow_right;
30
32
  const IconClose = assets_close;
31
33
  const IconCopy = copy;
32
34
  const IconDown = down;
35
+ const IconEdit = edit;
33
36
  const IconEmpty = empty;
34
37
  const IconFile = file;
35
38
  const IconGithub = github;
@@ -39,6 +42,7 @@ const IconJump = jump;
39
42
  const IconLoading = loading;
40
43
  const IconMenu = menu;
41
44
  const IconMoon = moon;
45
+ const IconScrollToTop = scroll_to_top;
42
46
  const IconSearch = search;
43
47
  const IconSmallMenu = small_menu;
44
48
  const IconSuccess = success;
@@ -48,4 +52,4 @@ const IconWrap = wrap;
48
52
  const IconWrapped = wrapped;
49
53
  const IconExternalLink = external_link;
50
54
  const IconLink = assets_link;
51
- export { IconArrowDown, IconArrowRight, IconClose, IconCopy, IconDeprecated, IconDown, IconEmpty, IconExperimental, IconExternalLink, IconFile, IconGithub, IconGitlab, IconHeader, IconJump, IconLink, IconLoading, IconMenu, IconMoon, IconSearch, IconSmallMenu, IconSuccess, IconSun, IconTitle, IconWrap, IconWrapped };
55
+ export { IconArrowDown, IconArrowRight, IconClose, IconCopy, IconDeprecated, IconDown, IconEdit, IconEmpty, IconExperimental, IconExternalLink, IconFile, IconGithub, IconGitlab, IconHeader, IconJump, IconLink, IconLoading, IconMenu, IconMoon, IconScrollToTop, IconSearch, IconSmallMenu, IconSuccess, IconSun, IconTitle, IconWrap, IconWrapped };
@@ -1,6 +1,6 @@
1
- export { Badge } from './components/Badge/index.js';
1
+ export { Badge, type BadgeProps } from './components/Badge/index.js';
2
2
  export { Banner, type BannerProps } from './components/Banner/index.js';
3
- export { Button } from './components/Button/index.js';
3
+ export { Button, type ButtonProps } from './components/Button/index.js';
4
4
  export { Callout, type CalloutProps } from './components/Callout/index.js';
5
5
  export { CodeBlock, type CodeBlockProps } from './components/CodeBlock/index.js';
6
6
  export { CodeBlockRuntime, type CodeBlockRuntimeProps, } from './components/CodeBlockRuntime/index.js';
@@ -22,6 +22,8 @@ export { LastUpdated } from './components/LastUpdated/index.js';
22
22
  export { Link, type LinkProps } from './components/Link/index.js';
23
23
  export { useLinkNavigate } from './components/Link/useLinkNavigate.js';
24
24
  export { LlmsContainer, type LlmsContainerProps, LlmsCopyButton, type LlmsCopyButtonProps, LlmsViewOptions, type LlmsViewOptionsProps, useMdUrl, } from './components/Llms/index.js';
25
+ export { LlmsCopyRow } from './components/Llms/LlmsCopyRow.js';
26
+ export { LlmsOpenRow } from './components/Llms/LlmsOpenRow.js';
25
27
  export { Nav, type NavProps } from './components/Nav/index.js';
26
28
  export { NavHamburger } from './components/NavHamburger/index.js';
27
29
  export { NavTitle } from './components/NavTitle/index.js';
@@ -32,6 +34,7 @@ export { type PackageManagerTabProps, PackageManagerTabs, } from './components/P
32
34
  export { PageTab, type PageTabProps, PageTabs, type PageTabsProps, } from './components/PageTabs/index.js';
33
35
  export { PrevNextPage } from './components/PrevNextPage/index.js';
34
36
  export { ReadPercent } from './components/ReadPercent/index.js';
37
+ export { useReadPercent } from './components/ReadPercent/useReadPercent.js';
35
38
  export { Root, type RootProps } from './components/Root/index.js';
36
39
  export { Search } from './components/Search/index.js';
37
40
  export type { AfterSearch, BeforeSearch, CustomMatchResult, DefaultMatchResult, DefaultMatchResultItem, HighlightInfo, MatchResult, OnSearch, PageSearcherConfig, RenderSearchFunction, SearchOptions, UserMatchResultItem, } from './components/Search/logic/types.js';
@@ -40,11 +43,11 @@ export { SearchButton, type SearchButtonProps, } from './components/Search/Searc
40
43
  export { SearchPanel, type SearchPanelProps, } from './components/Search/SearchPanel.js';
41
44
  export { Sidebar, SidebarList } from './components/Sidebar/index.js';
42
45
  export { SocialLinks } from './components/SocialLinks/index.js';
43
- export { SourceCode } from './components/SourceCode/index.js';
46
+ export { SourceCode, type SourceCodeProps, } from './components/SourceCode/index.js';
44
47
  export { Steps } from './components/Steps/index.js';
45
- export { SvgWrapper } from './components/SvgWrapper/index.js';
48
+ export { SvgWrapper, type SvgWrapperProps, } from './components/SvgWrapper/index.js';
46
49
  export { SwitchAppearance } from './components/SwitchAppearance/index.js';
47
- export { Tab, Tabs } from './components/Tabs/index.js';
50
+ export { Tab, type TabProps, Tabs, type TabsProps, } from './components/Tabs/index.js';
48
51
  export { Tag } from './components/Tag/index.js';
49
52
  export { Toc } from './components/Toc/index.js';
50
53
  export { useActiveAnchor } from './hooks/useActiveAnchor.js';
@@ -21,6 +21,8 @@ import { LastUpdated } from "./components/LastUpdated/index.js";
21
21
  import { Link } from "./components/Link/index.js";
22
22
  import { useLinkNavigate } from "./components/Link/useLinkNavigate.js";
23
23
  import { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl } from "./components/Llms/index.js";
24
+ import { LlmsCopyRow } from "./components/Llms/LlmsCopyRow.js";
25
+ import { LlmsOpenRow } from "./components/Llms/LlmsOpenRow.js";
24
26
  import { Nav } from "./components/Nav/index.js";
25
27
  import { NavHamburger } from "./components/NavHamburger/index.js";
26
28
  import { NavTitle } from "./components/NavTitle/index.js";
@@ -31,6 +33,7 @@ import { PackageManagerTabs } from "./components/PackageManagerTabs/index.js";
31
33
  import { PageTab, PageTabs } from "./components/PageTabs/index.js";
32
34
  import { PrevNextPage } from "./components/PrevNextPage/index.js";
33
35
  import { ReadPercent } from "./components/ReadPercent/index.js";
36
+ import { useReadPercent } from "./components/ReadPercent/useReadPercent.js";
34
37
  import { Root } from "./components/Root/index.js";
35
38
  import { Search } from "./components/Search/index.js";
36
39
  import { RenderType } from "./components/Search/logic/types.js";
@@ -62,4 +65,4 @@ import { useStorageValue } from "./logic/useStorageValue.js";
62
65
  import { useThemeState } from "./logic/useThemeState.js";
63
66
  import { parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown } from "./logic/utils.js";
64
67
  export * from "./icons.js";
65
- export { Badge, Banner, Button, Callout, CodeBlock, CodeBlockRuntime, CodeButtonGroup, DocContent, DocFooter, DocLayout, EditLink, FallbackHeading, HomeBackground, HomeFeature, HomeFooter, HomeHero, HomeLayout, HoverGroup, LastUpdated, Layout, Link, LlmsContainer, LlmsCopyButton, LlmsViewOptions, Nav, NavHamburger, NavTitle, NotFoundLayout, Outline, Overview, OverviewGroup, PackageManagerTabs, PageTab, PageTabs, PrevNextPage, ReadPercent, RenderType, Root, Search, SearchButton, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SvgWrapper, SwitchAppearance, Tab, Tabs, Tag, Toc, getCustomMDXComponent, mergeRefs, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, useActiveAnchor, useCodeButtonGroup, useDynamicToc, useEditLink, useFullTextSearch, useHoverGroup, useLinkNavigate, useMdUrl, usePrevNextPage, useRedirect4FirstVisit, useScrollAfterNav, useScrollReset, useSetup, useStorageValue, useThemeState, useWatchToc };
68
+ export { Badge, Banner, Button, Callout, CodeBlock, CodeBlockRuntime, CodeButtonGroup, DocContent, DocFooter, DocLayout, EditLink, FallbackHeading, HomeBackground, HomeFeature, HomeFooter, HomeHero, HomeLayout, HoverGroup, LastUpdated, Layout, Link, LlmsContainer, LlmsCopyButton, LlmsCopyRow, LlmsOpenRow, LlmsViewOptions, Nav, NavHamburger, NavTitle, NotFoundLayout, Outline, Overview, OverviewGroup, PackageManagerTabs, PageTab, PageTabs, PrevNextPage, ReadPercent, RenderType, Root, Search, SearchButton, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SvgWrapper, SwitchAppearance, Tab, Tabs, Tag, Toc, getCustomMDXComponent, mergeRefs, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, useActiveAnchor, useCodeButtonGroup, useDynamicToc, useEditLink, useFullTextSearch, useHoverGroup, useLinkNavigate, useMdUrl, usePrevNextPage, useReadPercent, useRedirect4FirstVisit, useScrollAfterNav, useScrollReset, useSetup, useStorageValue, useThemeState, useWatchToc };
@@ -77,12 +77,11 @@
77
77
  margin-top: var(--rp-sidebar-menu-height);
78
78
  z-index: var(--rp-z-index-aside);
79
79
  padding-top: var(--rp-content-padding-y);
80
- scrollbar-width: none;
81
- max-height: calc(100vh - var(--rp-nav-height) - var(--rp-banner-height, 0px));
80
+ height: calc(100vh - var(--rp-nav-height) - var(--rp-banner-height, 0px));
82
81
  box-shadow: var(--rp-shadow-1);
83
82
  position: sticky;
84
83
  right: 0;
85
- overflow: hidden scroll;
84
+ overflow: hidden;
86
85
  }
87
86
 
88
87
  .rp-doc-layout__menu {
@@ -142,6 +141,7 @@
142
141
  backdrop-filter: blur(25px);
143
142
  border-radius: var(--rp-radius-small);
144
143
  max-width: 100%;
144
+ height: auto;
145
145
  box-shadow: var(--rp-shadow-2);
146
146
  visibility: hidden;
147
147
  opacity: 0;
@@ -43,6 +43,10 @@ body {
43
43
  text-autospace: normal;
44
44
  }
45
45
 
46
+ pre {
47
+ text-autospace: no-autospace;
48
+ }
49
+
46
50
  :root #nprogress .bar {
47
51
  background: var(--rp-c-brand);
48
52
  }
@@ -42,6 +42,12 @@
42
42
  "left",
43
43
  "right"
44
44
  ]
45
+ },
46
+ "lang": {
47
+ "type": "string"
48
+ },
49
+ "rel": {
50
+ "type": "string"
45
51
  }
46
52
  },
47
53
  "required": [
@@ -105,6 +111,12 @@
105
111
  "left",
106
112
  "right"
107
113
  ]
114
+ },
115
+ "lang": {
116
+ "type": "string"
117
+ },
118
+ "rel": {
119
+ "type": "string"
108
120
  }
109
121
  },
110
122
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -41,9 +41,6 @@
41
41
  "./shiki-transformers": {
42
42
  "types": "./dist/shiki-transformers.d.ts",
43
43
  "default": "./dist/shiki-transformers.js"
44
- },
45
- "./_private/react": {
46
- "default": "./dist/_private/react/index.js"
47
44
  }
48
45
  },
49
46
  "main": "./dist/index.js",
@@ -63,13 +60,13 @@
63
60
  "dependencies": {
64
61
  "@mdx-js/mdx": "^3.1.1",
65
62
  "@mdx-js/react": "^3.1.1",
66
- "@rsbuild/core": "2.0.0-beta.3",
63
+ "@rsbuild/core": "2.0.0-beta.6",
67
64
  "@rsbuild/plugin-react": "~1.4.5",
68
- "@shikijs/rehype": "^3.21.0",
65
+ "@shikijs/rehype": "^4.0.1",
69
66
  "@types/unist": "^3.0.3",
70
- "@unhead/react": "^2.1.4",
67
+ "@unhead/react": "^2.1.9",
71
68
  "body-scroll-lock": "4.0.0-beta.0",
72
- "cac": "^6.7.14",
69
+ "cac": "^7.0.0",
73
70
  "chokidar": "^3.6.0",
74
71
  "clsx": "2.1.1",
75
72
  "copy-to-clipboard": "^3.3.3",
@@ -87,7 +84,8 @@
87
84
  "react-dom": "^19.2.4",
88
85
  "react-lazy-with-preload": "^2.2.1",
89
86
  "react-reconciler": "0.33.0",
90
- "react-router-dom": "^7.13.0",
87
+ "react-render-to-markdown": "19.0.1",
88
+ "react-router-dom": "^7.13.1",
91
89
  "rehype-external-links": "^3.0.0",
92
90
  "rehype-raw": "^7.0.0",
93
91
  "remark-gfm": "^4.0.1",
@@ -95,30 +93,30 @@
95
93
  "remark-parse": "^11.0.0",
96
94
  "remark-stringify": "^11.0.0",
97
95
  "scroll-into-view-if-needed": "^3.1.0",
98
- "shiki": "^3.21.0",
96
+ "shiki": "^4.0.1",
99
97
  "tinyglobby": "^0.2.15",
100
98
  "tinypool": "^1.1.1",
101
99
  "unified": "^11.0.5",
102
100
  "unist-util-remove": "^4.0.0",
103
101
  "unist-util-visit": "^5.0.0",
104
102
  "unist-util-visit-children": "^3.0.0",
105
- "@rspress/shared": "2.0.3"
103
+ "@rspress/shared": "2.0.4"
106
104
  },
107
105
  "devDependencies": {
108
- "@microsoft/api-extractor": "^7.56.3",
106
+ "@microsoft/api-extractor": "^7.57.6",
109
107
  "@rsbuild/plugin-sass": "~1.5.0",
110
108
  "@rsbuild/plugin-svgr": "^1.3.0",
111
- "@rslib/core": "0.19.5",
109
+ "@rslib/core": "0.19.6",
112
110
  "@types/body-scroll-lock": "^3.1.2",
113
111
  "@types/hast": "^3.0.4",
114
112
  "@types/lodash-es": "^4.17.12",
115
113
  "@types/mdast": "^4.0.4",
116
114
  "@types/node": "^22.8.1",
117
115
  "@types/nprogress": "^0.2.3",
118
- "@types/react": "^19.2.13",
116
+ "@types/react": "^19.2.14",
119
117
  "@types/react-dom": "^19.2.3",
120
- "@types/react-reconciler": "^0.32.3",
121
- "@types/web": "^0.0.330",
118
+ "@types/react-reconciler": "^0.33.0",
119
+ "@types/web": "^0.0.338",
122
120
  "execa": "8.0.1",
123
121
  "mdast-util-directive": "^3.1.0",
124
122
  "mdast-util-mdx-expression": "^2.0.1",
@@ -1,2 +0,0 @@
1
- import { renderToMarkdownString } from "./render.js";
2
- export { renderToMarkdownString };