@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.
Files changed (146) hide show
  1. package/+config.ts +17 -0
  2. package/MobileHeader.tsx +68 -0
  3. package/PageLayout.css +42 -0
  4. package/PageLayout.tsx +39 -0
  5. package/algolia/DocSearch.css +34 -0
  6. package/algolia/DocSearch.ts +62 -0
  7. package/autoScrollNav.ts +36 -0
  8. package/components/CodeBlockTransformer.css +9 -0
  9. package/components/CodeBlockTransformer.tsx +18 -0
  10. package/components/Comment.tsx +7 -0
  11. package/components/Consulting.tsx +47 -0
  12. package/components/Contributors.tsx +113 -0
  13. package/components/EditPageNote.tsx +18 -0
  14. package/components/FeatureList/FeatureList.client.ts +66 -0
  15. package/{dist/components/features → components/FeatureList}/FeatureList.css +10 -2
  16. package/components/FeatureList/FeatureList.tsx +114 -0
  17. package/components/HorizontalLine.tsx +20 -0
  18. package/components/ImportMeta.tsx +11 -0
  19. package/components/Link.tsx +144 -0
  20. package/components/Note.css +54 -0
  21. package/components/Note.tsx +78 -0
  22. package/components/P.css +8 -0
  23. package/components/P.tsx +8 -0
  24. package/components/ReadingRecommendation.tsx +56 -0
  25. package/components/RepoLink.tsx +24 -0
  26. package/components/Sponsors/label.draft.svg +108 -0
  27. package/components/Sponsors.tsx +218 -0
  28. package/components/Supporters.tsx +136 -0
  29. package/components/index.ts +14 -0
  30. package/config/getConfig.ts +18 -0
  31. package/config/resolveConfig/resolveHeading.ts +0 -0
  32. package/config/resolvePageContext.ts +186 -0
  33. package/css/button.css +7 -0
  34. package/css/code/block.css +36 -0
  35. package/css/code/inline.css +27 -0
  36. package/css/code.css +20 -0
  37. package/css/colorize-on-hover.css +29 -0
  38. package/css/font.css +25 -0
  39. package/css/heading.css +45 -0
  40. package/css/index.css +12 -0
  41. package/css/link.css +17 -0
  42. package/css/reset.css +12 -0
  43. package/css/table.css +14 -0
  44. package/css/tooltip.css +11 -0
  45. package/data/maintainersList.tsx +92 -0
  46. package/data/sponsorsList.ts +147 -0
  47. package/dist/+config.d.ts +19 -0
  48. package/dist/+config.js +15 -0
  49. package/dist/markdownHeadingsVitePlugin.d.ts +13 -0
  50. package/dist/markdownHeadingsVitePlugin.js +170 -0
  51. package/dist/utils/assert.d.ts +6 -0
  52. package/dist/utils/assert.js +48 -0
  53. package/dist/utils/determineSectionUrlHash.d.ts +4 -0
  54. package/dist/utils/determineSectionUrlHash.js +38 -0
  55. package/dist/vite.config.d.ts +3 -0
  56. package/dist/vite.config.js +32 -0
  57. package/index.ts +4 -0
  58. package/installSectionUrlHashs.ts +60 -0
  59. package/markdownHeadingsVitePlugin.ts +150 -0
  60. package/navigation/Navigation-highlight.css +41 -0
  61. package/navigation/Navigation-items.css +119 -0
  62. package/navigation/Navigation-layout.css +127 -0
  63. package/navigation/Navigation.client.ts +43 -0
  64. package/navigation/Navigation.css +3 -0
  65. package/navigation/Navigation.tsx +211 -0
  66. package/navigation/NavigationHeader.tsx +111 -0
  67. package/navigation/navigation-fullscreen/NavigationFullscreenButton.css +32 -0
  68. package/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +44 -0
  69. package/navigation/navigation-fullscreen/initNavigationFullscreen.ts +116 -0
  70. package/package.json +38 -53
  71. package/parseEmojis.ts +35 -0
  72. package/parseTitle.ts +139 -0
  73. package/renderer/client.ts +4 -0
  74. package/renderer/onRenderHtml.tsx +69 -0
  75. package/renderer/usePageContext.tsx +25 -0
  76. package/tsconfig.config.json +7 -0
  77. package/tsconfig.json +15 -0
  78. package/types/Config.ts +46 -0
  79. package/types/Heading.ts +49 -0
  80. package/utils/Emoji/Emoji.ts +224 -0
  81. package/utils/Emoji/assets.ts +9 -0
  82. package/utils/Emoji/index.ts +1 -0
  83. package/utils/Emoji/mountain.svg +1 -0
  84. package/utils/assert.ts +51 -0
  85. package/utils/client.ts +2 -0
  86. package/utils/determineSectionUrlHash.ts +44 -0
  87. package/utils/filesystemPathHandling.ts +42 -0
  88. package/utils/filter.ts +12 -0
  89. package/utils/isBrowser.ts +5 -0
  90. package/utils/jsxToTextContent.ts +11 -0
  91. package/utils/objectAssign.ts +9 -0
  92. package/utils/server.ts +7 -0
  93. package/vite.config.ts +36 -0
  94. package/bin.js +0 -3
  95. package/dist/chunk-2ZTPUQGS.js +0 -58
  96. package/dist/chunk-3QC7HYIF.js +0 -7
  97. package/dist/chunk-MGOI4AFO.js +0 -165
  98. package/dist/chunk-NVJING6T.js +0 -91
  99. package/dist/chunk-QWL3MA4E.js +0 -171
  100. package/dist/chunk-UN23G34B.js +0 -157
  101. package/dist/cli/index.d.ts +0 -1
  102. package/dist/cli/index.js +0 -34
  103. package/dist/components/features/FeatureList.d.ts +0 -13
  104. package/dist/components/features/FeatureList.js +0 -7
  105. package/dist/components/features/initFeatureList.d.ts +0 -3
  106. package/dist/components/features/initFeatureList.js +0 -59
  107. package/dist/devServer-JKH6U5PF.js +0 -36
  108. package/dist/index.css +0 -120
  109. package/dist/index.d.ts +0 -221
  110. package/dist/index.js +0 -947
  111. package/dist/renderer/_default.page.client.css +0 -318
  112. package/dist/renderer/_default.page.client.d.ts +0 -1
  113. package/dist/renderer/_default.page.client.js +0 -218
  114. package/dist/renderer/_default.page.server.css +0 -310
  115. package/dist/renderer/_default.page.server.d.ts +0 -22
  116. package/dist/renderer/_default.page.server.js +0 -665
  117. package/readme.md +0 -5
  118. /package/{dist/chevron-R2IYJD62.svg → components/FeatureList/chevron.svg} +0 -0
  119. /package/{dist/label-MP75CTIA.svg → components/Sponsors/label.svg} +0 -0
  120. /package/{dist/medalBronze-CO4CTUR4.svg → components/Sponsors/medalBronze.svg} +0 -0
  121. /package/{dist/medalGold-UP6A73FL.svg → components/Sponsors/medalGold.svg} +0 -0
  122. /package/{dist/medalSilver-FAPGGOBN.svg → components/Sponsors/medalSilver.svg} +0 -0
  123. /package/{dist/Inter-Var-IOAEQULN.ttf → css/Inter-Var.ttf} +0 -0
  124. /package/{dist/alignable-B4QZV4X7.svg → data/sponsorsList/companyLogos/alignable.svg} +0 -0
  125. /package/{dist/bluefin-JQABZFGV.svg → data/sponsorsList/companyLogos/bluefin.svg} +0 -0
  126. /package/{dist/burdaforward-EUGURYZY.png → data/sponsorsList/companyLogos/burdaforward.png} +0 -0
  127. /package/{dist/contra-WLZBOPBV.svg → data/sponsorsList/companyLogos/contra.svg} +0 -0
  128. /package/{dist/ecosia-OYRLTR5T.svg → data/sponsorsList/companyLogos/ecosia.svg} +0 -0
  129. /package/{dist/inlang-GFRWND6X.png → data/sponsorsList/companyLogos/inlang.png} +0 -0
  130. /package/{dist/optimizers-SFEZF3NW.svg → data/sponsorsList/companyLogos/optimizers.svg} +0 -0
  131. /package/{dist/sourcegraph-YR2HADLS.svg → data/sponsorsList/companyLogos/sourcegraph.svg} +0 -0
  132. /package/{dist/changelog-IPI5F42D.svg → icons/changelog.svg} +0 -0
  133. /package/{dist/discord-JD33TUSF.svg → icons/discord.svg} +0 -0
  134. /package/{dist/github-P5ZSKN2N.svg → icons/github.svg} +0 -0
  135. /package/{dist/heart-OINVKOXO.svg → icons/heart.svg} +0 -0
  136. /package/{dist/languages-KXPKJFQL.svg → icons/languages.svg} +0 -0
  137. /package/{dist/people-72KKQHU4.svg → icons/people.svg} +0 -0
  138. /package/{dist/twitter-I7DXDN3J.svg → icons/twitter.svg} +0 -0
  139. /package/{dist/chevron-K3WPYLOP.svg → navigation/navigation-fullscreen/chevron.svg} +0 -0
  140. /package/{dist/close-IQXTDOHV.svg → navigation/navigation-fullscreen/close.svg} +0 -0
  141. /package/{dist/compass-2RWQU3E4.svg → utils/Emoji/compass.svg} +0 -0
  142. /package/{dist/engine-6Q6VSCVA.png → utils/Emoji/engine.png} +0 -0
  143. /package/{dist/mechanical-arm-TR7IQQMG.svg → utils/Emoji/mechanical-arm.svg} +0 -0
  144. /package/{dist/road-fork-3WZLW3HB.svg → utils/Emoji/road-fork.svg} +0 -0
  145. /package/{dist/shield-CU45RG5C.svg → utils/Emoji/shield.svg} +0 -0
  146. /package/{dist/typescript-ALIPKLRM.svg → utils/Emoji/typescript.svg} +0 -0
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export * from './assert'
2
+ export * from './isBrowser'
@@ -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
+ }
@@ -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,5 @@
1
+ export { isBrowser }
2
+
3
+ function isBrowser() {
4
+ return typeof window !== 'undefined'
5
+ }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ export { objectAssign }
2
+
3
+ // Same as `Object.assign()` but with type inference
4
+ function objectAssign<Obj extends Object, ObjAddendum>(
5
+ obj: Obj,
6
+ objAddendum: ObjAddendum
7
+ ): asserts obj is Obj & ObjAddendum {
8
+ Object.assign(obj, objAddendum)
9
+ }
@@ -0,0 +1,7 @@
1
+ export * from './client'
2
+ export * from './isBrowser'
3
+ export * from './filter'
4
+ export * from './determineSectionUrlHash'
5
+ export * from './jsxToTextContent'
6
+ export * from './objectAssign'
7
+ export * from './Emoji'
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
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import './dist/cli/index.js'
@@ -1,58 +0,0 @@
1
- // src/utils/assert.ts
2
- function assert(condition, debugInfo) {
3
- if (condition) {
4
- return;
5
- }
6
- const hasDebugInfo = debugInfo !== void 0;
7
- if (hasDebugInfo) {
8
- console.log(debugInfo);
9
- if (typeof debugInfo === "object") {
10
- debugInfo = JSON.stringify(debugInfo);
11
- }
12
- }
13
- let errMsg = "[DocPress] Bug. Contact DocPress maintainer.";
14
- if (hasDebugInfo) {
15
- errMsg += " Debug info: " + String(debugInfo);
16
- }
17
- const err = new Error(errMsg);
18
- if (isBrowserAndDev()) {
19
- alert(err.stack);
20
- }
21
- throw err;
22
- }
23
- function assertUsage(condition, msg) {
24
- if (condition) {
25
- return;
26
- }
27
- const err = new Error("[DocPress][Wrong Usage] " + msg);
28
- if (isBrowserAndDev()) {
29
- alert(err.stack);
30
- }
31
- throw err;
32
- }
33
- function isBrowserAndDev() {
34
- var _a;
35
- return typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.port) !== "";
36
- }
37
- function assertWarning(condition, msg) {
38
- if (condition) {
39
- return;
40
- }
41
- msg = "[DocPress][Warning] " + msg;
42
- console.warn(msg);
43
- if (isBrowserAndDev()) {
44
- alert(msg);
45
- }
46
- }
47
-
48
- // src/utils/isBrowser.ts
49
- function isBrowser() {
50
- return typeof window !== "undefined";
51
- }
52
-
53
- export {
54
- assert,
55
- assertUsage,
56
- assertWarning,
57
- isBrowser
58
- };
@@ -1,7 +0,0 @@
1
- var __freeze = Object.freeze;
2
- var __defProp = Object.defineProperty;
3
- var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
4
-
5
- export {
6
- __template
7
- };
@@ -1,165 +0,0 @@
1
- import {
2
- Emoji
3
- } from "./chunk-UN23G34B.js";
4
- import {
5
- assert
6
- } from "./chunk-2ZTPUQGS.js";
7
-
8
- // src/components/RepoLink.tsx
9
- import React2 from "react";
10
-
11
- // src/renderer/usePageContext.tsx
12
- import React, { useContext } from "react";
13
- var Context = React.createContext(void 0);
14
- function PageContextProvider({
15
- pageContext,
16
- children
17
- }) {
18
- return /* @__PURE__ */ React.createElement(Context.Provider, {
19
- value: pageContext
20
- }, children);
21
- }
22
- function usePageContext() {
23
- const pageContext = useContext(Context);
24
- return pageContext;
25
- }
26
-
27
- // src/components/RepoLink.tsx
28
- function isRepoLink(href) {
29
- return ["/examples/", "/docs/", "/boilerplates/", ".github/", "/test/"].some((start) => href.startsWith(start));
30
- }
31
- function RepoLink({ path, text, editMode }) {
32
- const pageContext = usePageContext();
33
- assert(isRepoLink(path), { path });
34
- text = text || path;
35
- if (!path.startsWith("/")) {
36
- path = "/" + path;
37
- }
38
- const viewMode = path.endsWith("/") || editMode ? "tree" : "blob";
39
- const { githubRepository } = pageContext.config.projectInfo;
40
- assert(githubRepository.startsWith("https://github.com/"));
41
- const href = `${githubRepository}/${viewMode}/main${path}`;
42
- return /* @__PURE__ */ React2.createElement("a", {
43
- href
44
- }, text);
45
- }
46
-
47
- // src/parseTitle.ts
48
- import React3 from "react";
49
- function getHeadingsWithProcessedTitle(config) {
50
- const headingsWithoutBreadcrumb = config.headings.map(
51
- (heading) => {
52
- const titleProcessed = parseTitle(heading.title);
53
- const titleInNav = heading.titleInNav || heading.title;
54
- let titleInNavProcessed;
55
- titleInNavProcessed = parseTitle(titleInNav);
56
- if ("titleEmoji" in heading) {
57
- assert(heading.titleEmoji);
58
- titleInNavProcessed = withEmoji(heading.titleEmoji, titleInNavProcessed);
59
- }
60
- const headingProcessed = {
61
- ...heading,
62
- title: titleProcessed,
63
- titleInNav: titleInNavProcessed
64
- };
65
- return headingProcessed;
66
- }
67
- );
68
- const headingsProcessed = [];
69
- headingsWithoutBreadcrumb.forEach((heading) => {
70
- const headingsBreadcrumb = getHeadingsBreadcrumb(heading, headingsProcessed);
71
- headingsProcessed.push({
72
- ...heading,
73
- headingsBreadcrumb
74
- });
75
- });
76
- const headingsDetachedProcessed = config.headingsDetached.map((headingsDetached) => {
77
- const { url, title } = headingsDetached;
78
- assert(
79
- headingsProcessed.find((heading) => heading.url === url) === void 0,
80
- `remove ${headingsDetached.url} from headingsDetached`
81
- );
82
- const titleProcessed = typeof title === "string" ? parseTitle(title) : title;
83
- return {
84
- ...headingsDetached,
85
- level: 2,
86
- title: titleProcessed,
87
- titleInNav: titleProcessed,
88
- headingsBreadcrumb: null
89
- };
90
- });
91
- assertHeadingsUrl([...headingsProcessed, ...headingsDetachedProcessed]);
92
- return { headingsProcessed, headingsDetachedProcessed };
93
- }
94
- function getHeadingsBreadcrumb(heading, headings) {
95
- const headingsBreadcrumb = [];
96
- let levelCurrent = heading.level;
97
- headings.slice().reverse().forEach((parentCandidate) => {
98
- const isParent = parentCandidate.level < levelCurrent;
99
- if (isParent) {
100
- levelCurrent = parentCandidate.level;
101
- headingsBreadcrumb.push(parentCandidate);
102
- }
103
- });
104
- return headingsBreadcrumb;
105
- }
106
- function assertHeadingsUrl(headings) {
107
- headings.forEach((heading) => {
108
- if (heading.url) {
109
- const { url } = heading;
110
- assert(url.startsWith("/"));
111
- }
112
- });
113
- }
114
- function parseTitle(title) {
115
- const parts = [];
116
- let current;
117
- title.split("").forEach((letter) => {
118
- if (letter === "`") {
119
- if ((current == null ? void 0 : current.nodeType) === "code") {
120
- parts.push(current);
121
- current = void 0;
122
- } else {
123
- if (current) {
124
- parts.push(current);
125
- }
126
- current = { nodeType: "code", content: "" };
127
- }
128
- } else {
129
- if (!current) {
130
- current = { nodeType: "text", content: "" };
131
- }
132
- current.content += letter;
133
- }
134
- });
135
- if (current) {
136
- parts.push(current);
137
- }
138
- const titleJsx = React3.createElement(
139
- React3.Fragment,
140
- {},
141
- ...parts.map(
142
- (part, i) => React3.createElement(part.nodeType === "code" ? "code" : React3.Fragment, { key: i }, part.content)
143
- )
144
- );
145
- return titleJsx;
146
- }
147
- function withEmoji(name, title) {
148
- const style = { fontSize: "1.4em" };
149
- return React3.createElement(
150
- "span",
151
- { style },
152
- Emoji({ name }),
153
- " ",
154
- React3.createElement("span", { style: { fontSize: "1rem" } }, title)
155
- );
156
- }
157
-
158
- export {
159
- PageContextProvider,
160
- usePageContext,
161
- isRepoLink,
162
- RepoLink,
163
- getHeadingsWithProcessedTitle,
164
- parseTitle
165
- };
@@ -1,91 +0,0 @@
1
- // src/components/features/FeatureList.tsx
2
- import React from "react";
3
-
4
- // src/components/features/chevron.svg
5
- var chevron_default = "/assets/chevron-R2IYJD62.svg";
6
-
7
- // src/components/features/FeatureList.tsx
8
- function FeatureList({ features }) {
9
- const numberOfFeatures = features.length;
10
- const numberOfRows = Math.ceil(numberOfFeatures / 2);
11
- return /* @__PURE__ */ React.createElement("div", {
12
- id: "features"
13
- }, Array.from({ length: numberOfRows }, (_, i) => {
14
- const feature1Id = 2 * i + 0;
15
- const feature2Id = 2 * i + 1;
16
- const feature1 = features[feature1Id];
17
- const feature2 = features[feature2Id];
18
- const className = ["features-row", feature2 ? "" : "single-column"].filter(Boolean).join(" ");
19
- return /* @__PURE__ */ React.createElement("div", {
20
- className,
21
- key: i
22
- }, /* @__PURE__ */ React.createElement(Feature, {
23
- ...{ ...feature1, featureId: feature1Id }
24
- }), feature2 && /* @__PURE__ */ React.createElement(Feature, {
25
- ...{ ...feature2, featureId: feature2Id }
26
- }));
27
- }));
28
- }
29
- function Feature({ title, desc, learnMore, isSecondaryFeature, featureId }) {
30
- const name = `feature-${featureId}`;
31
- const rightSide = featureId % 2 === 1;
32
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FeatureHead, {
33
- name,
34
- hasLearnMore: !!learnMore,
35
- isSecondaryFeature
36
- }, " ", /* @__PURE__ */ React.createElement("h2", null, title), desc), !!learnMore && /* @__PURE__ */ React.createElement(LearnMore, {
37
- name,
38
- rightSide
39
- }, learnMore));
40
- }
41
- function FeatureHead({
42
- children,
43
- name,
44
- hasLearnMore,
45
- isSecondaryFeature,
46
- className = ""
47
- }) {
48
- return /* @__PURE__ */ React.createElement("summary", {
49
- className: [
50
- className,
51
- "feature",
52
- "colorize-on-hover",
53
- hasLearnMore && "has-learn-more",
54
- isSecondaryFeature && "secondary-feature"
55
- ].filter(Boolean).join(" "),
56
- id: name && `feature-${name}`,
57
- style: { cursor: hasLearnMore && "pointer" || void 0 }
58
- }, children, hasLearnMore && /* @__PURE__ */ React.createElement("div", {
59
- style: { textAlign: "center", marginTop: "1em" }
60
- }, /* @__PURE__ */ React.createElement("button", {
61
- type: "button",
62
- style: {
63
- textAlign: "center",
64
- padding: "0 7px",
65
- paddingTop: 3,
66
- paddingBottom: 1,
67
- display: "inline-block",
68
- fontSize: "10px",
69
- textTransform: "uppercase",
70
- letterSpacing: "1px",
71
- fontWeight: 600
72
- }
73
- }, /* @__PURE__ */ React.createElement("span", {
74
- className: "decolorize-5"
75
- }, "Learn more"), /* @__PURE__ */ React.createElement("br", null), /* @__PURE__ */ React.createElement("img", {
76
- className: "decolorize-4 chevron",
77
- src: chevron_default,
78
- height: "7",
79
- style: { marginTop: 2 }
80
- }))));
81
- }
82
- function LearnMore({ children, name, rightSide }) {
83
- return /* @__PURE__ */ React.createElement("aside", {
84
- className: "learn-more " + (rightSide ? "right-side" : ""),
85
- id: `learn-more-${name}`
86
- }, children);
87
- }
88
-
89
- export {
90
- FeatureList
91
- };