@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.
- package/dist/cli/index.js +2 -2
- package/dist/{common-Qw-RoVFD.js → common-Bo3KCGim.js} +4 -1
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/CdnTabs/index.test.tsx +71 -0
- package/dist/eject-theme/components/CdnTabs/index.tsx +175 -0
- package/dist/eject-theme/components/DocContent/index.tsx +0 -3
- package/dist/eject-theme/components/FallbackHeading/index.tsx +6 -1
- package/dist/eject-theme/components/Link/getHref.ts +1 -0
- package/dist/eject-theme/components/Link/index.tsx +9 -21
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +43 -54
- package/dist/eject-theme/components/NavTitle/index.test.tsx +78 -0
- package/dist/eject-theme/components/NavTitle/index.tsx +9 -5
- package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +79 -1
- package/dist/eject-theme/components/PackageManagerTabs/index.tsx +25 -12
- package/dist/eject-theme/components/Search/NoSearchResult.scss +1 -2
- package/dist/eject-theme/components/Search/SearchPanel.scss +75 -63
- package/dist/eject-theme/components/Search/SuggestItem.scss +28 -41
- package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +4 -1
- package/dist/eject-theme/components/Search/useSearchPanel.ts +103 -36
- package/dist/eject-theme/components/Sidebar/SidebarItem.scss +8 -0
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +3 -0
- package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +4 -1
- package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +1 -1
- package/dist/entry/worker.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/node/PluginDriver.d.ts +5 -0
- package/dist/node/PluginDriver.js +17 -2
- 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 +1 -1
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/constants.js +1 -1
- package/dist/node/eject.js +1 -1
- package/dist/node/initRsbuild.js +19 -7
- package/dist/node/llms.d.ts +1 -1
- package/dist/node/llms.js +2 -2
- package/dist/node/logger/hint.d.ts +1 -0
- package/dist/node/logger/hint.js +8 -2
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -0
- package/dist/node/mdx/remarkPlugins/link.js +1 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.d.ts → i18n/DEFAULT_I18N_TEXT.d.ts} +28 -0
- package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.js → i18n/DEFAULT_I18N_TEXT.js} +28 -0
- package/dist/node/runtimeModule/i18n/getI18nData.d.ts +11 -0
- package/dist/node/runtimeModule/{i18n.js → i18n/getI18nData.js} +35 -22
- package/dist/node/runtimeModule/i18n/rsbuildPlugin.d.ts +5 -0
- package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +21 -0
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +2 -2
- package/dist/node/runtimeModule/siteData/createSiteData.d.ts +2 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +3 -3
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.d.ts +2 -1
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +3 -4
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +2 -2
- package/dist/node/serve.js +1 -1
- package/dist/node/sitemap.d.ts +7 -0
- package/dist/node/sitemap.js +86 -0
- package/dist/node/ssg/alternateLinks.js +1 -1
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderHtmlTemplate.js +1 -1
- package/dist/node/ssg/renderPage.js +1 -1
- package/dist/node/ssg/renderPageWorker.js +1 -1
- package/dist/node/ssg/renderPages.js +2 -2
- package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
- package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
- package/dist/node/ssg-md/renderPage.js +5 -4
- package/dist/node/ssg-md/renderPages.js +2 -2
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/reactAlias.js +6 -3
- package/dist/{a~0.js → p~0.js} +23 -18
- package/dist/runtime/App.js +20 -29
- package/dist/runtime/BrowserOnly.d.ts +1 -1
- package/dist/runtime/BrowserOnly.js +53 -20
- package/dist/runtime/ClientApp.d.ts +3 -2
- package/dist/runtime/ClientApp.js +31 -21
- package/dist/runtime/ErrorRoute.d.ts +1 -0
- package/dist/runtime/ErrorRoute.js +30 -0
- package/dist/runtime/NoSSR.d.ts +7 -3
- package/dist/runtime/NoSSR.js +30 -9
- package/dist/runtime/PageRoute.d.ts +2 -0
- package/dist/runtime/PageRoute.js +70 -0
- package/dist/runtime/createServerRouter.d.ts +4 -0
- package/dist/runtime/createServerRouter.js +17 -0
- package/dist/runtime/csrClientEntry.js +5 -2
- package/dist/runtime/hooks/useWebMcp.d.ts +36 -0
- package/dist/runtime/hooks/useWebMcp.js +80 -0
- package/dist/runtime/index.d.ts +6 -3
- package/dist/runtime/index.js +6 -5
- package/dist/runtime/initPageData.d.ts +0 -3
- package/dist/runtime/initPageData.js +9 -45
- package/dist/runtime/pageDataLoader.d.ts +11 -0
- package/dist/runtime/pageDataLoader.js +7 -0
- package/dist/runtime/react.d.ts +5 -0
- package/dist/runtime/react.js +4 -0
- package/dist/runtime/reactDom.d.ts +6 -0
- package/dist/runtime/reactDom.js +2 -1
- package/dist/runtime/socialLinks.d.ts +1 -0
- package/dist/runtime/socialLinks.js +3 -0
- package/dist/runtime/ssrClientEntry.js +14 -6
- package/dist/runtime/ssrMdServerEntry.js +10 -21
- package/dist/runtime/ssrServerEntry.js +10 -21
- package/dist/static/assets/package.json +58 -0
- package/dist/theme/assets/bun.js +101 -0
- package/dist/theme/assets/deno.js +15 -0
- package/dist/theme/assets/jsdelivr.js +53 -0
- package/dist/theme/{components/PackageManagerTabs/icons/Npm.js → assets/npm.js} +4 -4
- package/dist/theme/{components/PackageManagerTabs/icons/Pnpm.js → assets/pnpm.js} +4 -4
- package/dist/theme/assets/unpkg.js +15 -0
- package/dist/theme/assets/yarn.js +22 -0
- package/dist/theme/components/CdnTabs/index.d.ts +10 -0
- package/dist/theme/components/CdnTabs/index.js +146 -0
- package/dist/theme/components/DocContent/index.js +1 -2
- package/dist/theme/components/FallbackHeading/index.js +1 -0
- package/dist/theme/components/Link/index.js +4 -17
- package/dist/theme/components/Link/useLinkNavigate.d.ts +2 -2
- package/dist/theme/components/Link/useLinkNavigate.js +22 -36
- package/dist/theme/components/NavTitle/index.js +10 -5
- package/dist/theme/components/PackageManagerTabs/index.d.ts +2 -0
- package/dist/theme/components/PackageManagerTabs/index.js +22 -12
- package/dist/theme/components/Search/NoSearchResult.css +1 -2
- package/dist/theme/components/Search/SearchPanel.css +72 -51
- package/dist/theme/components/Search/SuggestItem.css +21 -34
- package/dist/theme/components/Search/logic/providers/LocalProvider.js +4 -1
- package/dist/theme/components/Search/useSearchPanel.js +74 -26
- package/dist/theme/components/Sidebar/SidebarItem.css +5 -0
- package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -0
- package/dist/theme/components/SocialLinks/GithubStars.js +1 -1
- package/dist/theme/hooks/useDynamicToc.js +27 -34
- package/dist/theme/hooks/useWebMcpNavigation.d.ts +6 -0
- package/dist/theme/hooks/useWebMcpNavigation.js +123 -0
- package/dist/theme/hooks/useWebMcpPageList.d.ts +6 -0
- package/dist/theme/hooks/useWebMcpPageList.js +25 -0
- package/dist/theme/hooks/useWebMcpPageReading.d.ts +7 -0
- package/dist/theme/hooks/useWebMcpPageReading.js +23 -0
- package/dist/theme/hooks/useWebMcpSiteInfo.d.ts +6 -0
- package/dist/theme/hooks/useWebMcpSiteInfo.js +22 -0
- package/dist/theme/icons.d.ts +7 -0
- package/dist/theme/icons.js +15 -1
- package/dist/theme/index.d.ts +6 -2
- package/dist/theme/index.js +6 -2
- package/dist/theme/layout/ErrorLayout/index.css +52 -0
- package/dist/theme/layout/ErrorLayout/index.d.ts +8 -0
- package/dist/theme/layout/ErrorLayout/index.js +76 -0
- package/dist/theme/layout/Layout/index.js +1 -2
- package/dist/theme/webMcp/tools.d.ts +56 -0
- package/dist/theme/webMcp/tools.js +122 -0
- package/dist/theme/webMcp/types.d.ts +35 -0
- package/dist/theme/webMcp/types.js +0 -0
- package/dist/tinypool~0.js +19 -49
- package/dist/y~0.js +166 -0
- package/package.json +18 -18
- package/dist/b~0.js +0 -106
- package/dist/eject-theme/components/PackageManagerTabs/icons/Bun.tsx +0 -101
- package/dist/eject-theme/components/PackageManagerTabs/icons/Deno.tsx +0 -18
- package/dist/eject-theme/components/PackageManagerTabs/icons/Npm.tsx +0 -16
- package/dist/eject-theme/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
- package/dist/eject-theme/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
- package/dist/node/runtimeModule/i18n.d.ts +0 -8
- package/dist/theme/components/PackageManagerTabs/icons/Bun.d.ts +0 -2
- package/dist/theme/components/PackageManagerTabs/icons/Bun.js +0 -137
- package/dist/theme/components/PackageManagerTabs/icons/Deno.d.ts +0 -2
- package/dist/theme/components/PackageManagerTabs/icons/Deno.js +0 -15
- package/dist/theme/components/PackageManagerTabs/icons/Npm.d.ts +0 -2
- package/dist/theme/components/PackageManagerTabs/icons/Pnpm.d.ts +0 -2
- package/dist/theme/components/PackageManagerTabs/icons/Yarn.d.ts +0 -2
- package/dist/theme/components/PackageManagerTabs/icons/Yarn.js +0 -22
- package/dist/theme/logic/useScrollAfterNav.d.ts +0 -5
- package/dist/theme/logic/useScrollAfterNav.js +0 -35
- package/dist/theme/logic/useScrollReset.d.ts +0 -5
- 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
|
|
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,
|
|
@@ -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
|
-
*
|
|
4
|
-
*
|
|
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 {
|
|
2
|
-
import
|
|
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
|
-
|
|
6
|
-
|
|
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
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
42
|
-
else preloadChunkThenNavigate();
|
|
27
|
+
await navigation;
|
|
28
|
+
} else await navigate(to, options);
|
|
43
29
|
}, [
|
|
44
30
|
useTransitions,
|
|
45
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
35
|
-
|
|
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",
|
|
@@ -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(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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 =
|
|
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";
|
|
@@ -7,14 +7,20 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.rp-search-panel__modal {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
58
|
+
display: none;
|
|
36
59
|
}
|
|
37
60
|
|
|
38
|
-
@media (width
|
|
61
|
+
@media (width <= 768px) {
|
|
39
62
|
.rp-search-panel__cancel {
|
|
40
|
-
|
|
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
|
-
|
|
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:
|
|
50
|
-
height:
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
|
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:
|
|
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:
|
|
3
|
+
margin: 4px 0;
|
|
4
4
|
list-style: none;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.
|
|
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) {
|