Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@clack/prompts": "^0.11.0",
"@heroicons/react": "^2.2.0",
"@node-core/rehype-shiki": "1.3.0",
"@node-core/ui-components": "1.5.3",
"@node-core/ui-components": "1.5.6",
"@orama/orama": "^3.1.18",
"@orama/ui": "^1.5.4",
"@rollup/plugin-virtual": "^3.0.2",
Expand Down
1 change: 1 addition & 0 deletions src/generators/jsx-ast/utils/buildBarProps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const extractHeading = entry => {
value: heading,
stability: parseInt(entry.stability?.children[0]?.data.index ?? 2),
slug: data.slug,
data: { id: data.slug },
};
};

Expand Down
19 changes: 13 additions & 6 deletions src/generators/jsx-ast/utils/buildContent.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ export const processEntry = (entry, remark) => {
/**
* Builds the overall document layout tree
* @param {Array<ApiDocMetadataEntry>} entries - API documentation metadata entries
* @param {Record<string, any>} sideBarProps - Props for the sidebar component
* @param {Record<string, any>} metaBarProps - Props for the meta bar component
* @param {ReturnType<import('./buildBarProps.mjs').buildSideBarProps>} sideBarProps - Props for the sidebar component
* @param {ReturnType<buildMetaBarProps>} metaBarProps - Props for the meta bar component
* @param {import('unified').Processor} remark - The remark processor
*/
export const createDocumentLayout = (
Expand All @@ -274,10 +274,17 @@ export const createDocumentLayout = (
children: [
createJSXElement(JSX_IMPORTS.SideBar.name, sideBarProps),
createElement('div', [
createElement(
'main',
entries.map(entry => processEntry(entry, remark))
),
createElement('div', [
createJSXElement(JSX_IMPORTS.TableOfContents.name, {
headings: metaBarProps.headings,
summaryTitle: 'On this page',
}),
createElement('br'),
createElement(
'main',
entries.map(entry => processEntry(entry, remark))
),
]),
createJSXElement(JSX_IMPORTS.MetaBar.name, metaBarProps),
]),
],
Expand Down
5 changes: 4 additions & 1 deletion src/generators/web/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const ROOT = dirname(fileURLToPath(import.meta.url));
*/

/**
* @type {Record<string, JSXImportConfig>}
* An object containing mappings for various JSX components to their import paths.
*/
export const JSX_IMPORTS = {
Expand Down Expand Up @@ -50,6 +49,10 @@ export const JSX_IMPORTS = {
isDefaultExport: false,
source: '@node-core/ui-components/MDX/Tooltip',
},
TableOfContents: {
name: 'TableOfContents',
source: '@node-core/ui-components/Common/TableOfContents',
},
ChangeHistory: {
name: 'ChangeHistory',
source: '@node-core/ui-components/Common/ChangeHistory',
Expand Down
3 changes: 1 addition & 2 deletions src/generators/web/ui/components/MetaBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default ({
<MetaBar
heading="Table of Contents"
headings={{
items: headings.map(({ slug, value, stability, ...heading }) => ({
items: headings.map(({ value, stability, ...heading }) => ({
...heading,
value:
stability !== 2 ? (
Expand All @@ -53,7 +53,6 @@ export default ({
) : (
value
),
data: { id: slug },
})),
}}
items={{
Expand Down
Loading