@rspress/core 2.0.5 → 2.0.7

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 (265) hide show
  1. package/dist/0~1402.js +1 -0
  2. package/dist/{0~7675.423f6a06.js → 0~execa.js} +6 -5
  3. package/dist/1361.js +5 -0
  4. package/dist/1965.js +7 -0
  5. package/dist/4454.js +8 -0
  6. package/dist/{7744.421b464f.js → 4524.js} +20 -5
  7. package/dist/7397.js +18 -0
  8. package/dist/{5485.0bb24594.js → 8311.js} +5 -2
  9. package/dist/8474.js +4 -0
  10. package/dist/8885.js +4 -0
  11. package/dist/cli/index.js +2 -3
  12. package/dist/config/loadConfigFile.js +1 -2
  13. package/dist/eject-theme/components/Banner/index.tsx +1 -1
  14. package/dist/eject-theme/components/Button/index.tsx +1 -1
  15. package/dist/eject-theme/components/CodeBlock/index.scss +54 -1
  16. package/dist/eject-theme/components/CodeBlock/index.tsx +77 -7
  17. package/dist/eject-theme/components/CodeBlockRuntime/index.tsx +12 -2
  18. package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -1
  19. package/dist/eject-theme/components/CodeButtonGroup/index.tsx +15 -15
  20. package/dist/eject-theme/components/DocContent/docComponents/a.tsx +1 -1
  21. package/dist/eject-theme/components/DocContent/docComponents/pre.tsx +5 -1
  22. package/dist/eject-theme/components/DocContent/docComponents/title.tsx +6 -1
  23. package/dist/eject-theme/components/DocContent/index.tsx +1 -1
  24. package/dist/eject-theme/components/DocFooter/index.tsx +1 -1
  25. package/dist/eject-theme/components/EditLink/index.tsx +1 -1
  26. package/dist/eject-theme/components/FallbackHeading/index.tsx +4 -1
  27. package/dist/eject-theme/components/HomeFeature/index.tsx +5 -1
  28. package/dist/eject-theme/components/HomeFooter/index.tsx +1 -1
  29. package/dist/eject-theme/components/HomeHero/index.tsx +2 -2
  30. package/dist/eject-theme/components/HoverGroup/index.tsx +5 -2
  31. package/dist/eject-theme/components/Link/useLinkNavigate.ts +1 -1
  32. package/dist/eject-theme/components/Llms/LlmsCopyButton.tsx +3 -2
  33. package/dist/eject-theme/components/Llms/LlmsCopyRow.tsx +3 -2
  34. package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +1 -1
  35. package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +3 -2
  36. package/dist/eject-theme/components/Llms/copy.ts +12 -0
  37. package/dist/eject-theme/components/Nav/NavMenu.tsx +9 -2
  38. package/dist/eject-theme/components/Nav/index.tsx +1 -1
  39. package/dist/eject-theme/components/NavHamburger/index.tsx +6 -1
  40. package/dist/eject-theme/components/NavScreen/NavScreenAppearance.tsx +1 -1
  41. package/dist/eject-theme/components/NavScreen/NavScreenLangs.tsx +1 -1
  42. package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +5 -1
  43. package/dist/eject-theme/components/NavScreen/NavScreenMenuOthers.tsx +1 -1
  44. package/dist/eject-theme/components/NavScreen/NavScreenVersions.tsx +1 -1
  45. package/dist/eject-theme/components/NavScreen/index.tsx +1 -1
  46. package/dist/eject-theme/components/NavTitle/index.tsx +1 -1
  47. package/dist/eject-theme/components/Outline/ScrollToTop.tsx +5 -1
  48. package/dist/eject-theme/components/Outline/index.tsx +1 -1
  49. package/dist/eject-theme/components/Overview/index.tsx +1 -1
  50. package/dist/eject-theme/components/OverviewGroup/index.tsx +2 -2
  51. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +1 -1
  52. package/dist/eject-theme/components/PrevNextPage/index.tsx +1 -1
  53. package/dist/eject-theme/components/Root/index.tsx +1 -1
  54. package/dist/eject-theme/components/Search/NoSearchResult.tsx +1 -1
  55. package/dist/eject-theme/components/Search/SearchButton.tsx +1 -1
  56. package/dist/eject-theme/components/Search/SearchPanel.tsx +3 -1
  57. package/dist/eject-theme/components/Search/SuggestItem.tsx +1 -1
  58. package/dist/eject-theme/components/Search/index.tsx +1 -1
  59. package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +5 -1
  60. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +0 -4
  61. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -1
  62. package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.tsx +1 -1
  63. package/dist/eject-theme/components/SidebarMenu/index.tsx +1 -1
  64. package/dist/eject-theme/components/SocialLinks/index.tsx +1 -1
  65. package/dist/eject-theme/components/SourceCode/index.tsx +1 -1
  66. package/dist/eject-theme/components/SvgWrapper/index.tsx +1 -1
  67. package/dist/eject-theme/components/SwitchAppearance/index.tsx +1 -1
  68. package/dist/eject-theme/components/Tabs/index.scss +13 -15
  69. package/dist/eject-theme/components/Tabs/index.tsx +1 -1
  70. package/dist/eject-theme/components/Tag/index.tsx +1 -1
  71. package/dist/eject-theme/components/Toc/TocItem.tsx +5 -1
  72. package/dist/eject-theme/components/Toc/index.tsx +1 -1
  73. package/dist/index.js +1 -3
  74. package/dist/node/PluginDriver.js +3 -8
  75. package/dist/node/auto-nav-sidebar/index.js +1 -2
  76. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  77. package/dist/node/auto-nav-sidebar/normalize.js +3 -2
  78. package/dist/node/auto-nav-sidebar/utils.js +1 -2
  79. package/dist/node/auto-nav-sidebar/walk.js +1 -2
  80. package/dist/node/constants.js +1 -2
  81. package/dist/node/eject.js +1 -1
  82. package/dist/node/initRsbuild.js +2 -4
  83. package/dist/node/last-updated/index.js +1 -1
  84. package/dist/node/logger/hint.js +4 -1
  85. package/dist/node/mdx/options.js +1 -3
  86. package/dist/node/mdx/processor.js +1 -2
  87. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  88. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -2
  89. package/dist/node/mdx/rehypePlugins/shiki.d.ts +1 -1
  90. package/dist/node/mdx/rehypePlugins/shiki.js +2 -1
  91. package/dist/node/mdx/rehypePlugins/transformers/add-fold.d.ts +6 -0
  92. package/dist/node/mdx/rehypePlugins/transformers/add-fold.js +38 -0
  93. package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +1 -0
  94. package/dist/node/mdx/rehypePlugins/transformers/index.js +1 -0
  95. package/dist/node/mdx/rehypePlugins/transformers/meta-highlight.js +1 -1
  96. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  97. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +1 -2
  98. package/dist/node/mdx/remarkPlugins/image.js +1 -1
  99. package/dist/node/mdx/remarkPlugins/link.js +1 -2
  100. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  101. package/dist/node/medium-zoom/index.js +1 -1
  102. package/dist/node/route/RoutePage.js +1 -1
  103. package/dist/node/route/RouteService.js +1 -3
  104. package/dist/node/route/extractPageData.js +1 -3
  105. package/dist/node/route/normalizeRoutePath.js +1 -2
  106. package/dist/node/runtimeModule/i18n.js +2 -3
  107. package/dist/node/runtimeModule/pageData/createPageData.js +1 -2
  108. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -2
  109. package/dist/node/runtimeModule/searchHooks.js +1 -1
  110. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  111. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  112. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  113. package/dist/node/serve.js +1 -1
  114. package/dist/node/ssg/renderPage.js +1 -2
  115. package/dist/node/ssg/renderPageWorker.js +2 -2
  116. package/dist/node/ssg/renderPages.js +3 -4
  117. package/dist/node/ssg/rsbuildPluginSSG.js +1 -2
  118. package/dist/node/ssg/ssgEnv.d.ts +1 -1
  119. package/dist/node/ssg/ssgEnv.js +2 -2
  120. package/dist/node/ssg-md/llms/emitLlmsTxt.js +5 -7
  121. package/dist/node/ssg-md/llms/llmsTxt.js +1 -2
  122. package/dist/node/ssg-md/remarkSplitMdx.js +1 -2
  123. package/dist/node/ssg-md/renderPage.js +1 -2
  124. package/dist/node/ssg-md/renderPages.js +2 -2
  125. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -2
  126. package/dist/node/utils/checkLanguageParity.js +1 -1
  127. package/dist/node/utils/createHash.js +1 -1
  128. package/dist/node/utils/error.js +1 -1
  129. package/dist/node/utils/flattenMdxContent.js +1 -3
  130. package/dist/node/utils/fs.js +1 -1
  131. package/dist/node/utils/getPageKey.js +1 -1
  132. package/dist/node/utils/normalizePath.js +1 -2
  133. package/dist/node/utils/reactAlias.js +15 -10
  134. package/dist/runtime/index.js +20 -21
  135. package/dist/runtime/ssrMdServerEntry.js +2 -2
  136. package/dist/runtime/ssrServerEntry.js +2 -2
  137. package/dist/runtime/utils.d.ts +1 -1
  138. package/dist/runtime/utils.js +1 -1
  139. package/dist/shiki-transformers.js +1 -0
  140. package/dist/theme/assets/arrow-down.js +1 -1
  141. package/dist/theme/assets/arrow-right.js +1 -1
  142. package/dist/theme/assets/close.js +1 -1
  143. package/dist/theme/assets/copy.js +1 -1
  144. package/dist/theme/assets/deprecated.js +1 -1
  145. package/dist/theme/assets/down.js +1 -1
  146. package/dist/theme/assets/edit.js +1 -1
  147. package/dist/theme/assets/empty.js +1 -1
  148. package/dist/theme/assets/experimental.js +1 -1
  149. package/dist/theme/assets/external-link.js +1 -1
  150. package/dist/theme/assets/file.js +1 -1
  151. package/dist/theme/assets/github.js +1 -1
  152. package/dist/theme/assets/gitlab.js +1 -1
  153. package/dist/theme/assets/header.js +1 -1
  154. package/dist/theme/assets/jump.js +1 -1
  155. package/dist/theme/assets/link.js +1 -1
  156. package/dist/theme/assets/loading.js +1 -1
  157. package/dist/theme/assets/menu.js +1 -1
  158. package/dist/theme/assets/moon.js +1 -1
  159. package/dist/theme/assets/scroll-to-top.js +1 -1
  160. package/dist/theme/assets/search.js +1 -1
  161. package/dist/theme/assets/small-menu.js +1 -1
  162. package/dist/theme/assets/success.js +1 -1
  163. package/dist/theme/assets/sun.js +1 -1
  164. package/dist/theme/assets/title.js +1 -1
  165. package/dist/theme/assets/wrap.js +1 -1
  166. package/dist/theme/assets/wrapped.js +1 -1
  167. package/dist/theme/components/Banner/index.js +1 -1
  168. package/dist/theme/components/Button/index.js +1 -1
  169. package/dist/theme/components/Callout/index.js +2 -1
  170. package/dist/theme/components/CodeBlock/index.css +49 -1
  171. package/dist/theme/components/CodeBlock/index.d.ts +11 -3
  172. package/dist/theme/components/CodeBlock/index.js +51 -6
  173. package/dist/theme/components/CodeBlockRuntime/index.d.ts +2 -2
  174. package/dist/theme/components/CodeBlockRuntime/index.js +10 -2
  175. package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +1 -1
  176. package/dist/theme/components/CodeButtonGroup/index.d.ts +6 -6
  177. package/dist/theme/components/CodeButtonGroup/index.js +10 -10
  178. package/dist/theme/components/DocContent/docComponents/a.js +1 -1
  179. package/dist/theme/components/DocContent/docComponents/pre.d.ts +2 -2
  180. package/dist/theme/components/DocContent/docComponents/pre.js +4 -2
  181. package/dist/theme/components/DocContent/docComponents/title.js +1 -1
  182. package/dist/theme/components/DocContent/index.js +1 -1
  183. package/dist/theme/components/DocFooter/index.js +1 -1
  184. package/dist/theme/components/EditLink/index.js +1 -1
  185. package/dist/theme/components/FallbackHeading/index.js +1 -1
  186. package/dist/theme/components/HomeBackground/index.css +1 -0
  187. package/dist/theme/components/HomeFeature/index.css +3 -3
  188. package/dist/theme/components/HomeFeature/index.js +1 -1
  189. package/dist/theme/components/HomeFooter/index.js +1 -1
  190. package/dist/theme/components/HomeHero/index.d.ts +1 -1
  191. package/dist/theme/components/HomeHero/index.js +1 -1
  192. package/dist/theme/components/HoverGroup/index.d.ts +1 -1
  193. package/dist/theme/components/HoverGroup/index.js +4 -1
  194. package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
  195. package/dist/theme/components/Llms/LlmsCopyButton.js +4 -3
  196. package/dist/theme/components/Llms/LlmsCopyRow.js +3 -2
  197. package/dist/theme/components/Llms/LlmsOpenRow.js +1 -1
  198. package/dist/theme/components/Llms/LlmsViewOptions.js +4 -3
  199. package/dist/theme/components/Llms/copy.d.ts +1 -0
  200. package/dist/theme/components/Llms/copy.js +9 -0
  201. package/dist/theme/components/Llms/index.css +1 -0
  202. package/dist/theme/components/Llms/index.js +4 -5
  203. package/dist/theme/components/Nav/NavMenu.d.ts +1 -1
  204. package/dist/theme/components/Nav/NavMenu.js +2 -1
  205. package/dist/theme/components/Nav/index.css +1 -1
  206. package/dist/theme/components/Nav/index.js +1 -1
  207. package/dist/theme/components/NavHamburger/index.js +1 -1
  208. package/dist/theme/components/NavScreen/NavScreenAppearance.js +1 -1
  209. package/dist/theme/components/NavScreen/NavScreenLangs.js +1 -1
  210. package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +2 -1
  211. package/dist/theme/components/NavScreen/NavScreenMenuItem.js +4 -2
  212. package/dist/theme/components/NavScreen/NavScreenMenuOthers.js +1 -1
  213. package/dist/theme/components/NavScreen/NavScreenVersions.js +1 -1
  214. package/dist/theme/components/NavScreen/index.css +1 -1
  215. package/dist/theme/components/NavScreen/index.js +1 -1
  216. package/dist/theme/components/NavTitle/index.js +1 -1
  217. package/dist/theme/components/Outline/ScrollToTop.js +1 -1
  218. package/dist/theme/components/Outline/index.js +1 -1
  219. package/dist/theme/components/Overview/index.d.ts +1 -1
  220. package/dist/theme/components/Overview/index.js +1 -1
  221. package/dist/theme/components/OverviewGroup/icons/plugin.js +1 -1
  222. package/dist/theme/components/OverviewGroup/index.css +1 -0
  223. package/dist/theme/components/OverviewGroup/index.js +1 -1
  224. package/dist/theme/components/PackageManagerTabs/index.js +1 -1
  225. package/dist/theme/components/PrevNextPage/index.js +1 -1
  226. package/dist/theme/components/Root/index.d.ts +1 -1
  227. package/dist/theme/components/Search/NoSearchResult.js +1 -1
  228. package/dist/theme/components/Search/SearchButton.js +1 -1
  229. package/dist/theme/components/Search/SearchPanel.js +3 -2
  230. package/dist/theme/components/Search/SuggestItem.js +1 -1
  231. package/dist/theme/components/Search/index.js +1 -1
  232. package/dist/theme/components/Search/logic/providers/LocalProvider.js +1 -1
  233. package/dist/theme/components/Sidebar/SidebarGroup.js +1 -1
  234. package/dist/theme/components/Sidebar/SidebarItem.css +0 -4
  235. package/dist/theme/components/Sidebar/SidebarItem.js +1 -1
  236. package/dist/theme/components/Sidebar/SidebarSectionHeader.js +1 -1
  237. package/dist/theme/components/SidebarMenu/index.js +1 -1
  238. package/dist/theme/components/SocialLinks/index.js +1 -1
  239. package/dist/theme/components/SourceCode/index.js +1 -1
  240. package/dist/theme/components/SvgWrapper/index.js +1 -1
  241. package/dist/theme/components/SwitchAppearance/index.js +1 -1
  242. package/dist/theme/components/Tabs/index.css +14 -8
  243. package/dist/theme/components/Tabs/index.js +1 -1
  244. package/dist/theme/components/Tag/index.js +1 -1
  245. package/dist/theme/components/Toc/TocItem.css +1 -1
  246. package/dist/theme/components/Toc/TocItem.js +1 -1
  247. package/dist/theme/components/Toc/index.js +1 -1
  248. package/dist/theme/index.js +66 -67
  249. package/dist/theme/layout/DocLayout/index.css +11 -11
  250. package/dist/theme/layout/DocLayout/index.js +1 -1
  251. package/dist/theme/layout/HomeLayout/index.js +1 -1
  252. package/dist/theme/layout/Layout/index.d.ts +2 -2
  253. package/dist/theme/layout/Layout/index.js +16 -6
  254. package/dist/theme/layout/NotFountLayout/index.js +1 -1
  255. package/dist/theme/styles/base.css +7 -4
  256. package/dist/theme/styles/preflight.css +2 -0
  257. package/dist/theme/styles/vars/home-vars.css +28 -4
  258. package/nav-json-schema.json +3 -0
  259. package/package.json +14 -14
  260. package/dist/6289.29817fb4.js +0 -4
  261. package/dist/9348.1beb3e25.js +0 -11
  262. package/dist/cli/index.44f3184c.js +0 -2
  263. package/dist/node/mdx/loader.15134034.js +0 -9
  264. /package/dist/{node/ssg/renderPageWorker.165b5d46.js → 9224.js} +0 -0
  265. /package/dist/{rslib-runtime.99091bf6.js → rslib-runtime.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { NavItemWithChildren } from '@rspress/core';
2
2
  import { matchNavbar, useLocation } from '@rspress/core/runtime';
3
- import { Link, Tag } from '@theme';
3
+ import { Link, Tag } from '@rspress/core/theme';
4
4
  import cls from 'clsx';
5
5
 
6
6
  import './index.scss';
@@ -44,6 +44,7 @@ function HoverGroupItem({
44
44
  >
45
45
  <Link
46
46
  href={item.link}
47
+ download={'download' in item ? item.download : undefined}
47
48
  aria-label={item.text}
48
49
  className="rp-hover-group__item__link"
49
50
  lang={item.lang}
@@ -69,6 +70,7 @@ function HoverGroupItem({
69
70
 
70
71
  if ('link' in item) {
71
72
  const { text, link, lang, rel } = item;
73
+ const download = 'download' in item ? item.download : undefined;
72
74
  const isActiveItem = activeMatcher
73
75
  ? activeMatcher(item)
74
76
  : matchNavbar(item, pathname);
@@ -85,6 +87,7 @@ function HoverGroupItem({
85
87
  {link ? (
86
88
  <Link
87
89
  href={link}
90
+ download={download}
88
91
  aria-label={text}
89
92
  className="rp-hover-group__item__link"
90
93
  lang={lang}
@@ -147,5 +150,5 @@ function HoverGroup({
147
150
  );
148
151
  }
149
152
 
150
- export { HoverGroup };
151
153
  export type { HoverGroupProps, Items };
154
+ export { HoverGroup };
@@ -61,7 +61,7 @@ export function getHref(href: string): {
61
61
  }
62
62
 
63
63
  /**
64
- * For import { Link } from '@theme';
64
+ * For import { Link } from '@rspress/core/theme';
65
65
  * useNavigate with preload logic
66
66
  */
67
67
  export function useLinkNavigate(
@@ -4,11 +4,12 @@
4
4
  * @license MIT
5
5
  */
6
6
  import { useI18n } from '@rspress/core/runtime';
7
- import { IconCopy, IconSuccess } from '@theme';
7
+ import { IconCopy, IconSuccess } from '@rspress/core/theme';
8
8
  import { useCallback, useRef, useState } from 'react';
9
9
  import { SvgWrapper } from '../SvgWrapper';
10
10
  import './index.scss';
11
11
  import './LlmsCopyButton.scss';
12
+ import { copyToClipboard } from './copy';
12
13
  import { useMdUrl } from './useMdUrl';
13
14
 
14
15
  export interface LlmsCopyButtonProps
@@ -51,7 +52,7 @@ export function LlmsCopyButton(props: LlmsCopyButtonProps) {
51
52
  cache.get(url) ?? (await fetch(url).then(res => res.text()));
52
53
 
53
54
  cache.set(url, content);
54
- await navigator.clipboard.writeText(content);
55
+ await copyToClipboard(content);
55
56
  } finally {
56
57
  setLoading(false);
57
58
  setFinished(true);
@@ -1,6 +1,7 @@
1
1
  import { useI18n } from '@rspress/core/runtime';
2
- import { IconCopy, IconSuccess, SvgWrapper } from '@theme';
2
+ import { IconCopy, IconSuccess, SvgWrapper } from '@rspress/core/theme';
3
3
  import { useCallback, useRef, useState } from 'react';
4
+ import { copyToClipboard } from './copy';
4
5
  import { useMdUrl } from './useMdUrl';
5
6
 
6
7
  const cache = new Map<string, string>();
@@ -19,7 +20,7 @@ export function LlmsCopyRow() {
19
20
  const content: string =
20
21
  cache.get(pathname) ?? (await fetch(pathname).then(res => res.text()));
21
22
  cache.set(pathname, content);
22
- await navigator.clipboard.writeText(content);
23
+ await copyToClipboard(content);
23
24
  } finally {
24
25
  setLoading(false);
25
26
  setFinished(true);
@@ -1,5 +1,5 @@
1
1
  import { useI18n, useSite } from '@rspress/core/runtime';
2
- import { IconExternalLink, SvgWrapper } from '@theme';
2
+ import { IconExternalLink, SvgWrapper } from '@rspress/core/theme';
3
3
  import { useEffect, useMemo, useRef, useState } from 'react';
4
4
  import './LlmsOpenRow.scss';
5
5
  import './LlmsViewOptions.scss';
@@ -4,12 +4,13 @@
4
4
  * @license MIT
5
5
  */
6
6
  import { useI18n, useSite } from '@rspress/core/runtime';
7
- import { IconDown, IconExternalLink, IconLink } from '@theme';
7
+ import { IconDown, IconExternalLink, IconLink } from '@rspress/core/theme';
8
8
  import type React from 'react';
9
9
  import { useEffect, useMemo, useRef, useState } from 'react';
10
10
  import { SvgWrapper } from '../SvgWrapper';
11
11
  import './index.scss';
12
12
  import './LlmsViewOptions.scss';
13
+ import { copyToClipboard } from './copy';
13
14
  import { useMdUrl } from './useMdUrl';
14
15
 
15
16
  type Option =
@@ -98,7 +99,7 @@ export function LlmsViewOptions({
98
99
  title: t('copyMarkdownLinkText'),
99
100
  icon: <SvgWrapper icon={IconLink} />,
100
101
  onClick: () => {
101
- navigator.clipboard.writeText(fullMarkdownUrl);
102
+ void copyToClipboard(fullMarkdownUrl);
102
103
  },
103
104
  },
104
105
  chatgpt: {
@@ -0,0 +1,12 @@
1
+ import copy from 'copy-to-clipboard';
2
+
3
+ export async function copyToClipboard(text: string) {
4
+ if (navigator.clipboard?.writeText) {
5
+ try {
6
+ await navigator.clipboard.writeText(text);
7
+ return;
8
+ } catch {}
9
+ }
10
+
11
+ copy(text);
12
+ }
@@ -5,8 +5,14 @@ import type {
5
5
  NavItemWithLinkAndChildren,
6
6
  } from '@rspress/core';
7
7
  import { matchNavbar, useLocation } from '@rspress/core/runtime';
8
- import type { HoverGroupProps } from '@theme';
9
- import { IconArrowDown, Link, SvgWrapper, Tag, useHoverGroup } from '@theme';
8
+ import type { HoverGroupProps } from '@rspress/core/theme';
9
+ import {
10
+ IconArrowDown,
11
+ Link,
12
+ SvgWrapper,
13
+ Tag,
14
+ useHoverGroup,
15
+ } from '@rspress/core/theme';
10
16
  import cls from 'clsx';
11
17
  import { type ReactNode, useMemo } from 'react';
12
18
  import { useLangsMenu, useVersionsMenu } from './hooks';
@@ -29,6 +35,7 @@ export function NavMenuItemInner({
29
35
  {'link' in menuItem && typeof menuItem.link === 'string' ? (
30
36
  <Link
31
37
  href={menuItem.link}
38
+ download={menuItem.download}
32
39
  className="rp-nav-menu__item__container"
33
40
  hrefLang={menuItem.lang}
34
41
  lang={menuItem.lang}
@@ -5,7 +5,7 @@ import {
5
5
  Search,
6
6
  SocialLinks,
7
7
  SwitchAppearance,
8
- } from '@theme';
8
+ } from '@rspress/core/theme';
9
9
  import './index.scss';
10
10
  import { NavLangs, NavMenu, NavMenuDivider, NavVersions } from './NavMenu';
11
11
 
@@ -1,4 +1,9 @@
1
- import { IconSmallMenu, SocialLinks, SvgWrapper, useHoverGroup } from '@theme';
1
+ import {
2
+ IconSmallMenu,
3
+ SocialLinks,
4
+ SvgWrapper,
5
+ useHoverGroup,
6
+ } from '@rspress/core/theme';
2
7
  import clsx from 'clsx';
3
8
  import { createPortal } from 'react-dom';
4
9
  import { NavVersions } from '../Nav/NavMenu';
@@ -1,5 +1,5 @@
1
1
  import { NoSSR, useI18n, useSite } from '@rspress/core/runtime';
2
- import { SwitchAppearance } from '@theme';
2
+ import { SwitchAppearance } from '@rspress/core/theme';
3
3
  import './NavScreenAppearance.scss';
4
4
 
5
5
  export function NavScreenAppearance() {
@@ -2,7 +2,7 @@ import { useState } from 'react';
2
2
  import { useLangsMenu } from '../Nav/hooks';
3
3
  import './NavScreenLangs.scss';
4
4
  import { useI18n } from '@rspress/core/runtime';
5
- import { Link } from '@theme';
5
+ import { Link } from '@rspress/core/theme';
6
6
  import clsx from 'clsx';
7
7
  import { SvgDown } from './NavScreenMenuItem';
8
8
 
@@ -5,7 +5,7 @@ import type {
5
5
  NavItemWithLinkAndChildren,
6
6
  } from '@rspress/core';
7
7
  import { matchNavbar, useLocation } from '@rspress/core/runtime';
8
- import { IconArrowDown, Link, SvgWrapper, Tag } from '@theme';
8
+ import { IconArrowDown, Link, SvgWrapper, Tag } from '@rspress/core/theme';
9
9
  import clsx from 'clsx';
10
10
  import type React from 'react';
11
11
  import { useMemo, useState } from 'react';
@@ -26,6 +26,7 @@ export function NavScreenMenuItemRaw({
26
26
  isActive,
27
27
  onClick,
28
28
  href,
29
+ download,
29
30
  }: {
30
31
  left: React.ReactNode;
31
32
  right: React.ReactNode;
@@ -33,6 +34,7 @@ export function NavScreenMenuItemRaw({
33
34
  isActive?: boolean;
34
35
  onClick?: () => void;
35
36
  href?: string;
37
+ download?: boolean;
36
38
  }) {
37
39
  if (href) {
38
40
  return (
@@ -44,6 +46,7 @@ export function NavScreenMenuItemRaw({
44
46
  isActive && 'rp-nav-screen-menu-item--active',
45
47
  )}
46
48
  onClick={onClick}
49
+ download={download}
47
50
  >
48
51
  <div className="rp-nav-screen-menu-item__left">{left}</div>
49
52
  <div className="rp-nav-screen-menu-item__right">{right}</div>
@@ -84,6 +87,7 @@ export function NavScreenMenuItemWithLink({
84
87
  }
85
88
  right={null}
86
89
  href={menuItem.link}
90
+ download={menuItem.download}
87
91
  isActive={isActive}
88
92
  />
89
93
  );
@@ -1,5 +1,5 @@
1
1
  import { NoSSR, useSite } from '@rspress/core/runtime';
2
- import { SocialLinks, SwitchAppearance } from '@theme';
2
+ import { SocialLinks, SwitchAppearance } from '@rspress/core/theme';
3
3
  import './index.scss';
4
4
  import { NavScreenLangs } from './NavScreenLangs';
5
5
  import { NavScreenVersions } from './NavScreenVersions';
@@ -2,7 +2,7 @@ import { useState } from 'react';
2
2
  import { useVersionsMenu } from '../Nav/hooks';
3
3
  import './NavScreenVersions.scss';
4
4
  import { useI18n } from '@rspress/core/runtime';
5
- import { Link } from '@theme';
5
+ import { Link } from '@rspress/core/theme';
6
6
  import clsx from 'clsx';
7
7
  import { SvgDown } from './NavScreenMenuItem';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import { useNav } from '@rspress/core/runtime';
2
- import { SocialLinks } from '@theme';
2
+ import { SocialLinks } from '@rspress/core/theme';
3
3
  import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock';
4
4
  import clsx from 'clsx';
5
5
  import { useEffect, useRef } from 'react';
@@ -5,7 +5,7 @@ import {
5
5
  useLang,
6
6
  useSite,
7
7
  } from '@rspress/core/runtime';
8
- import { Link } from '@theme';
8
+ import { Link } from '@rspress/core/theme';
9
9
  import { useMemo } from 'react';
10
10
  import './index.scss';
11
11
 
@@ -1,5 +1,9 @@
1
1
  import { useI18n } from '@rspress/core/runtime';
2
- import { IconScrollToTop, SvgWrapper, useReadPercent } from '@theme';
2
+ import {
3
+ IconScrollToTop,
4
+ SvgWrapper,
5
+ useReadPercent,
6
+ } from '@rspress/core/theme';
3
7
 
4
8
  export function ScrollToTop() {
5
9
  const scrollToTop = () => {
@@ -6,7 +6,7 @@ import {
6
6
  ReadPercent,
7
7
  Toc,
8
8
  useDynamicToc,
9
- } from '@theme';
9
+ } from '@rspress/core/theme';
10
10
  import './index.scss';
11
11
  import { ScrollToTop } from './ScrollToTop';
12
12
 
@@ -15,7 +15,7 @@ import {
15
15
  type Group,
16
16
  type GroupItem,
17
17
  OverviewGroup,
18
- } from '@theme';
18
+ } from '@rspress/core/theme';
19
19
  import { useEffect, useMemo, useRef, useState } from 'react';
20
20
  import {
21
21
  isSidebarDivider,
@@ -1,8 +1,8 @@
1
- import { Link, renderInlineMarkdown } from '@theme';
1
+ import { Link, renderInlineMarkdown } from '@rspress/core/theme';
2
2
  import './index.scss';
3
3
  import type { Header } from '@rspress/core';
4
4
  import { routePathToMdPath } from '@rspress/core/runtime';
5
- import { FallbackHeading, SvgWrapper } from '@theme';
5
+ import { FallbackHeading, SvgWrapper } from '@rspress/core/theme';
6
6
  import { useMemo } from 'react';
7
7
  import IconPlugin from './icons/plugin.svg';
8
8
 
@@ -1,4 +1,4 @@
1
- import { getCustomMDXComponent, Tab, Tabs } from '@theme';
1
+ import { getCustomMDXComponent, Tab, Tabs } from '@rspress/core/theme';
2
2
  import { type ReactNode, useMemo } from 'react';
3
3
  import { Bun } from './icons/Bun';
4
4
  import { Deno } from './icons/Deno';
@@ -5,7 +5,7 @@ import {
5
5
  renderInlineMarkdown,
6
6
  SvgWrapper,
7
7
  usePrevNextPage,
8
- } from '@theme';
8
+ } from '@rspress/core/theme';
9
9
  import clsx from 'clsx';
10
10
  import './index.scss';
11
11
 
@@ -23,7 +23,7 @@ export interface RootProps {
23
23
  * @example
24
24
  * Default usage (no customization needed):
25
25
  * ```tsx
26
- * import { Root } from '@theme';
26
+ * import { Root } from '@rspress/core/theme';
27
27
  *
28
28
  * function App() {
29
29
  * return (
@@ -1,5 +1,5 @@
1
1
  import { useI18n } from '@rspress/core/runtime';
2
- import { IconEmpty, SvgWrapper } from '@theme';
2
+ import { IconEmpty, SvgWrapper } from '@rspress/core/theme';
3
3
  import './NoSearchResult.scss';
4
4
 
5
5
  export function NoSearchResult({ query }: { query: string }) {
@@ -1,5 +1,5 @@
1
1
  import { useI18n } from '@rspress/core/runtime';
2
- import { IconSearch, SvgWrapper } from '@theme';
2
+ import { IconSearch, SvgWrapper } from '@rspress/core/theme';
3
3
  import { useEffect, useState } from 'react';
4
4
  import './SearchButton.scss';
5
5
 
@@ -7,7 +7,7 @@ import {
7
7
  Tab,
8
8
  Tabs,
9
9
  useLinkNavigate,
10
- } from '@theme';
10
+ } from '@rspress/core/theme';
11
11
  import { debounce } from 'lodash-es';
12
12
  import { useCallback, useEffect, useRef, useState } from 'react';
13
13
  import { createPortal } from 'react-dom';
@@ -348,6 +348,8 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
348
348
  // only setSearchResult when query is current query value
349
349
  const currQuery = searchInputRef.current?.value;
350
350
  if (currQuery === newQuery) {
351
+ // Reset current suggestion index to 0 when search query changes
352
+ setCurrentSuggestionIndex(0);
351
353
  setSearchResult(searchResult || DEFAULT_RESULT);
352
354
  setIsSearching(false);
353
355
  }
@@ -5,7 +5,7 @@ import {
5
5
  IconTitle,
6
6
  Link,
7
7
  SvgWrapper,
8
- } from '@theme';
8
+ } from '@rspress/core/theme';
9
9
  import { useRef } from 'react';
10
10
  import './SuggestItem.scss';
11
11
  import type { DefaultMatchResultItem, HighlightInfo } from './logic/types';
@@ -1,5 +1,5 @@
1
1
  import { NoSSR } from '@rspress/core/runtime';
2
- import { SearchButton, SearchPanel } from '@theme';
2
+ import { SearchButton, SearchPanel } from '@rspress/core/theme';
3
3
  import { useState } from 'react';
4
4
 
5
5
  export function Search() {
@@ -5,7 +5,11 @@ import type {
5
5
  SidebarSectionHeader as SidebarSectionHeaderType,
6
6
  } from '@rspress/core';
7
7
  import { useActiveMatcher } from '@rspress/core/runtime';
8
- import { IconArrowRight, SvgWrapper, useLinkNavigate } from '@theme';
8
+ import {
9
+ IconArrowRight,
10
+ SvgWrapper,
11
+ useLinkNavigate,
12
+ } from '@rspress/core/theme';
9
13
  import clsx from 'clsx';
10
14
  import type React from 'react';
11
15
  import { SidebarDivider } from './SidebarDivider';
@@ -15,10 +15,6 @@
15
15
  color 0.15s,
16
16
  background-color 0.15s;
17
17
 
18
- &:first-child {
19
- margin-top: 0;
20
- }
21
-
22
18
  &:hover,
23
19
  &--pending {
24
20
  color: var(--rp-c-text-1);
@@ -3,7 +3,7 @@ import type {
3
3
  SidebarItem as SidebarItemType,
4
4
  } from '@rspress/core';
5
5
  import { useActiveMatcher } from '@rspress/core/runtime';
6
- import { Link, renderInlineMarkdown, Tag } from '@theme';
6
+ import { Link, renderInlineMarkdown, Tag } from '@rspress/core/theme';
7
7
  import clsx from 'clsx';
8
8
  import type React from 'react';
9
9
  import { useEffect, useRef, useTransition } from 'react';
@@ -1,4 +1,4 @@
1
- import { renderInlineMarkdown, Tag } from '@theme';
1
+ import { renderInlineMarkdown, Tag } from '@rspress/core/theme';
2
2
  import './SidebarSectionHeader.scss';
3
3
 
4
4
  export function SidebarSectionHeader({
@@ -7,7 +7,7 @@ import {
7
7
  SvgWrapper,
8
8
  useActiveAnchor,
9
9
  useDynamicToc,
10
- } from '@theme';
10
+ } from '@rspress/core/theme';
11
11
  import { forwardRef, useEffect, useRef } from 'react';
12
12
  import { createPortal } from 'react-dom';
13
13
  import './index.scss';
@@ -1,6 +1,6 @@
1
1
  import type { SocialLink } from '@rspress/core';
2
2
  import { useSite } from '@rspress/core/runtime';
3
- import { IconArrowDown, SvgWrapper } from '@theme';
3
+ import { IconArrowDown, SvgWrapper } from '@rspress/core/theme';
4
4
  import './index.scss';
5
5
  import { useHoverGroup } from '../HoverGroup/useHoverGroup';
6
6
  import { SocialLink as SocialLinkComp } from './SocialLink';
@@ -1,5 +1,5 @@
1
1
  import { useI18n } from '@rspress/core/runtime';
2
- import { IconGithub, IconGitlab, SvgWrapper } from '@theme';
2
+ import { IconGithub, IconGitlab, SvgWrapper } from '@rspress/core/theme';
3
3
  import './index.scss';
4
4
 
5
5
  export interface SourceCodeProps {
@@ -1,5 +1,5 @@
1
1
  import { normalizeImagePath } from '@rspress/core/runtime';
2
- import { renderHtmlOrText } from '@theme';
2
+ import { renderHtmlOrText } from '@rspress/core/theme';
3
3
 
4
4
  /**
5
5
  * Check if a string is a URL or file path
@@ -1,5 +1,5 @@
1
1
  import { ThemeContext, useSite } from '@rspress/core/runtime';
2
- import { IconMoon, IconSun, SvgWrapper } from '@theme';
2
+ import { IconMoon, IconSun, SvgWrapper } from '@rspress/core/theme';
3
3
  import { type MouseEvent, useContext } from 'react';
4
4
  import './global.scss';
5
5
  import './index.scss';
@@ -5,21 +5,8 @@
5
5
  border: var(--rp-code-block-border);
6
6
  box-shadow: var(--rp-code-block-shadow);
7
7
 
8
- // nested
9
- & & {
10
- border-radius: 0;
11
- margin: 0;
12
- border: none;
13
- }
14
-
15
- .rp-codeblock {
16
- margin: 0;
17
- border-radius: 0;
18
- border: none;
19
-
20
- .rp-codeblock__title {
21
- padding: 8px 12px;
22
- }
8
+ .rp-codeblock__title {
9
+ padding: 8px 12px;
23
10
  }
24
11
 
25
12
  &__label {
@@ -76,6 +63,17 @@
76
63
 
77
64
  &__content {
78
65
  &__item {
66
+ padding: 0 1rem;
67
+
68
+ // nested rp-tabs and codeblock
69
+ & > .rp-codeblock:only-child,
70
+ & > .rp-tabs:only-child {
71
+ margin: 0 -1rem;
72
+ border-radius: 0;
73
+ border: none;
74
+ box-shadow: none;
75
+ }
76
+
79
77
  &--active {
80
78
  display: block;
81
79
  }
@@ -1,4 +1,4 @@
1
- import { useStorageValue } from '@theme';
1
+ import { useStorageValue } from '@rspress/core/theme';
2
2
  import clsx from 'clsx';
3
3
  import {
4
4
  Children,
@@ -5,7 +5,7 @@ import {
5
5
  IconExperimental,
6
6
  SvgWrapper,
7
7
  Tag as WrappedTag,
8
- } from '@theme';
8
+ } from '@rspress/core/theme';
9
9
  import { useMemo } from 'react';
10
10
 
11
11
  const BADGE_TAGS = {
@@ -1,5 +1,9 @@
1
1
  import type { Header } from '@rspress/core';
2
- import { Link, parseInlineMarkdownText, renderInlineMarkdown } from '@theme';
2
+ import {
3
+ Link,
4
+ parseInlineMarkdownText,
5
+ renderInlineMarkdown,
6
+ } from '@rspress/core/theme';
3
7
  import clsx from 'clsx';
4
8
  import './TocItem.scss';
5
9
  import { useEffect, useRef } from 'react';
@@ -1,4 +1,4 @@
1
- import { useActiveAnchor, useDynamicToc } from '@theme';
1
+ import { useActiveAnchor, useDynamicToc } from '@rspress/core/theme';
2
2
  import { TocItem } from './TocItem';
3
3
 
4
4
  const baseHeaderLevel = 2;
package/dist/index.js CHANGED
@@ -1,11 +1,9 @@
1
1
  export { PluginDriver } from "./node/PluginDriver.js";
2
- export { RSPRESS_TEMP_DIR, getIconUrlPath, getNodeAttribute, getSidebarDataGroup, mergeDocConfig, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./9348.1beb3e25.js";
2
+ export { RSPRESS_TEMP_DIR, getIconUrlPath, getNodeAttribute, getSidebarDataGroup, logger, matchPath, mergeDocConfig, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./8474.js";
3
3
  export { RouteService } from "./node/route/RouteService.js";
4
4
  export { build } from "./node/build.js";
5
5
  export { defineConfig } from "./config/defineConfig.js";
6
6
  export { dev } from "./node/dev.js";
7
- export { logger } from "./6289.29817fb4.js";
8
- export { matchPath } from "./7744.421b464f.js";
9
7
  export { remarkFileCodeBlock } from "./node/mdx/remarkPlugins/fileCodeBlock.js";
10
8
  export { remarkLink } from "./node/mdx/remarkPlugins/link.js";
11
9
  export { serve } from "./node/serve.js";
@@ -1,5 +1,4 @@
1
- import { node_path } from "../6289.29817fb4.js";
2
- import { addTrailingSlash, addLeadingSlash } from "../9348.1beb3e25.js";
1
+ import { addTrailingSlash, node_path, addLeadingSlash } from "../4524.js";
3
2
  import { createError } from "./utils/error.js";
4
3
  import { auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
5
4
  class PluginDriver {
@@ -29,15 +28,11 @@ class PluginDriver {
29
28
  const enableLastUpdated = themeConfig?.lastUpdated;
30
29
  const mediumZoomConfig = config?.mediumZoom ?? true;
31
30
  if (enableLastUpdated) {
32
- const { pluginLastUpdated } = await import("./last-updated/index.js").then((mod)=>({
33
- pluginLastUpdated: mod.pluginLastUpdated
34
- }));
31
+ const { pluginLastUpdated } = await import("./last-updated/index.js");
35
32
  this.addPlugin(pluginLastUpdated());
36
33
  }
37
34
  if (mediumZoomConfig) {
38
- const { pluginMediumZoom } = await import("./medium-zoom/index.js").then((mod)=>({
39
- pluginMediumZoom: mod.pluginMediumZoom
40
- }));
35
+ const { pluginMediumZoom } = await import("./medium-zoom/index.js");
41
36
  this.addPlugin(pluginMediumZoom('object' == typeof mediumZoomConfig ? mediumZoomConfig : void 0));
42
37
  }
43
38
  (config.plugins || []).forEach((plugin)=>{
@@ -1,5 +1,4 @@
1
- import { node_path } from "../../6289.29817fb4.js";
2
- import { DEFAULT_PAGE_EXTENSIONS } from "../../7744.421b464f.js";
1
+ import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../4524.js";
3
2
  import { processLocales, combineWalkResult } from "./locales.js";
4
3
  import { walk } from "./walk.js";
5
4
  async function runAutoNavSide(config, metaFileSet, mdFileSet) {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../6289.29817fb4.js";
1
+ import { node_path } from "../../4524.js";
2
2
  import { walk } from "./walk.js";
3
3
  function combineWalkResult(walks, versions) {
4
4
  return walks.reduce((acc, cur, curIndex)=>({