@rspress/core 2.0.10 → 2.0.12

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 (115) hide show
  1. package/dist/0~execa.js +1 -1
  2. package/dist/3323.js +8 -0
  3. package/dist/{2240.js → 6162.js} +1 -4
  4. package/dist/8006.js +1 -1
  5. package/dist/8857.js +1 -1
  6. package/dist/common-Qw-RoVFD.js +25 -0
  7. package/dist/eject-theme/components/Llms/LlmsContainer.tsx +1 -2
  8. package/dist/eject-theme/components/Llms/LlmsCopyButton.tsx +1 -2
  9. package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +1 -2
  10. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +16 -17
  11. package/dist/eject-theme/components/Prompt/icons.tsx +1 -1
  12. package/dist/eject-theme/components/Prompt/index.scss +325 -380
  13. package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -6
  14. package/dist/eject-theme/components/Search/logic/search.ts +10 -5
  15. package/dist/eject-theme/components/Search/logic/util.test.ts +20 -1
  16. package/dist/eject-theme/components/Search/logic/util.ts +4 -1
  17. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -1
  18. package/dist/eject-theme/components/Tabs/index.tsx +48 -41
  19. package/dist/entry/process.d.ts +1 -0
  20. package/dist/entry/process.js +65 -0
  21. package/dist/entry/utils.d.ts +7 -0
  22. package/dist/entry/utils.js +2 -0
  23. package/dist/entry/worker.d.ts +1 -0
  24. package/dist/entry/worker.js +74 -0
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +1 -0
  27. package/dist/node/PluginDriver.js +1 -1
  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.d.ts +1 -1
  31. package/dist/node/auto-nav-sidebar/normalize.js +1 -1
  32. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  33. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  34. package/dist/node/index.d.ts +1 -0
  35. package/dist/node/initRsbuild.js +1 -1
  36. package/dist/node/mdx/options.js +2 -1
  37. package/dist/node/mdx/processor.js +1 -1
  38. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  39. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  40. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  41. package/dist/node/mdx/rehypePlugins/transformers/add-title.js +3 -6
  42. package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +1 -1
  43. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  44. package/dist/node/mdx/remarkPlugins/containerSyntax.d.ts +1 -1
  45. package/dist/node/mdx/remarkPlugins/fileCodeBlock.d.ts +1 -0
  46. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +9 -4
  47. package/dist/node/mdx/remarkPlugins/image.d.ts +1 -1
  48. package/dist/node/mdx/remarkPlugins/image.js +2 -1
  49. package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
  50. package/dist/node/mdx/remarkPlugins/link.js +1 -1
  51. package/dist/node/route/RoutePage.js +1 -1
  52. package/dist/node/route/RouteService.js +1 -1
  53. package/dist/node/route/extractPageData.js +1 -1
  54. package/dist/node/route/normalizeRoutePath.js +1 -1
  55. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +140 -140
  56. package/dist/node/runtimeModule/i18n.js +1 -1
  57. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  58. package/dist/node/runtimeModule/pageData/rsbuildPlugin.d.ts +1 -1
  59. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  60. package/dist/node/runtimeModule/searchHooks.js +1 -1
  61. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  62. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  63. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  64. package/dist/node/serve.js +1 -1
  65. package/dist/node/ssg/renderPages.js +2 -2
  66. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  67. package/dist/node/ssg/ssgEnv.js +1 -1
  68. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  69. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  70. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  71. package/dist/node/ssg-md/renderPage.js +1 -1
  72. package/dist/node/ssg-md/renderPages.js +1 -1
  73. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  74. package/dist/node/utils/checkLanguageParity.js +1 -1
  75. package/dist/node/utils/createHash.js +1 -1
  76. package/dist/node/utils/flattenMdxContent.js +1 -1
  77. package/dist/node/utils/getPageKey.js +1 -1
  78. package/dist/node/utils/reactAlias.js +1 -1
  79. package/dist/runtime/BrowserOnly.d.ts +7 -0
  80. package/dist/runtime/BrowserOnly.js +40 -0
  81. package/dist/runtime/BrowserOnly.test.d.ts +1 -0
  82. package/dist/runtime/index.d.ts +1 -0
  83. package/dist/runtime/index.js +1 -0
  84. package/dist/theme/components/DocContent/docComponents/a.d.ts +1 -1
  85. package/dist/theme/components/DocContent/docComponents/hr.d.ts +1 -1
  86. package/dist/theme/components/DocContent/docComponents/img.d.ts +1 -1
  87. package/dist/theme/components/DocContent/docComponents/index.d.ts +18 -18
  88. package/dist/theme/components/DocContent/docComponents/list.d.ts +3 -3
  89. package/dist/theme/components/DocContent/docComponents/paragraph.d.ts +3 -3
  90. package/dist/theme/components/DocContent/docComponents/table.d.ts +3 -3
  91. package/dist/theme/components/DocContent/docComponents/title.d.ts +6 -6
  92. package/dist/theme/components/Nav/hooks.d.ts +1 -1
  93. package/dist/theme/components/PackageManagerTabs/index.js +17 -17
  94. package/dist/theme/components/Prompt/icons.js +1 -1
  95. package/dist/theme/components/Prompt/index.css +11 -37
  96. package/dist/theme/components/Search/SearchPanel.js +1 -2
  97. package/dist/theme/components/Search/logic/search.js +5 -3
  98. package/dist/theme/components/Search/logic/util.js +2 -1
  99. package/dist/theme/components/Sidebar/SidebarItem.js +1 -0
  100. package/dist/theme/components/Tabs/index.d.ts +8 -4
  101. package/dist/theme/components/Tabs/index.js +19 -19
  102. package/dist/theme/layout/DocLayout/index.css +4 -0
  103. package/dist/theme/layout/DocLayout/index.js +3 -2
  104. package/dist/theme/logic/useThemeState.d.ts +5 -10
  105. package/dist/theme/logic/useThemeState.js +15 -20
  106. package/dist/utils-B--2TaWv.js +34 -0
  107. package/dist/utils-De75vAgL.js +7 -0
  108. package/package.json +13 -13
  109. package/dist/3425.js +0 -6
  110. package/dist/runtime/getSidebarDataGroup.test.js +0 -68
  111. package/dist/runtime/hooks/useWindowSize.test.js +0 -36
  112. package/dist/runtime/route.test.js +0 -154
  113. package/dist/runtime/utils.test.js +0 -34
  114. package/dist/theme/components/Search/logic/util.test.js +0 -51
  115. /package/dist/{2287.js → 2235.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { node_path, logger, promises } from "../../2287.js";
1
+ import { node_path, logger, promises } from "../../2235.js";
2
2
  import { createError } from "./error.js";
3
3
  function normalizePath(filePath) {
4
4
  return filePath.split(node_path.sep).join('/');
@@ -1,4 +1,4 @@
1
- import { createHash as external_node_crypto_createHash } from "../../2287.js";
1
+ import { createHash as external_node_crypto_createHash } from "../../2235.js";
2
2
  function createHash(str) {
3
3
  return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../2287.js";
1
+ import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../2235.js";
2
2
  import { createError } from "./error.js";
3
3
  import { importStatementRegex } from "../constants.js";
4
4
  const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
@@ -1,4 +1,4 @@
1
- import { removeLeadingSlash } from "../../2287.js";
1
+ import { removeLeadingSlash } from "../../2235.js";
2
2
  function getPageKey(route) {
3
3
  const cleanRoute = removeLeadingSlash(route);
4
4
  return cleanRoute.replace(/\//g, '_').replace(/\.[^.]+$/, '') || 'index';
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
2
  import "../../8006.js";
3
- import { node_path, core_rspack, logger } from "../../2287.js";
3
+ import { node_path, core_rspack, logger } from "../../2235.js";
4
4
  import { pathExists, readJson } from "./fs.js";
5
5
  import { PACKAGE_ROOT } from "../constants.js";
6
6
  import { hintReactVersion } from "../logger/hint.js";
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface BrowserOnlyProps {
3
+ children: () => ReactNode | Promise<ReactNode>;
4
+ fallback?: ReactNode;
5
+ }
6
+ export declare function BrowserOnly(props: BrowserOnlyProps): ReactNode;
7
+ export default BrowserOnly;
@@ -0,0 +1,40 @@
1
+ import { useEffect, useState } from "react";
2
+ function BrowserOnly(props) {
3
+ const { children, fallback = null } = props;
4
+ const [state, setState] = useState({
5
+ status: 'pending',
6
+ children
7
+ });
8
+ useEffect(()=>{
9
+ let isMounted = true;
10
+ setState({
11
+ status: 'pending',
12
+ children
13
+ });
14
+ Promise.resolve().then(()=>children()).then((content)=>{
15
+ if (isMounted) setState({
16
+ status: 'resolved',
17
+ children,
18
+ content
19
+ });
20
+ }, (error)=>{
21
+ if (isMounted) setState({
22
+ status: 'rejected',
23
+ children,
24
+ error
25
+ });
26
+ });
27
+ return ()=>{
28
+ isMounted = false;
29
+ };
30
+ }, [
31
+ children
32
+ ]);
33
+ if (state.children !== children) return fallback;
34
+ if ('rejected' === state.status) throw state.error;
35
+ if ('resolved' === state.status) return state.content;
36
+ return fallback;
37
+ }
38
+ const runtime_BrowserOnly = BrowserOnly;
39
+ export default runtime_BrowserOnly;
40
+ export { BrowserOnly };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref, } from '@rspress/shared';
2
2
  export { Head, useHead } from '@unhead/react';
3
3
  export * from 'react-router-dom';
4
+ export { BrowserOnly, type BrowserOnlyProps } from './BrowserOnly.js';
4
5
  export { Content } from './Content.js';
5
6
  export { useActiveMatcher } from './hooks/useActiveMatcher.js';
6
7
  export { ThemeContext, useDark } from './hooks/useDark.js';
@@ -1,6 +1,7 @@
1
1
  export * from "react-router-dom";
2
2
  export { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "@rspress/shared";
3
3
  export { Head, useHead } from "@unhead/react";
4
+ export { BrowserOnly } from "./BrowserOnly.js";
4
5
  export { Content } from "./Content.js";
5
6
  export { useActiveMatcher } from "./hooks/useActiveMatcher.js";
6
7
  export { ThemeContext, useDark } from "./hooks/useDark.js";
@@ -1,2 +1,2 @@
1
1
  import type { ComponentProps } from 'react';
2
- export declare const A: (props: ComponentProps<"a">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const A: (props: ComponentProps<'a'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { ComponentProps } from 'react';
2
- export declare const Hr: (props: ComponentProps<"hr">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Hr: (props: ComponentProps<'hr'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { ComponentProps } from 'react';
2
- export declare const Img: (props: ComponentProps<"img">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Img: (props: ComponentProps<'img'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,25 +1,25 @@
1
1
  import { Code } from './code.js';
2
2
  import { ShikiPre } from './pre.js';
3
3
  export declare function getCustomMDXComponent(): {
4
- h1: (props: React.ComponentProps<"h1">) => import("react/jsx-runtime").JSX.Element;
5
- h2: (props: React.ComponentProps<"h2">) => import("react/jsx-runtime").JSX.Element;
6
- h3: (props: React.ComponentProps<"h3">) => import("react/jsx-runtime").JSX.Element;
7
- h4: (props: React.ComponentProps<"h4">) => import("react/jsx-runtime").JSX.Element;
8
- h5: (props: React.ComponentProps<"h5">) => import("react/jsx-runtime").JSX.Element;
9
- h6: (props: React.ComponentProps<"h6">) => import("react/jsx-runtime").JSX.Element;
10
- ul: (props: import("react").ComponentProps<"ul">) => import("react/jsx-runtime").JSX.Element;
11
- ol: (props: import("react").ComponentProps<"ol">) => import("react/jsx-runtime").JSX.Element;
12
- li: (props: import("react").ComponentProps<"li">) => import("react/jsx-runtime").JSX.Element;
4
+ h1: (props: React.ComponentProps<'h1'>) => import("react/jsx-runtime").JSX.Element;
5
+ h2: (props: React.ComponentProps<'h2'>) => import("react/jsx-runtime").JSX.Element;
6
+ h3: (props: React.ComponentProps<'h3'>) => import("react/jsx-runtime").JSX.Element;
7
+ h4: (props: React.ComponentProps<'h4'>) => import("react/jsx-runtime").JSX.Element;
8
+ h5: (props: React.ComponentProps<'h5'>) => import("react/jsx-runtime").JSX.Element;
9
+ h6: (props: React.ComponentProps<'h6'>) => import("react/jsx-runtime").JSX.Element;
10
+ ul: (props: import("react").ComponentProps<'ul'>) => import("react/jsx-runtime").JSX.Element;
11
+ ol: (props: import("react").ComponentProps<'ol'>) => import("react/jsx-runtime").JSX.Element;
12
+ li: (props: import("react").ComponentProps<'li'>) => import("react/jsx-runtime").JSX.Element;
13
13
  table: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & import("react").RefAttributes<HTMLTableElement>>;
14
- td: (props: import("react").ComponentProps<"td">) => import("react/jsx-runtime").JSX.Element;
15
- th: (props: import("react").ComponentProps<"th">) => import("react/jsx-runtime").JSX.Element;
16
- tr: (props: import("react").ComponentProps<"tr">) => import("react/jsx-runtime").JSX.Element;
17
- hr: (props: import("react").ComponentProps<"hr">) => import("react/jsx-runtime").JSX.Element;
18
- p: (props: import("react").ComponentProps<"p">) => import("react/jsx-runtime").JSX.Element;
19
- blockquote: (props: import("react").ComponentProps<"blockquote">) => import("react/jsx-runtime").JSX.Element;
20
- strong: (props: import("react").ComponentProps<"strong">) => import("react/jsx-runtime").JSX.Element;
21
- a: (props: import("react").ComponentProps<"a">) => import("react/jsx-runtime").JSX.Element;
14
+ td: (props: import("react").ComponentProps<'td'>) => import("react/jsx-runtime").JSX.Element;
15
+ th: (props: import("react").ComponentProps<'th'>) => import("react/jsx-runtime").JSX.Element;
16
+ tr: (props: import("react").ComponentProps<'tr'>) => import("react/jsx-runtime").JSX.Element;
17
+ hr: (props: import("react").ComponentProps<'hr'>) => import("react/jsx-runtime").JSX.Element;
18
+ p: (props: import("react").ComponentProps<'p'>) => import("react/jsx-runtime").JSX.Element;
19
+ blockquote: (props: import("react").ComponentProps<'blockquote'>) => import("react/jsx-runtime").JSX.Element;
20
+ strong: (props: import("react").ComponentProps<'strong'>) => import("react/jsx-runtime").JSX.Element;
21
+ a: (props: import("react").ComponentProps<'a'>) => import("react/jsx-runtime").JSX.Element;
22
22
  code: typeof Code;
23
- img: (props: import("react").ComponentProps<"img">) => import("react/jsx-runtime").JSX.Element;
23
+ img: (props: import("react").ComponentProps<'img'>) => import("react/jsx-runtime").JSX.Element;
24
24
  pre: typeof ShikiPre;
25
25
  };
@@ -1,4 +1,4 @@
1
1
  import type { ComponentProps } from 'react';
2
- export declare const Ol: (props: ComponentProps<"ol">) => import("react/jsx-runtime").JSX.Element;
3
- export declare const Ul: (props: ComponentProps<"ul">) => import("react/jsx-runtime").JSX.Element;
4
- export declare const Li: (props: ComponentProps<"li">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Ol: (props: ComponentProps<'ol'>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Ul: (props: ComponentProps<'ul'>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Li: (props: ComponentProps<'li'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import type { ComponentProps } from 'react';
2
- export declare const P: (props: ComponentProps<"p">) => import("react/jsx-runtime").JSX.Element;
3
- export declare const Blockquote: (props: ComponentProps<"blockquote">) => import("react/jsx-runtime").JSX.Element;
4
- export declare const Strong: (props: ComponentProps<"strong">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const P: (props: ComponentProps<'p'>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Blockquote: (props: ComponentProps<'blockquote'>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Strong: (props: ComponentProps<'strong'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { type ComponentProps } from 'react';
2
2
  export declare const Table: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & import("react").RefAttributes<HTMLTableElement>>;
3
- export declare const Tr: (props: ComponentProps<"tr">) => import("react/jsx-runtime").JSX.Element;
4
- export declare const Td: (props: ComponentProps<"td">) => import("react/jsx-runtime").JSX.Element;
5
- export declare const Th: (props: ComponentProps<"th">) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Tr: (props: ComponentProps<'tr'>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Td: (props: ComponentProps<'td'>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const Th: (props: ComponentProps<'th'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
- export declare const H1: (props: React.ComponentProps<"h1">) => import("react/jsx-runtime").JSX.Element;
3
- export declare const H2: (props: React.ComponentProps<"h2">) => import("react/jsx-runtime").JSX.Element;
4
- export declare const H3: (props: React.ComponentProps<"h3">) => import("react/jsx-runtime").JSX.Element;
5
- export declare const H4: (props: React.ComponentProps<"h4">) => import("react/jsx-runtime").JSX.Element;
6
- export declare const H5: (props: React.ComponentProps<"h5">) => import("react/jsx-runtime").JSX.Element;
7
- export declare const H6: (props: React.ComponentProps<"h6">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const H1: (props: React.ComponentProps<'h1'>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const H2: (props: React.ComponentProps<'h2'>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const H3: (props: React.ComponentProps<'h3'>) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const H4: (props: React.ComponentProps<'h4'>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const H5: (props: React.ComponentProps<'h5'>) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const H6: (props: React.ComponentProps<'h6'>) => import("react/jsx-runtime").JSX.Element;
@@ -7,8 +7,8 @@ export declare function useLangsMenu(): {
7
7
  }[];
8
8
  activeValue: string | undefined;
9
9
  } | {
10
- items: never[];
11
10
  activeValue?: undefined;
11
+ items: never[];
12
12
  };
13
13
  export declare function useVersionsMenu(): {
14
14
  items: {
@@ -117,26 +117,26 @@ function PackageManagerTabs({ command, exec, dlx, additionalTabs = [] }) {
117
117
  }, '');
118
118
  return /*#__PURE__*/ jsx(Tabs, {
119
119
  groupId: "package.manager",
120
- values: Object.entries(commandInfo).map(([key])=>/*#__PURE__*/ jsxs("div", {
121
- style: {
122
- display: 'flex',
123
- alignItems: 'center',
124
- fontSize: 15
125
- },
126
- children: [
127
- packageMangerToIcon[key],
128
- /*#__PURE__*/ jsx("span", {
129
- style: {
130
- marginLeft: 6,
131
- marginBottom: 2
132
- },
133
- children: key
134
- })
135
- ]
136
- }, key)),
137
120
  children: Object.entries(commandInfo).map(([key, value])=>{
138
121
  const [packageManager, command] = splitTo2Parts(value);
139
122
  return /*#__PURE__*/ jsx(Tab, {
123
+ label: /*#__PURE__*/ jsxs("div", {
124
+ style: {
125
+ display: 'flex',
126
+ alignItems: 'center',
127
+ fontSize: 15
128
+ },
129
+ children: [
130
+ packageMangerToIcon[key],
131
+ /*#__PURE__*/ jsx("span", {
132
+ style: {
133
+ marginLeft: 6,
134
+ marginBottom: 2
135
+ },
136
+ children: key
137
+ })
138
+ ]
139
+ }),
140
140
  children: /*#__PURE__*/ jsx(Pre, {
141
141
  lang: "bash",
142
142
  className: "shiki css-variables",
@@ -36,7 +36,7 @@ const AGENT_ICONS = [
36
36
  },
37
37
  {
38
38
  name: 'Cursor',
39
- color: '#434343',
39
+ color: '#737373',
40
40
  svg: /*#__PURE__*/ jsx("svg", {
41
41
  "aria-hidden": "true",
42
42
  viewBox: "0 0 24 24",
@@ -37,7 +37,7 @@
37
37
  .rp-prompt__panel {
38
38
  border-radius: calc(var(--rp-radius) + 5px);
39
39
  color: var(--rp-c-text-1);
40
- background: linear-gradient(180deg, color-mix(in srgb, var(--rp-c-bg) 92%, transparent), color-mix(in srgb, var(--rp-c-bg-soft) 96%, transparent));
40
+ background: color-mix(in srgb, var(--rp-c-bg) 92%, transparent);
41
41
  backdrop-filter: blur(12px);
42
42
  padding: 1rem;
43
43
  position: relative;
@@ -47,9 +47,6 @@
47
47
  content: "";
48
48
  pointer-events: none;
49
49
  border-radius: inherit;
50
- background-image: linear-gradient(90deg, color-mix(in srgb, var(--rp-c-divider-light) 35%, transparent) 1px, transparent 1px),linear-gradient(180deg, color-mix(in srgb, var(--rp-c-divider-light) 28%, transparent) 1px, transparent 1px);
51
- opacity: .28;
52
- background-size: 20px 20px;
53
50
  position: absolute;
54
51
  inset: 0;
55
52
  mask-image: linear-gradient(#0000008c, #0000);
@@ -92,6 +89,10 @@
92
89
  display: inline-flex;
93
90
  }
94
91
 
92
+ .rp-prompt__meta--copied {
93
+ background: color-mix(in srgb, var(--rp-prompt-accent, var(--rp-c-brand-light)) 16%, var(--rp-c-bg));
94
+ }
95
+
95
96
  .rp-prompt__eyebrow {
96
97
  letter-spacing: .08em;
97
98
  text-transform: uppercase;
@@ -145,10 +146,6 @@
145
146
  line-height: 1.65;
146
147
  }
147
148
 
148
- .rp-prompt__meta--copied {
149
- background: color-mix(in srgb, var(--rp-prompt-accent, var(--rp-c-brand-light)) 16%, var(--rp-c-bg));
150
- }
151
-
152
149
  .rp-prompt__ripple {
153
150
  background: color-mix(in srgb, var(--rp-prompt-accent, var(--rp-c-brand-light)) 40%, transparent);
154
151
  pointer-events: none;
@@ -163,13 +160,6 @@
163
160
  transform: scale(0);
164
161
  }
165
162
 
166
- @keyframes rp-prompt-ripple {
167
- to {
168
- opacity: 0;
169
- transform: scale(5);
170
- }
171
- }
172
-
173
163
  .rp-prompt__action-icon {
174
164
  flex: none;
175
165
  width: .875rem;
@@ -267,22 +257,11 @@
267
257
  border-radius: calc(var(--rp-radius) - 2px);
268
258
  font-family: var(--rp-font-family-mono);
269
259
  color: var(--rp-c-text-1);
270
- background: linear-gradient(180deg, color-mix(in srgb, var(--rp-c-bg-soft) 88%, transparent), color-mix(in srgb, var(--rp-c-bg) 94%, transparent));
260
+ background: color-mix(in srgb, var(--rp-c-bg) 94%, transparent);
271
261
  padding: 1rem 1.125rem;
272
262
  font-size: .92rem;
273
263
  line-height: 1.8;
274
264
  position: relative;
275
- box-shadow: inset 0 1px #ffffff73;
276
- }
277
-
278
- .rp-prompt__content-body:before {
279
- content: "";
280
- pointer-events: none;
281
- border-radius: inherit;
282
- border: 1px solid #ffffff73;
283
- position: absolute;
284
- inset: 0;
285
- mask-image: linear-gradient(160deg, #000000d9, #0000 55%);
286
265
  }
287
266
 
288
267
  .rp-prompt__content-body > :first-child {
@@ -338,15 +317,10 @@
338
317
  margin-bottom: 0;
339
318
  }
340
319
 
341
- html.rp-dark .rp-prompt__meta {
342
- background: color-mix(in srgb, var(--rp-prompt-accent, var(--rp-c-brand)) 12%, var(--rp-c-bg));
343
- }
344
-
345
- html.rp-dark .rp-prompt__eyebrow {
346
- color: color-mix(in srgb, var(--rp-prompt-accent, #dbeafe) 92%, white);
347
- }
348
-
349
- html.rp-dark .rp-prompt__content-body {
350
- box-shadow: inset 0 1px #ffffff1a;
320
+ @keyframes rp-prompt-ripple {
321
+ to {
322
+ opacity: 0;
323
+ transform: scale(5);
324
+ }
351
325
  }
352
326
 
@@ -239,10 +239,8 @@ function SearchPanel({ focused, setFocused }) {
239
239
  children: renderSearchResultItem(currentSearchResult, query, isSearching)
240
240
  });
241
241
  }
242
- const tabValues = result.map((item)=>item.group);
243
242
  const renderKey = 'render';
244
243
  return /*#__PURE__*/ jsx(Tabs, {
245
- values: tabValues,
246
244
  className: "rp-search-panel__tabs",
247
245
  onChange: (index)=>{
248
246
  setResultTabIndex(index);
@@ -251,6 +249,7 @@ function SearchPanel({ focused, setFocused }) {
251
249
  keepDOM: false,
252
250
  ref: searchResultTabRef,
253
251
  children: result.map((item)=>/*#__PURE__*/ jsxs(Tab, {
252
+ label: item.group,
254
253
  children: [
255
254
  item.renderType === RenderType.Default && renderSearchResultItem(item.result, query, isSearching),
256
255
  item.renderType === RenderType.Custom && __rspack_external_virtual_search_hooks_9d01d01f[renderKey](item.result)
@@ -150,10 +150,11 @@ class PageSearcher {
150
150
  const currentHeader = getCurrentHeader(queryIndex);
151
151
  let statementStartIndex = content.slice(0, queryIndex).lastIndexOf('\n');
152
152
  statementStartIndex = -1 === statementStartIndex ? 0 : statementStartIndex;
153
- const statementEndIndex = content.indexOf('\n\n', queryIndex + query.length);
153
+ let statementEndIndex = content.indexOf('\n\n', queryIndex + query.length);
154
+ statementEndIndex = -1 === statementEndIndex ? content.length : statementEndIndex;
154
155
  let statement = content.slice(statementStartIndex, statementEndIndex);
155
- if (statement.length > THRESHOLD_CONTENT_LENGTH) statement = this.#normalizeStatement(statement, query);
156
- const highlightIndex = normalizeTextCase(statement).indexOf(query);
156
+ statement = this.#normalizeStatement(statement, query);
157
+ const highlightIndex = normalizeTextCase(statement).indexOf(normalizeTextCase(query));
157
158
  const highlightInfoList = [
158
159
  {
159
160
  start: highlightIndex,
@@ -176,6 +177,7 @@ class PageSearcher {
176
177
  }
177
178
  }
178
179
  #normalizeStatement(statement, query) {
180
+ if (statement.length <= THRESHOLD_CONTENT_LENGTH) return statement;
179
181
  const queryIndex = normalizeTextCase(statement).indexOf(normalizeTextCase(query));
180
182
  const maxPrefixOrSuffix = Math.floor((THRESHOLD_CONTENT_LENGTH - query.length) / 2);
181
183
  let prefix = statement.slice(0, queryIndex);
@@ -1,4 +1,5 @@
1
1
  const MAX_TITLE_LENGTH = 20;
2
+ const jRegex = /[\u3040-\u309f\u30a0-\u30ff\u31f0-\u31ff]/u;
2
3
  const kRegex = /[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]/u;
3
4
  const cyrillicRegex = /[\u0400-\u04FF]/u;
4
5
  function backTrackHeaders(rawHeaders, index) {
@@ -30,7 +31,7 @@ function normalizeTextCase(text) {
30
31
  const textNormalized = text.toString().toLowerCase().normalize('NFD');
31
32
  if (cyrillicRegex.test(String(text))) return textNormalized.normalize('NFC');
32
33
  const resultWithoutAccents = textNormalized.replace(/[\u0300-\u036f]/g, '');
33
- if (kRegex.test(String(text))) return resultWithoutAccents.normalize('NFC');
34
+ if (jRegex.test(String(text)) || kRegex.test(String(text))) return resultWithoutAccents.normalize('NFC');
34
35
  return resultWithoutAccents;
35
36
  }
36
37
  function removeDomain(url) {
@@ -28,6 +28,7 @@ function SidebarItemRaw({ active, text, tag, link, context, className, left, rig
28
28
  ref: ref,
29
29
  children: [
30
30
  /*#__PURE__*/ jsx("span", {
31
+ className: "rp-doc",
31
32
  ...renderInlineMarkdown(text)
32
33
  }),
33
34
  left
@@ -1,16 +1,17 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
2
  import './index.scss';
3
3
  type TabItem = {
4
- label?: string | ReactNode;
4
+ label: ReactNode;
5
+ value: string;
5
6
  disabled?: boolean;
6
- content?: ReactNode;
7
7
  };
8
8
  export interface TabsProps {
9
- values?: ReactNode[] | ReadonlyArray<ReactNode> | TabItem[];
9
+ values?: ReadonlyArray<TabItem>;
10
10
  /**
11
11
  * @default 0
12
12
  */
13
13
  defaultIndex?: number;
14
+ defaultValue?: string;
14
15
  onChange?: (index: number) => void;
15
16
  children: ReactNode;
16
17
  /**
@@ -29,7 +30,10 @@ export interface TabsProps {
29
30
  contentItemClassName?: string;
30
31
  }
31
32
  export declare const Tabs: import("react").ForwardRefExoticComponent<TabsProps & import("react").RefAttributes<HTMLDivElement>>;
32
- export type TabProps = Pick<TabItem, 'label' | 'disabled'> & {
33
+ export type TabProps = {
34
+ label?: ReactNode;
35
+ value?: string;
36
+ disabled?: boolean;
33
37
  children: ReactNode;
34
38
  };
35
39
  export declare function Tab({ children }: TabProps): ReactElement;
@@ -3,18 +3,19 @@ import { useStorageValue } from "@rspress/core/theme";
3
3
  import clsx from "clsx";
4
4
  import { Children, forwardRef, isValidElement, useMemo, useState } from "react";
5
5
  import "./index.css";
6
- function getTabValuesFromChildren(children, defaultValues) {
7
- if (defaultValues?.every((item)=>isTabItem(item) && item.content)) return defaultValues;
8
- if (defaultValues && defaultValues.length > 0) return defaultValues.map((item, index)=>{
9
- if (isTabItem(item)) return item;
6
+ function getTabValuesFromChildren(children, values) {
7
+ if (values && values.length > 0) return values.map((item, index)=>{
8
+ const content = children.find((child)=>child.props?.value === item.value) ?? children[index];
10
9
  return {
11
- label: item,
12
- content: children[index]
10
+ ...item,
11
+ content
13
12
  };
14
13
  });
15
14
  return Children.map(children, (child, index)=>{
16
15
  if (/*#__PURE__*/ isValidElement(child)) return {
17
16
  label: child.props?.label || void 0,
17
+ value: child.props?.value,
18
+ disabled: child.props?.disabled,
18
19
  content: children[index]
19
20
  };
20
21
  return {
@@ -23,17 +24,13 @@ function getTabValuesFromChildren(children, defaultValues) {
23
24
  };
24
25
  });
25
26
  }
26
- function isTabItem(item) {
27
- if (item && 'object' == typeof item && 'label' in item) return true;
28
- return false;
29
- }
30
27
  const groupIdPrefix = 'rspress.tabs.';
31
28
  const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
32
- const { values, defaultIndex, onChange, children: rawChildren, groupId, tabPosition = 'left', className, labelItemClassName, contentItemClassName, keepDOM = true } = props;
29
+ const { values, defaultIndex, defaultValue, onChange, children: rawChildren, groupId, tabPosition = 'left', className, labelItemClassName, contentItemClassName, keepDOM = true } = props;
33
30
  const children = Children.toArray(rawChildren).filter((child)=>!('string' == typeof child && '' === child.trim()) && /*#__PURE__*/ isValidElement(child));
34
31
  const tabValues = useMemo(()=>getTabValuesFromChildren(children, values), [
35
- values,
36
- children
32
+ children,
33
+ values
37
34
  ]);
38
35
  if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
39
36
  children: tabValues.map(({ label, content })=>/*#__PURE__*/ jsxs(Fragment, {
@@ -44,8 +41,10 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
44
41
  ]
45
42
  }))
46
43
  });
47
- const [activeIndex, setActiveIndex] = useState(defaultIndex ?? 0);
48
- const [storageIndex, setStorageIndex] = useStorageValue(`${groupIdPrefix}${groupId}`, activeIndex.toString());
44
+ const defaultValueIndex = void 0 !== defaultValue ? tabValues.findIndex((item)=>item.value === defaultValue) : -1;
45
+ const initialActiveIndex = -1 === defaultValueIndex ? defaultIndex ?? 0 : defaultValueIndex;
46
+ const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
47
+ const [storageIndex, setStorageIndex] = useStorageValue(`${groupIdPrefix}${groupId}`, initialActiveIndex.toString());
49
48
  const currentIndex = groupId ? Number(storageIndex) : activeIndex;
50
49
  return /*#__PURE__*/ jsxs("div", {
51
50
  className: clsx('rp-tabs', className),
@@ -56,23 +55,24 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
56
55
  style: {
57
56
  justifyContent: 'center' === tabPosition ? 'center' : 'flex-start'
58
57
  },
59
- children: tabValues.map(({ label }, index)=>{
58
+ children: tabValues.map(({ label, value, disabled }, index)=>{
60
59
  const isActive = index === currentIndex;
61
60
  return /*#__PURE__*/ jsx("div", {
62
61
  className: clsx('rp-tabs__label__item', isActive ? 'rp-tabs__label__item--selected' : 'rp-tabs__label__item--not-selected', labelItemClassName),
63
62
  "data-index": index,
64
63
  onClick: ()=>{
64
+ if (disabled) return;
65
65
  onChange?.(index);
66
66
  if (groupId) setStorageIndex(index.toString());
67
67
  else setActiveIndex(index);
68
68
  },
69
69
  children: label
70
- }, 'string' == typeof label ? label : index);
70
+ }, value ?? index);
71
71
  })
72
72
  }) : null,
73
73
  /*#__PURE__*/ jsx("div", {
74
74
  className: "rp-tabs__content",
75
- children: tabValues.map(({ label, content }, index)=>{
75
+ children: tabValues.map(({ value, content }, index)=>{
76
76
  const isActive = index === currentIndex;
77
77
  if (!keepDOM && !isActive) return null;
78
78
  return /*#__PURE__*/ jsx("div", {
@@ -80,7 +80,7 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
80
80
  "aria-hidden": !isActive,
81
81
  "data-index": index,
82
82
  children: content
83
- }, 'string' == typeof label ? label : index);
83
+ }, value ?? index);
84
84
  })
85
85
  })
86
86
  ]
@@ -23,6 +23,10 @@
23
23
  }
24
24
  }
25
25
 
26
+ :root:has(.rp-doc-layout__container--no-menu) {
27
+ --rp-sidebar-menu-height: 0px;
28
+ }
29
+
26
30
  .rp-doc-layout__container {
27
31
  flex-direction: row;
28
32
  justify-content: flex-start;
@@ -13,6 +13,7 @@ function DocLayout(props) {
13
13
  const showSidebarPlaceholder = false === sidebar || 'placeholder' === sidebar;
14
14
  const isLegacyPlaceholder = 'placeholder' === sidebar;
15
15
  const { outline: showOutline = true, footer: showDocFooter = true, pageType } = frontmatter;
16
+ const showSidebarMenu = showSidebar || !isOverviewPage && showOutline;
16
17
  if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
17
18
  children: isOverviewPage ? /*#__PURE__*/ jsx(Overview, {
18
19
  content: /*#__PURE__*/ jsx(DocContent, {
@@ -28,13 +29,13 @@ function DocLayout(props) {
28
29
  const { rspressDocRef } = useWatchToc();
29
30
  return /*#__PURE__*/ jsxs(Fragment, {
30
31
  children: [
31
- /*#__PURE__*/ jsx("div", {
32
+ showSidebarMenu && /*#__PURE__*/ jsx("div", {
32
33
  className: "rp-doc-layout__menu",
33
34
  children: sidebarMenu
34
35
  }),
35
36
  beforeDoc,
36
37
  /*#__PURE__*/ jsxs("div", {
37
- className: "rp-doc-layout__container",
38
+ className: clsx('rp-doc-layout__container', !showSidebarMenu && 'rp-doc-layout__container--no-menu'),
38
39
  children: [
39
40
  showSidebar ? /*#__PURE__*/ jsxs("aside", {
40
41
  className: clsx('rp-doc-layout__sidebar', isSidebarOpen && 'rp-doc-layout__sidebar--open', 'rp-scrollbar'),