@brillout/docpress 0.7.9-commit-ec0a3b5 → 0.7.10-commit-776b1fc
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/+config.ts +2 -10
- package/Layout.tsx +397 -67
- package/{navigation/NavigationHeader.tsx → Links.tsx} +6 -57
- package/MenuModal.tsx +146 -0
- package/autoScrollNav.ts +4 -5
- package/components/CodeBlockTransformer.tsx +0 -2
- package/components/Note.css +4 -4
- package/components/Note.tsx +0 -2
- package/components/Supporters.tsx +1 -0
- package/config/resolveHeadingsData.ts +20 -23
- package/config/resolvePageContext.ts +11 -1
- package/css/code/block.css +5 -5
- package/css/code/inline.css +1 -1
- package/css/code.css +9 -5
- package/css/index.css +0 -4
- package/css/reset.css +0 -6
- package/dist/+config.d.ts +1 -13
- package/dist/+config.js +0 -3
- package/dist/components/CodeBlockTransformer.d.ts +1 -0
- package/dist/components/CodeBlockTransformer.js +1 -0
- package/dist/components/Note.d.ts +1 -0
- package/dist/components/Note.js +1 -0
- package/dist/components/Supporters.js +1 -0
- package/dist/config/resolveHeadingsData.d.ts +5 -8
- package/dist/config/resolveHeadingsData.js +20 -22
- package/dist/config/resolvePageContext.d.ts +5 -7
- package/dist/config/resolvePageContext.js +2 -1
- package/dist/navigation/Navigation.d.ts +12 -17
- package/dist/navigation/Navigation.js +75 -74
- package/dist/renderer/getStyleColumnLayout.d.ts +7 -0
- package/dist/renderer/getStyleColumnLayout.js +167 -0
- package/dist/types/Heading.d.ts +2 -4
- package/dist/utils/client.d.ts +1 -0
- package/dist/utils/client.js +1 -0
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +27 -0
- package/dist/utils/getGlobalObject.d.ts +1 -0
- package/dist/utils/getGlobalObject.js +9 -0
- package/docsearch/DocSearchInstall.tsx +23 -0
- package/docsearch/SearchLink.tsx +48 -0
- package/docsearch/closeDocsearchModal.ts +29 -0
- package/initKeyBindings.ts +41 -0
- package/installSectionUrlHashs.ts +6 -5
- package/navigation/Navigation.css +101 -3
- package/navigation/Navigation.tsx +110 -128
- package/package.json +1 -8
- package/renderer/getPageContextCurrent.ts +16 -0
- package/renderer/getPageElement.tsx +19 -7
- package/renderer/getStyleColumnLayout.ts +187 -0
- package/renderer/onRenderClient.tsx +20 -24
- package/renderer/onRenderHtml.tsx +3 -8
- package/types/Heading.ts +2 -5
- package/types.d.ts +8 -0
- package/utils/client.ts +1 -0
- package/utils/css.ts +26 -0
- package/utils/getGlobalObject.ts +11 -0
- package/Layout.css +0 -63
- package/MobileHeader.tsx +0 -70
- package/algolia/DocSearch.css +0 -28
- package/components/FeatureList/FeatureList.client.ts +0 -60
- package/components/FeatureList/FeatureList.css +0 -119
- package/components/FeatureList/FeatureList.tsx +0 -114
- package/components/FeatureList/chevron.svg +0 -7
- package/css/block-design.css +0 -4
- package/dist/autoScrollNav.d.ts +0 -3
- package/dist/autoScrollNav.js +0 -36
- package/dist/components/Algolia/Hit.d.ts +0 -4
- package/dist/components/Algolia/Hit.js +0 -30
- package/dist/components/Algolia/SelectIcon.d.ts +0 -2
- package/dist/components/Algolia/SelectIcon.js +0 -7
- package/dist/components/Algolia/Snippet.d.ts +0 -13
- package/dist/components/Algolia/Snippet.js +0 -37
- package/dist/components/Algolia/SourceIcon.d.ts +0 -4
- package/dist/components/Algolia/SourceIcon.js +0 -23
- package/dist/components/Algolia/types.d.ts +0 -79
- package/dist/components/Algolia/types.js +0 -1
- package/dist/navigation/NavigationHeader.d.ts +0 -8
- package/dist/navigation/NavigationHeader.js +0 -75
- package/dist/navigation/navigation-fullscreen/NavigationFullscreenButton.d.ts +0 -6
- package/dist/navigation/navigation-fullscreen/NavigationFullscreenButton.js +0 -23
- package/dist/navigation/navigation-fullscreen/hotkeyLabel.d.ts +0 -1
- package/dist/navigation/navigation-fullscreen/hotkeyLabel.js +0 -1
- package/navigation/Navigation-highlight.css +0 -41
- package/navigation/Navigation-items.css +0 -116
- package/navigation/Navigation-layout.css +0 -129
- package/navigation/initMobileNavigation.ts +0 -23
- package/navigation/initPressKit.ts +0 -19
- package/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
- package/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -47
- package/navigation/navigation-fullscreen/chevron.svg +0 -1
- package/navigation/navigation-fullscreen/close.svg +0 -4
- package/navigation/navigation-fullscreen/hotkeyLabel.ts +0 -1
- package/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -60
- package/renderer/getCSSForResponsiveFullcreenNavItems.ts +0 -128
package/MenuModal.tsx
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export { MenuModal }
|
|
2
|
+
export { toggleMenuModal }
|
|
3
|
+
export { closeMenuModal }
|
|
4
|
+
export { hotkeyMenuOpen }
|
|
5
|
+
export { hotkeyMenuClose }
|
|
6
|
+
|
|
7
|
+
import React from 'react'
|
|
8
|
+
import { usePageContext } from './renderer/usePageContext'
|
|
9
|
+
import { NavigationContent } from './navigation/Navigation'
|
|
10
|
+
import { css } from './utils/css'
|
|
11
|
+
import { containerQueryMobile } from './Layout'
|
|
12
|
+
import { Links } from './Links'
|
|
13
|
+
|
|
14
|
+
const hotkeyMenuOpen = 'Ctrl + M'
|
|
15
|
+
const hotkeyMenuClose = 'Ctrl+M or Escape'
|
|
16
|
+
|
|
17
|
+
function MenuModal() {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<style>{getStyle()}</style>
|
|
21
|
+
<div
|
|
22
|
+
id="menu-modal"
|
|
23
|
+
style={{
|
|
24
|
+
position: 'fixed',
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: '100vh',
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
zIndex: 9999,
|
|
30
|
+
overflow: 'scroll',
|
|
31
|
+
background: 'var(--bg-color)',
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
style={{
|
|
36
|
+
// Place <LinksBottom /> to the bottom
|
|
37
|
+
display: 'flex',
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
minHeight: '100vh',
|
|
40
|
+
justifyContent: 'space-between',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<Nav />
|
|
44
|
+
<LinksBottom />
|
|
45
|
+
</div>
|
|
46
|
+
<CloseButton />
|
|
47
|
+
</div>
|
|
48
|
+
</>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
function Nav() {
|
|
52
|
+
const pageContext = usePageContext()
|
|
53
|
+
const navItems = pageContext.navItemsAll
|
|
54
|
+
return <NavigationContent columnLayout={true} navItems={navItems} />
|
|
55
|
+
}
|
|
56
|
+
function LinksBottom() {
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
display: 'flex',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
marginTop: 25,
|
|
63
|
+
marginBottom: 25,
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<Links />
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function getStyle() {
|
|
72
|
+
return css`
|
|
73
|
+
html:not(.menu-modal-show) #menu-modal {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
// disable scroll of main view
|
|
77
|
+
html.menu-modal-show {
|
|
78
|
+
overflow: hidden !important;
|
|
79
|
+
}
|
|
80
|
+
@container(min-width: ${containerQueryMobile}px) {
|
|
81
|
+
#menu-modal .nav-item-level-3 {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function CloseButton() {
|
|
89
|
+
return (
|
|
90
|
+
<a
|
|
91
|
+
onClick={toggleMenuModal}
|
|
92
|
+
style={{ position: 'fixed', top: 11, right: 11, zIndex: 10 }}
|
|
93
|
+
aria-label={hotkeyMenuClose}
|
|
94
|
+
data-balloon-pos="left"
|
|
95
|
+
data-balloon-blunt
|
|
96
|
+
data-balloon-nofocus
|
|
97
|
+
>
|
|
98
|
+
<svg width="48.855" height="48.855" version="1.1" viewBox="0 0 22.901 22.901" xmlns="http://www.w3.org/2000/svg">
|
|
99
|
+
<circle
|
|
100
|
+
cx="11.45"
|
|
101
|
+
cy="11.45"
|
|
102
|
+
r="10.607"
|
|
103
|
+
fill="#ececec"
|
|
104
|
+
stroke="#666"
|
|
105
|
+
strokeDashoffset="251.44"
|
|
106
|
+
strokeLinecap="round"
|
|
107
|
+
strokeLinejoin="round"
|
|
108
|
+
strokeWidth="1.6875"
|
|
109
|
+
style={{ paintOrder: 'normal' }}
|
|
110
|
+
/>
|
|
111
|
+
<path
|
|
112
|
+
d="m7.5904 6.2204 3.86 3.86 3.84-3.84a0.92 0.92 0 0 1 0.66-0.29 1 1 0 0 1 1 1 0.9 0.9 0 0 1-0.27 0.66l-3.89 3.84 3.89 3.89a0.9 0.9 0 0 1 0.27 0.61 1 1 0 0 1-1 1 0.92 0.92 0 0 1-0.69-0.27l-3.81-3.86-3.85 3.85a0.92 0.92 0 0 1-0.65 0.28 1 1 0 0 1-1-1 0.9 0.9 0 0 1 0.27-0.66l3.89-3.84-3.89-3.89a0.9 0.9 0 0 1-0.27-0.61 1 1 0 0 1 1-1c0.24 3e-3 0.47 0.1 0.64 0.27z"
|
|
113
|
+
fill="#666"
|
|
114
|
+
stroke="#666"
|
|
115
|
+
strokeWidth=".11719"
|
|
116
|
+
/>
|
|
117
|
+
</svg>
|
|
118
|
+
</a>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function toggleMenuModal() {
|
|
123
|
+
document.documentElement.classList.toggle('menu-modal-show')
|
|
124
|
+
if (document.documentElement.classList.contains('menu-modal-show') && getViewportWidth() < containerQueryMobile) {
|
|
125
|
+
autoScroll()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function getViewportWidth(): number {
|
|
129
|
+
// `window.innerWidth` inlcudes scrollbar width: https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
130
|
+
return document.documentElement.clientWidth
|
|
131
|
+
}
|
|
132
|
+
function autoScroll() {
|
|
133
|
+
const nav = document.querySelector('#menu-modal .navigation-content')!
|
|
134
|
+
const href = window.location.pathname
|
|
135
|
+
const navLinks = Array.from(nav.querySelectorAll(`a[href="${href}"]`))
|
|
136
|
+
const navLink = navLinks[0]
|
|
137
|
+
if (!navLink) return
|
|
138
|
+
navLink.scrollIntoView({
|
|
139
|
+
behavior: 'instant',
|
|
140
|
+
block: 'center',
|
|
141
|
+
inline: 'start',
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
function closeMenuModal() {
|
|
145
|
+
document.documentElement.classList.remove('menu-modal-show')
|
|
146
|
+
}
|
package/autoScrollNav.ts
CHANGED
|
@@ -2,12 +2,11 @@ export { autoScrollNav }
|
|
|
2
2
|
export const autoScrollNav_SSR = `autoScrollNav();${autoScrollNav.toString()}`
|
|
3
3
|
|
|
4
4
|
// - We cannot use TypeScript syntax because of autoScrollNav_SSR
|
|
5
|
-
// - We have to save & restore `
|
|
5
|
+
// - We have to save & restore `document.documentElement.scrollTop` because scrollIntoView() scrolls the main view. (I don't know why).
|
|
6
6
|
// - Failed alternatives:
|
|
7
7
|
// - scrollIntoViewIfNeeded() (https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded) would work (it doesn't scroll the main view) but Firefox doesn't support it.
|
|
8
8
|
// - Doesn't work: the scrolling is off by hundreds of px (I guess because this function runs too early while the page is still rendering).
|
|
9
9
|
// ```js
|
|
10
|
-
// const navigationContainerEl = document.getElementById("navigation-container")
|
|
11
10
|
// const offset = navLink.offsetTop - (window.innerHeight / 2)
|
|
12
11
|
// navigationContainerEl.scrollTop = offset
|
|
13
12
|
// ```
|
|
@@ -20,10 +19,10 @@ export const autoScrollNav_SSR = `autoScrollNav();${autoScrollNav.toString()}`
|
|
|
20
19
|
// ```
|
|
21
20
|
|
|
22
21
|
function autoScrollNav() {
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
22
|
+
const nav = document.querySelector('#nav-left .navigation-content')
|
|
23
|
+
if (!nav) return
|
|
25
24
|
const href = window.location.pathname
|
|
26
|
-
const navLinks = Array.from(
|
|
25
|
+
const navLinks = Array.from(nav.querySelectorAll(`a[href="${href}"]`))
|
|
27
26
|
const navLink = navLinks[0]
|
|
28
27
|
if (!navLink) return
|
|
29
28
|
|
package/components/Note.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
blockquote {
|
|
2
2
|
--color: 0, 0, 0;
|
|
3
|
-
--color-strengh-bg:
|
|
3
|
+
--color-strengh-bg: 1.5;
|
|
4
4
|
--color-strengh-border: 1.5;
|
|
5
5
|
border-left: 8px solid rgba(var(--color), calc(0.06 * var(--color-strengh-border)));
|
|
6
6
|
background-color: rgba(var(--color), calc(0.03 * var(--color-strengh-bg)));
|
|
@@ -9,12 +9,12 @@ blockquote {
|
|
|
9
9
|
padding: 4px 16px;
|
|
10
10
|
}
|
|
11
11
|
blockquote.note-color-red {
|
|
12
|
-
--color-strengh-bg:
|
|
12
|
+
--color-strengh-bg: 3.3;
|
|
13
13
|
--color-strengh-border: 6;
|
|
14
|
-
--color:
|
|
14
|
+
--color: 220, 25, 49;
|
|
15
15
|
}
|
|
16
16
|
blockquote.note-color-yellow {
|
|
17
|
-
--color-strengh-bg:
|
|
17
|
+
--color-strengh-bg: 7;
|
|
18
18
|
--color-strengh-border: 8;
|
|
19
19
|
--color: 255, 204, 50;
|
|
20
20
|
}
|
package/components/Note.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { resolveHeadingsData }
|
|
2
2
|
|
|
3
|
-
import { assert, jsxToTextContent } from '../utils/server'
|
|
3
|
+
import { assert, isBrowser, jsxToTextContent } from '../utils/server'
|
|
4
4
|
import type {
|
|
5
5
|
HeadingDefinition,
|
|
6
6
|
HeadingDetachedDefinition,
|
|
@@ -9,11 +9,13 @@ import type {
|
|
|
9
9
|
} from '../types/Heading'
|
|
10
10
|
import type { Config } from '../types/Config'
|
|
11
11
|
import { getConfig } from './getConfig'
|
|
12
|
-
import {
|
|
12
|
+
import type { NavItem, NavItemAll } from '../navigation/Navigation'
|
|
13
13
|
import type { LinkData } from '../components'
|
|
14
14
|
import type { Exports, PageContextOriginal } from './resolvePageContext'
|
|
15
15
|
import pc from '@brillout/picocolors'
|
|
16
16
|
import { parseTitle } from '../parseTitle'
|
|
17
|
+
import { determineColumnLayoutEntries } from '../renderer/getStyleColumnLayout'
|
|
18
|
+
assert(!isBrowser())
|
|
17
19
|
|
|
18
20
|
type PageSectionResolved = {
|
|
19
21
|
url: string | null
|
|
@@ -47,35 +49,26 @@ function resolveHeadingsData(pageContext: PageContextOriginal) {
|
|
|
47
49
|
...headingsDetachedResolved.map(headingToLinkData),
|
|
48
50
|
]
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
// TODO/refactor: remove navItems
|
|
53
|
+
let navItems: NavItem[]
|
|
54
|
+
let navItemsAll: NavItemAll[]
|
|
55
|
+
let columnLayouts: number[][]
|
|
51
56
|
{
|
|
52
|
-
const currentUrl: string = pageContext.urlPathname
|
|
53
57
|
const navItemsPageSections = pageSectionsResolved
|
|
54
58
|
.filter((pageSection) => pageSection.pageSectionLevel === 2)
|
|
55
59
|
.map(pageSectionToNavItem)
|
|
60
|
+
navItemsAll = headingsResolved.map(headingToNavItem)
|
|
61
|
+
const res = determineColumnLayoutEntries(navItemsAll)
|
|
62
|
+
columnLayouts = res.columnLayouts
|
|
56
63
|
if (isDetachedPage) {
|
|
57
|
-
|
|
58
|
-
const navItems: NavItem[] = [headingToNavItem(activeHeading), ...navItemsPageSections]
|
|
59
|
-
navigationData = {
|
|
60
|
-
isDetachedPage: true,
|
|
61
|
-
navItems,
|
|
62
|
-
navItemsAll,
|
|
63
|
-
currentUrl,
|
|
64
|
-
}
|
|
64
|
+
navItems = [headingToNavItem(activeHeading), ...navItemsPageSections]
|
|
65
65
|
} else {
|
|
66
|
-
|
|
67
|
-
const activeHeadingIndex = navItemsAll.findIndex((navItem) => navItem.url ===
|
|
66
|
+
navItems = navItemsAll
|
|
67
|
+
const activeHeadingIndex = navItemsAll.findIndex((navItem) => navItem.url === pageContext.urlPathname)
|
|
68
68
|
assert(activeHeadingIndex >= 0)
|
|
69
69
|
navItemsPageSections.forEach((navItem, i) => {
|
|
70
70
|
navItemsAll.splice(activeHeadingIndex + 1 + i, 0, navItem)
|
|
71
71
|
})
|
|
72
|
-
|
|
73
|
-
navigationData = {
|
|
74
|
-
isDetachedPage: false,
|
|
75
|
-
navItems: navItemsAll,
|
|
76
|
-
navItemsAll,
|
|
77
|
-
currentUrl,
|
|
78
|
-
}
|
|
79
72
|
}
|
|
80
73
|
}
|
|
81
74
|
|
|
@@ -84,13 +77,16 @@ function resolveHeadingsData(pageContext: PageContextOriginal) {
|
|
|
84
77
|
.map((h) => ({ title: typeof h.topNavigation === 'string' ? h.topNavigation : h.title, url: h.url }))
|
|
85
78
|
|
|
86
79
|
const pageContextAddendum = {
|
|
87
|
-
|
|
80
|
+
isDetachedPage,
|
|
81
|
+
navItems,
|
|
82
|
+
navItemsAll,
|
|
88
83
|
linksAll,
|
|
89
84
|
isLandingPage,
|
|
90
85
|
pageTitle,
|
|
91
86
|
documentTitle,
|
|
92
|
-
noSideNavigation: activeHeading.noSideNavigation,
|
|
93
87
|
topNavigationList,
|
|
88
|
+
// TODO: don't pass to client-side
|
|
89
|
+
columnLayouts,
|
|
94
90
|
}
|
|
95
91
|
return pageContextAddendum
|
|
96
92
|
}
|
|
@@ -101,6 +97,7 @@ function headingToNavItem(heading: HeadingResolved | HeadingDetachedResolved): N
|
|
|
101
97
|
url: heading.url,
|
|
102
98
|
title: heading.title,
|
|
103
99
|
titleInNav: heading.titleInNav,
|
|
100
|
+
menuModalFullWidth: heading.menuModalFullWidth,
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
function headingToLinkData(heading: HeadingResolved | HeadingDetachedResolved): LinkData {
|
|
@@ -23,10 +23,20 @@ function resolvePageContext(pageContext: PageContextOriginal) {
|
|
|
23
23
|
objectAssign(pageContextResolved, resolveHeadingsData(pageContext))
|
|
24
24
|
|
|
25
25
|
const config = getConfig()
|
|
26
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
faviconUrl,
|
|
28
|
+
algolia,
|
|
29
|
+
tagline,
|
|
30
|
+
twitterHandle,
|
|
31
|
+
bannerUrl,
|
|
32
|
+
websiteUrl,
|
|
33
|
+
topNavigationStyle,
|
|
34
|
+
projectInfo: { projectName },
|
|
35
|
+
} = config
|
|
27
36
|
objectAssign(pageContextResolved, {
|
|
28
37
|
urlPathname: pageContext.urlPathname, // TODO: remove
|
|
29
38
|
meta: {
|
|
39
|
+
projectName,
|
|
30
40
|
faviconUrl,
|
|
31
41
|
twitterHandle,
|
|
32
42
|
bannerUrl,
|
package/css/code/block.css
CHANGED
|
@@ -22,27 +22,27 @@ figure[data-rehype-pretty-code-figure] {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/* 821px screen width => the width of code blocks isn't shrinked anymore => no need to reduce the font-size of code blocks */
|
|
25
|
-
@
|
|
25
|
+
@container(max-width: 820px) {
|
|
26
26
|
pre > code {
|
|
27
27
|
font-size: 0.9em !important;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
@
|
|
30
|
+
@container(max-width: 720px) {
|
|
31
31
|
pre > code {
|
|
32
32
|
font-size: 0.8em !important;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
@
|
|
35
|
+
@container(max-width: 620px) {
|
|
36
36
|
pre > code {
|
|
37
37
|
font-size: 0.7em !important;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
@
|
|
40
|
+
@container(max-width: 550px) {
|
|
41
41
|
pre > code {
|
|
42
42
|
font-size: 0.6em !important;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
@
|
|
45
|
+
@container(max-width: 450px) {
|
|
46
46
|
pre > code {
|
|
47
47
|
font-size: 0.5em !important;
|
|
48
48
|
}
|
package/css/code/inline.css
CHANGED
package/css/code.css
CHANGED
|
@@ -3,21 +3,25 @@
|
|
|
3
3
|
@import './code/diff.css';
|
|
4
4
|
|
|
5
5
|
code {
|
|
6
|
-
/*
|
|
7
|
-
background-color: #f4f4f4;
|
|
8
|
-
0.043137255 = 1 - (#f4 / #ff)
|
|
9
|
-
*/
|
|
10
|
-
background-color: rgba(0, 0, 0, 0.043137255);
|
|
11
6
|
border-radius: 4px;
|
|
12
7
|
}
|
|
8
|
+
pre {
|
|
9
|
+
background: none !important;
|
|
10
|
+
}
|
|
13
11
|
|
|
14
12
|
/* Inline */
|
|
15
13
|
code {
|
|
14
|
+
background: rgba(0, 0, 0, 0.063137255);
|
|
16
15
|
font-size: 1.1em;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
/* Block */
|
|
20
19
|
pre > code {
|
|
20
|
+
/*
|
|
21
|
+
background-color: #f4f4f4;
|
|
22
|
+
0.043137255 = 1 - (#f4 / #ff)
|
|
23
|
+
*/
|
|
24
|
+
background: rgba(0, 0, 0, 0.043137255);
|
|
21
25
|
font-size: 1em;
|
|
22
26
|
}
|
|
23
27
|
/* Workaround for shiki regression */
|
package/css/index.css
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
@import './reset.css';
|
|
2
|
-
@import './block-design.css';
|
|
3
2
|
@import './colorize-on-hover.css';
|
|
4
3
|
@import './heading.css';
|
|
5
4
|
@import './button.css';
|
|
@@ -8,6 +7,3 @@
|
|
|
8
7
|
@import './code.css';
|
|
9
8
|
@import './table.css';
|
|
10
9
|
@import './tooltip.css';
|
|
11
|
-
@import '../algolia/DocSearch.css';
|
|
12
|
-
@import '../components/Note.css';
|
|
13
|
-
@import '../components/CodeBlockTransformer.css';
|
package/css/reset.css
CHANGED
package/dist/+config.d.ts
CHANGED
|
@@ -10,12 +10,6 @@ declare const _default: {
|
|
|
10
10
|
hydrationCanBeAborted: true;
|
|
11
11
|
passToClient: string[];
|
|
12
12
|
meta: {
|
|
13
|
-
NavHeader: {
|
|
14
|
-
env: {
|
|
15
|
-
client: true;
|
|
16
|
-
server: true;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
13
|
Layout: {
|
|
20
14
|
env: {
|
|
21
15
|
client: true;
|
|
@@ -37,13 +31,7 @@ declare global {
|
|
|
37
31
|
exports: Exports;
|
|
38
32
|
}
|
|
39
33
|
interface Config {
|
|
40
|
-
Layout?: ReactComponent | ImportString;
|
|
41
|
-
NavHeader?: {
|
|
42
|
-
NavHeader: ReactComponent;
|
|
43
|
-
navHeaderWrapperStyle?: React.CSSProperties;
|
|
44
|
-
NavHeaderMobile: ReactComponent;
|
|
45
|
-
navHeaderMobileWrapperStyle?: React.CSSProperties;
|
|
46
|
-
};
|
|
34
|
+
Layout?: ReactComponent | null | ImportString;
|
|
47
35
|
}
|
|
48
36
|
}
|
|
49
37
|
}
|
package/dist/+config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { CodeBlockTransformer };
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { assert } from '../utils/server';
|
|
4
|
+
import './CodeBlockTransformer.css';
|
|
4
5
|
function CodeBlockTransformer(_a) {
|
|
5
6
|
var children = _a.children, lineBreak = _a.lineBreak;
|
|
6
7
|
assert(lineBreak === 'white-space' || lineBreak === 'break-word', '`lineBreak` is currently the only use case for <CodeBlockTransformer>');
|
package/dist/components/Note.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
export { resolveHeadingsData };
|
|
2
|
-
import { NavItem } from '../navigation/Navigation';
|
|
2
|
+
import type { NavItem, NavItemAll } from '../navigation/Navigation';
|
|
3
3
|
import type { LinkData } from '../components';
|
|
4
4
|
import type { PageContextOriginal } from './resolvePageContext';
|
|
5
5
|
declare function resolveHeadingsData(pageContext: PageContextOriginal): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
currentUrl: string;
|
|
10
|
-
isDetachedPage: boolean;
|
|
11
|
-
};
|
|
6
|
+
isDetachedPage: boolean;
|
|
7
|
+
navItems: NavItem[];
|
|
8
|
+
navItemsAll: NavItemAll[];
|
|
12
9
|
linksAll: LinkData[];
|
|
13
10
|
isLandingPage: boolean;
|
|
14
11
|
pageTitle: string | null;
|
|
15
12
|
documentTitle: string;
|
|
16
|
-
noSideNavigation: (true | "no-logo") | undefined;
|
|
17
13
|
topNavigationList: {
|
|
18
14
|
title: string;
|
|
19
15
|
url: string | null | undefined;
|
|
20
16
|
}[];
|
|
17
|
+
columnLayouts: number[][];
|
|
21
18
|
};
|
|
@@ -19,10 +19,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
21
|
export { resolveHeadingsData };
|
|
22
|
-
import { assert, jsxToTextContent } from '../utils/server';
|
|
22
|
+
import { assert, isBrowser, jsxToTextContent } from '../utils/server';
|
|
23
23
|
import { getConfig } from './getConfig';
|
|
24
24
|
import pc from '@brillout/picocolors';
|
|
25
25
|
import { parseTitle } from '../parseTitle';
|
|
26
|
+
import { determineColumnLayoutEntries } from '../renderer/getStyleColumnLayout';
|
|
27
|
+
assert(!isBrowser());
|
|
26
28
|
function resolveHeadingsData(pageContext) {
|
|
27
29
|
var config = getConfig();
|
|
28
30
|
{
|
|
@@ -36,48 +38,43 @@ function resolveHeadingsData(pageContext) {
|
|
|
36
38
|
var _b = getTitles(activeHeading, pageContext, config), documentTitle = _b.documentTitle, isLandingPage = _b.isLandingPage, pageTitle = _b.pageTitle;
|
|
37
39
|
var pageSectionsResolved = getPageSectionsResolved(pageContext, activeHeading);
|
|
38
40
|
var linksAll = __spreadArray(__spreadArray(__spreadArray([], pageSectionsResolved.map(pageSectionToLinkData), true), headingsResolved.map(headingToLinkData), true), headingsDetachedResolved.map(headingToLinkData), true);
|
|
39
|
-
|
|
41
|
+
// TODO/refactor: remove navItems
|
|
42
|
+
var navItems;
|
|
43
|
+
var navItemsAll;
|
|
44
|
+
var columnLayouts;
|
|
40
45
|
{
|
|
41
|
-
var currentUrl_1 = pageContext.urlPathname;
|
|
42
46
|
var navItemsPageSections = pageSectionsResolved
|
|
43
47
|
.filter(function (pageSection) { return pageSection.pageSectionLevel === 2; })
|
|
44
48
|
.map(pageSectionToNavItem);
|
|
49
|
+
navItemsAll = headingsResolved.map(headingToNavItem);
|
|
50
|
+
var res = determineColumnLayoutEntries(navItemsAll);
|
|
51
|
+
columnLayouts = res.columnLayouts;
|
|
45
52
|
if (isDetachedPage) {
|
|
46
|
-
|
|
47
|
-
var navItems = __spreadArray([headingToNavItem(activeHeading)], navItemsPageSections, true);
|
|
48
|
-
navigationData = {
|
|
49
|
-
isDetachedPage: true,
|
|
50
|
-
navItems: navItems,
|
|
51
|
-
navItemsAll: navItemsAll,
|
|
52
|
-
currentUrl: currentUrl_1,
|
|
53
|
-
};
|
|
53
|
+
navItems = __spreadArray([headingToNavItem(activeHeading)], navItemsPageSections, true);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
|
|
57
|
-
var activeHeadingIndex_1 =
|
|
56
|
+
navItems = navItemsAll;
|
|
57
|
+
var activeHeadingIndex_1 = navItemsAll.findIndex(function (navItem) { return navItem.url === pageContext.urlPathname; });
|
|
58
58
|
assert(activeHeadingIndex_1 >= 0);
|
|
59
59
|
navItemsPageSections.forEach(function (navItem, i) {
|
|
60
|
-
|
|
60
|
+
navItemsAll.splice(activeHeadingIndex_1 + 1 + i, 0, navItem);
|
|
61
61
|
});
|
|
62
|
-
navigationData = {
|
|
63
|
-
isDetachedPage: false,
|
|
64
|
-
navItems: navItemsAll_1,
|
|
65
|
-
navItemsAll: navItemsAll_1,
|
|
66
|
-
currentUrl: currentUrl_1,
|
|
67
|
-
};
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
var topNavigationList = headingsResolved
|
|
71
65
|
.filter(function (heading) { return heading.topNavigation; })
|
|
72
66
|
.map(function (h) { return ({ title: typeof h.topNavigation === 'string' ? h.topNavigation : h.title, url: h.url }); });
|
|
73
67
|
var pageContextAddendum = {
|
|
74
|
-
|
|
68
|
+
isDetachedPage: isDetachedPage,
|
|
69
|
+
navItems: navItems,
|
|
70
|
+
navItemsAll: navItemsAll,
|
|
75
71
|
linksAll: linksAll,
|
|
76
72
|
isLandingPage: isLandingPage,
|
|
77
73
|
pageTitle: pageTitle,
|
|
78
74
|
documentTitle: documentTitle,
|
|
79
|
-
noSideNavigation: activeHeading.noSideNavigation,
|
|
80
75
|
topNavigationList: topNavigationList,
|
|
76
|
+
// TODO: don't pass to client-side
|
|
77
|
+
columnLayouts: columnLayouts,
|
|
81
78
|
};
|
|
82
79
|
return pageContextAddendum;
|
|
83
80
|
}
|
|
@@ -87,6 +84,7 @@ function headingToNavItem(heading) {
|
|
|
87
84
|
url: heading.url,
|
|
88
85
|
title: heading.title,
|
|
89
86
|
titleInNav: heading.titleInNav,
|
|
87
|
+
menuModalFullWidth: heading.menuModalFullWidth,
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
90
|
function headingToLinkData(heading) {
|