@rspress/core 1.1.1 → 1.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 +3754 -87
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -0
- package/dist/loader.js +46 -19
- package/dist/loader.js.map +1 -1
- package/dist/runtime/clientEntry.js +3 -1
- package/dist/theme/bundle.css +9 -0
- package/dist/theme/bundle.js +13 -10
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +7 -7
- package/src/runtime/clientEntry.tsx +4 -1
- package/src/theme-default/components/Overview/index.tsx +6 -4
- package/src/theme-default/components/SocialLinks/HiddenLinks.tsx +2 -1
- package/src/theme-default/components/SocialLinks/LinkContent.tsx +2 -2
- package/src/theme-default/layout/DocLayout/index.tsx +13 -12
|
@@ -2,9 +2,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { BrowserRouter } from "react-router-dom";
|
|
4
4
|
import { isProduction } from "@rspress/shared";
|
|
5
|
+
import siteData from "virtual-site-data";
|
|
5
6
|
import { App, initPageData } from "./App";
|
|
6
7
|
import { DataContext, ThemeContext } from "./hooks";
|
|
7
8
|
import { normalizeRoutePath } from "./utils";
|
|
9
|
+
const enableSSG = siteData.ssg;
|
|
8
10
|
const { default: Theme } = require("@theme");
|
|
9
11
|
async function renderInBrowser() {
|
|
10
12
|
const container = document.getElementById("root");
|
|
@@ -21,7 +23,7 @@ async function renderInBrowser() {
|
|
|
21
23
|
const RootApp = await enhancedApp();
|
|
22
24
|
if (process.env.__IS_REACT_18__) {
|
|
23
25
|
const { createRoot, hydrateRoot } = require("react-dom/client");
|
|
24
|
-
if (isProduction()) {
|
|
26
|
+
if (isProduction() && enableSSG) {
|
|
25
27
|
hydrateRoot(container, /* @__PURE__ */ jsx(RootApp, {}));
|
|
26
28
|
} else {
|
|
27
29
|
createRoot(container).render(/* @__PURE__ */ jsx(RootApp, {}));
|
package/dist/theme/bundle.css
CHANGED
|
@@ -424,6 +424,9 @@ video {
|
|
|
424
424
|
.z-10 {
|
|
425
425
|
z-index: 10;
|
|
426
426
|
}
|
|
427
|
+
.z-\[1\] {
|
|
428
|
+
z-index: 1;
|
|
429
|
+
}
|
|
427
430
|
.order-1 {
|
|
428
431
|
order: 1;
|
|
429
432
|
}
|
|
@@ -558,6 +561,9 @@ video {
|
|
|
558
561
|
.h-14 {
|
|
559
562
|
height: 3.5rem;
|
|
560
563
|
}
|
|
564
|
+
.h-\[50px\] {
|
|
565
|
+
height: 50px;
|
|
566
|
+
}
|
|
561
567
|
.h-full {
|
|
562
568
|
height: 100%;
|
|
563
569
|
}
|
|
@@ -573,6 +579,9 @@ video {
|
|
|
573
579
|
.w-32 {
|
|
574
580
|
width: 8rem;
|
|
575
581
|
}
|
|
582
|
+
.w-\[50px\] {
|
|
583
|
+
width: 50px;
|
|
584
|
+
}
|
|
576
585
|
.w-full {
|
|
577
586
|
width: 100%;
|
|
578
587
|
}
|
package/dist/theme/bundle.js
CHANGED
|
@@ -1195,10 +1195,10 @@ import {
|
|
|
1195
1195
|
} from "@/runtime";
|
|
1196
1196
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1197
1197
|
var DEFAULT_GROUP = "Others";
|
|
1198
|
-
function Overview() {
|
|
1198
|
+
function Overview(props) {
|
|
1199
1199
|
const {
|
|
1200
1200
|
siteData: siteData2,
|
|
1201
|
-
page: { routePath }
|
|
1201
|
+
page: { routePath, title }
|
|
1202
1202
|
} = usePageData8();
|
|
1203
1203
|
const { pages } = siteData2;
|
|
1204
1204
|
const overviewModules = pages.filter(
|
|
@@ -1244,7 +1244,8 @@ function Overview() {
|
|
|
1244
1244
|
];
|
|
1245
1245
|
}, [overviewSidebarGroups]);
|
|
1246
1246
|
return /* @__PURE__ */ jsxs8("div", { className: "overview-index mx-auto px-8", children: [
|
|
1247
|
-
/* @__PURE__ */ jsx14("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx14("h1", { className: "text-3xl leading-10 tracking-tight", children: "Overview" }) }),
|
|
1247
|
+
/* @__PURE__ */ jsx14("div", { className: "flex items-center justify-between", children: !title && /* @__PURE__ */ jsx14("h1", { className: "text-3xl leading-10 tracking-tight", children: "Overview" }) }),
|
|
1248
|
+
props.content,
|
|
1248
1249
|
groups.map((group) => /* @__PURE__ */ jsxs8("div", { className: "mb-16", children: [
|
|
1249
1250
|
group.name === DEFAULT_GROUP && groups.length === 1 ? /* @__PURE__ */ jsx14("h2", { style: { paddingTop: 0 } }) : /* @__PURE__ */ jsx14("h2", { children: group.name }),
|
|
1250
1251
|
/* @__PURE__ */ jsx14("div", { className: index_module_default6.overviewGroups, children: group.items.map((item) => {
|
|
@@ -1296,7 +1297,7 @@ function DocLayout(props) {
|
|
|
1296
1297
|
const getHasAside = () => {
|
|
1297
1298
|
var _a2, _b2;
|
|
1298
1299
|
const defaultHasAside = typeof window === "undefined" ? true : window.top === window.self;
|
|
1299
|
-
return (
|
|
1300
|
+
return (_b2 = (_a2 = frontmatter == null ? void 0 : frontmatter.outline) != null ? _a2 : themeConfig == null ? void 0 : themeConfig.outline) != null ? _b2 : defaultHasAside;
|
|
1300
1301
|
};
|
|
1301
1302
|
const [hasAside, setHasAside] = useState6(getHasAside());
|
|
1302
1303
|
useEffect9(() => {
|
|
@@ -1309,6 +1310,7 @@ function DocLayout(props) {
|
|
|
1309
1310
|
setHasFooter(false);
|
|
1310
1311
|
}
|
|
1311
1312
|
}, []);
|
|
1313
|
+
const docContent = /* @__PURE__ */ jsx15(TabDataContext.Provider, { value: { tabData, setTabData }, children: /* @__PURE__ */ jsx15(MDXProvider, { components: getCustomMDXComponent(), children: /* @__PURE__ */ jsx15(Content, {}) }) });
|
|
1312
1314
|
return /* @__PURE__ */ jsxs9(
|
|
1313
1315
|
"div",
|
|
1314
1316
|
{
|
|
@@ -1322,8 +1324,8 @@ function DocLayout(props) {
|
|
|
1322
1324
|
{
|
|
1323
1325
|
className: `${index_module_default7.content} rspress-doc-container flex flex-shrink-0 m-auto`,
|
|
1324
1326
|
children: [
|
|
1325
|
-
/* @__PURE__ */ jsx15("div", { className: "w-full", children: isOverviewPage ? /* @__PURE__ */ jsx15(Overview, {}) : /* @__PURE__ */ jsxs9("div", { children: [
|
|
1326
|
-
/* @__PURE__ */ jsx15("div", { className: "rspress-doc", children:
|
|
1327
|
+
/* @__PURE__ */ jsx15("div", { className: "w-full", children: isOverviewPage ? /* @__PURE__ */ jsx15("div", { className: "rspress-doc", children: /* @__PURE__ */ jsx15(Overview, { content: docContent }) }) : /* @__PURE__ */ jsxs9("div", { children: [
|
|
1328
|
+
/* @__PURE__ */ jsx15("div", { className: "rspress-doc", children: docContent }),
|
|
1327
1329
|
/* @__PURE__ */ jsxs9("div", { className: "rspress-doc-footer", children: [
|
|
1328
1330
|
beforeDocFooter,
|
|
1329
1331
|
hasFooter && /* @__PURE__ */ jsx15(DocFooter, {})
|
|
@@ -2030,7 +2032,7 @@ var LinkContent = (props) => {
|
|
|
2030
2032
|
boxShadow: "var(--rp-shadow-3)",
|
|
2031
2033
|
border: "1px solid var(--rp-c-divider-light)"
|
|
2032
2034
|
}, popperStyle),
|
|
2033
|
-
className: "z-1 p-3 w-50 absolute right-0 bg-white dark:bg-dark",
|
|
2035
|
+
className: "z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark",
|
|
2034
2036
|
children: /* @__PURE__ */ jsx26("div", { className: "text-md", children: content })
|
|
2035
2037
|
}
|
|
2036
2038
|
) : null
|
|
@@ -2050,7 +2052,7 @@ var LinkContent = (props) => {
|
|
|
2050
2052
|
contentVisible ? /* @__PURE__ */ jsx26(
|
|
2051
2053
|
"div",
|
|
2052
2054
|
{
|
|
2053
|
-
className: "break-all z-1 p-3 w-
|
|
2055
|
+
className: "break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl",
|
|
2054
2056
|
style: __spreadValues({
|
|
2055
2057
|
boxShadow: "var(--rp-shadow-3)"
|
|
2056
2058
|
}, popperStyle),
|
|
@@ -2091,9 +2093,10 @@ var HiddenLinks = (props) => {
|
|
|
2091
2093
|
style: {
|
|
2092
2094
|
boxShadow: "var(--rp-shadow-3)",
|
|
2093
2095
|
marginRight: "-2px",
|
|
2094
|
-
border: "1px solid var(--rp-c-divider-light)"
|
|
2096
|
+
border: "1px solid var(--rp-c-divider-light)",
|
|
2097
|
+
background: "var(--rp-c-bg)"
|
|
2095
2098
|
},
|
|
2096
|
-
className: "absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl
|
|
2099
|
+
className: "absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4",
|
|
2097
2100
|
children: links.map((item) => /* @__PURE__ */ jsx28(
|
|
2098
2101
|
LinkContent,
|
|
2099
2102
|
{
|