@brillout/docpress 0.1.9 → 0.1.11

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 (145) hide show
  1. package/{src/css/Inter-Var.ttf → dist/Inter-Var-IOAEQULN.ttf} +0 -0
  2. package/{src/components/Sponsors/companyLogos/ccoli.svg → dist/ccoli-CHW3TQKS.svg} +0 -0
  3. package/{src/icons/changelog.svg → dist/changelog-IPI5F42D.svg} +0 -0
  4. package/{src/navigation/navigation-fullscreen/chevron.svg → dist/chevron-K3WPYLOP.svg} +0 -0
  5. package/{src/components/features/chevron.svg → dist/chevron-R2IYJD62.svg} +0 -0
  6. package/dist/chunk-2SRWLPTC.js +9 -0
  7. package/dist/chunk-2SRWLPTC.js.map +1 -0
  8. package/dist/chunk-G2A5MZJA.js +48 -0
  9. package/dist/chunk-G2A5MZJA.js.map +1 -0
  10. package/dist/chunk-M7LTQJLV.js +178 -0
  11. package/dist/chunk-M7LTQJLV.js.map +1 -0
  12. package/dist/chunk-OEVBWUR6.js +92 -0
  13. package/dist/chunk-OEVBWUR6.js.map +1 -0
  14. package/dist/chunk-P6M6A4HU.js +154 -0
  15. package/dist/chunk-P6M6A4HU.js.map +1 -0
  16. package/dist/chunk-TTLAZ2T2.js +8 -0
  17. package/dist/chunk-TTLAZ2T2.js.map +1 -0
  18. package/dist/cli/index.d.ts +1 -0
  19. package/dist/cli/index.js +12 -8
  20. package/dist/cli/index.js.map +1 -0
  21. package/{src/navigation/navigation-fullscreen/close.svg → dist/close-IQXTDOHV.svg} +0 -0
  22. package/{src/utils/Emoji/compass.svg → dist/compass-2RWQU3E4.svg} +0 -0
  23. package/{src → dist}/components/features/FeatureList.css +2 -7
  24. package/dist/components/features/FeatureList.css.map +1 -0
  25. package/dist/components/features/FeatureList.d.ts +13 -0
  26. package/dist/components/features/FeatureList.js +8 -0
  27. package/dist/components/features/FeatureList.js.map +1 -0
  28. package/dist/components/features/initFeatureList.d.ts +3 -0
  29. package/dist/components/features/initFeatureList.js +60 -0
  30. package/dist/components/features/initFeatureList.js.map +1 -0
  31. package/{src/components/Sponsors/companyLogos/contra.svg → dist/contra-WLZBOPBV.svg} +0 -0
  32. package/dist/{cli/devServer.js → devServer-TDBL5PHQ.js} +4 -2
  33. package/dist/devServer-TDBL5PHQ.js.map +1 -0
  34. package/{src/icons/discord.svg → dist/discord-JD33TUSF.svg} +0 -0
  35. package/{src/utils/Emoji/engine.png → dist/engine-6Q6VSCVA.png} +0 -0
  36. package/{src/icons/github.svg → dist/github-P5ZSKN2N.svg} +0 -0
  37. package/{src/icons/heart.svg → dist/heart-OINVKOXO.svg} +0 -0
  38. package/dist/index.css +121 -0
  39. package/dist/index.css.map +1 -0
  40. package/dist/index.d.ts +137 -0
  41. package/dist/index.js +489 -0
  42. package/dist/index.js.map +1 -0
  43. package/{src/components/Sponsors/label.svg → dist/label-MP75CTIA.svg} +0 -0
  44. package/{src/utils/Emoji/mechanical-arm.svg → dist/mechanical-arm-TR7IQQMG.svg} +0 -0
  45. package/{src/components/Sponsors/medalBronze.svg → dist/medalBronze-CO4CTUR4.svg} +0 -0
  46. package/{src/components/Sponsors/medalGold.svg → dist/medalGold-UP6A73FL.svg} +0 -0
  47. package/{src/components/Sponsors/medalSilver.svg → dist/medalSilver-FAPGGOBN.svg} +0 -0
  48. package/{src/components/Sponsors/companyLogos/mfqs.svg → dist/mfqs-2EAEE7N6.svg} +0 -0
  49. package/dist/renderer/_default.page.client.css +263 -0
  50. package/dist/renderer/_default.page.client.css.map +1 -0
  51. package/dist/renderer/_default.page.client.d.ts +1 -0
  52. package/dist/renderer/_default.page.client.js +180 -0
  53. package/dist/renderer/_default.page.client.js.map +1 -0
  54. package/dist/renderer/_default.page.server.css +312 -0
  55. package/dist/renderer/_default.page.server.css.map +1 -0
  56. package/dist/renderer/_default.page.server.d.ts +22 -0
  57. package/dist/renderer/_default.page.server.js +602 -0
  58. package/dist/renderer/_default.page.server.js.map +1 -0
  59. package/{src/utils/Emoji/road-fork.svg → dist/road-fork-3WZLW3HB.svg} +0 -0
  60. package/{src/utils/Emoji/shield.svg → dist/shield-CU45RG5C.svg} +0 -0
  61. package/{src/icons/twitter.svg → dist/twitter-I7DXDN3J.svg} +0 -0
  62. package/{src/utils/Emoji/typescript.svg → dist/typescript-ALIPKLRM.svg} +0 -0
  63. package/dist/vite.config.d.ts +5 -0
  64. package/dist/vite.config.js +150 -0
  65. package/dist/vite.config.js.map +1 -0
  66. package/package.json +20 -26
  67. package/readme.md +4 -2
  68. package/cli.mjs +0 -2
  69. package/dist/cli/chunk-Y3OKG4SS.js +0 -30
  70. package/dist/cli/configFile.js +0 -6
  71. package/index.ts +0 -2
  72. package/src/MobileHeader.tsx +0 -68
  73. package/src/PageLayout.css +0 -41
  74. package/src/PageLayout.tsx +0 -37
  75. package/src/algolia/DocSearch.css +0 -29
  76. package/src/algolia/DocSearch.ts +0 -37
  77. package/src/autoScrollNav.ts +0 -22
  78. package/src/components/CodeBlock.tsx +0 -22
  79. package/src/components/DocLink.tsx +0 -108
  80. package/src/components/EditPageNote.tsx +0 -18
  81. package/src/components/HorizontalLine.tsx +0 -20
  82. package/src/components/ImportMeta.tsx +0 -11
  83. package/src/components/Info.tsx +0 -12
  84. package/src/components/Link.tsx +0 -18
  85. package/src/components/Note.tsx +0 -31
  86. package/src/components/P.css +0 -8
  87. package/src/components/P.tsx +0 -8
  88. package/src/components/ReadingRecommendation.tsx +0 -53
  89. package/src/components/RepoLink.tsx +0 -24
  90. package/src/components/Sponsors/companyLogos/ccoli-logo.svg +0 -1
  91. package/src/components/Sponsors/companyLogos/ccoli-text.svg +0 -1
  92. package/src/components/Sponsors/label.draft.svg +0 -108
  93. package/src/components/Sponsors.tsx +0 -243
  94. package/src/components/features/FeatureList.tsx +0 -114
  95. package/src/components/features/initFeatureList.ts +0 -66
  96. package/src/components/index.ts +0 -13
  97. package/src/config/Config.ts +0 -30
  98. package/src/config/getConfig.ts +0 -18
  99. package/src/config/resolveConfig/resolveHeading.ts +0 -0
  100. package/src/config/resolvePageContext.ts +0 -157
  101. package/src/css/button.css +0 -7
  102. package/src/css/code/block.css +0 -36
  103. package/src/css/code/inline.css +0 -27
  104. package/src/css/code.css +0 -20
  105. package/src/css/colorize-on-hover.css +0 -29
  106. package/src/css/font.css +0 -19
  107. package/src/css/heading.css +0 -25
  108. package/src/css/index.css +0 -10
  109. package/src/css/link.css +0 -17
  110. package/src/css/note.css +0 -26
  111. package/src/css/reset.css +0 -12
  112. package/src/css/table.css +0 -14
  113. package/src/css/tooltip.css +0 -11
  114. package/src/headings.ts +0 -201
  115. package/src/index.ts +0 -3
  116. package/src/installSectionUrlHashs.ts +0 -50
  117. package/src/navigation/Navigation-highlight.css +0 -41
  118. package/src/navigation/Navigation-items.css +0 -122
  119. package/src/navigation/Navigation-layout.css +0 -118
  120. package/src/navigation/Navigation.client.old.ts +0 -303
  121. package/src/navigation/Navigation.client.ts +0 -19
  122. package/src/navigation/Navigation.css +0 -12
  123. package/src/navigation/Navigation.tsx +0 -229
  124. package/src/navigation/NavigationHeader.tsx +0 -97
  125. package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
  126. package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -44
  127. package/src/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -115
  128. package/src/parseEmojis.ts +0 -33
  129. package/src/renderer/_default.page.client.ts +0 -7
  130. package/src/renderer/_default.page.server.tsx +0 -69
  131. package/src/renderer/usePageContext.tsx +0 -25
  132. package/src/types.ts +0 -2
  133. package/src/utils/Emoji/Emoji.ts +0 -216
  134. package/src/utils/Emoji/assets.ts +0 -9
  135. package/src/utils/Emoji/index.ts +0 -1
  136. package/src/utils/Emoji/mountain.svg +0 -1
  137. package/src/utils/assert.ts +0 -39
  138. package/src/utils/determineSectionUrlHash.ts +0 -35
  139. package/src/utils/filter.ts +0 -12
  140. package/src/utils/index.ts +0 -6
  141. package/src/utils/isBrowser.ts +0 -5
  142. package/src/utils/jsxToTextContent.ts +0 -11
  143. package/src/utils/objectAssign.ts +0 -9
  144. package/vite.config/markdownHeadings.ts +0 -128
  145. package/vite.config.ts +0 -42
