@brillout/docpress 0.1.20 → 0.2.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.
- package/bin.js +1 -1
- package/{src/css/Inter-Var.ttf → dist/Inter-Var-IOAEQULN.ttf} +0 -0
- package/{src/components/Sponsors/companyLogos/ccoli.svg → dist/ccoli-CHW3TQKS.svg} +0 -0
- package/{src/icons/changelog.svg → dist/changelog-IPI5F42D.svg} +0 -0
- package/{src/navigation/navigation-fullscreen/chevron.svg → dist/chevron-K3WPYLOP.svg} +0 -0
- package/{src/components/features/chevron.svg → dist/chevron-R2IYJD62.svg} +0 -0
- package/dist/chunk-7HKDCMSZ.js +154 -0
- package/dist/chunk-7HKDCMSZ.js.map +1 -0
- package/dist/chunk-C3OIVLKV.js +75 -0
- package/dist/chunk-C3OIVLKV.js.map +1 -0
- package/dist/chunk-G2A5MZJA.js +48 -0
- package/dist/chunk-G2A5MZJA.js.map +1 -0
- package/dist/chunk-H5CO4N2X.js +174 -0
- package/dist/chunk-H5CO4N2X.js.map +1 -0
- package/dist/chunk-TTLAZ2T2.js +8 -0
- package/dist/chunk-TTLAZ2T2.js.map +1 -0
- package/dist/{chunk-ZYYJWJMY.js → chunk-XUTBTIEE.js} +15 -42
- package/dist/chunk-XUTBTIEE.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +35 -0
- package/dist/cli/index.js.map +1 -0
- package/{src/navigation/navigation-fullscreen/close.svg → dist/close-IQXTDOHV.svg} +0 -0
- package/{src/utils/Emoji/compass.svg → dist/compass-2RWQU3E4.svg} +0 -0
- package/{src → dist}/components/features/FeatureList.css +2 -7
- package/dist/components/features/FeatureList.css.map +1 -0
- package/dist/components/features/FeatureList.d.ts +13 -0
- package/dist/components/features/FeatureList.js +8 -0
- package/dist/components/features/FeatureList.js.map +1 -0
- package/dist/components/features/initFeatureList.d.ts +3 -0
- package/dist/components/features/initFeatureList.js +60 -0
- package/dist/components/features/initFeatureList.js.map +1 -0
- package/{src/components/Sponsors/companyLogos/contra.svg → dist/contra-WLZBOPBV.svg} +0 -0
- package/dist/{devServer-J2XJQJGT.js → devServer-534L4U45.js} +5 -2
- package/dist/{devServer-J2XJQJGT.js.map → devServer-534L4U45.js.map} +1 -1
- package/{src/icons/discord.svg → dist/discord-JD33TUSF.svg} +0 -0
- package/{src/utils/Emoji/engine.png → dist/engine-6Q6VSCVA.png} +0 -0
- package/{src/icons/github.svg → dist/github-P5ZSKN2N.svg} +0 -0
- package/{src/icons/heart.svg → dist/heart-OINVKOXO.svg} +0 -0
- package/dist/index.css +121 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +136 -0
- package/dist/index.js +459 -26
- package/dist/index.js.map +1 -1
- package/{src/components/Sponsors/label.svg → dist/label-MP75CTIA.svg} +0 -0
- package/{src/utils/Emoji/mechanical-arm.svg → dist/mechanical-arm-TR7IQQMG.svg} +0 -0
- package/{src/components/Sponsors/medalBronze.svg → dist/medalBronze-CO4CTUR4.svg} +0 -0
- package/{src/components/Sponsors/medalGold.svg → dist/medalGold-UP6A73FL.svg} +0 -0
- package/{src/components/Sponsors/medalSilver.svg → dist/medalSilver-FAPGGOBN.svg} +0 -0
- package/{src/components/Sponsors/companyLogos/mfqs.svg → dist/mfqs-2EAEE7N6.svg} +0 -0
- package/dist/renderer/_default.page.client.css +264 -0
- package/dist/renderer/_default.page.client.css.map +1 -0
- package/dist/renderer/_default.page.client.d.ts +1 -0
- package/dist/renderer/_default.page.client.js +180 -0
- package/dist/renderer/_default.page.client.js.map +1 -0
- package/dist/renderer/_default.page.server.css +312 -0
- package/dist/renderer/_default.page.server.css.map +1 -0
- package/dist/renderer/_default.page.server.d.ts +22 -0
- package/dist/renderer/_default.page.server.js +591 -0
- package/dist/renderer/_default.page.server.js.map +1 -0
- package/{src/utils/Emoji/road-fork.svg → dist/road-fork-3WZLW3HB.svg} +0 -0
- package/{src/utils/Emoji/shield.svg → dist/shield-CU45RG5C.svg} +0 -0
- package/{src/icons/twitter.svg → dist/twitter-I7DXDN3J.svg} +0 -0
- package/{src/utils/Emoji/typescript.svg → dist/typescript-ALIPKLRM.svg} +0 -0
- package/package.json +12 -9
- package/dist/chunk-ZYYJWJMY.js.map +0 -1
- package/src/MobileHeader.tsx +0 -68
- package/src/PageLayout.css +0 -41
- package/src/PageLayout.tsx +0 -37
- package/src/algolia/DocSearch.css +0 -29
- package/src/algolia/DocSearch.ts +0 -37
- package/src/autoScrollNav.ts +0 -22
- package/src/cli/devServer.ts +0 -31
- package/src/cli/index.ts +0 -29
- package/src/components/CodeBlock.tsx +0 -22
- package/src/components/DocLink.tsx +0 -108
- package/src/components/EditPageNote.tsx +0 -18
- package/src/components/HorizontalLine.tsx +0 -20
- package/src/components/ImportMeta.tsx +0 -11
- package/src/components/Info.tsx +0 -12
- package/src/components/Link.tsx +0 -18
- package/src/components/Note.tsx +0 -31
- package/src/components/P.css +0 -8
- package/src/components/P.tsx +0 -8
- package/src/components/ReadingRecommendation.tsx +0 -53
- package/src/components/RepoLink.tsx +0 -24
- package/src/components/Sponsors/companyLogos/ccoli-logo.svg +0 -1
- package/src/components/Sponsors/companyLogos/ccoli-text.svg +0 -1
- package/src/components/Sponsors/label.draft.svg +0 -108
- package/src/components/Sponsors.tsx +0 -242
- package/src/components/features/FeatureList.tsx +0 -114
- package/src/components/features/initFeatureList.ts +0 -66
- package/src/components/index.ts +0 -13
- package/src/config/Config.ts +0 -30
- package/src/config/getConfig.ts +0 -18
- package/src/config/resolveConfig/resolveHeading.ts +0 -0
- package/src/config/resolvePageContext.ts +0 -157
- package/src/css/button.css +0 -7
- package/src/css/code/block.css +0 -36
- package/src/css/code/inline.css +0 -27
- package/src/css/code.css +0 -20
- package/src/css/colorize-on-hover.css +0 -29
- package/src/css/font.css +0 -19
- package/src/css/heading.css +0 -25
- package/src/css/index.css +0 -11
- package/src/css/link.css +0 -17
- package/src/css/note.css +0 -26
- package/src/css/reset.css +0 -12
- package/src/css/table.css +0 -14
- package/src/css/tooltip.css +0 -11
- package/src/headings.ts +0 -200
- package/src/index.ts +0 -3
- package/src/installSectionUrlHashs.ts +0 -50
- package/src/markdownHeadingsVitePlugin.ts +0 -128
- package/src/navigation/Navigation-highlight.css +0 -41
- package/src/navigation/Navigation-items.css +0 -122
- package/src/navigation/Navigation-layout.css +0 -118
- package/src/navigation/Navigation.client.old.ts +0 -303
- package/src/navigation/Navigation.client.ts +0 -19
- package/src/navigation/Navigation.css +0 -12
- package/src/navigation/Navigation.tsx +0 -228
- package/src/navigation/NavigationHeader.tsx +0 -97
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -44
- package/src/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -115
- package/src/parseEmojis.ts +0 -33
- package/src/renderer/_default.page.client.ts +0 -4
- package/src/renderer/_default.page.server.tsx +0 -69
- package/src/renderer/usePageContext.tsx +0 -25
- package/src/types.ts +0 -2
- package/src/utils/Emoji/Emoji.ts +0 -216
- package/src/utils/Emoji/assets.ts +0 -9
- package/src/utils/Emoji/index.ts +0 -1
- package/src/utils/Emoji/mountain.svg +0 -1
- package/src/utils/assert.ts +0 -39
- package/src/utils/client.ts +0 -2
- package/src/utils/crawlAllFiles.ts +0 -17
- package/src/utils/determineSectionUrlHash.ts +0 -35
- package/src/utils/filesystemPathHandling.ts +0 -42
- package/src/utils/filter.ts +0 -12
- package/src/utils/isBrowser.ts +0 -5
- package/src/utils/jsxToTextContent.ts +0 -11
- package/src/utils/objectAssign.ts +0 -9
- package/src/utils/server.ts +0 -8
- package/src/vite.config.ts +0 -44
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import './FeatureList.css'
|
|
3
|
-
import iconChevron from './chevron.svg'
|
|
4
|
-
|
|
5
|
-
export { FeatureList }
|
|
6
|
-
|
|
7
|
-
type FeatureProps = {
|
|
8
|
-
title: React.ReactNode
|
|
9
|
-
desc: React.ReactNode
|
|
10
|
-
learnMore?: React.ReactNode
|
|
11
|
-
isSecondaryFeature?: true
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function FeatureList({ features }: { features: FeatureProps[] }) {
|
|
15
|
-
const numberOfFeatures = features.length
|
|
16
|
-
const numberOfRows = Math.ceil(numberOfFeatures / 2)
|
|
17
|
-
return (
|
|
18
|
-
<div id="features">
|
|
19
|
-
{Array.from({ length: numberOfRows }, (_, i) => {
|
|
20
|
-
const feature1Id = 2 * i + 0
|
|
21
|
-
const feature2Id = 2 * i + 1
|
|
22
|
-
const feature1 = features[feature1Id]
|
|
23
|
-
const feature2 = features[feature2Id]
|
|
24
|
-
const className = ['features-row', feature2 ? '' : 'single-column'].filter(Boolean).join(' ')
|
|
25
|
-
return (
|
|
26
|
-
<div className={className} key={i}>
|
|
27
|
-
<Feature {...{ ...feature1, featureId: feature1Id }} />
|
|
28
|
-
{feature2 && <Feature {...{ ...feature2, featureId: feature2Id }} />}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
})}
|
|
32
|
-
</div>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Feature({ title, desc, learnMore, isSecondaryFeature, featureId }: FeatureProps & { featureId: number }) {
|
|
37
|
-
const name = `feature-${featureId}`
|
|
38
|
-
const rightSide = featureId % 2 === 1
|
|
39
|
-
return (
|
|
40
|
-
<>
|
|
41
|
-
<FeatureHead name={name} hasLearnMore={!!learnMore} isSecondaryFeature={isSecondaryFeature}>
|
|
42
|
-
{' '}
|
|
43
|
-
<h2>{title}</h2>
|
|
44
|
-
{desc}
|
|
45
|
-
</FeatureHead>
|
|
46
|
-
{!!learnMore && (
|
|
47
|
-
<LearnMore name={name} rightSide={rightSide}>
|
|
48
|
-
{learnMore}
|
|
49
|
-
</LearnMore>
|
|
50
|
-
)}
|
|
51
|
-
</>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function FeatureHead({
|
|
56
|
-
children,
|
|
57
|
-
name,
|
|
58
|
-
hasLearnMore,
|
|
59
|
-
isSecondaryFeature,
|
|
60
|
-
className = ''
|
|
61
|
-
}: {
|
|
62
|
-
className?: string
|
|
63
|
-
name?: string
|
|
64
|
-
hasLearnMore?: boolean
|
|
65
|
-
isSecondaryFeature?: true
|
|
66
|
-
children: any
|
|
67
|
-
}) {
|
|
68
|
-
return (
|
|
69
|
-
<summary
|
|
70
|
-
className={[
|
|
71
|
-
className,
|
|
72
|
-
'feature',
|
|
73
|
-
'colorize-on-hover',
|
|
74
|
-
hasLearnMore && 'has-learn-more',
|
|
75
|
-
isSecondaryFeature && 'secondary-feature'
|
|
76
|
-
]
|
|
77
|
-
.filter(Boolean)
|
|
78
|
-
.join(' ')}
|
|
79
|
-
id={name && `feature-${name}`}
|
|
80
|
-
style={{ cursor: (hasLearnMore && 'pointer') || undefined }}
|
|
81
|
-
>
|
|
82
|
-
{children}
|
|
83
|
-
{hasLearnMore && (
|
|
84
|
-
<div style={{ textAlign: 'center', marginTop: '1em' }}>
|
|
85
|
-
<button
|
|
86
|
-
type="button"
|
|
87
|
-
style={{
|
|
88
|
-
textAlign: 'center',
|
|
89
|
-
padding: '0 7px',
|
|
90
|
-
paddingTop: 3,
|
|
91
|
-
paddingBottom: 1,
|
|
92
|
-
display: 'inline-block',
|
|
93
|
-
fontSize: '10px',
|
|
94
|
-
textTransform: 'uppercase',
|
|
95
|
-
letterSpacing: '1px',
|
|
96
|
-
fontWeight: 600
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
<span className="decolorize-5">Learn more</span>
|
|
100
|
-
<br />
|
|
101
|
-
<img className="decolorize-4 chevron" src={iconChevron} height="7" style={{ marginTop: 2 }} />
|
|
102
|
-
</button>
|
|
103
|
-
</div>
|
|
104
|
-
)}
|
|
105
|
-
</summary>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
function LearnMore({ children, name, rightSide }: { name: string; children: any; rightSide: boolean }) {
|
|
109
|
-
return (
|
|
110
|
-
<aside className={'learn-more ' + (rightSide ? 'right-side' : '')} id={`learn-more-${name}`}>
|
|
111
|
-
{children}
|
|
112
|
-
</aside>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { assert } from '../../utils/client'
|
|
2
|
-
|
|
3
|
-
addTwitterWidgets()
|
|
4
|
-
addFeatureClickHandlers()
|
|
5
|
-
window.__docpress_hydrationFinished = true
|
|
6
|
-
|
|
7
|
-
function addTwitterWidgets() {
|
|
8
|
-
loadScript('https://platform.twitter.com/widgets.js')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function addFeatureClickHandlers() {
|
|
12
|
-
const featureEls: HTMLElement[] = Array.from(
|
|
13
|
-
document.getElementById('features')!.querySelectorAll('.feature.has-learn-more')
|
|
14
|
-
)
|
|
15
|
-
featureEls.forEach((featureEl) => {
|
|
16
|
-
featureEl.onclick = () => {
|
|
17
|
-
expandLearnMore(featureEl)
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function expandLearnMore(featureEl: HTMLElement) {
|
|
23
|
-
const featureId = featureEl.id
|
|
24
|
-
assert(featureId.startsWith('feature-'), { featureId })
|
|
25
|
-
const featureName = featureId.slice('feature-'.length)
|
|
26
|
-
|
|
27
|
-
const selectedClass = 'selected'
|
|
28
|
-
const learnId = 'learn-more-' + featureName
|
|
29
|
-
const learnEl = document.getElementById(learnId)
|
|
30
|
-
assert(learnEl, { learnId })
|
|
31
|
-
|
|
32
|
-
const isExpanded = featureEl.classList.contains(selectedClass)
|
|
33
|
-
|
|
34
|
-
if (!isExpanded) {
|
|
35
|
-
const rowEl = featureEl.parentNode as HTMLElement
|
|
36
|
-
if (getComputedStyle(rowEl, 'display') === 'grid') {
|
|
37
|
-
;[
|
|
38
|
-
...(rowEl.querySelectorAll('.learn-more') as any as HTMLElement[]),
|
|
39
|
-
...(rowEl.querySelectorAll('.feature') as any as HTMLElement[])
|
|
40
|
-
].forEach((el) => {
|
|
41
|
-
el.classList.remove(selectedClass)
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
;[featureEl, learnEl].forEach((el) => {
|
|
47
|
-
el.classList.toggle(selectedClass)
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function loadScript(scriptUrl: string): void {
|
|
52
|
-
assert(scriptUrl.startsWith('https://'))
|
|
53
|
-
const scriptEl = document.createElement('script')
|
|
54
|
-
scriptEl.src = scriptUrl
|
|
55
|
-
scriptEl.async = true
|
|
56
|
-
scriptEl.setAttribute('charset', 'utf-8')
|
|
57
|
-
document.getElementsByTagName('head')[0].appendChild(scriptEl)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function getComputedStyle(el: HTMLElement, styleProp: string) {
|
|
61
|
-
return window.document.defaultView!.getComputedStyle(el).getPropertyValue(styleProp)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
declare global {
|
|
65
|
-
var __docpress_hydrationFinished: undefined | true
|
|
66
|
-
}
|
package/src/components/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from '../utils/Emoji'
|
|
2
|
-
export * from './Link'
|
|
3
|
-
export * from './DocLink'
|
|
4
|
-
export * from './RepoLink'
|
|
5
|
-
export * from './P'
|
|
6
|
-
export * from './Info'
|
|
7
|
-
export * from './ReadingRecommendation'
|
|
8
|
-
export * from './Note'
|
|
9
|
-
export * from './ImportMeta'
|
|
10
|
-
export * from './features/FeatureList'
|
|
11
|
-
export * from './HorizontalLine'
|
|
12
|
-
export * from './Sponsors'
|
|
13
|
-
export * from './CodeBlock'
|
package/src/config/Config.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type { Config }
|
|
2
|
-
|
|
3
|
-
import type { HeadingDefinition, HeadingWithoutLink } from '../headings'
|
|
4
|
-
|
|
5
|
-
type Config = {
|
|
6
|
-
projectInfo: {
|
|
7
|
-
githubRepository: string
|
|
8
|
-
githubIssues: string
|
|
9
|
-
projectName: string
|
|
10
|
-
projectNameJsx?: JSX.Element
|
|
11
|
-
projectVersion: string
|
|
12
|
-
discordInvite: string
|
|
13
|
-
twitterProfile: string
|
|
14
|
-
}
|
|
15
|
-
faviconUrl: string
|
|
16
|
-
algolia: null | {
|
|
17
|
-
appId: string
|
|
18
|
-
apiKey: string
|
|
19
|
-
indexName: string
|
|
20
|
-
}
|
|
21
|
-
headings: HeadingDefinition[]
|
|
22
|
-
headingsWithoutLink: HeadingWithoutLink[]
|
|
23
|
-
navHeaderMobile: React.ReactNode
|
|
24
|
-
navHeader: React.ReactNode
|
|
25
|
-
titleNormalCase: boolean
|
|
26
|
-
tagline: string
|
|
27
|
-
websiteUrl: string
|
|
28
|
-
bannerUrl?: string
|
|
29
|
-
twitterHandle: string
|
|
30
|
-
}
|
package/src/config/getConfig.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { getConfig }
|
|
2
|
-
import { assert, assertUsage } from '../utils/server'
|
|
3
|
-
import { Config } from './Config'
|
|
4
|
-
|
|
5
|
-
function getConfig(): Config {
|
|
6
|
-
// We use `@ts-ignore` because the DocPress user most likely didn't add `vite/client` in his `tsconfig.json`.
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
const globResult = import.meta.glob('/**/docpress.config.*([a-zA-Z0-9])', { eager: true })
|
|
9
|
-
const files = Object.keys(globResult)
|
|
10
|
-
assertUsage(files.length >= 1, 'No DocPress config file found `docpress.config.(js|ts|tsx|...)`')
|
|
11
|
-
assertUsage(
|
|
12
|
-
files.length === 1,
|
|
13
|
-
`Found multiple \`docpress.config.js\` files: ${files.map((f) => `\`${f}\``).join(', ')}. Define only one instead.`
|
|
14
|
-
)
|
|
15
|
-
const config = (Object.values(globResult)[0] as any).default as Config
|
|
16
|
-
assert(config)
|
|
17
|
-
return config
|
|
18
|
-
}
|
|
File without changes
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { assert, jsxToTextContent, objectAssign } from '../utils/server'
|
|
2
|
-
import { getHeadings, HeadingWithoutLink, parseTitle } from '../headings'
|
|
3
|
-
import type { Heading } from '../headings'
|
|
4
|
-
import type { PageContextBuiltIn } from 'vite-plugin-ssr'
|
|
5
|
-
import type { MarkdownHeading } from '../markdownHeadingsVitePlugin'
|
|
6
|
-
import type { Config } from './Config'
|
|
7
|
-
import { getConfig } from './getConfig'
|
|
8
|
-
|
|
9
|
-
export { resolvePageContext }
|
|
10
|
-
export type { PageContextOriginal }
|
|
11
|
-
export type { PageContextResolved }
|
|
12
|
-
export type { Heading }
|
|
13
|
-
|
|
14
|
-
type ReactComponent = () => JSX.Element
|
|
15
|
-
type Exports = {
|
|
16
|
-
headings?: MarkdownHeading[]
|
|
17
|
-
}
|
|
18
|
-
type PageContextOriginal = PageContextBuiltIn & {
|
|
19
|
-
Page: ReactComponent
|
|
20
|
-
exports: Exports
|
|
21
|
-
}
|
|
22
|
-
type PageContextResolved = ReturnType<typeof resolvePageContext>
|
|
23
|
-
|
|
24
|
-
function resolvePageContext(pageContext: PageContextOriginal) {
|
|
25
|
-
const config = getConfig()
|
|
26
|
-
const { headings, headingsWithoutLink } = getHeadings(config)
|
|
27
|
-
const activeHeading = findActiveHeading(headings, headingsWithoutLink, pageContext)
|
|
28
|
-
const headingsWithSubHeadings = getHeadingsWithSubHeadings(headings, pageContext, activeHeading)
|
|
29
|
-
const { title, isLandingPage, pageTitle, isDetachedPage } = getMetaData(
|
|
30
|
-
headingsWithoutLink,
|
|
31
|
-
activeHeading,
|
|
32
|
-
pageContext,
|
|
33
|
-
config
|
|
34
|
-
)
|
|
35
|
-
const { faviconUrl, algolia, tagline, twitterHandle, bannerUrl, websiteUrl } = config
|
|
36
|
-
const pageContextResolved = {}
|
|
37
|
-
objectAssign(pageContextResolved, {
|
|
38
|
-
...pageContext,
|
|
39
|
-
meta: {
|
|
40
|
-
title,
|
|
41
|
-
faviconUrl,
|
|
42
|
-
twitterHandle,
|
|
43
|
-
bannerUrl,
|
|
44
|
-
websiteUrl,
|
|
45
|
-
tagline,
|
|
46
|
-
algolia
|
|
47
|
-
},
|
|
48
|
-
headings,
|
|
49
|
-
headingsWithSubHeadings,
|
|
50
|
-
isLandingPage,
|
|
51
|
-
isDetachedPage,
|
|
52
|
-
pageTitle,
|
|
53
|
-
config
|
|
54
|
-
})
|
|
55
|
-
return pageContextResolved
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function getMetaData(
|
|
59
|
-
headingsWithoutLink: HeadingWithoutLink[],
|
|
60
|
-
activeHeading: Heading | null,
|
|
61
|
-
pageContext: { urlOriginal: string; exports: Exports },
|
|
62
|
-
config: Config
|
|
63
|
-
) {
|
|
64
|
-
const url = pageContext.urlOriginal
|
|
65
|
-
|
|
66
|
-
let title: string
|
|
67
|
-
let pageTitle: string | JSX.Element | null
|
|
68
|
-
let isDetachedPage: boolean
|
|
69
|
-
if (activeHeading) {
|
|
70
|
-
title = activeHeading.titleDocument || jsxToTextContent(activeHeading.title)
|
|
71
|
-
pageTitle = activeHeading.title
|
|
72
|
-
isDetachedPage = false
|
|
73
|
-
} else {
|
|
74
|
-
pageTitle = headingsWithoutLink.find((h) => h.url === url)!.title
|
|
75
|
-
title = jsxToTextContent(pageTitle)
|
|
76
|
-
isDetachedPage = true
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const isLandingPage = url === '/'
|
|
80
|
-
if (!isLandingPage) {
|
|
81
|
-
title += ' | ' + config.projectInfo.projectName
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (isLandingPage) {
|
|
85
|
-
pageTitle = null
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return { title, isLandingPage, pageTitle, isDetachedPage }
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function findActiveHeading(
|
|
92
|
-
headings: Heading[],
|
|
93
|
-
headingsWithoutLink: HeadingWithoutLink[],
|
|
94
|
-
pageContext: { urlOriginal: string; exports: Exports }
|
|
95
|
-
): Heading | null {
|
|
96
|
-
let activeHeading: Heading | null = null
|
|
97
|
-
assert(pageContext.urlOriginal)
|
|
98
|
-
const pageUrl = pageContext.urlOriginal
|
|
99
|
-
headings.forEach((heading) => {
|
|
100
|
-
if (heading.url === pageUrl) {
|
|
101
|
-
activeHeading = heading
|
|
102
|
-
assert(heading.level === 2, { pageUrl, heading })
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
const debugInfo = {
|
|
106
|
-
msg: 'Heading not found for url: ' + pageUrl,
|
|
107
|
-
urls: headings.map((h) => h.url),
|
|
108
|
-
url: pageUrl
|
|
109
|
-
}
|
|
110
|
-
assert(activeHeading || headingsWithoutLink.find(({ url }) => pageUrl === url), debugInfo)
|
|
111
|
-
return activeHeading
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function getHeadingsWithSubHeadings(
|
|
115
|
-
headings: Heading[],
|
|
116
|
-
pageContext: { exports: Exports; urlOriginal: string },
|
|
117
|
-
activeHeading: Heading | null
|
|
118
|
-
): Heading[] {
|
|
119
|
-
const headingsWithSubHeadings = headings.slice()
|
|
120
|
-
if (activeHeading === null) return headingsWithSubHeadings
|
|
121
|
-
const activeHeadingIdx = headingsWithSubHeadings.indexOf(activeHeading)
|
|
122
|
-
assert(activeHeadingIdx >= 0)
|
|
123
|
-
const pageHeadings = pageContext.exports.headings || []
|
|
124
|
-
pageHeadings.forEach((pageHeading, i) => {
|
|
125
|
-
const title = parseTitle(pageHeading.title)
|
|
126
|
-
const url = '#' + pageHeading.id
|
|
127
|
-
assert(
|
|
128
|
-
pageHeading.headingLevel !== 3,
|
|
129
|
-
'Wrong page heading level `' +
|
|
130
|
-
pageHeading.headingLevel +
|
|
131
|
-
'` (it should be `<h2>`) for sub-heading `' +
|
|
132
|
-
pageHeading.title +
|
|
133
|
-
'` of page `' +
|
|
134
|
-
pageContext.urlOriginal +
|
|
135
|
-
'`.'
|
|
136
|
-
)
|
|
137
|
-
if (pageHeading.headingLevel === 2) {
|
|
138
|
-
const heading: Heading = {
|
|
139
|
-
url,
|
|
140
|
-
title,
|
|
141
|
-
parentHeadings: [activeHeading, ...activeHeading.parentHeadings],
|
|
142
|
-
titleInNav: title,
|
|
143
|
-
level: 3
|
|
144
|
-
}
|
|
145
|
-
headingsWithSubHeadings.splice(activeHeadingIdx + 1 + i, 0, heading)
|
|
146
|
-
}
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
if (activeHeading?.sectionTitles) {
|
|
150
|
-
activeHeading.sectionTitles.forEach((sectionTitle) => {
|
|
151
|
-
const pageHeadingTitles = pageHeadings.map((h) => h.title)
|
|
152
|
-
assert(pageHeadingTitles.includes(sectionTitle), { pageHeadingTitles, sectionTitle })
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return headingsWithSubHeadings
|
|
157
|
-
}
|
package/src/css/button.css
DELETED
package/src/css/code/block.css
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
pre > code {
|
|
2
|
-
padding: 16px !important;
|
|
3
|
-
}
|
|
4
|
-
@media screen and (max-width: 900px) {
|
|
5
|
-
pre > code {
|
|
6
|
-
font-size: 0.7em;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
pre {
|
|
10
|
-
display: grid;
|
|
11
|
-
}
|
|
12
|
-
pre > code {
|
|
13
|
-
padding-right: 0px !important;
|
|
14
|
-
overflow-x: auto;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@media screen and (max-width: 1139px) {
|
|
18
|
-
pre > code {
|
|
19
|
-
font-size: 0.95em;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
@media screen and (max-width: 1040px) {
|
|
23
|
-
pre > code {
|
|
24
|
-
font-size: 0.8em;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
@media screen and (max-width: 940px) {
|
|
28
|
-
pre > code {
|
|
29
|
-
font-size: 0.7em;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
pre > code {
|
|
34
|
-
display: reset;
|
|
35
|
-
word-break: reset;
|
|
36
|
-
}
|
package/src/css/code/inline.css
DELETED
|
@@ -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
|
-
}
|
package/src/css/heading.css
DELETED
|
@@ -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,11 +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';
|
|
11
|
-
@import '../algolia/DocSearch.css';
|
package/src/css/link.css
DELETED
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
package/src/css/table.css
DELETED