@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.
Files changed (89) hide show
  1. package/+config.ts +2 -2
  2. package/EditLink.tsx +3 -3
  3. package/ExternalLinks.tsx +1 -1
  4. package/Layout.tsx +15 -14
  5. package/MenuModal/Collapsible.tsx +1 -1
  6. package/MenuModal/NavigationWithColumnLayout.tsx +11 -11
  7. package/MenuModal/toggleMenuModal.ts +4 -4
  8. package/MenuModal.tsx +12 -8
  9. package/NavItemComponent.tsx +4 -3
  10. package/code-blocks/components/ChoiceGroup.css +6 -11
  11. package/code-blocks/components/ChoiceGroup.tsx +18 -19
  12. package/code-blocks/components/Pre.tsx +1 -1
  13. package/code-blocks/hooks/useSelectedChoice.ts +1 -1
  14. package/code-blocks/remarkChoiceGroup.ts +3 -5
  15. package/code-blocks/remarkDetype.ts +2 -3
  16. package/code-blocks/remarkPkgManager.ts +3 -1
  17. package/code-blocks/shikiTransformerAutoLinks.ts +2 -2
  18. package/code-blocks/utils/generateChoiceGroupCode.ts +40 -21
  19. package/components/Algolia/Hit.tsx +3 -3
  20. package/components/CodeBlockTransformer.tsx +1 -1
  21. package/components/Comment.tsx +1 -1
  22. package/components/HorizontalLine.tsx +1 -1
  23. package/components/ImportMeta.tsx +1 -1
  24. package/components/Link.tsx +5 -5
  25. package/components/Note.tsx +1 -1
  26. package/components/RepoLink.tsx +1 -1
  27. package/components/index.ts +10 -10
  28. package/css/index.css +1 -1
  29. package/determineNavItemsColumnLayout.spec.ts +2 -2
  30. package/determineNavItemsColumnLayout.ts +6 -6
  31. package/dist/+config.d.ts +2 -2
  32. package/dist/NavItemComponent.js +2 -2
  33. package/dist/code-blocks/rehypeMetaToProps.js +1 -1
  34. package/dist/code-blocks/remarkChoiceGroup.js +4 -6
  35. package/dist/code-blocks/remarkDetype.js +3 -3
  36. package/dist/code-blocks/remarkPkgManager.js +4 -2
  37. package/dist/code-blocks/utils/generateChoiceGroupCode.d.ts +2 -2
  38. package/dist/code-blocks/utils/generateChoiceGroupCode.js +35 -18
  39. package/dist/components/CodeBlockTransformer.js +1 -1
  40. package/dist/components/Comment.d.ts +1 -3
  41. package/dist/components/Comment.js +1 -1
  42. package/dist/components/HorizontalLine.js +1 -1
  43. package/dist/components/ImportMeta.js +1 -1
  44. package/dist/components/Link.d.ts +1 -1
  45. package/dist/components/Link.js +3 -3
  46. package/dist/components/Note.js +2 -2
  47. package/dist/components/RepoLink.js +1 -1
  48. package/dist/components/index.d.ts +10 -10
  49. package/dist/components/index.js +10 -10
  50. package/dist/determineNavItemsColumnLayout.d.ts +1 -1
  51. package/dist/determineNavItemsColumnLayout.js +3 -2
  52. package/dist/renderer/usePageContext.d.ts +3 -3
  53. package/dist/renderer/usePageContext.js +1 -1
  54. package/dist/resolvePageContext.d.ts +2 -2
  55. package/dist/resolvePageContext.js +5 -5
  56. package/dist/types/Config.d.ts +1 -1
  57. package/dist/utils/Emoji/Emoji.js +2 -2
  58. package/dist/utils/Emoji/index.d.ts +1 -1
  59. package/dist/utils/Emoji/index.js +1 -1
  60. package/dist/utils/client.d.ts +3 -3
  61. package/dist/utils/client.js +3 -3
  62. package/dist/utils/jsxToTextContent.js +1 -1
  63. package/dist/utils/server.d.ts +7 -7
  64. package/dist/utils/server.js +7 -7
  65. package/docsearch/DocSearchInstall.tsx +3 -3
  66. package/docsearch/SearchLink.tsx +2 -2
  67. package/docsearch/toggleDocsearchModal.ts +1 -1
  68. package/index.ts +10 -10
  69. package/initKeyBindings.ts +2 -2
  70. package/installSectionUrlHashs.ts +1 -1
  71. package/package.json +1 -1
  72. package/parsePageSections.ts +2 -2
  73. package/renderer/getHydrationPromise.ts +2 -2
  74. package/renderer/getPageElement.tsx +3 -3
  75. package/renderer/initOnNavigation.ts +3 -3
  76. package/renderer/onCreatePageContext.ts +1 -1
  77. package/renderer/onRenderClient.tsx +9 -9
  78. package/renderer/onRenderHtml.tsx +3 -3
  79. package/renderer/usePageContext.tsx +1 -1
  80. package/resolvePageContext.ts +10 -10
  81. package/tsconfig.json +20 -12
  82. package/types/Config.ts +1 -1
  83. package/utils/Emoji/Emoji.ts +2 -2
  84. package/utils/Emoji/index.ts +1 -1
  85. package/utils/addScript.ts +1 -1
  86. package/utils/client.ts +3 -3
  87. package/utils/determineSectionUrlHash.ts +2 -2
  88. package/utils/jsxToTextContent.ts +1 -1
  89. package/utils/server.ts +7 -7
