@brillout/docpress 0.16.12 → 0.16.13
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 +2 -2
- package/EditLink.tsx +3 -3
- package/ExternalLinks.tsx +1 -1
- package/Layout.tsx +15 -14
- package/MenuModal/Collapsible.tsx +1 -1
- package/MenuModal/NavigationWithColumnLayout.tsx +11 -11
- package/MenuModal/toggleMenuModal.ts +4 -4
- package/MenuModal.tsx +12 -8
- package/NavItemComponent.tsx +4 -3
- package/code-blocks/components/ChoiceGroup.css +6 -11
- package/code-blocks/components/ChoiceGroup.tsx +18 -19
- package/code-blocks/components/Pre.tsx +1 -1
- package/code-blocks/hooks/useSelectedChoice.ts +1 -1
- package/code-blocks/remarkChoiceGroup.ts +3 -5
- package/code-blocks/remarkDetype.ts +2 -3
- package/code-blocks/remarkPkgManager.ts +3 -1
- package/code-blocks/shikiTransformerAutoLinks.ts +2 -2
- package/code-blocks/utils/generateChoiceGroupCode.ts +40 -21
- package/components/Algolia/Hit.tsx +3 -3
- package/components/CodeBlockTransformer.tsx +1 -1
- package/components/Comment.tsx +1 -1
- package/components/HorizontalLine.tsx +1 -1
- package/components/ImportMeta.tsx +1 -1
- package/components/Link.tsx +5 -5
- package/components/Note.tsx +1 -1
- package/components/RepoLink.tsx +1 -1
- package/components/index.ts +10 -10
- package/css/index.css +1 -1
- package/determineNavItemsColumnLayout.spec.ts +2 -2
- package/determineNavItemsColumnLayout.ts +6 -6
- package/dist/+config.d.ts +2 -2
- package/dist/NavItemComponent.js +2 -2
- package/dist/code-blocks/rehypeMetaToProps.js +1 -1
- package/dist/code-blocks/remarkChoiceGroup.js +4 -6
- package/dist/code-blocks/remarkDetype.js +3 -3
- package/dist/code-blocks/remarkPkgManager.js +4 -2
- package/dist/code-blocks/utils/generateChoiceGroupCode.d.ts +2 -2
- package/dist/code-blocks/utils/generateChoiceGroupCode.js +35 -18
- package/dist/components/CodeBlockTransformer.js +1 -1
- package/dist/components/Comment.d.ts +1 -3
- package/dist/components/Comment.js +1 -1
- package/dist/components/HorizontalLine.js +1 -1
- package/dist/components/ImportMeta.js +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Link.js +3 -3
- package/dist/components/Note.js +2 -2
- package/dist/components/RepoLink.js +1 -1
- package/dist/components/index.d.ts +10 -10
- package/dist/components/index.js +10 -10
- package/dist/determineNavItemsColumnLayout.d.ts +1 -1
- package/dist/determineNavItemsColumnLayout.js +3 -2
- package/dist/renderer/usePageContext.d.ts +3 -3
- package/dist/renderer/usePageContext.js +1 -1
- package/dist/resolvePageContext.d.ts +2 -2
- package/dist/resolvePageContext.js +5 -5
- package/dist/types/Config.d.ts +1 -1
- package/dist/utils/Emoji/Emoji.js +2 -2
- package/dist/utils/Emoji/index.d.ts +1 -1
- package/dist/utils/Emoji/index.js +1 -1
- package/dist/utils/client.d.ts +3 -3
- package/dist/utils/client.js +3 -3
- package/dist/utils/jsxToTextContent.js +1 -1
- package/dist/utils/server.d.ts +7 -7
- package/dist/utils/server.js +7 -7
- package/docsearch/DocSearchInstall.tsx +3 -3
- package/docsearch/SearchLink.tsx +2 -2
- package/docsearch/toggleDocsearchModal.ts +1 -1
- package/index.ts +10 -10
- package/initKeyBindings.ts +2 -2
- package/installSectionUrlHashs.ts +1 -1
- package/package.json +1 -1
- package/parsePageSections.ts +2 -2
- package/renderer/getHydrationPromise.ts +2 -2
- package/renderer/getPageElement.tsx +3 -3
- package/renderer/initOnNavigation.ts +3 -3
- package/renderer/onCreatePageContext.ts +1 -1
- package/renderer/onRenderClient.tsx +9 -9
- package/renderer/onRenderHtml.tsx +3 -3
- package/renderer/usePageContext.tsx +1 -1
- package/resolvePageContext.ts +10 -10
- package/tsconfig.json +20 -12
- package/types/Config.ts +1 -1
- package/utils/Emoji/Emoji.ts +2 -2
- package/utils/Emoji/index.ts +1 -1
- package/utils/addScript.ts +1 -1
- package/utils/client.ts +3 -3
- package/utils/determineSectionUrlHash.ts +2 -2
- package/utils/jsxToTextContent.ts +1 -1
- package/utils/server.ts +7 -7
package/components/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from '../utils/Emoji'
|
|
2
|
-
export * from './Link'
|
|
3
|
-
export * from './RepoLink'
|
|
4
|
-
export * from './P'
|
|
5
|
-
export * from './Note'
|
|
6
|
-
export * from './ImportMeta'
|
|
7
|
-
export * from './HorizontalLine'
|
|
8
|
-
export * from './CodeBlockTransformer'
|
|
9
|
-
export * from './Comment'
|
|
10
|
-
export * from './FileRemoved'
|
|
1
|
+
export * from '../utils/Emoji/index.js'
|
|
2
|
+
export * from './Link.js'
|
|
3
|
+
export * from './RepoLink.js'
|
|
4
|
+
export * from './P.js'
|
|
5
|
+
export * from './Note.js'
|
|
6
|
+
export * from './ImportMeta.js'
|
|
7
|
+
export * from './HorizontalLine.js'
|
|
8
|
+
export * from './CodeBlockTransformer.js'
|
|
9
|
+
export * from './Comment.js'
|
|
10
|
+
export * from './FileRemoved.js'
|
package/css/index.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import { determineNavItemsColumnLayout } from './determineNavItemsColumnLayout'
|
|
3
|
-
import type { NavItem } from './NavItemComponent'
|
|
2
|
+
import { determineNavItemsColumnLayout } from './determineNavItemsColumnLayout.js'
|
|
3
|
+
import type { NavItem } from './NavItemComponent.js'
|
|
4
4
|
|
|
5
5
|
describe('determineNavItemsColumnLayout', () => {
|
|
6
6
|
it('should handle simple non-fullWidth categories', () => {
|
|
@@ -3,8 +3,8 @@ export { determineNavItemsColumnLayout }
|
|
|
3
3
|
// A CSS-only solution doesn't seem to exist.
|
|
4
4
|
// - https://github.com/brillout/docpress/blob/2e41d8b9df098ff8312b02f7e9d41a202548e2b9/src/renderer/getStyleColumnLayout.ts#L4-L26
|
|
5
5
|
|
|
6
|
-
import type { NavItem } from './NavItemComponent'
|
|
7
|
-
import { assert
|
|
6
|
+
import type { NavItem } from './NavItemComponent.js'
|
|
7
|
+
import { assert } from './utils/assert.js'
|
|
8
8
|
|
|
9
9
|
function determineNavItemsColumnLayout(navItems: NavItem[]): undefined {
|
|
10
10
|
const columnLayouts = getColumnEntries(navItems)
|
|
@@ -16,7 +16,7 @@ function determineNavItemsColumnLayout(navItems: NavItem[]): undefined {
|
|
|
16
16
|
)
|
|
17
17
|
columnEntries.forEach((columnEntry, i) => {
|
|
18
18
|
columnEntry.navItemLeader.isPotentialColumn ??= {}
|
|
19
|
-
columnEntry.navItemLeader.isPotentialColumn[numberOfColumns] = columnMapping[i]
|
|
19
|
+
columnEntry.navItemLeader.isPotentialColumn[numberOfColumns] = columnMapping[i]!
|
|
20
20
|
})
|
|
21
21
|
}
|
|
22
22
|
})
|
|
@@ -91,7 +91,7 @@ function getColumnEntries(navItems: NavItem[]) {
|
|
|
91
91
|
numberOfHeadings = navItemNext.numberOfHeadings
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
columnEntries.push({ navItemLeader: navItems[i]
|
|
94
|
+
columnEntries.push({ navItemLeader: navItems[i]!, numberOfEntries: numberOfHeadings })
|
|
95
95
|
}
|
|
96
96
|
})
|
|
97
97
|
assert(columnEntries!)
|
|
@@ -123,8 +123,8 @@ function mergeColumns(columnsMerging: ColumnMerging[], numberOfColumns: number):
|
|
|
123
123
|
|
|
124
124
|
let mergeCandidate: null | (ColumnMerging & { i: number }) = null
|
|
125
125
|
for (let i = 0; i <= columnsMerging.length - 2; i++) {
|
|
126
|
-
const column1 = columnsMerging[i + 0]
|
|
127
|
-
const column2 = columnsMerging[i + 1]
|
|
126
|
+
const column1 = columnsMerging[i + 0]!
|
|
127
|
+
const column2 = columnsMerging[i + 1]!
|
|
128
128
|
const heightTotal = column1.heightTotal + column2.heightTotal
|
|
129
129
|
if (!mergeCandidate || mergeCandidate.heightTotal > heightTotal) {
|
|
130
130
|
mergeCandidate = {
|
package/dist/+config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { config as default };
|
|
2
|
-
import type { Config as DocpressConfig } from './types/Config';
|
|
3
|
-
import type { PageSection } from './parsePageSections';
|
|
2
|
+
import type { Config as DocpressConfig } from './types/Config.js';
|
|
3
|
+
import type { PageSection } from './parsePageSections.js';
|
|
4
4
|
import type { Resolved } from './resolvePageContext.js';
|
|
5
5
|
declare const config: {
|
|
6
6
|
name: string;
|
package/dist/NavItemComponent.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { NavItemComponent };
|
|
2
2
|
export { getNavItemsWithComputed };
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { assert, assertWarning, jsxToTextContent } from './utils/server';
|
|
4
|
+
import { assert, assertWarning, jsxToTextContent } from './utils/server.js';
|
|
5
5
|
import './NavItemComponent.css';
|
|
6
|
-
import { parseMarkdownMini } from './parseMarkdownMini';
|
|
6
|
+
import { parseMarkdownMini } from './parseMarkdownMini.js';
|
|
7
7
|
function NavItemComponent({ navItem, onClick, }) {
|
|
8
8
|
assert([1, 2, 3, 4].includes(navItem.level), navItem);
|
|
9
9
|
const titleJsx = parseMarkdownMini(navItem.title);
|
|
@@ -21,7 +21,7 @@ function rehypeMetaToProps() {
|
|
|
21
21
|
visit(tree, 'element', (node, _index, parent) => {
|
|
22
22
|
if (node.tagName === 'code' && parent?.type === 'element' && parent.tagName === 'pre') {
|
|
23
23
|
const meta = parseMetaString(node.data?.meta);
|
|
24
|
-
parent.properties
|
|
24
|
+
parent.properties ?? (parent.properties = {});
|
|
25
25
|
parent.properties = { ...parent.properties, ...meta.props };
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -12,14 +12,14 @@ function remarkChoiceGroup() {
|
|
|
12
12
|
const { choice } = meta.props;
|
|
13
13
|
node.meta = meta.rest;
|
|
14
14
|
if (choice)
|
|
15
|
-
node.data
|
|
15
|
+
node.data ?? (node.data = { customDataChoice: choice, customDataFilter: `code-${node.lang}` });
|
|
16
16
|
}
|
|
17
17
|
if (node.type === 'containerDirective' && node.name === 'Choice') {
|
|
18
18
|
if (!node.attributes)
|
|
19
19
|
return;
|
|
20
20
|
const { id: choice } = node.attributes;
|
|
21
21
|
if (choice) {
|
|
22
|
-
node.data
|
|
22
|
+
node.data ?? (node.data = { customDataChoice: choice, customDataFilter: node.type });
|
|
23
23
|
node.attributes = {};
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -28,8 +28,6 @@ function remarkChoiceGroup() {
|
|
|
28
28
|
visit(tree, (node) => {
|
|
29
29
|
if (!('children' in node) || replaced.has(node))
|
|
30
30
|
return 'skip';
|
|
31
|
-
if (node.type === 'mdxJsxFlowElement')
|
|
32
|
-
return 'skip';
|
|
33
31
|
let start = -1;
|
|
34
32
|
let end = 0;
|
|
35
33
|
const process = () => {
|
|
@@ -39,10 +37,10 @@ function remarkChoiceGroup() {
|
|
|
39
37
|
const choiceNodesFiltered = filterChoices(nodes);
|
|
40
38
|
const replacements = [];
|
|
41
39
|
for (const choiceNodes of choiceNodesFiltered) {
|
|
42
|
-
const replacement = generateChoiceGroupCode(choiceNodes);
|
|
40
|
+
const replacement = generateChoiceGroupCode(choiceNodes, node);
|
|
43
41
|
replacements.push(replacement);
|
|
44
|
-
replaced.add(replacement);
|
|
45
42
|
}
|
|
43
|
+
replaced.add(replacements);
|
|
46
44
|
node.children.splice(start, end - start, ...replacements);
|
|
47
45
|
end = start;
|
|
48
46
|
start = -1;
|
|
@@ -60,7 +60,7 @@ function transformYaml(node) {
|
|
|
60
60
|
];
|
|
61
61
|
const replacement = generateChoiceGroupCode(choiceNodes);
|
|
62
62
|
replacement.attributes.push({ type: 'mdxJsxAttribute', name: 'hide' });
|
|
63
|
-
replacement.data
|
|
63
|
+
replacement.data ?? (replacement.data = { customDataChoice: choice, customDataFilter: 'codeLang' });
|
|
64
64
|
parent.children.splice(index, 1, replacement);
|
|
65
65
|
}
|
|
66
66
|
async function transformTsToJs(node, file) {
|
|
@@ -69,7 +69,7 @@ async function transformTsToJs(node, file) {
|
|
|
69
69
|
const maxWidth = Number(meta.props['max-width']);
|
|
70
70
|
const { choice } = meta.props;
|
|
71
71
|
codeBlock.meta = meta.rest;
|
|
72
|
-
codeBlock.data
|
|
72
|
+
codeBlock.data ?? (codeBlock.data = { customDataChoice: choice, customDataFilter: 'codeLang' });
|
|
73
73
|
if (choice === 'TypeScript')
|
|
74
74
|
return;
|
|
75
75
|
let codeBlockReplacedJs = replaceFileNameSuffixes(codeBlock.value);
|
|
@@ -126,7 +126,7 @@ async function transformTsToJs(node, file) {
|
|
|
126
126
|
if (codeBlockReplacedJs === codeBlockContentJs) {
|
|
127
127
|
replacement.attributes.push({ type: 'mdxJsxAttribute', name: 'hide' });
|
|
128
128
|
}
|
|
129
|
-
replacement.data
|
|
129
|
+
replacement.data ?? (replacement.data = { ...data });
|
|
130
130
|
parent.children.splice(index, 1, replacement);
|
|
131
131
|
}
|
|
132
132
|
// Replace all '.ts' extensions with '.js'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { remarkPkgManager };
|
|
2
2
|
import { visit } from 'unist-util-visit';
|
|
3
|
-
import
|
|
3
|
+
import convert_ from 'npm-to-yarn';
|
|
4
4
|
import { parseMetaString } from './rehypeMetaToProps.js';
|
|
5
5
|
import { generateChoiceGroupCode } from './utils/generateChoiceGroupCode.js';
|
|
6
|
+
// @ts-expect-error The type of npm-to-yarn doesn't work with `"moduleResolution": "Node16"`
|
|
7
|
+
const convert = convert_;
|
|
6
8
|
const PKG_MANAGERS = ['pnpm', 'Bun', 'Yarn'];
|
|
7
9
|
function remarkPkgManager() {
|
|
8
10
|
return function (tree) {
|
|
@@ -32,7 +34,7 @@ function remarkPkgManager() {
|
|
|
32
34
|
}
|
|
33
35
|
const choiceNodes = [...nodes].map(([name, node]) => ({ choiceValue: name, children: [node] }));
|
|
34
36
|
const replacement = generateChoiceGroupCode(choiceNodes);
|
|
35
|
-
replacement.data
|
|
37
|
+
replacement.data ?? (replacement.data = { customDataChoice: choice, customDataFilter: replacement.type });
|
|
36
38
|
parent.children.splice(index, 1, replacement);
|
|
37
39
|
});
|
|
38
40
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { generateChoiceGroupCode };
|
|
2
2
|
export type { ChoiceNode };
|
|
3
|
-
import type { BlockContent, DefinitionContent } from 'mdast';
|
|
3
|
+
import type { BlockContent, DefinitionContent, Parent } from 'mdast';
|
|
4
4
|
import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
5
5
|
type ChoiceNode = {
|
|
6
6
|
choiceValue: string;
|
|
7
7
|
children: (BlockContent | DefinitionContent)[];
|
|
8
8
|
};
|
|
9
|
-
declare function generateChoiceGroupCode(choiceNodes: ChoiceNode[]): MdxJsxFlowElement;
|
|
9
|
+
declare function generateChoiceGroupCode(choiceNodes: ChoiceNode[], parent?: Parent): MdxJsxFlowElement;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
export { generateChoiceGroupCode };
|
|
2
|
-
function generateChoiceGroupCode(choiceNodes) {
|
|
2
|
+
function generateChoiceGroupCode(choiceNodes, parent) {
|
|
3
3
|
const attributes = [];
|
|
4
4
|
const children = [];
|
|
5
|
-
const elements = choiceNodes.map((choiceNode) => ({
|
|
6
|
-
type: 'Literal',
|
|
7
|
-
value: findVisibleJsDropdown(choiceNode.children[0])
|
|
8
|
-
? `${choiceNode.choiceValue}:jsDropdown`
|
|
9
|
-
: choiceNode.choiceValue,
|
|
10
|
-
}));
|
|
11
5
|
attributes.push({
|
|
12
6
|
type: 'mdxJsxAttribute',
|
|
13
7
|
name: 'choices',
|
|
@@ -25,7 +19,10 @@ function generateChoiceGroupCode(choiceNodes) {
|
|
|
25
19
|
expression: {
|
|
26
20
|
type: 'ArrayExpression',
|
|
27
21
|
// @ts-ignore: Missing properties in type definition
|
|
28
|
-
elements
|
|
22
|
+
elements: choiceNodes.map((choiceNode) => ({
|
|
23
|
+
type: 'Literal',
|
|
24
|
+
value: choiceNode.choiceValue,
|
|
25
|
+
})),
|
|
29
26
|
},
|
|
30
27
|
},
|
|
31
28
|
],
|
|
@@ -33,7 +30,29 @@ function generateChoiceGroupCode(choiceNodes) {
|
|
|
33
30
|
},
|
|
34
31
|
},
|
|
35
32
|
});
|
|
33
|
+
let initLvl;
|
|
34
|
+
switch (parent?.type) {
|
|
35
|
+
case 'root':
|
|
36
|
+
initLvl = 0;
|
|
37
|
+
break;
|
|
38
|
+
case 'mdxJsxFlowElement':
|
|
39
|
+
initLvl = 1;
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
initLvl = 0;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
attributes.push({ type: 'mdxJsxAttribute', name: 'lvl', value: `${initLvl}` });
|
|
36
46
|
for (const choiceNode of choiceNodes) {
|
|
47
|
+
const choiceChildren = [];
|
|
48
|
+
if (choiceNode.children.every((node) => node.type === 'containerDirective')) {
|
|
49
|
+
choiceChildren.push(...choiceNode.children.flatMap((node) => [...node.children]));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
choiceChildren.push(...choiceNode.children);
|
|
53
|
+
}
|
|
54
|
+
for (const child of choiceChildren)
|
|
55
|
+
increaseLvl(child);
|
|
37
56
|
children.push({
|
|
38
57
|
type: 'mdxJsxFlowElement',
|
|
39
58
|
name: 'div',
|
|
@@ -41,9 +60,7 @@ function generateChoiceGroupCode(choiceNodes) {
|
|
|
41
60
|
{ type: 'mdxJsxAttribute', name: 'data-choice-value', value: choiceNode.choiceValue },
|
|
42
61
|
{ type: 'mdxJsxAttribute', name: 'className', value: 'choice' },
|
|
43
62
|
],
|
|
44
|
-
children:
|
|
45
|
-
? choiceNode.children.flatMap((node) => [...node.children])
|
|
46
|
-
: choiceNode.children,
|
|
63
|
+
children: choiceChildren,
|
|
47
64
|
});
|
|
48
65
|
}
|
|
49
66
|
return {
|
|
@@ -53,11 +70,11 @@ function generateChoiceGroupCode(choiceNodes) {
|
|
|
53
70
|
children,
|
|
54
71
|
};
|
|
55
72
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
function increaseLvl(node) {
|
|
74
|
+
if (node.type === 'mdxJsxFlowElement' && node.name === 'ChoiceGroup') {
|
|
75
|
+
const attribute = node.attributes.find((attribute) => attribute.type === 'mdxJsxAttribute' && attribute.name === 'lvl');
|
|
76
|
+
const lvlValue = attribute?.value;
|
|
77
|
+
if (lvlValue)
|
|
78
|
+
attribute.value = `${Number(lvlValue) + 1}`;
|
|
79
|
+
}
|
|
63
80
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CodeBlockTransformer };
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { assert } from '../utils/server';
|
|
3
|
+
import { assert } from '../utils/server.js';
|
|
4
4
|
import './CodeBlockTransformer.css';
|
|
5
5
|
function CodeBlockTransformer({ children, lineBreak }) {
|
|
6
6
|
assert(lineBreak === 'white-space' || lineBreak === 'break-word', '`lineBreak` is currently the only use case for <CodeBlockTransformer>');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { HorizontalLine };
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { cls } from '../utils/cls';
|
|
3
|
+
import { cls } from '../utils/cls.js';
|
|
4
4
|
function HorizontalLine({ primary }) {
|
|
5
5
|
return (React.createElement("div", { className: cls(primary && 'primary'), style: { textAlign: 'center' } },
|
|
6
6
|
React.createElement("hr", { style: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Link };
|
|
2
2
|
export type { LinkData };
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import type { StringArray } from '../types/Heading';
|
|
4
|
+
import type { StringArray } from '../types/Heading.js';
|
|
5
5
|
declare function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, children, }: {
|
|
6
6
|
href: string;
|
|
7
7
|
text?: string | React.ReactNode;
|
package/dist/components/Link.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { Link };
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { usePageContext } from '../renderer/usePageContext';
|
|
4
|
-
import { assert, assertUsage, assertWarning, determineSectionTitle, determineSectionUrlHash } from '../utils/server';
|
|
5
|
-
import { parseMarkdownMini } from '../parseMarkdownMini';
|
|
3
|
+
import { usePageContext } from '../renderer/usePageContext.js';
|
|
4
|
+
import { assert, assertUsage, assertWarning, determineSectionTitle, determineSectionUrlHash } from '../utils/server.js';
|
|
5
|
+
import { parseMarkdownMini } from '../parseMarkdownMini.js';
|
|
6
6
|
import pc from '@brillout/picocolors';
|
|
7
7
|
function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, children, }) {
|
|
8
8
|
const pageContext = usePageContext();
|
package/dist/components/Note.js
CHANGED
|
@@ -13,7 +13,7 @@ export { NoteWithCustomIcon };
|
|
|
13
13
|
export { Note }
|
|
14
14
|
*/
|
|
15
15
|
import React from 'react';
|
|
16
|
-
import { assert } from '../utils/assert';
|
|
16
|
+
import { assert } from '../utils/assert.js';
|
|
17
17
|
import './Note.css';
|
|
18
18
|
function Warning(props) {
|
|
19
19
|
return React.createElement(NoteGeneric, { type: "warning", ...props });
|
|
@@ -41,7 +41,7 @@ function NoteWithCustomIcon(props) {
|
|
|
41
41
|
}
|
|
42
42
|
function NoteGeneric({ type, icon, iconMargin, children, style, }) {
|
|
43
43
|
assert(icon === null || icon || type, { icon, type });
|
|
44
|
-
iconMargin
|
|
44
|
+
iconMargin ?? (iconMargin = 2);
|
|
45
45
|
let className = 'custom-icon';
|
|
46
46
|
if (type) {
|
|
47
47
|
className = `${className} type-${type}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { RepoLink };
|
|
2
2
|
export { getRepoHref };
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { usePageContext } from '../renderer/usePageContext';
|
|
4
|
+
import { usePageContext } from '../renderer/usePageContext.js';
|
|
5
5
|
function RepoLink({ path, text }) {
|
|
6
6
|
text = text || path;
|
|
7
7
|
const href = getRepoHref(path);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from '../utils/Emoji';
|
|
2
|
-
export * from './Link';
|
|
3
|
-
export * from './RepoLink';
|
|
4
|
-
export * from './P';
|
|
5
|
-
export * from './Note';
|
|
6
|
-
export * from './ImportMeta';
|
|
7
|
-
export * from './HorizontalLine';
|
|
8
|
-
export * from './CodeBlockTransformer';
|
|
9
|
-
export * from './Comment';
|
|
10
|
-
export * from './FileRemoved';
|
|
1
|
+
export * from '../utils/Emoji/index.js';
|
|
2
|
+
export * from './Link.js';
|
|
3
|
+
export * from './RepoLink.js';
|
|
4
|
+
export * from './P.js';
|
|
5
|
+
export * from './Note.js';
|
|
6
|
+
export * from './ImportMeta.js';
|
|
7
|
+
export * from './HorizontalLine.js';
|
|
8
|
+
export * from './CodeBlockTransformer.js';
|
|
9
|
+
export * from './Comment.js';
|
|
10
|
+
export * from './FileRemoved.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from '../utils/Emoji';
|
|
2
|
-
export * from './Link';
|
|
3
|
-
export * from './RepoLink';
|
|
4
|
-
export * from './P';
|
|
5
|
-
export * from './Note';
|
|
6
|
-
export * from './ImportMeta';
|
|
7
|
-
export * from './HorizontalLine';
|
|
8
|
-
export * from './CodeBlockTransformer';
|
|
9
|
-
export * from './Comment';
|
|
10
|
-
export * from './FileRemoved';
|
|
1
|
+
export * from '../utils/Emoji/index.js';
|
|
2
|
+
export * from './Link.js';
|
|
3
|
+
export * from './RepoLink.js';
|
|
4
|
+
export * from './P.js';
|
|
5
|
+
export * from './Note.js';
|
|
6
|
+
export * from './ImportMeta.js';
|
|
7
|
+
export * from './HorizontalLine.js';
|
|
8
|
+
export * from './CodeBlockTransformer.js';
|
|
9
|
+
export * from './Comment.js';
|
|
10
|
+
export * from './FileRemoved.js';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { determineNavItemsColumnLayout };
|
|
2
|
-
import { assert } from './utils/assert';
|
|
2
|
+
import { assert } from './utils/assert.js';
|
|
3
3
|
function determineNavItemsColumnLayout(navItems) {
|
|
4
4
|
const columnLayouts = getColumnEntries(navItems);
|
|
5
5
|
columnLayouts.forEach((columnEntries) => {
|
|
6
6
|
for (let numberOfColumns = columnEntries.length; numberOfColumns >= 1; numberOfColumns--) {
|
|
7
7
|
const columnMapping = determineColumnLayout(columnEntries.map((columnEntry) => columnEntry.numberOfEntries), numberOfColumns);
|
|
8
8
|
columnEntries.forEach((columnEntry, i) => {
|
|
9
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
(_a = columnEntry.navItemLeader).isPotentialColumn ?? (_a.isPotentialColumn = {});
|
|
10
11
|
columnEntry.navItemLeader.isPotentialColumn[numberOfColumns] = columnMapping[i];
|
|
11
12
|
});
|
|
12
13
|
}
|
|
@@ -4,14 +4,14 @@ export { usePageContextLegacy };
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import type { PageContext } from 'vike/types';
|
|
6
6
|
declare function usePageContextLegacy(): {
|
|
7
|
-
navItemsAll: import("../NavItemComponent").NavItem[];
|
|
8
|
-
navItemsDetached: import("../NavItemComponent").NavItem[] | undefined;
|
|
7
|
+
navItemsAll: import("../NavItemComponent.js").NavItem[];
|
|
8
|
+
navItemsDetached: import("../NavItemComponent.js").NavItem[] | undefined;
|
|
9
9
|
pageDesign: {
|
|
10
10
|
hideTitle?: true;
|
|
11
11
|
hideMenuLeft?: true;
|
|
12
12
|
contentMaxWidth?: number;
|
|
13
13
|
} | undefined;
|
|
14
|
-
linksAll: import("../components").LinkData[];
|
|
14
|
+
linksAll: import("../components/Link.js").LinkData[];
|
|
15
15
|
isLandingPage: boolean;
|
|
16
16
|
pageTitle: string | null;
|
|
17
17
|
documentTitle: string;
|
|
@@ -2,7 +2,7 @@ export { PageContextProvider };
|
|
|
2
2
|
export { usePageContext };
|
|
3
3
|
export { usePageContextLegacy };
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
|
-
import { getGlobalObject } from '../utils/getGlobalObject';
|
|
5
|
+
import { getGlobalObject } from '../utils/getGlobalObject.js';
|
|
6
6
|
const globalObject = getGlobalObject('usePageContext.ts', {
|
|
7
7
|
Ctx: React.createContext(undefined),
|
|
8
8
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { resolvePageContext };
|
|
2
2
|
export type Resolved = ReturnType<typeof resolvePageContext>;
|
|
3
|
-
import type { NavItem } from './NavItemComponent';
|
|
4
|
-
import type { LinkData } from './components';
|
|
3
|
+
import type { NavItem } from './NavItemComponent.js';
|
|
4
|
+
import type { LinkData } from './components/index.js';
|
|
5
5
|
import type { PageContextServer } from 'vike/types';
|
|
6
6
|
declare function resolvePageContext(pageContext: PageContextServer): {
|
|
7
7
|
navItemsAll: NavItem[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { resolvePageContext };
|
|
2
|
-
import { assert, assertUsage } from './utils/assert';
|
|
3
|
-
import { jsxToTextContent } from './utils/jsxToTextContent';
|
|
2
|
+
import { assert, assertUsage } from './utils/assert.js';
|
|
3
|
+
import { jsxToTextContent } from './utils/jsxToTextContent.js';
|
|
4
4
|
import pc from '@brillout/picocolors';
|
|
5
|
-
import { parseMarkdownMini } from './parseMarkdownMini';
|
|
6
|
-
import { determineNavItemsColumnLayout } from './determineNavItemsColumnLayout';
|
|
5
|
+
import { parseMarkdownMini } from './parseMarkdownMini.js';
|
|
6
|
+
import { determineNavItemsColumnLayout } from './determineNavItemsColumnLayout.js';
|
|
7
7
|
function resolvePageContext(pageContext) {
|
|
8
8
|
const config = pageContext.globalContext.config.docpress;
|
|
9
9
|
const { urlPathname } = pageContext;
|
|
@@ -106,8 +106,8 @@ function getTitles(activeHeading, urlPathname, config) {
|
|
|
106
106
|
function getActiveHeading(headingsResolved, headingsDetachedResolved, urlPathname) {
|
|
107
107
|
const URLs = '\n' +
|
|
108
108
|
[...headingsResolved, ...headingsDetachedResolved]
|
|
109
|
-
.filter(Boolean)
|
|
110
109
|
.map((h) => h.url)
|
|
110
|
+
.filter(Boolean)
|
|
111
111
|
.sort()
|
|
112
112
|
.map((url) => ` ${url}`)
|
|
113
113
|
.join('\n');
|
package/dist/types/Config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Let's eventually remove this. Telefunc is still using this as of 2024-12.
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { assert } from '../assert';
|
|
4
|
-
import { iconMechanicalArm, iconShield, iconTypescript, iconEngine } from './assets';
|
|
3
|
+
import { assert } from '../assert.js';
|
|
4
|
+
import { iconMechanicalArm, iconShield, iconTypescript, iconEngine } from './assets.js';
|
|
5
5
|
export { Emoji };
|
|
6
6
|
function Emoji({ name, style }) {
|
|
7
7
|
const emoji =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Emoji';
|
|
1
|
+
export * from './Emoji.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Emoji';
|
|
1
|
+
export * from './Emoji.js';
|
package/dist/utils/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './assert';
|
|
2
|
-
export * from './isBrowser';
|
|
3
|
-
export * from './getGlobalObject';
|
|
1
|
+
export * from './assert.js';
|
|
2
|
+
export * from './isBrowser.js';
|
|
3
|
+
export * from './getGlobalObject.js';
|
package/dist/utils/client.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './assert';
|
|
2
|
-
export * from './isBrowser';
|
|
3
|
-
export * from './getGlobalObject';
|
|
1
|
+
export * from './assert.js';
|
|
2
|
+
export * from './isBrowser.js';
|
|
3
|
+
export * from './getGlobalObject.js';
|
package/dist/utils/server.d.ts
CHANGED
|
@@ -1,7 +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';
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './isBrowser.js';
|
|
3
|
+
export * from './filter.js';
|
|
4
|
+
export * from './determineSectionUrlHash.js';
|
|
5
|
+
export * from './jsxToTextContent.js';
|
|
6
|
+
export * from './objectAssign.js';
|
|
7
|
+
export * from './Emoji/index.js';
|
package/dist/utils/server.js
CHANGED
|
@@ -1,7 +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';
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './isBrowser.js';
|
|
3
|
+
export * from './filter.js';
|
|
4
|
+
export * from './determineSectionUrlHash.js';
|
|
5
|
+
export * from './jsxToTextContent.js';
|
|
6
|
+
export * from './objectAssign.js';
|
|
7
|
+
export * from './Emoji/index.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { DocSearchInstall }
|
|
2
2
|
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { usePageContext } from '../renderer/usePageContext'
|
|
4
|
+
import { usePageContext } from '../renderer/usePageContext.js'
|
|
5
5
|
import { DocSearch as DocSearchButton } from '@docsearch/react'
|
|
6
|
-
import { Hit } from '../components/Algolia/Hit'
|
|
6
|
+
import { Hit } from '../components/Algolia/Hit.js'
|
|
7
7
|
|
|
8
8
|
function DocSearchInstall() {
|
|
9
9
|
const pageContext = usePageContext()
|
|
@@ -24,7 +24,7 @@ function DocSearchInstall() {
|
|
|
24
24
|
transformItems={(hits) => {
|
|
25
25
|
hits.map((hit) => {
|
|
26
26
|
if (hit.type === 'lvl1') {
|
|
27
|
-
hit.url = hit.url.split('#')[0]
|
|
27
|
+
hit.url = hit.url.split('#')[0]!
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
30
|
return hits
|