@rspress/core 0.1.1 → 0.2.0
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/index.js +57 -24
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -0
- package/dist/loader.js +5 -24
- package/dist/loader.js.map +1 -1
- package/dist/runtime/App.js +1 -0
- package/dist/runtime/Content.js +7 -2
- package/dist/runtime/hooks.d.ts +7 -0
- package/dist/runtime/hooks.js +23 -1
- package/dist/theme/bundle.css +39 -1
- package/dist/theme/bundle.d.ts +6 -1
- package/dist/theme/bundle.js +119 -69
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +7 -7
- package/src/runtime/App.tsx +1 -0
- package/src/runtime/Content.tsx +11 -2
- package/src/runtime/hooks.ts +47 -1
- package/src/theme-default/components/Nav/index.tsx +19 -5
- package/src/theme-default/index.ts +2 -0
- package/src/theme-default/layout/DocLayout/docComponents/link.tsx +8 -23
- package/src/theme-default/layout/DocLayout/index.module.scss +46 -0
- package/src/theme-default/logic/index.ts +1 -0
- package/src/theme-default/logic/usePathUtils.ts +72 -0
package/dist/theme/bundle.js
CHANGED
|
@@ -395,6 +395,58 @@ function setup() {
|
|
|
395
395
|
bindingWindowScroll();
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
+
// src/theme-default/logic/usePathUtils.ts
|
|
399
|
+
import { isExternalUrl, normalizeHref } from "@rspress/shared";
|
|
400
|
+
import { removeBase, useLang, usePageData as usePageData4, useVersion, withBase as withBase3 } from "@/runtime";
|
|
401
|
+
function usePathUtils() {
|
|
402
|
+
const currentLang = useLang();
|
|
403
|
+
const currentVersion = useVersion();
|
|
404
|
+
const pageData = usePageData4();
|
|
405
|
+
const defaultLang = pageData.siteData.lang;
|
|
406
|
+
const defaultVersion = pageData.siteData.multiVersion.default;
|
|
407
|
+
const normalizeLinkHref = (rawHref) => {
|
|
408
|
+
let href = rawHref;
|
|
409
|
+
if ((defaultLang || defaultVersion) && !isExternalUrl(href) && !href.startsWith("#")) {
|
|
410
|
+
href = removeBase(href);
|
|
411
|
+
const linkParts = href.split("/").filter(Boolean);
|
|
412
|
+
let versionPart = "";
|
|
413
|
+
let langPart = "";
|
|
414
|
+
let purePathPart = "";
|
|
415
|
+
if (defaultVersion) {
|
|
416
|
+
if (currentVersion !== defaultVersion) {
|
|
417
|
+
versionPart = currentVersion;
|
|
418
|
+
if (linkParts[0] === currentVersion) {
|
|
419
|
+
linkParts.shift();
|
|
420
|
+
}
|
|
421
|
+
} else if (linkParts[0] === defaultVersion) {
|
|
422
|
+
linkParts.shift();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (defaultLang) {
|
|
426
|
+
if (currentLang !== defaultLang) {
|
|
427
|
+
langPart = currentLang;
|
|
428
|
+
if (linkParts[0] === currentLang) {
|
|
429
|
+
linkParts.shift();
|
|
430
|
+
}
|
|
431
|
+
} else if (linkParts[0] === defaultLang) {
|
|
432
|
+
linkParts.shift();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
purePathPart = linkParts.join("/");
|
|
436
|
+
return normalizeHref(withBase3([
|
|
437
|
+
versionPart,
|
|
438
|
+
langPart,
|
|
439
|
+
purePathPart
|
|
440
|
+
].filter(Boolean).join("/")));
|
|
441
|
+
} else {
|
|
442
|
+
return href;
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
return {
|
|
446
|
+
normalizeLinkHref
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
398
450
|
// src/theme-default/logic/utils.ts
|
|
399
451
|
import { isEqualPath as isEqualPath3 } from "@/runtime";
|
|
400
452
|
function isActive(currentPath, targetLink, strict = false) {
|
|
@@ -535,7 +587,7 @@ import { routes } from "virtual-routes";
|
|
|
535
587
|
var index_module_default2 = { "link": "link_b3367" };
|
|
536
588
|
|
|
537
589
|
// src/theme-default/components/Link/index.tsx
|
|
538
|
-
import { normalizeHref, normalizeRoutePath, withBase as
|
|
590
|
+
import { normalizeHref as normalizeHref2, normalizeRoutePath, withBase as withBase4 } from "@/runtime";
|
|
539
591
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
540
592
|
try {
|
|
541
593
|
var info = gen[key](arg);
|
|
@@ -574,7 +626,7 @@ function Link(props) {
|
|
|
574
626
|
const isExternal = EXTERNAL_URL_RE.test(href);
|
|
575
627
|
const target = isExternal ? "_blank" : "";
|
|
576
628
|
const rel = isExternal ? "noopener noreferrer" : void 0;
|
|
577
|
-
const withBaseUrl = isExternal ? href :
|
|
629
|
+
const withBaseUrl = isExternal ? href : withBase4(normalizeHref2(href));
|
|
578
630
|
const navigate = useNavigate();
|
|
579
631
|
const handleNavigate = function() {
|
|
580
632
|
var _ref = _async_to_generator(function* (e) {
|
|
@@ -623,11 +675,11 @@ function Link(props) {
|
|
|
623
675
|
var index_module_default3 = { "pager": "pager_33e00", "has-next": "has-next_33e00", "hasNext": "has-next_33e00", "prev": "prev_33e00", "next": "next_33e00", "pager-link": "pager-link_33e00", "pagerLink": "pager-link_33e00", "title": "title_33e00", "desc": "desc_33e00" };
|
|
624
676
|
|
|
625
677
|
// src/theme-default/components/DocFooter/index.tsx
|
|
626
|
-
import { normalizeHref as
|
|
678
|
+
import { normalizeHref as normalizeHref3, usePageData as usePageData5 } from "@/runtime";
|
|
627
679
|
function DocFooter() {
|
|
628
680
|
const { prevPage, nextPage } = usePrevNextPage();
|
|
629
681
|
const { prevPageText = "Previous Page", nextPageText = "Next page", lastUpdatedText: localesLastUpdatedText = "Last Updated", lastUpdated: localesLastUpdated = false } = useLocaleSiteData();
|
|
630
|
-
const { page: { lastUpdatedTime }, siteData: siteData2 } =
|
|
682
|
+
const { page: { lastUpdatedTime }, siteData: siteData2 } = usePageData5();
|
|
631
683
|
const { themeConfig } = siteData2;
|
|
632
684
|
const lastUpdatedText = (themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.lastUpdatedText) || localesLastUpdatedText;
|
|
633
685
|
const showLastUpdated = themeConfig.lastUpdated || localesLastUpdated;
|
|
@@ -661,7 +713,7 @@ function DocFooter() {
|
|
|
661
713
|
/* @__PURE__ */ _jsx5("div", {
|
|
662
714
|
className: `${index_module_default3.prev} flex flex-col`,
|
|
663
715
|
children: prevPage ? /* @__PURE__ */ _jsxs3(Link, {
|
|
664
|
-
href:
|
|
716
|
+
href: normalizeHref3(prevPage.link),
|
|
665
717
|
className: index_module_default3.pagerLink,
|
|
666
718
|
children: [
|
|
667
719
|
/* @__PURE__ */ _jsx5("span", {
|
|
@@ -678,7 +730,7 @@ function DocFooter() {
|
|
|
678
730
|
/* @__PURE__ */ _jsx5("div", {
|
|
679
731
|
className: `${index_module_default3.next} flex flex-col`,
|
|
680
732
|
children: nextPage ? /* @__PURE__ */ _jsxs3(Link, {
|
|
681
|
-
href:
|
|
733
|
+
href: normalizeHref3(nextPage.link),
|
|
682
734
|
className: `${index_module_default3.pagerLink} ${index_module_default3.next}`,
|
|
683
735
|
children: [
|
|
684
736
|
/* @__PURE__ */ _jsx5("span", {
|
|
@@ -813,7 +865,7 @@ var SvgArrowRight = (props) => /* @__PURE__ */ _jsx7("svg", _object_spread_props
|
|
|
813
865
|
var arrow_right_default = SvgArrowRight;
|
|
814
866
|
|
|
815
867
|
// src/theme-default/components/Sidebar/SidebarGroup.tsx
|
|
816
|
-
import { normalizeHref as
|
|
868
|
+
import { normalizeHref as normalizeHref4, withBase as withBase5 } from "@/runtime";
|
|
817
869
|
function _define_property4(obj, key, value) {
|
|
818
870
|
if (key in obj) {
|
|
819
871
|
Object.defineProperty(obj, key, {
|
|
@@ -955,7 +1007,7 @@ function SidebarGroup(props) {
|
|
|
955
1007
|
onMouseEnter: () => item.link && props.preloadLink(item.link),
|
|
956
1008
|
onClick: (e) => {
|
|
957
1009
|
if (item.link) {
|
|
958
|
-
navigate(
|
|
1010
|
+
navigate(withBase5(normalizeHref4(item.link)));
|
|
959
1011
|
collapsed && toggleCollapse(e);
|
|
960
1012
|
} else {
|
|
961
1013
|
collapsible && toggleCollapse(e);
|
|
@@ -1015,7 +1067,7 @@ function SidebarGroup(props) {
|
|
|
1015
1067
|
}
|
|
1016
1068
|
|
|
1017
1069
|
// src/theme-default/components/Sidebar/SidebarItem.tsx
|
|
1018
|
-
import { normalizeHref as
|
|
1070
|
+
import { normalizeHref as normalizeHref5 } from "@/runtime";
|
|
1019
1071
|
function _define_property5(obj, key, value) {
|
|
1020
1072
|
if (key in obj) {
|
|
1021
1073
|
Object.defineProperty(obj, key, {
|
|
@@ -1069,7 +1121,7 @@ function SidebarItem(props) {
|
|
|
1069
1121
|
}, `${item.text}-${id}`);
|
|
1070
1122
|
} else {
|
|
1071
1123
|
return /* @__PURE__ */ _jsx9(Link, {
|
|
1072
|
-
href:
|
|
1124
|
+
href: normalizeHref5(item.link),
|
|
1073
1125
|
className: index_module_default4.menuLink,
|
|
1074
1126
|
children: /* @__PURE__ */ _jsxs5("div", {
|
|
1075
1127
|
ref,
|
|
@@ -1095,7 +1147,7 @@ function SidebarItem(props) {
|
|
|
1095
1147
|
}
|
|
1096
1148
|
|
|
1097
1149
|
// src/theme-default/components/Sidebar/index.tsx
|
|
1098
|
-
import { removeBase, usePageData as
|
|
1150
|
+
import { removeBase as removeBase2, usePageData as usePageData6 } from "@/runtime";
|
|
1099
1151
|
function _define_property6(obj, key, value) {
|
|
1100
1152
|
if (key in obj) {
|
|
1101
1153
|
Object.defineProperty(obj, key, {
|
|
@@ -1133,7 +1185,7 @@ var highlightTitleStyle = {
|
|
|
1133
1185
|
var matchCache = /* @__PURE__ */ new WeakMap();
|
|
1134
1186
|
function SideBar(props) {
|
|
1135
1187
|
const { isSidebarOpen, langRoutePrefix, pathname: rawPathname, sidebarData: rawSidebarData } = props;
|
|
1136
|
-
const { siteData: { themeConfig }, page: { frontmatter } } =
|
|
1188
|
+
const { siteData: { themeConfig }, page: { frontmatter } } = usePageData6();
|
|
1137
1189
|
var _frontmatter_hideNavbar, _ref;
|
|
1138
1190
|
const hideNavbar = (_ref = (_frontmatter_hideNavbar = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.hideNavbar) !== null && _frontmatter_hideNavbar !== void 0 ? _frontmatter_hideNavbar : themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.hideNavbar) !== null && _ref !== void 0 ? _ref : false;
|
|
1139
1191
|
const [sidebarData, setSidebarData] = useState2(rawSidebarData.filter(Boolean).flat());
|
|
@@ -1179,7 +1231,7 @@ function SideBar(props) {
|
|
|
1179
1231
|
const removeLangPrefix = (path) => {
|
|
1180
1232
|
return path.replace(langRoutePrefix, "");
|
|
1181
1233
|
};
|
|
1182
|
-
const activeMatcher = (path) => isActive(
|
|
1234
|
+
const activeMatcher = (path) => isActive(removeBase2(removeLangPrefix(pathname)), removeLangPrefix(path), true);
|
|
1183
1235
|
const preloadLink = (link) => {
|
|
1184
1236
|
const match = matchRoutes2(routes2, link);
|
|
1185
1237
|
if (match === null || match === void 0 ? void 0 : match.length) {
|
|
@@ -1341,7 +1393,7 @@ import { useMemo } from "react";
|
|
|
1341
1393
|
var index_module_default5 = { "header-anchor": "header-anchor_90d29", "headerAnchor": "header-anchor_90d29", "overview-groups": "overview-groups_90d29", "overviewGroups": "overview-groups_90d29", "overview-group-li": "overview-group-li_90d29", "overviewGroupLi": "overview-group-li_90d29", "level-2": "level-2_90d29", "level2": "level-2_90d29", "overview-group": "overview-group_90d29", "overviewGroup": "overview-group_90d29", "header": "header_90d29" };
|
|
1342
1394
|
|
|
1343
1395
|
// src/theme-default/components/Overview/index.tsx
|
|
1344
|
-
import { usePageData as
|
|
1396
|
+
import { usePageData as usePageData7, normalizeHref as normalizeHref6, withBase as withBase6, isEqualPath as isEqualPath4 } from "@/runtime";
|
|
1345
1397
|
function _define_property8(obj, key, value) {
|
|
1346
1398
|
if (key in obj) {
|
|
1347
1399
|
Object.defineProperty(obj, key, {
|
|
@@ -1396,13 +1448,13 @@ function _object_spread_props5(target, source) {
|
|
|
1396
1448
|
}
|
|
1397
1449
|
var DEFAULT_GROUP = "Others";
|
|
1398
1450
|
function Overview() {
|
|
1399
|
-
const { siteData: siteData2, page: { routePath } } =
|
|
1451
|
+
const { siteData: siteData2, page: { routePath } } = usePageData7();
|
|
1400
1452
|
const { pages } = siteData2;
|
|
1401
1453
|
const overviewModules = pages.filter((page) => page.routePath.startsWith(routePath.replace(/overview$/, "")) && page.routePath !== routePath);
|
|
1402
1454
|
const { items: overviewSidebarGroups } = useSidebarData();
|
|
1403
1455
|
function normalizeSidebarItem(item) {
|
|
1404
1456
|
var _pageModule_toc;
|
|
1405
|
-
const pageModule = overviewModules.find((m) => isEqualPath4(m.routePath,
|
|
1457
|
+
const pageModule = overviewModules.find((m) => isEqualPath4(m.routePath, withBase6(item.link || "")));
|
|
1406
1458
|
const getChildLink = (traverseItem) => {
|
|
1407
1459
|
if (traverseItem.link) {
|
|
1408
1460
|
return traverseItem.link;
|
|
@@ -1469,7 +1521,7 @@ function Overview() {
|
|
|
1469
1521
|
marginBottom: 8
|
|
1470
1522
|
},
|
|
1471
1523
|
children: /* @__PURE__ */ _jsx13(Link, {
|
|
1472
|
-
href:
|
|
1524
|
+
href: normalizeHref6(item.link),
|
|
1473
1525
|
children: item.text
|
|
1474
1526
|
})
|
|
1475
1527
|
})
|
|
@@ -1479,7 +1531,7 @@ function Overview() {
|
|
|
1479
1531
|
children: (_item_headers = item.headers) === null || _item_headers === void 0 ? void 0 : _item_headers.map((header) => /* @__PURE__ */ _jsx13("li", {
|
|
1480
1532
|
className: `${index_module_default5.overviewGroupLi} ${index_module_default5[`level${header.depth}`]} first:mt-2`,
|
|
1481
1533
|
children: /* @__PURE__ */ _jsx13(Link, {
|
|
1482
|
-
href: `${
|
|
1534
|
+
href: `${normalizeHref6(item.link)}#${header.id}`,
|
|
1483
1535
|
children: header.text
|
|
1484
1536
|
})
|
|
1485
1537
|
}, header.id))
|
|
@@ -1499,10 +1551,10 @@ import { createContext } from "react";
|
|
|
1499
1551
|
var TabDataContext = createContext({});
|
|
1500
1552
|
|
|
1501
1553
|
// src/theme-default/layout/DocLayout/index.module.scss
|
|
1502
|
-
var index_module_default6 = { "aside-container": "aside-container_feeda", "asideContainer": "aside-container_feeda", "docLayout": "docLayout_feeda", "content": "content_feeda" };
|
|
1554
|
+
var index_module_default6 = { "aside-container": "aside-container_feeda", "asideContainer": "aside-container_feeda", "fade-out": "fade-out_feeda", "fadeOut": "fade-out_feeda", "fade-in": "fade-in_feeda", "fadeIn": "fade-in_feeda", "docLayout": "docLayout_feeda", "content": "content_feeda" };
|
|
1503
1555
|
|
|
1504
1556
|
// src/theme-default/layout/DocLayout/index.tsx
|
|
1505
|
-
import { Content, usePageData as
|
|
1557
|
+
import { Content, usePageData as usePageData8, normalizeSlash } from "@/runtime";
|
|
1506
1558
|
function _define_property9(obj, key, value) {
|
|
1507
1559
|
if (key in obj) {
|
|
1508
1560
|
Object.defineProperty(obj, key, {
|
|
@@ -1533,7 +1585,7 @@ function _object_spread9(target) {
|
|
|
1533
1585
|
}
|
|
1534
1586
|
function DocLayout(props) {
|
|
1535
1587
|
const { beforeDocFooter, beforeDoc, afterDoc, beforeOutline, afterOutline } = props;
|
|
1536
|
-
const { siteData: siteData2, page } =
|
|
1588
|
+
const { siteData: siteData2, page } = usePageData8();
|
|
1537
1589
|
const { toc = [], frontmatter } = page;
|
|
1538
1590
|
const [tabData, setTabData] = useState4({});
|
|
1539
1591
|
const headers = toc;
|
|
@@ -1633,7 +1685,7 @@ function DocLayout(props) {
|
|
|
1633
1685
|
}
|
|
1634
1686
|
|
|
1635
1687
|
// src/theme-default/layout/Layout/index.tsx
|
|
1636
|
-
import { usePageData as
|
|
1688
|
+
import { usePageData as usePageData9, Content as Content2, removeBase as removeBase3, withBase as withBase7 } from "@/runtime";
|
|
1637
1689
|
function _define_property10(obj, key, value) {
|
|
1638
1690
|
if (key in obj) {
|
|
1639
1691
|
Object.defineProperty(obj, key, {
|
|
@@ -1671,7 +1723,7 @@ var Layout = (props) => {
|
|
|
1671
1723
|
beforeOutline,
|
|
1672
1724
|
afterOutline
|
|
1673
1725
|
};
|
|
1674
|
-
const { siteData: siteData2, page } =
|
|
1726
|
+
const { siteData: siteData2, page } = usePageData9();
|
|
1675
1727
|
const { themeConfig } = siteData2;
|
|
1676
1728
|
const {
|
|
1677
1729
|
pageType,
|
|
@@ -1715,7 +1767,7 @@ var Layout = (props) => {
|
|
|
1715
1767
|
return;
|
|
1716
1768
|
}
|
|
1717
1769
|
const { pathname } = window.location;
|
|
1718
|
-
const cleanPathname =
|
|
1770
|
+
const cleanPathname = removeBase3(pathname);
|
|
1719
1771
|
const FIRST_VISIT_KEY = "rspress-visited";
|
|
1720
1772
|
const visited = localStorage.getItem(FIRST_VISIT_KEY);
|
|
1721
1773
|
if (visited) {
|
|
@@ -1731,7 +1783,7 @@ var Layout = (props) => {
|
|
|
1731
1783
|
if (targetLang === defaultLang) {
|
|
1732
1784
|
window.location.replace(pathname.replace(`/${currentLang}`, ""));
|
|
1733
1785
|
} else if (currentLang === defaultLang) {
|
|
1734
|
-
window.location.replace(
|
|
1786
|
+
window.location.replace(withBase7(`/${targetLang}${cleanPathname}`));
|
|
1735
1787
|
} else {
|
|
1736
1788
|
window.location.replace(pathname.replace(`/${currentLang}`, `/${targetLang}`));
|
|
1737
1789
|
}
|
|
@@ -1812,7 +1864,7 @@ function Button(props) {
|
|
|
1812
1864
|
var index_module_default8 = { "clip": "clip_1e4a0", "mask": "mask_1e4a0" };
|
|
1813
1865
|
|
|
1814
1866
|
// src/theme-default/components/HomeHero/index.tsx
|
|
1815
|
-
import { normalizeHref as
|
|
1867
|
+
import { normalizeHref as normalizeHref7 } from "@/runtime";
|
|
1816
1868
|
var DEFAULT_HERO = {
|
|
1817
1869
|
name: "modern",
|
|
1818
1870
|
text: "modern ssg",
|
|
@@ -1867,7 +1919,7 @@ function HomeHero({ frontmatter }) {
|
|
|
1867
1919
|
children: /* @__PURE__ */ _jsx16(Button, {
|
|
1868
1920
|
type: "a",
|
|
1869
1921
|
text: action.text,
|
|
1870
|
-
href:
|
|
1922
|
+
href: normalizeHref7(action.link),
|
|
1871
1923
|
theme: action.theme
|
|
1872
1924
|
})
|
|
1873
1925
|
}, action.link))
|
|
@@ -1957,10 +2009,10 @@ function HomeFeature({ frontmatter }) {
|
|
|
1957
2009
|
}
|
|
1958
2010
|
|
|
1959
2011
|
// src/theme-default/layout/HomeLayout/index.tsx
|
|
1960
|
-
import { usePageData as
|
|
2012
|
+
import { usePageData as usePageData10 } from "@/runtime";
|
|
1961
2013
|
function HomeLayout(props) {
|
|
1962
2014
|
const { beforeHero, afterHero, beforeFeatures, afterFeatures } = props;
|
|
1963
|
-
const { page: { frontmatter } } =
|
|
2015
|
+
const { page: { frontmatter } } = usePageData10();
|
|
1964
2016
|
return /* @__PURE__ */ _jsxs12("div", {
|
|
1965
2017
|
className: "relative",
|
|
1966
2018
|
style: {
|
|
@@ -2168,12 +2220,12 @@ import { withoutBase } from "@rspress/shared";
|
|
|
2168
2220
|
var index_module_default11 = { "container": "container_47ac2", "leftNav": "leftNav_47ac2", "rightNav": "rightNav_47ac2", "activeItem": "activeItem_47ac2", "singleItem": "singleItem_47ac2", "navContainer": "navContainer_47ac2", "social-links-icon": "social-links-icon_47ac2", "socialLinksIcon": "social-links-icon_47ac2", "menu-item": "menu-item_47ac2", "menuItem": "menu-item_47ac2", "mobileNavMenu": "mobileNavMenu_47ac2", "mask": "mask_47ac2", "docPage": "docPage_47ac2" };
|
|
2169
2221
|
|
|
2170
2222
|
// src/theme-default/components/Nav/NavMenuSingleItem.tsx
|
|
2171
|
-
import { normalizeHref as
|
|
2223
|
+
import { normalizeHref as normalizeHref8 } from "@/runtime";
|
|
2172
2224
|
function NavMenuSingleItem(item) {
|
|
2173
2225
|
const { pathname, base } = item;
|
|
2174
2226
|
const isActive2 = new RegExp(item.activeMatch || item.link).test(withoutBase(pathname, base));
|
|
2175
2227
|
return /* @__PURE__ */ _jsx21(Link, {
|
|
2176
|
-
href:
|
|
2228
|
+
href: normalizeHref8(item.link),
|
|
2177
2229
|
children: /* @__PURE__ */ _jsxs14("div", {
|
|
2178
2230
|
className: `${index_module_default11.singleItem} ${isActive2 ? index_module_default11.activeItem : ""} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`,
|
|
2179
2231
|
children: [
|
|
@@ -3425,7 +3477,7 @@ function NavMenuGroup(item) {
|
|
|
3425
3477
|
}
|
|
3426
3478
|
|
|
3427
3479
|
// src/theme-default/components/Nav/index.tsx
|
|
3428
|
-
import { ThemeContext as ThemeContext3, usePageData as
|
|
3480
|
+
import { ThemeContext as ThemeContext3, usePageData as usePageData11, useVersion as useVersion2, withBase as withBase8 } from "@/runtime";
|
|
3429
3481
|
function _define_property20(obj, key, value) {
|
|
3430
3482
|
if (key in obj) {
|
|
3431
3483
|
Object.defineProperty(obj, key, {
|
|
@@ -3483,7 +3535,7 @@ var NavBarTitle = ({ title, langRoutePrefix, logo }) => {
|
|
|
3483
3535
|
return /* @__PURE__ */ _jsx36("div", {
|
|
3484
3536
|
className: `${index_module_default11.navBarTitle}`,
|
|
3485
3537
|
children: /* @__PURE__ */ _jsx36("a", {
|
|
3486
|
-
href:
|
|
3538
|
+
href: withBase8(langRoutePrefix),
|
|
3487
3539
|
className: "flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60",
|
|
3488
3540
|
children: logo ? /* @__PURE__ */ _jsx36("img", {
|
|
3489
3541
|
src: logo,
|
|
@@ -3509,24 +3561,33 @@ var NavTranslations = ({ translationMenuData }) => {
|
|
|
3509
3561
|
function Nav2(props) {
|
|
3510
3562
|
var _localeLanguages_find, _siteData_themeConfig;
|
|
3511
3563
|
const { beforeNavTitle, afterNavTitle, beforeNav } = props;
|
|
3512
|
-
const { siteData: siteData2, page } =
|
|
3564
|
+
const { siteData: siteData2, page } = usePageData11();
|
|
3513
3565
|
const { logo: rawLogo, base } = siteData2;
|
|
3514
3566
|
const { pathname } = useLocation4();
|
|
3515
3567
|
const { theme } = useContext3(ThemeContext3);
|
|
3516
3568
|
const localeData = useLocaleSiteData();
|
|
3569
|
+
const currentVersion = useVersion2();
|
|
3517
3570
|
const [isMobile, setIsMobile] = useState10(false);
|
|
3518
3571
|
const localeLanguages = Object.values(siteData2.themeConfig.locales || {});
|
|
3519
3572
|
const hasMultiLanguage = localeLanguages.length > 1;
|
|
3520
3573
|
const socialLinks = siteData2.themeConfig.socialLinks || [];
|
|
3521
3574
|
const hasSocialLinks = socialLinks.length > 0;
|
|
3522
|
-
const defaultLang = siteData2.lang || "
|
|
3575
|
+
const defaultLang = siteData2.lang || "";
|
|
3576
|
+
const defaultVersion = siteData2.multiVersion.default || "";
|
|
3523
3577
|
const { lang } = page;
|
|
3524
|
-
const langs = localeLanguages.map((item) => item.lang || "
|
|
3578
|
+
const langs = localeLanguages.map((item) => item.lang || "") || [];
|
|
3525
3579
|
const [logo, setLogo] = useState10(getLogoUrl(rawLogo, theme));
|
|
3526
3580
|
const translationMenuData = hasMultiLanguage ? {
|
|
3527
3581
|
items: localeLanguages.map((item) => ({
|
|
3528
3582
|
text: item === null || item === void 0 ? void 0 : item.label,
|
|
3529
|
-
link: replaceLang(pathname,
|
|
3583
|
+
link: replaceLang(pathname, {
|
|
3584
|
+
current: lang,
|
|
3585
|
+
target: item.lang,
|
|
3586
|
+
default: defaultLang
|
|
3587
|
+
}, {
|
|
3588
|
+
current: currentVersion,
|
|
3589
|
+
default: defaultVersion
|
|
3590
|
+
}, base)
|
|
3530
3591
|
})),
|
|
3531
3592
|
activeValue: (_localeLanguages_find = localeLanguages.find((item) => lang === item.lang)) === null || _localeLanguages_find === void 0 ? void 0 : _localeLanguages_find.label
|
|
3532
3593
|
} : null;
|
|
@@ -3605,7 +3666,7 @@ function Nav2(props) {
|
|
|
3605
3666
|
});
|
|
3606
3667
|
};
|
|
3607
3668
|
return /* @__PURE__ */ _jsxs23("header", {
|
|
3608
|
-
className:
|
|
3669
|
+
className: "top-0 left-0 md:fixed w-full",
|
|
3609
3670
|
style: {
|
|
3610
3671
|
zIndex: "var(--rp-z-index-nav)",
|
|
3611
3672
|
background: "var(--rp-c-bg)"
|
|
@@ -4502,7 +4563,7 @@ var RemoteProvider = class {
|
|
|
4502
4563
|
};
|
|
4503
4564
|
|
|
4504
4565
|
// src/theme-default/components/Search/logic/search.ts
|
|
4505
|
-
import { normalizeHref as
|
|
4566
|
+
import { normalizeHref as normalizeHref9 } from "@/runtime";
|
|
4506
4567
|
function asyncGeneratorStep4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4507
4568
|
try {
|
|
4508
4569
|
var info = gen[key](arg);
|
|
@@ -4674,7 +4735,7 @@ function matchTitle(item, query2, matchedResult) {
|
|
|
4674
4735
|
type: "title",
|
|
4675
4736
|
title,
|
|
4676
4737
|
header: title,
|
|
4677
|
-
link: `${item.domain}${
|
|
4738
|
+
link: `${item.domain}${normalizeHref9(item.routePath)}`,
|
|
4678
4739
|
query: query2,
|
|
4679
4740
|
highlightInfoList: [
|
|
4680
4741
|
{
|
|
@@ -4707,7 +4768,7 @@ function matchHeader(item, query2, matchedResult) {
|
|
|
4707
4768
|
length: getStrByteLength(query2)
|
|
4708
4769
|
}
|
|
4709
4770
|
],
|
|
4710
|
-
link: `${domain}${
|
|
4771
|
+
link: `${domain}${normalizeHref9(item.routePath)}#${header.id}`,
|
|
4711
4772
|
query: query2,
|
|
4712
4773
|
group: _class_private_field_get3(this, _options2).extractGroupName(item.routePath)
|
|
4713
4774
|
});
|
|
@@ -4762,7 +4823,7 @@ function matchContent(item, query2, matchedResult) {
|
|
|
4762
4823
|
type: "content",
|
|
4763
4824
|
title: item.title,
|
|
4764
4825
|
header: (_currentHeader_text = currentHeader === null || currentHeader === void 0 ? void 0 : currentHeader.text) !== null && _currentHeader_text !== void 0 ? _currentHeader_text : item.title,
|
|
4765
|
-
link: `${domain}${
|
|
4826
|
+
link: `${domain}${normalizeHref9(item.routePath)}${currentHeader ? `#${currentHeader.id}` : ""}`,
|
|
4766
4827
|
query: query2,
|
|
4767
4828
|
highlightInfoList,
|
|
4768
4829
|
group: _class_private_field_get3(this, _options2).extractGroupName(item.routePath),
|
|
@@ -4793,7 +4854,7 @@ function matchContent(item, query2, matchedResult) {
|
|
|
4793
4854
|
header: (_currentHeader_text1 = currentHeader === null || currentHeader === void 0 ? void 0 : currentHeader.text) !== null && _currentHeader_text1 !== void 0 ? _currentHeader_text1 : item.title,
|
|
4794
4855
|
statement,
|
|
4795
4856
|
highlightInfoList,
|
|
4796
|
-
link: `${domain}${
|
|
4857
|
+
link: `${domain}${normalizeHref9(item.routePath)}${currentHeader ? `#${currentHeader.id}` : ""}`,
|
|
4797
4858
|
query: query2,
|
|
4798
4859
|
group: _class_private_field_get3(this, _options2).extractGroupName(item.routePath)
|
|
4799
4860
|
});
|
|
@@ -5322,7 +5383,7 @@ function NoSearchResult({ query: query2 }) {
|
|
|
5322
5383
|
}
|
|
5323
5384
|
|
|
5324
5385
|
// src/theme-default/components/Search/SearchPanel.tsx
|
|
5325
|
-
import { isProduction as isProduction2, usePageData as
|
|
5386
|
+
import { isProduction as isProduction2, usePageData as usePageData12 } from "@/runtime";
|
|
5326
5387
|
function asyncGeneratorStep5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5327
5388
|
try {
|
|
5328
5389
|
var info = gen[key](arg);
|
|
@@ -5425,7 +5486,7 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
5425
5486
|
const [initing, setIniting] = useState12(true);
|
|
5426
5487
|
const [currentSuggestionIndex, setCurrentSuggestionIndex] = useState12(0);
|
|
5427
5488
|
const pageSearcherRef = useRef5(null);
|
|
5428
|
-
const { siteData: siteData2, page: { lang } } =
|
|
5489
|
+
const { siteData: siteData2, page: { lang } } = usePageData12();
|
|
5429
5490
|
const { sidebar } = useLocaleSiteData();
|
|
5430
5491
|
const { search } = siteData2;
|
|
5431
5492
|
const suggestions = [
|
|
@@ -5750,9 +5811,9 @@ function Search2() {
|
|
|
5750
5811
|
|
|
5751
5812
|
// src/theme-default/components/HomeFooter/index.tsx
|
|
5752
5813
|
import { jsx as _jsx50 } from "react/jsx-runtime";
|
|
5753
|
-
import { usePageData as
|
|
5814
|
+
import { usePageData as usePageData13 } from "@/runtime";
|
|
5754
5815
|
function HomeFooter2() {
|
|
5755
|
-
const { siteData: siteData2 } =
|
|
5816
|
+
const { siteData: siteData2 } = usePageData13();
|
|
5756
5817
|
const { message } = siteData2.themeConfig.footer || {};
|
|
5757
5818
|
return /* @__PURE__ */ _jsx50("footer", {
|
|
5758
5819
|
className: "absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light",
|
|
@@ -5768,7 +5829,7 @@ function HomeFooter2() {
|
|
|
5768
5829
|
|
|
5769
5830
|
// src/theme-default/components/Toc/index.tsx
|
|
5770
5831
|
import { jsx as _jsx51 } from "react/jsx-runtime";
|
|
5771
|
-
import { usePageData as
|
|
5832
|
+
import { usePageData as usePageData14 } from "@/runtime";
|
|
5772
5833
|
function _define_property32(obj, key, value) {
|
|
5773
5834
|
if (key in obj) {
|
|
5774
5835
|
Object.defineProperty(obj, key, {
|
|
@@ -5822,7 +5883,7 @@ var TocItem = (header) => {
|
|
|
5822
5883
|
}, header.id);
|
|
5823
5884
|
};
|
|
5824
5885
|
function Toc() {
|
|
5825
|
-
const { page } =
|
|
5886
|
+
const { page } = usePageData14();
|
|
5826
5887
|
return /* @__PURE__ */ _jsx51("ul", {
|
|
5827
5888
|
children: page.toc.map((item) => /* @__PURE__ */ _jsx51(TocItem, _object_spread32({}, item), item.id))
|
|
5828
5889
|
});
|
|
@@ -5967,7 +6028,7 @@ var prisim_theme_default = {
|
|
|
5967
6028
|
};
|
|
5968
6029
|
|
|
5969
6030
|
// src/theme-default/layout/DocLayout/docComponents/code.tsx
|
|
5970
|
-
import { usePageData as
|
|
6031
|
+
import { usePageData as usePageData15 } from "@/runtime";
|
|
5971
6032
|
function _define_property33(obj, key, value) {
|
|
5972
6033
|
if (key in obj) {
|
|
5973
6034
|
Object.defineProperty(obj, key, {
|
|
@@ -6017,7 +6078,7 @@ function registerLanguages() {
|
|
|
6017
6078
|
}
|
|
6018
6079
|
function Code(props) {
|
|
6019
6080
|
const copyButtonRef = useRef6(null);
|
|
6020
|
-
const { siteData: siteData2 } =
|
|
6081
|
+
const { siteData: siteData2 } = usePageData15();
|
|
6021
6082
|
const { showLineNumbers } = siteData2.markdown;
|
|
6022
6083
|
if (!registered) {
|
|
6023
6084
|
registerLanguages();
|
|
@@ -6879,8 +6940,6 @@ var Hr = (props) => {
|
|
|
6879
6940
|
|
|
6880
6941
|
// src/theme-default/layout/DocLayout/docComponents/link.tsx
|
|
6881
6942
|
import { jsx as _jsx63 } from "react/jsx-runtime";
|
|
6882
|
-
import { isExternalUrl, normalizeHref as normalizeHref9, normalizeSlash as normalizeSlash2 } from "@rspress/shared";
|
|
6883
|
-
import { withBase as withBase8, useLang, usePageData as usePageData15, removeBase as removeBase3 } from "@/runtime";
|
|
6884
6943
|
function _define_property42(obj, key, value) {
|
|
6885
6944
|
if (key in obj) {
|
|
6886
6945
|
Object.defineProperty(obj, key, {
|
|
@@ -6934,24 +6993,11 @@ function _object_spread_props34(target, source) {
|
|
|
6934
6993
|
return target;
|
|
6935
6994
|
}
|
|
6936
6995
|
var A = (props) => {
|
|
6937
|
-
|
|
6938
|
-
const
|
|
6939
|
-
const pageData = usePageData15();
|
|
6940
|
-
const defaultLang = pageData.siteData.lang;
|
|
6941
|
-
if (defaultLang && !isExternalUrl(href) && !href.startsWith("#")) {
|
|
6942
|
-
href = normalizeSlash2(href);
|
|
6943
|
-
const startWithLang = removeBase3(href).startsWith(`/${lang}`);
|
|
6944
|
-
if (lang !== defaultLang && !startWithLang) {
|
|
6945
|
-
href = `/${lang}${href}`;
|
|
6946
|
-
}
|
|
6947
|
-
if (lang === defaultLang && startWithLang) {
|
|
6948
|
-
href = removeBase3(href).replace(`/${lang}`, "");
|
|
6949
|
-
}
|
|
6950
|
-
href = normalizeHref9(withBase8(href || ""));
|
|
6951
|
-
}
|
|
6996
|
+
const { href = "" } = props;
|
|
6997
|
+
const { normalizeLinkHref } = usePathUtils();
|
|
6952
6998
|
return /* @__PURE__ */ _jsx63("a", _object_spread_props34(_object_spread42({}, props), {
|
|
6953
6999
|
className: `${index_module_default17.link} ${props.className}`,
|
|
6954
|
-
href
|
|
7000
|
+
href: normalizeLinkHref(href)
|
|
6955
7001
|
}));
|
|
6956
7002
|
};
|
|
6957
7003
|
|
|
@@ -7061,8 +7107,11 @@ var theme_default_default = {
|
|
|
7061
7107
|
export {
|
|
7062
7108
|
Button,
|
|
7063
7109
|
HomeFooter2 as HomeFooter,
|
|
7110
|
+
HomeLayout,
|
|
7111
|
+
Layout,
|
|
7064
7112
|
Link,
|
|
7065
7113
|
Nav2 as Nav,
|
|
7114
|
+
NotFoundLayout,
|
|
7066
7115
|
PackageManagerTabs,
|
|
7067
7116
|
Search2 as Search,
|
|
7068
7117
|
SearchPanel,
|
|
@@ -7080,6 +7129,7 @@ export {
|
|
|
7080
7129
|
setup,
|
|
7081
7130
|
useEditLink,
|
|
7082
7131
|
useLocaleSiteData,
|
|
7132
|
+
usePathUtils,
|
|
7083
7133
|
usePrevNextPage,
|
|
7084
7134
|
useSidebarData
|
|
7085
7135
|
};
|