@@ -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
@@ -7,4 +7,4 @@
7
7
  @import './code.css';
8
8
  @import './table.css';
9
9
  @import './tooltip.css';
10
- @import '@docsearch/css';
10
+ @import '@docsearch/css/dist/style.css';
@@ -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, assertUsage } from './utils/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], numberOfEntries: numberOfHeadings })
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;
@@ -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 ??= { customDataChoice: choice, customDataFilter: `code-${node.lang}` };
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 ??= { customDataChoice: choice, customDataFilter: node.type };
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 ??= { customDataChoice: choice, customDataFilter: 'codeLang' };
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 ??= { customDataChoice: choice, customDataFilter: 'codeLang' };
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 ??= { ...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 convert from 'npm-to-yarn';
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 ??= { customDataChoice: choice, customDataFilter: replacement.type };
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: choiceNode.children.every((node) => node.type === 'containerDirective')
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 findVisibleJsDropdown(node) {
57
- let currentNode = node;
58
- if (node.type === 'containerDirective' && node.name === 'Choice')
59
- currentNode = node.children[0];
60
- return (currentNode.type === 'mdxJsxFlowElement' &&
61
- currentNode.data?.customDataFilter === 'codeLang' &&
62
- currentNode.attributes.every((attribute) => attribute.type !== 'mdxJsxAttribute' || attribute.name !== 'hide'));
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,5 +1,3 @@
1
1
  export { Comment };
2
2
  import React from 'react';
3
- declare function Comment({ children }: {
4
- children: React.ReactNode;
5
- }): React.JSX.Element;
3
+ declare function Comment(): React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export { Comment };
2
2
  import React from 'react';
3
- function Comment({ children }) {
3
+ function Comment() {
4
4
  return React.createElement(React.Fragment, null);
5
5
  }
@@ -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,5 +1,5 @@
1
1
  import React from 'react';
2
- import { assert } from '../utils/server';
2
+ import { assert } from '../utils/server.js';
3
3
  export { ImportMeta };
4
4
  function ImportMeta({ prop }) {
5
5
  assert(!prop.startsWith('import'));
@@ -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;
@@ -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();
@@ -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 ??= 2;
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';
@@ -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,3 +1,3 @@
1
1
  export { determineNavItemsColumnLayout };
2
- import type { NavItem } from './NavItemComponent';
2
+ import type { NavItem } from './NavItemComponent.js';
3
3
  declare function determineNavItemsColumnLayout(navItems: NavItem[]): undefined;
@@ -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
- columnEntry.navItemLeader.isPotentialColumn ??= {};
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');
@@ -1,5 +1,5 @@
1
1
  export type { Config };
2
- import type { HeadingDefinition, HeadingDetachedDefinition } from './Heading';
2
+ import type { HeadingDefinition, HeadingDetachedDefinition } from './Heading.js';
3
3
  type Config = {
4
4
  name: string;
5
5
  version: string;
@@ -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';
@@ -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';
@@ -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';
@@ -1,4 +1,4 @@
1
- import { assert } from './assert';
1
+ import { assert } from './assert.js';
2
2
  export { jsxToTextContent };
3
3
  // https://stackoverflow.com/questions/34204975/react-is-there-something-similar-to-node-textcontent/60564620#60564620
4
4
  function jsxToTextContent(node) {
@@ -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,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