@@ -1,27 +0,0 @@
1
- code {
2
- padding: 2px 5px;
3
- }
4
-
5
- /*
6
- * Line breaks in `<code>`:
7
- * - Avoid them on desktop
8
- * - Allow them on mobile
9
- * - Allo them for `<code long>`
10
- */
11
- code {
12
- display: inline-block;
13
- }
14
- @media screen and (max-width: 500px) {
15
- code {
16
- word-break: break-word;
17
- display: inline;
18
- }
19
- }
20
- .inline-code-break code {
21
- display: inline;
22
- word-break: break-word;
23
- }
24
- code.long {
25
- word-break: break-word;
26
- display: inline;
27
- }
package/src/css/code.css DELETED
@@ -1,20 +0,0 @@
1
- @import './code/inline.css';
2
- @import './code/block.css';
3
-
4
- code {
5
- /*
6
- background-color: #f4f4f4;
7
- 0.043137255 = 1 - (#f4 / #ff)
8
- */
9
- background-color: rgba(0, 0, 0, 0.043137255);
10
- border-radius: 4px;
11
- }
12
-
13
- /* Inline */
14
- code {
15
- font-size: 1.1em;
16
- }
17
- /* Block */
18
- pre > code {
19
- font-size: 1em;
20
- }
@@ -1,29 +0,0 @@
1
- .colorize-on-hover,
2
- .colorize-on-hover [class^='decolorize-'],
3
- .colorize-on-hover [class*=' decolorize-'] {
4
- transition: filter 0.3s ease-in-out;
5
- }
6
- .colorize-on-hover:hover,
7
- .colorize-on-hover:hover [class^='decolorize-'],
8
- .colorize-on-hover:hover [class*=' decolorize-'] {
9
- filter: grayscale(0) opacity(1) !important;
10
- }
11
-
12
- .decolorize-7 {
13
- filter: grayscale(1) opacity(0.7);
14
- }
15
- .decolorize-6 {
16
- filter: grayscale(1) opacity(0.6);
17
- }
18
- .decolorize-5 {
19
- filter: grayscale(1) opacity(0.5);
20
- }
21
- .decolorize-4 {
22
- filter: grayscale(1) opacity(0.4);
23
- }
24
-
25
- /*
26
- * Twitter opacity(0.7): #ababab > #868686
27
- * == Following computation does NOT work ==
28
- * Discord opacity(0.7): #6c6c6c > (0.7 * (#fff - #ababab) = #868686 = x * (#fff - #6c6c6c) <=> x = 0.7 * ((#fff - #ababab) / (#fff - #6c6c6c)) = 0.7 * ((255 - 171) / (255 - 108)) = 0.4)
29
- */
package/src/css/font.css DELETED
@@ -1,19 +0,0 @@
1
- body {
2
- font-family: 'Inter';
3
- }
4
- button {
5
- font-family: inherit;
6
- }
7
- body {
8
- --color-text: #323d48;
9
- color: var(--color-text);
10
- line-height: 1.5;
11
- }
12
-
13
- @font-face {
14
- font-family: 'Inter';
15
- font-weight: 100 900;
16
- font-stretch: 75% 125%;
17
- font-style: oblique 0deg 12deg;
18
- src: url('./Inter-Var.ttf') format('truetype-variations');
19
- }
@@ -1,25 +0,0 @@
1
- .doc-page h2 {
2
- margin-top: 50px;
3
- margin-bottom: 16px;
4
- }
5
- .doc-page h2[id] {
6
- cursor: pointer;
7
- position: relative;
8
- padding-left: 20px;
9
- margin-left: -20px;
10
- }
11
- .doc-page h2[id]:hover::before {
12
- content: '#';
13
- position: absolute;
14
- left: calc(-1 * (0.75em - 20px));
15
- color: #aaa;
16
- }
17
-
18
- .doc-page h1 + h2 {
19
- margin-top: 0;
20
- }
21
-
22
- .doc-page h4 {
23
- margin-top: 32px;
24
- margin-bottom: 16px;
25
- }
package/src/css/index.css DELETED
@@ -1,10 +0,0 @@
1
- @import './reset.css';
2
- @import './colorize-on-hover.css';
3
- @import './heading.css';
4
- @import './button.css';
5
- @import './link.css';
6
- @import './font.css';
7
- @import './code.css';
8
- @import './note.css';
9
- @import './table.css';
10
- @import './tooltip.css';
package/src/css/link.css DELETED
@@ -1,17 +0,0 @@
1
- /*
2
- :root {
3
- --link-color: #4747ff;
4
- }
5
- */
6
-
7
- a {
8
- /*
9
- color: inherit;
10
- color: var(--link-color);
11
- */
12
- color: #4747ff;
13
- text-decoration: none;
14
- }
15
- a > button {
16
- color: var(--color-text);
17
- }
package/src/css/note.css DELETED
@@ -1,26 +0,0 @@
1
- blockquote {
2
- --color: 0, 0, 0;
3
- --color-strengh-bg: 0.7;
4
- --color-strengh-border: 1.5;
5
- border-left: 8px solid rgba(var(--color), calc(0.06 * var(--color-strengh-border)));
6
- background-color: rgba(var(--color), calc(0.03 * var(--color-strengh-bg)));
7
- margin-left: 0;
8
- padding: 4px 16px;
9
- }
10
- blockquote.error {
11
- --color-strengh-bg: 1.7;
12
- --color-strengh-border: 6;
13
- --color: 190, 25, 49;
14
- }
15
- blockquote.warning {
16
- --color-strengh-bg: 4;
17
- --color-strengh-border: 8;
18
- --color: 255, 204, 50;
19
- }
20
- blockquote > p:first-child::before,
21
- /* blockquote > p:first-of-type::before, */
22
- blockquote > div.paragraph:first-child::before {
23
- font-family: emoji;
24
- content: 'ℹ️';
25
- margin-right: 4px;
26
- }
package/src/css/reset.css DELETED
@@ -1,12 +0,0 @@
1
- * {
2
- box-sizing: border-box;
3
- }
4
- body {
5
- margin: 0;
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/src/css/table.css DELETED
@@ -1,14 +0,0 @@
1
- table th {
2
- background-color: #f7f7f7;
3
- }
4
- table {
5
- border-collapse: collapse;
6
- }
7
- table td,
8
- table th {
9
- padding: 8px;
10
- border: 1px solid #ccc;
11
- }
12
- table th {
13
- text-align: left;
14
- }
@@ -1,11 +0,0 @@
1
- @import 'balloon-css';
2
-
3
- :root {
4
- --balloon-color: #444;
5
- --balloon-move: 2px;
6
- --balloon-font-size: 14px;
7
- --balloon-border-radius: 5px;
8
- }
9
- [aria-label][data-balloon-pos]:after {
10
- font-family: 'Inter';
11
- }
package/src/headings.ts DELETED
@@ -1,201 +0,0 @@
1
- import React from 'react'
2
- import { assert } from './utils'
3
- import { Emoji, EmojiName } from './utils/Emoji'
4
-
5
- export { getHeadings }
6
- export { parseTitle }
7
-
8
- export type Heading = Omit<HeadingDefinition, 'title' | 'titleInNav'> & {
9
- title: JSX.Element
10
- titleInNav: JSX.Element
11
- parentHeadings: Heading[]
12
- // Not sure why this is needed
13
- isListTitle?: true
14
- sectionTitles?: string[]
15
- }
16
- export type HeadingWithoutLink = {
17
- url: string
18
- title: string | JSX.Element
19
- }
20
- export type HeadingDefinition = HeadingBase &
21
- (
22
- | ({ level: 1; titleEmoji: EmojiName } & HeadingAbstract)
23
- | ({ level: 4 } & HeadingAbstract)
24
- | {
25
- level: 2
26
- isListTitle?: true
27
- sectionTitles?: string[]
28
- url: string
29
- }
30
- | {
31
- level: 3
32
- url: string
33
- }
34
- )
35
- type HeadingBase = {
36
- title: string
37
- level: number
38
- url?: string
39
- titleDocument?: string
40
- titleInNav?: string
41
- // titleSize?: string
42
- }
43
- type HeadingAbstract = {
44
- url?: undefined
45
- titleDocument?: undefined
46
- titleInNav?: undefined
47
- }
48
-
49
- function getHeadings(config: { headings: HeadingDefinition[]; headingsWithoutLink: HeadingWithoutLink[] }): {
50
- headings: Heading[]
51
- headingsWithoutLink: HeadingWithoutLink[]
52
- } {
53
- const headingsWithoutParent: Omit<Heading, 'parentHeadings'>[] = config.headings.map((heading: HeadingDefinition) => {
54
- const titleProcessed: JSX.Element = parseTitle(heading.title)
55
-
56
- const titleInNav = heading.titleInNav || heading.title
57
- let titleInNavProcessed: JSX.Element
58
- if ('isListTitle' in heading) {
59
- assert(heading.isListTitle === true)
60
- let titleParsed: JSX.Element = parseTitle(titleInNav)
61
- // if (heading.titleSize) {
62
- // titleParsed = React.createElement('span', { style: { fontSize: heading.titleSize } }, titleParsed)
63
- // }
64
- titleInNavProcessed = React.createElement(React.Fragment, {}, getListPrefix(), titleParsed)
65
- } else {
66
- titleInNavProcessed = parseTitle(titleInNav)
67
- }
68
- if ('titleEmoji' in heading) {
69
- assert(heading.titleEmoji)
70
- titleInNavProcessed = withEmoji(heading.titleEmoji, titleInNavProcessed)
71
- }
72
-
73
- const headingProcessed: Omit<Heading, 'parentHeadings'> = {
74
- ...heading,
75
- title: titleProcessed,
76
- titleInNav: titleInNavProcessed
77
- }
78
- return headingProcessed
79
- })
80
-
81
- const headings: Heading[] = []
82
- headingsWithoutParent.forEach((heading) => {
83
- const parentHeadings = findParentHeadings(heading, headings)
84
- headings.push({ ...heading, parentHeadings })
85
- })
86
-
87
- const headingsWithoutLink = config.headingsWithoutLink.map((headingsWithoutLink) => {
88
- const { url, title } = headingsWithoutLink
89
- assert(
90
- headings.find((heading) => heading.url === url) === undefined,
91
- `remove ${headingsWithoutLink.url} from headingsWithoutLink`
92
- )
93
- const titleProcessed = typeof title === 'string' ? parseTitle(title) : title
94
- return {
95
- ...headingsWithoutLink,
96
- title: titleProcessed
97
- }
98
- })
99
-
100
- assertHeadingsUrl([...headings, ...headingsWithoutLink])
101
- return { headings, headingsWithoutLink }
102
- }
103
-
104
- function findParentHeadings(heading: Omit<Heading, 'parentHeadings'>, headings: Heading[]) {
105
- const parentHeadings: Heading[] = []
106
- let levelCurrent = heading.level
107
- let listTitleParentFound = false
108
- headings
109
- .slice()
110
- .reverse()
111
- .forEach((parentCandidate) => {
112
- let isListTitleParent = false
113
- if (
114
- !listTitleParentFound &&
115
- levelCurrent === heading.level &&
116
- parentCandidate.level === heading.level &&
117
- !parentCandidate.isListTitle &&
118
- heading.isListTitle
119
- ) {
120
- isListTitleParent = true
121
- listTitleParentFound = true
122
- }
123
-
124
- const isParent = parentCandidate.level < levelCurrent
125
-
126
- if (isParent || isListTitleParent) {
127
- levelCurrent = parentCandidate.level
128
- parentHeadings.push(parentCandidate)
129
- }
130
- })
131
- return parentHeadings
132
- }
133
-
134
- function assertHeadingsUrl(headings: { url?: string }[]) {
135
- const urls: Record<string, true> = {}
136
- headings.forEach((heading) => {
137
- if (heading.url) {
138
- const { url } = heading
139
- assert(url.startsWith('/'))
140
- assert(!urls[url], { url })
141
- urls[url] = true
142
- }
143
- })
144
- }
145
-
146
- function getListPrefix() {
147
- const nonBreakingSpace = String.fromCodePoint(0x00a0)
148
- const bulletPoint = String.fromCodePoint(0x2022)
149
- return nonBreakingSpace + bulletPoint + nonBreakingSpace
150
- }
151
-
152
- function parseTitle(title: string): JSX.Element {
153
- type Part = { nodeType: 'text' | 'code'; content: string }
154
- const parts: Part[] = []
155
- let current: Part | undefined
156
- title.split('').forEach((letter) => {
157
- if (letter === '`') {
158
- if (current?.nodeType === 'code') {
159
- // </code>
160
- parts.push(current)
161
- current = undefined
162
- } else {
163
- // <code>
164
- if (current) {
165
- parts.push(current)
166
- }
167
- current = { nodeType: 'code', content: '' }
168
- }
169
- } else {
170
- if (!current) {
171
- current = { nodeType: 'text', content: '' }
172
- }
173
- current.content += letter
174
- }
175
- })
176
- if (current) {
177
- parts.push(current)
178
- }
179
-
180
- const titleJsx = React.createElement(
181
- React.Fragment,
182
- {},
183
- ...parts.map((part, i) =>
184
- React.createElement(part.nodeType === 'code' ? 'code' : React.Fragment, { key: i }, part.content)
185
- )
186
- )
187
-
188
- return titleJsx
189
- }
190
-
191
- function withEmoji(name: EmojiName, title: string | JSX.Element): JSX.Element {
192
- const style = { fontSize: '1.4em' }
193
- //return React.createElement(React.Fragment, null, Emoji({ name, style }), ' ', title)
194
- return React.createElement(
195
- 'span',
196
- { style },
197
- Emoji({ name }),
198
- ' ',
199
- React.createElement('span', { style: { fontSize: '1rem' } }, title)
200
- )
201
- }
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './components'
2
- export * from './utils'
3
- export * from './types'
@@ -1,50 +0,0 @@
1
- import { assert } from './utils'
2
-
3
- installSectionUrlHashs()
4
- /* Let browser restore previous scroll
5
- jumpToSection()
6
- */
7
-
8
- function installSectionUrlHashs() {
9
- const pageContainer = document.querySelector('.doc-page #page-container')
10
- if (!pageContainer) {
11
- assert(window.location.pathname === '/')
12
- return
13
- }
14
- const navigationEl = document.getElementById('navigation-content')
15
- assert(navigationEl)
16
- const docSections = Array.from(document.querySelectorAll('h2'))
17
- docSections.forEach((docSection) => {
18
- const docTitle = docSection.textContent
19
- assert(docTitle)
20
- assert(docSection.id, { docSection })
21
- const urlHash = '#' + docSection.id
22
- assertNavLink(navigationEl, urlHash)
23
- docSection.onclick = () => {
24
- window.location.hash = urlHash
25
- // The browser doesn't jump if hash doesn't change
26
- jumpToSection()
27
- }
28
- })
29
- }
30
-
31
- function assertNavLink(navigationEl: HTMLElement, urlHash: string) {
32
- const parentNavLinkMatch = Array.from(navigationEl.querySelectorAll(`a[href="${window.location.pathname}"]`))
33
- assert(parentNavLinkMatch.length <= 1)
34
- if (parentNavLinkMatch.length === 0) return
35
- const navLinks: HTMLElement[] = Array.from(navigationEl.querySelectorAll(`a[href="${urlHash}"]`))
36
- assert(navLinks.length === 1, { urlHash })
37
- }
38
-
39
- function jumpToSection() {
40
- const { hash } = window.location
41
- if (hash === '' || hash === '#') {
42
- return
43
- }
44
- assert(hash.startsWith('#'))
45
- const target = document.getElementById(hash.slice(1))
46
- if (!target) {
47
- return
48
- }
49
- target.scrollIntoView()
50
- }
@@ -1,41 +0,0 @@
1
- /*
2
- .nav-item {
3
- border-top: 1px solid transparent;
4
- }
5
- .nav-item.is-active {
6
- border-color: #eaeaea;
7
- }
8
- .nav-item[is-active] {
9
- background-color: attr(is-active)
10
- }
11
- */
12
-
13
- /*
14
- #navigation-container:not(:hover) ::-webkit-scrollbar {
15
- display: none;
16
- }
17
- #navigation-container ::-webkit-scrollbar-thumb {
18
- opacity: 0;
19
- }
20
- #navigation-container ::-webkit-scrollbar-track {
21
- opacity: 0;
22
- }
23
- */
24
-
25
- /*
26
- .nav-tree:not(.expanded) > .nav-tree {
27
- edisplay: none;
28
- background:red;
29
- }
30
- */
31
- /*
32
- .nav-tree.expanded,
33
- .nav-tree.expanded > .nav-tree {
34
- display: inherit;
35
- }
36
- .nav-tree.expanded,
37
- .nav-tree.expanded > .nav-tree {
38
- display: inherit;
39
- background:red;
40
- }
41
- */
@@ -1,122 +0,0 @@
1
- .nav-item {
2
- display: block;
3
- white-space: nowrap;
4
- overflow-x: hidden;
5
- --padding-left-global: 9px;
6
- --padding-left-additional: 0px;
7
- }
8
- .nav-item code {
9
- font-size: 0.9em;
10
- }
11
- .nav-item-h1 + .nav-item-h4 {
12
- margin-top: -2px;
13
- }
14
- .nav-item-h4 {
15
- margin-top: 14px;
16
- margin-bottom: -1px;
17
- color: #999;
18
- font-size: 12px;
19
- font-weight: 400;
20
- letter-spacing: 0.15ch;
21
- padding-left: var(--padding-left-global);
22
- padding-right: 4px;
23
- text-decoration: none;
24
- }
25
- .nav-column:first-of-type > .nav-h1-group:first-of-type > .nav-item-h1:first-of-type {
26
- margin-top: 20px;
27
- }
28
- .nav-item-h1 {
29
- margin-top: 30px;
30
- font-size: 15.4px;
31
- text-transform: uppercase;
32
- font-weight: 600;
33
- letter-spacing: 0.15ch;
34
- color: var(--color-text);
35
- padding: 12px 0;
36
- padding-left: calc(var(--padding-left-global) - 2px);
37
- padding-right: 4px;
38
- text-decoration: none;
39
- }
40
- .nav-item-h2 {
41
- text-decoration: none;
42
- font-size: 14.4px;
43
- font-weight: 400;
44
- letter-spacing: 0.15ch;
45
- color: var(--color-text);
46
- padding-left: var(--padding-left-global);
47
- padding-right: 0;
48
- --padding: 4px;
49
- padding-top: var(--padding);
50
- padding-bottom: var(--padding);
51
- }
52
- .nav-item-h3 {
53
- font-size: 12px;
54
- font-weight: 400;
55
- letter-spacing: 0.15ch;
56
- color: var(--color-text);
57
- text-decoration: none;
58
- --padding: 5px;
59
-
60
- background-color: #f9f9f9;
61
- padding: var(--padding) 0;
62
- padding-left: calc(var(--padding-left-global) + var(--padding-left-additional));
63
- }
64
- html.navigation-fullscreen .nav-item-h3 {
65
- border-right: 4px solid #eee;
66
- }
67
- .nav-item-h3.nav-item-first-of-its-kind {
68
- padding-top: calc(var(--padding) * 1.6);
69
- }
70
- .nav-item-h3.nav-item-last-of-its-kind {
71
- padding-bottom: calc(var(--padding) * 2);
72
- }
73
- .nav-item-h2,
74
- .nav-item-h3 {
75
- position: relative;
76
- }
77
- /*
78
- .nav-item-h2.is-active .nav-item-text{
79
- background-color: var(--background-color);
80
- }
81
- */
82
- .nav-item-h2.is-active {
83
- background-color: var(--background-color);
84
- }
85
- .nav-item-h3.is-active:before {
86
- display: block;
87
- content: '';
88
- position: absolute;
89
- width: 4px;
90
- left: 0;
91
- top: 0;
92
- height: 100%;
93
- background-color: var(--background-color);
94
- z-index: 10;
95
- }
96
- .nav-item-h3.is-active-last:after {
97
- display: block;
98
- content: '';
99
- position: absolute;
100
- height: 4px;
101
- left: 0;
102
- bottom: 0;
103
- width: 100%;
104
- background-color: var(--background-color);
105
- z-index: 10;
106
- border-bottom-left-radius: 5px;
107
- }
108
- html.navigation-fullscreen .nav-item {
109
- --expend-border-radius: 5px;
110
- }
111
- .nav-item.is-active-first {
112
- border-top-left-radius: 5px;
113
- border-top-right-radius: var(--expend-border-radius);
114
- }
115
- .nav-item.is-active-last,
116
- .nav-item.is-active-last:before {
117
- border-bottom-left-radius: 5px;
118
- border-bottom-right-radius: var(--expend-border-radius);
119
- }
120
- .nav-item-h3.nav-item-parent-is-list-heading {
121
- --padding-left-additional: 21px;
122
- }