@rspress/core 2.0.17 → 2.0.19
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.
- package/dist/{4538.js → 4538~0.js} +1 -1
- package/dist/6305~0.js +3007 -0
- package/dist/{7448.js → 8472~0.js} +3 -3
- package/dist/{0~execa.js → 864~0.js} +11 -11
- package/dist/cli/index.js +13 -40
- package/dist/config/defineConfig.d.ts +15 -15
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/DocContent/docComponents/title.tsx +1 -1
- package/dist/eject-theme/components/HomeFeature/index.scss +1 -0
- package/dist/eject-theme/components/HomeFeature/index.tsx +1 -1
- package/dist/eject-theme/components/HoverGroup/index.scss +25 -0
- package/dist/eject-theme/components/HoverGroup/index.tsx +22 -1
- package/dist/eject-theme/components/Llms/LlmsCopyButton.tsx +2 -6
- package/dist/eject-theme/components/Llms/LlmsCopyRow.tsx +2 -5
- package/dist/eject-theme/components/Llms/LlmsHint.test.tsx +104 -0
- package/dist/eject-theme/components/Llms/LlmsHint.tsx +70 -0
- package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +51 -64
- package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +65 -51
- package/dist/eject-theme/components/Llms/getLlmsCopyContent.test.ts +21 -0
- package/dist/eject-theme/components/Llms/getLlmsCopyContent.ts +20 -0
- package/dist/eject-theme/components/Llms/index.tsx +6 -1
- package/dist/eject-theme/components/Nav/NavMenu.scss +16 -0
- package/dist/eject-theme/components/Nav/NavMenu.tsx +12 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +18 -2
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +27 -19
- package/dist/eject-theme/components/NavScreen/index.scss +4 -0
- package/dist/eject-theme/components/Outline/index.scss +4 -0
- package/dist/eject-theme/components/Outline/index.tsx +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +3 -0
- package/dist/eject-theme/components/Sidebar/SidebarItem.scss +16 -0
- package/dist/eject-theme/components/Sidebar/SidebarItem.test.tsx +51 -0
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +10 -1
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +15 -0
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.tsx +6 -1
- package/dist/eject-theme/components/Sidebar/index.tsx +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node/PluginDriver.js +1 -1
- package/dist/node/auto-nav-sidebar/index.js +1 -1
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +39 -10
- package/dist/node/auto-nav-sidebar/type.d.ts +7 -0
- package/dist/node/auto-nav-sidebar/utils.d.ts +1 -0
- package/dist/node/auto-nav-sidebar/utils.js +2 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/constants.d.ts +2 -1
- package/dist/node/constants.js +50 -2
- package/dist/node/dev.d.ts +2 -1
- package/dist/node/dev.js +7 -2
- package/dist/node/eject.js +3 -3
- package/dist/node/initRsbuild.d.ts +6 -2
- package/dist/node/initRsbuild.js +49 -14
- package/dist/node/last-updated/index.js +112 -15
- package/dist/node/llms.d.ts +3 -0
- package/dist/node/llms.js +8 -0
- package/dist/node/logger/hint.js +2 -2
- package/dist/node/mdx/options.js +1 -1
- package/dist/node/mdx/processor.js +1 -1
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +3 -3
- package/dist/node/mdx/remarkPlugins/image.js +3 -3
- package/dist/node/mdx/remarkPlugins/link.js +3 -3
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +5 -3
- package/dist/node/route/RouteService.js +8 -3
- package/dist/node/route/extractPageData.js +3 -15
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/route/routeChunkAssets.d.ts +15 -0
- package/dist/node/route/routeChunkAssets.js +56 -0
- package/dist/node/runtimeModule/i18n.js +3 -3
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +1 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/alternateLinks.d.ts +7 -0
- package/dist/node/ssg/alternateLinks.js +40 -0
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderHtmlTemplate.d.ts +3 -1
- package/dist/node/ssg/renderHtmlTemplate.js +25 -3
- package/dist/node/ssg/renderPage.d.ts +3 -1
- package/dist/node/ssg/renderPage.js +5 -5
- package/dist/node/ssg/renderPageWorker.js +5 -5
- package/dist/node/ssg/renderPages.d.ts +3 -2
- package/dist/node/ssg/renderPages.js +18 -13
- package/dist/node/ssg/rsbuildPluginCSR.d.ts +3 -1
- package/dist/node/ssg/rsbuildPluginCSR.js +2 -2
- package/dist/node/ssg/rsbuildPluginSSG.d.ts +3 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +3 -3
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +2 -2
- package/dist/node/ssg-md/llms/llmsTxt.d.ts +2 -2
- package/dist/node/ssg-md/llms/llmsTxt.js +49 -35
- package/dist/node/ssg-md/remarkSplitMdx.js +8 -10
- package/dist/node/ssg-md/renderPage.js +3 -3
- package/dist/node/ssg-md/renderPages.js +4 -4
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.d.ts +1 -1
- package/dist/node/utils/createHash.js +3 -3
- package/dist/node/utils/error.js +2 -2
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +1 -1
- package/dist/node/utils/reactAlias.js +3 -3
- package/dist/runtime/App.js +7 -2
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/reactDom.d.ts +19 -0
- package/dist/runtime/reactDom.js +5 -0
- package/dist/runtime/utils.d.ts +2 -1
- package/dist/runtime/utils.js +5 -2
- package/dist/theme/assets/anthropic.js +15 -0
- package/dist/theme/assets/open-in-chat.js +19 -0
- package/dist/theme/assets/openai.js +15 -0
- package/dist/theme/components/DocContent/docComponents/title.js +1 -1
- package/dist/theme/components/HomeFeature/index.css +1 -0
- package/dist/theme/components/HomeFeature/index.js +32 -34
- package/dist/theme/components/HoverGroup/index.css +22 -0
- package/dist/theme/components/HoverGroup/index.js +17 -1
- package/dist/theme/components/Llms/LlmsCopyButton.js +3 -4
- package/dist/theme/components/Llms/LlmsCopyRow.js +2 -3
- package/dist/theme/components/Llms/LlmsHint.d.ts +2 -0
- package/dist/theme/components/Llms/LlmsHint.js +40 -0
- package/dist/theme/components/Llms/LlmsOpenRow.js +31 -57
- package/dist/theme/components/Llms/LlmsViewOptions.d.ts +6 -4
- package/dist/theme/components/Llms/LlmsViewOptions.js +28 -45
- package/dist/theme/components/Llms/getLlmsCopyContent.d.ts +1 -0
- package/dist/theme/components/Llms/getLlmsCopyContent.js +14 -0
- package/dist/theme/components/Llms/index.d.ts +2 -1
- package/dist/theme/components/Llms/index.js +1 -0
- package/dist/theme/components/Nav/NavMenu.css +15 -0
- package/dist/theme/components/Nav/NavMenu.js +8 -0
- package/dist/theme/components/NavScreen/NavScreenMenuItem.css +17 -2
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +21 -22
- package/dist/theme/components/NavScreen/index.css +4 -0
- package/dist/theme/components/Outline/index.css +4 -0
- package/dist/theme/components/Outline/index.js +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.js +4 -1
- package/dist/theme/components/Sidebar/SidebarItem.css +15 -0
- package/dist/theme/components/Sidebar/SidebarItem.d.ts +2 -1
- package/dist/theme/components/Sidebar/SidebarItem.js +7 -2
- package/dist/theme/components/Sidebar/SidebarSectionHeader.css +14 -0
- package/dist/theme/components/Sidebar/SidebarSectionHeader.d.ts +2 -1
- package/dist/theme/components/Sidebar/SidebarSectionHeader.js +12 -6
- package/dist/theme/components/Sidebar/index.js +1 -0
- package/dist/theme/icons.d.ts +4 -1
- package/dist/theme/icons.js +8 -2
- package/dist/theme/index.d.ts +1 -2
- package/dist/theme/index.js +1 -2
- package/dist/theme/layout/Layout/index.js +1 -2
- package/meta-json-schema.json +33 -3
- package/nav-json-schema.json +9 -0
- package/package.json +16 -21
- package/dist/8629.js +0 -7275
- package/dist/8629.js.LICENSE.txt +0 -41
- package/dist/theme/logic/useRedirect4FirstVisit.d.ts +0 -5
- package/dist/theme/logic/useRedirect4FirstVisit.js +0 -31
- /package/dist/{102.js → 102~0.js} +0 -0
- /package/dist/{5357.js → 5357~0.js} +0 -0
- /package/dist/{7748.js → 7748~0.js} +0 -0
- /package/dist/{0~8016.js → 8016~0.js} +0 -0
- /package/dist/{9857.js → 9857~0.js} +0 -0
- /package/dist/{9940.js → 9940~0.js} +0 -0
- /package/dist/{0~rslib-runtime.js → rslib-runtime~0.js} +0 -0
- /package/dist/{0~tinypool.js → tinypool~0.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __webpack_require__ } from "../../
|
|
2
|
-
import "../../4538.js";
|
|
3
|
-
import { node_path, core_rspack, logger } from "../../
|
|
1
|
+
import { __webpack_require__ } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../4538~0.js";
|
|
3
|
+
import { node_path, core_rspack, logger } from "../../6305~0.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";
|
package/dist/runtime/App.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PageContext, useLocation } from "@rspress/core/runtime";
|
|
3
3
|
import { Layout, Root } from "@rspress/core/theme";
|
|
4
|
+
import { LlmsHint } from "@rspress/core/theme-original";
|
|
4
5
|
import react, { useContext, useLayoutEffect } from "react";
|
|
5
6
|
import virtual_global_components from "virtual-global-components";
|
|
6
7
|
import { consumeCachedPageData, initPageData, setCurrentPageData } from "./initPageData.js";
|
|
@@ -29,11 +30,15 @@ function App() {
|
|
|
29
30
|
const GLOBAL_COMPONENTS_KEY = 'globalUIComponents';
|
|
30
31
|
const query = new URLSearchParams(search);
|
|
31
32
|
const hideGlobalUIComponents = false === frontmatter[GLOBAL_COMPONENTS_KEY] || "0" === query.get(GLOBAL_COMPONENTS_KEY);
|
|
32
|
-
if (import.meta.env.SSG_MD) return /*#__PURE__*/
|
|
33
|
-
children:
|
|
33
|
+
if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsxs(Root, {
|
|
34
|
+
children: [
|
|
35
|
+
import.meta.env.ENABLE_LLMS_HINT && /*#__PURE__*/ jsx(LlmsHint, {}),
|
|
36
|
+
/*#__PURE__*/ jsx(Layout, {})
|
|
37
|
+
]
|
|
34
38
|
});
|
|
35
39
|
return /*#__PURE__*/ jsxs(Root, {
|
|
36
40
|
children: [
|
|
41
|
+
import.meta.env.ENABLE_LLMS_HINT && /*#__PURE__*/ jsx(LlmsHint, {}),
|
|
37
42
|
/*#__PURE__*/ jsx(Layout, {}),
|
|
38
43
|
!hideGlobalUIComponents && virtual_global_components.map((componentInfo, index)=>{
|
|
39
44
|
if (Array.isArray(componentInfo)) {
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -19,5 +19,6 @@ export { useVersion } from './hooks/useVersion.js';
|
|
|
19
19
|
export { useWindowSize } from './hooks/useWindowSize.js';
|
|
20
20
|
export { initPageData, warmPageData } from './initPageData.js';
|
|
21
21
|
export { NoSSR } from './NoSSR.js';
|
|
22
|
+
export { safePreconnect, safePreload } from './reactDom.js';
|
|
22
23
|
export { isActive, pathnameToRouteService, preloadLink } from './route.js';
|
|
23
|
-
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, } from './utils.js';
|
|
24
|
+
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, withSiteOrigin, } from './utils.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -19,5 +19,6 @@ export { useVersion } from "./hooks/useVersion.js";
|
|
|
19
19
|
export { useWindowSize } from "./hooks/useWindowSize.js";
|
|
20
20
|
export { initPageData, warmPageData } from "./initPageData.js";
|
|
21
21
|
export { NoSSR } from "./NoSSR.js";
|
|
22
|
+
export { safePreconnect, safePreload } from "./reactDom.js";
|
|
22
23
|
export { isActive, pathnameToRouteService, preloadLink } from "./route.js";
|
|
23
|
-
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase } from "./utils.js";
|
|
24
|
+
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, withSiteOrigin } from "./utils.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type CrossOrigin = '' | 'anonymous' | 'use-credentials';
|
|
2
|
+
type Preconnect = (href: string, options?: {
|
|
3
|
+
crossOrigin?: CrossOrigin;
|
|
4
|
+
}) => void;
|
|
5
|
+
type Preload = (href: string, options?: {
|
|
6
|
+
as: 'audio' | 'document' | 'embed' | 'fetch' | 'font' | 'image' | 'object' | 'script' | 'style' | 'track' | 'video' | 'worker';
|
|
7
|
+
crossOrigin?: CrossOrigin;
|
|
8
|
+
fetchPriority?: 'high' | 'low' | 'auto';
|
|
9
|
+
imageSizes?: string;
|
|
10
|
+
imageSrcSet?: string;
|
|
11
|
+
integrity?: string;
|
|
12
|
+
media?: string;
|
|
13
|
+
nonce?: string;
|
|
14
|
+
referrerPolicy?: ReferrerPolicy;
|
|
15
|
+
type?: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
export declare const safePreconnect: Preconnect | undefined;
|
|
18
|
+
export declare const safePreload: Preload | undefined;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as __rspack_external_react_dom_20ef40a6 from "react-dom";
|
|
2
|
+
const reactDOM = __rspack_external_react_dom_20ef40a6;
|
|
3
|
+
const safePreconnect = reactDOM.preconnect ?? reactDOM.default?.preconnect;
|
|
4
|
+
const safePreload = reactDOM.preload ?? reactDOM.default?.preload;
|
|
5
|
+
export { safePreconnect, safePreload };
|
package/dist/runtime/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addLeadingSlash, addTrailingSlash, isProduction, removeTrailingSlash } from '@rspress/shared';
|
|
2
2
|
declare function withBase(url?: string): string;
|
|
3
|
+
declare function withSiteOrigin(url: string): string;
|
|
3
4
|
declare function removeBase(url: string): string;
|
|
4
5
|
declare function isEqualPath(a: string, b: string): boolean;
|
|
5
6
|
declare function normalizeHrefInRuntime(link: string): string;
|
|
@@ -9,4 +10,4 @@ declare function normalizeHrefInRuntime(link: string): string;
|
|
|
9
10
|
declare function cleanUrlByConfig(link: string): string;
|
|
10
11
|
declare function normalizeImagePath(imagePath: string): string;
|
|
11
12
|
declare function routePathToMdPath(routePath: string): string;
|
|
12
|
-
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, };
|
|
13
|
+
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase, withSiteOrigin, };
|
package/dist/runtime/utils.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { addLeadingSlash, addTrailingSlash, isDataUrl, isExternalUrl, isProduction, normalizeHref, removeBase, removeHash, removeTrailingSlash, withBase } from "@rspress/shared";
|
|
1
|
+
import { addLeadingSlash, addTrailingSlash, isDataUrl, isExternalUrl, isProduction, normalizeHref, removeBase, removeHash, removeTrailingSlash, withBase, withSiteOrigin } from "@rspress/shared";
|
|
2
2
|
import virtual_site_data from "virtual-site-data";
|
|
3
3
|
function utils_withBase(url = '/') {
|
|
4
4
|
return withBase(url, virtual_site_data.base);
|
|
5
5
|
}
|
|
6
|
+
function utils_withSiteOrigin(url) {
|
|
7
|
+
return withSiteOrigin(url, virtual_site_data.siteOrigin);
|
|
8
|
+
}
|
|
6
9
|
function utils_removeBase(url) {
|
|
7
10
|
return removeBase(url, virtual_site_data.base);
|
|
8
11
|
}
|
|
@@ -31,4 +34,4 @@ function routePathToMdPath(routePath) {
|
|
|
31
34
|
function isAbsoluteUrl(path) {
|
|
32
35
|
return isExternalUrl(path) || isDataUrl(path) || path.startsWith('//');
|
|
33
36
|
}
|
|
34
|
-
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeTrailingSlash, routePathToMdPath, utils_removeBase as removeBase, utils_withBase as withBase };
|
|
37
|
+
export { addLeadingSlash, addTrailingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeTrailingSlash, routePathToMdPath, utils_removeBase as removeBase, utils_withBase as withBase, utils_withSiteOrigin as withSiteOrigin };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgAnthropic = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: 16,
|
|
6
|
+
height: 16,
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
...props,
|
|
10
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
11
|
+
d: "M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z"
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
var anthropic = SvgAnthropic;
|
|
15
|
+
export default anthropic;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgOpenInChat = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: 16,
|
|
6
|
+
height: 16,
|
|
7
|
+
fill: "none",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
...props,
|
|
10
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeLinecap: "round",
|
|
13
|
+
strokeLinejoin: "round",
|
|
14
|
+
strokeWidth: 2,
|
|
15
|
+
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
var open_in_chat = SvgOpenInChat;
|
|
19
|
+
export default open_in_chat;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
const SvgOpenai = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: 16,
|
|
6
|
+
height: 16,
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
...props,
|
|
10
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
11
|
+
d: "M22.282 9.821a5.99 5.99 0 0 0-.516-4.91 6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.99 5.99 0 0 0-3.998 2.9 6.05 6.05 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.05 6.05 0 0 0 6.515 2.9A5.99 5.99 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206 6 6 0 0 0 3.997-2.9 6.06 6.06 0 0 0-.747-7.073zM13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023-.141-.085-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08-4.778 2.758a.8.8 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5Z"
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
var openai = SvgOpenai;
|
|
15
|
+
export default openai;
|
|
@@ -21,7 +21,7 @@ const H1 = (props)=>{
|
|
|
21
21
|
})
|
|
22
22
|
]
|
|
23
23
|
}),
|
|
24
|
-
|
|
24
|
+
import.meta.env.ENABLE_LLMS_UI && 'title' === placement && /*#__PURE__*/ jsxs(LlmsContainer, {
|
|
25
25
|
children: [
|
|
26
26
|
/*#__PURE__*/ jsx(LlmsCopyButton, {}),
|
|
27
27
|
/*#__PURE__*/ jsx(LlmsViewOptions, {})
|
|
@@ -24,44 +24,42 @@ function HomeFeatureItem({ feature }) {
|
|
|
24
24
|
const { icon, title, details, link } = feature;
|
|
25
25
|
const { innerProps, outerProps, outerRef, shineDom } = useCardAnimation();
|
|
26
26
|
const navigate = useLinkNavigate();
|
|
27
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/ jsx("div", {
|
|
28
28
|
...outerProps,
|
|
29
29
|
className: `rp-home-feature__item ${getGridClass(feature)}`,
|
|
30
30
|
ref: outerRef,
|
|
31
|
-
children:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
icon: icon
|
|
48
|
-
})
|
|
49
|
-
}) : null,
|
|
50
|
-
/*#__PURE__*/ jsx("h2", {
|
|
51
|
-
className: "rp-home-feature__title",
|
|
52
|
-
children: title
|
|
31
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
32
|
+
className: "rp-home-feature__item-wrapper",
|
|
33
|
+
...innerProps,
|
|
34
|
+
children: /*#__PURE__*/ jsxs("article", {
|
|
35
|
+
className: `rp-home-feature__card ${link ? 'rp-home-feature__card--clickable' : ''}`,
|
|
36
|
+
onClick: ()=>{
|
|
37
|
+
if (link) navigate(link);
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsxs("div", {
|
|
41
|
+
className: "rp-home-feature__title-wrapper",
|
|
42
|
+
children: [
|
|
43
|
+
icon ? /*#__PURE__*/ jsx("div", {
|
|
44
|
+
className: "rp-home-feature__icon",
|
|
45
|
+
children: /*#__PURE__*/ jsx(SvgWrapper, {
|
|
46
|
+
icon: icon
|
|
53
47
|
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
}) : null,
|
|
49
|
+
/*#__PURE__*/ jsx("h2", {
|
|
50
|
+
className: "rp-home-feature__title",
|
|
51
|
+
children: title
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ jsx("p", {
|
|
56
|
+
className: "rp-home-feature__detail",
|
|
57
|
+
...renderHtmlOrText(details)
|
|
58
|
+
}),
|
|
59
|
+
shineDom
|
|
60
|
+
]
|
|
61
|
+
}, title)
|
|
62
|
+
})
|
|
65
63
|
}, title);
|
|
66
64
|
}
|
|
67
65
|
function HomeFeature({ features: featuresProp }) {
|
|
@@ -38,6 +38,13 @@
|
|
|
38
38
|
transition: opacity .3s ease-in-out, visibility 0s linear .3s;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
.rp-nav-menu__item:hover > .rp-hover-group--hidden, .rp-nav-hamburger:hover > .rp-hover-group--hidden {
|
|
42
|
+
visibility: visible;
|
|
43
|
+
opacity: 1;
|
|
44
|
+
pointer-events: auto;
|
|
45
|
+
transition: opacity .3s ease-in-out;
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
.rp-hover-group__item {
|
|
42
49
|
white-space: nowrap;
|
|
43
50
|
height: 32px;
|
|
@@ -61,6 +68,21 @@
|
|
|
61
68
|
display: flex;
|
|
62
69
|
}
|
|
63
70
|
|
|
71
|
+
.rp-hover-group__item__icon {
|
|
72
|
+
object-fit: contain;
|
|
73
|
+
flex: 0 0 16px;
|
|
74
|
+
width: 16px;
|
|
75
|
+
height: 16px;
|
|
76
|
+
font-size: 16px;
|
|
77
|
+
line-height: 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.rp-hover-group__item__icon > svg, .rp-hover-group__item__icon > img {
|
|
81
|
+
object-fit: contain;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
.rp-hover-group__item--active {
|
|
65
87
|
color: var(--rp-c-brand);
|
|
66
88
|
cursor: auto;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { matchNavbar, useLocation } from "@rspress/core/runtime";
|
|
3
|
-
import { Link, Tag } from "@rspress/core/theme";
|
|
3
|
+
import { Link, SvgWrapper, Tag } from "@rspress/core/theme";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import "./index.css";
|
|
6
6
|
function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
@@ -24,6 +24,10 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
24
24
|
hrefLang: item.lang,
|
|
25
25
|
rel: item.rel,
|
|
26
26
|
children: [
|
|
27
|
+
item.icon && /*#__PURE__*/ jsx(SvgWrapper, {
|
|
28
|
+
icon: item.icon,
|
|
29
|
+
className: "rp-hover-group__item__icon"
|
|
30
|
+
}),
|
|
27
31
|
item.text,
|
|
28
32
|
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
29
33
|
tag: item.tag
|
|
@@ -60,6 +64,10 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
60
64
|
hrefLang: lang,
|
|
61
65
|
rel: rel,
|
|
62
66
|
children: [
|
|
67
|
+
item.icon && /*#__PURE__*/ jsx(SvgWrapper, {
|
|
68
|
+
icon: item.icon,
|
|
69
|
+
className: "rp-hover-group__item__icon"
|
|
70
|
+
}),
|
|
63
71
|
text,
|
|
64
72
|
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
65
73
|
tag: item.tag
|
|
@@ -69,6 +77,10 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
69
77
|
className: "rp-hover-group__item__link",
|
|
70
78
|
lang: lang,
|
|
71
79
|
children: [
|
|
80
|
+
item.icon && /*#__PURE__*/ jsx(SvgWrapper, {
|
|
81
|
+
icon: item.icon,
|
|
82
|
+
className: "rp-hover-group__item__icon"
|
|
83
|
+
}),
|
|
72
84
|
text,
|
|
73
85
|
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
74
86
|
tag: item.tag
|
|
@@ -86,6 +98,10 @@ function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
|
86
98
|
children: /*#__PURE__*/ jsxs("div", {
|
|
87
99
|
className: "rp-hover-group__item__link",
|
|
88
100
|
children: [
|
|
101
|
+
item.icon && /*#__PURE__*/ jsx(SvgWrapper, {
|
|
102
|
+
icon: item.icon,
|
|
103
|
+
className: "rp-hover-group__item__icon"
|
|
104
|
+
}),
|
|
89
105
|
item.text,
|
|
90
106
|
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
91
107
|
tag: item.tag
|
|
@@ -5,13 +5,13 @@ import { IconCopy, IconSuccess, SvgWrapper, copyToClipboard } from "@rspress/cor
|
|
|
5
5
|
import { useCallback, useRef, useState } from "react";
|
|
6
6
|
import "./index.css";
|
|
7
7
|
import "./LlmsCopyButton.css";
|
|
8
|
+
import { getLlmsCopyContent } from "./getLlmsCopyContent.js";
|
|
8
9
|
import { useMdUrl } from "./useMdUrl.js";
|
|
9
10
|
/**
|
|
10
11
|
* Inspired from fumadocs docsite
|
|
11
12
|
* @from https://github.com/fuma-nama/fumadocs/blob/5723bbe58ef805a5421a780abf235a10b251be2f/apps/docs/app/docs/%5B...slug%5D/page.client.tsx#L11
|
|
12
13
|
* @license MIT
|
|
13
|
-
*/
|
|
14
|
-
function LlmsCopyButton(props) {
|
|
14
|
+
*/ function LlmsCopyButton(props) {
|
|
15
15
|
const { onClick, ...otherProps } = props;
|
|
16
16
|
const t = useI18n();
|
|
17
17
|
const { pathname } = useMdUrl();
|
|
@@ -22,8 +22,7 @@ function LlmsCopyButton(props) {
|
|
|
22
22
|
setLoading(true);
|
|
23
23
|
const url = pathname;
|
|
24
24
|
try {
|
|
25
|
-
const content =
|
|
26
|
-
cache.set(url, content);
|
|
25
|
+
const content = await getLlmsCopyContent(url);
|
|
27
26
|
const isCopied = await copyToClipboard(content);
|
|
28
27
|
if (!isCopied) return;
|
|
29
28
|
setFinished(true);
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useI18n } from "@rspress/core/runtime";
|
|
3
3
|
import { IconCopy, IconSuccess, SvgWrapper, copyToClipboard } from "@rspress/core/theme";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
5
|
+
import { getLlmsCopyContent } from "./getLlmsCopyContent.js";
|
|
5
6
|
import { useMdUrl } from "./useMdUrl.js";
|
|
6
|
-
const cache = new Map();
|
|
7
7
|
function LlmsCopyRow() {
|
|
8
8
|
const t = useI18n();
|
|
9
9
|
const { pathname } = useMdUrl();
|
|
@@ -14,8 +14,7 @@ function LlmsCopyRow() {
|
|
|
14
14
|
if (!pathname) return;
|
|
15
15
|
setLoading(true);
|
|
16
16
|
try {
|
|
17
|
-
const content =
|
|
18
|
-
cache.set(pathname, content);
|
|
17
|
+
const content = await getLlmsCopyContent(pathname);
|
|
19
18
|
const isCopied = await copyToClipboard(content);
|
|
20
19
|
if (!isCopied) return;
|
|
21
20
|
setFinished(true);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { routePathToMdPath, usePage, useSite, withBase, withSiteOrigin } from "@rspress/core/runtime";
|
|
3
|
+
const visuallyHiddenStyle = {
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
width: 1,
|
|
6
|
+
height: 1,
|
|
7
|
+
padding: 0,
|
|
8
|
+
margin: -1,
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
11
|
+
clipPath: 'inset(50%)',
|
|
12
|
+
whiteSpace: 'nowrap',
|
|
13
|
+
border: 0
|
|
14
|
+
};
|
|
15
|
+
function createLlmsHintText({ llmsTxtUrl, llmsFullTxtUrl, pageMdUrl }) {
|
|
16
|
+
return `For AI agents: the complete documentation index is available at ${llmsTxtUrl}, the full documentation bundle is available at ${llmsFullTxtUrl}, and this page is available as Markdown at ${pageMdUrl}.`;
|
|
17
|
+
}
|
|
18
|
+
function LlmsHint() {
|
|
19
|
+
const { page } = usePage();
|
|
20
|
+
const { site } = useSite();
|
|
21
|
+
if (!page?.routePath) return null;
|
|
22
|
+
const isMultiVersion = site.multiVersion.versions.length > 0;
|
|
23
|
+
const versionPrefix = isMultiVersion && page.version !== site.multiVersion.default ? `${page.version}/` : '';
|
|
24
|
+
const langPrefix = page.lang === site.lang ? '' : `${page.lang}/`;
|
|
25
|
+
const llmsTxtUrl = withSiteOrigin(withBase(`/${versionPrefix}${langPrefix}llms.txt`));
|
|
26
|
+
const llmsFullTxtUrl = withSiteOrigin(withBase(`/${versionPrefix}${langPrefix}llms-full.txt`));
|
|
27
|
+
const pageMdUrl = withSiteOrigin(routePathToMdPath(page.routePath));
|
|
28
|
+
const hintText = createLlmsHintText({
|
|
29
|
+
llmsTxtUrl,
|
|
30
|
+
llmsFullTxtUrl,
|
|
31
|
+
pageMdUrl
|
|
32
|
+
});
|
|
33
|
+
if (import.meta.env.SSG_MD) return `> ${hintText}\n\n`;
|
|
34
|
+
return /*#__PURE__*/ jsx("div", {
|
|
35
|
+
className: "rp-llms-hint",
|
|
36
|
+
style: visuallyHiddenStyle,
|
|
37
|
+
children: hintText
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { LlmsHint };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useI18n, useSite } from "@rspress/core/runtime";
|
|
3
|
-
import { IconExternalLink, SvgWrapper } from "@rspress/core/theme";
|
|
3
|
+
import { IconAnthropic, IconExternalLink, IconLink, IconOpenAI, IconOpenInChat, SvgWrapper, copyToClipboard } from "@rspress/core/theme";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import "./LlmsOpenRow.css";
|
|
6
6
|
import "./LlmsViewOptions.css";
|
|
7
7
|
import { useMdUrl } from "./useMdUrl.js";
|
|
8
|
+
const DEFAULT_OPTIONS = [
|
|
9
|
+
'markdownLink',
|
|
10
|
+
'chatgpt',
|
|
11
|
+
'claude'
|
|
12
|
+
];
|
|
8
13
|
function LlmsOpenRow() {
|
|
9
14
|
const t = useI18n();
|
|
10
15
|
const { pathname } = useMdUrl();
|
|
@@ -12,10 +17,7 @@ function LlmsOpenRow() {
|
|
|
12
17
|
const llmsUI = site?.themeConfig?.llmsUI;
|
|
13
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
14
19
|
const containerRef = useRef(null);
|
|
15
|
-
const options = 'object' == typeof llmsUI
|
|
16
|
-
'chatgpt',
|
|
17
|
-
'claude'
|
|
18
|
-
];
|
|
20
|
+
const options = 'object' == typeof llmsUI ? false === llmsUI.viewOptions ? [] : llmsUI.viewOptions ?? DEFAULT_OPTIONS : DEFAULT_OPTIONS;
|
|
19
21
|
useEffect(()=>{
|
|
20
22
|
const handleClickOutside = (event)=>{
|
|
21
23
|
if (containerRef.current && event.target && !containerRef.current.contains(event.target)) setIsOpen(false);
|
|
@@ -30,6 +32,15 @@ function LlmsOpenRow() {
|
|
|
30
32
|
]);
|
|
31
33
|
const q = `Read ${fullMarkdownUrl}, I want to ask questions about it.`;
|
|
32
34
|
const builtinItems = useMemo(()=>({
|
|
35
|
+
markdownLink: {
|
|
36
|
+
title: t('copyMarkdownLinkText'),
|
|
37
|
+
icon: /*#__PURE__*/ jsx(SvgWrapper, {
|
|
38
|
+
icon: IconLink
|
|
39
|
+
}),
|
|
40
|
+
onClick: ()=>{
|
|
41
|
+
copyToClipboard(fullMarkdownUrl);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
33
44
|
chatgpt: {
|
|
34
45
|
title: t('openInText', {
|
|
35
46
|
name: 'ChatGPT'
|
|
@@ -38,16 +49,8 @@ function LlmsOpenRow() {
|
|
|
38
49
|
hints: 'search',
|
|
39
50
|
q
|
|
40
51
|
})}`,
|
|
41
|
-
icon: /*#__PURE__*/ jsx(
|
|
42
|
-
|
|
43
|
-
viewBox: "0 0 24 24",
|
|
44
|
-
fill: "currentColor",
|
|
45
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
46
|
-
width: "16",
|
|
47
|
-
height: "16",
|
|
48
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
49
|
-
d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"
|
|
50
|
-
})
|
|
52
|
+
icon: /*#__PURE__*/ jsx(SvgWrapper, {
|
|
53
|
+
icon: IconOpenAI
|
|
51
54
|
})
|
|
52
55
|
},
|
|
53
56
|
claude: {
|
|
@@ -57,23 +60,20 @@ function LlmsOpenRow() {
|
|
|
57
60
|
href: `https://claude.ai/new?${new URLSearchParams({
|
|
58
61
|
q
|
|
59
62
|
})}`,
|
|
60
|
-
icon: /*#__PURE__*/ jsx(
|
|
61
|
-
|
|
62
|
-
role: "img",
|
|
63
|
-
viewBox: "0 0 24 24",
|
|
64
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
-
width: "16",
|
|
66
|
-
height: "16",
|
|
67
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
68
|
-
d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"
|
|
69
|
-
})
|
|
63
|
+
icon: /*#__PURE__*/ jsx(SvgWrapper, {
|
|
64
|
+
icon: IconAnthropic
|
|
70
65
|
})
|
|
71
66
|
}
|
|
72
67
|
}), [
|
|
68
|
+
fullMarkdownUrl,
|
|
73
69
|
t,
|
|
74
70
|
q
|
|
75
71
|
]);
|
|
76
|
-
|
|
72
|
+
const renderableItems = useMemo(()=>options.map((option)=>builtinItems[option] ?? null).filter((item)=>null !== item), [
|
|
73
|
+
options,
|
|
74
|
+
builtinItems
|
|
75
|
+
]);
|
|
76
|
+
if (!pathname || 0 === renderableItems.length) return null;
|
|
77
77
|
return /*#__PURE__*/ jsxs("div", {
|
|
78
78
|
ref: containerRef,
|
|
79
79
|
className: "rp-outline__open-in-wrapper",
|
|
@@ -82,29 +82,8 @@ function LlmsOpenRow() {
|
|
|
82
82
|
className: "rp-outline__action-row",
|
|
83
83
|
onClick: ()=>setIsOpen(!isOpen),
|
|
84
84
|
children: [
|
|
85
|
-
/*#__PURE__*/
|
|
86
|
-
|
|
87
|
-
height: "16",
|
|
88
|
-
viewBox: "0 0 24 24",
|
|
89
|
-
fill: "none",
|
|
90
|
-
stroke: "currentColor",
|
|
91
|
-
strokeWidth: "2",
|
|
92
|
-
strokeLinecap: "round",
|
|
93
|
-
strokeLinejoin: "round",
|
|
94
|
-
children: [
|
|
95
|
-
/*#__PURE__*/ jsx("path", {
|
|
96
|
-
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
97
|
-
}),
|
|
98
|
-
/*#__PURE__*/ jsx("polyline", {
|
|
99
|
-
points: "15 3 21 3 21 9"
|
|
100
|
-
}),
|
|
101
|
-
/*#__PURE__*/ jsx("line", {
|
|
102
|
-
x1: "10",
|
|
103
|
-
y1: "14",
|
|
104
|
-
x2: "21",
|
|
105
|
-
y2: "3"
|
|
106
|
-
})
|
|
107
|
-
]
|
|
85
|
+
/*#__PURE__*/ jsx(SvgWrapper, {
|
|
86
|
+
icon: IconOpenInChat
|
|
108
87
|
}),
|
|
109
88
|
/*#__PURE__*/ jsx("span", {
|
|
110
89
|
children: t('openInText', {
|
|
@@ -115,13 +94,7 @@ function LlmsOpenRow() {
|
|
|
115
94
|
}),
|
|
116
95
|
isOpen && /*#__PURE__*/ jsx("div", {
|
|
117
96
|
className: "rp-llms-view-options__menu",
|
|
118
|
-
children:
|
|
119
|
-
let item;
|
|
120
|
-
if ('string' == typeof option && builtinItems[option]) item = builtinItems[option];
|
|
121
|
-
else {
|
|
122
|
-
if ('object' != typeof option || !('title' in option)) return null;
|
|
123
|
-
item = option;
|
|
124
|
-
}
|
|
97
|
+
children: renderableItems.map((item)=>{
|
|
125
98
|
if (item.href) return /*#__PURE__*/ jsxs("a", {
|
|
126
99
|
className: "rp-llms-view-options__menu-item",
|
|
127
100
|
href: item.href,
|
|
@@ -144,7 +117,8 @@ function LlmsOpenRow() {
|
|
|
144
117
|
})
|
|
145
118
|
]
|
|
146
119
|
}, item.title);
|
|
147
|
-
return /*#__PURE__*/ jsxs("
|
|
120
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
121
|
+
type: "button",
|
|
148
122
|
className: "rp-llms-view-options__menu-item",
|
|
149
123
|
onClick: ()=>{
|
|
150
124
|
item.onClick?.();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import './index.scss';
|
|
3
3
|
import './LlmsViewOptions.scss';
|
|
4
|
-
type
|
|
4
|
+
export type LlmsViewOptionsItem = {
|
|
5
5
|
title: string;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
onClick?: () => void;
|
|
@@ -16,8 +16,11 @@ export interface LlmsViewOptionsProps extends React.ButtonHTMLAttributes<HTMLBut
|
|
|
16
16
|
* @default ['markdownLink', 'chatgpt', 'claude']
|
|
17
17
|
* - 'chatgpt': Open in ChatGPT
|
|
18
18
|
* - 'claude': Open in Claude
|
|
19
|
+
*
|
|
20
|
+
* Unlike `themeConfig.llmsUI.viewOptions`, component options can use
|
|
21
|
+
* ReactNode icons and onClick callbacks.
|
|
19
22
|
*/
|
|
20
|
-
options?:
|
|
23
|
+
options?: LlmsViewOptionsItem[];
|
|
21
24
|
/**
|
|
22
25
|
* Button text by language, used with `useLang`.
|
|
23
26
|
* @default en: 'Open', zh: '\u6253\u5f00'
|
|
@@ -30,5 +33,4 @@ export interface LlmsViewOptionsProps extends React.ButtonHTMLAttributes<HTMLBut
|
|
|
30
33
|
*/
|
|
31
34
|
text?: string;
|
|
32
35
|
}
|
|
33
|
-
export declare function LlmsViewOptions({ options: propsOptions, }: LlmsViewOptionsProps): React.JSX.Element;
|
|
34
|
-
export {};
|
|
36
|
+
export declare function LlmsViewOptions({ options: propsOptions, }: LlmsViewOptionsProps): React.JSX.Element | null;
|