@brillout/docpress 0.16.46 → 0.16.47-commit-e262d2a
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/ExternalLinks.tsx +4 -3
- package/Layout.tsx +30 -101
- package/MenuModal.tsx +3 -2
- package/code-blocks/components/Pre.css +1 -0
- package/components/index.ts +0 -3
- package/css/code.css +1 -0
- package/css/font.css +1 -1
- package/css/heading.css +5 -0
- package/css/tooltip.css +1 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -3
- package/dist/renderer/usePageContext.d.ts +0 -16
- package/dist/renderer/usePageContext.js +0 -6
- package/dist/resolvePageContext.d.ts +1 -0
- package/dist/types/Config.d.ts +1 -1
- package/dist/types/Heading.d.ts +6 -0
- package/dist/utils/server.d.ts +0 -2
- package/dist/utils/server.js +0 -2
- package/package.json +2 -5
- package/renderer/usePageContext.tsx +0 -7
- package/types/Config.ts +1 -1
- package/types/Heading.ts +6 -0
- package/utils/server.ts +0 -2
- package/components/Comment.tsx +0 -7
- package/components/HorizontalLine.tsx +0 -22
- package/components/P.css +0 -8
- package/components/P.tsx +0 -8
- package/dist/components/Comment.d.ts +0 -3
- package/dist/components/Comment.js +0 -5
- package/dist/components/HorizontalLine.d.ts +0 -5
- package/dist/components/HorizontalLine.js +0 -15
- package/dist/components/P.d.ts +0 -4
- package/dist/components/P.js +0 -6
- package/dist/utils/cls.d.ts +0 -3
- package/dist/utils/cls.js +0 -5
- package/dist/utils/filter.d.ts +0 -2
- package/dist/utils/filter.js +0 -11
- package/dist/utils/objectAssign.d.ts +0 -2
- package/dist/utils/objectAssign.js +0 -5
- package/utils/PassTrough.tsx +0 -7
- package/utils/filesystemPathHandling.ts +0 -42
- package/utils/filter.ts +0 -12
- package/utils/objectAssign.ts +0 -9
package/ExternalLinks.tsx
CHANGED
|
@@ -46,10 +46,11 @@ function ExternalLinks(props: { style?: React.CSSProperties }) {
|
|
|
46
46
|
|
|
47
47
|
function ChangelogButton() {
|
|
48
48
|
const pageContext = usePageContext()
|
|
49
|
-
const { version, github } = pageContext.globalContext.config.docpress
|
|
49
|
+
const { version, github, changelog } = pageContext.globalContext.config.docpress
|
|
50
|
+
const changeLogUrl = typeof changelog === 'string' ? changelog : `${github}/blob/main/CHANGELOG.md`
|
|
50
51
|
return (
|
|
51
52
|
<a
|
|
52
|
-
href={
|
|
53
|
+
href={changeLogUrl}
|
|
53
54
|
className="colorize-on-hover"
|
|
54
55
|
style={{
|
|
55
56
|
display: 'flex',
|
|
@@ -62,7 +63,7 @@ function ChangelogButton() {
|
|
|
62
63
|
className="button"
|
|
63
64
|
style={{
|
|
64
65
|
background: '#ffffff4f',
|
|
65
|
-
fontFamily: 'monospace',
|
|
66
|
+
fontFamily: 'var(--font-mono, monospace)',
|
|
66
67
|
letterSpacing: -1,
|
|
67
68
|
display: 'flex',
|
|
68
69
|
alignItems: 'center',
|
package/Layout.tsx
CHANGED
|
@@ -69,7 +69,8 @@ const whitespaceBuster2: React.CSSProperties = {
|
|
|
69
69
|
|
|
70
70
|
function Layout({ children }: { children: React.ReactNode }) {
|
|
71
71
|
const pageContext = usePageContext()
|
|
72
|
-
const { isLandingPage } = pageContext.resolved
|
|
72
|
+
const { isLandingPage, pageDesign } = pageContext.resolved
|
|
73
|
+
const isTopNavSticky = !isLandingPage && (pageDesign?.topNavSticky ?? true)
|
|
73
74
|
|
|
74
75
|
let content: React.JSX.Element
|
|
75
76
|
if (isLandingPage) {
|
|
@@ -86,6 +87,8 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
86
87
|
['--block-margin']: `${blockMargin}px`,
|
|
87
88
|
// ['--nav-head-height']: `${isLandingPage ? 70 : 63}px`,
|
|
88
89
|
['--nav-head-height']: `63px`,
|
|
90
|
+
// The offset that sticky elements (top nav, <NavLeft>) sit below. Zero when the top nav scrolls away.
|
|
91
|
+
['--nav-head-sticky-offset']: isTopNavSticky ? 'var(--nav-head-height)' : '0px',
|
|
89
92
|
['--main-view-padding']: `${mainViewPadding}px`,
|
|
90
93
|
// We don't add `container` to `body` nor `html` beacuse in Firefox it breaks the `position: fixed` of <MenuModal>
|
|
91
94
|
// https://stackoverflow.com/questions/74601420/css-container-inline-size-and-fixed-child
|
|
@@ -94,9 +97,12 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
94
97
|
margin: 'auto',
|
|
95
98
|
}}
|
|
96
99
|
>
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
<div className={isLandingPage ? 'landing-page' : 'doc-page'} style={whitespaceBuster1}>
|
|
101
|
+
<div style={{ position: isTopNavSticky ? 'sticky' : 'relative', top: 0, zIndex: 100 }}>
|
|
102
|
+
<NavHead />
|
|
103
|
+
{/* <MenuModal> is inside here because `container-type` on the page wrapper traps `position: fixed` — https://github.com/brillout/docpress/pull/177 */}
|
|
104
|
+
<MenuModal isNavLeftAlwaysHidden_={isNavLeftAlwaysHidden_} />
|
|
105
|
+
</div>
|
|
100
106
|
{content}
|
|
101
107
|
</div>
|
|
102
108
|
{/* Early toggling, to avoid layout jumps */}
|
|
@@ -220,10 +226,10 @@ function NavLeft() {
|
|
|
220
226
|
<div
|
|
221
227
|
style={{
|
|
222
228
|
position: 'sticky',
|
|
223
|
-
top
|
|
229
|
+
// Sit below the sticky top nav (or at the very top when the top nav scrolls away)
|
|
230
|
+
top: 'var(--nav-head-sticky-offset)',
|
|
224
231
|
}}
|
|
225
232
|
>
|
|
226
|
-
<NavHead isNavLeft={true} />
|
|
227
233
|
<div
|
|
228
234
|
style={{
|
|
229
235
|
backgroundColor: 'var(--color-bg-gray)',
|
|
@@ -233,7 +239,7 @@ function NavLeft() {
|
|
|
233
239
|
id="navigation-container"
|
|
234
240
|
style={{
|
|
235
241
|
top: 0,
|
|
236
|
-
height: `calc(100vh - var(--nav-head-
|
|
242
|
+
height: `calc(100vh - var(--nav-head-sticky-offset) - var(--block-margin))`,
|
|
237
243
|
overflowY: 'auto',
|
|
238
244
|
overscrollBehavior: 'contain',
|
|
239
245
|
paddingBottom: 40,
|
|
@@ -296,29 +302,18 @@ const menuLinkStyle: React.CSSProperties = {
|
|
|
296
302
|
justifyContent: 'center',
|
|
297
303
|
}
|
|
298
304
|
|
|
299
|
-
|
|
300
|
-
// - The left-side <NavHead> shown on documentation pages on desktop
|
|
301
|
-
// - The top <NavHead> shown otherwise
|
|
302
|
-
function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
305
|
+
function NavHead() {
|
|
303
306
|
const pageContext = usePageContext()
|
|
304
307
|
const { navMaxWidth, name, algolia } = pageContext.globalContext.config.docpress
|
|
305
308
|
const hideNavHeadLogo = pageContext.resolved.isLandingPage && !navMaxWidth
|
|
306
309
|
|
|
307
310
|
const navHeadSecondary = (
|
|
308
311
|
<div
|
|
309
|
-
className=
|
|
312
|
+
className="nav-head-secondary"
|
|
310
313
|
style={{
|
|
311
314
|
padding: 0,
|
|
312
315
|
display: 'flex',
|
|
313
316
|
height: '100%',
|
|
314
|
-
...(isNavLeft
|
|
315
|
-
? {
|
|
316
|
-
position: 'absolute',
|
|
317
|
-
left: '100%',
|
|
318
|
-
top: 0,
|
|
319
|
-
width: mainViewWidthMax, // guaranteed real estate
|
|
320
|
-
}
|
|
321
|
-
: {}),
|
|
322
317
|
}}
|
|
323
318
|
>
|
|
324
319
|
{pageContext.globalContext.config.docpress.topNavigation}
|
|
@@ -336,26 +331,29 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
336
331
|
|
|
337
332
|
return (
|
|
338
333
|
<div
|
|
339
|
-
className={cls(['nav-head link-hover-animation',
|
|
334
|
+
className={cls(['nav-head link-hover-animation', !!navMaxWidth && 'has-max-width'])}
|
|
340
335
|
style={{
|
|
341
336
|
backgroundColor: 'var(--color-bg-gray)',
|
|
342
|
-
borderBottom: 'var(--block-margin) solid var(--color-bg-white)',
|
|
343
337
|
position: 'relative',
|
|
338
|
+
boxShadow: `0 ${blockMargin}px 0 var(--color-bg-white)`,
|
|
344
339
|
}}
|
|
345
340
|
>
|
|
346
|
-
{isNavLeft && <NavHeadLeftFullWidthBackground />}
|
|
347
341
|
<div
|
|
348
342
|
style={{
|
|
349
343
|
// DON'T REMOVE this container: it's needed for the `cqw` values
|
|
350
344
|
container: 'container-nav-head / inline-size',
|
|
351
345
|
width: '100%',
|
|
346
|
+
// Cap the cqw context so nav-item spacing matches between landing and doc pages.
|
|
347
|
+
maxWidth: bodyMaxWidth,
|
|
348
|
+
margin: '0 auto',
|
|
352
349
|
}}
|
|
353
350
|
>
|
|
354
351
|
<div
|
|
355
352
|
className="nav-head-content"
|
|
356
353
|
style={{
|
|
357
354
|
width: '100%',
|
|
358
|
-
|
|
355
|
+
// Top nav spans the doc-page width so its logo lines up with the sidebar (same width on landing).
|
|
356
|
+
maxWidth: bodyMaxWidth,
|
|
359
357
|
margin: 'auto',
|
|
360
358
|
height: 'var(--nav-head-height)',
|
|
361
359
|
fontSize: `min(14.2px, ${isProjectNameShort(name) ? '4.8cqw' : '4.5cqw'})`,
|
|
@@ -364,7 +362,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
364
362
|
justifyContent: 'center',
|
|
365
363
|
}}
|
|
366
364
|
>
|
|
367
|
-
{!hideNavHeadLogo && <NavHeadLogo
|
|
365
|
+
{!hideNavHeadLogo && <NavHeadLogo />}
|
|
368
366
|
<div className="desktop-grow" style={{ display: 'none' }} />
|
|
369
367
|
{algolia && <SearchLink className="always-shown" style={menuLinkStyle} />}
|
|
370
368
|
<MenuToggleMain className="always-shown nav-head-menu-toggle" style={menuLinkStyle} />
|
|
@@ -380,7 +378,7 @@ function getStyleLayout() {
|
|
|
380
378
|
// Mobile
|
|
381
379
|
style += css`
|
|
382
380
|
@media(max-width: ${viewMobile}px) {
|
|
383
|
-
.nav-head
|
|
381
|
+
.nav-head {
|
|
384
382
|
.nav-head-menu-toggle {
|
|
385
383
|
justify-content: flex-end !important;
|
|
386
384
|
padding-right: var(--main-view-padding) !important;
|
|
@@ -397,7 +395,7 @@ function getStyleLayout() {
|
|
|
397
395
|
// Mobile + tablet
|
|
398
396
|
style += css`
|
|
399
397
|
@media(max-width: ${viewTablet}px) {
|
|
400
|
-
.nav-head
|
|
398
|
+
.nav-head {
|
|
401
399
|
.nav-head-secondary {
|
|
402
400
|
display: none !important;
|
|
403
401
|
}
|
|
@@ -407,7 +405,7 @@ function getStyleLayout() {
|
|
|
407
405
|
// Tablet
|
|
408
406
|
style += css`
|
|
409
407
|
@media(max-width: ${viewTablet}px) and (min-width: ${viewMobile + 1}px) {
|
|
410
|
-
.nav-head
|
|
408
|
+
.nav-head {
|
|
411
409
|
.nav-head-content {
|
|
412
410
|
--icon-text-padding: 8px;
|
|
413
411
|
--padding-side: 20px;
|
|
@@ -418,7 +416,7 @@ function getStyleLayout() {
|
|
|
418
416
|
// Desktop small + desktop
|
|
419
417
|
style += css`
|
|
420
418
|
@media(min-width: ${viewTablet + 1}px) {
|
|
421
|
-
.nav-head
|
|
419
|
+
.nav-head {
|
|
422
420
|
.nav-head-content {
|
|
423
421
|
--icon-text-padding: min(8px, 0.5cqw);
|
|
424
422
|
--padding-side: min(20px, 1.2cqw);
|
|
@@ -442,39 +440,6 @@ function getStyleLayout() {
|
|
|
442
440
|
// Desktop
|
|
443
441
|
if (!isNavLeftAlwaysHidden()) {
|
|
444
442
|
style += css`
|
|
445
|
-
@container container-viewport (min-width: ${viewDesktop}px) {
|
|
446
|
-
.nav-head:not(.is-nav-left) {
|
|
447
|
-
display: none !important;
|
|
448
|
-
}
|
|
449
|
-
.nav-head.is-nav-left {
|
|
450
|
-
.nav-head-content {
|
|
451
|
-
--icon-text-padding: min(8px, 7 * (1cqw - 2.5px));
|
|
452
|
-
& > :not(.always-shown) {
|
|
453
|
-
--padding-side: min(24px, 27 * (1cqw - 2.5px));
|
|
454
|
-
}
|
|
455
|
-
& > * {
|
|
456
|
-
flex-grow: 0.5;
|
|
457
|
-
}
|
|
458
|
-
& > .nav-head-menu-toggle {
|
|
459
|
-
flex-grow: 1;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
.show-on-nav-hover {
|
|
464
|
-
opacity: 0;
|
|
465
|
-
transition-property: opacity;
|
|
466
|
-
pointer-events: none;
|
|
467
|
-
}
|
|
468
|
-
html:not(.unexpand-nav) {
|
|
469
|
-
& .nav-head.is-nav-left:hover .show-on-nav-hover,
|
|
470
|
-
&:has(.nav-head:hover) #menu-modal-wrapper.show-on-nav-hover,
|
|
471
|
-
&.menu-modal-show .nav-head.is-nav-left .show-on-nav-hover,
|
|
472
|
-
&.menu-modal-show #menu-modal-wrapper.show-on-nav-hover {
|
|
473
|
-
opacity: 1;
|
|
474
|
-
pointer-events: all;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
443
|
@container container-viewport (max-width: ${viewDesktop - 1}px) {
|
|
479
444
|
#nav-left, #nav-left-margin {
|
|
480
445
|
display: none;
|
|
@@ -514,37 +479,7 @@ function unexpandNav() {
|
|
|
514
479
|
}, 1000)
|
|
515
480
|
}
|
|
516
481
|
|
|
517
|
-
function
|
|
518
|
-
return (
|
|
519
|
-
<>
|
|
520
|
-
<div
|
|
521
|
-
className="nav-head-bg show-on-nav-hover add-transition"
|
|
522
|
-
style={{
|
|
523
|
-
height: '100%',
|
|
524
|
-
zIndex: -1,
|
|
525
|
-
background: 'var(--color-bg-gray)',
|
|
526
|
-
position: 'absolute',
|
|
527
|
-
left: 0,
|
|
528
|
-
top: 0,
|
|
529
|
-
boxSizing: 'content-box',
|
|
530
|
-
borderBottom: 'var(--block-margin) solid var(--color-bg-white)',
|
|
531
|
-
}}
|
|
532
|
-
/>
|
|
533
|
-
<Style>{
|
|
534
|
-
// (min-width: 0px) => trick to always apply => @container seems to always require a condition
|
|
535
|
-
css`
|
|
536
|
-
@container container-viewport (min-width: 0px) {
|
|
537
|
-
.nav-head-bg {
|
|
538
|
-
width: 100cqw;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
`
|
|
542
|
-
}</Style>
|
|
543
|
-
</>
|
|
544
|
-
)
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
482
|
+
function NavHeadLogo() {
|
|
548
483
|
const pageContext = usePageContext()
|
|
549
484
|
|
|
550
485
|
const { navLogo } = pageContext.globalContext.config.docpress
|
|
@@ -584,14 +519,8 @@ function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
584
519
|
alignItems: 'center',
|
|
585
520
|
height: '100%',
|
|
586
521
|
color: 'inherit',
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
paddingLeft: 'var(--main-view-padding)',
|
|
590
|
-
paddingRight: 'var(--padding-side)',
|
|
591
|
-
}
|
|
592
|
-
: {
|
|
593
|
-
paddingLeft: 15,
|
|
594
|
-
}),
|
|
522
|
+
paddingLeft: 'var(--main-view-padding)',
|
|
523
|
+
paddingRight: 'var(--padding-side)',
|
|
595
524
|
}}
|
|
596
525
|
href="/"
|
|
597
526
|
onContextMenu={!navLogo ? undefined : onContextMenu}
|
package/MenuModal.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from './MenuModal/toggleMenuModal.js'
|
|
15
15
|
import { EditLink } from './EditLink.js'
|
|
16
16
|
|
|
17
|
-
function MenuModal({
|
|
17
|
+
function MenuModal({ isNavLeftAlwaysHidden_ }: { isNavLeftAlwaysHidden_: boolean }) {
|
|
18
18
|
return (
|
|
19
19
|
<>
|
|
20
20
|
<Style>{getStyle()}</Style>
|
|
@@ -22,7 +22,8 @@ function MenuModal({ isTopNav, isNavLeftAlwaysHidden_ }: { isTopNav: boolean; is
|
|
|
22
22
|
id="menu-modal-wrapper"
|
|
23
23
|
className="link-hover-animation add-transition show-on-nav-hover"
|
|
24
24
|
style={{
|
|
25
|
-
|
|
25
|
+
// Absolute inside the sticky header so the dropdown tracks the nav on scroll
|
|
26
|
+
position: 'absolute',
|
|
26
27
|
width: '100%',
|
|
27
28
|
top: 'var(--nav-head-height)',
|
|
28
29
|
zIndex: 199, // maximum value, because docsearch's modal has `z-index: 200`
|
package/components/index.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from '../utils/Emoji/index.js'
|
|
2
2
|
export * from './Link.js'
|
|
3
3
|
export * from './RepoLink.js'
|
|
4
|
-
export * from './P.js'
|
|
5
4
|
export * from './Note.js'
|
|
6
5
|
export * from './ImportMeta.js'
|
|
7
|
-
export * from './HorizontalLine.js'
|
|
8
6
|
export * from './CodeBlockTransformer.js'
|
|
9
|
-
export * from './Comment.js'
|
|
10
7
|
export * from './FileRemoved.js'
|
|
11
8
|
export * from '../code-blocks/components/Tabs.js'
|
package/css/code.css
CHANGED
package/css/font.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
2
2
|
|
|
3
3
|
body {
|
|
4
|
-
font-family: 'Inter', sans-serif;
|
|
4
|
+
font-family: var(--font-sans, 'Inter', sans-serif);
|
|
5
5
|
}
|
|
6
6
|
button {
|
|
7
7
|
font-family: inherit;
|
package/css/heading.css
CHANGED
|
@@ -13,6 +13,11 @@ h3 {
|
|
|
13
13
|
margin-bottom: 20px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/* Offset headings below the sticky top nav (no offset when the top nav scrolls away). */
|
|
17
|
+
.doc-page :is(h1, h2, h3, h4, h5, h6) {
|
|
18
|
+
scroll-margin-top: calc(var(--nav-head-sticky-offset) + 16px);
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
.doc-page h2,
|
|
17
22
|
.doc-page h3 {
|
|
18
23
|
margin-bottom: 16px;
|
package/css/tooltip.css
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from '../utils/Emoji/index.js';
|
|
2
2
|
export * from './Link.js';
|
|
3
3
|
export * from './RepoLink.js';
|
|
4
|
-
export * from './P.js';
|
|
5
4
|
export * from './Note.js';
|
|
6
5
|
export * from './ImportMeta.js';
|
|
7
|
-
export * from './HorizontalLine.js';
|
|
8
6
|
export * from './CodeBlockTransformer.js';
|
|
9
|
-
export * from './Comment.js';
|
|
10
7
|
export * from './FileRemoved.js';
|
|
11
8
|
export * from '../code-blocks/components/Tabs.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from '../utils/Emoji/index.js';
|
|
2
2
|
export * from './Link.js';
|
|
3
3
|
export * from './RepoLink.js';
|
|
4
|
-
export * from './P.js';
|
|
5
4
|
export * from './Note.js';
|
|
6
5
|
export * from './ImportMeta.js';
|
|
7
|
-
export * from './HorizontalLine.js';
|
|
8
6
|
export * from './CodeBlockTransformer.js';
|
|
9
|
-
export * from './Comment.js';
|
|
10
7
|
export * from './FileRemoved.js';
|
|
11
8
|
export * from '../code-blocks/components/Tabs.js';
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
export { PageContextProvider };
|
|
2
2
|
export { usePageContext };
|
|
3
|
-
export { usePageContextLegacy };
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import type { PageContext } from 'vike/types';
|
|
6
|
-
declare function usePageContextLegacy(): {
|
|
7
|
-
navItemsAll: import("../NavItemComponent.js").NavItem[];
|
|
8
|
-
navItemsDetached: import("../NavItemComponent.js").NavItem[] | undefined;
|
|
9
|
-
pageDesign: {
|
|
10
|
-
hideTitle?: true;
|
|
11
|
-
hideMenuLeft?: true;
|
|
12
|
-
contentMaxWidth?: number;
|
|
13
|
-
} | undefined;
|
|
14
|
-
linksAll: import("../components/Link.js").LinkData[];
|
|
15
|
-
isLandingPage: boolean;
|
|
16
|
-
pageTitle: string | null;
|
|
17
|
-
documentTitle: string;
|
|
18
|
-
activeCategoryName: string;
|
|
19
|
-
choices: import("../code-blocks/utils/resolveChoices.js").ResolvedChoices | undefined;
|
|
20
|
-
};
|
|
21
5
|
declare function usePageContext(): PageContext;
|
|
22
6
|
declare function PageContextProvider({ pageContext, children, }: {
|
|
23
7
|
pageContext: PageContext;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
export { PageContextProvider };
|
|
2
2
|
export { usePageContext };
|
|
3
|
-
export { usePageContextLegacy };
|
|
4
3
|
import React, { useContext } from 'react';
|
|
5
4
|
import { getGlobalObject } from '../utils/getGlobalObject.js';
|
|
6
5
|
const globalObject = getGlobalObject('usePageContext.ts', {
|
|
7
6
|
Ctx: React.createContext(undefined),
|
|
8
7
|
});
|
|
9
|
-
function usePageContextLegacy() {
|
|
10
|
-
const { Ctx } = globalObject;
|
|
11
|
-
const pageContext = useContext(Ctx);
|
|
12
|
-
return pageContext.resolved;
|
|
13
|
-
}
|
|
14
8
|
function usePageContext() {
|
|
15
9
|
const pageContext = useContext(globalObject.Ctx);
|
|
16
10
|
return pageContext;
|
package/dist/types/Config.d.ts
CHANGED
package/dist/types/Heading.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ type PageDesign = {
|
|
|
24
24
|
hideTitle?: true;
|
|
25
25
|
hideMenuLeft?: true;
|
|
26
26
|
contentMaxWidth?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the top navigation sticks to the top of the viewport while scrolling.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
topNavSticky?: boolean;
|
|
27
33
|
};
|
|
28
34
|
type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'> & {
|
|
29
35
|
level: 2;
|
package/dist/utils/server.d.ts
CHANGED
package/dist/utils/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brillout/docpress",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.47-commit-e262d2a",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@brillout/picocolors": "^1.0.10",
|
|
@@ -66,10 +66,7 @@
|
|
|
66
66
|
"vike": "^0.4.255",
|
|
67
67
|
"vite": "^8.0.8"
|
|
68
68
|
},
|
|
69
|
-
"repository":
|
|
70
|
-
"type": "git",
|
|
71
|
-
"url": "https://github.com/brillout/docpress"
|
|
72
|
-
},
|
|
69
|
+
"repository": "https://github.com/brillout/docpress",
|
|
73
70
|
"license": "MIT",
|
|
74
71
|
"publishConfig": {
|
|
75
72
|
"access": "public"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { PageContextProvider }
|
|
2
2
|
export { usePageContext }
|
|
3
|
-
export { usePageContextLegacy }
|
|
4
3
|
|
|
5
4
|
import React, { useContext } from 'react'
|
|
6
5
|
import type { PageContext } from 'vike/types'
|
|
@@ -10,12 +9,6 @@ const globalObject = getGlobalObject('usePageContext.ts', {
|
|
|
10
9
|
Ctx: React.createContext<PageContext>(undefined as any),
|
|
11
10
|
})
|
|
12
11
|
|
|
13
|
-
function usePageContextLegacy() {
|
|
14
|
-
const { Ctx } = globalObject
|
|
15
|
-
const pageContext = useContext(Ctx)
|
|
16
|
-
return pageContext.resolved
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
function usePageContext(): PageContext {
|
|
20
13
|
const pageContext = useContext(globalObject.Ctx)
|
|
21
14
|
return pageContext
|
package/types/Config.ts
CHANGED
package/types/Heading.ts
CHANGED
|
@@ -28,6 +28,12 @@ type PageDesign = {
|
|
|
28
28
|
hideTitle?: true
|
|
29
29
|
hideMenuLeft?: true
|
|
30
30
|
contentMaxWidth?: number
|
|
31
|
+
/**
|
|
32
|
+
* Whether the top navigation sticks to the top of the viewport while scrolling.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
topNavSticky?: boolean
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'> & {
|
package/utils/server.ts
CHANGED
package/components/Comment.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { HorizontalLine }
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { cls } from '../utils/cls.js'
|
|
5
|
-
|
|
6
|
-
function HorizontalLine({ primary }: { primary?: true }) {
|
|
7
|
-
return (
|
|
8
|
-
<div className={cls(primary && 'primary')} style={{ textAlign: 'center' }}>
|
|
9
|
-
<hr
|
|
10
|
-
style={{
|
|
11
|
-
display: 'inline-block',
|
|
12
|
-
margin: 0,
|
|
13
|
-
border: 0,
|
|
14
|
-
// Same as `.doc-page h2::after`
|
|
15
|
-
borderTop: '1px solid var(--color-border, rgba(0, 0, 0, 0.1))',
|
|
16
|
-
maxWidth: 500,
|
|
17
|
-
width: '80%',
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
)
|
|
22
|
-
}
|
package/components/P.css
DELETED
package/components/P.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { HorizontalLine };
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { cls } from '../utils/cls.js';
|
|
4
|
-
function HorizontalLine({ primary }) {
|
|
5
|
-
return (React.createElement("div", { className: cls(primary && 'primary'), style: { textAlign: 'center' } },
|
|
6
|
-
React.createElement("hr", { style: {
|
|
7
|
-
display: 'inline-block',
|
|
8
|
-
margin: 0,
|
|
9
|
-
border: 0,
|
|
10
|
-
// Same as `.doc-page h2::after`
|
|
11
|
-
borderTop: '1px solid var(--color-border, rgba(0, 0, 0, 0.1))',
|
|
12
|
-
maxWidth: 500,
|
|
13
|
-
width: '80%',
|
|
14
|
-
} })));
|
|
15
|
-
}
|
package/dist/components/P.d.ts
DELETED
package/dist/components/P.js
DELETED
package/dist/utils/cls.d.ts
DELETED
package/dist/utils/cls.js
DELETED
package/dist/utils/filter.d.ts
DELETED
package/dist/utils/filter.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { filter };
|
|
2
|
-
// https://stackoverflow.com/questions/66341757/typescript-how-to-filter-the-object
|
|
3
|
-
function filter(obj, predicate) {
|
|
4
|
-
const result = {};
|
|
5
|
-
Object.keys(obj).forEach((name) => {
|
|
6
|
-
if (predicate(obj[name], name)) {
|
|
7
|
-
result[name] = obj[name];
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
return result;
|
|
11
|
-
}
|
package/utils/PassTrough.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export { toPosixPath }
|
|
2
|
-
export { assertPosixPath }
|
|
3
|
-
export { toSystemPath }
|
|
4
|
-
|
|
5
|
-
import assert from 'assert'
|
|
6
|
-
|
|
7
|
-
const sepPosix = '/'
|
|
8
|
-
const sepWin32 = '\\'
|
|
9
|
-
|
|
10
|
-
function toPosixPath(path: string) {
|
|
11
|
-
if (isPosix()) {
|
|
12
|
-
assertPosixPath(path)
|
|
13
|
-
return path
|
|
14
|
-
}
|
|
15
|
-
if (isWin32()) {
|
|
16
|
-
const pathPosix = path.split(sepWin32).join(sepPosix)
|
|
17
|
-
assertPosixPath(pathPosix)
|
|
18
|
-
return pathPosix
|
|
19
|
-
}
|
|
20
|
-
assert(false)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function assertPosixPath(path: string) {
|
|
24
|
-
assert(path && !path.includes(sepWin32), `Wrongly formatted path: ${path}`)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function toSystemPath(path: string) {
|
|
28
|
-
if (isPosix()) {
|
|
29
|
-
return toPosixPath(path)
|
|
30
|
-
}
|
|
31
|
-
if (isWin32()) {
|
|
32
|
-
return path.split(sepPosix).join(sepWin32)
|
|
33
|
-
}
|
|
34
|
-
assert(false)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function isWin32() {
|
|
38
|
-
return process.platform === 'win32'
|
|
39
|
-
}
|
|
40
|
-
function isPosix() {
|
|
41
|
-
return !isWin32()
|
|
42
|
-
}
|
package/utils/filter.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { filter }
|
|
2
|
-
|
|
3
|
-
// https://stackoverflow.com/questions/66341757/typescript-how-to-filter-the-object
|
|
4
|
-
function filter<T extends object>(obj: T, predicate: <K extends keyof T>(value: T[K], key: K) => boolean): T {
|
|
5
|
-
const result: { [K in keyof T]?: T[K] } = {}
|
|
6
|
-
;(Object.keys(obj) as Array<keyof T>).forEach((name) => {
|
|
7
|
-
if (predicate(obj[name], name)) {
|
|
8
|
-
result[name] = obj[name]
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
return result as T
|
|
12
|
-
}
|
package/utils/objectAssign.ts
DELETED