@brillout/docpress 0.9.3 → 0.9.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/Layout.tsx +40 -17
- package/NavSecondaryContent.tsx +2 -1
- package/components/RepoLink.tsx +3 -2
- package/dist/Layout.d.ts +1 -1
- package/dist/Layout.js +27 -21
- package/dist/NavSecondaryContent.d.ts +0 -1
- package/dist/NavSecondaryContent.js +1 -1
- package/dist/components/RepoLink.js +3 -1
- package/dist/docsearch/SearchLink.js +1 -1
- package/dist/renderer/usePageContext.js +6 -1
- package/dist/types/Config.d.ts +1 -0
- package/docsearch/SearchLink.tsx +1 -1
- package/package.json +1 -1
- package/renderer/usePageContext.tsx +6 -1
- package/types/Config.ts +1 -0
package/Layout.tsx
CHANGED
|
@@ -26,13 +26,10 @@ const mainViewPadding = 20
|
|
|
26
26
|
const mainViewWidthMax = 800
|
|
27
27
|
const navLeftWidthMax = 370
|
|
28
28
|
const navLeftWidthMin = 300
|
|
29
|
-
// 840 = 800 + 20 * 2
|
|
30
|
-
const mainViewMax = mainViewWidthMax + mainViewPadding * 2
|
|
29
|
+
const mainViewMax = (mainViewWidthMax + mainViewPadding * 2) as 840 // 840 = 800 + 20 * 2
|
|
31
30
|
const containerQueryMobileMenu = 1000
|
|
32
|
-
// 1143 = 840 + 300
|
|
33
|
-
const
|
|
34
|
-
// 1213 = 840 + 370 + 3
|
|
35
|
-
const containerQueryExtraSpace = mainViewMax + navLeftWidthMax + blockMargin
|
|
31
|
+
const containerQueryMobileLayout = (mainViewMax + navLeftWidthMin) as 1143 // 1143 = 840 + 300
|
|
32
|
+
const containerQueryExtraSpace = (mainViewMax + navLeftWidthMax + blockMargin) as 1213 // 1213 = 840 + 370 + 3
|
|
36
33
|
|
|
37
34
|
// Avoid whitespace at the bottom of pages with almost no content
|
|
38
35
|
const whitespaceBuster1: React.CSSProperties = {
|
|
@@ -61,7 +58,8 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
61
58
|
['--bg-color']: '#f5f5f7',
|
|
62
59
|
['--block-margin']: `${blockMargin}px`,
|
|
63
60
|
['--icon-text-padding']: '8px',
|
|
64
|
-
['--nav-head-height']: `${isLandingPage ? 70 : 60}px`,
|
|
61
|
+
// ['--nav-head-height']: `${isLandingPage ? 70 : 60}px`,
|
|
62
|
+
['--nav-head-height']: `60px`,
|
|
65
63
|
}}
|
|
66
64
|
>
|
|
67
65
|
<MenuModal isTopNav={isLandingPage} />
|
|
@@ -89,7 +87,11 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
|
89
87
|
<style>{getStyle()}</style>
|
|
90
88
|
<div style={{ display: 'flex', ...whitespaceBuster2 }}>
|
|
91
89
|
<NavLeft />
|
|
92
|
-
<div
|
|
90
|
+
<div
|
|
91
|
+
id="nav-left-margin"
|
|
92
|
+
className="low-prio-grow"
|
|
93
|
+
style={{ width: 0, maxWidth: 50, background: 'var(--bg-color)' }}
|
|
94
|
+
/>
|
|
93
95
|
<PageContent>{children}</PageContent>
|
|
94
96
|
</div>
|
|
95
97
|
</>
|
|
@@ -246,6 +248,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
246
248
|
const pageContext2 = usePageContext2()
|
|
247
249
|
const { projectName } = pageContext.meta
|
|
248
250
|
const { isLandingPage } = pageContext
|
|
251
|
+
const { navMaxWidth } = pageContext.config
|
|
249
252
|
|
|
250
253
|
const linkStyle: React.CSSProperties = {
|
|
251
254
|
height: '100%',
|
|
@@ -256,7 +259,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
256
259
|
const TopNavigation = pageContext2.config.TopNavigation || PassThrough
|
|
257
260
|
const navSecondaryContent = (
|
|
258
261
|
<div
|
|
259
|
-
className={isNavLeft ? 'show-on-nav-hover add-transition' : 'hide-on-shrink'}
|
|
262
|
+
className={isNavLeft ? 'show-on-nav-hover add-transition' : 'hide-on-shrink desktop-grow'}
|
|
260
263
|
style={{
|
|
261
264
|
padding: 0,
|
|
262
265
|
display: 'flex',
|
|
@@ -274,6 +277,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
274
277
|
}}
|
|
275
278
|
>
|
|
276
279
|
<TopNavigation />
|
|
280
|
+
<div className="desktop-grow" />
|
|
277
281
|
<NavSecondaryContent
|
|
278
282
|
style={{
|
|
279
283
|
display: 'inline-flex',
|
|
@@ -309,6 +313,8 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
309
313
|
className="nav-head-content"
|
|
310
314
|
style={{
|
|
311
315
|
width: '100%',
|
|
316
|
+
maxWidth: navMaxWidth,
|
|
317
|
+
margin: 'auto',
|
|
312
318
|
height: 'var(--nav-head-height)',
|
|
313
319
|
fontSize: `min(16.96px, ${isProjectNameShort(projectName) ? '4.8cqw' : '4.5cqw'})`,
|
|
314
320
|
color: '#666',
|
|
@@ -317,9 +323,10 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
317
323
|
justifyContent: 'center',
|
|
318
324
|
}}
|
|
319
325
|
>
|
|
320
|
-
<NavLogo className="grow-half" />
|
|
321
|
-
<
|
|
322
|
-
<
|
|
326
|
+
<NavLogo className="mobile-grow-half" />
|
|
327
|
+
<div className="desktop-grow" />
|
|
328
|
+
<SearchLink className="mobile-grow-half" style={linkStyle} />
|
|
329
|
+
<MenuLink className="mobile-grow-full" style={linkStyle} />
|
|
323
330
|
{navSecondaryContent}
|
|
324
331
|
</div>
|
|
325
332
|
</div>
|
|
@@ -330,10 +337,10 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
330
337
|
function getStyle() {
|
|
331
338
|
let style = css`
|
|
332
339
|
@container container-nav-head (max-width: 550px) {
|
|
333
|
-
.grow-full {
|
|
340
|
+
.mobile-grow-full {
|
|
334
341
|
flex-grow: 1;
|
|
335
342
|
}
|
|
336
|
-
.grow-half {
|
|
343
|
+
.mobile-grow-half {
|
|
337
344
|
flex-grow: 0.5;
|
|
338
345
|
}
|
|
339
346
|
.nav-head-content {
|
|
@@ -358,7 +365,23 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
358
365
|
}
|
|
359
366
|
}
|
|
360
367
|
`
|
|
361
|
-
if (
|
|
368
|
+
if (navMaxWidth) {
|
|
369
|
+
style += css`
|
|
370
|
+
@media(min-width: ${containerQueryMobileMenu + 1}px) {
|
|
371
|
+
.desktop-grow {
|
|
372
|
+
flex-grow: 1;
|
|
373
|
+
}
|
|
374
|
+
.desktop-fade {
|
|
375
|
+
transition: opacity 0.3s ease-in-out !important;
|
|
376
|
+
}
|
|
377
|
+
html:not(.menu-modal-show) .nav-head-top:not(:hover) .desktop-fade {
|
|
378
|
+
transition: opacity 0.3s ease-in-out !important;
|
|
379
|
+
opacity: 0.5;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
`
|
|
383
|
+
}
|
|
384
|
+
if (isLandingPage && !navMaxWidth)
|
|
362
385
|
style += css`
|
|
363
386
|
@media(min-width: ${containerQueryMobileMenu + 1}px) {
|
|
364
387
|
.nav-logo {
|
|
@@ -521,7 +544,7 @@ function MenuLink(props: PropsDiv) {
|
|
|
521
544
|
}
|
|
522
545
|
function DocsIcon() {
|
|
523
546
|
return (
|
|
524
|
-
<span style={{ marginRight: 'calc(var(--icon-text-padding) + 2px)' }} className="decolorize-6">
|
|
547
|
+
<span style={{ marginRight: 'calc(var(--icon-text-padding) + 2px)' }} className="decolorize-6 desktop-fade">
|
|
525
548
|
📚
|
|
526
549
|
</span>
|
|
527
550
|
)
|
|
@@ -530,7 +553,7 @@ function MenuIcon() {
|
|
|
530
553
|
return (
|
|
531
554
|
<svg
|
|
532
555
|
style={{ marginRight: 'calc(var(--icon-text-padding) + 2px)', verticalAlign: 'top', width: '1.3em' }}
|
|
533
|
-
className="decolorize-6"
|
|
556
|
+
className="decolorize-6 desktop-fade"
|
|
534
557
|
viewBox="0 0 448 512"
|
|
535
558
|
>
|
|
536
559
|
<path
|
package/NavSecondaryContent.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import iconLanguages from './icons/languages.svg'
|
|
|
9
9
|
import { usePageContext } from './renderer/usePageContext'
|
|
10
10
|
import '@docsearch/css'
|
|
11
11
|
|
|
12
|
-
function NavSecondaryContent(props: { style?: React.CSSProperties
|
|
12
|
+
function NavSecondaryContent(props: { style?: React.CSSProperties }) {
|
|
13
13
|
const pageContext = usePageContext()
|
|
14
14
|
const { projectInfo, i18n } = pageContext.config
|
|
15
15
|
const iconI18n = !i18n ? null : (
|
|
@@ -28,6 +28,7 @@ function NavSecondaryContent(props: { style?: React.CSSProperties; className?: s
|
|
|
28
28
|
alignItems: 'center',
|
|
29
29
|
...props.style,
|
|
30
30
|
}}
|
|
31
|
+
className="desktop-fade"
|
|
31
32
|
>
|
|
32
33
|
{iconI18n}
|
|
33
34
|
{projectInfo.discordInvite && (
|
package/components/RepoLink.tsx
CHANGED
|
@@ -16,9 +16,10 @@ function RepoLink({ path, text, editMode }: { path: string; text?: string | JSX.
|
|
|
16
16
|
if (!path.startsWith('/')) {
|
|
17
17
|
path = '/' + path
|
|
18
18
|
}
|
|
19
|
-
const viewMode = path.endsWith('/')
|
|
19
|
+
const viewMode = path.endsWith('/') && !editMode ? 'tree' : 'blob'
|
|
20
20
|
const { githubRepository } = pageContext.config.projectInfo
|
|
21
21
|
assert(githubRepository.startsWith('https://github.com/'))
|
|
22
|
-
|
|
22
|
+
let href = `${githubRepository}/${viewMode}/main${path}`
|
|
23
|
+
if (editMode) href += '?plain=1'
|
|
23
24
|
return <a href={href}>{text}</a>
|
|
24
25
|
}
|
package/dist/Layout.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
declare const navLeftWidthMax = 370;
|
|
9
9
|
declare const navLeftWidthMin = 300;
|
|
10
10
|
declare const containerQueryMobileMenu = 1000;
|
|
11
|
-
declare const containerQueryMobileLayout:
|
|
11
|
+
declare const containerQueryMobileLayout: 1143;
|
|
12
12
|
declare function Layout({ children }: {
|
|
13
13
|
children: React.ReactNode;
|
|
14
14
|
}): React.JSX.Element;
|
package/dist/Layout.js
CHANGED
|
@@ -39,13 +39,10 @@ var mainViewPadding = 20;
|
|
|
39
39
|
var mainViewWidthMax = 800;
|
|
40
40
|
var navLeftWidthMax = 370;
|
|
41
41
|
var navLeftWidthMin = 300;
|
|
42
|
-
// 840 = 800 + 20 * 2
|
|
43
|
-
var mainViewMax = mainViewWidthMax + mainViewPadding * 2;
|
|
42
|
+
var mainViewMax = (mainViewWidthMax + mainViewPadding * 2); // 840 = 800 + 20 * 2
|
|
44
43
|
var containerQueryMobileMenu = 1000;
|
|
45
|
-
// 1143 = 840 + 300
|
|
46
|
-
var
|
|
47
|
-
// 1213 = 840 + 370 + 3
|
|
48
|
-
var containerQueryExtraSpace = mainViewMax + navLeftWidthMax + blockMargin;
|
|
44
|
+
var containerQueryMobileLayout = (mainViewMax + navLeftWidthMin); // 1143 = 840 + 300
|
|
45
|
+
var containerQueryExtraSpace = (mainViewMax + navLeftWidthMax + blockMargin); // 1213 = 840 + 370 + 3
|
|
49
46
|
// Avoid whitespace at the bottom of pages with almost no content
|
|
50
47
|
var whitespaceBuster1 = {
|
|
51
48
|
minHeight: '100vh',
|
|
@@ -71,7 +68,8 @@ function Layout(_a) {
|
|
|
71
68
|
_b['--bg-color'] = '#f5f5f7',
|
|
72
69
|
_b['--block-margin'] = "".concat(blockMargin, "px"),
|
|
73
70
|
_b['--icon-text-padding'] = '8px',
|
|
74
|
-
|
|
71
|
+
// ['--nav-head-height']: `${isLandingPage ? 70 : 60}px`,
|
|
72
|
+
_b['--nav-head-height'] = "60px",
|
|
75
73
|
_b) },
|
|
76
74
|
React.createElement(MenuModal, { isTopNav: isLandingPage }),
|
|
77
75
|
React.createElement("div", { className: isLandingPage ? '' : 'doc-page', style: __assign({
|
|
@@ -89,7 +87,7 @@ function LayoutDocsPage(_a) {
|
|
|
89
87
|
React.createElement("style", null, getStyle()),
|
|
90
88
|
React.createElement("div", { style: __assign({ display: 'flex' }, whitespaceBuster2) },
|
|
91
89
|
React.createElement(NavLeft, null),
|
|
92
|
-
React.createElement("div", { id:
|
|
90
|
+
React.createElement("div", { id: "nav-left-margin", className: "low-prio-grow", style: { width: 0, maxWidth: 50, background: 'var(--bg-color)' } }),
|
|
93
91
|
React.createElement(PageContent, null, children))));
|
|
94
92
|
function getStyle() {
|
|
95
93
|
var style = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n@container container-viewport (min-width: ", "px) {\n .low-prio-grow {\n flex-grow: 1;\n }\n #navigation-container {\n width: ", "px !important;\n }\n}"], ["\n@container container-viewport (min-width: ", "px) {\n .low-prio-grow {\n flex-grow: 1;\n }\n #navigation-container {\n width: ", "px !important;\n }\n}"])), containerQueryExtraSpace, navLeftWidthMax);
|
|
@@ -168,13 +166,14 @@ function NavHead(_a) {
|
|
|
168
166
|
var pageContext2 = usePageContext2();
|
|
169
167
|
var projectName = pageContext.meta.projectName;
|
|
170
168
|
var isLandingPage = pageContext.isLandingPage;
|
|
169
|
+
var navMaxWidth = pageContext.config.navMaxWidth;
|
|
171
170
|
var linkStyle = {
|
|
172
171
|
height: '100%',
|
|
173
172
|
padding: '0 var(--padding-side)',
|
|
174
173
|
justifyContent: 'center',
|
|
175
174
|
};
|
|
176
175
|
var TopNavigation = pageContext2.config.TopNavigation || PassThrough;
|
|
177
|
-
var navSecondaryContent = (React.createElement("div", { className: isNavLeft ? 'show-on-nav-hover add-transition' : 'hide-on-shrink', style: __assign({ padding: 0, display: 'flex', height: '100%' }, (!isNavLeft
|
|
176
|
+
var navSecondaryContent = (React.createElement("div", { className: isNavLeft ? 'show-on-nav-hover add-transition' : 'hide-on-shrink desktop-grow', style: __assign({ padding: 0, display: 'flex', height: '100%' }, (!isNavLeft
|
|
178
177
|
? {}
|
|
179
178
|
: {
|
|
180
179
|
position: 'absolute',
|
|
@@ -185,6 +184,7 @@ function NavHead(_a) {
|
|
|
185
184
|
width: mainViewMax, // guaranteed real estate
|
|
186
185
|
})) },
|
|
187
186
|
React.createElement(TopNavigation, null),
|
|
187
|
+
React.createElement("div", { className: "desktop-grow" }),
|
|
188
188
|
React.createElement(NavSecondaryContent, { style: {
|
|
189
189
|
display: 'inline-flex',
|
|
190
190
|
fontSize: '1.06em',
|
|
@@ -207,6 +207,8 @@ function NavHead(_a) {
|
|
|
207
207
|
} },
|
|
208
208
|
React.createElement("div", { className: "nav-head-content", style: (_b = {
|
|
209
209
|
width: '100%',
|
|
210
|
+
maxWidth: navMaxWidth,
|
|
211
|
+
margin: 'auto',
|
|
210
212
|
height: 'var(--nav-head-height)',
|
|
211
213
|
fontSize: "min(16.96px, ".concat(isProjectNameShort(projectName) ? '4.8cqw' : '4.5cqw', ")"),
|
|
212
214
|
color: '#666'
|
|
@@ -215,17 +217,21 @@ function NavHead(_a) {
|
|
|
215
217
|
_b.display = 'flex',
|
|
216
218
|
_b.justifyContent = 'center',
|
|
217
219
|
_b) },
|
|
218
|
-
React.createElement(NavLogo, { className: "grow-half" }),
|
|
219
|
-
React.createElement(
|
|
220
|
-
React.createElement(
|
|
220
|
+
React.createElement(NavLogo, { className: "mobile-grow-half" }),
|
|
221
|
+
React.createElement("div", { className: "desktop-grow" }),
|
|
222
|
+
React.createElement(SearchLink, { className: "mobile-grow-half", style: linkStyle }),
|
|
223
|
+
React.createElement(MenuLink, { className: "mobile-grow-full", style: linkStyle }),
|
|
221
224
|
navSecondaryContent)),
|
|
222
225
|
getStyle()));
|
|
223
226
|
function getStyle() {
|
|
224
|
-
var style = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n@container container-nav-head (max-width: 550px) {\n .grow-full {\n flex-grow: 1;\n }\n .grow-half {\n flex-grow: 0.5;\n }\n .nav-head-content {\n --padding-side: 0px;\n }\n .nav-logo {\n padding-left: 15px;\n margin-left: -10px;\n }\n}\n@container container-nav-head (min-width: 501px) {\n .nav-head-content {\n --padding-side: 35px;\n }\n .nav-logo {\n padding: 0 var(--padding-side);\n }\n}\n@media(max-width: ", "px) {\n .hide-on-shrink {\n display: none !important;\n }\n}\n"], ["\n@container container-nav-head (max-width: 550px) {\n .grow-full {\n flex-grow: 1;\n }\n .grow-half {\n flex-grow: 0.5;\n }\n .nav-head-content {\n --padding-side: 0px;\n }\n .nav-logo {\n padding-left: 15px;\n margin-left: -10px;\n }\n}\n@container container-nav-head (min-width: 501px) {\n .nav-head-content {\n --padding-side: 35px;\n }\n .nav-logo {\n padding: 0 var(--padding-side);\n }\n}\n@media(max-width: ", "px) {\n .hide-on-shrink {\n display: none !important;\n }\n}\n"])), containerQueryMobileMenu);
|
|
225
|
-
if (
|
|
226
|
-
style += css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n@media(min-width: ", "px) {\n .nav-
|
|
227
|
+
var style = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n@container container-nav-head (max-width: 550px) {\n .mobile-grow-full {\n flex-grow: 1;\n }\n .mobile-grow-half {\n flex-grow: 0.5;\n }\n .nav-head-content {\n --padding-side: 0px;\n }\n .nav-logo {\n padding-left: 15px;\n margin-left: -10px;\n }\n}\n@container container-nav-head (min-width: 501px) {\n .nav-head-content {\n --padding-side: 35px;\n }\n .nav-logo {\n padding: 0 var(--padding-side);\n }\n}\n@media(max-width: ", "px) {\n .hide-on-shrink {\n display: none !important;\n }\n}\n"], ["\n@container container-nav-head (max-width: 550px) {\n .mobile-grow-full {\n flex-grow: 1;\n }\n .mobile-grow-half {\n flex-grow: 0.5;\n }\n .nav-head-content {\n --padding-side: 0px;\n }\n .nav-logo {\n padding-left: 15px;\n margin-left: -10px;\n }\n}\n@container container-nav-head (min-width: 501px) {\n .nav-head-content {\n --padding-side: 35px;\n }\n .nav-logo {\n padding: 0 var(--padding-side);\n }\n}\n@media(max-width: ", "px) {\n .hide-on-shrink {\n display: none !important;\n }\n}\n"])), containerQueryMobileMenu);
|
|
228
|
+
if (navMaxWidth) {
|
|
229
|
+
style += css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n@media(min-width: ", "px) {\n .desktop-grow {\n flex-grow: 1;\n }\n .desktop-fade {\n transition: opacity 0.3s ease-in-out !important;\n }\n html:not(.menu-modal-show) .nav-head-top:not(:hover) .desktop-fade {\n transition: opacity 0.3s ease-in-out !important;\n opacity: 0.5;\n }\n}\n"], ["\n@media(min-width: ", "px) {\n .desktop-grow {\n flex-grow: 1;\n }\n .desktop-fade {\n transition: opacity 0.3s ease-in-out !important;\n }\n html:not(.menu-modal-show) .nav-head-top:not(:hover) .desktop-fade {\n transition: opacity 0.3s ease-in-out !important;\n opacity: 0.5;\n }\n}\n"])), containerQueryMobileMenu + 1);
|
|
230
|
+
}
|
|
231
|
+
if (isLandingPage && !navMaxWidth)
|
|
232
|
+
style += css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n@media(min-width: ", "px) {\n .nav-logo {\n display: none !important;\n }\n}\n"], ["\n@media(min-width: ", "px) {\n .nav-logo {\n display: none !important;\n }\n}\n"])), containerQueryMobileMenu + 1);
|
|
227
233
|
if (isNavLeft) {
|
|
228
|
-
style += css(
|
|
234
|
+
style += css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n\n.show-on-nav-hover {\n opacity: 0;\n transition-property: opacity;\n pointer-events: none;\n}\nhtml:not(.unexpand-nav) :has(.nav-head-full-width:hover) .show-on-nav-hover,\nhtml:not(.unexpand-nav) :has(.show-on-nav-hover:hover) .show-on-nav-hover,\nhtml:not(.unexpand-nav).menu-modal-show .show-on-nav-hover {\n opacity: 1;\n pointer-events: all;\n}\n"], ["\n\n.show-on-nav-hover {\n opacity: 0;\n transition-property: opacity;\n pointer-events: none;\n}\nhtml:not(.unexpand-nav) :has(.nav-head-full-width:hover) .show-on-nav-hover,\nhtml:not(.unexpand-nav) :has(.show-on-nav-hover:hover) .show-on-nav-hover,\nhtml:not(.unexpand-nav).menu-modal-show .show-on-nav-hover {\n opacity: 1;\n pointer-events: all;\n}\n"])));
|
|
229
235
|
}
|
|
230
236
|
return React.createElement(Style, null, style);
|
|
231
237
|
}
|
|
@@ -251,7 +257,7 @@ function NavHeaderLeftFullWidthBackground() {
|
|
|
251
257
|
} }),
|
|
252
258
|
React.createElement(Style, null,
|
|
253
259
|
// (min-width: 0px) => trick to always apply => @container seems to always require a condition
|
|
254
|
-
css(
|
|
260
|
+
css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n@container container-viewport (min-width: 0px) {\n .nav-bg {\n width: 100cqw;\n }\n}\n"], ["\n@container container-viewport (min-width: 0px) {\n .nav-bg {\n width: 100cqw;\n }\n}\n"]))))));
|
|
255
261
|
}
|
|
256
262
|
function NavLogo(_a) {
|
|
257
263
|
var className = _a.className;
|
|
@@ -305,13 +311,13 @@ function MenuLink(props) {
|
|
|
305
311
|
React.createElement("span", { className: "text-menu" },
|
|
306
312
|
React.createElement(MenuIcon, null),
|
|
307
313
|
" Menu"),
|
|
308
|
-
React.createElement(Style, null, css(
|
|
314
|
+
React.createElement(Style, null, css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n@media(max-width: ", "px) {\n .text-docs {\n display: none;\n }\n}\n@media(min-width: ", "px) {\n .text-menu {\n display: none;\n }\n}\n"], ["\n@media(max-width: ", "px) {\n .text-docs {\n display: none;\n }\n}\n@media(min-width: ", "px) {\n .text-menu {\n display: none;\n }\n}\n"])), containerQueryMobileMenu, containerQueryMobileMenu + 1))));
|
|
309
315
|
}
|
|
310
316
|
function DocsIcon() {
|
|
311
|
-
return (React.createElement("span", { style: { marginRight: 'calc(var(--icon-text-padding) + 2px)' }, className: "decolorize-6" }, "\uD83D\uDCDA"));
|
|
317
|
+
return (React.createElement("span", { style: { marginRight: 'calc(var(--icon-text-padding) + 2px)' }, className: "decolorize-6 desktop-fade" }, "\uD83D\uDCDA"));
|
|
312
318
|
}
|
|
313
319
|
function MenuIcon() {
|
|
314
|
-
return (React.createElement("svg", { style: { marginRight: 'calc(var(--icon-text-padding) + 2px)', verticalAlign: 'top', width: '1.3em' }, className: "decolorize-6", viewBox: "0 0 448 512" },
|
|
320
|
+
return (React.createElement("svg", { style: { marginRight: 'calc(var(--icon-text-padding) + 2px)', verticalAlign: 'top', width: '1.3em' }, className: "decolorize-6 desktop-fade", viewBox: "0 0 448 512" },
|
|
315
321
|
React.createElement("path", { fill: "currentColor", 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" })));
|
|
316
322
|
}
|
|
317
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
323
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
@@ -22,7 +22,7 @@ function NavSecondaryContent(props) {
|
|
|
22
22
|
var pageContext = usePageContext();
|
|
23
23
|
var _a = pageContext.config, projectInfo = _a.projectInfo, i18n = _a.i18n;
|
|
24
24
|
var iconI18n = !i18n ? null : (React.createElement(LinkIcon, { className: "decolorize-4", icon: iconLanguages, href: '/languages', style: { height: 21, position: 'relative', top: 0, left: 0 } }));
|
|
25
|
-
return (React.createElement("div", __assign({}, props, { style: __assign({ display: 'flex', alignItems: 'center' }, props.style) }),
|
|
25
|
+
return (React.createElement("div", __assign({}, props, { style: __assign({ display: 'flex', alignItems: 'center' }, props.style), className: "desktop-fade" }),
|
|
26
26
|
iconI18n,
|
|
27
27
|
projectInfo.discordInvite && (React.createElement(LinkIcon, { className: "decolorize-6", icon: iconDiscord, href: projectInfo.discordInvite })),
|
|
28
28
|
React.createElement(LinkIcon, { className: "decolorize-4", icon: iconTwitter, href: projectInfo.twitterProfile }),
|
|
@@ -14,9 +14,11 @@ function RepoLink(_a) {
|
|
|
14
14
|
if (!path.startsWith('/')) {
|
|
15
15
|
path = '/' + path;
|
|
16
16
|
}
|
|
17
|
-
var viewMode = path.endsWith('/')
|
|
17
|
+
var viewMode = path.endsWith('/') && !editMode ? 'tree' : 'blob';
|
|
18
18
|
var githubRepository = pageContext.config.projectInfo.githubRepository;
|
|
19
19
|
assert(githubRepository.startsWith('https://github.com/'));
|
|
20
20
|
var href = "".concat(githubRepository, "/").concat(viewMode, "/main").concat(path);
|
|
21
|
+
if (editMode)
|
|
22
|
+
href += '?plain=1';
|
|
21
23
|
return React.createElement("a", { href: href }, text);
|
|
22
24
|
}
|
|
@@ -21,5 +21,5 @@ function SearchLink(props) {
|
|
|
21
21
|
"Search"));
|
|
22
22
|
}
|
|
23
23
|
function SearchIcon() {
|
|
24
|
-
return (React.createElement("span", { style: { marginRight: 'var(--icon-text-padding)', fontSize: '1.1em' }, className: "decolorize-7" }, "\uD83D\uDD0D"));
|
|
24
|
+
return (React.createElement("span", { style: { marginRight: 'var(--icon-text-padding)', fontSize: '1.1em' }, className: "decolorize-7 desktop-fade" }, "\uD83D\uDD0D"));
|
|
25
25
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export { usePageContext };
|
|
2
2
|
export { PageContextProvider };
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
|
|
4
|
+
import { getGlobalObject } from '../utils/getGlobalObject';
|
|
5
|
+
var globalObject = getGlobalObject('onRenderClient.ts', {
|
|
6
|
+
Context: React.createContext(undefined),
|
|
7
|
+
});
|
|
5
8
|
function PageContextProvider(_a) {
|
|
6
9
|
var pageContext = _a.pageContext, children = _a.children;
|
|
10
|
+
var Context = globalObject.Context;
|
|
7
11
|
return React.createElement(Context.Provider, { value: pageContext }, children);
|
|
8
12
|
}
|
|
9
13
|
function usePageContext() {
|
|
14
|
+
var Context = globalObject.Context;
|
|
10
15
|
var pageContext = useContext(Context);
|
|
11
16
|
return pageContext;
|
|
12
17
|
}
|
package/dist/types/Config.d.ts
CHANGED
package/docsearch/SearchLink.tsx
CHANGED
|
@@ -29,7 +29,7 @@ function SearchLink(props: PropsAnchor) {
|
|
|
29
29
|
}
|
|
30
30
|
function SearchIcon() {
|
|
31
31
|
return (
|
|
32
|
-
<span style={{ marginRight: 'var(--icon-text-padding)', fontSize: '1.1em' }} className="decolorize-7">
|
|
32
|
+
<span style={{ marginRight: 'var(--icon-text-padding)', fontSize: '1.1em' }} className="decolorize-7 desktop-fade">
|
|
33
33
|
🔍
|
|
34
34
|
</span>
|
|
35
35
|
)
|
package/package.json
CHANGED
|
@@ -4,8 +4,11 @@ export { PageContextProvider }
|
|
|
4
4
|
import React, { useContext } from 'react'
|
|
5
5
|
import type { PageContextResolved } from '../config/resolvePageContext'
|
|
6
6
|
import type { PageContext } from 'vike/types'
|
|
7
|
+
import { getGlobalObject } from '../utils/getGlobalObject'
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const globalObject = getGlobalObject('onRenderClient.ts', {
|
|
10
|
+
Context: React.createContext<PageContextResolved>(undefined as any),
|
|
11
|
+
})
|
|
9
12
|
|
|
10
13
|
function PageContextProvider({
|
|
11
14
|
pageContext,
|
|
@@ -14,10 +17,12 @@ function PageContextProvider({
|
|
|
14
17
|
pageContext: PageContextResolved
|
|
15
18
|
children: React.ReactNode
|
|
16
19
|
}) {
|
|
20
|
+
const { Context } = globalObject
|
|
17
21
|
return <Context.Provider value={pageContext}>{children}</Context.Provider>
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
function usePageContext(): PageContextResolved {
|
|
25
|
+
const { Context } = globalObject
|
|
21
26
|
const pageContext = useContext(Context)
|
|
22
27
|
return pageContext
|
|
23
28
|
}
|