@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.
- 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-2SRWLPTC.js +9 -0
- package/dist/chunk-2SRWLPTC.js.map +1 -0
- package/dist/chunk-G2A5MZJA.js +48 -0
- package/dist/chunk-G2A5MZJA.js.map +1 -0
- package/dist/chunk-M7LTQJLV.js +178 -0
- package/dist/chunk-M7LTQJLV.js.map +1 -0
- package/dist/chunk-OEVBWUR6.js +92 -0
- package/dist/chunk-OEVBWUR6.js.map +1 -0
- package/dist/chunk-P6M6A4HU.js +154 -0
- package/dist/chunk-P6M6A4HU.js.map +1 -0
- package/dist/chunk-TTLAZ2T2.js +8 -0
- package/dist/chunk-TTLAZ2T2.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +12 -8
- 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/{cli/devServer.js → devServer-TDBL5PHQ.js} +4 -2
- package/dist/devServer-TDBL5PHQ.js.map +1 -0
- 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 +137 -0
- package/dist/index.js +489 -0
- package/dist/index.js.map +1 -0
- 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 +263 -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 +602 -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/dist/vite.config.d.ts +5 -0
- package/dist/vite.config.js +150 -0
- package/dist/vite.config.js.map +1 -0
- package/package.json +20 -26
- package/readme.md +4 -2
- package/cli.mjs +0 -2
- package/dist/cli/chunk-Y3OKG4SS.js +0 -30
- package/dist/cli/configFile.js +0 -6
- package/index.ts +0 -2
- 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/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 -243
- 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 -10
- 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 -201
- package/src/index.ts +0 -3
- package/src/installSectionUrlHashs.ts +0 -50
- 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 -229
- 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 -7
- 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/determineSectionUrlHash.ts +0 -35
- package/src/utils/filter.ts +0 -12
- package/src/utils/index.ts +0 -6
- package/src/utils/isBrowser.ts +0 -5
- package/src/utils/jsxToTextContent.ts +0 -11
- package/src/utils/objectAssign.ts +0 -9
- package/vite.config/markdownHeadings.ts +0 -128
- package/vite.config.ts +0 -42
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import iconGithub from '../icons/github.svg'
|
|
3
|
-
import iconTwitter from '../icons/twitter.svg'
|
|
4
|
-
import iconDiscord from '../icons/discord.svg'
|
|
5
|
-
import iconChangelog from '../icons/changelog.svg'
|
|
6
|
-
import { usePageContext } from '../renderer/usePageContext'
|
|
7
|
-
|
|
8
|
-
export { NavigationHeader }
|
|
9
|
-
|
|
10
|
-
function NavigationHeader() {
|
|
11
|
-
const pageContext = usePageContext()
|
|
12
|
-
return (
|
|
13
|
-
<div
|
|
14
|
-
id="navigation-header"
|
|
15
|
-
style={{
|
|
16
|
-
display: 'flex',
|
|
17
|
-
flexDirection: 'column',
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
marginBottom: -5
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
<a
|
|
23
|
-
id="navigation-header-logo"
|
|
24
|
-
style={{
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
color: 'inherit',
|
|
28
|
-
justifyContent: 'left',
|
|
29
|
-
textDecoration: 'none',
|
|
30
|
-
paddingTop: 12,
|
|
31
|
-
paddingBottom: 7
|
|
32
|
-
}}
|
|
33
|
-
href="/"
|
|
34
|
-
>
|
|
35
|
-
{pageContext.config.navHeader}
|
|
36
|
-
</a>
|
|
37
|
-
<Links />
|
|
38
|
-
</div>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function Links() {
|
|
43
|
-
const pageContext = usePageContext()
|
|
44
|
-
const { projectInfo } = pageContext.config
|
|
45
|
-
return (
|
|
46
|
-
<div
|
|
47
|
-
style={{
|
|
48
|
-
display: 'flex',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
paddingTop: 0,
|
|
51
|
-
justifyContent: 'left'
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
<SocialLink className="decolorize-4" icon={iconGithub} href={projectInfo.githubRepository} />
|
|
55
|
-
<SocialLink className="decolorize-6" icon={iconDiscord} href={projectInfo.discordInvite} />
|
|
56
|
-
<SocialLink className="decolorize-7" icon={iconTwitter} href={projectInfo.twitterProfile} />
|
|
57
|
-
<div id="docsearch-desktop" />
|
|
58
|
-
<ChangelogButton />
|
|
59
|
-
</div>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function ChangelogButton() {
|
|
64
|
-
const pageContext = usePageContext()
|
|
65
|
-
const { projectInfo } = pageContext.config
|
|
66
|
-
return (
|
|
67
|
-
<a
|
|
68
|
-
href={`${projectInfo.githubRepository}/blob/main/CHANGELOG.md`}
|
|
69
|
-
className="button colorize-on-hover"
|
|
70
|
-
style={{
|
|
71
|
-
display: 'flex',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
padding: '1px 7px',
|
|
74
|
-
marginLeft: 2,
|
|
75
|
-
fontSize: '0.97em',
|
|
76
|
-
color: 'inherit'
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<span className="decolorize-7">v{projectInfo.projectVersion}</span>
|
|
80
|
-
<img className="decolorize-6" src={iconChangelog} height={16} style={{ marginLeft: 5 }} />
|
|
81
|
-
</a>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function SocialLink({ className, icon, href }: { className: string; icon: string; href: string }) {
|
|
86
|
-
return (
|
|
87
|
-
<>
|
|
88
|
-
<a
|
|
89
|
-
className={'colorize-on-hover ' + className}
|
|
90
|
-
href={href}
|
|
91
|
-
style={{ padding: 3, display: 'inline-block', lineHeight: 0 }}
|
|
92
|
-
>
|
|
93
|
-
<img src={icon} height="20" style={{}} />
|
|
94
|
-
</a>
|
|
95
|
-
</>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--navigation-fullscreen-button-width: 20px;
|
|
3
|
-
}
|
|
4
|
-
#navigation-fullscreen-button {
|
|
5
|
-
width: var(--navigation-fullscreen-button-width);
|
|
6
|
-
position: relative;
|
|
7
|
-
z-index: 2;
|
|
8
|
-
}
|
|
9
|
-
#navigation-wrapper:hover + #navigation-fullscreen-button > div > div,
|
|
10
|
-
#navigation-fullscreen-button:hover > div > div {
|
|
11
|
-
left: 0px;
|
|
12
|
-
}
|
|
13
|
-
#navigation-fullscreen-button > div > div {
|
|
14
|
-
transition: all 0.3s ease-in-out;
|
|
15
|
-
left: -20px;
|
|
16
|
-
position: absolute;
|
|
17
|
-
height: 100%;
|
|
18
|
-
width: 100%;
|
|
19
|
-
background-color: #eee !important;
|
|
20
|
-
background: url('./chevron.svg');
|
|
21
|
-
background-repeat: no-repeat;
|
|
22
|
-
background-position: center center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
html:not(.navigation-fullscreen) #navigation-fullscreen-close {
|
|
26
|
-
display: none;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
html.navigation-fullscreen #page-content {
|
|
30
|
-
/* Make `Ctrl-F` browser search only crawl the navigation menu */
|
|
31
|
-
visibility: hidden;
|
|
32
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export { NavigationFullscreenButton }
|
|
2
|
-
export { NavigationFullscreenClose }
|
|
3
|
-
|
|
4
|
-
import React from 'react'
|
|
5
|
-
import './NavigationFullscreenButton.css'
|
|
6
|
-
import closeIcon from './close.svg'
|
|
7
|
-
|
|
8
|
-
function NavigationFullscreenButton() {
|
|
9
|
-
return (
|
|
10
|
-
<>
|
|
11
|
-
<a id="navigation-fullscreen-button">
|
|
12
|
-
<div
|
|
13
|
-
style={{
|
|
14
|
-
position: 'fixed',
|
|
15
|
-
cursor: 'pointer',
|
|
16
|
-
height: '100vh',
|
|
17
|
-
width: 20,
|
|
18
|
-
overflow: 'hidden'
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<div></div>
|
|
22
|
-
</div>
|
|
23
|
-
<div
|
|
24
|
-
style={{ position: 'fixed', height: '100vh', width: 20 }}
|
|
25
|
-
aria-label="Press <Esc>"
|
|
26
|
-
data-balloon-pos="right"
|
|
27
|
-
></div>
|
|
28
|
-
</a>
|
|
29
|
-
</>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function NavigationFullscreenClose() {
|
|
34
|
-
return (
|
|
35
|
-
<a
|
|
36
|
-
id="navigation-fullscreen-close"
|
|
37
|
-
style={{ position: 'fixed', top: 11, right: 15, zIndex: 10 }}
|
|
38
|
-
aria-label="Press <Esc>"
|
|
39
|
-
data-balloon-pos="left"
|
|
40
|
-
>
|
|
41
|
-
<img src={closeIcon} height={50} width={50} style={{ display: 'block' }} />
|
|
42
|
-
</a>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
export { initNavigationFullscreen }
|
|
2
|
-
|
|
3
|
-
import { assert } from '../../utils'
|
|
4
|
-
|
|
5
|
-
let scrollPositionBeforeToggle: number = 0
|
|
6
|
-
|
|
7
|
-
function initNavigationFullscreen() {
|
|
8
|
-
updateColumnWidth()
|
|
9
|
-
window.addEventListener('resize', updateColumnWidth, { passive: true })
|
|
10
|
-
document.getElementById('navigation-fullscreen-button')!.onclick = toggleNavExpend
|
|
11
|
-
document.getElementById('navigation-fullscreen-close')!.onclick = toggleNavExpend
|
|
12
|
-
document.addEventListener(
|
|
13
|
-
// We don't use keydown to not interfere with user pressing `<Esc>` for closing the browser's `<Ctrl-F>` search diablog, see https://stackoverflow.com/questions/66595035/how-to-detect-escape-key-if-search-bar-of-browser-is-open
|
|
14
|
-
'keydown',
|
|
15
|
-
(ev) => {
|
|
16
|
-
if (ev.key === 'Escape') toggleNavExpend()
|
|
17
|
-
},
|
|
18
|
-
false
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function toggleNavExpend() {
|
|
23
|
-
const navContainer = document.getElementById('navigation-container')!
|
|
24
|
-
const scrollPos = navContainer.scrollTop
|
|
25
|
-
document.documentElement.classList.toggle('navigation-fullscreen')
|
|
26
|
-
if (scrollPositionBeforeToggle !== undefined) {
|
|
27
|
-
navContainer.scrollTop = scrollPositionBeforeToggle
|
|
28
|
-
}
|
|
29
|
-
scrollPositionBeforeToggle = scrollPos
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function updateColumnWidth() {
|
|
33
|
-
const navMinWidth = 299
|
|
34
|
-
const navH1Groups = Array.from(document.querySelectorAll('.nav-h1-group'))
|
|
35
|
-
const numberOfColumnsMax = navH1Groups.length
|
|
36
|
-
|
|
37
|
-
const widthAvailable = getViewportWidth()
|
|
38
|
-
const numberOfColumns = Math.max(1, Math.min(numberOfColumnsMax, Math.floor(widthAvailable / navMinWidth)))
|
|
39
|
-
|
|
40
|
-
let columns = navH1Groups.map((navH1Group) => {
|
|
41
|
-
const column = [
|
|
42
|
-
{
|
|
43
|
-
element: navH1Group,
|
|
44
|
-
elementHeight: navH1Group.children.length
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
return column
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
mergeColumns(columns, numberOfColumns)
|
|
51
|
-
|
|
52
|
-
const navContent = document.getElementById('navigation-content')!
|
|
53
|
-
|
|
54
|
-
Array.from(navContent.children).forEach((child) => {
|
|
55
|
-
assert(child.className === 'nav-column')
|
|
56
|
-
})
|
|
57
|
-
navContent.innerHTML = ''
|
|
58
|
-
|
|
59
|
-
columns.forEach((column) => {
|
|
60
|
-
const columnEl = document.createElement('div')
|
|
61
|
-
columnEl.className = 'nav-column'
|
|
62
|
-
column.forEach(({ element }) => {
|
|
63
|
-
columnEl.appendChild(element)
|
|
64
|
-
})
|
|
65
|
-
navContent.appendChild(columnEl)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
const navItemMaxWidth = 350
|
|
69
|
-
navContent.style.maxWidth = `${numberOfColumns * navItemMaxWidth}px`
|
|
70
|
-
}
|
|
71
|
-
function getViewportWidth(): number {
|
|
72
|
-
// `window.innerWidth` inlcudes scrollbar width: https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
73
|
-
return document.documentElement.clientWidth
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function mergeColumns<T>(columns: { element: T; elementHeight: number }[][], maxNumberOfColumns: number) {
|
|
77
|
-
assert(columns.length > 0)
|
|
78
|
-
assert(maxNumberOfColumns > 0)
|
|
79
|
-
if (columns.length <= maxNumberOfColumns) {
|
|
80
|
-
return columns
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let mergeCandidate = {
|
|
84
|
-
i: -1,
|
|
85
|
-
mergeHeight: Infinity
|
|
86
|
-
}
|
|
87
|
-
for (let i = 0; i <= columns.length - 2; i++) {
|
|
88
|
-
const column1 = columns[i + 0]
|
|
89
|
-
const column2 = columns[i + 1]
|
|
90
|
-
const column1Height = sum(column1.map((c) => c.elementHeight))
|
|
91
|
-
const column2Height = sum(column2.map((c) => c.elementHeight))
|
|
92
|
-
const mergeHeight = column1Height + column2Height
|
|
93
|
-
if (mergeCandidate.mergeHeight > mergeHeight) {
|
|
94
|
-
mergeCandidate = {
|
|
95
|
-
i,
|
|
96
|
-
mergeHeight
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
const { i } = mergeCandidate
|
|
103
|
-
assert(-1 < i && i < columns.length - 1, { i, columnsLength: columns.length, maxNumberOfColumns })
|
|
104
|
-
columns[i] = [...columns[i], ...columns[i + 1]]
|
|
105
|
-
columns.splice(i + 1, 1)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
mergeColumns(columns, maxNumberOfColumns)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function sum(arr: number[]): number {
|
|
112
|
-
let total = 0
|
|
113
|
-
arr.forEach((n) => (total += n))
|
|
114
|
-
return total
|
|
115
|
-
}
|
package/src/parseEmojis.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export { parseEmojis }
|
|
2
|
-
|
|
3
|
-
import twemoji from 'twemoji'
|
|
4
|
-
|
|
5
|
-
const emojiList = {
|
|
6
|
-
// https://emojipedia.org/no-entry/
|
|
7
|
-
':no_entry:': 0x26d4,
|
|
8
|
-
// https://emojipedia.org/warning/
|
|
9
|
-
':warning:': 0x26a0,
|
|
10
|
-
// https://emojipedia.org/trophy/
|
|
11
|
-
':trophy:': 0x1f3c6
|
|
12
|
-
/*
|
|
13
|
-
// https://emojipedia.org/red-heart/
|
|
14
|
-
':heart:': 0x2764,
|
|
15
|
-
*/
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function parseEmojis(html: string) {
|
|
19
|
-
Object.entries(emojiList).forEach(([shortcode, codepoint]) => {
|
|
20
|
-
if (!html.includes(shortcode)) {
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
const emojiStr = twemoji.convert.fromCodePoint(codepoint)
|
|
24
|
-
let emojiImg: any = twemoji.parse(emojiStr, {
|
|
25
|
-
folder: 'svg',
|
|
26
|
-
ext: '.svg'
|
|
27
|
-
})
|
|
28
|
-
const style = 'height: 1.275em; width: 1.275em; vertical-align: -20%'
|
|
29
|
-
emojiImg = emojiImg.replace('<img class="emoji" ', `<img style="${style}" `)
|
|
30
|
-
html = html.split(shortcode).join(emojiImg)
|
|
31
|
-
})
|
|
32
|
-
return html
|
|
33
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import ReactDOMServer from 'react-dom/server'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { escapeInject, dangerouslySkipEscape } from 'vite-plugin-ssr'
|
|
4
|
-
import { PageLayout } from '../PageLayout'
|
|
5
|
-
import { resolvePageContext, PageContextOriginal } from '../config/resolvePageContext'
|
|
6
|
-
import { getDocSearchJS, getDocSearchCSS } from '../algolia/DocSearch'
|
|
7
|
-
import { parseEmojis } from '../parseEmojis'
|
|
8
|
-
import { assert } from '../utils'
|
|
9
|
-
|
|
10
|
-
export { render }
|
|
11
|
-
|
|
12
|
-
async function render(pageContextOriginal: PageContextOriginal) {
|
|
13
|
-
const { Page } = pageContextOriginal
|
|
14
|
-
const pageContextResolved = resolvePageContext(pageContextOriginal)
|
|
15
|
-
|
|
16
|
-
const page = (
|
|
17
|
-
<PageLayout pageContext={pageContextResolved}>
|
|
18
|
-
<Page />
|
|
19
|
-
</PageLayout>
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
const descriptionTag = pageContextResolved.isLandingPage
|
|
23
|
-
? dangerouslySkipEscape(`<meta name="description" content="${pageContextResolved.meta.tagline}" />`)
|
|
24
|
-
: ''
|
|
25
|
-
|
|
26
|
-
const docSearchJS = getDocSearchJS(pageContextResolved)
|
|
27
|
-
const docSearchCSS = getDocSearchCSS(pageContextResolved)
|
|
28
|
-
|
|
29
|
-
let pageHtml = ReactDOMServer.renderToString(page)
|
|
30
|
-
pageHtml = parseEmojis(pageHtml)
|
|
31
|
-
|
|
32
|
-
return escapeInject`<!DOCTYPE html>
|
|
33
|
-
<html>
|
|
34
|
-
<head>
|
|
35
|
-
<meta charset="UTF-8" />
|
|
36
|
-
<link rel="icon" href="${pageContextResolved.meta.faviconUrl}" />
|
|
37
|
-
<title>${pageContextResolved.meta.title}</title>
|
|
38
|
-
${descriptionTag}
|
|
39
|
-
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
|
|
40
|
-
${docSearchCSS}
|
|
41
|
-
${getOpenGraphTags(pageContextOriginal.urlPathname, pageContextResolved.meta)}
|
|
42
|
-
</head>
|
|
43
|
-
<body>
|
|
44
|
-
<div id="page-view">${dangerouslySkipEscape(pageHtml)}</div>
|
|
45
|
-
${docSearchJS}
|
|
46
|
-
</body>
|
|
47
|
-
</html>`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function getOpenGraphTags(
|
|
51
|
-
url: string,
|
|
52
|
-
meta: { title: string; tagline: string; websiteUrl: string; twitterHandle: string; bannerUrl?: string }
|
|
53
|
-
) {
|
|
54
|
-
const { title, tagline, websiteUrl, twitterHandle, bannerUrl } = meta
|
|
55
|
-
|
|
56
|
-
assert(url.startsWith('/'))
|
|
57
|
-
if (url !== '/' || !bannerUrl) return ''
|
|
58
|
-
|
|
59
|
-
// See view-source:https://vitejs.dev/
|
|
60
|
-
return escapeInject`
|
|
61
|
-
<meta property="og:type" content="website">
|
|
62
|
-
<meta property="og:title" content="${title}">
|
|
63
|
-
<meta property="og:image" content="${bannerUrl}">
|
|
64
|
-
<meta property="og:url" content="${websiteUrl}">
|
|
65
|
-
<meta property="og:description" content="${tagline}">
|
|
66
|
-
<meta name="twitter:card" content="summary_large_image">
|
|
67
|
-
<meta name="twitter:site" content="${twitterHandle}">
|
|
68
|
-
`
|
|
69
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// `usePageContext` allows us to access `pageContext` in any React component.
|
|
2
|
-
// More infos: https://vite-plugin-ssr.com/pageContext-anywhere
|
|
3
|
-
|
|
4
|
-
import React, { useContext } from 'react'
|
|
5
|
-
import type { PageContextResolved } from '../config/resolvePageContext'
|
|
6
|
-
|
|
7
|
-
export { PageContextProvider }
|
|
8
|
-
export { usePageContext }
|
|
9
|
-
|
|
10
|
-
const Context = React.createContext<PageContextResolved>(undefined as any)
|
|
11
|
-
|
|
12
|
-
function PageContextProvider({
|
|
13
|
-
pageContext,
|
|
14
|
-
children
|
|
15
|
-
}: {
|
|
16
|
-
pageContext: PageContextResolved
|
|
17
|
-
children: React.ReactNode
|
|
18
|
-
}) {
|
|
19
|
-
return <Context.Provider value={pageContext}>{children}</Context.Provider>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function usePageContext() {
|
|
23
|
-
const pageContext = useContext(Context)
|
|
24
|
-
return pageContext
|
|
25
|
-
}
|
package/src/types.ts
DELETED
package/src/utils/Emoji/Emoji.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { assert } from '../assert'
|
|
3
|
-
|
|
4
|
-
import { iconMechanicalArm, iconCompass, iconRoadFork, iconShield, iconTypescript, iconEngine } from './assets'
|
|
5
|
-
|
|
6
|
-
export { Emoji }
|
|
7
|
-
export type { EmojiName }
|
|
8
|
-
|
|
9
|
-
type EmojiName =
|
|
10
|
-
| 'warning'
|
|
11
|
-
| 'typescript'
|
|
12
|
-
| 'shield'
|
|
13
|
-
| 'mechanical-arm'
|
|
14
|
-
| 'mountain'
|
|
15
|
-
| 'rocket'
|
|
16
|
-
| 'wrench'
|
|
17
|
-
| 'compass'
|
|
18
|
-
| 'seedling'
|
|
19
|
-
| 'books'
|
|
20
|
-
| 'plug'
|
|
21
|
-
| 'earth'
|
|
22
|
-
| 'gear'
|
|
23
|
-
| 'red-heart'
|
|
24
|
-
| 'high-voltage'
|
|
25
|
-
| 'gem-stone'
|
|
26
|
-
| 'dizzy'
|
|
27
|
-
| 'sparkles'
|
|
28
|
-
| 'writing-hang'
|
|
29
|
-
| 'road-fork'
|
|
30
|
-
| 'engine'
|
|
31
|
-
| 'red-circle'
|
|
32
|
-
| 'sparkling-heart'
|
|
33
|
-
| 'gift'
|
|
34
|
-
| 'package'
|
|
35
|
-
| 'info'
|
|
36
|
-
| 'lab'
|
|
37
|
-
| 'trophy'
|
|
38
|
-
|
|
39
|
-
function Emoji({ name, style }: { name: EmojiName; style?: React.CSSProperties }): JSX.Element {
|
|
40
|
-
const emoji =
|
|
41
|
-
// ***
|
|
42
|
-
// U+26A0
|
|
43
|
-
// https://emojipedia.org/warning/
|
|
44
|
-
// https://www.unicompat.com/26A0 => 94.1%
|
|
45
|
-
// https://www.unicompat.com/26A0-FE0F => 92.4%
|
|
46
|
-
// https://www.unicompat.com/2697 => 94.1%
|
|
47
|
-
(name === 'warning' && Unicode(0x26a0, { fontFamily: 'emoji' })) ||
|
|
48
|
-
// ***
|
|
49
|
-
// U+2697
|
|
50
|
-
// https://emojipedia.org/alembic/
|
|
51
|
-
// https://www.unicompat.com/2697 => 94.1%
|
|
52
|
-
(name === 'lab' && Unicode(0x2697)) ||
|
|
53
|
-
// ***
|
|
54
|
-
// U+2139
|
|
55
|
-
// https://emojipedia.org/information/
|
|
56
|
-
// https://www.unicompat.com/2139 => 94.8%
|
|
57
|
-
// https://www.unicompat.com/2139-FE0F => 92.4%
|
|
58
|
-
(name === 'info' && Unicode(0x2139, { fontFamily: 'emoji' })) ||
|
|
59
|
-
// ***
|
|
60
|
-
// U+1F4E6
|
|
61
|
-
// https://emojipedia.org/package/
|
|
62
|
-
// https://www.unicompat.com/1F4E6 => 94.1%
|
|
63
|
-
(name === 'package' && Unicode(0x1f4e6)) ||
|
|
64
|
-
// ***
|
|
65
|
-
// U+1F381
|
|
66
|
-
// https://emojipedia.org/wrapped-gift/
|
|
67
|
-
// https://www.unicompat.com/1F381 => 94.1%
|
|
68
|
-
(name === 'gift' && Unicode(0x1f381)) ||
|
|
69
|
-
// ***
|
|
70
|
-
// U+1F496
|
|
71
|
-
// https://emojipedia.org/sparkling-heart/
|
|
72
|
-
// https://www.unicompat.com/1F496 => 94.1%
|
|
73
|
-
(name === 'sparkling-heart' && Unicode(0x1f496)) ||
|
|
74
|
-
// ***
|
|
75
|
-
// U+2B55
|
|
76
|
-
// https://emojipedia.org/hollow-red-circle/
|
|
77
|
-
// https://www.unicompat.com/2B55 => 94.1%
|
|
78
|
-
(name === 'red-circle' && Unicode(0x2b55)) ||
|
|
79
|
-
// ***
|
|
80
|
-
(name === 'engine' && Img(iconEngine)) ||
|
|
81
|
-
// ***
|
|
82
|
-
// https://www.typescriptlang.org/branding/
|
|
83
|
-
(name === 'typescript' && Img(iconTypescript)) ||
|
|
84
|
-
// ***
|
|
85
|
-
// U+FE0F
|
|
86
|
-
// https://emojipedia.org/shield/
|
|
87
|
-
// https://www.unicompat.com/FE0F => 46.5%
|
|
88
|
-
// https://icon-sets.iconify.design/noto/shield/
|
|
89
|
-
(name === 'shield' && Img(iconShield)) ||
|
|
90
|
-
// ***
|
|
91
|
-
// Custom
|
|
92
|
-
(name === 'road-fork' && Img(iconRoadFork, '1.4em')) ||
|
|
93
|
-
// ***
|
|
94
|
-
// U+270D
|
|
95
|
-
// https://emojipedia.org/writing-hand/
|
|
96
|
-
// https://www.unicompat.com/270D => 93.8%
|
|
97
|
-
(name === 'writing-hang' && Unicode(0x270d)) ||
|
|
98
|
-
// ***
|
|
99
|
-
// U+1F4AB
|
|
100
|
-
// https://emojipedia.org/dizzy/
|
|
101
|
-
// https://www.unicompat.com/1F4AB => 94.1%
|
|
102
|
-
(name === 'dizzy' && Unicode(0x1f4ab)) ||
|
|
103
|
-
// ***
|
|
104
|
-
// U+1F9BE
|
|
105
|
-
// https://iconify.design/icon-sets/noto/mechanical-arm.html
|
|
106
|
-
// https://emojipedia.org/mechanical-arm/
|
|
107
|
-
// https://www.unicompat.com/1f9be => 65.5%
|
|
108
|
-
(name === 'mechanical-arm' && Img(iconMechanicalArm)) ||
|
|
109
|
-
// ***
|
|
110
|
-
// U+1F680
|
|
111
|
-
// https://www.unicompat.com/1F680 => 94.1
|
|
112
|
-
(name === 'rocket' && Unicode(0x1f680)) ||
|
|
113
|
-
// ***
|
|
114
|
-
// U+1F527
|
|
115
|
-
// https://emojipedia.org/wrench/
|
|
116
|
-
// https://www.unicompat.com/1F527 => 94.1%
|
|
117
|
-
(name === 'wrench' && Unicode(0x1f527)) ||
|
|
118
|
-
// ***
|
|
119
|
-
// U+1F9ED
|
|
120
|
-
// https://iconify.design/icon-sets/noto/compass.html
|
|
121
|
-
// https://www.unicompat.com/1F9ED => 67.1%
|
|
122
|
-
(name === 'compass' && Img(iconCompass, '1.4em')) ||
|
|
123
|
-
// ***
|
|
124
|
-
// U+1F331
|
|
125
|
-
// https://www.unicompat.com/1F331 => 94.1%
|
|
126
|
-
(name === 'seedling' && Unicode(0x1f331)) ||
|
|
127
|
-
// ***
|
|
128
|
-
// U+1F4DA
|
|
129
|
-
// https://www.unicompat.com/1F4DA => 94.1%
|
|
130
|
-
(name === 'books' && Unicode(0x1f4da)) ||
|
|
131
|
-
// ***
|
|
132
|
-
// U+1F50C
|
|
133
|
-
// https://www.unicompat.com/1F50C => 94.1%
|
|
134
|
-
(name === 'plug' && Unicode(0x1f50c)) ||
|
|
135
|
-
// ***
|
|
136
|
-
// U+1F30D
|
|
137
|
-
// https://www.unicompat.com/1F30D => 88.8%
|
|
138
|
-
(name === 'earth' && Unicode(0x1f30d)) ||
|
|
139
|
-
// ***
|
|
140
|
-
// U+2699
|
|
141
|
-
// https://www.unicompat.com/2699 => 94.1%
|
|
142
|
-
(name === 'gear' && Unicode(0x2699)) ||
|
|
143
|
-
// ***
|
|
144
|
-
// U+2764
|
|
145
|
-
// https://emojipedia.org/red-heart/
|
|
146
|
-
// https://www.unicompat.com/2764 => 94.4%
|
|
147
|
-
// https://www.unicompat.com/2764-FE0F => 92.4%
|
|
148
|
-
(name === 'red-heart' && Unicode(0x2764, { fontFamily: 'emoji' })) ||
|
|
149
|
-
// U+26A1
|
|
150
|
-
// https://www.unicompat.com/26A1 => 94.1%
|
|
151
|
-
(name === 'high-voltage' && Unicode(0x26a1)) ||
|
|
152
|
-
// U+2728
|
|
153
|
-
// https://emojipedia.org/sparkles/
|
|
154
|
-
// https://www.unicompat.com/2728 => 94.1%
|
|
155
|
-
(name === 'sparkles' && Unicode(0x2728)) ||
|
|
156
|
-
// ***
|
|
157
|
-
// U+1F48E
|
|
158
|
-
// https://emojipedia.org/gem-stone/
|
|
159
|
-
// https://www.unicompat.com/1F48E => 94.1%
|
|
160
|
-
(name === 'gem-stone' && Unicode(0x1f48e)) ||
|
|
161
|
-
// ***
|
|
162
|
-
// 0x1F3C6
|
|
163
|
-
// https://emojipedia.org/trophy/
|
|
164
|
-
// https://www.unicompat.com/1F3C6 => 94.1%
|
|
165
|
-
(name === 'trophy' && Unicode(0x1f3c6)) ||
|
|
166
|
-
false
|
|
167
|
-
/* ======= Unused ========
|
|
168
|
-
// ***
|
|
169
|
-
// U+1FAA8
|
|
170
|
-
// https://emojipedia.org/rock/
|
|
171
|
-
// https://www.unicompat.com/1faa8 => 20.7%
|
|
172
|
-
//
|
|
173
|
-
// ***
|
|
174
|
-
// U+26F0
|
|
175
|
-
// https://emojipedia.org/mountain/
|
|
176
|
-
// https://iconify.design/icon-sets/noto/mountain.html
|
|
177
|
-
// https://www.unicompat.com/26F0 => 89.3%
|
|
178
|
-
(name === 'mountain' && Img(iconMountain)) ||
|
|
179
|
-
//
|
|
180
|
-
// ***
|
|
181
|
-
// U+2194
|
|
182
|
-
// https://emojipedia.org/left-right-arrow/
|
|
183
|
-
// https://www.unicompat.com/2194 => 95.0%
|
|
184
|
-
// Couldn't manage to show colored version
|
|
185
|
-
(name === 'left-right-arrow' && Unicode(0x2194)) ||
|
|
186
|
-
(name === 'left-right-arrow' && Unicode(0x2194, { fontFamily: 'reset' })) ||
|
|
187
|
-
(name === 'left-right-arrow' && Unicode(0xFE0F)) ||
|
|
188
|
-
(name === 'left-right-arrow' && Unicode(0xFE0F, { fontFamily: 'reset' })) ||
|
|
189
|
-
======================== */
|
|
190
|
-
|
|
191
|
-
assert(emoji, { name })
|
|
192
|
-
|
|
193
|
-
return emoji
|
|
194
|
-
|
|
195
|
-
function Unicode(codePoint: number, styleAddendum?: React.CSSProperties) {
|
|
196
|
-
const text = String.fromCodePoint(codePoint)
|
|
197
|
-
if (style || styleAddendum) {
|
|
198
|
-
return React.createElement('span', { style: { ...style, ...styleAddendum } }, text)
|
|
199
|
-
} else {
|
|
200
|
-
return React.createElement(React.Fragment, null, text)
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function Img(imgSrc: string, width: string = '1.15em') {
|
|
205
|
-
const props = {
|
|
206
|
-
src: imgSrc,
|
|
207
|
-
style: {
|
|
208
|
-
verticalAlign: 'text-top',
|
|
209
|
-
fontSize: '1em',
|
|
210
|
-
width,
|
|
211
|
-
...style
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return React.createElement('img', props)
|
|
215
|
-
}
|
|
216
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import iconMechanicalArm from './mechanical-arm.svg'
|
|
2
|
-
//import iconMountain from './mountain.svg'
|
|
3
|
-
import iconCompass from './compass.svg'
|
|
4
|
-
import iconRoadFork from './road-fork.svg'
|
|
5
|
-
import iconShield from './shield.svg'
|
|
6
|
-
import iconTypescript from './typescript.svg'
|
|
7
|
-
import iconEngine from './engine.png'
|
|
8
|
-
|
|
9
|
-
export { iconMechanicalArm, iconCompass, iconRoadFork, iconShield, iconTypescript, iconEngine }
|
package/src/utils/Emoji/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Emoji'
|