@rspress/core 2.0.0-rc.3 → 2.0.0-rc.5
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/{0~7675.723d12b2.js → 0~7675.4468968d.js} +4 -4
- package/dist/1820.985588a0.js +5 -0
- package/dist/{3521.56e42d70.js → 5341.9eb6b114.js} +12 -12
- package/dist/{5485.077f14ff.js → 5485.b9ce9bdf.js} +5 -5
- package/dist/6289.29817fb4.js +4 -0
- package/dist/8813.4b28f4bb.js +1 -0
- package/dist/_private/react/render.js +1 -1
- package/dist/cli/config/loadConfigFile.js +2 -2
- package/dist/cli/index.44f3184c.js +2 -0
- package/dist/cli/index.js +3 -3
- package/dist/eject-theme/components/CodeBlock/index.tsx +1 -1
- package/dist/eject-theme/components/FallbackHeading/index.tsx +4 -0
- package/dist/eject-theme/components/HomeBackground/useNavTransparent.tsx +2 -1
- package/dist/eject-theme/components/HomeHero/index.scss +8 -0
- package/dist/eject-theme/components/HomeHero/index.tsx +11 -2
- package/dist/eject-theme/components/HoverGroup/index.scss +3 -2
- package/dist/eject-theme/components/HoverGroup/index.tsx +104 -22
- package/dist/eject-theme/components/Nav/NavMenu.scss +1 -1
- package/dist/eject-theme/components/Nav/NavMenu.tsx +50 -28
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +26 -11
- package/dist/eject-theme/components/Overview/index.tsx +11 -0
- package/dist/eject-theme/components/OverviewGroup/index.tsx +46 -0
- package/dist/eject-theme/components/Steps/index.scss +1 -0
- package/dist/index.js +6 -11
- package/dist/node/PluginDriver.js +3 -3
- package/dist/node/auto-nav-sidebar/index.js +3 -3
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +2 -2
- package/dist/node/auto-nav-sidebar/utils.js +2 -2
- package/dist/node/auto-nav-sidebar/walk.js +13 -9
- package/dist/node/constants.js +2 -2
- package/dist/node/eject.js +2 -5
- package/dist/node/initRsbuild.js +14 -9
- package/dist/node/last-updated/index.js +1 -1
- package/dist/node/logger/hint.js +1 -1
- package/dist/node/mdx/loader.7c249a26.js +12 -0
- package/dist/node/mdx/options.js +3 -3
- package/dist/node/mdx/processor.js +2 -2
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +4 -4
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -5
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +3 -3
- package/dist/node/mdx/remarkPlugins/image.js +2 -3
- package/dist/node/mdx/remarkPlugins/link.js +3 -3
- package/dist/node/mdx/remarkPlugins/toc.js +3 -3
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +3 -3
- package/dist/node/route/extractPageData.js +4 -5
- package/dist/node/route/normalizeRoutePath.js +2 -2
- package/dist/node/runtimeModule/i18n.js +2 -2
- package/dist/node/runtimeModule/pageData/createPageData.js +2 -2
- 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/renderPage.js +2 -2
- package/dist/node/ssg/renderPageWorker.165b5d46.js +1 -0
- package/dist/node/ssg/renderPageWorker.js +2 -2
- package/dist/node/ssg/renderPages.js +3 -3
- package/dist/node/ssg/rsbuildPluginSSG.js +2 -2
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +9 -7
- package/dist/node/ssg-md/llms/llmsTxt.js +2 -2
- package/dist/node/ssg-md/remarkSplitMdx.js +2 -2
- package/dist/node/ssg-md/renderPage.js +2 -2
- package/dist/node/ssg-md/renderPages.js +2 -2
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +2 -2
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/error.js +1 -1
- package/dist/node/utils/flattenMdxContent.js +4 -5
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +3 -3
- package/dist/node/utils/reactAlias.js +2 -2
- package/dist/runtime/App.js +4 -2
- package/dist/runtime/Content.d.ts +4 -0
- package/dist/runtime/Content.js +18 -0
- package/dist/runtime/NoSSR.d.ts +3 -0
- package/dist/runtime/NoSSR.js +14 -0
- package/dist/runtime/getSidebarDataGroup.test.js +68 -0
- package/dist/runtime/hooks/useActiveMatcher.d.ts +1 -0
- package/dist/runtime/hooks/useActiveMatcher.js +14 -0
- package/dist/runtime/hooks/useDark.d.ts +7 -0
- package/dist/runtime/hooks/useDark.js +7 -0
- package/dist/runtime/hooks/useFrontmatter.d.ts +4 -0
- package/dist/runtime/hooks/useFrontmatter.js +9 -0
- package/dist/runtime/hooks/useI18n.d.ts +2 -0
- package/dist/runtime/hooks/useI18n.js +14 -0
- package/dist/runtime/hooks/useLang.d.ts +1 -0
- package/dist/runtime/hooks/useLang.js +6 -0
- package/dist/runtime/hooks/useLocaleSiteData.d.ts +18 -0
- package/dist/runtime/hooks/useLocaleSiteData.js +20 -0
- package/dist/runtime/hooks/useNav.d.ts +1 -0
- package/dist/runtime/hooks/useNav.js +12 -0
- package/dist/runtime/hooks/usePage.d.ts +10 -0
- package/dist/runtime/hooks/usePage.js +9 -0
- package/dist/runtime/hooks/usePageData.d.ts +5 -0
- package/dist/runtime/hooks/usePageData.js +16 -0
- package/dist/runtime/hooks/usePages.d.ts +4 -0
- package/dist/runtime/hooks/usePages.js +7 -0
- package/dist/runtime/hooks/useSidebar.d.ts +16 -0
- package/dist/runtime/hooks/useSidebar.js +67 -0
- package/dist/runtime/hooks/useSite.d.ts +4 -0
- package/dist/runtime/hooks/useSite.js +7 -0
- package/dist/runtime/hooks/useVersion.d.ts +1 -0
- package/dist/runtime/hooks/useVersion.js +6 -0
- package/dist/runtime/hooks/useWindowSize.d.ts +9 -0
- package/dist/runtime/hooks/useWindowSize.js +31 -0
- package/dist/runtime/hooks/useWindowSize.test.js +36 -0
- package/dist/runtime/index.d.ts +21 -0
- package/dist/runtime/index.js +22 -0
- package/dist/runtime/route.d.ts +36 -0
- package/dist/runtime/route.js +53 -0
- package/dist/runtime/route.test.js +154 -0
- package/dist/runtime/ssrMdServerEntry.js +1 -1
- package/dist/runtime/utils.d.ts +12 -0
- package/dist/runtime/utils.js +34 -0
- package/dist/runtime/utils.test.js +34 -0
- package/dist/shiki-transformers.js +2 -2
- package/dist/theme/components/CodeBlock/index.js +1 -1
- package/dist/theme/components/FallbackHeading/index.js +4 -1
- package/dist/theme/components/HomeBackground/useNavTransparent.js +1 -1
- package/dist/theme/components/HomeHero/index.css +6 -0
- package/dist/theme/components/HomeHero/index.js +10 -3
- package/dist/theme/components/HoverGroup/index.css +3 -2
- package/dist/theme/components/HoverGroup/index.js +88 -17
- package/dist/theme/components/Nav/NavMenu.css +1 -1
- package/dist/theme/components/Nav/NavMenu.d.ts +6 -1
- package/dist/theme/components/Nav/NavMenu.js +47 -45
- package/dist/theme/components/NavScreen/NavScreenMenuItem.d.ts +1 -1
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +21 -11
- package/dist/theme/components/Overview/index.js +12 -1
- package/dist/theme/components/OverviewGroup/index.js +33 -0
- package/dist/theme/components/Steps/index.css +1 -0
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/layout/DocLayout/index.js +10 -0
- package/dist/theme/layout/HomeLayout/index.js +40 -0
- package/dist/theme/layout/Layout/index.js +10 -6
- package/dist/theme/logic/useScrollAfterNav.js +2 -2
- package/dist/theme/logic/useScrollReset.js +2 -2
- package/dist/theme/logic/useStorageValue.js +6 -3
- package/dist/theme/logic/{useAppearance.d.ts → useThemeState.d.ts} +4 -1
- package/dist/theme/logic/useThemeState.js +50 -0
- package/dist/theme/styles/scrollbar.css +14 -2
- package/dist/theme/styles/vars/base-vars.css +2 -2
- package/dist/theme/styles/vars/code-vars.css +2 -2
- package/nav-json-schema.json +2 -2
- package/package.json +10 -11
- package/static/MediumZoom.tsx +1 -1
- package/dist/4669.12208c6a.js +0 -2
- package/dist/6289.c67fe0d5.js +0 -5
- package/dist/8813.9da1f210.js +0 -2
- package/dist/9643.f109822d.js +0 -5
- package/dist/cli/index.cb89dbd1.js +0 -3
- package/dist/node/mdx/loader.e1578c62.js +0 -13
- package/dist/node/ssg/renderPageWorker.474f9f73.js +0 -2
- package/dist/runtime.72d450ac.js +0 -1
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.js +0 -4
- package/dist/theme/logic/useAppearance.js +0 -64
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isDataUrl, isExternalUrl, matchNavbar, matchSidebar, normalizeHref } from "@rspress/shared";
|
|
2
|
+
import { Head } from "@unhead/react";
|
|
3
|
+
import { Content } from "./Content.js";
|
|
4
|
+
import { useActiveMatcher } from "./hooks/useActiveMatcher.js";
|
|
5
|
+
import { ThemeContext, useDark } from "./hooks/useDark.js";
|
|
6
|
+
import { useFrontmatter } from "./hooks/useFrontmatter.js";
|
|
7
|
+
import { useI18n } from "./hooks/useI18n.js";
|
|
8
|
+
import { useLang } from "./hooks/useLang.js";
|
|
9
|
+
import { useLocaleSiteData } from "./hooks/useLocaleSiteData.js";
|
|
10
|
+
import { useNav } from "./hooks/useNav.js";
|
|
11
|
+
import { PageContext, usePage } from "./hooks/usePage.js";
|
|
12
|
+
import { usePageData } from "./hooks/usePageData.js";
|
|
13
|
+
import { usePages } from "./hooks/usePages.js";
|
|
14
|
+
import { getSidebarDataGroup, useSidebar, useSidebarDynamic } from "./hooks/useSidebar.js";
|
|
15
|
+
import { useSite } from "./hooks/useSite.js";
|
|
16
|
+
import { useVersion } from "./hooks/useVersion.js";
|
|
17
|
+
import { useWindowSize } from "./hooks/useWindowSize.js";
|
|
18
|
+
import { NoSSR } from "./NoSSR.js";
|
|
19
|
+
import { isActive, pathnameToRouteService, preloadLink } from "./route.js";
|
|
20
|
+
import { addLeadingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, removeBase, removeTrailingSlash, routePathToMdPath, withBase } from "./utils.js";
|
|
21
|
+
export * from "react-router-dom";
|
|
22
|
+
export { Content, Head, NoSSR, PageContext, ThemeContext, addLeadingSlash, cleanUrlByConfig, getSidebarDataGroup, isActive, isDataUrl, isEqualPath, isExternalUrl, isProduction, matchNavbar, matchSidebar, normalizeHref, normalizeHrefInRuntime, normalizeImagePath, pathnameToRouteService, preloadLink, removeBase, removeTrailingSlash, routePathToMdPath, useActiveMatcher, useDark, useFrontmatter, useI18n, useLang, useLocaleSiteData, useNav, usePage, usePageData, usePages, useSidebar, useSidebarDynamic, useSite, useVersion, useWindowSize, withBase };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Route } from '@rspress/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Simple implementation of matchPath to check if a pattern matches a pathname
|
|
4
|
+
* Better performance alternative of `import { matchPath } from 'react-router-dom'`
|
|
5
|
+
* @param pattern - The route pattern to match against
|
|
6
|
+
* @param pathname - The pathname to check
|
|
7
|
+
* @returns Match object if matched, null otherwise
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* matchPath('/api/config', '/api/config') // { path: '/api/config' }
|
|
11
|
+
* matchPath('/api/config/', '/api/config') // { path: '/api/config/' }
|
|
12
|
+
* matchPath('/api/config', '/api/other') // null
|
|
13
|
+
*/
|
|
14
|
+
export declare function matchPath(pattern: string, pathname: string): {
|
|
15
|
+
path: string;
|
|
16
|
+
} | null;
|
|
17
|
+
/**
|
|
18
|
+
* this is a bridge of two core features Sidebar and RouteService
|
|
19
|
+
* @param pathname useLocation().pathname
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function pathnameToRouteService(pathname: string): Route | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* link: /api/config
|
|
25
|
+
* currentPathname:
|
|
26
|
+
* 0. /api/config
|
|
27
|
+
* 1. /api/config.html
|
|
28
|
+
* 2. /api/config/
|
|
29
|
+
* 3. /api/config/index
|
|
30
|
+
* 4. /api/config/index.html
|
|
31
|
+
* @param itemLink
|
|
32
|
+
* @param currentPathname
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export declare function isActive(itemLink: string, currentPathname: string): boolean;
|
|
36
|
+
export declare const preloadLink: (link: string) => void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cleanUrl } from "@rspress/shared";
|
|
2
|
+
import { routes } from "virtual-routes";
|
|
3
|
+
function normalizeRoutePath(routePath) {
|
|
4
|
+
return cleanUrl(decodeURIComponent(routePath)).replace(/\.html$/, '').replace(/\/index$/, '/').toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
function matchPath(pattern, pathname) {
|
|
7
|
+
const normalizedPattern = normalizeRoutePath(pattern);
|
|
8
|
+
const normalizedPathname = normalizeRoutePath(pathname);
|
|
9
|
+
const normalizedPatternWithSlash = normalizedPattern.endsWith('/') ? normalizedPattern : `${normalizedPattern}/`;
|
|
10
|
+
const normalizedPathnameWithSlash = normalizedPathname.endsWith('/') ? normalizedPathname : `${normalizedPathname}/`;
|
|
11
|
+
if (normalizedPatternWithSlash === normalizedPathnameWithSlash) return {
|
|
12
|
+
path: pattern
|
|
13
|
+
};
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const sortedRoutes = [
|
|
17
|
+
...routes
|
|
18
|
+
].sort((a, b)=>{
|
|
19
|
+
const pathA = a.path || '';
|
|
20
|
+
const pathB = b.path || '';
|
|
21
|
+
return pathB.length - pathA.length;
|
|
22
|
+
});
|
|
23
|
+
function matchRoutes(_routes, pathname) {
|
|
24
|
+
for (const route of sortedRoutes){
|
|
25
|
+
const routePath = route.path || '';
|
|
26
|
+
const match = matchPath(routePath, pathname);
|
|
27
|
+
if (match) return [
|
|
28
|
+
{
|
|
29
|
+
route
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const cache = new Map();
|
|
36
|
+
function pathnameToRouteService(pathname) {
|
|
37
|
+
const normalizedPathname = normalizeRoutePath(pathname);
|
|
38
|
+
const cacheItem = cache.get(normalizedPathname);
|
|
39
|
+
if (cacheItem) return cacheItem;
|
|
40
|
+
const matched = matchRoutes(routes, normalizedPathname);
|
|
41
|
+
const route = matched?.[0]?.route;
|
|
42
|
+
if (route) cache.set(normalizedPathname, route);
|
|
43
|
+
return route;
|
|
44
|
+
}
|
|
45
|
+
function isActive(itemLink, currentPathname) {
|
|
46
|
+
const linkMatched = matchPath(itemLink, currentPathname);
|
|
47
|
+
return null !== linkMatched;
|
|
48
|
+
}
|
|
49
|
+
const preloadLink = (link)=>{
|
|
50
|
+
const route = pathnameToRouteService(link);
|
|
51
|
+
if (route) route.preload();
|
|
52
|
+
};
|
|
53
|
+
export { isActive, matchPath, pathnameToRouteService, preloadLink };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { describe, expect, it, rs } from "@rstest/core";
|
|
2
|
+
import { isActive, matchPath, pathnameToRouteService } from "./route.js";
|
|
3
|
+
rs.mock('virtual-routes', ()=>{
|
|
4
|
+
const element = rs.fn();
|
|
5
|
+
const routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '/api/config',
|
|
8
|
+
element,
|
|
9
|
+
filePath: 'api/config.mdx',
|
|
10
|
+
preload: async ()=>{},
|
|
11
|
+
lang: '',
|
|
12
|
+
version: ''
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
path: '/api/config/',
|
|
16
|
+
element,
|
|
17
|
+
filePath: 'api/config/index.mdx',
|
|
18
|
+
preload: async ()=>{},
|
|
19
|
+
lang: '',
|
|
20
|
+
version: ''
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: '/',
|
|
24
|
+
element,
|
|
25
|
+
filePath: 'index.mdx',
|
|
26
|
+
preload: async ()=>{},
|
|
27
|
+
lang: '',
|
|
28
|
+
version: ''
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
return {
|
|
32
|
+
routes
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
describe('matchPath', ()=>{
|
|
36
|
+
it('should match exact paths', ()=>{
|
|
37
|
+
expect(matchPath('/api/config', '/api/config')).toEqual({
|
|
38
|
+
path: '/api/config'
|
|
39
|
+
});
|
|
40
|
+
expect(matchPath('/api/config/', '/api/config/')).toEqual({
|
|
41
|
+
path: '/api/config/'
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it('should normalize trailing slashes', ()=>{
|
|
45
|
+
expect(matchPath('/api/config', '/api/config/')).toEqual({
|
|
46
|
+
path: '/api/config'
|
|
47
|
+
});
|
|
48
|
+
expect(matchPath('/api/config/', '/api/config')).toEqual({
|
|
49
|
+
path: '/api/config/'
|
|
50
|
+
});
|
|
51
|
+
expect(matchPath('/api/config/', '/api/config/index.html')).toEqual({
|
|
52
|
+
path: '/api/config/'
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
it('should return null for non-matching paths', ()=>{
|
|
56
|
+
expect(matchPath('/api/config', '/api/other')).toBeNull();
|
|
57
|
+
expect(matchPath('/api', '/api/config')).toBeNull();
|
|
58
|
+
expect(matchPath('/api', '/api/index.md')).toBeNull();
|
|
59
|
+
});
|
|
60
|
+
it('should handle case-insensitive matching', ()=>{
|
|
61
|
+
expect(matchPath('/api/config', '/API/CONFIG')).toEqual({
|
|
62
|
+
path: '/api/config'
|
|
63
|
+
});
|
|
64
|
+
expect(matchPath('/api/config', '/Api/Config')).toEqual({
|
|
65
|
+
path: '/api/config'
|
|
66
|
+
});
|
|
67
|
+
expect(matchPath('/api/config', '/api/CONFIG.html')).toEqual({
|
|
68
|
+
path: '/api/config'
|
|
69
|
+
});
|
|
70
|
+
expect(matchPath('/api/config/', '/API/CONFIG/')).toEqual({
|
|
71
|
+
path: '/api/config/'
|
|
72
|
+
});
|
|
73
|
+
expect(matchPath('/api/config/', '/API/CONFIG/index.html')).toEqual({
|
|
74
|
+
path: '/api/config/'
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('isActive', ()=>{
|
|
79
|
+
it('should return true for matching normalized paths', ()=>{
|
|
80
|
+
expect(isActive('/api/config', '/api/config')).toBe(true);
|
|
81
|
+
expect(isActive('/api/config', '/api/config.html')).toBe(true);
|
|
82
|
+
expect(isActive('/api/config', '/api/config/')).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
it('should return false for non-matching paths', ()=>{
|
|
85
|
+
expect(isActive('/api/config', '/api/other')).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
it('should handle hash and search parameters correctly', ()=>{
|
|
88
|
+
expect(isActive('/api/config', '/api/config#hash')).toBe(true);
|
|
89
|
+
expect(isActive('/api/config', '/api/config?query=value')).toBe(true);
|
|
90
|
+
expect(isActive('/api/config', '/api/config.html#hash')).toBe(true);
|
|
91
|
+
expect(isActive('/api/config', '/api/config.html?query=value')).toBe(true);
|
|
92
|
+
expect(isActive('/api/config', '/api/config.html?query=value#hash')).toBe(true);
|
|
93
|
+
expect(isActive('/api/config#different', '/api/config#hash')).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it('should handle case-insensitive matching', ()=>{
|
|
96
|
+
expect(isActive('/api/config', '/API/CONFIG')).toBe(true);
|
|
97
|
+
expect(isActive('/api/config', '/Api/Config')).toBe(true);
|
|
98
|
+
expect(isActive('/api/config', '/api/CONFIG.html')).toBe(true);
|
|
99
|
+
expect(isActive('/api/config', '/API/CONFIG/')).toBe(true);
|
|
100
|
+
expect(isActive('/api/config', '/API/CONFIG/index.html')).toBe(true);
|
|
101
|
+
expect(isActive('/api/config', '/api/CONFIG#hash')).toBe(true);
|
|
102
|
+
expect(isActive('/api/config', '/API/config?query=value')).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('pathnameToRouteService', ()=>{
|
|
106
|
+
it('0. /api/config', ()=>{
|
|
107
|
+
const pathname = '/api/config';
|
|
108
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
109
|
+
});
|
|
110
|
+
it('1. /api/config.html', ()=>{
|
|
111
|
+
const pathname = '/api/config.html';
|
|
112
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
113
|
+
});
|
|
114
|
+
it('2. /api/config/', ()=>{
|
|
115
|
+
const pathname = '/api/config/';
|
|
116
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
117
|
+
});
|
|
118
|
+
it('3. /api/config/index', ()=>{
|
|
119
|
+
const pathname = '/api/config/index';
|
|
120
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
121
|
+
});
|
|
122
|
+
it('4. /api/config/index.html', ()=>{
|
|
123
|
+
const pathname = '/api/config/index.html';
|
|
124
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
125
|
+
});
|
|
126
|
+
it('5. /', ()=>{
|
|
127
|
+
expect(pathnameToRouteService('/index.html')?.path).toMatchInlineSnapshot('"/"');
|
|
128
|
+
expect(pathnameToRouteService('/index.md')?.path).toMatchInlineSnapshot("undefined");
|
|
129
|
+
});
|
|
130
|
+
it('6. /api/config.html#hash - should handle hash correctly', ()=>{
|
|
131
|
+
const pathname = '/api/config.html#hash';
|
|
132
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
133
|
+
});
|
|
134
|
+
it('7. /api/config.html?query=value - should handle query params correctly', ()=>{
|
|
135
|
+
const pathname = '/api/config.html?query=value';
|
|
136
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
137
|
+
});
|
|
138
|
+
it('8. /api/config.html?query=value#hash - should handle both query and hash', ()=>{
|
|
139
|
+
const pathname = '/api/config.html?query=value#hash';
|
|
140
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
141
|
+
});
|
|
142
|
+
it('9. /api/config#hash - should handle hash without .html', ()=>{
|
|
143
|
+
const pathname = '/api/config#hash';
|
|
144
|
+
expect(pathnameToRouteService(pathname)?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
145
|
+
});
|
|
146
|
+
it('10. Case-insensitive route matching', ()=>{
|
|
147
|
+
expect(pathnameToRouteService('/API/CONFIG')?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
148
|
+
expect(pathnameToRouteService('/Api/Config')?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
149
|
+
expect(pathnameToRouteService('/API/CONFIG.html')?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
150
|
+
expect(pathnameToRouteService('/API/CONFIG/')?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
151
|
+
expect(pathnameToRouteService('/API/CONFIG/index.html')?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
152
|
+
expect(pathnameToRouteService('/api/CONFIG#hash')?.path).toMatchInlineSnapshot('"/api/config/"');
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { renderToMarkdownString } from "@rspress/core/_private/react";
|
|
3
|
-
import { PageContext, ThemeContext, pathnameToRouteService, removeTrailingSlash, withBase } from "@rspress/runtime";
|
|
3
|
+
import { PageContext, ThemeContext, pathnameToRouteService, removeTrailingSlash, withBase } from "@rspress/core/runtime";
|
|
4
4
|
import { UnheadProvider } from "@unhead/react/server";
|
|
5
5
|
import { StaticRouter } from "react-router-dom";
|
|
6
6
|
import { App } from "./App.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { addLeadingSlash, isProduction, removeTrailingSlash } from '@rspress/shared';
|
|
2
|
+
declare function withBase(url?: string): string;
|
|
3
|
+
declare function removeBase(url: string): string;
|
|
4
|
+
declare function isEqualPath(a: string, b: string): boolean;
|
|
5
|
+
declare function normalizeHrefInRuntime(link: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* we do cleanUrls in runtime side
|
|
8
|
+
*/
|
|
9
|
+
declare function cleanUrlByConfig(link: string): string;
|
|
10
|
+
declare function normalizeImagePath(imagePath: string): string;
|
|
11
|
+
declare function routePathToMdPath(routePath: string): string;
|
|
12
|
+
export { addLeadingSlash, removeTrailingSlash, isProduction, normalizeImagePath, cleanUrlByConfig, removeBase, withBase, isEqualPath, normalizeHrefInRuntime, routePathToMdPath, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { addLeadingSlash, isDataUrl, isExternalUrl, isProduction, normalizeHref, removeBase, removeHash, removeTrailingSlash, withBase } from "@rspress/shared";
|
|
2
|
+
import virtual_site_data from "virtual-site-data";
|
|
3
|
+
function utils_withBase(url = '/') {
|
|
4
|
+
return withBase(url, virtual_site_data.base);
|
|
5
|
+
}
|
|
6
|
+
function utils_removeBase(url) {
|
|
7
|
+
return removeBase(url, virtual_site_data.base);
|
|
8
|
+
}
|
|
9
|
+
function isEqualPath(a, b) {
|
|
10
|
+
return utils_removeBase(normalizeHref(removeHash(a), true)) === utils_removeBase(normalizeHref(removeHash(b), true));
|
|
11
|
+
}
|
|
12
|
+
function normalizeHrefInRuntime(link) {
|
|
13
|
+
const cleanUrls = Boolean(virtual_site_data?.route?.cleanUrls);
|
|
14
|
+
return normalizeHref(link, cleanUrls);
|
|
15
|
+
}
|
|
16
|
+
function cleanUrlByConfig(link) {
|
|
17
|
+
if (virtual_site_data?.route?.cleanUrls) return normalizeHref(link, true);
|
|
18
|
+
return link;
|
|
19
|
+
}
|
|
20
|
+
function normalizeImagePath(imagePath) {
|
|
21
|
+
if (isAbsoluteUrl(imagePath)) return imagePath;
|
|
22
|
+
if (!imagePath.startsWith('/')) return imagePath;
|
|
23
|
+
return utils_withBase(imagePath);
|
|
24
|
+
}
|
|
25
|
+
function routePathToMdPath(routePath) {
|
|
26
|
+
let url = routePath;
|
|
27
|
+
url = normalizeHref(url, false);
|
|
28
|
+
url = url.replace(/\.html(?=#|\?|$)/, '.md');
|
|
29
|
+
return utils_withBase(url);
|
|
30
|
+
}
|
|
31
|
+
function isAbsoluteUrl(path) {
|
|
32
|
+
return isExternalUrl(path) || isDataUrl(path) || path.startsWith('//');
|
|
33
|
+
}
|
|
34
|
+
export { addLeadingSlash, cleanUrlByConfig, isEqualPath, isProduction, normalizeHrefInRuntime, normalizeImagePath, utils_removeBase as removeBase, removeTrailingSlash, routePathToMdPath, utils_withBase as withBase };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it, rs } from "@rstest/core";
|
|
2
|
+
import { routePathToMdPath } from "./utils.js";
|
|
3
|
+
rs.mock('virtual-site-data', ()=>({
|
|
4
|
+
default: {
|
|
5
|
+
base: '/'
|
|
6
|
+
}
|
|
7
|
+
}));
|
|
8
|
+
describe('routePathToMdPath', ()=>{
|
|
9
|
+
it('should match snapshot for various paths', ()=>{
|
|
10
|
+
const cases = [
|
|
11
|
+
'/foo/bar.html',
|
|
12
|
+
'/foo/bar.html#hash',
|
|
13
|
+
'/foo/bar.html?q=1',
|
|
14
|
+
'/foo/bar.html?q=1#hash',
|
|
15
|
+
'/foo.html',
|
|
16
|
+
'/simple.html#my-heading',
|
|
17
|
+
'/query.html?foo=bar&baz=qux',
|
|
18
|
+
'/complex.html?id=123#section-2'
|
|
19
|
+
];
|
|
20
|
+
const results = cases.map((path)=>routePathToMdPath(path));
|
|
21
|
+
expect(results).toMatchInlineSnapshot(`
|
|
22
|
+
[
|
|
23
|
+
"/foo/bar.md",
|
|
24
|
+
"/foo/bar.md#hash",
|
|
25
|
+
"/foo/bar.md?q=1",
|
|
26
|
+
"/foo/bar.md?q=1#hash",
|
|
27
|
+
"/foo.md",
|
|
28
|
+
"/simple.md#my-heading",
|
|
29
|
+
"/query.md?foo=bar&baz=qux",
|
|
30
|
+
"/complex.md?id=123#section-2",
|
|
31
|
+
]
|
|
32
|
+
`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./node/mdx/rehypePlugins/transformers/index.js";
|
|
2
|
+
export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./node/mdx/rehypePlugins/transformers/add-lang.js";
|
|
2
3
|
export { SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, transformerAddLineNumbers } from "./node/mdx/rehypePlugins/transformers/add-line-numbers.js";
|
|
3
|
-
export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./node/mdx/rehypePlugins/transformers/meta-highlight.js";
|
|
4
4
|
export { SHIKI_TRANSFORMER_ADD_TITLE, transformerAddTitle } from "./node/mdx/rehypePlugins/transformers/add-title.js";
|
|
5
|
-
export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./node/mdx/rehypePlugins/transformers/add-lang.js";
|
|
6
5
|
export { SHIKI_TRANSFORMER_ADD_WRAP_CODE, transformerAddWrapCode } from "./node/mdx/rehypePlugins/transformers/add-wrap-code.js";
|
|
6
|
+
export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./node/mdx/rehypePlugins/transformers/meta-highlight.js";
|
|
@@ -18,7 +18,7 @@ function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: w
|
|
|
18
18
|
className: clsx('rp-codeblock__content', codeWrap && 'rp-codeblock__content--code-wrap', lineNumbersProp && 'rp-codeblock__content--line-numbers'),
|
|
19
19
|
children: [
|
|
20
20
|
/*#__PURE__*/ jsx("div", {
|
|
21
|
-
className: "rp-codeblock__content__scroll-container rp-scrollbar",
|
|
21
|
+
className: "rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always",
|
|
22
22
|
ref: copyElementRef,
|
|
23
23
|
children: children
|
|
24
24
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getCustomMDXComponent, renderInlineMarkdown } from "@theme";
|
|
3
3
|
import { slug } from "github-slugger";
|
|
4
4
|
import { useMemo } from "react";
|
|
@@ -14,6 +14,9 @@ const getHeadingMap = ()=>{
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
function FallbackHeading({ level, title }) {
|
|
17
|
+
if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
|
|
18
|
+
children: `${'#'.repeat(level)} ${title}\n\n`
|
|
19
|
+
});
|
|
17
20
|
const titleSlug = title && slug(title.trim());
|
|
18
21
|
const Element = useMemo(()=>{
|
|
19
22
|
const headingMap = getHeadingMap();
|
|
@@ -29,7 +29,7 @@ const useNavTransparent = ()=>{
|
|
|
29
29
|
topArrived
|
|
30
30
|
]);
|
|
31
31
|
return /*#__PURE__*/ jsx("style", {
|
|
32
|
-
children: "body:not(.notTopArrived) .rp-nav {background: transparent !important; border-bottom:
|
|
32
|
+
children: "body:not(.notTopArrived) .rp-nav {background: transparent !important; border-bottom: 1px solid transparent !important;}.rp-nav {background: color-mix(in srgb,var(--rp-c-bg) 60%,transparent);backdrop-filter: blur(25px);}"
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
export { useNavTransparent };
|
|
@@ -74,6 +74,8 @@
|
|
|
74
74
|
padding: .5rem 1rem;
|
|
75
75
|
font-size: .875rem;
|
|
76
76
|
font-weight: 500;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
transition: background .2s, border-color .2s;
|
|
77
79
|
display: inline-flex;
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -92,6 +94,10 @@
|
|
|
92
94
|
cursor: pointer;
|
|
93
95
|
}
|
|
94
96
|
|
|
97
|
+
.rp-home-hero__badge:is(a):hover {
|
|
98
|
+
border-color: var(--rp-c-brand);
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
.rp-home-hero__title {
|
|
96
102
|
font-size: 4rem;
|
|
97
103
|
font-weight: 600;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { normalizeImagePath, useFrontmatter } from "@rspress/core/runtime";
|
|
3
|
-
import { Button, renderHtmlOrText } from "@theme";
|
|
3
|
+
import { Button, Link, renderHtmlOrText } from "@theme";
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
const DEFAULT_HERO = {
|
|
@@ -31,10 +31,17 @@ function HomeHero({ beforeHeroActions, afterHeroActions }) {
|
|
|
31
31
|
/*#__PURE__*/ jsxs("div", {
|
|
32
32
|
className: "rp-home-hero__container",
|
|
33
33
|
children: [
|
|
34
|
-
hero.badge && /*#__PURE__*/ jsx("div", {
|
|
34
|
+
hero.badge && ('string' == typeof hero.badge ? /*#__PURE__*/ jsx("div", {
|
|
35
35
|
className: "rp-home-hero__badge",
|
|
36
36
|
children: hero.badge
|
|
37
|
-
}),
|
|
37
|
+
}) : hero.badge.link ? /*#__PURE__*/ jsx(Link, {
|
|
38
|
+
href: hero.badge.link,
|
|
39
|
+
className: "rp-home-hero__badge",
|
|
40
|
+
children: hero.badge.text
|
|
41
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
42
|
+
className: "rp-home-hero__badge",
|
|
43
|
+
children: hero.badge.text
|
|
44
|
+
})),
|
|
38
45
|
/*#__PURE__*/ jsxs("div", {
|
|
39
46
|
className: "rp-home-hero__content",
|
|
40
47
|
children: [
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
border-radius: 8px;
|
|
44
44
|
flex: 1;
|
|
45
45
|
align-self: stretch;
|
|
46
|
-
padding-left: 8px;
|
|
47
46
|
padding-right: 8px;
|
|
48
47
|
font-size: 14px;
|
|
49
48
|
font-style: normal;
|
|
@@ -54,8 +53,10 @@
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
.rp-hover-group__item__link {
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: 2px;
|
|
57
58
|
height: 100%;
|
|
58
|
-
display:
|
|
59
|
+
display: flex;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
.rp-hover-group__item--active {
|
|
@@ -1,7 +1,89 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { matchNavbar, useLocation } from "@rspress/core/runtime";
|
|
3
|
+
import { Link, Tag } from "@theme";
|
|
3
4
|
import clsx from "clsx";
|
|
4
5
|
import "./index.css";
|
|
6
|
+
function HoverGroupItem({ item, activeMatcher, depth = 0 }) {
|
|
7
|
+
const { pathname } = useLocation();
|
|
8
|
+
if ('items' in item && item.items && item.items.length > 0) {
|
|
9
|
+
const hasLink = 'link' in item && item.link;
|
|
10
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
11
|
+
children: [
|
|
12
|
+
hasLink && /*#__PURE__*/ jsx("li", {
|
|
13
|
+
className: "rp-hover-group__item",
|
|
14
|
+
style: {
|
|
15
|
+
paddingLeft: `${8 + 12 * depth}px`
|
|
16
|
+
},
|
|
17
|
+
"data-depth": depth,
|
|
18
|
+
children: /*#__PURE__*/ jsxs(Link, {
|
|
19
|
+
href: item.link,
|
|
20
|
+
"aria-label": item.text,
|
|
21
|
+
className: "rp-hover-group__item__link",
|
|
22
|
+
children: [
|
|
23
|
+
item.text,
|
|
24
|
+
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
25
|
+
tag: item.tag
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
}, item.text),
|
|
30
|
+
item.items.map((subItem)=>/*#__PURE__*/ jsx(HoverGroupItem, {
|
|
31
|
+
item: subItem,
|
|
32
|
+
activeMatcher: activeMatcher,
|
|
33
|
+
depth: depth + 1
|
|
34
|
+
}, subItem.text))
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if ('link' in item) {
|
|
39
|
+
const { text, link } = item;
|
|
40
|
+
const isActiveItem = activeMatcher ? activeMatcher(item) : matchNavbar(item, pathname);
|
|
41
|
+
return /*#__PURE__*/ jsx("li", {
|
|
42
|
+
className: clsx('rp-hover-group__item', {
|
|
43
|
+
'rp-hover-group__item--active': isActiveItem
|
|
44
|
+
}),
|
|
45
|
+
style: {
|
|
46
|
+
paddingLeft: `${8 + 12 * depth}px`
|
|
47
|
+
},
|
|
48
|
+
"data-depth": depth,
|
|
49
|
+
children: link ? /*#__PURE__*/ jsxs(Link, {
|
|
50
|
+
href: link,
|
|
51
|
+
"aria-label": text,
|
|
52
|
+
className: "rp-hover-group__item__link",
|
|
53
|
+
children: [
|
|
54
|
+
text,
|
|
55
|
+
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
56
|
+
tag: item.tag
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
60
|
+
className: "rp-hover-group__item__link",
|
|
61
|
+
children: [
|
|
62
|
+
text,
|
|
63
|
+
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
64
|
+
tag: item.tag
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
}, text + link);
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/ jsx("li", {
|
|
71
|
+
className: "rp-hover-group__item",
|
|
72
|
+
style: {
|
|
73
|
+
paddingLeft: `${8 + 12 * depth}px`
|
|
74
|
+
},
|
|
75
|
+
"data-depth": depth,
|
|
76
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
77
|
+
className: "rp-hover-group__item__link",
|
|
78
|
+
children: [
|
|
79
|
+
item.text,
|
|
80
|
+
'tag' in item && item.tag && /*#__PURE__*/ jsx(Tag, {
|
|
81
|
+
tag: item.tag
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
}, item.text);
|
|
86
|
+
}
|
|
5
87
|
function HoverGroup({ items, customChildren, isOpen, position = 'center', activeMatcher }) {
|
|
6
88
|
return /*#__PURE__*/ jsx("ul", {
|
|
7
89
|
className: clsx('rp-hover-group', {
|
|
@@ -10,21 +92,10 @@ function HoverGroup({ items, customChildren, isOpen, position = 'center', active
|
|
|
10
92
|
'rp-hover-group--center': 'center' === position,
|
|
11
93
|
'rp-hover-group--right': 'right' === position
|
|
12
94
|
}),
|
|
13
|
-
children: customChildren ?? items?.map((item)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
className: clsx('rp-hover-group__item', {
|
|
18
|
-
'rp-hover-group__item--active': isActiveItem
|
|
19
|
-
}),
|
|
20
|
-
children: /*#__PURE__*/ jsx(Link, {
|
|
21
|
-
href: link,
|
|
22
|
-
"aria-label": text,
|
|
23
|
-
className: "rp-hover-group__item__link",
|
|
24
|
-
children: text
|
|
25
|
-
})
|
|
26
|
-
}, text + link);
|
|
27
|
-
})
|
|
95
|
+
children: customChildren ?? items?.map((item)=>/*#__PURE__*/ jsx(HoverGroupItem, {
|
|
96
|
+
item: item,
|
|
97
|
+
activeMatcher: activeMatcher
|
|
98
|
+
}, item.text))
|
|
28
99
|
});
|
|
29
100
|
}
|
|
30
101
|
export { HoverGroup };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren } from '@rspress/core';
|
|
2
2
|
import type { HoverGroupProps } from '@theme';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
3
4
|
import './NavMenu.scss';
|
|
4
5
|
export declare const SvgDown: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function NavMenuItemInner({ menuItem, children, }: {
|
|
7
|
+
menuItem: Partial<NavItemWithLink>;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
10
|
export declare function NavMenuItemWithChildren({ menuItem, activeMatcher, }: {
|
|
6
11
|
menuItem: NavItemWithChildren | NavItemWithLinkAndChildren;
|
|
7
12
|
activeMatcher?: HoverGroupProps['activeMatcher'];
|
|
@@ -9,7 +14,7 @@ export declare function NavMenuItemWithChildren({ menuItem, activeMatcher, }: {
|
|
|
9
14
|
export declare function NavMenuItemWithLink({ menuItem, }: {
|
|
10
15
|
menuItem: NavItemWithLink;
|
|
11
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare function NavMenuItem({ menuItem
|
|
17
|
+
export declare function NavMenuItem({ menuItem }: {
|
|
13
18
|
menuItem: NavItem;
|
|
14
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
15
20
|
export declare function NavMenuDivider(): import("react/jsx-runtime").JSX.Element;
|