@rspress/core 2.0.23 → 2.1.0-beta.2

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 (181) hide show
  1. package/dist/cli/index.js +2 -2
  2. package/dist/{common-Qw-RoVFD.js → common-Bo3KCGim.js} +4 -1
  3. package/dist/config/loadConfigFile.js +1 -1
  4. package/dist/eject-theme/components/CdnTabs/index.test.tsx +71 -0
  5. package/dist/eject-theme/components/CdnTabs/index.tsx +175 -0
  6. package/dist/eject-theme/components/DocContent/index.tsx +0 -3
  7. package/dist/eject-theme/components/FallbackHeading/index.tsx +6 -1
  8. package/dist/eject-theme/components/Link/getHref.ts +1 -0
  9. package/dist/eject-theme/components/Link/index.tsx +9 -21
  10. package/dist/eject-theme/components/Link/useLinkNavigate.ts +43 -54
  11. package/dist/eject-theme/components/NavTitle/index.test.tsx +78 -0
  12. package/dist/eject-theme/components/NavTitle/index.tsx +9 -5
  13. package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +79 -1
  14. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +25 -12
  15. package/dist/eject-theme/components/Search/NoSearchResult.scss +1 -2
  16. package/dist/eject-theme/components/Search/SearchPanel.scss +75 -63
  17. package/dist/eject-theme/components/Search/SuggestItem.scss +28 -41
  18. package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +4 -1
  19. package/dist/eject-theme/components/Search/useSearchPanel.ts +103 -36
  20. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +8 -0
  21. package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +3 -0
  22. package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +4 -1
  23. package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +1 -1
  24. package/dist/entry/worker.js +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/node/PluginDriver.d.ts +5 -0
  27. package/dist/node/PluginDriver.js +17 -2
  28. package/dist/node/auto-nav-sidebar/index.js +1 -1
  29. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  30. package/dist/node/auto-nav-sidebar/normalize.js +1 -1
  31. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  32. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  33. package/dist/node/constants.js +1 -1
  34. package/dist/node/eject.js +1 -1
  35. package/dist/node/initRsbuild.js +19 -7
  36. package/dist/node/llms.d.ts +1 -1
  37. package/dist/node/llms.js +2 -2
  38. package/dist/node/logger/hint.d.ts +1 -0
  39. package/dist/node/logger/hint.js +8 -2
  40. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -0
  41. package/dist/node/mdx/remarkPlugins/link.js +1 -1
  42. package/dist/node/route/RoutePage.js +1 -1
  43. package/dist/node/route/RouteService.js +1 -1
  44. package/dist/node/route/extractPageData.js +1 -1
  45. package/dist/node/route/normalizeRoutePath.js +1 -1
  46. package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.d.ts → i18n/DEFAULT_I18N_TEXT.d.ts} +28 -0
  47. package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.js → i18n/DEFAULT_I18N_TEXT.js} +28 -0
  48. package/dist/node/runtimeModule/i18n/getI18nData.d.ts +11 -0
  49. package/dist/node/runtimeModule/{i18n.js → i18n/getI18nData.js} +35 -22
  50. package/dist/node/runtimeModule/i18n/rsbuildPlugin.d.ts +5 -0
  51. package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +21 -0
  52. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  53. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  54. package/dist/node/runtimeModule/searchHooks.js +2 -2
  55. package/dist/node/runtimeModule/siteData/createSiteData.d.ts +2 -1
  56. package/dist/node/runtimeModule/siteData/createSiteData.js +3 -3
  57. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.d.ts +2 -1
  58. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +3 -4
  59. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +2 -2
  60. package/dist/node/serve.js +1 -1
  61. package/dist/node/sitemap.d.ts +7 -0
  62. package/dist/node/sitemap.js +86 -0
  63. package/dist/node/ssg/alternateLinks.js +1 -1
  64. package/dist/node/ssg/htmlFile.js +1 -1
  65. package/dist/node/ssg/renderHtmlTemplate.js +1 -1
  66. package/dist/node/ssg/renderPage.js +1 -1
  67. package/dist/node/ssg/renderPageWorker.js +1 -1
  68. package/dist/node/ssg/renderPages.js +2 -2
  69. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  70. package/dist/node/ssg/ssgEnv.js +1 -1
  71. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  72. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  73. package/dist/node/ssg-md/renderPage.js +5 -4
  74. package/dist/node/ssg-md/renderPages.js +2 -2
  75. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  76. package/dist/node/utils/checkLanguageParity.js +1 -1
  77. package/dist/node/utils/createHash.js +1 -1
  78. package/dist/node/utils/flattenMdxContent.js +1 -1
  79. package/dist/node/utils/getPageKey.js +1 -1
  80. package/dist/node/utils/reactAlias.js +6 -3
  81. package/dist/{a~0.js → p~0.js} +23 -18
  82. package/dist/runtime/App.js +20 -29
  83. package/dist/runtime/BrowserOnly.d.ts +1 -1
  84. package/dist/runtime/BrowserOnly.js +53 -20
  85. package/dist/runtime/ClientApp.d.ts +3 -2
  86. package/dist/runtime/ClientApp.js +31 -21
  87. package/dist/runtime/ErrorRoute.d.ts +1 -0
  88. package/dist/runtime/ErrorRoute.js +30 -0
  89. package/dist/runtime/NoSSR.d.ts +7 -3
  90. package/dist/runtime/NoSSR.js +30 -9
  91. package/dist/runtime/PageRoute.d.ts +2 -0
  92. package/dist/runtime/PageRoute.js +70 -0
  93. package/dist/runtime/createServerRouter.d.ts +4 -0
  94. package/dist/runtime/createServerRouter.js +17 -0
  95. package/dist/runtime/csrClientEntry.js +5 -2
  96. package/dist/runtime/hooks/useWebMcp.d.ts +36 -0
  97. package/dist/runtime/hooks/useWebMcp.js +80 -0
  98. package/dist/runtime/index.d.ts +6 -3
  99. package/dist/runtime/index.js +6 -5
  100. package/dist/runtime/initPageData.d.ts +0 -3
  101. package/dist/runtime/initPageData.js +9 -45
  102. package/dist/runtime/pageDataLoader.d.ts +11 -0
  103. package/dist/runtime/pageDataLoader.js +7 -0
  104. package/dist/runtime/react.d.ts +5 -0
  105. package/dist/runtime/react.js +4 -0
  106. package/dist/runtime/reactDom.d.ts +6 -0
  107. package/dist/runtime/reactDom.js +2 -1
  108. package/dist/runtime/socialLinks.d.ts +1 -0
  109. package/dist/runtime/socialLinks.js +3 -0
  110. package/dist/runtime/ssrClientEntry.js +14 -6
  111. package/dist/runtime/ssrMdServerEntry.js +10 -21
  112. package/dist/runtime/ssrServerEntry.js +10 -21
  113. package/dist/static/assets/package.json +58 -0
  114. package/dist/theme/assets/bun.js +101 -0
  115. package/dist/theme/assets/deno.js +15 -0
  116. package/dist/theme/assets/jsdelivr.js +53 -0
  117. package/dist/theme/{components/PackageManagerTabs/icons/Npm.js → assets/npm.js} +4 -4
  118. package/dist/theme/{components/PackageManagerTabs/icons/Pnpm.js → assets/pnpm.js} +4 -4
  119. package/dist/theme/assets/unpkg.js +15 -0
  120. package/dist/theme/assets/yarn.js +22 -0
  121. package/dist/theme/components/CdnTabs/index.d.ts +10 -0
  122. package/dist/theme/components/CdnTabs/index.js +146 -0
  123. package/dist/theme/components/DocContent/index.js +1 -2
  124. package/dist/theme/components/FallbackHeading/index.js +1 -0
  125. package/dist/theme/components/Link/index.js +4 -17
  126. package/dist/theme/components/Link/useLinkNavigate.d.ts +2 -2
  127. package/dist/theme/components/Link/useLinkNavigate.js +22 -36
  128. package/dist/theme/components/NavTitle/index.js +10 -5
  129. package/dist/theme/components/PackageManagerTabs/index.d.ts +2 -0
  130. package/dist/theme/components/PackageManagerTabs/index.js +22 -12
  131. package/dist/theme/components/Search/NoSearchResult.css +1 -2
  132. package/dist/theme/components/Search/SearchPanel.css +72 -51
  133. package/dist/theme/components/Search/SuggestItem.css +21 -34
  134. package/dist/theme/components/Search/logic/providers/LocalProvider.js +4 -1
  135. package/dist/theme/components/Search/useSearchPanel.js +74 -26
  136. package/dist/theme/components/Sidebar/SidebarItem.css +5 -0
  137. package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -0
  138. package/dist/theme/components/SocialLinks/GithubStars.js +1 -1
  139. package/dist/theme/hooks/useDynamicToc.js +27 -34
  140. package/dist/theme/hooks/useWebMcpNavigation.d.ts +6 -0
  141. package/dist/theme/hooks/useWebMcpNavigation.js +123 -0
  142. package/dist/theme/hooks/useWebMcpPageList.d.ts +6 -0
  143. package/dist/theme/hooks/useWebMcpPageList.js +25 -0
  144. package/dist/theme/hooks/useWebMcpPageReading.d.ts +7 -0
  145. package/dist/theme/hooks/useWebMcpPageReading.js +23 -0
  146. package/dist/theme/hooks/useWebMcpSiteInfo.d.ts +6 -0
  147. package/dist/theme/hooks/useWebMcpSiteInfo.js +22 -0
  148. package/dist/theme/icons.d.ts +7 -0
  149. package/dist/theme/icons.js +15 -1
  150. package/dist/theme/index.d.ts +6 -2
  151. package/dist/theme/index.js +6 -2
  152. package/dist/theme/layout/ErrorLayout/index.css +52 -0
  153. package/dist/theme/layout/ErrorLayout/index.d.ts +8 -0
  154. package/dist/theme/layout/ErrorLayout/index.js +76 -0
  155. package/dist/theme/layout/Layout/index.js +1 -2
  156. package/dist/theme/webMcp/tools.d.ts +56 -0
  157. package/dist/theme/webMcp/tools.js +122 -0
  158. package/dist/theme/webMcp/types.d.ts +35 -0
  159. package/dist/theme/webMcp/types.js +0 -0
  160. package/dist/tinypool~0.js +19 -49
  161. package/dist/y~0.js +166 -0
  162. package/package.json +18 -18
  163. package/dist/b~0.js +0 -106
  164. package/dist/eject-theme/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  165. package/dist/eject-theme/components/PackageManagerTabs/icons/Deno.tsx +0 -18
  166. package/dist/eject-theme/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  167. package/dist/eject-theme/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  168. package/dist/eject-theme/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  169. package/dist/node/runtimeModule/i18n.d.ts +0 -8
  170. package/dist/theme/components/PackageManagerTabs/icons/Bun.d.ts +0 -2
  171. package/dist/theme/components/PackageManagerTabs/icons/Bun.js +0 -137
  172. package/dist/theme/components/PackageManagerTabs/icons/Deno.d.ts +0 -2
  173. package/dist/theme/components/PackageManagerTabs/icons/Deno.js +0 -15
  174. package/dist/theme/components/PackageManagerTabs/icons/Npm.d.ts +0 -2
  175. package/dist/theme/components/PackageManagerTabs/icons/Pnpm.d.ts +0 -2
  176. package/dist/theme/components/PackageManagerTabs/icons/Yarn.d.ts +0 -2
  177. package/dist/theme/components/PackageManagerTabs/icons/Yarn.js +0 -22
  178. package/dist/theme/logic/useScrollAfterNav.d.ts +0 -5
  179. package/dist/theme/logic/useScrollAfterNav.js +0 -35
  180. package/dist/theme/logic/useScrollReset.d.ts +0 -5
  181. package/dist/theme/logic/useScrollReset.js +0 -12
