@brillout/docpress 0.1.20 → 0.2.1
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/bin.js +1 -1
- package/{src/css/Inter-Var.ttf → dist/Inter-Var-IOAEQULN.ttf} +0 -0
- package/{src/components/Sponsors/companyLogos/ccoli.svg → dist/ccoli-CHW3TQKS.svg} +0 -0
- package/{src/icons/changelog.svg → dist/changelog-IPI5F42D.svg} +0 -0
- package/{src/navigation/navigation-fullscreen/chevron.svg → dist/chevron-K3WPYLOP.svg} +0 -0
- package/{src/components/features/chevron.svg → dist/chevron-R2IYJD62.svg} +0 -0
- package/dist/chunk-7HKDCMSZ.js +154 -0
- package/dist/chunk-7HKDCMSZ.js.map +1 -0
- package/dist/chunk-C3OIVLKV.js +75 -0
- package/dist/chunk-C3OIVLKV.js.map +1 -0
- package/dist/chunk-G2A5MZJA.js +48 -0
- package/dist/chunk-G2A5MZJA.js.map +1 -0
- package/dist/chunk-H5CO4N2X.js +174 -0
- package/dist/chunk-H5CO4N2X.js.map +1 -0
- package/dist/chunk-TTLAZ2T2.js +8 -0
- package/dist/chunk-TTLAZ2T2.js.map +1 -0
- package/dist/{chunk-ZYYJWJMY.js → chunk-XUTBTIEE.js} +15 -42
- package/dist/chunk-XUTBTIEE.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +35 -0
- package/dist/cli/index.js.map +1 -0
- package/{src/navigation/navigation-fullscreen/close.svg → dist/close-IQXTDOHV.svg} +0 -0
- package/{src/utils/Emoji/compass.svg → dist/compass-2RWQU3E4.svg} +0 -0
- package/{src → dist}/components/features/FeatureList.css +2 -7
- package/dist/components/features/FeatureList.css.map +1 -0
- package/dist/components/features/FeatureList.d.ts +13 -0
- package/dist/components/features/FeatureList.js +8 -0
- package/dist/components/features/FeatureList.js.map +1 -0
- package/dist/components/features/initFeatureList.d.ts +3 -0
- package/dist/components/features/initFeatureList.js +60 -0
- package/dist/components/features/initFeatureList.js.map +1 -0
- package/{src/components/Sponsors/companyLogos/contra.svg → dist/contra-WLZBOPBV.svg} +0 -0
- package/dist/{devServer-J2XJQJGT.js → devServer-534L4U45.js} +5 -2
- package/dist/{devServer-J2XJQJGT.js.map → devServer-534L4U45.js.map} +1 -1
- package/{src/icons/discord.svg → dist/discord-JD33TUSF.svg} +0 -0
- package/{src/utils/Emoji/engine.png → dist/engine-6Q6VSCVA.png} +0 -0
- package/{src/icons/github.svg → dist/github-P5ZSKN2N.svg} +0 -0
- package/{src/icons/heart.svg → dist/heart-OINVKOXO.svg} +0 -0
- package/dist/index.css +121 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +136 -0
- package/dist/index.js +459 -26
- package/dist/index.js.map +1 -1
- package/{src/components/Sponsors/label.svg → dist/label-MP75CTIA.svg} +0 -0
- package/{src/utils/Emoji/mechanical-arm.svg → dist/mechanical-arm-TR7IQQMG.svg} +0 -0
- package/{src/components/Sponsors/medalBronze.svg → dist/medalBronze-CO4CTUR4.svg} +0 -0
- package/{src/components/Sponsors/medalGold.svg → dist/medalGold-UP6A73FL.svg} +0 -0
- package/{src/components/Sponsors/medalSilver.svg → dist/medalSilver-FAPGGOBN.svg} +0 -0
- package/{src/components/Sponsors/companyLogos/mfqs.svg → dist/mfqs-2EAEE7N6.svg} +0 -0
- package/dist/renderer/_default.page.client.css +264 -0
- package/dist/renderer/_default.page.client.css.map +1 -0
- package/dist/renderer/_default.page.client.d.ts +1 -0
- package/dist/renderer/_default.page.client.js +180 -0
- package/dist/renderer/_default.page.client.js.map +1 -0
- package/dist/renderer/_default.page.server.css +312 -0
- package/dist/renderer/_default.page.server.css.map +1 -0
- package/dist/renderer/_default.page.server.d.ts +22 -0
- package/dist/renderer/_default.page.server.js +591 -0
- package/dist/renderer/_default.page.server.js.map +1 -0
- package/{src/utils/Emoji/road-fork.svg → dist/road-fork-3WZLW3HB.svg} +0 -0
- package/{src/utils/Emoji/shield.svg → dist/shield-CU45RG5C.svg} +0 -0
- package/{src/icons/twitter.svg → dist/twitter-I7DXDN3J.svg} +0 -0
- package/{src/utils/Emoji/typescript.svg → dist/typescript-ALIPKLRM.svg} +0 -0
- package/package.json +12 -9
- package/dist/chunk-ZYYJWJMY.js.map +0 -1
- package/src/MobileHeader.tsx +0 -68
- package/src/PageLayout.css +0 -41
- package/src/PageLayout.tsx +0 -37
- package/src/algolia/DocSearch.css +0 -29
- package/src/algolia/DocSearch.ts +0 -37
- package/src/autoScrollNav.ts +0 -22
- package/src/cli/devServer.ts +0 -31
- package/src/cli/index.ts +0 -29
- package/src/components/CodeBlock.tsx +0 -22
- package/src/components/DocLink.tsx +0 -108
- package/src/components/EditPageNote.tsx +0 -18
- package/src/components/HorizontalLine.tsx +0 -20
- package/src/components/ImportMeta.tsx +0 -11
- package/src/components/Info.tsx +0 -12
- package/src/components/Link.tsx +0 -18
- package/src/components/Note.tsx +0 -31
- package/src/components/P.css +0 -8
- package/src/components/P.tsx +0 -8
- package/src/components/ReadingRecommendation.tsx +0 -53
- package/src/components/RepoLink.tsx +0 -24
- package/src/components/Sponsors/companyLogos/ccoli-logo.svg +0 -1
- package/src/components/Sponsors/companyLogos/ccoli-text.svg +0 -1
- package/src/components/Sponsors/label.draft.svg +0 -108
- package/src/components/Sponsors.tsx +0 -242
- package/src/components/features/FeatureList.tsx +0 -114
- package/src/components/features/initFeatureList.ts +0 -66
- package/src/components/index.ts +0 -13
- package/src/config/Config.ts +0 -30
- package/src/config/getConfig.ts +0 -18
- package/src/config/resolveConfig/resolveHeading.ts +0 -0
- package/src/config/resolvePageContext.ts +0 -157
- package/src/css/button.css +0 -7
- package/src/css/code/block.css +0 -36
- package/src/css/code/inline.css +0 -27
- package/src/css/code.css +0 -20
- package/src/css/colorize-on-hover.css +0 -29
- package/src/css/font.css +0 -19
- package/src/css/heading.css +0 -25
- package/src/css/index.css +0 -11
- package/src/css/link.css +0 -17
- package/src/css/note.css +0 -26
- package/src/css/reset.css +0 -12
- package/src/css/table.css +0 -14
- package/src/css/tooltip.css +0 -11
- package/src/headings.ts +0 -200
- package/src/index.ts +0 -3
- package/src/installSectionUrlHashs.ts +0 -50
- package/src/markdownHeadingsVitePlugin.ts +0 -128
- package/src/navigation/Navigation-highlight.css +0 -41
- package/src/navigation/Navigation-items.css +0 -122
- package/src/navigation/Navigation-layout.css +0 -118
- package/src/navigation/Navigation.client.old.ts +0 -303
- package/src/navigation/Navigation.client.ts +0 -19
- package/src/navigation/Navigation.css +0 -12
- package/src/navigation/Navigation.tsx +0 -228
- package/src/navigation/NavigationHeader.tsx +0 -97
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -44
- package/src/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -115
- package/src/parseEmojis.ts +0 -33
- package/src/renderer/_default.page.client.ts +0 -4
- package/src/renderer/_default.page.server.tsx +0 -69
- package/src/renderer/usePageContext.tsx +0 -25
- package/src/types.ts +0 -2
- package/src/utils/Emoji/Emoji.ts +0 -216
- package/src/utils/Emoji/assets.ts +0 -9
- package/src/utils/Emoji/index.ts +0 -1
- package/src/utils/Emoji/mountain.svg +0 -1
- package/src/utils/assert.ts +0 -39
- package/src/utils/client.ts +0 -2
- package/src/utils/crawlAllFiles.ts +0 -17
- package/src/utils/determineSectionUrlHash.ts +0 -35
- package/src/utils/filesystemPathHandling.ts +0 -42
- package/src/utils/filter.ts +0 -12
- package/src/utils/isBrowser.ts +0 -5
- package/src/utils/jsxToTextContent.ts +0 -11
- package/src/utils/objectAssign.ts +0 -9
- package/src/utils/server.ts +0 -8
- package/src/vite.config.ts +0 -44
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PageContextProvider,
|
|
3
|
+
RepoLink,
|
|
4
|
+
getHeadings,
|
|
5
|
+
parseTitle,
|
|
6
|
+
usePageContext
|
|
7
|
+
} from "../chunk-H5CO4N2X.js";
|
|
8
|
+
import {
|
|
9
|
+
Emoji,
|
|
10
|
+
jsxToTextContent,
|
|
11
|
+
objectAssign
|
|
12
|
+
} from "../chunk-7HKDCMSZ.js";
|
|
13
|
+
import {
|
|
14
|
+
assert,
|
|
15
|
+
assertUsage
|
|
16
|
+
} from "../chunk-G2A5MZJA.js";
|
|
17
|
+
import {
|
|
18
|
+
__template
|
|
19
|
+
} from "../chunk-TTLAZ2T2.js";
|
|
20
|
+
|
|
21
|
+
// src/renderer/_default.page.server.tsx
|
|
22
|
+
import ReactDOMServer from "react-dom/server";
|
|
23
|
+
import React7 from "react";
|
|
24
|
+
import { escapeInject as escapeInject2, dangerouslySkipEscape } from "vite-plugin-ssr";
|
|
25
|
+
|
|
26
|
+
// src/PageLayout.tsx
|
|
27
|
+
import React6 from "react";
|
|
28
|
+
|
|
29
|
+
// src/navigation/Navigation.tsx
|
|
30
|
+
import React3 from "react";
|
|
31
|
+
|
|
32
|
+
// src/navigation/NavigationHeader.tsx
|
|
33
|
+
import React from "react";
|
|
34
|
+
|
|
35
|
+
// src/icons/github.svg
|
|
36
|
+
var github_default = "/assets/github-P5ZSKN2N.svg";
|
|
37
|
+
|
|
38
|
+
// src/icons/twitter.svg
|
|
39
|
+
var twitter_default = "/assets/twitter-I7DXDN3J.svg";
|
|
40
|
+
|
|
41
|
+
// src/icons/discord.svg
|
|
42
|
+
var discord_default = "/assets/discord-JD33TUSF.svg";
|
|
43
|
+
|
|
44
|
+
// src/icons/changelog.svg
|
|
45
|
+
var changelog_default = "/assets/changelog-IPI5F42D.svg";
|
|
46
|
+
|
|
47
|
+
// src/navigation/NavigationHeader.tsx
|
|
48
|
+
function NavigationHeader() {
|
|
49
|
+
const pageContext = usePageContext();
|
|
50
|
+
return /* @__PURE__ */ React.createElement(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
id: "navigation-header",
|
|
54
|
+
style: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
marginBottom: -5
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
/* @__PURE__ */ React.createElement(
|
|
62
|
+
"a",
|
|
63
|
+
{
|
|
64
|
+
id: "navigation-header-logo",
|
|
65
|
+
style: {
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
color: "inherit",
|
|
69
|
+
justifyContent: "left",
|
|
70
|
+
textDecoration: "none",
|
|
71
|
+
paddingTop: 12,
|
|
72
|
+
paddingBottom: 7
|
|
73
|
+
},
|
|
74
|
+
href: "/"
|
|
75
|
+
},
|
|
76
|
+
pageContext.config.navHeader
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ React.createElement(Links, null)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function Links() {
|
|
82
|
+
const pageContext = usePageContext();
|
|
83
|
+
const { projectInfo } = pageContext.config;
|
|
84
|
+
return /* @__PURE__ */ React.createElement(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
style: {
|
|
88
|
+
display: "flex",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
paddingTop: 0,
|
|
91
|
+
justifyContent: "left"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
/* @__PURE__ */ React.createElement(SocialLink, { className: "decolorize-4", icon: github_default, href: projectInfo.githubRepository }),
|
|
95
|
+
/* @__PURE__ */ React.createElement(SocialLink, { className: "decolorize-6", icon: discord_default, href: projectInfo.discordInvite }),
|
|
96
|
+
/* @__PURE__ */ React.createElement(SocialLink, { className: "decolorize-7", icon: twitter_default, href: projectInfo.twitterProfile }),
|
|
97
|
+
/* @__PURE__ */ React.createElement("div", { id: "docsearch-desktop" }),
|
|
98
|
+
/* @__PURE__ */ React.createElement(ChangelogButton, null)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function ChangelogButton() {
|
|
102
|
+
const pageContext = usePageContext();
|
|
103
|
+
const { projectInfo } = pageContext.config;
|
|
104
|
+
return /* @__PURE__ */ React.createElement(
|
|
105
|
+
"a",
|
|
106
|
+
{
|
|
107
|
+
href: `${projectInfo.githubRepository}/blob/main/CHANGELOG.md`,
|
|
108
|
+
className: "button colorize-on-hover",
|
|
109
|
+
style: {
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
padding: "1px 7px",
|
|
113
|
+
marginLeft: 2,
|
|
114
|
+
fontSize: "0.97em",
|
|
115
|
+
color: "inherit"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
/* @__PURE__ */ React.createElement("span", { className: "decolorize-7" }, "v", projectInfo.projectVersion),
|
|
119
|
+
/* @__PURE__ */ React.createElement("img", { className: "decolorize-6", src: changelog_default, height: 16, style: { marginLeft: 5 } })
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function SocialLink({ className, icon, href }) {
|
|
123
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
124
|
+
"a",
|
|
125
|
+
{
|
|
126
|
+
className: "colorize-on-hover " + className,
|
|
127
|
+
href,
|
|
128
|
+
style: { padding: 3, display: "inline-block", lineHeight: 0 }
|
|
129
|
+
},
|
|
130
|
+
/* @__PURE__ */ React.createElement("img", { src: icon, height: "20", style: {} })
|
|
131
|
+
));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx
|
|
135
|
+
import React2 from "react";
|
|
136
|
+
|
|
137
|
+
// src/navigation/navigation-fullscreen/close.svg
|
|
138
|
+
var close_default = "/assets/close-IQXTDOHV.svg";
|
|
139
|
+
|
|
140
|
+
// src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx
|
|
141
|
+
function NavigationFullscreenButton() {
|
|
142
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("a", { id: "navigation-fullscreen-button" }, /* @__PURE__ */ React2.createElement(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
style: {
|
|
146
|
+
position: "fixed",
|
|
147
|
+
cursor: "pointer",
|
|
148
|
+
height: "100vh",
|
|
149
|
+
width: 20,
|
|
150
|
+
overflow: "hidden"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
/* @__PURE__ */ React2.createElement("div", null)
|
|
154
|
+
), /* @__PURE__ */ React2.createElement(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
style: { position: "fixed", height: "100vh", width: 20 },
|
|
158
|
+
"aria-label": "Press <Esc>",
|
|
159
|
+
"data-balloon-pos": "right"
|
|
160
|
+
}
|
|
161
|
+
)));
|
|
162
|
+
}
|
|
163
|
+
function NavigationFullscreenClose() {
|
|
164
|
+
return /* @__PURE__ */ React2.createElement(
|
|
165
|
+
"a",
|
|
166
|
+
{
|
|
167
|
+
id: "navigation-fullscreen-close",
|
|
168
|
+
style: { position: "fixed", top: 11, right: 15, zIndex: 10 },
|
|
169
|
+
"aria-label": "Press <Esc>",
|
|
170
|
+
"data-balloon-pos": "left"
|
|
171
|
+
},
|
|
172
|
+
/* @__PURE__ */ React2.createElement("img", { src: close_default, height: 50, width: 50, style: { display: "block" } })
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/navigation/Navigation.tsx
|
|
177
|
+
function Navigation({
|
|
178
|
+
pageContext
|
|
179
|
+
}) {
|
|
180
|
+
const { isDetachedPage } = pageContext;
|
|
181
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("div", { id: "navigation-container" }, /* @__PURE__ */ React3.createElement(NavigationHeader, null), isDetachedPage && /* @__PURE__ */ React3.createElement(DetachedPageNote, null), /* @__PURE__ */ React3.createElement(NavigationContent, { pageContext }), /* @__PURE__ */ React3.createElement(NavigationFullscreenClose, null)));
|
|
182
|
+
}
|
|
183
|
+
function NavigationMask() {
|
|
184
|
+
return /* @__PURE__ */ React3.createElement("div", { id: "navigation-mask" });
|
|
185
|
+
}
|
|
186
|
+
function NavigationContent({
|
|
187
|
+
pageContext
|
|
188
|
+
}) {
|
|
189
|
+
const headings = getHeadingsWithComputedProps(pageContext);
|
|
190
|
+
const headingsGrouped = groupHeadings(headings);
|
|
191
|
+
return /* @__PURE__ */ React3.createElement("div", { id: "navigation-content" }, /* @__PURE__ */ React3.createElement("div", { className: "nav-column", style: { position: "relative" } }, headingsGrouped.map((headingsH1, i) => /* @__PURE__ */ React3.createElement("div", { className: "nav-h1-group", key: i }, /* @__PURE__ */ React3.createElement(Heading, { heading: headingsH1 }), headingsH1.headings.map((heading, j) => /* @__PURE__ */ React3.createElement(Heading, { heading, key: j }))))));
|
|
192
|
+
}
|
|
193
|
+
function Heading({
|
|
194
|
+
heading
|
|
195
|
+
}) {
|
|
196
|
+
assert([1, 2, 3, 4].includes(heading.level), heading);
|
|
197
|
+
return /* @__PURE__ */ React3.createElement(
|
|
198
|
+
"a",
|
|
199
|
+
{
|
|
200
|
+
className: [
|
|
201
|
+
"nav-item",
|
|
202
|
+
"nav-item-h" + heading.level,
|
|
203
|
+
heading.computed.isActive && " is-active",
|
|
204
|
+
heading.computed.isActiveFirst && " is-active-first",
|
|
205
|
+
heading.computed.isActiveLast && " is-active-last",
|
|
206
|
+
heading.computed.isChildOfListHeading && "nav-item-parent-is-list-heading",
|
|
207
|
+
heading.computed.isFirstOfItsKind && "nav-item-first-of-its-kind",
|
|
208
|
+
heading.computed.isLastOfItsKind && "nav-item-last-of-its-kind"
|
|
209
|
+
].filter(Boolean).join(" "),
|
|
210
|
+
href: heading.url || void 0
|
|
211
|
+
},
|
|
212
|
+
heading.titleInNav
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
function groupHeadings(headings) {
|
|
216
|
+
const headingsGrouped = [];
|
|
217
|
+
headings.forEach((heading) => {
|
|
218
|
+
if (heading.level === 1) {
|
|
219
|
+
headingsGrouped.push({ ...heading, headings: [] });
|
|
220
|
+
} else {
|
|
221
|
+
headingsGrouped[headingsGrouped.length - 1].headings.push(heading);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return headingsGrouped;
|
|
225
|
+
}
|
|
226
|
+
function getHeadingsWithComputedProps(pageContext) {
|
|
227
|
+
const { headingsWithSubHeadings, urlPathname } = pageContext;
|
|
228
|
+
return headingsWithSubHeadings.map((heading, i) => {
|
|
229
|
+
var _a2;
|
|
230
|
+
assert([1, 2, 3, 4].includes(heading.level), heading);
|
|
231
|
+
const headingPrevious = headingsWithSubHeadings[i - 1];
|
|
232
|
+
const headingNext = headingsWithSubHeadings[i + 1];
|
|
233
|
+
let isActiveFirst = false;
|
|
234
|
+
let isActiveLast = false;
|
|
235
|
+
let isActive = false;
|
|
236
|
+
if (heading.url === urlPathname) {
|
|
237
|
+
assert(heading.level === 2, { urlPathname });
|
|
238
|
+
isActive = true;
|
|
239
|
+
isActiveFirst = true;
|
|
240
|
+
if ((headingNext == null ? void 0 : headingNext.level) !== 3) {
|
|
241
|
+
isActiveLast = true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (heading.level === 3) {
|
|
245
|
+
isActive = true;
|
|
246
|
+
if ((headingNext == null ? void 0 : headingNext.level) !== 3) {
|
|
247
|
+
isActiveLast = true;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const isFirstOfItsKind = heading.level !== (headingPrevious == null ? void 0 : headingPrevious.level);
|
|
251
|
+
const isLastOfItsKind = heading.level !== (headingNext == null ? void 0 : headingNext.level);
|
|
252
|
+
const isChildOfListHeading = !!((_a2 = heading.parentHeadings[0]) == null ? void 0 : _a2.isListTitle);
|
|
253
|
+
return {
|
|
254
|
+
...heading,
|
|
255
|
+
computed: {
|
|
256
|
+
isActive,
|
|
257
|
+
isActiveFirst,
|
|
258
|
+
isActiveLast,
|
|
259
|
+
isFirstOfItsKind,
|
|
260
|
+
isLastOfItsKind,
|
|
261
|
+
isChildOfListHeading
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function DetachedPageNote() {
|
|
267
|
+
return /* @__PURE__ */ React3.createElement(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
id: "detached-note",
|
|
271
|
+
style: {
|
|
272
|
+
backgroundColor: "var(--background-color)",
|
|
273
|
+
textAlign: "left",
|
|
274
|
+
marginLeft: 10,
|
|
275
|
+
marginRight: 10,
|
|
276
|
+
marginTop: 30,
|
|
277
|
+
marginBottom: -8,
|
|
278
|
+
borderRadius: 5,
|
|
279
|
+
padding: 10
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
/* @__PURE__ */ React3.createElement(Emoji, { name: "info" }),
|
|
283
|
+
" ",
|
|
284
|
+
/* @__PURE__ */ React3.createElement("b", null, /* @__PURE__ */ React3.createElement("em", null, "Detached")),
|
|
285
|
+
/* @__PURE__ */ React3.createElement(
|
|
286
|
+
"span",
|
|
287
|
+
{
|
|
288
|
+
style: {
|
|
289
|
+
opacity: 0.8
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
" ",
|
|
293
|
+
"\u2014 this page isn't listed in the navigation menu below."
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// src/MobileHeader.tsx
|
|
299
|
+
import React4 from "react";
|
|
300
|
+
function MobileHeader() {
|
|
301
|
+
const pageContext = usePageContext();
|
|
302
|
+
return /* @__PURE__ */ React4.createElement(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
id: "mobile-header",
|
|
306
|
+
style: {
|
|
307
|
+
height: "var(--mobile-header-height)",
|
|
308
|
+
width: "100vw",
|
|
309
|
+
position: "relative"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
/* @__PURE__ */ React4.createElement(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
style: {
|
|
316
|
+
position: "fixed",
|
|
317
|
+
display: "flex",
|
|
318
|
+
alignItems: "center",
|
|
319
|
+
background: "white",
|
|
320
|
+
zIndex: 99,
|
|
321
|
+
top: 0,
|
|
322
|
+
left: 0,
|
|
323
|
+
height: "var(--mobile-header-height)",
|
|
324
|
+
width: "100%",
|
|
325
|
+
borderBottom: "1px solid #ddd"
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
/* @__PURE__ */ React4.createElement(MenuToggle, null),
|
|
329
|
+
/* @__PURE__ */ React4.createElement(
|
|
330
|
+
"a",
|
|
331
|
+
{
|
|
332
|
+
href: "/",
|
|
333
|
+
style: {
|
|
334
|
+
color: "inherit",
|
|
335
|
+
display: "flex",
|
|
336
|
+
alignItems: "center",
|
|
337
|
+
justifyContent: "left",
|
|
338
|
+
textDecoration: "none"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
pageContext.config.navHeaderMobile
|
|
342
|
+
),
|
|
343
|
+
/* @__PURE__ */ React4.createElement("div", { id: "docsearch-mobile" })
|
|
344
|
+
)
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
function MenuToggle() {
|
|
348
|
+
return /* @__PURE__ */ React4.createElement("div", { style: { padding: 20, lineHeight: 0 }, id: "menu-toggle" }, /* @__PURE__ */ React4.createElement(
|
|
349
|
+
"svg",
|
|
350
|
+
{
|
|
351
|
+
style: { width: 20 },
|
|
352
|
+
className: "icon",
|
|
353
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
354
|
+
"aria-hidden": "true",
|
|
355
|
+
role: "img",
|
|
356
|
+
viewBox: "0 0 448 512"
|
|
357
|
+
},
|
|
358
|
+
/* @__PURE__ */ React4.createElement(
|
|
359
|
+
"path",
|
|
360
|
+
{
|
|
361
|
+
fill: "currentColor",
|
|
362
|
+
d: "M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// src/components/EditPageNote.tsx
|
|
369
|
+
import React5 from "react";
|
|
370
|
+
function EditPageNote({ pageContext }) {
|
|
371
|
+
const text = /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Emoji, { name: "writing-hang" }), " Edit this page");
|
|
372
|
+
return /* @__PURE__ */ React5.createElement("div", { style: { marginTop: 50 } }, /* @__PURE__ */ React5.createElement(RepoLink, { path: "/docs/pages" + pageContext.urlPathname + ".page.server.mdx", text, editMode: true }));
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// src/PageLayout.tsx
|
|
376
|
+
function PageLayout({ pageContext, children }) {
|
|
377
|
+
const { isLandingPage, pageTitle } = pageContext;
|
|
378
|
+
return /* @__PURE__ */ React6.createElement(React6.StrictMode, null, /* @__PURE__ */ React6.createElement(PageContextProvider, { pageContext }, /* @__PURE__ */ React6.createElement("div", { id: "page-layout", className: isLandingPage ? "landing-page" : "doc-page" }, /* @__PURE__ */ React6.createElement("div", { id: "navigation-wrapper" }, /* @__PURE__ */ React6.createElement(Navigation, { pageContext })), /* @__PURE__ */ React6.createElement(NavigationFullscreenButton, null), /* @__PURE__ */ React6.createElement("div", { id: "page-wrapper" }, /* @__PURE__ */ React6.createElement("div", { id: "page-container" }, /* @__PURE__ */ React6.createElement(MobileHeader, null), /* @__PURE__ */ React6.createElement("div", { id: "page-content" }, pageTitle && /* @__PURE__ */ React6.createElement("h1", null, pageTitle), children, !isLandingPage && /* @__PURE__ */ React6.createElement(EditPageNote, { pageContext }))), /* @__PURE__ */ React6.createElement(NavigationMask, null)))));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// src/config/getConfig.ts
|
|
382
|
+
function getConfig() {
|
|
383
|
+
const globResult = import.meta.glob("/**/docpress.config.*([a-zA-Z0-9])", { eager: true });
|
|
384
|
+
const files = Object.keys(globResult);
|
|
385
|
+
assertUsage(files.length >= 1, "No DocPress config file found `docpress.config.(js|ts|tsx|...)`");
|
|
386
|
+
assertUsage(
|
|
387
|
+
files.length === 1,
|
|
388
|
+
`Found multiple \`docpress.config.js\` files: ${files.map((f) => `\`${f}\``).join(", ")}. Define only one instead.`
|
|
389
|
+
);
|
|
390
|
+
const config = Object.values(globResult)[0].default;
|
|
391
|
+
assert(config);
|
|
392
|
+
return config;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// src/config/resolvePageContext.ts
|
|
396
|
+
function resolvePageContext(pageContext) {
|
|
397
|
+
const config = getConfig();
|
|
398
|
+
const { headings, headingsWithoutLink } = getHeadings(config);
|
|
399
|
+
const activeHeading = findActiveHeading(headings, headingsWithoutLink, pageContext);
|
|
400
|
+
const headingsWithSubHeadings = getHeadingsWithSubHeadings(headings, pageContext, activeHeading);
|
|
401
|
+
const { title, isLandingPage, pageTitle, isDetachedPage } = getMetaData(
|
|
402
|
+
headingsWithoutLink,
|
|
403
|
+
activeHeading,
|
|
404
|
+
pageContext,
|
|
405
|
+
config
|
|
406
|
+
);
|
|
407
|
+
const { faviconUrl, algolia, tagline, twitterHandle, bannerUrl, websiteUrl } = config;
|
|
408
|
+
const pageContextResolved = {};
|
|
409
|
+
objectAssign(pageContextResolved, {
|
|
410
|
+
...pageContext,
|
|
411
|
+
meta: {
|
|
412
|
+
title,
|
|
413
|
+
faviconUrl,
|
|
414
|
+
twitterHandle,
|
|
415
|
+
bannerUrl,
|
|
416
|
+
websiteUrl,
|
|
417
|
+
tagline,
|
|
418
|
+
algolia
|
|
419
|
+
},
|
|
420
|
+
headings,
|
|
421
|
+
headingsWithSubHeadings,
|
|
422
|
+
isLandingPage,
|
|
423
|
+
isDetachedPage,
|
|
424
|
+
pageTitle,
|
|
425
|
+
config
|
|
426
|
+
});
|
|
427
|
+
return pageContextResolved;
|
|
428
|
+
}
|
|
429
|
+
function getMetaData(headingsWithoutLink, activeHeading, pageContext, config) {
|
|
430
|
+
const url = pageContext.urlOriginal;
|
|
431
|
+
let title;
|
|
432
|
+
let pageTitle;
|
|
433
|
+
let isDetachedPage;
|
|
434
|
+
if (activeHeading) {
|
|
435
|
+
title = activeHeading.titleDocument || jsxToTextContent(activeHeading.title);
|
|
436
|
+
pageTitle = activeHeading.title;
|
|
437
|
+
isDetachedPage = false;
|
|
438
|
+
} else {
|
|
439
|
+
pageTitle = headingsWithoutLink.find((h) => h.url === url).title;
|
|
440
|
+
title = jsxToTextContent(pageTitle);
|
|
441
|
+
isDetachedPage = true;
|
|
442
|
+
}
|
|
443
|
+
const isLandingPage = url === "/";
|
|
444
|
+
if (!isLandingPage) {
|
|
445
|
+
title += " | " + config.projectInfo.projectName;
|
|
446
|
+
}
|
|
447
|
+
if (isLandingPage) {
|
|
448
|
+
pageTitle = null;
|
|
449
|
+
}
|
|
450
|
+
return { title, isLandingPage, pageTitle, isDetachedPage };
|
|
451
|
+
}
|
|
452
|
+
function findActiveHeading(headings, headingsWithoutLink, pageContext) {
|
|
453
|
+
let activeHeading = null;
|
|
454
|
+
assert(pageContext.urlOriginal);
|
|
455
|
+
const pageUrl = pageContext.urlOriginal;
|
|
456
|
+
headings.forEach((heading) => {
|
|
457
|
+
if (heading.url === pageUrl) {
|
|
458
|
+
activeHeading = heading;
|
|
459
|
+
assert(heading.level === 2, { pageUrl, heading });
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
const debugInfo = {
|
|
463
|
+
msg: "Heading not found for url: " + pageUrl,
|
|
464
|
+
urls: headings.map((h) => h.url),
|
|
465
|
+
url: pageUrl
|
|
466
|
+
};
|
|
467
|
+
assert(activeHeading || headingsWithoutLink.find(({ url }) => pageUrl === url), debugInfo);
|
|
468
|
+
return activeHeading;
|
|
469
|
+
}
|
|
470
|
+
function getHeadingsWithSubHeadings(headings, pageContext, activeHeading) {
|
|
471
|
+
const headingsWithSubHeadings = headings.slice();
|
|
472
|
+
if (activeHeading === null)
|
|
473
|
+
return headingsWithSubHeadings;
|
|
474
|
+
const activeHeadingIdx = headingsWithSubHeadings.indexOf(activeHeading);
|
|
475
|
+
assert(activeHeadingIdx >= 0);
|
|
476
|
+
const pageHeadings = pageContext.exports.headings || [];
|
|
477
|
+
pageHeadings.forEach((pageHeading, i) => {
|
|
478
|
+
const title = parseTitle(pageHeading.title);
|
|
479
|
+
const url = "#" + pageHeading.id;
|
|
480
|
+
assert(
|
|
481
|
+
pageHeading.headingLevel !== 3,
|
|
482
|
+
"Wrong page heading level `" + pageHeading.headingLevel + "` (it should be `<h2>`) for sub-heading `" + pageHeading.title + "` of page `" + pageContext.urlOriginal + "`."
|
|
483
|
+
);
|
|
484
|
+
if (pageHeading.headingLevel === 2) {
|
|
485
|
+
const heading = {
|
|
486
|
+
url,
|
|
487
|
+
title,
|
|
488
|
+
parentHeadings: [activeHeading, ...activeHeading.parentHeadings],
|
|
489
|
+
titleInNav: title,
|
|
490
|
+
level: 3
|
|
491
|
+
};
|
|
492
|
+
headingsWithSubHeadings.splice(activeHeadingIdx + 1 + i, 0, heading);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
if (activeHeading == null ? void 0 : activeHeading.sectionTitles) {
|
|
496
|
+
activeHeading.sectionTitles.forEach((sectionTitle) => {
|
|
497
|
+
const pageHeadingTitles = pageHeadings.map((h) => h.title);
|
|
498
|
+
assert(pageHeadingTitles.includes(sectionTitle), { pageHeadingTitles, sectionTitle });
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
return headingsWithSubHeadings;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// src/algolia/DocSearch.ts
|
|
505
|
+
import { escapeInject } from "vite-plugin-ssr";
|
|
506
|
+
function getDocSearchCSS(pageContext) {
|
|
507
|
+
const docSearchCSS = !pageContext.meta.algolia ? "" : escapeInject`
|
|
508
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@alpha" />
|
|
509
|
+
`;
|
|
510
|
+
return docSearchCSS;
|
|
511
|
+
}
|
|
512
|
+
var _a;
|
|
513
|
+
function getDocSearchJS(pageContext) {
|
|
514
|
+
const docSearchJS = !pageContext.meta.algolia ? "" : escapeInject(_a || (_a = __template([`
|
|
515
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"><\/script>
|
|
516
|
+
<script type="text/javascript">
|
|
517
|
+
docsearch({
|
|
518
|
+
appId: '`, "',\n apiKey: '", "',\n indexName: '", "',\n container: '#docsearch-desktop',\n })\n docsearch({\n appId: '", "',\n apiKey: '", "',\n indexName: '", "',\n container: '#docsearch-mobile',\n })\n <\/script>\n "])), pageContext.meta.algolia.appId, pageContext.meta.algolia.apiKey, pageContext.meta.algolia.indexName, pageContext.meta.algolia.appId, pageContext.meta.algolia.apiKey, pageContext.meta.algolia.indexName);
|
|
519
|
+
return docSearchJS;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/parseEmojis.ts
|
|
523
|
+
import twemoji from "twemoji";
|
|
524
|
+
var emojiList = {
|
|
525
|
+
":no_entry:": 9940,
|
|
526
|
+
":warning:": 9888,
|
|
527
|
+
":trophy:": 127942
|
|
528
|
+
};
|
|
529
|
+
function parseEmojis(html) {
|
|
530
|
+
Object.entries(emojiList).forEach(([shortcode, codepoint]) => {
|
|
531
|
+
if (!html.includes(shortcode)) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const emojiStr = twemoji.convert.fromCodePoint(codepoint);
|
|
535
|
+
let emojiImg = twemoji.parse(emojiStr, {
|
|
536
|
+
folder: "svg",
|
|
537
|
+
ext: ".svg"
|
|
538
|
+
});
|
|
539
|
+
const style = "height: 1.275em; width: 1.275em; vertical-align: -20%";
|
|
540
|
+
emojiImg = emojiImg.replace('<img class="emoji" ', `<img style="${style}" `);
|
|
541
|
+
html = html.split(shortcode).join(emojiImg);
|
|
542
|
+
});
|
|
543
|
+
return html;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// src/renderer/_default.page.server.tsx
|
|
547
|
+
async function render(pageContextOriginal) {
|
|
548
|
+
const { Page } = pageContextOriginal;
|
|
549
|
+
const pageContextResolved = resolvePageContext(pageContextOriginal);
|
|
550
|
+
const page = /* @__PURE__ */ React7.createElement(PageLayout, { pageContext: pageContextResolved }, /* @__PURE__ */ React7.createElement(Page, null));
|
|
551
|
+
const descriptionTag = pageContextResolved.isLandingPage ? dangerouslySkipEscape(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`) : "";
|
|
552
|
+
const docSearchJS = getDocSearchJS(pageContextResolved);
|
|
553
|
+
const docSearchCSS = getDocSearchCSS(pageContextResolved);
|
|
554
|
+
let pageHtml = ReactDOMServer.renderToString(page);
|
|
555
|
+
pageHtml = parseEmojis(pageHtml);
|
|
556
|
+
return escapeInject2`<!DOCTYPE html>
|
|
557
|
+
<html>
|
|
558
|
+
<head>
|
|
559
|
+
<meta charset="UTF-8" />
|
|
560
|
+
<link rel="icon" href="${pageContextResolved.meta.faviconUrl}" />
|
|
561
|
+
<title>${pageContextResolved.meta.title}</title>
|
|
562
|
+
${descriptionTag}
|
|
563
|
+
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
|
|
564
|
+
${docSearchCSS}
|
|
565
|
+
${getOpenGraphTags(pageContextOriginal.urlPathname, pageContextResolved.meta)}
|
|
566
|
+
</head>
|
|
567
|
+
<body>
|
|
568
|
+
<div id="page-view">${dangerouslySkipEscape(pageHtml)}</div>
|
|
569
|
+
${docSearchJS}
|
|
570
|
+
</body>
|
|
571
|
+
</html>`;
|
|
572
|
+
}
|
|
573
|
+
function getOpenGraphTags(url, meta) {
|
|
574
|
+
const { title, tagline, websiteUrl, twitterHandle, bannerUrl } = meta;
|
|
575
|
+
assert(url.startsWith("/"));
|
|
576
|
+
if (url !== "/" || !bannerUrl)
|
|
577
|
+
return "";
|
|
578
|
+
return escapeInject2`
|
|
579
|
+
<meta property="og:type" content="website">
|
|
580
|
+
<meta property="og:title" content="${title}">
|
|
581
|
+
<meta property="og:image" content="${bannerUrl}">
|
|
582
|
+
<meta property="og:url" content="${websiteUrl}">
|
|
583
|
+
<meta property="og:description" content="${tagline}">
|
|
584
|
+
<meta name="twitter:card" content="summary_large_image">
|
|
585
|
+
<meta name="twitter:site" content="${twitterHandle}">
|
|
586
|
+
`;
|
|
587
|
+
}
|
|
588
|
+
export {
|
|
589
|
+
render
|
|
590
|
+
};
|
|
591
|
+
//# sourceMappingURL=_default.page.server.js.map
|