@brillout/docpress 0.6.21 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/+config.ts +26 -3
- package/MobileHeader.tsx +5 -3
- package/PageLayout.tsx +28 -19
- package/algolia/DocSearch.css +6 -9
- package/autoScrollNav.ts +4 -3
- package/components/FeatureList/FeatureList.client.ts +6 -11
- package/components/Link.tsx +9 -9
- package/config/getConfig.ts +2 -1
- package/config/resolveHeadingsData.ts +22 -38
- package/config/resolvePageContext.ts +4 -6
- package/dist/+config.d.ts +25 -3
- package/dist/+config.js +7 -3
- package/dist/components/CodeBlockTransformer.d.ts +7 -0
- package/dist/components/CodeBlockTransformer.js +9 -0
- package/dist/components/Comment.d.ts +5 -0
- package/dist/components/Comment.js +6 -0
- package/dist/components/Consulting.d.ts +4 -0
- package/dist/components/Consulting.js +39 -0
- package/dist/components/Contributors.d.ts +7 -0
- package/dist/components/Contributors.js +74 -0
- package/dist/components/FileRemoved.d.ts +9 -0
- package/dist/components/FileRemoved.js +28 -0
- package/dist/components/HorizontalLine.d.ts +5 -0
- package/dist/components/HorizontalLine.js +15 -0
- package/dist/components/ImportMeta.d.ts +5 -0
- package/dist/components/ImportMeta.js +10 -0
- package/dist/components/Link.d.ts +16 -0
- package/dist/components/Link.js +108 -0
- package/dist/components/Note.d.ts +22 -0
- package/dist/components/Note.js +93 -0
- package/dist/components/P.d.ts +4 -0
- package/dist/components/P.js +17 -0
- package/dist/components/ReadingRecommendation.d.ts +6 -0
- package/dist/components/ReadingRecommendation.js +40 -0
- package/dist/components/RepoLink.d.ts +9 -0
- package/dist/components/RepoLink.js +22 -0
- package/dist/components/Sponsors.d.ts +22 -0
- package/dist/components/Sponsors.js +161 -0
- package/dist/components/Supporters.d.ts +32 -0
- package/dist/components/Supporters.js +80 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/index.js +15 -0
- package/dist/config/getConfig.d.ts +3 -0
- package/dist/config/getConfig.js +14 -0
- package/dist/config/resolveHeadingsData.d.ts +16 -0
- package/dist/config/resolveHeadingsData.js +216 -0
- package/dist/config/resolvePageContext.d.ts +38 -0
- package/dist/config/resolvePageContext.js +23 -0
- package/dist/data/maintainersList.d.ts +9 -0
- package/dist/data/maintainersList.js +83 -0
- package/dist/data/sponsorsList.d.ts +3 -0
- package/dist/data/sponsorsList.js +151 -0
- package/dist/navigation/Navigation.d.ts +20 -0
- package/dist/navigation/Navigation.js +134 -0
- package/dist/navigation/NavigationHeader.d.ts +4 -0
- package/dist/navigation/NavigationHeader.js +85 -0
- package/dist/navigation/navigation-fullscreen/NavigationFullscreenButton.d.ts +6 -0
- package/dist/navigation/navigation-fullscreen/NavigationFullscreenButton.js +22 -0
- package/dist/parsePageSections.js +7 -3
- package/dist/parseTitle.d.ts +5 -0
- package/dist/parseTitle.js +52 -0
- package/dist/renderer/usePageContext.d.ts +17 -0
- package/dist/renderer/usePageContext.js +26 -0
- package/dist/types/Config.d.ts +30 -0
- package/dist/types/Config.js +1 -0
- package/dist/types/Heading.d.ts +43 -0
- package/dist/types/Heading.js +1 -0
- package/dist/utils/Emoji/Emoji.d.ts +8 -0
- package/dist/utils/Emoji/Emoji.js +191 -0
- package/dist/utils/Emoji/assets.d.ts +6 -0
- package/dist/utils/Emoji/assets.js +7 -0
- package/dist/utils/Emoji/index.d.ts +1 -0
- package/dist/utils/Emoji/index.js +1 -0
- package/dist/utils/assert.js +43 -8
- package/dist/utils/client.d.ts +2 -0
- package/dist/utils/client.js +2 -0
- package/dist/utils/filter.d.ts +2 -0
- package/dist/utils/filter.js +11 -0
- package/dist/utils/isBrowser.d.ts +2 -0
- package/dist/utils/isBrowser.js +4 -0
- package/dist/utils/jsxToTextContent.d.ts +2 -0
- package/dist/utils/jsxToTextContent.js +12 -0
- package/dist/utils/objectAssign.d.ts +2 -0
- package/dist/utils/objectAssign.js +5 -0
- package/dist/utils/server.d.ts +7 -0
- package/dist/utils/server.js +7 -0
- package/dist/vite.config.js +5 -3
- package/installSectionUrlHashs.ts +7 -13
- package/navigation/Navigation.tsx +28 -19
- package/navigation/NavigationHeader.tsx +33 -4
- package/navigation/initMobileNavigation.ts +2 -11
- package/navigation/initPressKit.ts +5 -2
- package/navigation/navigation-fullscreen/initNavigationFullscreen.ts +12 -5
- package/package.json +21 -15
- package/parsePageSections.ts +6 -1
- package/renderer/getPageElement.tsx +16 -0
- package/renderer/onBeforeRender.ts +12 -0
- package/renderer/onRenderClient.tsx +90 -0
- package/renderer/onRenderHtml.tsx +10 -22
- package/renderer/usePageContext.tsx +20 -0
- package/tsconfig.config.json +1 -1
- package/tsconfig.json +1 -1
- package/types/Config.ts +6 -20
- package/types/Heading.ts +5 -5
- package/utils/assert.ts +44 -8
- package/utils/jsxToTextContent.ts +1 -1
- package/vite.config.ts +5 -3
- package/algolia/DocSearch.ts +0 -62
- package/navigation/Navigation.client.ts +0 -7
- package/renderer/client.ts +0 -4
package/algolia/DocSearch.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export { getDocSearchCSS }
|
|
2
|
-
export { getDocSearchJS }
|
|
3
|
-
|
|
4
|
-
import { dangerouslySkipEscape, escapeInject } from 'vike/server'
|
|
5
|
-
import { PageContextResolved } from '../config/resolvePageContext'
|
|
6
|
-
/* Imorted in /src/css/index.css instead
|
|
7
|
-
import './DocSearch.css'
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
function getDocSearchCSS(pageContext: PageContextResolved) {
|
|
11
|
-
const docSearchCSS = !pageContext.meta.algolia
|
|
12
|
-
? ''
|
|
13
|
-
: escapeInject`
|
|
14
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@alpha" />
|
|
15
|
-
`
|
|
16
|
-
return docSearchCSS
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getDocSearchJS(pageContext: PageContextResolved) {
|
|
20
|
-
const { algolia } = pageContext.meta
|
|
21
|
-
// If the docpress website doesn't use algolia => we don't inject the algolia assets => the search icon wrapper stays empty
|
|
22
|
-
// If algolia is PENDING_APPROVAL => we fill a FAKE API key so that the algolia popup shows (while no results are shown).
|
|
23
|
-
// - We show an alert warning users that there aren't any results until algolia's approval is pending (see below).
|
|
24
|
-
let docSearchJS = !algolia
|
|
25
|
-
? ''
|
|
26
|
-
: escapeInject`
|
|
27
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"></script>
|
|
28
|
-
<script type="text/javascript">
|
|
29
|
-
const appId = '${algolia.appId || 'FAKE'}';
|
|
30
|
-
const apiKey = '${algolia.apiKey || 'FAKE'}';
|
|
31
|
-
const indexName = '${algolia.indexName || 'FAKE'}';
|
|
32
|
-
const transformItems = ${dangerouslySkipEscape(getTransformItems())};
|
|
33
|
-
docsearch({
|
|
34
|
-
container: '#docsearch-desktop',
|
|
35
|
-
appId, apiKey, indexName, transformItems,
|
|
36
|
-
insights: true,
|
|
37
|
-
});
|
|
38
|
-
</script>
|
|
39
|
-
`
|
|
40
|
-
if (algolia?.PENDING_APPROVAL) {
|
|
41
|
-
docSearchJS = escapeInject`
|
|
42
|
-
${docSearchJS}
|
|
43
|
-
<script>document.getElementById('docsearch-desktop').addEventListener('click', () => window.alert("Algolia approval is pending: the search results may be empty until the approval process is completed."))</script>
|
|
44
|
-
`
|
|
45
|
-
}
|
|
46
|
-
return docSearchJS
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Remove superfluous hash '#page-content' from URLs pointing to whole pages
|
|
50
|
-
// - https://github.com/algolia/docsearch/issues/1801
|
|
51
|
-
// - https://discourse.algolia.com/t/how-to-avoid-hash-in-search-result-url/6486
|
|
52
|
-
// - https://discourse.algolia.com/t/docsearchs-transformdata-function-cannot-remove-hashes-from-result-urls/8487
|
|
53
|
-
function getTransformItems() {
|
|
54
|
-
return `function(hits) {
|
|
55
|
-
hits.map(hit => {
|
|
56
|
-
if (hit.url.indexOf('#page-content') > 0) {
|
|
57
|
-
hit.url = hit.url.replace('#page-content', '');
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
return hits;
|
|
61
|
-
}`
|
|
62
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { initNavigationFullscreen } from './navigation-fullscreen/initNavigationFullscreen'
|
|
2
|
-
import { initMobileNavigation } from './initMobileNavigation'
|
|
3
|
-
import { initPressKit } from './initPressKit'
|
|
4
|
-
|
|
5
|
-
initNavigationFullscreen()
|
|
6
|
-
initMobileNavigation()
|
|
7
|
-
initPressKit()
|
package/renderer/client.ts
DELETED