@@ -1,7 +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, useScrollAfterNav } from "@rspress/core/theme";
4
+ import { Callout, FallbackHeading, getCustomMDXComponent } from "@rspress/core/theme";
5
5
  import "./doc.css";
6
6
  function FallbackTitle() {
7
7
  const { site } = useSite();
@@ -13,7 +13,6 @@ function FallbackTitle() {
13
13
  });
14
14
  }
15
15
  function DocContent({ components, isOverviewPage = false, afterDocContent, beforeDocContent }) {
16
- useScrollAfterNav();
17
16
  const mdxComponents = {
18
17
  ...getCustomMDXComponent(),
19
18
  ...components,
@@ -35,6 +35,7 @@ function FallbackHeading({ level, title }) {
35
35
  className: "rp-header-anchor",
36
36
  href: `#${titleSlug}`,
37
37
  "aria-hidden": true,
38
+ tabIndex: -1,
38
39
  children: "#"
39
40
  })
40
41
  ]
@@ -1,14 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { preloadLink } from "@rspress/core/runtime";
3
3
  import clsx from "clsx";
4
- import nprogress from "nprogress";
5
4
  import { forwardRef } from "react";
6
5
  import "./index.css";
7
6
  import { getHref } from "./getHref.js";
8
7
  import { useLinkNavigate } from "./useLinkNavigate.js";
