@brillout/docpress 0.11.3 → 0.11.5
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/Layout.tsx +4 -3
- package/components/Algolia/Snippet.tsx +19 -1
- package/components/Algolia/types.ts +2 -2
- package/config/resolveHeadingsData.ts +1 -1
- package/dist/config/resolveHeadingsData.d.ts +5 -1
- package/dist/config/resolveHeadingsData.js +1 -1
- package/dist/config/resolvePageContext.d.ts +5 -1
- package/dist/types/Heading.d.ts +7 -2
- package/package.json +2 -2
- package/types/Heading.ts +8 -2
package/Layout.tsx
CHANGED
|
@@ -86,7 +86,7 @@ function Layout({ children }: { children: React.ReactNode }) {
|
|
|
86
86
|
function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
87
87
|
const pageContext = usePageContext()
|
|
88
88
|
const hideNavLeftAlways =
|
|
89
|
-
pageContext.hideMenuLeft || (pageContext.navItemsDetached && pageContext.navItemsDetached.length <= 1)
|
|
89
|
+
pageContext.pageDesign?.hideMenuLeft || (pageContext.navItemsDetached && pageContext.navItemsDetached.length <= 1)
|
|
90
90
|
return (
|
|
91
91
|
<>
|
|
92
92
|
<Style>{getStyle()}</Style>
|
|
@@ -159,6 +159,7 @@ function PageContent({ children }: { children: React.ReactNode }) {
|
|
|
159
159
|
const pageTitleParsed = pageTitle && parseMarkdownMini(pageTitle)
|
|
160
160
|
const { globalNote } = pageContext.config
|
|
161
161
|
const ifDocPage = (style: React.CSSProperties) => (isLandingPage ? {} : style)
|
|
162
|
+
const contentMaxWidth = pageContext.pageDesign?.contentMaxWidth ?? mainViewWidthMax
|
|
162
163
|
return (
|
|
163
164
|
<div
|
|
164
165
|
className="page-wrapper low-prio-grow"
|
|
@@ -177,14 +178,14 @@ function PageContent({ children }: { children: React.ReactNode }) {
|
|
|
177
178
|
// Also define --main-view-padding for landing page because it's used by <Contributors> and <Sponsors>
|
|
178
179
|
['--main-view-padding']: `${mainViewPadding}px`,
|
|
179
180
|
...ifDocPage({
|
|
180
|
-
width: `calc(${
|
|
181
|
+
width: `calc(${contentMaxWidth}px + 2 * var(--main-view-padding))`,
|
|
181
182
|
maxWidth: '100%',
|
|
182
183
|
padding: '20px var(--main-view-padding)',
|
|
183
184
|
}),
|
|
184
185
|
}}
|
|
185
186
|
>
|
|
186
187
|
{globalNote}
|
|
187
|
-
{pageTitleParsed && (
|
|
188
|
+
{pageTitleParsed && !pageContext.pageDesign?.hideTitle && (
|
|
188
189
|
<div>
|
|
189
190
|
<EditLink className="show-only-on-desktop" style={{ float: 'right', marginTop: 6, padding: 10 }} />
|
|
190
191
|
<h1 id={`${pageContext.urlPathname.replace('/', '')}`}>{pageTitleParsed}</h1>
|
|
@@ -23,10 +23,28 @@ export function Snippet<TItem extends StoredDocSearchHit>({
|
|
|
23
23
|
tagName = 'span',
|
|
24
24
|
...rest
|
|
25
25
|
}: SnippetProps<TItem>) {
|
|
26
|
+
let title = ''
|
|
27
|
+
let lvl2 = ''
|
|
28
|
+
|
|
29
|
+
if (!hit.__docsearch_parent && hit.type !== 'lvl1' && attribute !== 'content') {
|
|
30
|
+
if (hit.type === 'content') {
|
|
31
|
+
const lvl0 =
|
|
32
|
+
getPropertyByPath(hit, `_snippetResult.hierarchy.lvl0.value`) || getPropertyByPath(hit, 'hierarchy.lvl0')
|
|
33
|
+
title = lvl0 ? `${lvl0} > ` : ''
|
|
34
|
+
|
|
35
|
+
lvl2 = getPropertyByPath(hit, `_snippetResult.hierarchy.lvl2.value`) || getPropertyByPath(hit, 'hierarchy.lvl2')
|
|
36
|
+
lvl2 = lvl2 ? ` > ${lvl2}` : ''
|
|
37
|
+
} else {
|
|
38
|
+
const lvl1 =
|
|
39
|
+
getPropertyByPath(hit, `_snippetResult.hierarchy.lvl1.value`) || getPropertyByPath(hit, 'hierarchy.lvl1')
|
|
40
|
+
title = lvl1 ? `${lvl1} > ` : ''
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
return createElement(tagName, {
|
|
27
45
|
...rest,
|
|
28
46
|
dangerouslySetInnerHTML: {
|
|
29
|
-
__html: getPropertyByPath(hit, `_snippetResult.${attribute}.value`) || getPropertyByPath(hit, attribute)
|
|
47
|
+
__html: `${title}${getPropertyByPath(hit, `_snippetResult.${attribute}.value`) || getPropertyByPath(hit, attribute)}${lvl2}`,
|
|
30
48
|
},
|
|
31
49
|
})
|
|
32
50
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type InternalDocSearchHit = DocSearchHit & {
|
|
2
|
-
__docsearch_parent
|
|
2
|
+
__docsearch_parent?: InternalDocSearchHit | null
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
export type StoredDocSearchHit = Omit<
|
|
5
|
+
export type StoredDocSearchHit = Omit<InternalDocSearchHit, '_highlightResult' | '_snippetResult'>
|
|
6
6
|
|
|
7
7
|
type ContentType = 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6'
|
|
8
8
|
|
|
@@ -92,7 +92,7 @@ function resolveHeadingsData(pageContext: PageContextOriginal) {
|
|
|
92
92
|
const pageContextAddendum = {
|
|
93
93
|
navItemsAll,
|
|
94
94
|
navItemsDetached,
|
|
95
|
-
|
|
95
|
+
pageDesign: activeHeading.pageDesign,
|
|
96
96
|
linksAll,
|
|
97
97
|
isLandingPage,
|
|
98
98
|
pageTitle,
|
|
@@ -11,7 +11,11 @@ type ActiveCategory = {
|
|
|
11
11
|
declare function resolveHeadingsData(pageContext: PageContextOriginal): {
|
|
12
12
|
navItemsAll: NavItem[];
|
|
13
13
|
navItemsDetached: NavItem[] | undefined;
|
|
14
|
-
|
|
14
|
+
pageDesign: {
|
|
15
|
+
hideTitle?: true;
|
|
16
|
+
hideMenuLeft?: true;
|
|
17
|
+
contentMaxWidth?: number;
|
|
18
|
+
} | undefined;
|
|
15
19
|
linksAll: LinkData[];
|
|
16
20
|
isLandingPage: boolean;
|
|
17
21
|
pageTitle: string | null;
|
|
@@ -64,7 +64,7 @@ function resolveHeadingsData(pageContext) {
|
|
|
64
64
|
var pageContextAddendum = {
|
|
65
65
|
navItemsAll: navItemsAll,
|
|
66
66
|
navItemsDetached: navItemsDetached,
|
|
67
|
-
|
|
67
|
+
pageDesign: activeHeading.pageDesign,
|
|
68
68
|
linksAll: linksAll,
|
|
69
69
|
isLandingPage: isLandingPage,
|
|
70
70
|
pageTitle: pageTitle,
|
|
@@ -12,7 +12,11 @@ type PageContextResolved = ReturnType<typeof resolvePageContext>;
|
|
|
12
12
|
declare function resolvePageContext(pageContext: PageContextOriginal): {
|
|
13
13
|
navItemsAll: import("../NavItemComponent").NavItem[];
|
|
14
14
|
navItemsDetached: import("../NavItemComponent").NavItem[] | undefined;
|
|
15
|
-
|
|
15
|
+
pageDesign: {
|
|
16
|
+
hideTitle?: true;
|
|
17
|
+
hideMenuLeft?: true;
|
|
18
|
+
contentMaxWidth?: number;
|
|
19
|
+
} | undefined;
|
|
16
20
|
linksAll: import("../components").LinkData[];
|
|
17
21
|
isLandingPage: boolean;
|
|
18
22
|
pageTitle: string | null;
|
package/dist/types/Heading.d.ts
CHANGED
|
@@ -10,12 +10,17 @@ type HeadingResolved = {
|
|
|
10
10
|
linkBreadcrumb: string[];
|
|
11
11
|
sectionTitles?: string[];
|
|
12
12
|
menuModalFullWidth?: true;
|
|
13
|
-
|
|
13
|
+
pageDesign?: PageDesign;
|
|
14
14
|
category?: string;
|
|
15
15
|
color?: string;
|
|
16
16
|
titleIcon?: string;
|
|
17
17
|
titleIconStyle?: React.CSSProperties;
|
|
18
18
|
} & Tmp;
|
|
19
|
+
type PageDesign = {
|
|
20
|
+
hideTitle?: true;
|
|
21
|
+
hideMenuLeft?: true;
|
|
22
|
+
contentMaxWidth?: number;
|
|
23
|
+
};
|
|
19
24
|
type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'> & {
|
|
20
25
|
level: 2;
|
|
21
26
|
linkBreadcrumb: null;
|
|
@@ -23,7 +28,7 @@ type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'>
|
|
|
23
28
|
type HeadingDefinitionCommon = {
|
|
24
29
|
title: string;
|
|
25
30
|
menuModalFullWidth?: true;
|
|
26
|
-
|
|
31
|
+
pageDesign?: PageDesign;
|
|
27
32
|
};
|
|
28
33
|
type HeadingDetachedDefinition = HeadingDefinitionCommon & {
|
|
29
34
|
url: string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brillout/docpress",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@brillout/picocolors": "^1.0.10",
|
|
7
|
-
"@docsearch/css": "
|
|
7
|
+
"@docsearch/css": "3.6.1",
|
|
8
8
|
"@docsearch/react": "3.6.1",
|
|
9
9
|
"@mdx-js/mdx": "3.0.1",
|
|
10
10
|
"@mdx-js/react": "3.0.1",
|
package/types/Heading.ts
CHANGED
|
@@ -11,13 +11,19 @@ type HeadingResolved = {
|
|
|
11
11
|
linkBreadcrumb: string[]
|
|
12
12
|
sectionTitles?: string[]
|
|
13
13
|
menuModalFullWidth?: true
|
|
14
|
-
|
|
14
|
+
pageDesign?: PageDesign
|
|
15
15
|
category?: string
|
|
16
16
|
color?: string
|
|
17
17
|
titleIcon?: string
|
|
18
18
|
titleIconStyle?: React.CSSProperties
|
|
19
19
|
} & Tmp
|
|
20
20
|
|
|
21
|
+
type PageDesign = {
|
|
22
|
+
hideTitle?: true
|
|
23
|
+
hideMenuLeft?: true
|
|
24
|
+
contentMaxWidth?: number
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'> & {
|
|
22
28
|
level: 2
|
|
23
29
|
linkBreadcrumb: null
|
|
@@ -26,7 +32,7 @@ type HeadingDetachedResolved = Omit<HeadingResolved, 'level' | 'linkBreadcrumb'>
|
|
|
26
32
|
type HeadingDefinitionCommon = {
|
|
27
33
|
title: string
|
|
28
34
|
menuModalFullWidth?: true
|
|
29
|
-
|
|
35
|
+
pageDesign?: PageDesign
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
type HeadingDetachedDefinition = HeadingDefinitionCommon & {
|