@brillout/docpress 0.15.13-commit-2b0e889 → 0.15.13-commit-253f5e5
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/EditLink.tsx +6 -16
- package/Layout.css +9 -0
- package/Layout.tsx +45 -15
- package/MenuModal.tsx +7 -3
- package/NavItemComponent.css +26 -10
- package/NavItemComponent.tsx +2 -2
- package/css/colorize-on-hover.css +9 -2
- package/dist/NavItemComponent.js +2 -2
- package/package.json +1 -1
package/EditLink.tsx
CHANGED
|
@@ -12,18 +12,7 @@ function EditLink({
|
|
|
12
12
|
}: { className?: string; style: React.CSSProperties; verbose?: boolean }) {
|
|
13
13
|
const pageContext = usePageContext()
|
|
14
14
|
const iconSize = 13
|
|
15
|
-
const icon =
|
|
16
|
-
<img
|
|
17
|
-
src={iconPencil}
|
|
18
|
-
width={iconSize}
|
|
19
|
-
height={iconSize}
|
|
20
|
-
style={{
|
|
21
|
-
marginRight: 6,
|
|
22
|
-
position: 'relative',
|
|
23
|
-
top: -1,
|
|
24
|
-
}}
|
|
25
|
-
/>
|
|
26
|
-
)
|
|
15
|
+
const icon = <img src={iconPencil} width={iconSize} height={iconSize} style={{ marginRight: 6 }} />
|
|
27
16
|
const { urlPathname } = pageContext
|
|
28
17
|
const fsPath = urlPathname === '/' ? '/index/+Page.tsx' : `${urlPathname}/+Page.mdx`
|
|
29
18
|
const docsDir = pageContext.globalContext.config.docpress.docsDir ?? 'docs'
|
|
@@ -35,20 +24,21 @@ function EditLink({
|
|
|
35
24
|
style={{
|
|
36
25
|
display: 'inline-flex',
|
|
37
26
|
alignItems: 'center',
|
|
38
|
-
paddingTop:
|
|
39
|
-
paddingBottom:
|
|
27
|
+
paddingTop: 7,
|
|
28
|
+
paddingBottom: 7,
|
|
40
29
|
paddingLeft: 8,
|
|
41
|
-
paddingRight:
|
|
30
|
+
paddingRight: 7,
|
|
42
31
|
border: '1px solid #e0e0e0',
|
|
43
32
|
borderRadius: 7,
|
|
44
33
|
fontSize: '0.91em',
|
|
45
34
|
color: '#6c6c6c',
|
|
46
35
|
background: '#f8f8f8',
|
|
47
36
|
letterSpacing: 0.4,
|
|
37
|
+
lineHeight: 0,
|
|
48
38
|
...style,
|
|
49
39
|
}}
|
|
50
40
|
>
|
|
51
|
-
{icon} Edit{verbose ? '
|
|
41
|
+
{icon} Edit{verbose ? ' page' : ''}
|
|
52
42
|
</a>
|
|
53
43
|
)
|
|
54
44
|
}
|
package/Layout.css
ADDED
package/Layout.tsx
CHANGED
|
@@ -4,6 +4,7 @@ export { viewDesktop }
|
|
|
4
4
|
export { viewTablet }
|
|
5
5
|
export { navLeftWidthMin }
|
|
6
6
|
export { navLeftWidthMax }
|
|
7
|
+
export { bodyMaxWidth }
|
|
7
8
|
export { unexpandNav }
|
|
8
9
|
export { blockMargin }
|
|
9
10
|
|
|
@@ -33,8 +34,9 @@ import { Style } from './utils/Style'
|
|
|
33
34
|
import { cls } from './utils/cls'
|
|
34
35
|
import { iconBooks } from './icons'
|
|
35
36
|
import { EditLink } from './EditLink'
|
|
37
|
+
import './Layout.css'
|
|
36
38
|
|
|
37
|
-
const blockMargin =
|
|
39
|
+
const blockMargin = 4
|
|
38
40
|
const mainViewPadding = 20
|
|
39
41
|
const mainViewWidthMaxInner = 800
|
|
40
42
|
const mainViewWidthMax = (mainViewWidthMaxInner + mainViewPadding * 2) as 840 // 840 = 800 + 20 * 2
|
|
@@ -42,8 +44,10 @@ const navLeftWidthMin = 300
|
|
|
42
44
|
const navLeftWidthMax = 370
|
|
43
45
|
const viewMobile = 450
|
|
44
46
|
const viewTablet = 1016
|
|
45
|
-
const viewDesktop = (mainViewWidthMax + navLeftWidthMin) as
|
|
46
|
-
const viewDesktopLarge = (mainViewWidthMax + navLeftWidthMax + blockMargin) as
|
|
47
|
+
const viewDesktop = (mainViewWidthMax + navLeftWidthMin + blockMargin) as 1144 // 1140 = 840 + 300 + 4
|
|
48
|
+
const viewDesktopLarge = (mainViewWidthMax + navLeftWidthMax + blockMargin) as 1214 // 1214 = 840 + 370 + 4
|
|
49
|
+
// TODO
|
|
50
|
+
const bodyMaxWidth = 1300
|
|
47
51
|
|
|
48
52
|
// Avoid whitespace at the bottom of pages with almost no content
|
|
49
53
|
const whitespaceBuster1: React.CSSProperties = {
|
|
@@ -77,6 +81,8 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
77
81
|
// We don't add `container` to `body` nor `html` beacuse in Firefox it breaks the `position: fixed` of <MenuModal>
|
|
78
82
|
// https://stackoverflow.com/questions/74601420/css-container-inline-size-and-fixed-child
|
|
79
83
|
container: 'container-viewport / inline-size',
|
|
84
|
+
maxWidth: bodyMaxWidth,
|
|
85
|
+
margin: 'auto',
|
|
80
86
|
}}
|
|
81
87
|
>
|
|
82
88
|
<MenuModal isTopNav={isLandingPage} />
|
|
@@ -108,14 +114,22 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
|
108
114
|
<PageContent>{children}</PageContent>
|
|
109
115
|
</div>
|
|
110
116
|
<Style>{css`
|
|
117
|
+
@container container-viewport (max-width: ${viewDesktopLarge - 1}px) {
|
|
118
|
+
#nav-left {
|
|
119
|
+
flex-grow: 1;
|
|
120
|
+
min-width: ${navLeftWidthMin + blockMargin}px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
111
123
|
@container container-viewport (min-width: ${viewDesktopLarge}px) {
|
|
112
124
|
.low-prio-grow {
|
|
113
125
|
flex-grow: 1;
|
|
114
126
|
}
|
|
115
|
-
#
|
|
116
|
-
width: ${navLeftWidthMax}px
|
|
127
|
+
#nav-left {
|
|
128
|
+
min-width: ${navLeftWidthMax + blockMargin}px;
|
|
117
129
|
}
|
|
118
|
-
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
`}</Style>
|
|
119
133
|
</>
|
|
120
134
|
)
|
|
121
135
|
}
|
|
@@ -181,12 +195,16 @@ function NavLeft() {
|
|
|
181
195
|
id="nav-left"
|
|
182
196
|
className="link-hover-animation"
|
|
183
197
|
style={{
|
|
198
|
+
/* TODO
|
|
184
199
|
flexGrow: 1,
|
|
185
|
-
|
|
200
|
+
*/
|
|
201
|
+
borderRight: 'var(--block-margin) solid var(--background-color)',
|
|
186
202
|
zIndex: 1,
|
|
187
203
|
// We must set min-width to avoid layout overflow when the text of a navigation item exceeds the available width.
|
|
188
204
|
// https://stackoverflow.com/questions/36230944/prevent-flex-items-from-overflowing-a-container/66689926#66689926
|
|
189
|
-
|
|
205
|
+
// TODO: remove
|
|
206
|
+
// minWidth: navLeftWidthMin + blockMargin,
|
|
207
|
+
// maxWidth: navLeftWidthMax,
|
|
190
208
|
}}
|
|
191
209
|
>
|
|
192
210
|
<div
|
|
@@ -199,8 +217,10 @@ function NavLeft() {
|
|
|
199
217
|
<div
|
|
200
218
|
style={{
|
|
201
219
|
backgroundColor: 'var(--bg-color)',
|
|
220
|
+
/* TODO: remove?
|
|
202
221
|
display: 'flex',
|
|
203
222
|
justifyContent: 'flex-end',
|
|
223
|
+
*/
|
|
204
224
|
}}
|
|
205
225
|
>
|
|
206
226
|
<div
|
|
@@ -212,7 +232,6 @@ function NavLeft() {
|
|
|
212
232
|
overscrollBehavior: 'contain',
|
|
213
233
|
paddingBottom: 40,
|
|
214
234
|
minWidth: navLeftWidthMin,
|
|
215
|
-
maxWidth: navLeftWidthMax,
|
|
216
235
|
width: '100%',
|
|
217
236
|
}}
|
|
218
237
|
>
|
|
@@ -302,10 +321,11 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
302
321
|
<div
|
|
303
322
|
className={cls(['nav-head link-hover-animation', isNavLeft && 'is-nav-left', !!navMaxWidth && 'has-max-width'])}
|
|
304
323
|
style={{
|
|
305
|
-
|
|
306
|
-
|
|
324
|
+
// TODO: remove?
|
|
325
|
+
// display: 'flex',
|
|
326
|
+
// justifyContent: isNavLeft ? 'flex-end' : 'center',
|
|
307
327
|
backgroundColor: 'var(--bg-color)',
|
|
308
|
-
borderBottom: 'var(--block-margin) solid
|
|
328
|
+
borderBottom: 'var(--block-margin) solid var(--background-color)',
|
|
309
329
|
position: 'relative',
|
|
310
330
|
}}
|
|
311
331
|
>
|
|
@@ -315,8 +335,9 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
315
335
|
// DON'T REMOVE this container: it's needed for the `cqw` values
|
|
316
336
|
container: 'container-nav-head / inline-size',
|
|
317
337
|
width: '100%',
|
|
318
|
-
|
|
319
|
-
|
|
338
|
+
// TODO
|
|
339
|
+
// minWidth: isNavLeft && navLeftWidthMin,
|
|
340
|
+
// maxWidth: isNavLeft && navLeftWidthMax,
|
|
320
341
|
}}
|
|
321
342
|
>
|
|
322
343
|
<div
|
|
@@ -347,6 +368,12 @@ function getStyleNav() {
|
|
|
347
368
|
|
|
348
369
|
// Mobile
|
|
349
370
|
style += css`
|
|
371
|
+
/* TODO: move */
|
|
372
|
+
.nav-item {
|
|
373
|
+
box-sizing: content-box;
|
|
374
|
+
max-width: ${navLeftWidthMax}px;
|
|
375
|
+
}
|
|
376
|
+
|
|
350
377
|
@media(max-width: ${viewMobile}px) {
|
|
351
378
|
.nav-head:not(.is-nav-left) {
|
|
352
379
|
.nav-head-menu-toggle {
|
|
@@ -495,7 +522,7 @@ function NavHeadLeftFullWidthBackground() {
|
|
|
495
522
|
left: 0,
|
|
496
523
|
top: 0,
|
|
497
524
|
boxSizing: 'content-box',
|
|
498
|
-
borderBottom: 'var(--block-margin) solid
|
|
525
|
+
borderBottom: 'var(--block-margin) solid var(--background-color)',
|
|
499
526
|
}}
|
|
500
527
|
/>
|
|
501
528
|
<Style>{
|
|
@@ -546,6 +573,7 @@ function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
546
573
|
|
|
547
574
|
return (
|
|
548
575
|
<a
|
|
576
|
+
className="nav-head-logo"
|
|
549
577
|
style={{
|
|
550
578
|
display: 'flex',
|
|
551
579
|
alignItems: 'center',
|
|
@@ -557,8 +585,10 @@ function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
557
585
|
paddingRight: 'var(--padding-side)',
|
|
558
586
|
}
|
|
559
587
|
: {
|
|
588
|
+
/* TODO
|
|
560
589
|
paddingLeft: 15,
|
|
561
590
|
marginLeft: -10,
|
|
591
|
+
*/
|
|
562
592
|
}),
|
|
563
593
|
}}
|
|
564
594
|
href="/"
|
package/MenuModal.tsx
CHANGED
|
@@ -3,7 +3,7 @@ export { MenuModal }
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { usePageContext } from './renderer/usePageContext'
|
|
5
5
|
import { css } from './utils/css'
|
|
6
|
-
import { viewDesktop, viewTablet } from './Layout'
|
|
6
|
+
import { bodyMaxWidth, viewDesktop, viewTablet } from './Layout'
|
|
7
7
|
import { ExternalLinks } from './ExternalLinks'
|
|
8
8
|
import { Style } from './utils/Style'
|
|
9
9
|
import { NavigationWithColumnLayout } from './MenuModal/NavigationWithColumnLayout'
|
|
@@ -21,11 +21,15 @@ function MenuModal({ isTopNav }: { isTopNav: boolean }) {
|
|
|
21
21
|
position: isTopNav ? 'absolute' : 'fixed',
|
|
22
22
|
width: '100%',
|
|
23
23
|
top: 'var(--nav-head-height)',
|
|
24
|
-
left: 0,
|
|
25
24
|
zIndex: 199, // maximum value, because docsearch's modal has `z-index: 200`
|
|
26
25
|
background: '#ededef',
|
|
27
26
|
transitionProperty: 'opacity',
|
|
28
27
|
transitionTimingFunction: 'ease',
|
|
28
|
+
maxWidth: bodyMaxWidth,
|
|
29
|
+
// Horizontal align
|
|
30
|
+
// https://stackoverflow.com/questions/3157372/css-horizontal-centering-of-a-fixed-div/32694476#32694476
|
|
31
|
+
left: '50%',
|
|
32
|
+
transform: 'translateX(-50%)',
|
|
29
33
|
}}
|
|
30
34
|
onMouseOver={keepMenuModalOpenOnMouseOver}
|
|
31
35
|
onMouseLeave={closeMenuModalOnMouseLeave}
|
|
@@ -66,7 +70,7 @@ function BorderBottom() {
|
|
|
66
70
|
<div
|
|
67
71
|
id="border-bottom"
|
|
68
72
|
style={{
|
|
69
|
-
background: '
|
|
73
|
+
background: 'var(--background-color)',
|
|
70
74
|
height: 'var(--block-margin)',
|
|
71
75
|
width: '100%',
|
|
72
76
|
}}
|
package/NavItemComponent.css
CHANGED
|
@@ -91,6 +91,8 @@
|
|
|
91
91
|
--box-shadow-top: 0 0;
|
|
92
92
|
--box-shadow-bottom: 0 0;
|
|
93
93
|
box-shadow: var(--box-shadow-top), var(--box-shadow-bottom), var(--box-shadow-left), var(--box-shadow-right);
|
|
94
|
+
box-shadow: var(--box-shadow-top), var(--box-shadow-right);
|
|
95
|
+
box-shadow: var(--box-shadow-top), var(--box-shadow-bottom);
|
|
94
96
|
}
|
|
95
97
|
.nav-item-level-3.nav-item-first-of-its-kind {
|
|
96
98
|
padding-top: 10px;
|
|
@@ -105,14 +107,28 @@
|
|
|
105
107
|
position: relative;
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
.nav-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
/* TODO: remove
|
|
111
|
+
.nav-head-content {
|
|
112
|
+
border-left: 1px solid red;
|
|
113
|
+
}
|
|
114
|
+
.nav-item-level-1 {
|
|
115
|
+
border-left: 1px solid red;
|
|
116
|
+
}
|
|
117
|
+
.nav-item-level-3 {
|
|
118
|
+
border-left: 1px solid red;
|
|
119
|
+
}
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
#nav-left {
|
|
123
|
+
.nav-item-level-1 {
|
|
124
|
+
margin-left: min(25px, max(3px, 30 * (1vw - 12.7px) - 5px));
|
|
125
|
+
}
|
|
126
|
+
.nav-head-logo {
|
|
127
|
+
padding-left: min(25px, max(3px, 30 * (1vw - 12.7px) - 5px));
|
|
128
|
+
}
|
|
129
|
+
.nav-item-level-2,
|
|
130
|
+
.nav-item-level-3,
|
|
131
|
+
.nav-item-level-4 {
|
|
132
|
+
padding-left: min(30px, max(6px, 30 * (1vw - 12.7px)));
|
|
133
|
+
}
|
|
118
134
|
}
|
package/NavItemComponent.tsx
CHANGED
|
@@ -68,7 +68,7 @@ function NavItemComponent({
|
|
|
68
68
|
const icon = navItem.titleIcon && (
|
|
69
69
|
<img
|
|
70
70
|
src={navItem.titleIcon}
|
|
71
|
-
style={{ height: iconSize, width: iconSize, marginRight: 8, marginLeft:
|
|
71
|
+
style={{ height: iconSize, width: iconSize, marginRight: 8, marginLeft: 2, ...navItem.titleIconStyle }}
|
|
72
72
|
/>
|
|
73
73
|
)
|
|
74
74
|
|
|
@@ -106,7 +106,7 @@ function NavItemComponent({
|
|
|
106
106
|
className: [
|
|
107
107
|
'nav-item',
|
|
108
108
|
'nav-item-level-' + navItem.level,
|
|
109
|
-
navItem.url && navItem.isActive && ' is-active',
|
|
109
|
+
((navItem.url && navItem.isActive) || navItem.level === 3) && ' is-active',
|
|
110
110
|
navItem.isFirstOfItsKind && 'nav-item-first-of-its-kind',
|
|
111
111
|
navItem.isLastOfItsKind && 'nav-item-last-of-its-kind',
|
|
112
112
|
]
|
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
.colorize-on-hover:hover [class*=' decolorize-'] {
|
|
8
8
|
filter: grayscale(0) opacity(1) !important;
|
|
9
9
|
}
|
|
10
|
+
.is-active {
|
|
11
|
+
background-color: var(--active-color);
|
|
12
|
+
}
|
|
10
13
|
.link-hover-animation a:hover {
|
|
11
|
-
color: black !important;
|
|
12
14
|
background-color: var(--active-color);
|
|
15
|
+
&.is-active {
|
|
16
|
+
background-color: var(--double-active-color);
|
|
17
|
+
}
|
|
13
18
|
}
|
|
14
19
|
}
|
|
15
20
|
|
|
@@ -46,5 +51,7 @@
|
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
body {
|
|
49
|
-
--active-color:
|
|
54
|
+
--active-color-value: 0.03;
|
|
55
|
+
--active-color: rgba(0, 0, 0, var(--active-color-value));
|
|
56
|
+
--double-active-color: rgba(0, 0, 0, calc(2 * var(--active-color-value)));
|
|
50
57
|
}
|
package/dist/NavItemComponent.js
CHANGED
|
@@ -9,7 +9,7 @@ function NavItemComponent({ navItem, onClick, }) {
|
|
|
9
9
|
const titleJsx = parseMarkdownMini(navItem.title);
|
|
10
10
|
const titleInNavJsx = parseMarkdownMini(navItem.titleInNav);
|
|
11
11
|
const iconSize = 25;
|
|
12
|
-
const icon = navItem.titleIcon && (React.createElement("img", { src: navItem.titleIcon, style: { height: iconSize, width: iconSize, marginRight: 8, marginLeft:
|
|
12
|
+
const icon = navItem.titleIcon && (React.createElement("img", { src: navItem.titleIcon, style: { height: iconSize, width: iconSize, marginRight: 8, marginLeft: 2, ...navItem.titleIconStyle } }));
|
|
13
13
|
if (navItem.level === 1 || navItem.level === 4) {
|
|
14
14
|
assert(navItem.url === undefined);
|
|
15
15
|
}
|
|
@@ -37,7 +37,7 @@ function NavItemComponent({ navItem, onClick, }) {
|
|
|
37
37
|
className: [
|
|
38
38
|
'nav-item',
|
|
39
39
|
'nav-item-level-' + navItem.level,
|
|
40
|
-
navItem.url && navItem.isActive && ' is-active',
|
|
40
|
+
((navItem.url && navItem.isActive) || navItem.level === 3) && ' is-active',
|
|
41
41
|
navItem.isFirstOfItsKind && 'nav-item-first-of-its-kind',
|
|
42
42
|
navItem.isLastOfItsKind && 'nav-item-last-of-its-kind',
|
|
43
43
|
]
|