@brillout/docpress 0.5.39 → 0.5.40-commit-51be4fa
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/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/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/{dist/components → components}/features/FeatureList.css +10 -2
- package/components/features/FeatureList.tsx +114 -0
- package/components/features/initFeatureList.ts +66 -0
- package/components/index.ts +15 -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/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 +26 -48
- 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.json +15 -0
- package/tsconfig.vite-config.json +7 -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 -225
- package/dist/index.js +0 -948
- 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/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/chevron-R2IYJD62.svg → components/features/chevron.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,25 @@
|
|
|
1
|
+
// `usePageContext` allows us to access `pageContext` in any React component.
|
|
2
|
+
// More infos: https://vike.dev/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(): PageContextResolved {
|
|
23
|
+
const pageContext = useContext(Context)
|
|
24
|
+
return pageContext
|
|
25
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react",
|
|
4
|
+
"module": "ES2020",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
7
|
+
"types": ["vite/client"],
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"declaration": true,
|
|
12
|
+
// "noUncheckedIndexedAccess": true,
|
|
13
|
+
"strict": true
|
|
14
|
+
}
|
|
15
|
+
}
|
package/types/Config.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type { Config }
|
|
2
|
+
|
|
3
|
+
import type { HeadingDefinition, HeadingDetachedDefinition } from './Heading'
|
|
4
|
+
|
|
5
|
+
type Config = {
|
|
6
|
+
projectInfo: {
|
|
7
|
+
githubRepository: string
|
|
8
|
+
githubIssues: string
|
|
9
|
+
githubDiscussions?: string
|
|
10
|
+
projectName: string
|
|
11
|
+
projectVersion: string
|
|
12
|
+
discordInvite: string
|
|
13
|
+
twitterProfile: string
|
|
14
|
+
}
|
|
15
|
+
faviconUrl: string
|
|
16
|
+
algolia:
|
|
17
|
+
| null
|
|
18
|
+
| ({
|
|
19
|
+
PENDING_APPROVAL?: true
|
|
20
|
+
} & (
|
|
21
|
+
| {
|
|
22
|
+
appId?: undefined
|
|
23
|
+
apiKey?: undefined
|
|
24
|
+
indexName?: undefined
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
appId: string
|
|
28
|
+
apiKey: string
|
|
29
|
+
indexName: string
|
|
30
|
+
}
|
|
31
|
+
))
|
|
32
|
+
headings: HeadingDefinition[]
|
|
33
|
+
headingsDetached: HeadingDetachedDefinition[]
|
|
34
|
+
navHeaderMobile: React.ReactNode
|
|
35
|
+
navHeaderMobileWrapperStyle?: React.CSSProperties
|
|
36
|
+
navHeader: React.ReactNode
|
|
37
|
+
navHeaderWrapperStyle?: React.CSSProperties
|
|
38
|
+
tagline: string
|
|
39
|
+
websiteUrl: string
|
|
40
|
+
bannerUrl?: string
|
|
41
|
+
twitterHandle: string
|
|
42
|
+
globalNote?: React.ReactNode
|
|
43
|
+
i18n?: true
|
|
44
|
+
pressKit?: true
|
|
45
|
+
sponsorGithubAccount?: string
|
|
46
|
+
}
|
package/types/Heading.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export { Heading }
|
|
2
|
+
export { HeadingDetached }
|
|
3
|
+
export { HeadingDetachedDefinition }
|
|
4
|
+
export { HeadingDefinition }
|
|
5
|
+
|
|
6
|
+
import type { EmojiName } from '../utils/server'
|
|
7
|
+
|
|
8
|
+
type Heading = Omit<HeadingDefinition, 'title' | 'titleInNav'> & {
|
|
9
|
+
title: JSX.Element
|
|
10
|
+
titleInNav: JSX.Element
|
|
11
|
+
headingsBreadcrumb: (Heading | HeadingDetached)[]
|
|
12
|
+
sectionTitles?: string[]
|
|
13
|
+
}
|
|
14
|
+
type HeadingDetached = Omit<Heading, 'level' | 'headingsBreadcrumb'> & {
|
|
15
|
+
level: 2
|
|
16
|
+
headingsBreadcrumb: null
|
|
17
|
+
}
|
|
18
|
+
type HeadingDetachedDefinition = {
|
|
19
|
+
url: string
|
|
20
|
+
title: string | JSX.Element
|
|
21
|
+
sectionTitles?: string[]
|
|
22
|
+
}
|
|
23
|
+
type HeadingDefinition = HeadingBase &
|
|
24
|
+
(
|
|
25
|
+
| ({ level: 1; titleEmoji: EmojiName } & HeadingAbstract)
|
|
26
|
+
| ({ level: 4 } & HeadingAbstract)
|
|
27
|
+
| {
|
|
28
|
+
level: 2
|
|
29
|
+
sectionTitles?: string[]
|
|
30
|
+
url: null | string
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
level: 3
|
|
34
|
+
url: null | string
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
type HeadingBase = {
|
|
38
|
+
title: string
|
|
39
|
+
level: number
|
|
40
|
+
url?: null | string
|
|
41
|
+
titleDocument?: string
|
|
42
|
+
titleInNav?: string
|
|
43
|
+
// titleSize?: string
|
|
44
|
+
}
|
|
45
|
+
type HeadingAbstract = {
|
|
46
|
+
url?: undefined
|
|
47
|
+
titleDocument?: undefined
|
|
48
|
+
titleInNav?: undefined
|
|
49
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
| 'ribbon'
|
|
39
|
+
|
|
40
|
+
function Emoji({ name, style }: { name: EmojiName; style?: React.CSSProperties }): JSX.Element {
|
|
41
|
+
const emoji =
|
|
42
|
+
// ***
|
|
43
|
+
// U+26A0
|
|
44
|
+
// https://emojipedia.org/warning/
|
|
45
|
+
// https://www.unicompat.com/26A0 => 94.1%
|
|
46
|
+
// https://www.unicompat.com/26A0-FE0F => 92.4%
|
|
47
|
+
// https://www.unicompat.com/2697 => 94.1%
|
|
48
|
+
(name === 'warning' && Unicode(0x26a0, { fontFamily: 'emoji' })) ||
|
|
49
|
+
// ***
|
|
50
|
+
// U+2697
|
|
51
|
+
// https://emojipedia.org/alembic/
|
|
52
|
+
// https://www.unicompat.com/2697 => 94.1%
|
|
53
|
+
(name === 'lab' && Unicode(0x2697)) ||
|
|
54
|
+
// ***
|
|
55
|
+
// U+2139
|
|
56
|
+
// https://emojipedia.org/information/
|
|
57
|
+
// https://www.unicompat.com/2139 => 94.8%
|
|
58
|
+
// https://www.unicompat.com/2139-FE0F => 92.4%
|
|
59
|
+
(name === 'info' && Unicode(0x2139, { fontFamily: 'emoji' })) ||
|
|
60
|
+
// ***
|
|
61
|
+
// U+1F4E6
|
|
62
|
+
// https://emojipedia.org/package/
|
|
63
|
+
// https://www.unicompat.com/1F4E6 => 94.1%
|
|
64
|
+
(name === 'package' && Unicode(0x1f4e6)) ||
|
|
65
|
+
// ***
|
|
66
|
+
// U+1F381
|
|
67
|
+
// https://emojipedia.org/wrapped-gift/
|
|
68
|
+
// https://www.unicompat.com/1F381 => 94.1%
|
|
69
|
+
(name === 'gift' && Unicode(0x1f381)) ||
|
|
70
|
+
// ***
|
|
71
|
+
// U+1F496
|
|
72
|
+
// https://emojipedia.org/sparkling-heart/
|
|
73
|
+
// https://www.unicompat.com/1F496 => 94.1%
|
|
74
|
+
(name === 'sparkling-heart' && Unicode(0x1f496)) ||
|
|
75
|
+
// ***
|
|
76
|
+
// U+2B55
|
|
77
|
+
// https://emojipedia.org/hollow-red-circle/
|
|
78
|
+
// https://www.unicompat.com/2B55 => 94.1%
|
|
79
|
+
(name === 'red-circle' && Unicode(0x2b55)) ||
|
|
80
|
+
// ***
|
|
81
|
+
(name === 'engine' && Img(iconEngine)) ||
|
|
82
|
+
// ***
|
|
83
|
+
// https://www.typescriptlang.org/branding/
|
|
84
|
+
(name === 'typescript' && Img(iconTypescript)) ||
|
|
85
|
+
// ***
|
|
86
|
+
// U+FE0F
|
|
87
|
+
// https://emojipedia.org/shield/
|
|
88
|
+
// https://www.unicompat.com/FE0F => 46.5%
|
|
89
|
+
// https://icon-sets.iconify.design/noto/shield/
|
|
90
|
+
(name === 'shield' && Img(iconShield)) ||
|
|
91
|
+
// ***
|
|
92
|
+
// Custom
|
|
93
|
+
(name === 'road-fork' && Img(iconRoadFork, '1.4em')) ||
|
|
94
|
+
// ***
|
|
95
|
+
// U+270D
|
|
96
|
+
// https://emojipedia.org/writing-hand/
|
|
97
|
+
// https://www.unicompat.com/270D => 93.8%
|
|
98
|
+
(name === 'writing-hang' && Unicode(0x270d)) ||
|
|
99
|
+
// ***
|
|
100
|
+
// U+1F4AB
|
|
101
|
+
// https://emojipedia.org/dizzy/
|
|
102
|
+
// https://www.unicompat.com/1F4AB => 94.1%
|
|
103
|
+
(name === 'dizzy' && Unicode(0x1f4ab)) ||
|
|
104
|
+
// ***
|
|
105
|
+
// U+1F9BE
|
|
106
|
+
// https://iconify.design/icon-sets/noto/mechanical-arm.html
|
|
107
|
+
// https://emojipedia.org/mechanical-arm/
|
|
108
|
+
// https://www.unicompat.com/1f9be => 65.5%
|
|
109
|
+
(name === 'mechanical-arm' && Img(iconMechanicalArm)) ||
|
|
110
|
+
// ***
|
|
111
|
+
// U+1F680
|
|
112
|
+
// https://www.unicompat.com/1F680 => 94.1
|
|
113
|
+
(name === 'rocket' && Unicode(0x1f680)) ||
|
|
114
|
+
// ***
|
|
115
|
+
// U+1F527
|
|
116
|
+
// https://emojipedia.org/wrench/
|
|
117
|
+
// https://www.unicompat.com/1F527 => 94.1%
|
|
118
|
+
(name === 'wrench' && Unicode(0x1f527)) ||
|
|
119
|
+
// ***
|
|
120
|
+
// U+1F9ED
|
|
121
|
+
// https://iconify.design/icon-sets/noto/compass.html
|
|
122
|
+
// https://www.unicompat.com/1F9ED => 67.1%
|
|
123
|
+
(name === 'compass' && Img(iconCompass, '1.4em')) ||
|
|
124
|
+
// ***
|
|
125
|
+
// U+1F331
|
|
126
|
+
// https://www.unicompat.com/1F331 => 94.1%
|
|
127
|
+
(name === 'seedling' && Unicode(0x1f331)) ||
|
|
128
|
+
// ***
|
|
129
|
+
// U+1F4DA
|
|
130
|
+
// https://www.unicompat.com/1F4DA => 94.1%
|
|
131
|
+
(name === 'books' && Unicode(0x1f4da)) ||
|
|
132
|
+
// ***
|
|
133
|
+
// U+1F50C
|
|
134
|
+
// https://www.unicompat.com/1F50C => 94.1%
|
|
135
|
+
(name === 'plug' && Unicode(0x1f50c)) ||
|
|
136
|
+
// ***
|
|
137
|
+
// U+1F30D
|
|
138
|
+
// https://www.unicompat.com/1F30D => 88.8%
|
|
139
|
+
(name === 'earth' && Unicode(0x1f30d)) ||
|
|
140
|
+
// ***
|
|
141
|
+
// U+2699
|
|
142
|
+
// https://www.unicompat.com/2699 => 94.1%
|
|
143
|
+
(name === 'gear' && Unicode(0x2699)) ||
|
|
144
|
+
// ***
|
|
145
|
+
// U+2764
|
|
146
|
+
// https://emojipedia.org/red-heart/
|
|
147
|
+
// https://www.unicompat.com/2764 => 94.4%
|
|
148
|
+
// https://www.unicompat.com/2764-FE0F => 92.4%
|
|
149
|
+
(name === 'red-heart' && Unicode(0x2764, { fontFamily: 'emoji' })) ||
|
|
150
|
+
// U+26A1
|
|
151
|
+
// https://www.unicompat.com/26A1 => 94.1%
|
|
152
|
+
(name === 'high-voltage' && Unicode(0x26a1)) ||
|
|
153
|
+
// U+2728
|
|
154
|
+
// https://emojipedia.org/sparkles/
|
|
155
|
+
// https://www.unicompat.com/2728 => 94.1%
|
|
156
|
+
(name === 'sparkles' && Unicode(0x2728)) ||
|
|
157
|
+
// ***
|
|
158
|
+
// U+1F48E
|
|
159
|
+
// https://emojipedia.org/gem-stone/
|
|
160
|
+
// https://www.unicompat.com/1F48E => 94.1%
|
|
161
|
+
(name === 'gem-stone' && Unicode(0x1f48e)) ||
|
|
162
|
+
// ***
|
|
163
|
+
// 0x1F3C6
|
|
164
|
+
// https://emojipedia.org/trophy/
|
|
165
|
+
// https://www.unicompat.com/1F3C6 => 94.1%
|
|
166
|
+
(name === 'trophy' && Unicode(0x1f3c6)) ||
|
|
167
|
+
// ***
|
|
168
|
+
// U+1F397
|
|
169
|
+
// https://emojipedia.org/reminder-ribbon/
|
|
170
|
+
// unicompat.com is down
|
|
171
|
+
// - https://github.com/gelbartj/unicompat-public/issues/42
|
|
172
|
+
// - https://stackoverflow.com/questions/51042771/unicode-symbols-and-os-browser-font-support
|
|
173
|
+
(name === 'ribbon' && Unicode(0x1f397, { fontFamily: 'emoji' })) ||
|
|
174
|
+
false
|
|
175
|
+
/* ======= Unused ========
|
|
176
|
+
// ***
|
|
177
|
+
// U+1FAA8
|
|
178
|
+
// https://emojipedia.org/rock/
|
|
179
|
+
// https://www.unicompat.com/1faa8 => 20.7%
|
|
180
|
+
//
|
|
181
|
+
// ***
|
|
182
|
+
// U+26F0
|
|
183
|
+
// https://emojipedia.org/mountain/
|
|
184
|
+
// https://iconify.design/icon-sets/noto/mountain.html
|
|
185
|
+
// https://www.unicompat.com/26F0 => 89.3%
|
|
186
|
+
(name === 'mountain' && Img(iconMountain)) ||
|
|
187
|
+
//
|
|
188
|
+
// ***
|
|
189
|
+
// U+2194
|
|
190
|
+
// https://emojipedia.org/left-right-arrow/
|
|
191
|
+
// https://www.unicompat.com/2194 => 95.0%
|
|
192
|
+
// Couldn't manage to show colored version
|
|
193
|
+
(name === 'left-right-arrow' && Unicode(0x2194)) ||
|
|
194
|
+
(name === 'left-right-arrow' && Unicode(0x2194, { fontFamily: 'reset' })) ||
|
|
195
|
+
(name === 'left-right-arrow' && Unicode(0xFE0F)) ||
|
|
196
|
+
(name === 'left-right-arrow' && Unicode(0xFE0F, { fontFamily: 'reset' })) ||
|
|
197
|
+
======================== */
|
|
198
|
+
|
|
199
|
+
assert(emoji, { name })
|
|
200
|
+
|
|
201
|
+
return emoji
|
|
202
|
+
|
|
203
|
+
function Unicode(codePoint: number, styleAddendum?: React.CSSProperties) {
|
|
204
|
+
const text = String.fromCodePoint(codePoint)
|
|
205
|
+
if (style || styleAddendum) {
|
|
206
|
+
return React.createElement('span', { style: { ...style, ...styleAddendum } }, text)
|
|
207
|
+
} else {
|
|
208
|
+
return React.createElement(React.Fragment, null, text)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function Img(imgSrc: string, width: string = '1.15em') {
|
|
213
|
+
const props = {
|
|
214
|
+
src: imgSrc,
|
|
215
|
+
style: {
|
|
216
|
+
verticalAlign: 'text-top',
|
|
217
|
+
fontSize: '1em',
|
|
218
|
+
width,
|
|
219
|
+
...style
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return React.createElement('img', props)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Emoji'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 128 128"><linearGradient id="IconifyId-17a99f60578-807714-36" x1="43.401" x2="66.946" y1="35.388" y2="110.95" gradientUnits="userSpaceOnUse"><stop stop-color="#607D8B" offset="0"/><stop stop-color="#57727F" offset=".4"/><stop stop-color="#455A64" offset="1"/></linearGradient><path d="M119.04 73.55c-1.44-2.68-2.99-4.84-4.61-6.24v-.01c-.06-.06-.13-.1-.19-.16c-.13-.11-.26-.22-.39-.31c-.23-.17-.46-.33-.69-.47c-.44-.26-.87-.55-1.29-.85c-.12-.08-.24-.17-.35-.26c-7.1-5.26-12.5-15.94-16.52-22.86c-1.83-3.78-3.65-6.46-5.44-6.46c-.37 0-.81.19-1.29.48c-1.06.63-2.39 1.94-3.93 3.78c-5.27-3.29-5.44-20.97-10.08-20.97c-2.3 0-4.09-6.19-6.35-10.67c-.01-.01-.01-.02-.02-.03c-.17.21-.17.21 0 0c-.32-.63-.64-1.22-.98-1.76c-.67-1.08-1.39-1.93-2.18-2.39c-.39-.23-.8-.36-1.24-.37c-.82-.02-1.75.5-2.76 1.43c-.76.7-1.57 1.62-2.4 2.73c-.56.74-1.13 1.55-1.71 2.43c-.29.44-.58.89-.87 1.36c-.59.93-1.18 1.92-1.78 2.95c-5.95 10.28-12.1 24.38-13.87 26.26c-.51.54-1.02.95-1.55 1.27c-1.57.97-3.21 1.12-4.77 1.25c-.7.06-1.38.1-2.03.22c-1.03.18-2.02.58-2.94 1.18c-.46.3-.9.65-1.31 1.05c-.21.2-.41.41-.6.64c-.19.22-.38.46-.56.71c-.19.26-.38.53-.57.81c-.05.07-.1.15-.15.23c-.15.22-.3.44-.45.68l-.15.24c-.16.25-.33.52-.5.78l-.11.17c-.18.3-.37.6-.55.92c-.02.04-.04.07-.06.11c-.17.28-.34.57-.5.86c-4.43 7.69-9.74 19.58-14.49 31.05A62.077 62.077 0 0 0 4 107.28V116h120V93.87c0-7.07-1.6-14.1-4.96-20.32zm-31.23-8.47c-.1.17-.18.32-.28.48c.1-.16.18-.31.28-.48zm-.39 41.54c-.8.92-1.59 1.87-2.38 2.8c.8-.94 1.58-1.88 2.38-2.8c.38-.43.74-.86 1.1-1.28c-.35.42-.72.84-1.1 1.28zm.06-30.55zm5-31.33c-.09-.37-.18-.74-.28-1.1c.1.36.19.73.28 1.1l.12.51l-.12-.51zm6.58 43.57c.11-.53.17-1.02.19-1.49c-.02.47-.09.96-.19 1.49z" fill="url(#IconifyId-17a99f60578-807714-36)"/><path d="M91.45 101.77c-1.18 1.5-2.52 3.12-4.02 4.85c-.8.92-1.59 1.87-2.38 2.8c.79-.93 1.58-1.88 2.38-2.8c1.5-1.73 2.84-3.35 4.02-4.85z" fill="none"/><path d="M99.25 86.15c-.02-.44-.07-.85-.16-1.24c.09.39.15.8.16 1.24z" fill="none"/><path d="M98.19 82.86z" fill="none"/><path d="M99.06 88.31c.11-.53.17-1.02.19-1.49c-.02.47-.09.96-.19 1.49z" fill="none"/><path d="M97.85 91.87c.45-.99.79-1.9 1.01-2.74c-.23.83-.56 1.74-1.01 2.74z" fill="none"/><path d="M91.45 101.77c3.15-4.01 5.2-7.25 6.4-9.9c-1.21 2.65-3.25 5.89-6.4 9.9z" fill="none"/><linearGradient id="IconifyId-17a99f60578-807714-37" x1="27.284" x2="48.617" y1="52.926" y2="122.26" gradientTransform="matrix(-1 0 0 1 128 0)" gradientUnits="userSpaceOnUse"><stop stop-color="#78909C" offset="0"/><stop stop-color="#6C8490" offset=".427"/><stop stop-color="#546E7A" offset="1"/></linearGradient><path d="M79.6 116c1.79-2.21 3.6-4.41 5.45-6.58A306.38 306.38 0 0 0 79.6 116z" fill="url(#IconifyId-17a99f60578-807714-37)"/><linearGradient id="IconifyId-17a99f60578-807714-38" x1="52.004" x2="45.004" y1="58.942" y2="118.44" gradientTransform="matrix(-1 0 0 1 128 0)" gradientUnits="userSpaceOnUse"><stop stop-color="#546E7A" offset="0"/><stop stop-color="#4C636E" offset=".37"/><stop stop-color="#37474F" offset="1"/></linearGradient><path d="M79.6 116c1.79-2.21 3.6-4.41 5.45-6.58A306.38 306.38 0 0 0 79.6 116z" fill="url(#IconifyId-17a99f60578-807714-38)"/><linearGradient id="IconifyId-17a99f60578-807714-39" x1="59.148" x2="59.148" y1="3" y2="74.391" gradientTransform="matrix(-1 0 0 1 128 0)" gradientUnits="userSpaceOnUse"><stop stop-color="#E1F5FE" offset="0"/><stop stop-color="#D5F1FD" offset=".351"/><stop stop-color="#B4E5FC" offset=".991"/><stop stop-color="#B3E5FC" offset="1"/></linearGradient><path d="M23.78 51.4c.02-.04.04-.07.06-.11c.19-.31.37-.62.55-.92l.11-.17c.17-.27.33-.53.5-.78l.15-.24c.15-.23.3-.46.45-.68c.05-.07.1-.15.15-.23c.19-.28.38-.55.57-.81c.18-.25.37-.48.56-.71c.19-.22.4-.44.6-.64c.41-.4.85-.75 1.31-1.05c.92-.6 1.91-1 2.94-1.18c.66-.11 1.34-.16 2.03-.22c1.57-.12 3.2-.28 4.77-1.25c.52-.32 1.04-.74 1.55-1.27c1.77-1.88 7.92-15.98 13.87-26.26c.6-1.03 1.19-2.02 1.78-2.95c.29-.47.59-.92.87-1.36c.58-.88 1.15-1.69 1.71-2.43c.84-1.1 1.64-2.03 2.4-2.73c1.04-.91 1.97-1.43 2.78-1.41c.43.01.84.14 1.24.37c.79.46 1.51 1.32 2.18 2.39c.34.54.66 1.13.98 1.76c-.17.21-.17.21 0 0c.01.01.01.02.02.03c2.26 4.49 4.05 10.67 6.35 10.67c4.64 0 4.81 17.69 10.08 20.97c1.53-1.84 2.86-3.15 3.93-3.78c.48-.29.92-.48 1.29-.48c1.79 0 3.61 2.68 5.44 6.46c4.33 7.44 10.24 19.25 18.17 23.97c.43.26.85.57 1.27.93c-1.52 3.03-4.15 6.24-8.18 4.92c-7-2.3-10.45.11-14.01 4.71c-.4.51-.83.89-1.29 1.19c-3.63 2.4-8.84-1.37-10.88-2.8c-2.26-1.58-10.08-3.49-17.11-.59c-.02.01-.25.09-.34.13c-7.12 3.1-11.6-6.89-11.14-17.91s-5.4-9.87-9.07-7.12c-2.83 2.12-13.96 2.88-19.14 2.44c.16-.29.33-.57.5-.86z" fill="url(#IconifyId-17a99f60578-807714-39)"/><radialGradient id="IconifyId-17a99f60578-807714-40" cx="96.5" cy="50" r="37.832" gradientUnits="userSpaceOnUse"><stop stop-color="#546E7A" offset="0"/><stop stop-color="#4C636E" offset=".37"/><stop stop-color="#37474F" offset="1"/></radialGradient><path d="M85.04 109.42c.79-.93 1.58-1.88 2.38-2.8c1.51-1.73 2.84-3.34 4.02-4.85c3.15-4.01 5.2-7.25 6.4-9.9c.45-.99.79-1.9 1.01-2.74c.08-.28.14-.55.2-.81c.11-.53.17-1.02.19-1.49c.01-.23.01-.46 0-.68c-.02-.44-.07-.85-.16-1.24a6.04 6.04 0 0 0-.9-2.05c-.21-.3-.44-.58-.7-.85c-.77-.8-1.72-1.45-2.77-2.03c-.52-.29-1.06-.57-1.61-.83c-.72-.35-1.45-.69-2.16-1.03c-.36-.17-.72-.35-1.06-.53a15.107 15.107 0 0 1-1.32-.76c-.38-.24-.76-.49-1.09-.76c-.41-.34-.78-.7-1.09-1.1c-.21-.27-.39-.55-.54-.85a5.002 5.002 0 0 1-.47-1.49c-.11-.73-.07-1.55.15-2.49c.08-.33.18-.67.3-1.03c.1-.31.24-.63.37-.96c.02-.04.03-.08.05-.13c.33-.76.76-1.58 1.28-2.46c.1-.16.17-.31.28-.48c.56-.91 1.07-1.8 1.53-2.68c.69-1.31 1.27-2.57 1.74-3.79c.32-.81.59-1.61.82-2.38c.09-.31.18-.62.26-.92c.12-.45.23-.9.32-1.34c.23-1.1.37-2.16.45-3.17a21.958 21.958 0 0 0 .01-2.91c-.04-.62-.11-1.21-.2-1.79c-.05-.29-.1-.57-.15-.85l-.12-.51c-.09-.37-.18-.74-.28-1.1c-.23-.78-.5-1.51-.8-2.2c-.2-.46-.41-.9-.63-1.32s-.45-.82-.69-1.2s-.48-.74-.72-1.09c-.36-.51-.73-.98-1.09-1.41c.48-.29.92-.48 1.29-.48c1.79 0 3.61 2.68 5.44 6.46C99 49.32 104.4 60 111.5 65.26l.35.26c.43.3.85.59 1.29.85c.23.14.46.3.69.47c.13.1.26.21.39.31c.06.05.13.1.19.16v.01c1.63 1.41 3.17 3.57 4.61 6.24C122.4 79.77 124 86.8 124 93.87V116H79.6c1.78-2.21 3.6-4.41 5.44-6.58z" fill="url(#IconifyId-17a99f60578-807714-40)"/><radialGradient id="IconifyId-17a99f60578-807714-41" cx="51.5" cy="10.75" r="83.563" gradientUnits="userSpaceOnUse"><stop stop-color="#90A4AE" offset="0"/><stop stop-color="#849AA5" offset=".226"/><stop stop-color="#65818E" offset=".633"/><stop stop-color="#607D8B" offset=".686"/><stop stop-color="#5F7C8A" offset=".697"/><stop stop-color="#57717E" offset=".848"/><stop stop-color="#546E7A" offset="1"/></radialGradient><path d="M8.79 83.31c4.75-11.46 10.06-23.36 14.49-31.05c.17-.29.34-.58.5-.86c.02-.04.04-.07.06-.11c.19-.31.37-.62.55-.92l.11-.17c.17-.27.33-.53.5-.78l.15-.24c.15-.23.3-.46.45-.68c.05-.07.1-.15.15-.23c.19-.28.38-.55.57-.81c.18-.25.37-.48.56-.71c.19-.22.4-.44.6-.64c.41-.4.85-.75 1.31-1.05c.92-.6 1.91-1 2.94-1.18c.66-.11 1.34-.16 2.03-.22c1.57-.12 3.2-.28 4.77-1.25c.52-.32 1.04-.74 1.55-1.27c1.77-1.88 7.92-15.98 13.87-26.26c.6-1.03 1.19-2.02 1.78-2.95c.29-.47.59-.92.87-1.36c.58-.88 1.15-1.69 1.71-2.43c.84-1.1 1.64-2.03 2.4-2.73c1.04-.91 1.97-1.43 2.78-1.41c.43.01.84.14 1.24.37c.79.46 1.51 1.32 2.18 2.39c.34.54.66 1.13.98 1.76c-.17.21-.17.21 0 0c.01.01.01.02.02.03c-11.53 13.77-9.16 27.69-5.53 38.75c.41.5.8 1 1.16 1.53c1.82 2.67 3.09 5.71 5.52 7.93c.85.78 1.8 1.41 2.8 1.96c6.06-9.67 12.36-18.36 12.48-18.53c1.53-1.84 2.86-3.15 3.93-3.78a20.635 20.635 0 0 1 1.81 2.5c.24.38.47.78.69 1.2s.43.86.63 1.32c.3.69.57 1.42.8 2.2c.1.36.2.72.28 1.1l.12.51c.06.28.11.56.15.85a19.982 19.982 0 0 1 .24 2.73c.01.64 0 1.29-.05 1.97c-.07 1.01-.22 2.07-.45 3.17c-.09.44-.2.89-.32 1.34c-.08.3-.16.61-.26.92c-.23.77-.51 1.57-.82 2.38a37.81 37.81 0 0 1-1.74 3.79c-.46.87-.97 1.76-1.53 2.68c-.1.17-.18.32-.28.48c-.52.88-.95 1.7-1.28 2.46c-.02.04-.03.08-.05.13a12.777 12.777 0 0 0-.67 1.99c-.22.94-.26 1.76-.15 2.49c.03.18.06.36.11.53c.09.34.21.66.36.96s.33.58.54.85c.31.4.68.76 1.09 1.1c.33.27.71.52 1.09.76c.12.07.23.15.35.22c.31.19.64.36.97.54c.35.18.7.36 1.06.53c.71.34 1.44.68 2.16 1.03c.55.27 1.09.54 1.61.83c1.04.58 2 1.23 2.77 2.03c.26.27.49.55.7.85c.42.6.73 1.28.9 2.05c.09.39.14.8.16 1.24c.01.22.01.44 0 .68c-.02.47-.09.96-.19 1.49c-.05.26-.12.53-.2.81c-.23.84-.56 1.75-1.01 2.74c-1.2 2.65-3.25 5.89-6.4 9.9c-1.18 1.5-2.52 3.12-4.02 4.85c-.8.92-1.59 1.87-2.38 2.8c-1.84 2.17-3.66 4.37-5.45 6.58H4v-8.72c0-8.22 1.64-16.36 4.79-23.96z" fill="url(#IconifyId-17a99f60578-807714-41)"/><linearGradient id="IconifyId-17a99f60578-807714-42" x1="63.668" x2="74.418" y1="21.399" y2="55.899" gradientUnits="userSpaceOnUse"><stop stop-color="#607D8B" offset="0"/><stop stop-color="#57727F" offset=".4"/><stop stop-color="#455A64" offset="1"/></linearGradient><path d="M64.87 69.15c-.43.58-1.35.18-1.2-.53c.93-4.67 2.28-11.36.08-17.38c-4.22-11.58-8.79-27.23 4.15-42.69c2.26 4.49 4.05 10.67 6.35 10.67c4.64 0 4.81 17.69 10.08 20.97c-.14.21-14.5 22.18-19.46 28.96z" fill="url(#IconifyId-17a99f60578-807714-42)"/><linearGradient id="IconifyId-17a99f60578-807714-43" x1="64" x2="64" y1="105.17" y2="83.076" gradientUnits="userSpaceOnUse"><stop stop-color="#37474F" offset="0"/><stop stop-color="#37474F" stop-opacity="0" offset="1"/></linearGradient><path d="M119.04 73.55c-1.44-2.68-2.99-4.84-4.61-6.24v-.01c-.06-.06-.13-.1-.19-.16c-.13-.11-.26-.22-.39-.31c-.23-.17-.46-.33-.69-.47c-.44-.26-.87-.55-1.29-.85c-.12-.08-.24-.17-.35-.26c-7.1-5.26-12.5-15.94-16.52-22.86c-1.83-3.78-3.65-6.46-5.44-6.46c-.37 0-.81.19-1.29.48c-1.06.63-2.39 1.94-3.93 3.78c-.12.17-6.42 8.85-12.48 18.53c-.99-.56-1.94-1.18-2.8-1.96c-2.43-2.22-3.7-5.26-5.52-7.93c-.36-.53-.76-1.04-1.16-1.53c-3.64-11.06-6-24.98 5.53-38.75c-.01-.01-.01-.02-.02-.03c-.17.21-.17.21 0 0c-.32-.63-.64-1.22-.98-1.76c-.67-1.08-1.39-1.93-2.18-2.39c-.39-.23-.8-.36-1.24-.37c-.82-.02-1.75.5-2.76 1.43c-.76.7-1.57 1.62-2.4 2.73c-.56.74-1.13 1.55-1.71 2.43c-.29.44-.58.89-.87 1.36c-.59.93-1.18 1.92-1.78 2.95c-5.95 10.28-12.1 24.38-13.87 26.26c-.51.54-1.02.95-1.55 1.27c-1.57.97-3.21 1.12-4.77 1.25c-.7.06-1.38.1-2.03.22c-1.03.18-2.02.58-2.94 1.18c-.46.3-.9.65-1.31 1.05c-.21.2-.41.41-.6.64c-.19.22-.38.46-.56.71c-.19.26-.38.53-.57.81c-.05.07-.1.15-.15.23c-.15.22-.3.44-.45.68l-.15.24c-.16.25-.33.52-.5.78l-.11.17c-.18.3-.37.6-.55.92c-.02.04-.04.07-.06.11c-.17.28-.34.57-.5.86c-4.43 7.69-9.74 19.58-14.49 31.05A62.077 62.077 0 0 0 4 107.28V116h120V93.87c0-7.07-1.6-14.1-4.96-20.32zm-31.23-8.47c-.1.17-.18.32-.28.48c.1-.16.18-.31.28-.48zm-.39 41.54c-.8.92-1.59 1.87-2.38 2.8c.8-.94 1.58-1.88 2.38-2.8c.38-.43.74-.86 1.1-1.28c-.35.42-.72.84-1.1 1.28zm.06-30.55zm5-31.33c-.09-.37-.18-.74-.28-1.1c.1.36.19.73.28 1.1l.12.51l-.12-.51zm6.58 43.57c.11-.53.17-1.02.19-1.49c-.02.47-.09.96-.19 1.49z" fill="url(#IconifyId-17a99f60578-807714-43)" opacity=".7"/><path d="M63.42 7.12c.19.18.51.53.93 1.2c.05.09.17.36.24.52c.19.42.45 1.01.87 1.53c.5 1.03.98 2.16 1.46 3.27c1.89 4.39 3.53 8.21 6.84 8.56c.82 1.09 1.83 4.9 2.45 7.24c1.42 5.36 2.89 10.9 6.4 13.21l.03.03l.14.08l.03.02l.01.01l2.17 1.32l1.65-1.99c1.49-1.8 2.41-2.6 2.89-2.95c.47.48 1.38 1.67 2.76 4.53l.05.1l.06.1c.55.94 1.12 1.95 1.72 3.01c4 7.06 8.97 15.84 15.61 20.75c.13.1.27.2.4.29c.56.4 1.04.71 1.49.98c.12.07.26.17.44.3c.07.05.13.11.2.16l.06.05c.02.02.04.04.06.05l.08.07c1.27 1.1 2.59 2.92 3.94 5.4c3.01 5.58 4.6 12.11 4.6 18.89V113H7v-5.72c0-7.84 1.53-15.51 4.56-22.81c5.74-13.85 10.56-24.18 14.32-30.7l.42-.72c.02-.04.04-.07.07-.11l.14-.24c.15-.25.3-.5.45-.74l.07-.11l.04-.06c.16-.25.31-.5.47-.74l.01-.05l.11-.17c.14-.22.28-.43.42-.63l.07-.1l.08-.11c.18-.26.35-.5.52-.74c.13-.18.27-.35.41-.51s.28-.31.42-.45c.28-.27.57-.51.88-.71c.57-.38 1.18-.62 1.8-.73c.48-.08 1.04-.13 1.63-.17l.13-.01c1.64-.13 3.88-.31 6.11-1.69c.77-.48 1.49-1.07 2.15-1.77c1.14-1.21 2.62-4.14 5.84-10.64c2.45-4.94 5.5-11.09 8.44-16.17c.6-1.03 1.18-1.99 1.72-2.86c.28-.45.56-.88.84-1.3c.56-.84 1.1-1.61 1.6-2.27c.76-1 1.44-1.78 2.04-2.33c.29-.26.5-.42.66-.52M63.45 4c-.81 0-1.72.52-2.72 1.43c-.76.7-1.57 1.62-2.4 2.73c-.56.74-1.13 1.55-1.71 2.43c-.29.44-.58.89-.87 1.36c-.59.93-1.18 1.92-1.78 2.95c-5.95 10.28-12.1 24.38-13.87 26.26c-.51.54-1.02.95-1.55 1.27c-1.57.97-3.21 1.12-4.77 1.25c-.7.06-1.38.1-2.03.22c-1.03.18-2.02.58-2.94 1.18c-.46.3-.9.65-1.31 1.05c-.21.2-.41.41-.6.64c-.19.22-.38.46-.56.71c-.19.26-.38.53-.57.81c-.05.07-.1.15-.15.23c-.15.22-.3.44-.45.68l-.15.24c-.16.25-.33.52-.5.78l-.11.17c-.18.3-.37.6-.55.92c-.02.04-.04.07-.06.11c-.17.28-.34.57-.5.86c-4.43 7.69-9.74 19.58-14.49 31.05A62.077 62.077 0 0 0 4 107.28V116h120V93.87c0-7.07-1.6-14.1-4.96-20.32c-1.44-2.68-2.99-4.84-4.61-6.24v-.01c-.06-.06-.13-.1-.19-.16c-.13-.11-.26-.22-.39-.31c-.23-.17-.46-.33-.69-.47c-.44-.26-.87-.55-1.29-.85c-.12-.08-.24-.17-.35-.26c-7.1-5.26-12.5-15.94-16.52-22.86c-1.83-3.78-3.65-6.46-5.44-6.46c-.37 0-.81.19-1.29.48c-1.06.63-2.39 1.94-3.93 3.78c-5.27-3.29-5.44-20.97-10.08-20.97c-2.3 0-4.09-6.19-6.35-10.67c-.01-.01-.01-.02-.02-.03c-.01.01-.02.02-.04.02c-.19 0-.63-1.28-.94-1.78c-.67-1.08-1.39-1.93-2.18-2.39c-.39-.23-.8-.36-1.24-.37h-.04z" fill="#424242" opacity=".2"/><path d="M37.32 53.83c.07-.46-.57-.66-.77-.24c-2.66 5.64-13.77 22.19-17.77 29.25c-.39.69.44 1.42 1.07.95c1.93-1.43 5.72-4.78 5.93-5.78c.3-1.43 2.96-5.44 3.81-6.7c.17-.24.34-.48.52-.71l3.49-4.39c.68-.86 1.17-1.85 1.42-2.92l2.3-9.46z" fill="#eee" opacity=".2"/><path d="M49.45 42.23c.16-.34-.24-.67-.54-.45l-3.66 2.62c-.26.27-.45.6-.53.97l-2.87 11.42c0 .45.63.54.76.11l6.84-14.67z" fill="#eee" opacity=".2"/><path d="M61.64 72.67c.15-.41-.39-.7-.65-.35c-3.42 4.6-16.44 17.5-21.32 23.14c-.48.55.14 1.36.8 1.05c2-.94 6.02-3.27 6.39-4.14c.53-1.24 3.65-4.36 4.65-5.34c.19-.19.39-.37.6-.54l3.94-3.32c.77-.65 1.39-1.46 1.81-2.37l3.78-8.13z" fill="#eee" opacity=".2"/><path d="M45.2 82.13c.27-.21.09-.64-.25-.59l-4.1.58c-.33.11-.62.3-.84.57l-7.2 8.09c-.19.36.29.71.57.41l11.82-9.06z" fill="#eee" opacity=".2"/><path d="M109.19 86.06c.24.25.65-.04.49-.35c-2.17-4.11-7.06-18.14-9.48-23.69c-.24-.54-1.04-.37-1.04.22c-.01 1.79.29 5.55.79 6.12c.72.82 1.92 4.2 2.29 5.27c.07.21.13.41.19.63l1.06 4.04c.21.79.58 1.52 1.1 2.15l4.6 5.61z" fill="#424242" opacity=".2"/><path d="M109.32 71.78c-.07-.27.17-.27.4-.01l3.91 4.77c.31.26.58.64.72 1l3.16 8.4l-2.88-4.43c-.13-.2-.33-.26-.31-.09l.76 6.36c.02.28-.38.05-1.08-.27l-4.68-15.73z" fill="#424242" opacity=".2"/><path d="M86.41 46.15c.16-.19.46-.11.51.13l.71 4.17c.16.26.17.58.02.84l-3.47 6.13l.29-3.63c.01-.17-.18-.26-.31-.15l-4.71 4.12c-.23.17-.53-.09-1.13-.52l8.09-11.09z" fill="#424242" opacity=".2"/><path d="M65.54 18.5c-.07-.28.17-.28.41-.01l4.03 4.92c.32.27.6.66.74 1.03l3.26 8.66l-2.97-4.57c-.14-.21-.34-.27-.32-.09l.79 6.56c.02.28-.39.05-1.12-.28L65.54 18.5z" fill="#424242" opacity=".2"/><linearGradient id="IconifyId-17a99f60578-807714-44" x1="64" x2="64" y1="99" y2="123.52" gradientUnits="userSpaceOnUse"><stop stop-color="#4CAF50" offset="0"/><stop stop-color="#48A84C" offset=".267"/><stop stop-color="#3B933F" offset=".667"/><stop stop-color="#2E7D32" offset="1"/></linearGradient><path d="M124 92.57c0-1.9-2-3.16-3.7-2.32c-4.06 2-7.41 5.21-9.59 9.17c-.59.69-1.07 1.52-1.42 2.51c-.02.07-.05.14-.07.21c-.17.51-.7.78-1.23.65c-.32-.08-.64-.12-.98-.12c-1.34 0-2.57.63-3.57 1.7c-.71.76-1.91.79-2.73.15a12.53 12.53 0 0 0-7.69-2.64c-2.2 0-4.27.58-6.08 1.58c-.87.48-1.95.18-2.54-.62c-3.56-4.84-9.18-7.98-15.52-7.98c-4.8 0-9.18 1.8-12.58 4.77c-.38.34-.94.34-1.33.01c-.9-.78-1.95-1.23-3.08-1.23c-1.1 0-2.13.43-3.01 1.17c-.34.29-.82.3-1.2.06a13.87 13.87 0 0 0-7.54-2.23c-3.9 0-7.42 1.62-9.99 4.23c-.39.4-1.02.37-1.43-.02c-.95-.92-2.1-1.47-3.34-1.47c-1.36 0-2.61.65-3.61 1.74c-.39.43-1.06.47-1.45.05c-3.57-3.84-8.59-6.24-14.15-6.22C4.96 95.76 4 96.77 4 97.98V124h120V92.57z" fill="url(#IconifyId-17a99f60578-807714-44)"/><path d="M121 93.26V121H7V98.77c4.23.2 8.16 2.04 11.13 5.24c.74.8 1.79 1.26 2.88 1.26c1.12 0 2.21-.48 2.97-1.31c.32-.35.83-.77 1.4-.77c.4 0 .83.21 1.25.62a4.04 4.04 0 0 0 2.82 1.15c1.07 0 2.08-.42 2.83-1.18c2.12-2.15 4.91-3.34 7.85-3.34c2.09 0 4.13.61 5.91 1.75c.66.42 1.42.65 2.19.65c.94 0 1.84-.33 2.56-.93c.37-.31.74-.47 1.08-.47c.36 0 .74.17 1.12.5c.73.63 1.66.98 2.62.98c.97 0 1.91-.35 2.65-1c2.97-2.6 6.74-4.03 10.6-4.03c5.17 0 9.95 2.46 13.1 6.75c.96 1.3 2.48 2.08 4.07 2.08c.82 0 1.64-.21 2.35-.61c1.44-.8 2.99-1.2 4.62-1.2c2.13 0 4.15.7 5.86 2.01c.9.69 2.02 1.07 3.15 1.07c1.37 0 2.69-.57 3.61-1.55c.32-.34.82-.75 1.38-.75c.09 0 .18.01.27.03c.32.08.64.11.96.11c1.73 0 3.26-1.1 3.81-2.73l.06-.18c.21-.6.5-1.12.87-1.55l.2-.24l.15-.27a19.17 19.17 0 0 1 7.68-7.6m.42-3.27c-.37 0-.76.08-1.12.27c-4.06 2-7.41 5.21-9.59 9.17c-.59.69-1.07 1.52-1.42 2.51c-.02.07-.05.14-.07.21a1 1 0 0 1-.97.69c-.09 0-.17-.01-.26-.03c-.32-.08-.64-.12-.98-.12c-1.34 0-2.57.63-3.57 1.7c-.38.4-.89.6-1.42.6c-.46 0-.93-.15-1.31-.45a12.53 12.53 0 0 0-7.69-2.64c-2.2 0-4.27.58-6.08 1.58c-.28.16-.59.23-.9.23c-.63 0-1.25-.31-1.65-.85c-3.56-4.84-9.18-7.98-15.52-7.98c-4.8 0-9.18 1.8-12.58 4.77a.99.99 0 0 1-1.33.01c-.9-.78-1.95-1.23-3.08-1.23c-1.1 0-2.13.43-3.01 1.17c-.18.15-.4.23-.63.23c-.2 0-.39-.06-.57-.17a13.87 13.87 0 0 0-7.54-2.23c-3.9 0-7.42 1.62-9.99 4.23c-.19.19-.44.29-.69.29c-.26 0-.53-.1-.74-.3c-.95-.92-2.1-1.47-3.34-1.47c-1.36 0-2.61.65-3.61 1.74c-.21.22-.49.34-.77.34c-.25 0-.5-.1-.68-.3c-3.55-3.83-8.54-6.22-14.08-6.22h-.08C4.96 95.76 4 96.77 4 97.98V124h120V92.57c0-1.49-1.23-2.58-2.58-2.58z" fill="#424242" opacity=".2"/><path d="M50.2 106.91c3.02.93 4.54 3.57 4.13 6.64c-.28 2.14 3.07 2.2 3.35.08c.19-1.41.04-2.77-.37-4.01c4.74-.01 8.82 2.53 10.88 6.87c.93 1.95 3.87.36 2.95-1.59c-2.62-5.52-8.29-8.93-14.39-8.62c-.44.02-.79.19-1.06.43a9.616 9.616 0 0 0-4.57-3.02c-2.05-.64-2.98 2.58-.92 3.22z" fill="#424242" opacity=".2"/><path d="M106.05 111.43c2.1.71 3.11 2.58 2.77 4.72c-.24 1.49 2.1 1.59 2.34.12c.16-.98.08-1.93-.18-2.81c3.31.08 6.12 1.93 7.48 5c.61 1.38 2.7.32 2.09-1.05c-1.73-3.91-5.63-6.4-9.9-6.29c-.31.01-.56.12-.75.28a6.692 6.692 0 0 0-3.14-2.19c-1.43-.49-2.14 1.74-.71 2.22z" fill="#424242" opacity=".2"/><path d="M24.03 109.78c-4.55.1-8.07 2.94-9.2 7.37c-.47 1.84-3.33 1.16-2.87-.68c1.45-5.68 6.11-9.5 11.99-9.63c1.9-.04 1.98 2.9.08 2.94z" fill="#424242" opacity=".2"/></svg>
|
package/utils/assert.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export { assert }
|
|
2
|
+
export { assertUsage }
|
|
3
|
+
export { assertWarning }
|
|
4
|
+
|
|
5
|
+
function assert(condition: unknown, debugInfo?: unknown): asserts condition {
|
|
6
|
+
if (condition) {
|
|
7
|
+
return
|
|
8
|
+
}
|
|
9
|
+
const hasDebugInfo = debugInfo !== undefined
|
|
10
|
+
if (hasDebugInfo) {
|
|
11
|
+
console.log(debugInfo)
|
|
12
|
+
if (typeof debugInfo === 'object') {
|
|
13
|
+
debugInfo = JSON.stringify(debugInfo)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
let errMsg = '[DocPress] Bug. Contact DocPress maintainer.'
|
|
17
|
+
if (hasDebugInfo) {
|
|
18
|
+
errMsg += ' Debug info: ' + String(debugInfo)
|
|
19
|
+
}
|
|
20
|
+
const err = new Error(errMsg)
|
|
21
|
+
if (isBrowserAndDev()) {
|
|
22
|
+
alert(err.stack)
|
|
23
|
+
}
|
|
24
|
+
throw err
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function assertUsage(condition: unknown, msg: string): asserts condition {
|
|
28
|
+
if (condition) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
const err = new Error('[DocPress][Wrong Usage] ' + msg)
|
|
32
|
+
if (isBrowserAndDev()) {
|
|
33
|
+
alert(err.stack)
|
|
34
|
+
}
|
|
35
|
+
throw err
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isBrowserAndDev() {
|
|
39
|
+
return typeof window !== 'undefined' && window?.location?.port !== ''
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function assertWarning(condition: unknown, msg: string): asserts condition {
|
|
43
|
+
if (condition) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
msg = '[DocPress][Warning] ' + msg
|
|
47
|
+
console.warn(msg)
|
|
48
|
+
if (isBrowserAndDev()) {
|
|
49
|
+
alert(msg)
|
|
50
|
+
}
|
|
51
|
+
}
|
package/utils/client.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { assert } from './assert.js'
|
|
2
|
+
|
|
3
|
+
export { determineSectionUrlHash }
|
|
4
|
+
export { determineSectionTitle }
|
|
5
|
+
|
|
6
|
+
function determineSectionUrlHash(title: string): string | null {
|
|
7
|
+
title = title.toLowerCase()
|
|
8
|
+
title = removeAccentsAndDiacritics(title)
|
|
9
|
+
const urlHash = title
|
|
10
|
+
// \u4E00-\u9FA5 are chinese characters, see https://github.com/brillout/docpress/pull/2
|
|
11
|
+
.split(/[^a-z0-9\u4E00-\u9FA5]+/)
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join('-')
|
|
14
|
+
|
|
15
|
+
// E.g. section is composed of only non-latin characters
|
|
16
|
+
if (urlHash === '') return null
|
|
17
|
+
|
|
18
|
+
return urlHash
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Remove accents/diacritics in a string in JavaScript
|
|
22
|
+
// https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463
|
|
23
|
+
function removeAccentsAndDiacritics(str: string): string {
|
|
24
|
+
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function determineSectionTitle(urlWithHash: string): string {
|
|
28
|
+
assert(urlWithHash.includes('#'), { urlWithHash })
|
|
29
|
+
const urlHash = urlWithHash.split('#')[1]
|
|
30
|
+
const title = urlHash
|
|
31
|
+
.split('-')
|
|
32
|
+
.map((word, i) => {
|
|
33
|
+
if (i === 0) {
|
|
34
|
+
return capitalizeFirstLetter(word)
|
|
35
|
+
}
|
|
36
|
+
return word
|
|
37
|
+
})
|
|
38
|
+
.join(' ')
|
|
39
|
+
return title
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function capitalizeFirstLetter(word: string): string {
|
|
43
|
+
return word[0].toUpperCase() + word.slice(1)
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { toPosixPath }
|
|
2
|
+
export { assertPosixPath }
|
|
3
|
+
export { toSystemPath }
|
|
4
|
+
|
|
5
|
+
import assert from 'assert'
|
|
6
|
+
|
|
7
|
+
const sepPosix = '/'
|
|
8
|
+
const sepWin32 = '\\'
|
|
9
|
+
|
|
10
|
+
function toPosixPath(path: string) {
|
|
11
|
+
if (isPosix()) {
|
|
12
|
+
assertPosixPath(path)
|
|
13
|
+
return path
|
|
14
|
+
}
|
|
15
|
+
if (isWin32()) {
|
|
16
|
+
const pathPosix = path.split(sepWin32).join(sepPosix)
|
|
17
|
+
assertPosixPath(pathPosix)
|
|
18
|
+
return pathPosix
|
|
19
|
+
}
|
|
20
|
+
assert(false)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function assertPosixPath(path: string) {
|
|
24
|
+
assert(path && !path.includes(sepWin32), `Wrongly formatted path: ${path}`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function toSystemPath(path: string) {
|
|
28
|
+
if (isPosix()) {
|
|
29
|
+
return toPosixPath(path)
|
|
30
|
+
}
|
|
31
|
+
if (isWin32()) {
|
|
32
|
+
return path.split(sepPosix).join(sepWin32)
|
|
33
|
+
}
|
|
34
|
+
assert(false)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isWin32() {
|
|
38
|
+
return process.platform === 'win32'
|
|
39
|
+
}
|
|
40
|
+
function isPosix() {
|
|
41
|
+
return !isWin32()
|
|
42
|
+
}
|
package/utils/filter.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { filter }
|
|
2
|
+
|
|
3
|
+
// https://stackoverflow.com/questions/66341757/typescript-how-to-filter-the-object
|
|
4
|
+
function filter<T extends object>(obj: T, predicate: <K extends keyof T>(value: T[K], key: K) => boolean): T {
|
|
5
|
+
const result: { [K in keyof T]?: T[K] } = {}
|
|
6
|
+
;(Object.keys(obj) as Array<keyof T>).forEach((name) => {
|
|
7
|
+
if (predicate(obj[name], name)) {
|
|
8
|
+
result[name] = obj[name]
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
return result as T
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { assert } from './assert'
|
|
2
|
+
|
|
3
|
+
export { jsxToTextContent }
|
|
4
|
+
|
|
5
|
+
// https://stackoverflow.com/questions/34204975/react-is-there-something-similar-to-node-textcontent/60564620#60564620
|
|
6
|
+
function jsxToTextContent(node: JSX.Element | string): string {
|
|
7
|
+
if (['string', 'number'].includes(typeof node)) return String(node)
|
|
8
|
+
if (node instanceof Array) return node.map(jsxToTextContent).join('')
|
|
9
|
+
if (typeof node === 'object' && node) return jsxToTextContent(node.props.children)
|
|
10
|
+
assert(false)
|
|
11
|
+
}
|
package/utils/server.ts
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import mdx from '@mdx-js/rollup'
|
|
2
|
+
import react from '@vitejs/plugin-react-swc'
|
|
3
|
+
import vike from 'vike/plugin'
|
|
4
|
+
import { UserConfig } from 'vite'
|
|
5
|
+
import { markdownHeadingsVitePlugin } from './markdownHeadingsVitePlugin.js'
|
|
6
|
+
import rehypePrettyCode from 'rehype-pretty-code'
|
|
7
|
+
import remarkGfm from 'remark-gfm'
|
|
8
|
+
|
|
9
|
+
const root = process.cwd()
|
|
10
|
+
const prettyCode = [rehypePrettyCode, { theme: 'github-light' }]
|
|
11
|
+
const rehypePlugins: any = [prettyCode]
|
|
12
|
+
const remarkPlugins = [remarkGfm]
|
|
13
|
+
|
|
14
|
+
const config: UserConfig = {
|
|
15
|
+
root,
|
|
16
|
+
plugins: [
|
|
17
|
+
markdownHeadingsVitePlugin(),
|
|
18
|
+
mdx({ rehypePlugins, remarkPlugins }),
|
|
19
|
+
// @vitejs/plugin-react-swc needs to be added *after* the mdx plugins
|
|
20
|
+
react(),
|
|
21
|
+
vike({
|
|
22
|
+
prerender: {
|
|
23
|
+
noExtraDir: true
|
|
24
|
+
},
|
|
25
|
+
includeAssetsImportedByServer: true
|
|
26
|
+
})
|
|
27
|
+
],
|
|
28
|
+
optimizeDeps: { include: ['@mdx-js/react', 'react-dom'] },
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
ssr: {
|
|
31
|
+
noExternal: ['@brillout/docpress']
|
|
32
|
+
},
|
|
33
|
+
clearScreen: false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default config
|
package/bin.js
DELETED