@brillout/docpress 0.7.10 → 0.8.1

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.
Files changed (93) hide show
  1. package/+config.ts +2 -10
  2. package/Layout.tsx +397 -67
  3. package/{navigation/NavigationHeader.tsx → Links.tsx} +6 -57
  4. package/MenuModal.tsx +146 -0
  5. package/autoScrollNav.ts +4 -5
  6. package/components/CodeBlockTransformer.tsx +0 -2
  7. package/components/Note.css +4 -4
  8. package/components/Note.tsx +0 -2
  9. package/components/Supporters.tsx +1 -0
  10. package/config/resolveHeadingsData.ts +20 -23
  11. package/config/resolvePageContext.ts +11 -1
  12. package/css/code/block.css +5 -5
  13. package/css/code/inline.css +1 -1
  14. package/css/code.css +9 -5
  15. package/css/index.css +0 -4
  16. package/css/reset.css +0 -6
  17. package/dist/+config.d.ts +1 -13
  18. package/dist/+config.js +0 -3
  19. package/dist/components/CodeBlockTransformer.d.ts +1 -0
  20. package/dist/components/CodeBlockTransformer.js +1 -0
  21. package/dist/components/Note.d.ts +1 -0
  22. package/dist/components/Note.js +1 -0
  23. package/dist/components/Supporters.js +1 -0
  24. package/dist/config/resolveHeadingsData.d.ts +5 -8
  25. package/dist/config/resolveHeadingsData.js +20 -22
  26. package/dist/config/resolvePageContext.d.ts +5 -7
  27. package/dist/config/resolvePageContext.js +2 -1
  28. package/dist/navigation/Navigation.d.ts +12 -17
  29. package/dist/navigation/Navigation.js +82 -74
  30. package/dist/renderer/getStyleColumnLayout.d.ts +7 -0
  31. package/dist/renderer/getStyleColumnLayout.js +183 -0
  32. package/dist/types/Heading.d.ts +2 -4
  33. package/dist/utils/client.d.ts +1 -0
  34. package/dist/utils/client.js +1 -0
  35. package/dist/utils/css.d.ts +1 -0
  36. package/dist/utils/css.js +27 -0
  37. package/dist/utils/getGlobalObject.d.ts +1 -0
  38. package/dist/utils/getGlobalObject.js +9 -0
  39. package/docsearch/DocSearchInstall.tsx +23 -0
  40. package/docsearch/SearchLink.tsx +48 -0
  41. package/docsearch/toggleDocsearchModal.ts +29 -0
  42. package/global.d.ts +7 -0
  43. package/initKeyBindings.ts +41 -0
  44. package/installSectionUrlHashs.ts +6 -5
  45. package/navigation/Navigation.css +101 -3
  46. package/navigation/Navigation.tsx +114 -128
  47. package/package.json +1 -8
  48. package/renderer/getPageElement.tsx +19 -7
  49. package/renderer/getStyleColumnLayout.ts +204 -0
  50. package/renderer/onRenderClient.tsx +17 -24
  51. package/renderer/onRenderHtml.tsx +3 -6
  52. package/types/Heading.ts +2 -5
  53. package/utils/client.ts +1 -0
  54. package/utils/css.ts +26 -0
  55. package/utils/getGlobalObject.ts +11 -0
  56. package/Layout.css +0 -63
  57. package/MobileHeader.tsx +0 -70
  58. package/algolia/DocSearch.css +0 -28
  59. package/components/FeatureList/FeatureList.client.ts +0 -60
  60. package/components/FeatureList/FeatureList.css +0 -119
  61. package/components/FeatureList/FeatureList.tsx +0 -114
  62. package/components/FeatureList/chevron.svg +0 -7
  63. package/css/block-design.css +0 -4
  64. package/dist/autoScrollNav.d.ts +0 -3
  65. package/dist/autoScrollNav.js +0 -36
  66. package/dist/components/Algolia/Hit.d.ts +0 -4
  67. package/dist/components/Algolia/Hit.js +0 -30
  68. package/dist/components/Algolia/SelectIcon.d.ts +0 -2
  69. package/dist/components/Algolia/SelectIcon.js +0 -7
  70. package/dist/components/Algolia/Snippet.d.ts +0 -13
  71. package/dist/components/Algolia/Snippet.js +0 -37
  72. package/dist/components/Algolia/SourceIcon.d.ts +0 -4
  73. package/dist/components/Algolia/SourceIcon.js +0 -23
  74. package/dist/components/Algolia/types.d.ts +0 -79
  75. package/dist/components/Algolia/types.js +0 -1
  76. package/dist/navigation/NavigationHeader.d.ts +0 -8
  77. package/dist/navigation/NavigationHeader.js +0 -75
  78. package/dist/navigation/navigation-fullscreen/NavigationFullscreenButton.d.ts +0 -6
  79. package/dist/navigation/navigation-fullscreen/NavigationFullscreenButton.js +0 -23
  80. package/dist/navigation/navigation-fullscreen/hotkeyLabel.d.ts +0 -1
  81. package/dist/navigation/navigation-fullscreen/hotkeyLabel.js +0 -1
  82. package/navigation/Navigation-highlight.css +0 -41
  83. package/navigation/Navigation-items.css +0 -116
  84. package/navigation/Navigation-layout.css +0 -129
  85. package/navigation/initMobileNavigation.ts +0 -23
  86. package/navigation/initPressKit.ts +0 -19
  87. package/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
  88. package/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -47
  89. package/navigation/navigation-fullscreen/chevron.svg +0 -1
  90. package/navigation/navigation-fullscreen/close.svg +0 -4
  91. package/navigation/navigation-fullscreen/hotkeyLabel.ts +0 -1
  92. package/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -60
  93. package/renderer/getCSSForResponsiveFullcreenNavItems.ts +0 -127
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
+ paddingTop: 10,
63
+ paddingBottom: 40,
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 `dodocument.documentElement.scrollTop` because scrollIntoView() scrolls the main view. (I don't know why).
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 navigationEl = document.getElementById('navigation-content-main')
24
- if (!navigationEl) return
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(navigationEl.querySelectorAll(`a[href="${href}"]`))
25
+ const navLinks = Array.from(nav.querySelectorAll(`a[href="${href}"]`))
27
26
  const navLink = navLinks[0]
28
27
  if (!navLink) return
29
28
 
@@ -2,9 +2,7 @@ export { CodeBlockTransformer }
2
2
 
3
3
  import React from 'react'
4
4
  import { assert } from '../utils/server'
5
- /* Imorted in /src/css/index.css instead
6
5
  import './CodeBlockTransformer.css'
7
- */
8
6
 
9
7
  type LineBreak = 'white-space' | 'break-word'
10
8
 
@@ -1,6 +1,6 @@
1
1
  blockquote {
2
2
  --color: 0, 0, 0;
3
- --color-strengh-bg: 0.7;
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: 1.7;
12
+ --color-strengh-bg: 3.3;
13
13
  --color-strengh-border: 6;
14
- --color: 190, 25, 49;
14
+ --color: 220, 25, 49;
15
15
  }
16
16
  blockquote.note-color-yellow {
17
- --color-strengh-bg: 4;
17
+ --color-strengh-bg: 7;
18
18
  --color-strengh-border: 8;
19
19
  --color: 255, 204, 50;
20
20
  }
@@ -15,9 +15,7 @@ export { Note }
15
15
 
16
16
  import React from 'react'
17
17
  import { assert } from '../utils/assert'
18
- /* Imorted in /src/css/index.css instead
19
18
  import './Note.css'
20
- */
21
19
 
22
20
  type Props = {
23
21
  children: React.ReactNode
@@ -26,6 +26,7 @@ function SectionDescription({ children }: { children?: Children }) {
26
26
  display: 'inline-block',
27
27
  marginTop: 12,
28
28
  marginBottom: 12,
29
+ fontSize: '1.05em',
29
30
  }}
30
31
  >
31
32
  {children}
@@ -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 { NavigationData, NavItem } from '../navigation/Navigation'
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
- let navigationData: NavigationData
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
- const navItemsAll: NavItem[] = headingsResolved
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
- const navItemsAll: NavItem[] = headingsResolved.map(headingToNavItem)
67
- const activeHeadingIndex = navItemsAll.findIndex((navItem) => navItem.url === currentUrl)
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
- navigationData,
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 { faviconUrl, algolia, tagline, twitterHandle, bannerUrl, websiteUrl, topNavigationStyle } = config
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,
@@ -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
- @media screen and (max-width: 820px) {
25
+ @container(max-width: 820px) {
26
26
  pre > code {
27
27
  font-size: 0.9em !important;
28
28
  }
29
29
  }
30
- @media screen and (max-width: 720px) {
30
+ @container(max-width: 720px) {
31
31
  pre > code {
32
32
  font-size: 0.8em !important;
33
33
  }
34
34
  }
35
- @media screen and (max-width: 620px) {
35
+ @container(max-width: 620px) {
36
36
  pre > code {
37
37
  font-size: 0.7em !important;
38
38
  }
39
39
  }
40
- @media screen and (max-width: 550px) {
40
+ @container(max-width: 550px) {
41
41
  pre > code {
42
42
  font-size: 0.6em !important;
43
43
  }
44
44
  }
45
- @media screen and (max-width: 450px) {
45
+ @container(max-width: 450px) {
46
46
  pre > code {
47
47
  font-size: 0.5em !important;
48
48
  }
@@ -8,7 +8,7 @@ code {
8
8
  * - Allow them on mobile
9
9
  * - Allow them for `<code long>`
10
10
  */
11
- @media screen and (max-width: 500px) {
11
+ @container(max-width: 500px) {
12
12
  code {
13
13
  word-break: break-word;
14
14
  }
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
@@ -4,9 +4,3 @@
4
4
  body {
5
5
  margin: 0;
6
6
  }
7
-
8
- /* Avoid tweet embeds to overflow the body width.
9
- * Settings `overflow: hidden` to a container doesn't work (This is a CSS bug?) */
10
- iframe {
11
- max-width: 100%;
12
- }
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
@@ -9,9 +9,6 @@ export default {
9
9
  hydrationCanBeAborted: true,
10
10
  passToClient: ['pageContextResolved'],
11
11
  meta: {
12
- NavHeader: {
13
- env: { client: true, server: true },
14
- },
15
12
  Layout: {
16
13
  env: { client: true, server: true },
17
14
  },
@@ -1,5 +1,6 @@
1
1
  export { CodeBlockTransformer };
2
2
  import React from 'react';
3
+ import './CodeBlockTransformer.css';
3
4
  type LineBreak = 'white-space' | 'break-word';
4
5
  declare function CodeBlockTransformer({ children, lineBreak }: {
5
6
  children: React.ReactNode;
@@ -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>');
@@ -6,6 +6,7 @@ export { Danger };
6
6
  export { NoteWithoutIcon };
7
7
  export { NoteWithCustomIcon };
8
8
  import React from 'react';
9
+ import './Note.css';
9
10
  type Props = {
10
11
  children: React.ReactNode;
11
12
  style?: React.CSSProperties;
@@ -25,6 +25,7 @@ export { Note }
25
25
  */
26
26
  import React from 'react';
27
27
  import { assert } from '../utils/assert';
28
+ import './Note.css';
28
29
  function Warning(props) {
29
30
  return React.createElement(NoteGeneric, __assign({ type: "warning" }, props));
30
31
  }
@@ -14,6 +14,7 @@ function SectionDescription(_a) {
14
14
  display: 'inline-block',
15
15
  marginTop: 12,
16
16
  marginBottom: 12,
17
+ fontSize: '1.05em',
17
18
  } }, children));
18
19
  }
19
20
  function Individuals(_a) {
@@ -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
- navigationData: {
7
- navItems: NavItem[];
8
- navItemsAll: NavItem[];
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
- var navigationData;
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
- var navItemsAll = headingsResolved;
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
- var navItemsAll_1 = headingsResolved.map(headingToNavItem);
57
- var activeHeadingIndex_1 = navItemsAll_1.findIndex(function (navItem) { return navItem.url === currentUrl_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
- navItemsAll_1.splice(activeHeadingIndex_1 + 1 + i, 0, navItem);
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
- navigationData: navigationData,
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) {