9
- nprogress.configure({
10
- showSpinner: false
11
- });
12
8
  const Link = /*#__PURE__*/ forwardRef((props, ref)=>{
13
9
  const { href = '/', children, className = '', onClick, onMouseEnter, startTransition, ...otherProps } = props;
14
10
  const { linkType, removeBaseHref, routePath, withBaseHref } = getHref(href);
@@ -26,29 +22,20 @@ const Link = /*#__PURE__*/ forwardRef((props, ref)=>{
26
22
  ...otherProps,
27
23
  children: children
28
24
  });
29
- if ('hashOnly' === linkType) return /*#__PURE__*/ jsx("a", {
30
- ref: ref,
31
- href: href,
32
- className: clsx(className, 'rp-link'),
33
- onClick: onClick,
34
- onMouseEnter: onMouseEnter,
35
- ...otherProps,
36
- children: children
37
- });
38
- if ('relative' === linkType) return /*#__PURE__*/ jsx("a", {
25
+ if ('hashOnly' === linkType || 'relative' === linkType) return /*#__PURE__*/ jsx("a", {
39
26
  ref: ref,
40
27
  href: href,
41
28
  className: clsx(className, 'rp-link'),
42
29
  onMouseEnter: (event)=>{
43
30
  onMouseEnter?.(event);
44
- preloadLink(routePath);
31
+ if ('relative' === linkType) preloadLink(routePath);
45
32
  },
46
33
  onTouchStart: ()=>{
47
- preloadLink(routePath);
34
+ if ('relative' === linkType) preloadLink(routePath);
48
35
  },
49
36
  onClick: (e)=>{
50
37
  onClick?.(e);
51
- if (0 !== e.button || e.currentTarget.target && '_self' !== e.currentTarget.target || e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) return;
38
+ if (e.defaultPrevented || e.currentTarget.hasAttribute('download') || 0 !== e.button || e.currentTarget.target && '_self' !== e.currentTarget.target || e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) return;
52
39
  e.preventDefault();
53
40
  navigate(href);
54
41
  },
@@ -1,7 +1,7 @@
1
1
  import { type TransitionStartFunction } from 'react';
2
2
  /**
3
- * For import { Link } from '@rspress/core/theme';
4
- * useNavigate with preload logic
3
+ * Navigate with Rspress link normalization. The router loader handles page
4
+ * loading for both this helper and the native useNavigate hook.
5
5
  */
6
6
  export declare function useLinkNavigate({ startTransition, }?: {
7
7
  startTransition?: TransitionStartFunction;
@@ -1,48 +1,34 @@
1
- import { initPageData, isActive, pathnameToRouteService, useLocation, useNavigate, useSite, warmPageData } from "@rspress/core/runtime";
2
- import nprogress from "nprogress";
3
- import { startTransition as external_react_startTransition, useCallback } from "react";
1
+ import { isActive, pathnameToRouteService, useLocation, useNavigate, useSite } from "@rspress/core/runtime";
2
+ import { useCallback } from "react";
4
3
  import { getHref } from "./getHref.js";
5
- nprogress.configure({
6
- showSpinner: false
7
- });
8
- function useLinkNavigate({ startTransition = external_react_startTransition } = {
9
- startTransition: external_react_startTransition
10
- }) {
11
- const { pathname: currPagePathname } = useLocation();
4
+ function useLinkNavigate({ startTransition } = {}) {
5
+ const { pathname } = useLocation();
12
6
  const navigate = useNavigate();
13
7
  const { site } = useSite();
14
8
  const useTransitions = site?.route?.useTransitions;
15
9
  return useCallback(async (href)=>{
16
10
  const { linkType, removeBaseHref, routePath, withBaseHref } = getHref(href);
17
- if ('external' === linkType || 'hashOnly' === linkType) return void window.location.assign(href);
18
- const isTransitionable = !!(useTransitions && startTransition);
19
- const preloadChunkThenNavigate = async ()=>{
20
- const inCurrPage = isActive(removeBaseHref, currPagePathname);
21
- if (!import.meta.env.SSR && !inCurrPage) {
22
- const matchedRoute = pathnameToRouteService(routePath);
23
- if (!matchedRoute) return void window.location.assign(withBaseHref);
24
- else {
25
- const timer = setTimeout(()=>{
26
- nprogress.start();
27
- }, 200);
28
- const data = await initPageData(routePath);
29
- warmPageData(routePath, data);
30
- clearTimeout(timer);
31
- nprogress.done();
32
- }
33
- }
34
- if (isTransitionable) startTransition(()=>navigate(removeBaseHref, {
35
- replace: false
36
- }));
37
- else navigate(removeBaseHref, {
38
- replace: false
11
+ if ('external' === linkType) return void window.location.assign(href);
12
+ if ('hashOnly' !== linkType && !isActive(removeBaseHref, pathname) && !pathnameToRouteService(routePath)) return void window.location.assign(withBaseHref);
13
+ const hashUrl = 'hashOnly' === linkType ? new URL(href, window.location.href) : void 0;
14
+ const to = hashUrl ? {
15
+ search: hashUrl.search,
16
+ hash: hashUrl.hash
17
+ } : removeBaseHref;
18
+ const options = hashUrl ? {
19
+ replace: hashUrl.href === window.location.href
20
+ } : void 0;
21
+ if (useTransitions && startTransition) {
22
+ let navigation;
23
+ startTransition(()=>{
24
+ navigation = navigate(to, options);
25
+ return navigation;
39
26
  });
40
- };
41
- if (isTransitionable) startTransition(preloadChunkThenNavigate);
42
- else preloadChunkThenNavigate();
27
+ await navigation;
28
+ } else await navigate(to, options);
43
29
  }, [
44
30
  useTransitions,
45
- currPagePathname,
31
+ pathname,
46
32
  navigate,
47
33
  startTransition
48
34
  ]);
@@ -13,11 +13,12 @@ const NavTitle = ()=>{
13
13
  const title = (localeInfo?.title ?? site.title) || 'Home';
14
14
  const langRoutePrefix = lang === defaultLang ? '/' : addTrailingSlash(lang);
15
15
  const { logo: rawLogo, logoText, logoHref } = site;
16
+ const alt = logoText ? '' : title;
16
17
  const logo = useMemo(()=>{
17
18
  if (!rawLogo) return null;
18
19
  if ('string' == typeof rawLogo) return /*#__PURE__*/ jsx("img", {
19
20
  src: normalizeImagePath(rawLogo),
20
- alt: "logo",
21
+ alt: alt,
21
22
  id: "logo",
22
23
  className: "rspress-logo rp-nav__title__logo-image"
23
24
  });
@@ -25,20 +26,24 @@ const NavTitle = ()=>{
25
26
  children: [
26
27
  /*#__PURE__*/ jsx("img", {
27
28
  src: normalizeImagePath(rawLogo.light),
28
- alt: "logo",
29
+ alt: alt,
29
30
  id: "logo",
31
+ width: rawLogo.width,
32
+ height: rawLogo.height,
30
33
  className: "rspress-logo rp-nav__title__logo-image rp-nav__title__logo-image--light"
31
34
  }),
32
35
  /*#__PURE__*/ jsx("img", {
33
36
  src: normalizeImagePath(rawLogo.dark),
34
- alt: "logo",
35
- id: "logo",
37
+ alt: alt,
38
+ width: rawLogo.width,
39
+ height: rawLogo.height,
36
40
  className: "rspress-logo rp-nav__title__logo-image rp-nav__title__logo-image--dark"
37
41
  })
38
42
  ]
39
43
  });
40
44
  }, [
41
- rawLogo
45
+ rawLogo,
46
+ alt
42
47
  ]);
43
48
  return /*#__PURE__*/ jsx("div", {
44
49
  className: "rp-nav__title",
@@ -25,6 +25,8 @@ export type PackageManagerTabProps = ({
25
25
  }) & {
26
26
  additionalTabs?: {
27
27
  tool: string;
28
+ /** Full command for this tab, rendered as written. */
29
+ command?: string;
28
30
  icon?: ReactNode;
29
31
  }[];
30
32
  };
@@ -1,11 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Tab, Tabs, getCustomMDXComponent } from "@rspress/core/theme";
2
+ import { IconBun, IconDeno, IconNpm, IconPnpm, IconYarn, SvgWrapper, Tab, Tabs, getCustomMDXComponent } from "@rspress/core/theme";
3
3
  import { useMemo } from "react";
4
- import { Bun } from "./icons/Bun.js";
5
- import { Deno } from "./icons/Deno.js";
6
- import { Npm } from "./icons/Npm.js";
7
- import { Pnpm } from "./icons/Pnpm.js";
8
- import { Yarn } from "./icons/Yarn.js";
9
4
  const transformDenoPositional = (cmd)=>{
10
5
  const parts = cmd.split(' ');
11
6
  const subcommand = parts[1];
@@ -52,11 +47,21 @@ function splitTo2Parts(command) {
52
47
  function PackageManagerTabs({ command, exec, dlx, additionalTabs = [] }) {
53
48
  let commandInfo;
54
49
  const packageMangerToIcon = {
55
- npm: /*#__PURE__*/ jsx(Npm, {}),
56
- yarn: /*#__PURE__*/ jsx(Yarn, {}),
57
- pnpm: /*#__PURE__*/ jsx(Pnpm, {}),
58
- bun: /*#__PURE__*/ jsx(Bun, {}),
59
- deno: /*#__PURE__*/ jsx(Deno, {})
50
+ npm: /*#__PURE__*/ jsx(SvgWrapper, {
51
+ icon: IconNpm
52
+ }),
53
+ yarn: /*#__PURE__*/ jsx(SvgWrapper, {
54
+ icon: IconYarn
55
+ }),
56
+ pnpm: /*#__PURE__*/ jsx(SvgWrapper, {
57
+ icon: IconPnpm
58
+ }),
59
+ bun: /*#__PURE__*/ jsx(SvgWrapper, {
60
+ icon: IconBun
61
+ }),
62
+ deno: /*#__PURE__*/ jsx(SvgWrapper, {
63
+ icon: IconDeno
64
+ })
60
65
  };
61
66
  additionalTabs.forEach((tab)=>{
62
67
  packageMangerToIcon[tab.tool] = tab.icon;
@@ -110,7 +115,12 @@ function PackageManagerTabs({ command, exec, dlx, additionalTabs = [] }) {
110
115
  commandInfo.pnpm = normalizeCommand(commandInfo.pnpm);
111
116
  commandInfo.bun = normalizeCommand(commandInfo.bun);
112
117
  commandInfo.deno = normalizeCommand(commandInfo.deno);
113
- } else commandInfo = command;
118
+ } else commandInfo = {
119
+ ...command
120
+ };
121
+ additionalTabs.forEach((tab)=>{
122
+ if (void 0 !== tab.command) commandInfo[tab.tool] = tab.command;
123
+ });
114
124
  if (import.meta.env.SSG_MD) return Object.values(commandInfo).reduce((previous, current)=>{
115
125
  const [packageManager, command] = splitTo2Parts(current);
116
126
  return previous + `\n\`\`\`sh [${packageManager}]\n` + `${packageManager}${command}\n` + "```\n";
@@ -1,8 +1,7 @@
1
1
  .rp-no-search-result {
2
2
  flex-direction: column;
3
3
  align-items: center;
4
- padding-top: 2rem;
5
- padding-bottom: .5rem;
4
+ padding: 2rem 1rem;
6
5
  display: flex;
7
6
  }
8
7
 
@@ -7,14 +7,20 @@
7
7
  }
8
8
 
9
9
  .rp-search-panel__modal {
10
- background-color: var(--rp-c-bg-soft);
11
- border-radius: var(--rp-radius);
12
- max-width: 560px;
13
- height: auto;
14
- margin: 80px auto auto;
15
- padding: 20px;
10
+ --rp-search-panel-top: min(80px, 10dvh);
11
+ margin: calc(var(--rp-search-panel-top) + env(safe-area-inset-top, 0px)) auto auto;
12
+ width: calc(100% - 48px);
13
+ max-width: 640px;
14
+ max-height: calc(100dvh - var(--rp-search-panel-top) - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
15
+ border: 1px solid var(--rp-c-divider-light);
16
+ background-color: var(--rp-c-bg);
17
+ border-radius: 16px;
18
+ flex-direction: column;
16
19
  animation: .18s ease-out rp-search-panel-in;
20
+ display: flex;
17
21
  position: relative;
22
+ overflow: hidden;
23
+ box-shadow: 0 16px 48px #0003;
18
24
  }
19
25
 
20
26
  @media (prefers-reduced-motion: reduce) {
@@ -23,48 +29,85 @@
23
29
  }
24
30
  }
25
31
 
32
+ @media (width <= 768px) {
33
+ .rp-search-panel__modal {
34
+ --rp-search-panel-top: 24px;
35
+ width: calc(100% - 24px);
36
+ max-width: 560px;
37
+ }
38
+ }
39
+
26
40
  .rp-search-panel__header {
41
+ flex-shrink: 0;
27
42
  align-items: center;
43
+ gap: 8px;
44
+ padding: 12px 20px;
28
45
  display: flex;
29
46
  }
30
47
 
48
+ @media (width <= 768px) {
49
+ .rp-search-panel__header {
50
+ padding: 8px 12px;
51
+ }
52
+ }
53
+
31
54
  .rp-search-panel__cancel {
32
55
  color: var(--rp-c-brand);
33
56
  cursor: pointer;
34
57
  white-space: nowrap;
35
- margin-left: .5rem;
58
+ display: none;
36
59
  }
37
60
 
38
- @media (width >= 640px) {
61
+ @media (width <= 768px) {
39
62
  .rp-search-panel__cancel {
40
- display: none;
63
+ flex-shrink: 0;
64
+ align-items: center;
65
+ min-height: 44px;
66
+ margin: 0;
67
+ padding: 0 4px;
68
+ font-size: 14px;
69
+ font-weight: 500;
70
+ display: flex;
41
71
  }
42
72
  }
43
73
 
44
74
  .rp-search-panel__input-form {
45
- background-color: var(--rp-c-bg);
46
- border: 1px solid var(--rp-c-brand);
47
- border-radius: var(--rp-radius-small);
75
+ flex: 1;
48
76
  align-items: center;
49
- width: 100%;
50
- height: 55px;
51
- padding: 0 12px;
77
+ min-width: 0;
78
+ height: 48px;
52
79
  display: flex;
53
80
  }
54
81
 
82
+ @media (width <= 768px) {
83
+ .rp-search-panel__input-form {
84
+ height: 44px;
85
+ }
86
+ }
87
+
55
88
  .rp-search-panel__input {
56
89
  background-color: var(--rp-c-bg);
90
+ min-width: 0;
91
+ height: 100%;
92
+ color: var(--rp-c-text-1);
57
93
  outline: none;
58
94
  flex: 1;
59
- width: 80%;
60
- height: 100%;
61
- padding-left: 8px;
62
- font-size: 20px;
63
- font-weight: 500;
95
+ padding-left: 10px;
96
+ font-size: 18px;
97
+ font-weight: 400;
64
98
  }
65
99
 
66
- .dark .rp-search-panel__input {
67
- color: var(--rp-c-text);
100
+ @media (width <= 768px) {
101
+ .rp-search-panel__input {
102
+ font-size: 16px;
103
+ }
104
+ }
105
+
106
+ .rp-search-panel__search-icon, .rp-search-panel__close {
107
+ width: 20px;
108
+ height: 20px;
109
+ color: var(--rp-c-text-2);
110
+ display: block;
68
111
  }
69
112
 
70
113
  .rp-search-panel__close:hover {
@@ -83,15 +126,12 @@
83
126
  }
84
127
  }
85
128
 
86
- .rp-search-panel__search-icon {
87
- font-size: 20px;
88
- display: inline-block;
89
- }
90
-
91
129
  .rp-search-panel__results {
92
- max-height: calc(100vh - 230px);
93
- padding-right: 2px;
94
- overflow: scroll;
130
+ border-top: 1px solid var(--rp-c-divider-light);
131
+ overscroll-behavior: contain;
132
+ min-height: 0;
133
+ padding: 8px;
134
+ overflow: auto;
95
135
  }
96
136
 
97
137
  .rp-search-panel__error {
@@ -101,7 +141,7 @@
101
141
  }
102
142
 
103
143
  .rp-search-panel__tabs {
104
- background-color: var(--rp-c-bg-soft);
144
+ background-color: var(--rp-c-bg);
105
145
  padding-bottom: 6px;
106
146
  position: sticky;
107
147
  }
@@ -113,26 +153,7 @@
113
153
  }
114
154
 
115
155
  .rp-search-panel__group {
116
- padding-bottom: .5rem;
117
- }
118
-
119
- @media (width <= 960px) {
120
- .rp-search-panel__modal {
121
- margin-top: calc(32px + env(safe-area-inset-top, 0px));
122
- }
123
-
124
- .rp-search-panel__input-form {
125
- height: 40px;
126
- }
127
-
128
- .rp-search-panel__search-icon, .rp-search-panel__close {
129
- width: 16px;
130
- height: 16px;
131
- }
132
-
133
- .rp-search-panel__input {
134
- font-size: 16px;
135
- }
156
+ padding-bottom: 4px;
136
157
  }
137
158
 
138
159
  @keyframes rp-search-panel-in {
@@ -1,48 +1,16 @@
1
1
  .rp-suggest-item {
2
2
  box-sizing: border-box;
3
- margin: 5px 2px;
3
+ margin: 4px 0;
4
4
  list-style: none;
5
5
  }
6
6
 
7
- .dark .rp-suggest-item, .dark .rp-suggest-item .rp-suggest-item__link {
8
- box-shadow: none;
9
- }
10
-
11
- .rp-suggest-item .rp-suggest-item__link {
7
+ .rp-suggest-item__link {
12
8
  color: var(--rp-c-text-1);
13
9
  background-color: var(--rp-c-bg);
14
10
  border-radius: var(--rp-radius-small);
15
11
  width: 100%;
16
12
  padding-left: 12px;
17
13
  display: flex;
18
- box-shadow: 0 1px 3px #d4d9e1;
19
- }
20
-
21
- .rp-suggest-item--current .rp-suggest-item__link {
22
- background-color: var(--rp-c-brand);
23
- cursor: pointer;
24
- color: #fff;
25
- }
26
-
27
- .rp-suggest-item--current .rp-suggest-item__container .rp-suggest-item__icon {
28
- color: #fff;
29
- }
30
-
31
- .rp-suggest-item--current .rp-suggest-item__container .rp-suggest-item__action-icon {
32
- opacity: 1;
33
- }
34
-
35
- .rp-suggest-item--current .rp-suggest-item__container .rp-suggest-item__content .rp-suggest-item__statement {
36
- color: #fff;
37
- }
38
-
39
- .rp-suggest-item--current .rp-suggest-item__container .rp-suggest-item__content .rp-suggest-item__mark {
40
- color: #fff;
41
- text-decoration: underline;
42
- }
43
-
44
- .rp-suggest-item--current .rp-suggest-item__container .rp-suggest-item__content .rp-suggest-item__title {
45
- color: #fff;
46
14
  }
47
15
 
48
16
  .rp-suggest-item__container {
@@ -59,7 +27,9 @@
59
27
  }
60
28
 
61
29
  .rp-suggest-item__content {
30
+ overflow-wrap: anywhere;
62
31
  width: 100%;
32
+ min-width: 0;
63
33
  padding: 6px 8px;
64
34
  font-size: 14px;
65
35
  line-height: 1.5;
@@ -88,3 +58,20 @@
88
58
  opacity: 0;
89
59
  }
90
60
 
61
+ .rp-suggest-item--current .rp-suggest-item__link {
62
+ background-color: var(--rp-c-brand);
63
+ cursor: pointer;
64
+ }
65
+
66
+ .rp-suggest-item--current .rp-suggest-item__link, .rp-suggest-item--current .rp-suggest-item__icon, .rp-suggest-item--current .rp-suggest-item__statement, .rp-suggest-item--current .rp-suggest-item__mark, .rp-suggest-item--current .rp-suggest-item__title {
67
+ color: #fff;
68
+ }
69
+
70
+ .rp-suggest-item--current .rp-suggest-item__mark {
71
+ text-decoration: underline;
72
+ }
73
+
74
+ .rp-suggest-item--current .rp-suggest-item__action-icon {
75
+ opacity: 1;
76
+ }
77
+
@@ -47,7 +47,10 @@ class LocalProvider {
47
47
  if (this.#fetchPromise) return this.#fetchPromise;
48
48
  const { currentLang, currentVersion } = options;
49
49
  const versioned = options.versioned ?? true;
50
- this.#fetchPromise = this.#getPages(currentLang, versioned ? currentVersion : '');
50
+ this.#fetchPromise = this.#getPages(currentLang, versioned ? currentVersion : '').catch((error)=>{
51
+ this.#fetchPromise = void 0;
52
+ throw error;
53
+ });
51
54
  return this.#fetchPromise;
52
55
  }
53
56
  async init(options) {