@brillout/docpress 0.15.13-commit-c682b3d → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Layout.css +2 -7
- package/Layout.tsx +33 -45
- package/MenuModal.tsx +3 -3
- package/NavItemComponent.css +10 -21
- package/NavItemComponent.tsx +1 -1
- package/css/colorize-on-hover.css +6 -6
- package/css/heading.css +7 -1
- package/dist/NavItemComponent.js +1 -1
- package/package.json +1 -1
package/Layout.css
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
body {
|
|
2
|
-
background: var(--
|
|
3
|
-
|
|
4
|
-
--background-color: #fbfbfb;
|
|
5
|
-
--background-color: #fcfcfc;
|
|
6
|
-
--background-color: white;
|
|
7
|
-
--background-color: #fefefe;
|
|
8
|
-
--background-color: #fdfdfd;
|
|
2
|
+
background: var(--color-bg-white);
|
|
3
|
+
--color-bg-white: #fdfdfd;
|
|
9
4
|
}
|
package/Layout.tsx
CHANGED
|
@@ -46,7 +46,6 @@ const viewMobile = 450
|
|
|
46
46
|
const viewTablet = 1016
|
|
47
47
|
const viewDesktop = (mainViewWidthMax + navLeftWidthMin + blockMargin) as 1144 // 1140 = 840 + 300 + 4
|
|
48
48
|
const viewDesktopLarge = (mainViewWidthMax + navLeftWidthMax + blockMargin) as 1214 // 1214 = 840 + 370 + 4
|
|
49
|
-
// TODO
|
|
50
49
|
const bodyMaxWidth = 1300
|
|
51
50
|
|
|
52
51
|
// Avoid whitespace at the bottom of pages with almost no content
|
|
@@ -70,11 +69,11 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
70
69
|
content = <LayoutDocsPage>{children}</LayoutDocsPage>
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
const
|
|
72
|
+
const isNavLeftAlwaysHidden_ = isNavLeftAlwaysHidden()
|
|
74
73
|
return (
|
|
75
74
|
<div
|
|
76
75
|
style={{
|
|
77
|
-
['--bg-
|
|
76
|
+
['--color-bg-gray']: '#f5f5f5',
|
|
78
77
|
['--block-margin']: `${blockMargin}px`,
|
|
79
78
|
// ['--nav-head-height']: `${isLandingPage ? 70 : 63}px`,
|
|
80
79
|
['--nav-head-height']: `63px`,
|
|
@@ -82,18 +81,18 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
82
81
|
// We don't add `container` to `body` nor `html` beacuse in Firefox it breaks the `position: fixed` of <MenuModal>
|
|
83
82
|
// https://stackoverflow.com/questions/74601420/css-container-inline-size-and-fixed-child
|
|
84
83
|
container: 'container-viewport / inline-size',
|
|
85
|
-
maxWidth:
|
|
84
|
+
maxWidth: isNavLeftAlwaysHidden_ ? undefined : bodyMaxWidth,
|
|
86
85
|
margin: 'auto',
|
|
87
86
|
}}
|
|
88
87
|
>
|
|
89
|
-
<MenuModal isTopNav={isLandingPage}
|
|
88
|
+
<MenuModal isTopNav={isLandingPage} isNavLeftAlwaysHidden_={isNavLeftAlwaysHidden_} />
|
|
90
89
|
<div className={isLandingPage ? '' : 'doc-page'} style={whitespaceBuster1}>
|
|
91
90
|
<NavHead />
|
|
92
91
|
{content}
|
|
93
92
|
</div>
|
|
94
93
|
{/* Early toggling, to avoid layout jumps */}
|
|
95
94
|
<script dangerouslySetInnerHTML={{ __html: initializeJsToggle_SSR }}></script>
|
|
96
|
-
<Style>{
|
|
95
|
+
<Style>{getStyleLayout()}</Style>
|
|
97
96
|
</div>
|
|
98
97
|
)
|
|
99
98
|
}
|
|
@@ -108,7 +107,7 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
|
108
107
|
<div
|
|
109
108
|
id="nav-left-margin"
|
|
110
109
|
className="low-prio-grow"
|
|
111
|
-
style={{ width: 0, maxWidth: 50, background: 'var(--bg-
|
|
110
|
+
style={{ width: 0, maxWidth: 50, background: 'var(--color-bg-gray)' }}
|
|
112
111
|
/>
|
|
113
112
|
</>
|
|
114
113
|
)}
|
|
@@ -129,7 +128,14 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
|
129
128
|
min-width: ${navLeftWidthMax + blockMargin}px;
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
|
|
131
|
+
.page-content {
|
|
132
|
+
--hash-offset: 24px;
|
|
133
|
+
}
|
|
134
|
+
@container container-viewport (max-width: ${viewDesktopLarge - 1}px) and (min-width: ${viewDesktop}px) {
|
|
135
|
+
.page-content {
|
|
136
|
+
--hash-offset: 27px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
133
139
|
`}</Style>
|
|
134
140
|
</>
|
|
135
141
|
)
|
|
@@ -159,7 +165,7 @@ function PageContent({ children }: { children: React.ReactNode }) {
|
|
|
159
165
|
// https://stackoverflow.com/questions/36230944/prevent-flex-items-from-overflowing-a-container/66689926#66689926
|
|
160
166
|
minWidth: 0,
|
|
161
167
|
...ifDocPage({
|
|
162
|
-
backgroundColor: 'var(--bg-
|
|
168
|
+
backgroundColor: 'var(--color-bg-gray)',
|
|
163
169
|
paddingBottom: 50,
|
|
164
170
|
}),
|
|
165
171
|
}}
|
|
@@ -196,16 +202,10 @@ function NavLeft() {
|
|
|
196
202
|
id="nav-left"
|
|
197
203
|
className="link-hover-animation"
|
|
198
204
|
style={{
|
|
199
|
-
|
|
200
|
-
flexGrow: 1,
|
|
201
|
-
*/
|
|
202
|
-
borderRight: 'var(--block-margin) solid var(--background-color)',
|
|
205
|
+
borderRight: 'var(--block-margin) solid var(--color-bg-white)',
|
|
203
206
|
zIndex: 1,
|
|
204
207
|
// We must set min-width to avoid layout overflow when the text of a navigation item exceeds the available width.
|
|
205
208
|
// https://stackoverflow.com/questions/36230944/prevent-flex-items-from-overflowing-a-container/66689926#66689926
|
|
206
|
-
// TODO: remove
|
|
207
|
-
// minWidth: navLeftWidthMin + blockMargin,
|
|
208
|
-
// maxWidth: navLeftWidthMax,
|
|
209
209
|
}}
|
|
210
210
|
>
|
|
211
211
|
<div
|
|
@@ -217,11 +217,7 @@ function NavLeft() {
|
|
|
217
217
|
<NavHead isNavLeft={true} />
|
|
218
218
|
<div
|
|
219
219
|
style={{
|
|
220
|
-
backgroundColor: 'var(--bg-
|
|
221
|
-
/* TODO: remove?
|
|
222
|
-
display: 'flex',
|
|
223
|
-
justifyContent: 'flex-end',
|
|
224
|
-
*/
|
|
220
|
+
backgroundColor: 'var(--color-bg-gray)',
|
|
225
221
|
}}
|
|
226
222
|
>
|
|
227
223
|
<div
|
|
@@ -247,9 +243,18 @@ function NavLeft() {
|
|
|
247
243
|
</div>
|
|
248
244
|
{/* Early scrolling, to avoid flashing */}
|
|
249
245
|
<script dangerouslySetInnerHTML={{ __html: autoScrollNav_SSR }}></script>
|
|
246
|
+
<Style>{getStyleNavLeft()}</Style>
|
|
250
247
|
</>
|
|
251
248
|
)
|
|
252
249
|
}
|
|
250
|
+
function getStyleNavLeft() {
|
|
251
|
+
return css`
|
|
252
|
+
.nav-item {
|
|
253
|
+
box-sizing: content-box;
|
|
254
|
+
max-width: ${navLeftWidthMax}px;
|
|
255
|
+
}`
|
|
256
|
+
}
|
|
257
|
+
|
|
253
258
|
function NavigationContent(props: {
|
|
254
259
|
navItems: NavItem[]
|
|
255
260
|
showOnlyRelevant?: true
|
|
@@ -322,11 +327,8 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
322
327
|
<div
|
|
323
328
|
className={cls(['nav-head link-hover-animation', isNavLeft && 'is-nav-left', !!navMaxWidth && 'has-max-width'])}
|
|
324
329
|
style={{
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
// justifyContent: isNavLeft ? 'flex-end' : 'center',
|
|
328
|
-
backgroundColor: 'var(--bg-color)',
|
|
329
|
-
borderBottom: 'var(--block-margin) solid var(--background-color)',
|
|
330
|
+
backgroundColor: 'var(--color-bg-gray)',
|
|
331
|
+
borderBottom: 'var(--block-margin) solid var(--color-bg-white)',
|
|
330
332
|
position: 'relative',
|
|
331
333
|
}}
|
|
332
334
|
>
|
|
@@ -336,9 +338,6 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
336
338
|
// DON'T REMOVE this container: it's needed for the `cqw` values
|
|
337
339
|
container: 'container-nav-head / inline-size',
|
|
338
340
|
width: '100%',
|
|
339
|
-
// TODO
|
|
340
|
-
// minWidth: isNavLeft && navLeftWidthMin,
|
|
341
|
-
// maxWidth: isNavLeft && navLeftWidthMax,
|
|
342
341
|
}}
|
|
343
342
|
>
|
|
344
343
|
<div
|
|
@@ -364,17 +363,11 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
364
363
|
</div>
|
|
365
364
|
)
|
|
366
365
|
}
|
|
367
|
-
function
|
|
366
|
+
function getStyleLayout() {
|
|
368
367
|
let style = ''
|
|
369
368
|
|
|
370
369
|
// Mobile
|
|
371
370
|
style += css`
|
|
372
|
-
/* TODO: move */
|
|
373
|
-
.nav-item {
|
|
374
|
-
box-sizing: content-box;
|
|
375
|
-
max-width: ${navLeftWidthMax}px;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
371
|
@media(max-width: ${viewMobile}px) {
|
|
379
372
|
.nav-head:not(.is-nav-left) {
|
|
380
373
|
.nav-head-menu-toggle {
|
|
@@ -518,12 +511,12 @@ function NavHeadLeftFullWidthBackground() {
|
|
|
518
511
|
style={{
|
|
519
512
|
height: '100%',
|
|
520
513
|
zIndex: -1,
|
|
521
|
-
background: 'var(--bg-
|
|
514
|
+
background: 'var(--color-bg-gray)',
|
|
522
515
|
position: 'absolute',
|
|
523
516
|
left: 0,
|
|
524
517
|
top: 0,
|
|
525
518
|
boxSizing: 'content-box',
|
|
526
|
-
borderBottom: 'var(--block-margin) solid var(--
|
|
519
|
+
borderBottom: 'var(--block-margin) solid var(--color-bg-white)',
|
|
527
520
|
}}
|
|
528
521
|
/>
|
|
529
522
|
<Style>{
|
|
@@ -585,12 +578,7 @@ function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
585
578
|
paddingLeft: 'var(--main-view-padding)',
|
|
586
579
|
paddingRight: 'var(--padding-side)',
|
|
587
580
|
}
|
|
588
|
-
: {
|
|
589
|
-
/* TODO
|
|
590
|
-
paddingLeft: 15,
|
|
591
|
-
marginLeft: -10,
|
|
592
|
-
*/
|
|
593
|
-
}),
|
|
581
|
+
: {}),
|
|
594
582
|
}}
|
|
595
583
|
href="/"
|
|
596
584
|
onContextMenu={!navLogo ? undefined : onContextMenu}
|
|
@@ -696,7 +684,7 @@ function MenuToggle({ menuId, ...props }: PropsDiv & { menuId: number }) {
|
|
|
696
684
|
height: 100%;
|
|
697
685
|
width: 100%;
|
|
698
686
|
top: var(--nav-head-height);
|
|
699
|
-
background-color: var(--active
|
|
687
|
+
background-color: var(--color-active);
|
|
700
688
|
transition-property: top !important;
|
|
701
689
|
transition: top 0.4s ease !important;
|
|
702
690
|
z-index: -1;
|
package/MenuModal.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { NavigationWithColumnLayout } from './MenuModal/NavigationWithColumnLayo
|
|
|
10
10
|
import { closeMenuModal, closeMenuModalOnMouseLeave, keepMenuModalOpenOnMouseOver } from './MenuModal/toggleMenuModal'
|
|
11
11
|
import { EditLink } from './EditLink'
|
|
12
12
|
|
|
13
|
-
function MenuModal({ isTopNav,
|
|
13
|
+
function MenuModal({ isTopNav, isNavLeftAlwaysHidden_ }: { isTopNav: boolean; isNavLeftAlwaysHidden_: boolean }) {
|
|
14
14
|
return (
|
|
15
15
|
<>
|
|
16
16
|
<Style>{getStyle()}</Style>
|
|
@@ -25,7 +25,7 @@ function MenuModal({ isTopNav, isNavLeftHidden }: { isTopNav: boolean; isNavLeft
|
|
|
25
25
|
background: '#ededef',
|
|
26
26
|
transitionProperty: 'opacity',
|
|
27
27
|
transitionTimingFunction: 'ease',
|
|
28
|
-
maxWidth:
|
|
28
|
+
maxWidth: isNavLeftAlwaysHidden_ ? undefined : bodyMaxWidth,
|
|
29
29
|
// Horizontal align
|
|
30
30
|
// https://stackoverflow.com/questions/3157372/css-horizontal-centering-of-a-fixed-div/32694476#32694476
|
|
31
31
|
left: '50%',
|
|
@@ -70,7 +70,7 @@ function BorderBottom() {
|
|
|
70
70
|
<div
|
|
71
71
|
id="border-bottom"
|
|
72
72
|
style={{
|
|
73
|
-
background: 'var(--
|
|
73
|
+
background: 'var(--color-bg-white)',
|
|
74
74
|
height: 'var(--block-margin)',
|
|
75
75
|
width: '100%',
|
|
76
76
|
}}
|
package/NavItemComponent.css
CHANGED
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
padding-left: 9px;
|
|
37
37
|
padding-top: 6px;
|
|
38
38
|
padding-bottom: 6px;
|
|
39
|
-
border-left: 3px solid var(--category
|
|
39
|
+
border-left: 3px solid var(--color-category);
|
|
40
40
|
.collapsible-expanded &,
|
|
41
41
|
.collapsible-collapsed & {
|
|
42
42
|
text-decoration: underline;
|
|
43
|
-
text-decoration-color: var(--category
|
|
43
|
+
text-decoration-color: var(--color-category);
|
|
44
44
|
text-decoration-thickness: 3px;
|
|
45
45
|
text-underline-offset: .3em;
|
|
46
46
|
border: 0;
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
#nav-left & {
|
|
56
|
-
border-bottom: 3px solid var(--category
|
|
56
|
+
border-bottom: 3px solid var(--color-category);
|
|
57
57
|
padding-bottom: 2px;
|
|
58
58
|
margin-top: 3px;
|
|
59
59
|
margin-bottom: 10px;
|
|
@@ -86,12 +86,13 @@
|
|
|
86
86
|
--shadow-size-minus: calc(-1 * var(--shadow-size));
|
|
87
87
|
--shadow-top: inset 0px var(--shadow-size) var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
88
88
|
--shadow-bottom: inset 0px var(--shadow-size-minus) var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
89
|
-
--box-shadow-left: inset var(--shadow-size-minus) 0px var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
90
|
-
--box-shadow-right: inset var(--shadow-size) 0px var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
91
89
|
--box-shadow-top: 0 0;
|
|
92
90
|
--box-shadow-bottom: 0 0;
|
|
91
|
+
/*
|
|
92
|
+
--box-shadow-left: inset var(--shadow-size-minus) 0px var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
93
|
+
--box-shadow-right: inset var(--shadow-size) 0px var(--shadow-size) var(--shadow-size-minus) var(--shadow-color);
|
|
93
94
|
box-shadow: var(--box-shadow-top), var(--box-shadow-bottom), var(--box-shadow-left), var(--box-shadow-right);
|
|
94
|
-
|
|
95
|
+
*/
|
|
95
96
|
box-shadow: var(--box-shadow-top), var(--box-shadow-bottom);
|
|
96
97
|
}
|
|
97
98
|
.nav-item-level-3.nav-item-first-of-its-kind {
|
|
@@ -107,28 +108,16 @@
|
|
|
107
108
|
position: relative;
|
|
108
109
|
}
|
|
109
110
|
|
|
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
111
|
#nav-left {
|
|
123
112
|
.nav-item-level-1 {
|
|
124
|
-
margin-left: min(25px, max(
|
|
113
|
+
margin-left: min(25px, max(5px, 30 * (1vw - 12.7px) - 5px));
|
|
125
114
|
}
|
|
126
115
|
.nav-head-logo {
|
|
127
|
-
padding-left: min(25px, max(
|
|
116
|
+
padding-left: min(25px, max(5px, 30 * (1vw - 12.7px) - 5px));
|
|
128
117
|
}
|
|
129
118
|
.nav-item-level-2,
|
|
130
119
|
.nav-item-level-3,
|
|
131
120
|
.nav-item-level-4 {
|
|
132
|
-
padding-left: min(30px, max(
|
|
121
|
+
padding-left: min(30px, max(8px, 30 * (1vw - 12.7px)));
|
|
133
122
|
}
|
|
134
123
|
}
|
package/NavItemComponent.tsx
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
filter: grayscale(0) opacity(1) !important;
|
|
9
9
|
}
|
|
10
10
|
.is-active {
|
|
11
|
-
background-color: var(--active
|
|
11
|
+
background-color: var(--color-active);
|
|
12
12
|
}
|
|
13
13
|
.link-hover-animation a:hover {
|
|
14
|
-
background-color: var(--active
|
|
14
|
+
background-color: var(--color-active);
|
|
15
15
|
&.is-active {
|
|
16
|
-
background-color: var(--
|
|
16
|
+
background-color: var(--color-active-double);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
body {
|
|
54
|
-
--active-
|
|
55
|
-
--active
|
|
56
|
-
--
|
|
54
|
+
--color-active-value: 0.03;
|
|
55
|
+
--color-active: rgba(0, 0, 0, var(--color-active-value));
|
|
56
|
+
--color-active-double: rgba(0, 0, 0, calc(2 * var(--color-active-value)));
|
|
57
57
|
}
|
package/css/heading.css
CHANGED
|
@@ -77,7 +77,13 @@ h3 {
|
|
|
77
77
|
.doc-page h3[id]:hover::before {
|
|
78
78
|
content: '#';
|
|
79
79
|
position: absolute;
|
|
80
|
-
|
|
80
|
+
height: 100%;
|
|
81
|
+
line-height: 0;
|
|
82
|
+
font-size: 23px;
|
|
83
|
+
top: 1px;
|
|
84
|
+
left: calc(-1 * (0.75em - var(--hash-offset)));
|
|
81
85
|
color: #aaa;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
82
88
|
}
|
|
83
89
|
}
|
package/dist/NavItemComponent.js
CHANGED