@brillout/docpress 0.5.40 → 0.6.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/+config.ts +17 -0
- package/MobileHeader.tsx +68 -0
- package/PageLayout.css +42 -0
- package/PageLayout.tsx +39 -0
- package/algolia/DocSearch.css +34 -0
- package/algolia/DocSearch.ts +62 -0
- package/autoScrollNav.ts +36 -0
- package/components/CodeBlockTransformer.css +9 -0
- package/components/CodeBlockTransformer.tsx +18 -0
- package/components/Comment.tsx +7 -0
- package/components/Consulting.tsx +47 -0
- package/components/Contributors.tsx +113 -0
- package/components/EditPageNote.tsx +18 -0
- package/components/FeatureList/FeatureList.client.ts +66 -0
- package/{dist/components/features → components/FeatureList}/FeatureList.css +10 -2
- package/components/FeatureList/FeatureList.tsx +114 -0
- package/components/HorizontalLine.tsx +20 -0
- package/components/ImportMeta.tsx +11 -0
- package/components/Link.tsx +144 -0
- package/components/Note.css +54 -0
- package/components/Note.tsx +78 -0
- package/components/P.css +8 -0
- package/components/P.tsx +8 -0
- package/components/ReadingRecommendation.tsx +56 -0
- package/components/RepoLink.tsx +24 -0
- package/components/Sponsors/label.draft.svg +108 -0
- package/components/Sponsors.tsx +218 -0
- package/components/Supporters.tsx +136 -0
- package/components/index.ts +14 -0
- package/config/getConfig.ts +18 -0
- package/config/resolveConfig/resolveHeading.ts +0 -0
- package/config/resolvePageContext.ts +186 -0
- package/css/button.css +7 -0
- package/css/code/block.css +36 -0
- package/css/code/inline.css +27 -0
- package/css/code.css +20 -0
- package/css/colorize-on-hover.css +29 -0
- package/css/font.css +25 -0
- package/css/heading.css +45 -0
- package/css/index.css +12 -0
- package/css/link.css +17 -0
- package/css/reset.css +12 -0
- package/css/table.css +14 -0
- package/css/tooltip.css +11 -0
- package/data/maintainersList.tsx +92 -0
- package/data/sponsorsList.ts +147 -0
- package/dist/+config.d.ts +19 -0
- package/dist/+config.js +15 -0
- package/dist/markdownHeadingsVitePlugin.d.ts +13 -0
- package/dist/markdownHeadingsVitePlugin.js +170 -0
- package/dist/utils/assert.d.ts +6 -0
- package/dist/utils/assert.js +48 -0
- package/dist/utils/determineSectionUrlHash.d.ts +4 -0
- package/dist/utils/determineSectionUrlHash.js +38 -0
- package/dist/vite.config.d.ts +3 -0
- package/dist/vite.config.js +32 -0
- package/index.ts +4 -0
- package/installSectionUrlHashs.ts +60 -0
- package/markdownHeadingsVitePlugin.ts +150 -0
- package/navigation/Navigation-highlight.css +41 -0
- package/navigation/Navigation-items.css +119 -0
- package/navigation/Navigation-layout.css +127 -0
- package/navigation/Navigation.client.ts +43 -0
- package/navigation/Navigation.css +3 -0
- package/navigation/Navigation.tsx +211 -0
- package/navigation/NavigationHeader.tsx +111 -0
- package/navigation/navigation-fullscreen/NavigationFullscreenButton.css +32 -0
- package/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +44 -0
- package/navigation/navigation-fullscreen/initNavigationFullscreen.ts +116 -0
- package/package.json +38 -53
- package/parseEmojis.ts +35 -0
- package/parseTitle.ts +139 -0
- package/renderer/client.ts +4 -0
- package/renderer/onRenderHtml.tsx +69 -0
- package/renderer/usePageContext.tsx +25 -0
- package/tsconfig.config.json +7 -0
- package/tsconfig.json +15 -0
- package/types/Config.ts +46 -0
- package/types/Heading.ts +49 -0
- package/utils/Emoji/Emoji.ts +224 -0
- package/utils/Emoji/assets.ts +9 -0
- package/utils/Emoji/index.ts +1 -0
- package/utils/Emoji/mountain.svg +1 -0
- package/utils/assert.ts +51 -0
- package/utils/client.ts +2 -0
- package/utils/determineSectionUrlHash.ts +44 -0
- package/utils/filesystemPathHandling.ts +42 -0
- package/utils/filter.ts +12 -0
- package/utils/isBrowser.ts +5 -0
- package/utils/jsxToTextContent.ts +11 -0
- package/utils/objectAssign.ts +9 -0
- package/utils/server.ts +7 -0
- package/vite.config.ts +36 -0
- package/bin.js +0 -3
- package/dist/chunk-2ZTPUQGS.js +0 -58
- package/dist/chunk-3QC7HYIF.js +0 -7
- package/dist/chunk-MGOI4AFO.js +0 -165
- package/dist/chunk-NVJING6T.js +0 -91
- package/dist/chunk-QWL3MA4E.js +0 -171
- package/dist/chunk-UN23G34B.js +0 -157
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -34
- package/dist/components/features/FeatureList.d.ts +0 -13
- package/dist/components/features/FeatureList.js +0 -7
- package/dist/components/features/initFeatureList.d.ts +0 -3
- package/dist/components/features/initFeatureList.js +0 -59
- package/dist/devServer-JKH6U5PF.js +0 -36
- package/dist/index.css +0 -120
- package/dist/index.d.ts +0 -221
- package/dist/index.js +0 -947
- package/dist/renderer/_default.page.client.css +0 -318
- package/dist/renderer/_default.page.client.d.ts +0 -1
- package/dist/renderer/_default.page.client.js +0 -218
- package/dist/renderer/_default.page.server.css +0 -310
- package/dist/renderer/_default.page.server.d.ts +0 -22
- package/dist/renderer/_default.page.server.js +0 -665
- package/readme.md +0 -5
- /package/{dist/chevron-R2IYJD62.svg → components/FeatureList/chevron.svg} +0 -0
- /package/{dist/label-MP75CTIA.svg → components/Sponsors/label.svg} +0 -0
- /package/{dist/medalBronze-CO4CTUR4.svg → components/Sponsors/medalBronze.svg} +0 -0
- /package/{dist/medalGold-UP6A73FL.svg → components/Sponsors/medalGold.svg} +0 -0
- /package/{dist/medalSilver-FAPGGOBN.svg → components/Sponsors/medalSilver.svg} +0 -0
- /package/{dist/Inter-Var-IOAEQULN.ttf → css/Inter-Var.ttf} +0 -0
- /package/{dist/alignable-B4QZV4X7.svg → data/sponsorsList/companyLogos/alignable.svg} +0 -0
- /package/{dist/bluefin-JQABZFGV.svg → data/sponsorsList/companyLogos/bluefin.svg} +0 -0
- /package/{dist/burdaforward-EUGURYZY.png → data/sponsorsList/companyLogos/burdaforward.png} +0 -0
- /package/{dist/contra-WLZBOPBV.svg → data/sponsorsList/companyLogos/contra.svg} +0 -0
- /package/{dist/ecosia-OYRLTR5T.svg → data/sponsorsList/companyLogos/ecosia.svg} +0 -0
- /package/{dist/inlang-GFRWND6X.png → data/sponsorsList/companyLogos/inlang.png} +0 -0
- /package/{dist/optimizers-SFEZF3NW.svg → data/sponsorsList/companyLogos/optimizers.svg} +0 -0
- /package/{dist/sourcegraph-YR2HADLS.svg → data/sponsorsList/companyLogos/sourcegraph.svg} +0 -0
- /package/{dist/changelog-IPI5F42D.svg → icons/changelog.svg} +0 -0
- /package/{dist/discord-JD33TUSF.svg → icons/discord.svg} +0 -0
- /package/{dist/github-P5ZSKN2N.svg → icons/github.svg} +0 -0
- /package/{dist/heart-OINVKOXO.svg → icons/heart.svg} +0 -0
- /package/{dist/languages-KXPKJFQL.svg → icons/languages.svg} +0 -0
- /package/{dist/people-72KKQHU4.svg → icons/people.svg} +0 -0
- /package/{dist/twitter-I7DXDN3J.svg → icons/twitter.svg} +0 -0
- /package/{dist/chevron-K3WPYLOP.svg → navigation/navigation-fullscreen/chevron.svg} +0 -0
- /package/{dist/close-IQXTDOHV.svg → navigation/navigation-fullscreen/close.svg} +0 -0
- /package/{dist/compass-2RWQU3E4.svg → utils/Emoji/compass.svg} +0 -0
- /package/{dist/engine-6Q6VSCVA.png → utils/Emoji/engine.png} +0 -0
- /package/{dist/mechanical-arm-TR7IQQMG.svg → utils/Emoji/mechanical-arm.svg} +0 -0
- /package/{dist/road-fork-3WZLW3HB.svg → utils/Emoji/road-fork.svg} +0 -0
- /package/{dist/shield-CU45RG5C.svg → utils/Emoji/shield.svg} +0 -0
- /package/{dist/typescript-ALIPKLRM.svg → utils/Emoji/typescript.svg} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
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: React.ReactNode
|
|
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: React.ReactNode; rightSide: boolean }) {
|
|
109
|
+
return (
|
|
110
|
+
<aside className={'learn-more ' + (rightSide ? 'right-side' : '')} id={`learn-more-${name}`}>
|
|
111
|
+
{children}
|
|
112
|
+
</aside>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export { HorizontalLine }
|
|
4
|
+
|
|
5
|
+
function HorizontalLine({ primary }: { primary?: true }) {
|
|
6
|
+
return (
|
|
7
|
+
<div className={'header-separator-line ' + (primary ? 'primary' : '')} style={{ textAlign: 'center' }}>
|
|
8
|
+
<hr
|
|
9
|
+
style={{
|
|
10
|
+
display: 'inline-block',
|
|
11
|
+
margin: 0,
|
|
12
|
+
border: 0,
|
|
13
|
+
borderTop: '1px solid #eee',
|
|
14
|
+
maxWidth: 500,
|
|
15
|
+
width: '80%'
|
|
16
|
+
}}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { assert } from '../utils/server'
|
|
3
|
+
|
|
4
|
+
export { ImportMeta }
|
|
5
|
+
|
|
6
|
+
function ImportMeta({ prop }: { prop: string }) {
|
|
7
|
+
assert(!prop.startsWith('import'))
|
|
8
|
+
assert(!prop.startsWith('.'))
|
|
9
|
+
const text = 'imp' + 'ort.meta.' + prop
|
|
10
|
+
return <code>{text}</code>
|
|
11
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export { Link }
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { isRepoLink, RepoLink } from './RepoLink'
|
|
5
|
+
import type { Heading, HeadingDetached } from '../types/Heading'
|
|
6
|
+
import type { PageContextResolved } from '../config/resolvePageContext'
|
|
7
|
+
import { usePageContext } from '../renderer/usePageContext'
|
|
8
|
+
import { assert, assertUsage, determineSectionTitle, determineSectionUrlHash } from '../utils/server'
|
|
9
|
+
import { parseTitle } from '../parseTitle'
|
|
10
|
+
|
|
11
|
+
function Link({
|
|
12
|
+
href,
|
|
13
|
+
text,
|
|
14
|
+
noBreadcrumb,
|
|
15
|
+
doNotInferSectionTitle,
|
|
16
|
+
children
|
|
17
|
+
}: {
|
|
18
|
+
href: string
|
|
19
|
+
text?: string | JSX.Element
|
|
20
|
+
noBreadcrumb?: true
|
|
21
|
+
doNotInferSectionTitle?: true
|
|
22
|
+
children?: React.ReactNode
|
|
23
|
+
}) {
|
|
24
|
+
assertUsage(
|
|
25
|
+
href.startsWith('/') || href.startsWith('#'),
|
|
26
|
+
`<Link href /> prop \`href==='${href}'\` but should start with '/' or '#'`
|
|
27
|
+
)
|
|
28
|
+
assertUsage(!text || !children, 'Cannot use both `text` or `children`')
|
|
29
|
+
|
|
30
|
+
if (isRepoLink(href)) {
|
|
31
|
+
return <RepoLink path={href} text={text} />
|
|
32
|
+
} else {
|
|
33
|
+
const pageContext = usePageContext()
|
|
34
|
+
return (
|
|
35
|
+
<a href={href}>{children || text || getLinkText({ href, noBreadcrumb, pageContext, doNotInferSectionTitle })}</a>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getLinkText({
|
|
41
|
+
href,
|
|
42
|
+
noBreadcrumb,
|
|
43
|
+
pageContext,
|
|
44
|
+
doNotInferSectionTitle
|
|
45
|
+
}: {
|
|
46
|
+
href: string
|
|
47
|
+
noBreadcrumb: true | undefined
|
|
48
|
+
pageContext: PageContextResolved
|
|
49
|
+
doNotInferSectionTitle: true | undefined
|
|
50
|
+
}): string | JSX.Element {
|
|
51
|
+
let urlHash: string | null = null
|
|
52
|
+
let hrefWithoutHash: string = href
|
|
53
|
+
if (href.includes('#')) {
|
|
54
|
+
;[hrefWithoutHash, urlHash] = href.split('#')
|
|
55
|
+
assert(hrefWithoutHash || urlHash)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let heading: Heading | HeadingDetached
|
|
59
|
+
let isLinkOnSamePage: boolean = false
|
|
60
|
+
if (hrefWithoutHash) {
|
|
61
|
+
heading = findHeading(hrefWithoutHash, pageContext)
|
|
62
|
+
if (heading.url === pageContext.urlPathname) {
|
|
63
|
+
isLinkOnSamePage = true
|
|
64
|
+
// heading !== pageContext.activeHeading because activeHeading is a different object holding on-this-page subheadings
|
|
65
|
+
heading = pageContext.activeHeading
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
assert(urlHash)
|
|
69
|
+
isLinkOnSamePage = true
|
|
70
|
+
heading = pageContext.activeHeading
|
|
71
|
+
}
|
|
72
|
+
assert(heading)
|
|
73
|
+
assert(isLinkOnSamePage === (heading.url === pageContext.urlPathname))
|
|
74
|
+
assert(isLinkOnSamePage === (heading.url === pageContext.activeHeading.url))
|
|
75
|
+
assert(isLinkOnSamePage === (heading === pageContext.activeHeading))
|
|
76
|
+
|
|
77
|
+
const breadcrumbParts: (string | JSX.Element)[] = []
|
|
78
|
+
|
|
79
|
+
if (heading.headingsBreadcrumb) {
|
|
80
|
+
breadcrumbParts.push(
|
|
81
|
+
...(heading.headingsBreadcrumb ?? [])
|
|
82
|
+
.slice()
|
|
83
|
+
.reverse()
|
|
84
|
+
.map(({ title }) => title)
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
breadcrumbParts.push(heading.title)
|
|
89
|
+
|
|
90
|
+
if (urlHash) {
|
|
91
|
+
let sectionTitle: string | JSX.Element | undefined = undefined
|
|
92
|
+
assert(!urlHash.startsWith('#'))
|
|
93
|
+
if (isLinkOnSamePage) {
|
|
94
|
+
const pageHeading = findHeading(`#${urlHash}`, pageContext)
|
|
95
|
+
sectionTitle = pageHeading.title
|
|
96
|
+
} else if ('sectionTitles' in heading && heading.sectionTitles) {
|
|
97
|
+
heading.sectionTitles.forEach((title) => {
|
|
98
|
+
if (determineSectionUrlHash(title) === urlHash) {
|
|
99
|
+
sectionTitle = parseTitle(title)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
if (!sectionTitle) {
|
|
104
|
+
assertUsage(
|
|
105
|
+
!doNotInferSectionTitle,
|
|
106
|
+
`Page section title not found for <Link href="\`${href}\`" doNotInferSectionTitle={true} />.`
|
|
107
|
+
)
|
|
108
|
+
sectionTitle = determineSectionTitle(href)
|
|
109
|
+
}
|
|
110
|
+
breadcrumbParts.push(sectionTitle)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
if (noBreadcrumb || isLinkOnSamePage) {
|
|
115
|
+
return breadcrumbParts[breadcrumbParts.length - 1]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<>
|
|
121
|
+
{breadcrumbParts.map((title, i) => {
|
|
122
|
+
const seperator = i === 0 ? <></> : ' > '
|
|
123
|
+
return (
|
|
124
|
+
<React.Fragment key={i}>
|
|
125
|
+
{seperator}
|
|
126
|
+
{title}
|
|
127
|
+
</React.Fragment>
|
|
128
|
+
)
|
|
129
|
+
})}
|
|
130
|
+
</>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function findHeading(href: string, pageContext: PageContextResolved): Heading | HeadingDetached {
|
|
135
|
+
assert(href.startsWith('/') || href.startsWith('#'))
|
|
136
|
+
const { headingsAll } = pageContext
|
|
137
|
+
const heading = headingsAll.find(({ url }) => href === url)
|
|
138
|
+
if (href.startsWith('#')) {
|
|
139
|
+
assertUsage(heading, `Couldn't find ${href} in ${pageContext.urlPathname}, does it exist?`)
|
|
140
|
+
} else {
|
|
141
|
+
assertUsage(heading, `Couldn't find heading for ${href}, did you define the heading for ${href}?`)
|
|
142
|
+
}
|
|
143
|
+
return heading
|
|
144
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
margin-right: 0;
|
|
9
|
+
padding: 4px 16px;
|
|
10
|
+
}
|
|
11
|
+
blockquote.note-color-red {
|
|
12
|
+
--color-strengh-bg: 1.7;
|
|
13
|
+
--color-strengh-border: 6;
|
|
14
|
+
--color: 190, 25, 49;
|
|
15
|
+
}
|
|
16
|
+
blockquote.note-color-yellow {
|
|
17
|
+
--color-strengh-bg: 4;
|
|
18
|
+
--color-strengh-border: 8;
|
|
19
|
+
--color: 255, 204, 50;
|
|
20
|
+
}
|
|
21
|
+
.blockquote-content {
|
|
22
|
+
display: inline;
|
|
23
|
+
}
|
|
24
|
+
blockquote.custom-icon > .blockquote-content > :first-child {
|
|
25
|
+
/* E.g. for <Warning> so that the warning icon is on the same line as the first paragraph.
|
|
26
|
+
* We assume the second element to have a top margin.
|
|
27
|
+
*/
|
|
28
|
+
display: inline;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/************************/
|
|
32
|
+
/*** Icon Positioning ***/
|
|
33
|
+
/************************/
|
|
34
|
+
blockquote.type-construction img[src^="https://twemoji."]
|
|
35
|
+
{
|
|
36
|
+
margin-right: 2px;
|
|
37
|
+
}
|
|
38
|
+
blockquote.type-warning img[src^="https://twemoji."]
|
|
39
|
+
{
|
|
40
|
+
position: relative;
|
|
41
|
+
top: -1px;
|
|
42
|
+
margin-right: 2px;
|
|
43
|
+
}
|
|
44
|
+
blockquote.type-danger img[src^="https://twemoji."]
|
|
45
|
+
{
|
|
46
|
+
margin-right: 2px;
|
|
47
|
+
}
|
|
48
|
+
blockquote > p:first-child::before,
|
|
49
|
+
/* blockquote > p:first-of-type::before, */
|
|
50
|
+
blockquote > div.paragraph:first-child::before {
|
|
51
|
+
font-family: emoji;
|
|
52
|
+
content: 'ℹ️';
|
|
53
|
+
margin-right: 7px;
|
|
54
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export { Warning }
|
|
2
|
+
export { Construction }
|
|
3
|
+
export { Danger }
|
|
4
|
+
export { NoteWithoutIcon }
|
|
5
|
+
export { NoteWithCustomIcon }
|
|
6
|
+
/* Use markdown instead:
|
|
7
|
+
* ```diff
|
|
8
|
+
* - <Note>Some note</Note>
|
|
9
|
+
* + > Some note
|
|
10
|
+
* ```
|
|
11
|
+
export { Note }
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import React from 'react'
|
|
15
|
+
import { assert } from '../utils/assert'
|
|
16
|
+
/* Imorted in /src/css/index.css instead
|
|
17
|
+
import './Note.css'
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function Warning({ children }: { children: React.ReactNode }) {
|
|
21
|
+
return <NoteGeneric type="warning">{children}</NoteGeneric>
|
|
22
|
+
}
|
|
23
|
+
function Construction({ children }: { children: React.ReactNode }) {
|
|
24
|
+
return <NoteGeneric type="construction">{children}</NoteGeneric>
|
|
25
|
+
}
|
|
26
|
+
function Danger({ children }: { children: React.ReactNode }) {
|
|
27
|
+
return <NoteGeneric type="danger">{children}</NoteGeneric>
|
|
28
|
+
}
|
|
29
|
+
function NoteWithoutIcon({ children }: { children: React.ReactNode }) {
|
|
30
|
+
return <NoteGeneric icon={null}>{children}</NoteGeneric>
|
|
31
|
+
}
|
|
32
|
+
type CustomIcon = JSX.Element | string
|
|
33
|
+
function NoteWithCustomIcon({ icon, children }: { children: React.ReactNode; icon: CustomIcon }) {
|
|
34
|
+
if (!icon) throw new Error(`<NoteWithCustomIcon icon={/*...*/}> property 'icon' is \`${icon}\` which is forbidden`)
|
|
35
|
+
return <NoteGeneric icon={icon}>{children}</NoteGeneric>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function NoteGeneric({
|
|
39
|
+
type,
|
|
40
|
+
icon,
|
|
41
|
+
children
|
|
42
|
+
}: {
|
|
43
|
+
icon?: null | CustomIcon
|
|
44
|
+
type?: 'danger' | 'warning' | 'construction'
|
|
45
|
+
children: React.ReactNode
|
|
46
|
+
}) {
|
|
47
|
+
assert(icon === null || icon || type, { icon, type })
|
|
48
|
+
|
|
49
|
+
let className = 'custom-icon'
|
|
50
|
+
if (type) {
|
|
51
|
+
className = `${className} type-${type}`
|
|
52
|
+
}
|
|
53
|
+
if (!icon && type) {
|
|
54
|
+
let classColor = ''
|
|
55
|
+
if (type === 'danger') {
|
|
56
|
+
icon = ':no_entry:'
|
|
57
|
+
classColor = 'note-color-red'
|
|
58
|
+
}
|
|
59
|
+
if (type === 'warning') {
|
|
60
|
+
icon = ':warning:'
|
|
61
|
+
classColor = 'note-color-yellow'
|
|
62
|
+
}
|
|
63
|
+
if (type === 'construction') {
|
|
64
|
+
icon = ':construction:'
|
|
65
|
+
classColor = 'note-color-yellow'
|
|
66
|
+
}
|
|
67
|
+
assert(icon)
|
|
68
|
+
assert(classColor)
|
|
69
|
+
className = `${className} ${classColor}`
|
|
70
|
+
}
|
|
71
|
+
return (
|
|
72
|
+
<blockquote className={className}>
|
|
73
|
+
<div style={{ marginBottom: 20 }} />
|
|
74
|
+
{icon} <div className="blockquote-content">{children}</div>
|
|
75
|
+
<div style={{ marginTop: 20 }} />
|
|
76
|
+
</blockquote>
|
|
77
|
+
)
|
|
78
|
+
}
|
package/components/P.css
ADDED
package/components/P.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Link } from './Link'
|
|
3
|
+
|
|
4
|
+
export { ReadingRecommendation }
|
|
5
|
+
|
|
6
|
+
function ReadingRecommendation({ tour, links }: { tour?: true; links?: string[] }) {
|
|
7
|
+
links ??= []
|
|
8
|
+
if (!links.length) tour = true
|
|
9
|
+
const multiple = links.length + (tour ? 1 : 0) > 1
|
|
10
|
+
const intro = <b>Reading Recommendation{multiple ? '.' : ': '}</b>
|
|
11
|
+
return (
|
|
12
|
+
<blockquote>
|
|
13
|
+
{(() => {
|
|
14
|
+
if (!multiple) {
|
|
15
|
+
const link = tour ? <TourLink /> : <Link href={links[0]} />
|
|
16
|
+
return (
|
|
17
|
+
<p>
|
|
18
|
+
{intro}
|
|
19
|
+
{link}
|
|
20
|
+
</p>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<p> {intro}</p>
|
|
26
|
+
<ul
|
|
27
|
+
style={{
|
|
28
|
+
marginLeft: 18,
|
|
29
|
+
marginTop: 11
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{tour && (
|
|
33
|
+
<li>
|
|
34
|
+
<TourLink />
|
|
35
|
+
</li>
|
|
36
|
+
)}
|
|
37
|
+
{links.map((link, i) => (
|
|
38
|
+
<li key={i}>
|
|
39
|
+
<Link href={link} />
|
|
40
|
+
</li>
|
|
41
|
+
))}
|
|
42
|
+
</ul>
|
|
43
|
+
</>
|
|
44
|
+
)
|
|
45
|
+
})()}
|
|
46
|
+
</blockquote>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function TourLink() {
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<Link href={'/react-tour'} noBreadcrumb={true} /> or <Link href={'/vue-tour'} noBreadcrumb={true} />
|
|
54
|
+
</>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { assert } from '../utils/server'
|
|
3
|
+
import { usePageContext } from '../renderer/usePageContext'
|
|
4
|
+
|
|
5
|
+
export { RepoLink }
|
|
6
|
+
export { isRepoLink }
|
|
7
|
+
|
|
8
|
+
function isRepoLink(href: string) {
|
|
9
|
+
return ['/examples/', '/docs/', '/boilerplates/', '.github/', '/test/'].some((start) => href.startsWith(start))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function RepoLink({ path, text, editMode }: { path: string; text?: string | JSX.Element; editMode?: true }) {
|
|
13
|
+
const pageContext = usePageContext()
|
|
14
|
+
assert(isRepoLink(path), { path })
|
|
15
|
+
text = text || path
|
|
16
|
+
if (!path.startsWith('/')) {
|
|
17
|
+
path = '/' + path
|
|
18
|
+
}
|
|
19
|
+
const viewMode = path.endsWith('/') || editMode ? 'tree' : 'blob'
|
|
20
|
+
const { githubRepository } = pageContext.config.projectInfo
|
|
21
|
+
assert(githubRepository.startsWith('https://github.com/'))
|
|
22
|
+
const href = `${githubRepository}/${viewMode}/main${path}`
|
|
23
|
+
return <a href={href}>{text}</a>
|
|
24
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
6
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
7
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
8
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
12
|
+
width="210mm"
|
|
13
|
+
height="297mm"
|
|
14
|
+
viewBox="0 0 210 297"
|
|
15
|
+
version="1.1"
|
|
16
|
+
id="svg8"
|
|
17
|
+
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
|
18
|
+
sodipodi:docname="label.draft.svg">
|
|
19
|
+
<defs
|
|
20
|
+
id="defs2" />
|
|
21
|
+
<sodipodi:namedview
|
|
22
|
+
id="base"
|
|
23
|
+
pagecolor="#ffffff"
|
|
24
|
+
bordercolor="#666666"
|
|
25
|
+
borderopacity="1.0"
|
|
26
|
+
inkscape:pageopacity="0.0"
|
|
27
|
+
inkscape:pageshadow="2"
|
|
28
|
+
inkscape:zoom="0.9899495"
|
|
29
|
+
inkscape:cx="461.6406"
|
|
30
|
+
inkscape:cy="96.846632"
|
|
31
|
+
inkscape:document-units="mm"
|
|
32
|
+
inkscape:current-layer="layer1"
|
|
33
|
+
showgrid="false"
|
|
34
|
+
inkscape:window-width="1366"
|
|
35
|
+
inkscape:window-height="736"
|
|
36
|
+
inkscape:window-x="0"
|
|
37
|
+
inkscape:window-y="16"
|
|
38
|
+
inkscape:window-maximized="1" />
|
|
39
|
+
<metadata
|
|
40
|
+
id="metadata5">
|
|
41
|
+
<rdf:RDF>
|
|
42
|
+
<cc:Work
|
|
43
|
+
rdf:about="">
|
|
44
|
+
<dc:format>image/svg+xml</dc:format>
|
|
45
|
+
<dc:type
|
|
46
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
47
|
+
<dc:title></dc:title>
|
|
48
|
+
</cc:Work>
|
|
49
|
+
</rdf:RDF>
|
|
50
|
+
</metadata>
|
|
51
|
+
<g
|
|
52
|
+
inkscape:label="Layer 1"
|
|
53
|
+
inkscape:groupmode="layer"
|
|
54
|
+
id="layer1">
|
|
55
|
+
<path
|
|
56
|
+
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
57
|
+
d="m 51.40476,117.83928 13.530744,-23.435929 0.01098,0.0063 v 0"
|
|
58
|
+
id="path815"
|
|
59
|
+
inkscape:connector-curvature="0" />
|
|
60
|
+
<path
|
|
61
|
+
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
62
|
+
d="M 78.309972,119.26576 90.337099,96.280583 h 32.339611"
|
|
63
|
+
id="path817"
|
|
64
|
+
inkscape:connector-curvature="0"
|
|
65
|
+
sodipodi:nodetypes="ccc" />
|
|
66
|
+
<path
|
|
67
|
+
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
68
|
+
d="M 71.815475,146.56548 H 85.96596 c 0.676332,-0.0209 3.30147,-0.005 3.934153,-0.83721 0.426501,-0.36462 1.272256,-1.92024 1.602106,-2.49156 l 4.177131,-7.23501 c 0,0 0.679705,-1.34341 1.817605,-2.11076 0.472523,-0.30451 3.063205,-0.4009 3.063205,-0.4009 h 13.21067"
|
|
69
|
+
id="path819"
|
|
70
|
+
inkscape:connector-curvature="0"
|
|
71
|
+
sodipodi:nodetypes="cccccccc" />
|
|
72
|
+
<path
|
|
73
|
+
sodipodi:nodetypes="cccccccc"
|
|
74
|
+
inkscape:connector-curvature="0"
|
|
75
|
+
id="path859"
|
|
76
|
+
d="m 145.52085,146.56548 h -14.15049 c -0.67633,-0.0209 -3.30147,-0.005 -3.93415,-0.83721 -0.4265,-0.36462 -1.27226,-1.92024 -1.60211,-2.49156 l -4.17713,-7.23501 c 0,0 -0.67971,-1.34341 -1.81761,-2.11076 -0.47252,-0.30451 -3.0632,-0.4009 -3.0632,-0.4009 h -13.21068"
|
|
77
|
+
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
78
|
+
<path
|
|
79
|
+
sodipodi:nodetypes="ccccccccc"
|
|
80
|
+
inkscape:connector-curvature="0"
|
|
81
|
+
id="path967"
|
|
82
|
+
d="m 118.49554,172.57638 -47.05804,0 h 10.748698 c 0.676332,-0.0209 3.30147,-0.005 3.934153,-0.83721 0.426501,-0.36462 1.272256,-1.92024 1.602106,-2.49156 l 4.177131,-7.23501 c 0,0 0.679705,-1.34341 1.817605,-2.11076 0.472523,-0.30451 3.063205,-0.4009 3.063205,-0.4009 l 22.282102,0"
|
|
83
|
+
style="fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
|
84
|
+
<path
|
|
85
|
+
style="fill:#f0f0f0;stroke:none;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
|
|
86
|
+
d="M 365.78516 702.83789 C 365.78516 702.83789 355.99294 703.20261 354.20703 704.35352 C 349.90631 707.25374 347.33789 712.33203 347.33789 712.33203 L 331.54883 739.67578 C 330.30215 741.8351 327.10611 747.71566 325.49414 749.09375 C 323.1029 752.23911 313.18122 752.17882 310.625 752.25781 L 392.14258 752.25781 L 447.85742 752.25781 L 529.375 752.25781 C 526.81879 752.17882 516.89709 752.23911 514.50586 749.09375 C 512.89389 747.71566 509.69785 741.8351 508.45117 739.67578 L 492.66211 712.33203 C 492.66211 712.33203 490.09369 707.25374 485.79297 704.35352 C 484.00707 703.20261 474.2168 702.83789 474.2168 702.83789 L 450 702.83789 L 390 702.83789 L 365.78516 702.83789 z "
|
|
87
|
+
transform="scale(0.26458333)"
|
|
88
|
+
id="path977" />
|
|
89
|
+
<path
|
|
90
|
+
id="path982"
|
|
91
|
+
d="m 96.780656,212.41754 c 0,0 -2.590858,0.0965 -3.06338,0.40101 -1.137899,0.76735 -1.81746,2.11098 -1.81746,2.11098 l -4.177523,7.2347 c -0.32985,0.57132 -1.175469,2.12722 -1.60197,2.49184 -0.632682,0.83221 -3.257793,0.81625 -3.934126,0.83715 h 21.568193 30.61622 21.56819 c -0.67633,-0.0209 -3.30145,-0.005 -3.93413,-0.83715 -0.4265,-0.36462 -1.27212,-1.92052 -1.60197,-2.49184 l -4.17752,-7.2347 c 0,0 -0.67956,-1.34363 -1.81746,-2.11098 -0.47252,-0.30452 -3.06286,-0.40101 -3.06286,-0.40101 h -6.40736 -31.75 z"
|
|
92
|
+
style="fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
93
|
+
inkscape:connector-curvature="0"
|
|
94
|
+
sodipodi:nodetypes="ccccccccccccccccc" />
|
|
95
|
+
<path
|
|
96
|
+
sodipodi:nodetypes="ccccccccccccccccc"
|
|
97
|
+
inkscape:connector-curvature="0"
|
|
98
|
+
style="fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
99
|
+
d="m 96.780656,244.16756 c 0,0 -2.590858,0.0965 -3.06338,0.40101 -1.137899,0.76735 -1.81746,2.11098 -1.81746,2.11098 l -4.177523,7.2347 c -0.32985,0.57132 -1.175469,2.12722 -1.60197,2.49184 -0.632682,0.83221 -3.257793,0.81625 -3.934126,0.83715 h 21.568193 25.32455 21.56819 c -0.67633,-0.0209 -3.30145,-0.005 -3.93413,-0.83715 -0.4265,-0.36462 -1.27212,-1.92052 -1.60197,-2.49184 l -4.17752,-7.2347 c 0,0 -0.67956,-1.34363 -1.81746,-2.11098 -0.47252,-0.30452 -3.06286,-0.40101 -3.06286,-0.40101 h -6.40736 -26.45833 z"
|
|
100
|
+
id="path984" />
|
|
101
|
+
<path
|
|
102
|
+
id="path878"
|
|
103
|
+
d="m 103.72033,265.33423 c 0,0 -2.25707,0.0965 -2.66872,0.40101 -0.9913,0.76735 -1.583315,2.11098 -1.583315,2.11098 l -3.639329,7.2347 c -0.287355,0.57132 -1.024032,2.12722 -1.395586,2.49184 -0.551173,0.83221 -2.838088,0.81625 -3.427289,0.83715 h 18.789539 22.06196 18.78954 c -0.5892,-0.0209 -2.87612,-0.005 -3.42729,-0.83715 -0.37156,-0.36462 -1.10823,-1.92052 -1.39559,-2.49184 l -3.63932,-7.2347 c 0,0 -0.59202,-1.34363 -1.58332,-2.11098 -0.41164,-0.30452 -2.66827,-0.40101 -2.66827,-0.40101 h -5.58189 -23.04968 z"
|
|
104
|
+
style="fill:#f0f0f0;fill-opacity:1;stroke:none;stroke-width:0.24695262px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
|
105
|
+
inkscape:connector-curvature="0"
|
|
106
|
+
sodipodi:nodetypes="ccccccccccccccccc" />
|
|
107
|
+
</g>
|
|
108
|
+
</svg>
|