@depup/nextra 4.6.1-depup.0

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 (293) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/changes.json +110 -0
  4. package/dist/client/components/banner/close-banner-button.d.ts +8 -0
  5. package/dist/client/components/banner/close-banner-button.js +45 -0
  6. package/dist/client/components/banner/index.client.d.ts +5 -0
  7. package/dist/client/components/banner/index.client.js +46 -0
  8. package/dist/client/components/banner/index.d.ts +51 -0
  9. package/dist/client/components/banner/index.js +93 -0
  10. package/dist/client/components/bleed.d.ts +63 -0
  11. package/dist/client/components/bleed.js +54 -0
  12. package/dist/client/components/button.d.ts +9 -0
  13. package/dist/client/components/button.js +55 -0
  14. package/dist/client/components/callout.d.ts +136 -0
  15. package/dist/client/components/callout.js +99 -0
  16. package/dist/client/components/cards.d.ts +104 -0
  17. package/dist/client/components/cards.js +132 -0
  18. package/dist/client/components/collapse.d.ts +12 -0
  19. package/dist/client/components/collapse.js +143 -0
  20. package/dist/client/components/file-tree/file.d.ts +9 -0
  21. package/dist/client/components/file-tree/file.js +43 -0
  22. package/dist/client/components/file-tree/folder.d.ts +12 -0
  23. package/dist/client/components/file-tree/folder.js +94 -0
  24. package/dist/client/components/file-tree/index.d.ts +57 -0
  25. package/dist/client/components/file-tree/index.js +12 -0
  26. package/dist/client/components/file-tree/tree.d.ts +5 -0
  27. package/dist/client/components/file-tree/tree.js +41 -0
  28. package/dist/client/components/head.d.ts +139 -0
  29. package/dist/client/components/head.js +202 -0
  30. package/dist/client/components/image-zoom.d.ts +6 -0
  31. package/dist/client/components/image-zoom.js +79 -0
  32. package/dist/client/components/index.d.ts +56 -0
  33. package/dist/client/components/index.js +42 -0
  34. package/dist/client/components/playground.d.ts +90 -0
  35. package/dist/client/components/playground.js +103 -0
  36. package/dist/client/components/popup/index.client.d.ts +7 -0
  37. package/dist/client/components/popup/index.client.js +83 -0
  38. package/dist/client/components/popup/index.d.ts +12 -0
  39. package/dist/client/components/popup/index.js +11 -0
  40. package/dist/client/components/search.d.ts +88 -0
  41. package/dist/client/components/search.js +426 -0
  42. package/dist/client/components/select.d.ts +19 -0
  43. package/dist/client/components/select.js +109 -0
  44. package/dist/client/components/skip-nav/index.client.d.ts +5 -0
  45. package/dist/client/components/skip-nav/index.client.js +45 -0
  46. package/dist/client/components/skip-nav/index.d.ts +6 -0
  47. package/dist/client/components/skip-nav/index.js +24 -0
  48. package/dist/client/components/steps.d.ts +64 -0
  49. package/dist/client/components/steps.js +74 -0
  50. package/dist/client/components/tabs/index.client.d.ts +21 -0
  51. package/dist/client/components/tabs/index.client.js +243 -0
  52. package/dist/client/components/tabs/index.d.ts +53 -0
  53. package/dist/client/components/tabs/index.js +9 -0
  54. package/dist/client/evaluate.d.ts +30 -0
  55. package/dist/client/evaluate.js +17 -0
  56. package/dist/client/hocs/index.d.ts +4 -0
  57. package/dist/client/hocs/index.js +6 -0
  58. package/dist/client/hocs/with-github-alert.d.ts +11 -0
  59. package/dist/client/hocs/with-github-alert.js +30 -0
  60. package/dist/client/hocs/with-icons.d.ts +6 -0
  61. package/dist/client/hocs/with-icons.js +76 -0
  62. package/dist/client/hooks/index.d.ts +4 -0
  63. package/dist/client/hooks/index.js +10 -0
  64. package/dist/client/hooks/use-copy.d.ts +9 -0
  65. package/dist/client/hooks/use-copy.js +77 -0
  66. package/dist/client/hooks/use-fs-route.d.ts +3 -0
  67. package/dist/client/hooks/use-fs-route.js +20 -0
  68. package/dist/client/hooks/use-hash.d.ts +3 -0
  69. package/dist/client/hooks/use-hash.js +20 -0
  70. package/dist/client/hooks/use-mounted.d.ts +3 -0
  71. package/dist/client/hooks/use-mounted.js +13 -0
  72. package/dist/client/icons/arrow-right.d.ts +5 -0
  73. package/dist/client/icons/arrow-right.js +24 -0
  74. package/dist/client/icons/chatgpt.d.ts +2 -0
  75. package/dist/client/icons/chatgpt.js +24 -0
  76. package/dist/client/icons/check.d.ts +2 -0
  77. package/dist/client/icons/check.js +24 -0
  78. package/dist/client/icons/claude.d.ts +2 -0
  79. package/dist/client/icons/claude.js +81 -0
  80. package/dist/client/icons/copy.d.ts +2 -0
  81. package/dist/client/icons/copy.js +31 -0
  82. package/dist/client/icons/cpp.d.ts +2 -0
  83. package/dist/client/icons/cpp.js +24 -0
  84. package/dist/client/icons/cross-circled.d.ts +2 -0
  85. package/dist/client/icons/cross-circled.js +24 -0
  86. package/dist/client/icons/csharp.d.ts +2 -0
  87. package/dist/client/icons/csharp.js +24 -0
  88. package/dist/client/icons/css.d.ts +2 -0
  89. package/dist/client/icons/css.js +24 -0
  90. package/dist/client/icons/discord.d.ts +2 -0
  91. package/dist/client/icons/discord.js +24 -0
  92. package/dist/client/icons/expand.d.ts +2 -0
  93. package/dist/client/icons/expand.js +31 -0
  94. package/dist/client/icons/file.d.ts +2 -0
  95. package/dist/client/icons/file.js +24 -0
  96. package/dist/client/icons/folder-open.d.ts +2 -0
  97. package/dist/client/icons/folder-open.js +24 -0
  98. package/dist/client/icons/folder.d.ts +2 -0
  99. package/dist/client/icons/folder.js +24 -0
  100. package/dist/client/icons/github-caution.d.ts +2 -0
  101. package/dist/client/icons/github-caution.js +24 -0
  102. package/dist/client/icons/github-important.d.ts +2 -0
  103. package/dist/client/icons/github-important.js +24 -0
  104. package/dist/client/icons/github-note.d.ts +2 -0
  105. package/dist/client/icons/github-note.js +24 -0
  106. package/dist/client/icons/github-tip.d.ts +2 -0
  107. package/dist/client/icons/github-tip.js +24 -0
  108. package/dist/client/icons/github-warning.d.ts +2 -0
  109. package/dist/client/icons/github-warning.js +24 -0
  110. package/dist/client/icons/github.d.ts +2 -0
  111. package/dist/client/icons/github.js +24 -0
  112. package/dist/client/icons/globe.d.ts +2 -0
  113. package/dist/client/icons/globe.js +24 -0
  114. package/dist/client/icons/go.d.ts +2 -0
  115. package/dist/client/icons/go.js +46 -0
  116. package/dist/client/icons/graphql.d.ts +2 -0
  117. package/dist/client/icons/graphql.js +56 -0
  118. package/dist/client/icons/index.d.ts +2 -0
  119. package/dist/client/icons/index.js +92 -0
  120. package/dist/client/icons/javascript.d.ts +2 -0
  121. package/dist/client/icons/javascript.js +24 -0
  122. package/dist/client/icons/json.d.ts +2 -0
  123. package/dist/client/icons/json.js +41 -0
  124. package/dist/client/icons/link-arrow.d.ts +2 -0
  125. package/dist/client/icons/link-arrow.js +31 -0
  126. package/dist/client/icons/link.d.ts +2 -0
  127. package/dist/client/icons/link.js +24 -0
  128. package/dist/client/icons/markdown.d.ts +2 -0
  129. package/dist/client/icons/markdown.js +24 -0
  130. package/dist/client/icons/mdx.d.ts +2 -0
  131. package/dist/client/icons/mdx.js +24 -0
  132. package/dist/client/icons/menu.d.ts +2 -0
  133. package/dist/client/icons/menu.js +36 -0
  134. package/dist/client/icons/moon.d.ts +2 -0
  135. package/dist/client/icons/moon.js +24 -0
  136. package/dist/client/icons/move.d.ts +2 -0
  137. package/dist/client/icons/move.js +24 -0
  138. package/dist/client/icons/python.d.ts +2 -0
  139. package/dist/client/icons/python.js +31 -0
  140. package/dist/client/icons/react.d.ts +2 -0
  141. package/dist/client/icons/react.js +38 -0
  142. package/dist/client/icons/rust.d.ts +2 -0
  143. package/dist/client/icons/rust.js +31 -0
  144. package/dist/client/icons/spinner.d.ts +2 -0
  145. package/dist/client/icons/spinner.js +31 -0
  146. package/dist/client/icons/sun.d.ts +2 -0
  147. package/dist/client/icons/sun.js +24 -0
  148. package/dist/client/icons/svelte.d.ts +2 -0
  149. package/dist/client/icons/svelte.js +31 -0
  150. package/dist/client/icons/terminal.d.ts +2 -0
  151. package/dist/client/icons/terminal.js +24 -0
  152. package/dist/client/icons/terraform.d.ts +2 -0
  153. package/dist/client/icons/terraform.js +24 -0
  154. package/dist/client/icons/typescript.d.ts +2 -0
  155. package/dist/client/icons/typescript.js +24 -0
  156. package/dist/client/icons/word-wrap.d.ts +2 -0
  157. package/dist/client/icons/word-wrap.js +24 -0
  158. package/dist/client/icons/x.d.ts +2 -0
  159. package/dist/client/icons/x.js +24 -0
  160. package/dist/client/mdx-components/anchor.d.ts +10 -0
  161. package/dist/client/mdx-components/anchor.js +109 -0
  162. package/dist/client/mdx-components/code.d.ts +7 -0
  163. package/dist/client/mdx-components/code.js +52 -0
  164. package/dist/client/mdx-components/details.d.ts +5 -0
  165. package/dist/client/mdx-components/details.js +166 -0
  166. package/dist/client/mdx-components/image.d.ts +28 -0
  167. package/dist/client/mdx-components/image.js +39 -0
  168. package/dist/client/mdx-components/index.d.ts +11 -0
  169. package/dist/client/mdx-components/index.js +16 -0
  170. package/dist/client/mdx-components/pre/copy-to-clipboard.d.ts +5 -0
  171. package/dist/client/mdx-components/pre/copy-to-clipboard.js +49 -0
  172. package/dist/client/mdx-components/pre/index.d.ts +16 -0
  173. package/dist/client/mdx-components/pre/index.js +156 -0
  174. package/dist/client/mdx-components/pre/toggle-word-wrap-button.d.ts +7 -0
  175. package/dist/client/mdx-components/pre/toggle-word-wrap-button.js +31 -0
  176. package/dist/client/mdx-components/summary.d.ts +5 -0
  177. package/dist/client/mdx-components/summary.js +80 -0
  178. package/dist/client/mdx-components/table.d.ts +57 -0
  179. package/dist/client/mdx-components/table.js +95 -0
  180. package/dist/client/mdx-components.d.ts +89 -0
  181. package/dist/client/mdx-components.js +15 -0
  182. package/dist/client/mdx-remote.d.ts +62 -0
  183. package/dist/client/mdx-remote.js +36 -0
  184. package/dist/client/normalize-pages.d.ts +84 -0
  185. package/dist/client/normalize-pages.js +232 -0
  186. package/dist/client/package.json +1 -0
  187. package/dist/client/pages.d.ts +131 -0
  188. package/dist/client/pages.js +39 -0
  189. package/dist/client/remove-links.d.ts +6 -0
  190. package/dist/client/remove-links.js +35 -0
  191. package/dist/client/setup-page.d.ts +18 -0
  192. package/dist/client/setup-page.js +14 -0
  193. package/dist/server/compile-metadata.d.ts +12 -0
  194. package/dist/server/compile-metadata.js +39 -0
  195. package/dist/server/compile.d.ts +39 -0
  196. package/dist/server/compile.js +158 -0
  197. package/dist/server/constants.d.ts +15 -0
  198. package/dist/server/constants.js +22 -0
  199. package/dist/server/fetch-filepaths-from-github.d.ts +10 -0
  200. package/dist/server/fetch-filepaths-from-github.js +36 -0
  201. package/dist/server/index.d.ts +39 -0
  202. package/dist/server/index.js +203 -0
  203. package/dist/server/loader.d.ts +18 -0
  204. package/dist/server/loader.js +155 -0
  205. package/dist/server/locales.d.ts +22 -0
  206. package/dist/server/locales.js +38 -0
  207. package/dist/server/page-map/find-meta-and-page-file-paths.d.ts +8 -0
  208. package/dist/server/page-map/find-meta-and-page-file-paths.js +32 -0
  209. package/dist/server/page-map/get.d.ts +50 -0
  210. package/dist/server/page-map/get.js +28 -0
  211. package/dist/server/page-map/index-page.d.ts +21 -0
  212. package/dist/server/page-map/index-page.js +57 -0
  213. package/dist/server/page-map/index.d.ts +26 -0
  214. package/dist/server/page-map/index.js +24 -0
  215. package/dist/server/page-map/merge-meta-with-page-map.d.ts +17 -0
  216. package/dist/server/page-map/merge-meta-with-page-map.js +74 -0
  217. package/dist/server/page-map/normalize.d.ts +17 -0
  218. package/dist/server/page-map/normalize.js +122 -0
  219. package/dist/server/page-map/placeholder.d.ts +2 -0
  220. package/dist/server/page-map/placeholder.js +0 -0
  221. package/dist/server/page-map/to-ast.d.ts +18 -0
  222. package/dist/server/page-map/to-ast.js +47 -0
  223. package/dist/server/page-map/to-js.d.ts +21 -0
  224. package/dist/server/page-map/to-js.js +72 -0
  225. package/dist/server/page-map/to-page-map.d.ts +26 -0
  226. package/dist/server/page-map/to-page-map.js +101 -0
  227. package/dist/server/recma-plugins/index.d.ts +3 -0
  228. package/dist/server/recma-plugins/index.js +4 -0
  229. package/dist/server/recma-plugins/recma-rewrite.d.ts +11 -0
  230. package/dist/server/recma-plugins/recma-rewrite.js +98 -0
  231. package/dist/server/rehype-plugins/index.d.ts +18 -0
  232. package/dist/server/rehype-plugins/index.js +16 -0
  233. package/dist/server/rehype-plugins/rehype-better-react-mathjax.d.ts +24 -0
  234. package/dist/server/rehype-plugins/rehype-better-react-mathjax.js +96 -0
  235. package/dist/server/rehype-plugins/rehype-extract-toc-content.d.ts +6 -0
  236. package/dist/server/rehype-plugins/rehype-extract-toc-content.js +119 -0
  237. package/dist/server/rehype-plugins/rehype-twoslash-popup.d.ts +6 -0
  238. package/dist/server/rehype-plugins/rehype-twoslash-popup.js +50 -0
  239. package/dist/server/rehype-plugins/rehype.d.ts +21 -0
  240. package/dist/server/rehype-plugins/rehype.js +84 -0
  241. package/dist/server/remark-plugins/index.d.ts +15 -0
  242. package/dist/server/remark-plugins/index.js +26 -0
  243. package/dist/server/remark-plugins/remark-assign-frontmatter.d.ts +10 -0
  244. package/dist/server/remark-plugins/remark-assign-frontmatter.js +24 -0
  245. package/dist/server/remark-plugins/remark-custom-heading-id.d.ts +9 -0
  246. package/dist/server/remark-plugins/remark-custom-heading-id.js +18 -0
  247. package/dist/server/remark-plugins/remark-export-only-metadata.d.ts +6 -0
  248. package/dist/server/remark-plugins/remark-export-only-metadata.js +18 -0
  249. package/dist/server/remark-plugins/remark-export-source-code.d.ts +6 -0
  250. package/dist/server/remark-plugins/remark-export-source-code.js +35 -0
  251. package/dist/server/remark-plugins/remark-headings.d.ts +12 -0
  252. package/dist/server/remark-plugins/remark-headings.js +133 -0
  253. package/dist/server/remark-plugins/remark-link-rewrite.d.ts +11 -0
  254. package/dist/server/remark-plugins/remark-link-rewrite.js +12 -0
  255. package/dist/server/remark-plugins/remark-mdx-disable-explicit-jsx.d.ts +10 -0
  256. package/dist/server/remark-plugins/remark-mdx-disable-explicit-jsx.js +10 -0
  257. package/dist/server/remark-plugins/remark-mdx-frontmatter.d.ts +6 -0
  258. package/dist/server/remark-plugins/remark-mdx-frontmatter.js +37 -0
  259. package/dist/server/remark-plugins/remark-mdx-title.d.ts +10 -0
  260. package/dist/server/remark-plugins/remark-mdx-title.js +53 -0
  261. package/dist/server/remark-plugins/remark-remove-imports.d.ts +6 -0
  262. package/dist/server/remark-plugins/remark-remove-imports.js +12 -0
  263. package/dist/server/remark-plugins/remark-static-image.d.ts +6 -0
  264. package/dist/server/remark-plugins/remark-static-image.js +107 -0
  265. package/dist/server/schemas.d.ts +352 -0
  266. package/dist/server/schemas.js +240 -0
  267. package/dist/server/tsdoc/base.d.ts +38 -0
  268. package/dist/server/tsdoc/base.js +284 -0
  269. package/dist/server/tsdoc/index.d.ts +6 -0
  270. package/dist/server/tsdoc/index.js +10 -0
  271. package/dist/server/tsdoc/tsdoc.d.ts +102 -0
  272. package/dist/server/tsdoc/tsdoc.js +262 -0
  273. package/dist/server/tsdoc/types.d.ts +64 -0
  274. package/dist/server/tsdoc/types.js +0 -0
  275. package/dist/server/tsdoc/zod-to-ts.d.ts +5 -0
  276. package/dist/server/tsdoc/zod-to-ts.js +107 -0
  277. package/dist/server/twoslash.d.ts +6 -0
  278. package/dist/server/twoslash.js +60 -0
  279. package/dist/server/utils.d.ts +12 -0
  280. package/dist/server/utils.js +45 -0
  281. package/dist/types.d.ts +128 -0
  282. package/dist/types.generated.d.ts +203 -0
  283. package/dist/types.generated.js +0 -0
  284. package/dist/types.js +0 -0
  285. package/loader.cjs +24 -0
  286. package/package.json +265 -0
  287. package/styles/cards.css +24 -0
  288. package/styles/code-block.css +266 -0
  289. package/styles/default.css +55 -0
  290. package/styles/react-medium-image-zoom.css +101 -0
  291. package/styles/scrollbar.css +14 -0
  292. package/styles/steps.css +22 -0
  293. package/styles/subheading-anchor.css +25 -0
@@ -0,0 +1,57 @@
1
+ import { FC, HTMLAttributes } from 'react';
2
+
3
+ /**
4
+ * A collection of built-in components designed to create styled, non-markdown
5
+ * (i.e., literal) HTML tables.
6
+ *
7
+ * @example
8
+ * <Table className="mt-6">
9
+ * <thead>
10
+ * <Table.Tr>
11
+ * <Table.Th>Country</Table.Th>
12
+ * <Table.Th>Flag</Table.Th>
13
+ * </Table.Tr>
14
+ * </thead>
15
+ * <tbody>
16
+ * <Table.Tr>
17
+ * <Table.Td>France</Table.Td>
18
+ * <Table.Td>🇫🇷</Table.Td>
19
+ * </Table.Tr>
20
+ * <Table.Tr>
21
+ * <Table.Td>Ukraine</Table.Td>
22
+ * <Table.Td>🇺🇦</Table.Td>
23
+ * </Table.Tr>
24
+ * </tbody>
25
+ * </Table>
26
+ *
27
+ * @usage
28
+ * ```mdx
29
+ * import { Table } from 'nextra/components'
30
+ *
31
+ * <Table>
32
+ * <thead>
33
+ * <Table.Tr>
34
+ * <Table.Th>Country</Table.Th>
35
+ * <Table.Th>Flag</Table.Th>
36
+ * </Table.Tr>
37
+ * </thead>
38
+ * <tbody>
39
+ * <Table.Tr>
40
+ * <Table.Td>France</Table.Td>
41
+ * <Table.Td>🇫🇷</Table.Td>
42
+ * </Table.Tr>
43
+ * <Table.Tr>
44
+ * <Table.Td>Ukraine</Table.Td>
45
+ * <Table.Td>🇺🇦</Table.Td>
46
+ * </Table.Tr>
47
+ * </tbody>
48
+ * </Table>
49
+ * ```
50
+ */
51
+ declare const Table: FC<HTMLAttributes<HTMLTableElement>> & {
52
+ Th: FC<HTMLAttributes<HTMLTableCellElement>>;
53
+ Tr: FC<HTMLAttributes<HTMLTableRowElement>>;
54
+ Td: FC<HTMLAttributes<HTMLTableCellElement>>;
55
+ };
56
+
57
+ export { Table };
@@ -0,0 +1,95 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c as _c } from "react-compiler-runtime";
3
+ import cn from "clsx";
4
+ const Table_ = (props) => {
5
+ const $ = _c(5);
6
+ let t0;
7
+ if ($[0] !== props.className) {
8
+ t0 = cn("x:block x:overflow-x-auto", props.className);
9
+ $[0] = props.className;
10
+ $[1] = t0;
11
+ } else {
12
+ t0 = $[1];
13
+ }
14
+ let t1;
15
+ if ($[2] !== props || $[3] !== t0) {
16
+ t1 = /* @__PURE__ */ jsx("table", { ...props, className: t0 });
17
+ $[2] = props;
18
+ $[3] = t0;
19
+ $[4] = t1;
20
+ } else {
21
+ t1 = $[4];
22
+ }
23
+ return t1;
24
+ };
25
+ const Th = (props) => {
26
+ const $ = _c(5);
27
+ let t0;
28
+ if ($[0] !== props.className) {
29
+ t0 = cn("x:m-0 x:border x:border-gray-300 x:px-4 x:py-2 x:font-semibold x:dark:border-gray-600", props.className);
30
+ $[0] = props.className;
31
+ $[1] = t0;
32
+ } else {
33
+ t0 = $[1];
34
+ }
35
+ let t1;
36
+ if ($[2] !== props || $[3] !== t0) {
37
+ t1 = /* @__PURE__ */ jsx("th", { ...props, className: t0 });
38
+ $[2] = props;
39
+ $[3] = t0;
40
+ $[4] = t1;
41
+ } else {
42
+ t1 = $[4];
43
+ }
44
+ return t1;
45
+ };
46
+ const Tr = (props) => {
47
+ const $ = _c(5);
48
+ let t0;
49
+ if ($[0] !== props.className) {
50
+ t0 = cn("x:m-0 x:border-t x:border-gray-300 x:p-0 x:dark:border-gray-600", "x:even:bg-gray-100 x:even:dark:bg-gray-600/20", props.className);
51
+ $[0] = props.className;
52
+ $[1] = t0;
53
+ } else {
54
+ t0 = $[1];
55
+ }
56
+ let t1;
57
+ if ($[2] !== props || $[3] !== t0) {
58
+ t1 = /* @__PURE__ */ jsx("tr", { ...props, className: t0 });
59
+ $[2] = props;
60
+ $[3] = t0;
61
+ $[4] = t1;
62
+ } else {
63
+ t1 = $[4];
64
+ }
65
+ return t1;
66
+ };
67
+ const Td = (props) => {
68
+ const $ = _c(5);
69
+ let t0;
70
+ if ($[0] !== props.className) {
71
+ t0 = cn("x:m-0 x:border x:border-gray-300 x:px-4 x:py-2 x:dark:border-gray-600", props.className);
72
+ $[0] = props.className;
73
+ $[1] = t0;
74
+ } else {
75
+ t0 = $[1];
76
+ }
77
+ let t1;
78
+ if ($[2] !== props || $[3] !== t0) {
79
+ t1 = /* @__PURE__ */ jsx("td", { ...props, className: t0 });
80
+ $[2] = props;
81
+ $[3] = t0;
82
+ $[4] = t1;
83
+ } else {
84
+ t1 = $[4];
85
+ }
86
+ return t1;
87
+ };
88
+ const Table = Object.assign(Table_, {
89
+ Th,
90
+ Tr,
91
+ Td
92
+ });
93
+ export {
94
+ Table
95
+ };
@@ -0,0 +1,89 @@
1
+ import * as url from 'url';
2
+ import * as next_link_js from 'next/link.js';
3
+ import * as react from 'react';
4
+ import { FC, JSX, ComponentPropsWithoutRef } from 'react';
5
+ import * as next_image_js from 'next/image.js';
6
+ import { MDXWrapper } from '../types.js';
7
+ import { ImageZoom } from './components/image-zoom.js';
8
+ import { Anchor } from './mdx-components/anchor.js';
9
+ import 'mdast';
10
+ import 'next';
11
+ import 'zod';
12
+ import '../server/schemas.js';
13
+ import './lib/index.js';
14
+ import 'rehype-katex/lib/index.js';
15
+ import 'better-react-mathjax';
16
+ import 'rehype-pretty-code';
17
+ import '../types.generated.js';
18
+ import '@mdx-js/mdx';
19
+ import 'rehype-katex';
20
+ import 'next/image';
21
+ import 'next/link';
22
+
23
+ /**
24
+ * A valid JSX string component.
25
+ */
26
+ type StringComponent = Exclude<keyof JSX.IntrinsicElements, 'img' | 'a'>;
27
+ /**
28
+ * Any allowed JSX component.
29
+ */
30
+ type Component<Props> = FC<Props> | StringComponent;
31
+ interface NestedMDXComponents {
32
+ [key: string]: NestedMDXComponents | Component<any>;
33
+ }
34
+ /**
35
+ * MDX components may be passed as the `components`.
36
+ *
37
+ * The key is the name of the element to override. The value is the component to render instead.
38
+ */
39
+ type MDXComponents = NestedMDXComponents & {
40
+ [Key in StringComponent]?: FC<ComponentPropsWithoutRef<Key>>;
41
+ } & {
42
+ /**
43
+ * If a wrapper component is defined, the MDX content will be wrapped inside it.
44
+ */
45
+ wrapper?: MDXWrapper;
46
+ } & DefaultMdxComponents;
47
+ type DefaultMdxComponents = {
48
+ /**
49
+ * Nextra's `<ImageZoom />` component with zoom functionality.
50
+ * Uses `<NextImage>` for static images and falls back to a standard `<img>` element for others.
51
+ */
52
+ img?: typeof ImageZoom;
53
+ /**
54
+ * Nextra's `<Anchor />` component for rendering links.
55
+ * Uses `<NextLink>` for internal navigation and falls back to a regular `<a>` element for
56
+ * external links.
57
+ */
58
+ a?: typeof Anchor;
59
+ };
60
+ declare const DEFAULT_COMPONENTS: {
61
+ img: FC<next_image_js.ImageProps>;
62
+ a: FC<Omit<Omit<Omit<react.AnchorHTMLAttributes<HTMLAnchorElement>, keyof next_link_js.LinkProps<any>> & next_link_js.LinkProps<any> & {
63
+ children?: React.ReactNode | undefined;
64
+ } & react.RefAttributes<HTMLAnchorElement>, "ref">, "href"> & {
65
+ href?: (string | url.UrlObject) | undefined;
66
+ }>;
67
+ };
68
+ /**
69
+ * Get current MDX components.
70
+ * @returns The current set of MDX components.
71
+ */
72
+ type UseMDXComponents<
73
+ /**
74
+ * Default MDX components
75
+ */
76
+ DefaultMDXComponents extends MDXComponents> = {
77
+ <components extends MDXComponents>(
78
+ /**
79
+ * An object where:
80
+ * - The key is the name of the HTML element to override.
81
+ * - The value is the component to render instead.
82
+ * @remarks `MDXComponents`
83
+ */
84
+ components: components): DefaultMDXComponents & components;
85
+ (): DefaultMDXComponents;
86
+ };
87
+ declare const useMDXComponents: UseMDXComponents<typeof DEFAULT_COMPONENTS>;
88
+
89
+ export { type MDXComponents, type NestedMDXComponents, type UseMDXComponents, useMDXComponents };
@@ -0,0 +1,15 @@
1
+ import { ImageZoom } from "./components/image-zoom.js";
2
+ import { Anchor } from "./mdx-components/anchor.js";
3
+ const DEFAULT_COMPONENTS = {
4
+ img: ImageZoom,
5
+ a: Anchor
6
+ };
7
+ const useMDXComponents = (components) => {
8
+ return {
9
+ ...DEFAULT_COMPONENTS,
10
+ ...components
11
+ };
12
+ };
13
+ export {
14
+ useMDXComponents
15
+ };
@@ -0,0 +1,62 @@
1
+ import { FC } from 'react';
2
+ import { Scope } from './evaluate.js';
3
+ import { MDXComponents } from './mdx-components.js';
4
+ import '../types.js';
5
+ import 'mdast';
6
+ import 'next';
7
+ import 'zod';
8
+ import '../server/schemas.js';
9
+ import './lib/index.js';
10
+ import 'rehype-katex/lib/index.js';
11
+ import 'better-react-mathjax';
12
+ import 'rehype-pretty-code';
13
+ import '../types.generated.js';
14
+ import '@mdx-js/mdx';
15
+ import 'rehype-katex';
16
+ import 'url';
17
+ import 'next/link.js';
18
+ import 'next/image.js';
19
+ import './components/image-zoom.js';
20
+ import 'next/image';
21
+ import './mdx-components/anchor.js';
22
+ import 'next/link';
23
+
24
+ type MDXRemoteProps = Readonly<{
25
+ /**
26
+ * An object mapping names to React components.
27
+ * The key used will be the name accessible to MDX.
28
+ *
29
+ * @example
30
+ * `{ ComponentName: Component }` will be accessible in the MDX as `<ComponentName>`.
31
+ */
32
+ components?: MDXComponents;
33
+ /**
34
+ * Pass-through variables for use in the MDX content.
35
+ * These variables will be available in the MDX scope.
36
+ */
37
+ scope?: Scope;
38
+ /**
39
+ * Raw JavaScript compiled MDX source code, a result of Nextra's
40
+ * [`compileMdx` function](https://nextra.site/api/compilemdx).
41
+ */
42
+ compiledSource: string;
43
+ }>;
44
+ /**
45
+ * A React component that renders compiled MDX content.
46
+ *
47
+ * @returns A rendered React element that renders the MDX content.
48
+ * @example
49
+ * ```mdx filename="example.mdx"
50
+ * import { compileMdx } from 'nextra/compile'
51
+ * import { MDXRemote } from 'nextra/mdx-remote'
52
+ *
53
+ * <MDXRemote
54
+ * compiledSource={await compileMdx('# Hello {myVariable} <MyComponent />')}
55
+ * components={{ MyComponent: () => <div>My Component</div> }}
56
+ * scope={{ myVariable: 'World' }}
57
+ * />
58
+ * ```
59
+ */
60
+ declare const MDXRemote: FC<MDXRemoteProps>;
61
+
62
+ export { MDXRemote, type MDXRemoteProps };
@@ -0,0 +1,36 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c as _c } from "react-compiler-runtime";
3
+ import { useMDXComponents } from "next-mdx-import-source-file";
4
+ import { evaluate } from "./evaluate.js";
5
+ const MDXRemote = (t0) => {
6
+ const $ = _c(6);
7
+ const {
8
+ scope,
9
+ components,
10
+ compiledSource
11
+ } = t0;
12
+ const t1 = useMDXComponents(components);
13
+ let t2;
14
+ if ($[0] !== compiledSource || $[1] !== scope || $[2] !== t1) {
15
+ t2 = evaluate(compiledSource, t1, scope);
16
+ $[0] = compiledSource;
17
+ $[1] = scope;
18
+ $[2] = t1;
19
+ $[3] = t2;
20
+ } else {
21
+ t2 = $[3];
22
+ }
23
+ const MDXContent = t2.default;
24
+ let t3;
25
+ if ($[4] !== MDXContent) {
26
+ t3 = /* @__PURE__ */ jsx(MDXContent, {});
27
+ $[4] = MDXContent;
28
+ $[5] = t3;
29
+ } else {
30
+ t3 = $[5];
31
+ }
32
+ return t3;
33
+ };
34
+ export {
35
+ MDXRemote
36
+ };
@@ -0,0 +1,84 @@
1
+ import { ReactNode } from 'react';
2
+ import { z } from 'zod';
3
+ import { itemSchema, menuSchema } from '../server/schemas.js';
4
+ import { MdxFile, Folder, FrontMatter, PageMapItem } from '../types.js';
5
+ import './lib/index.js';
6
+ import 'rehype-katex/lib/index.js';
7
+ import 'better-react-mathjax';
8
+ import 'rehype-pretty-code';
9
+ import 'mdast';
10
+ import 'next';
11
+ import '../types.generated.js';
12
+ import '@mdx-js/mdx';
13
+ import 'rehype-katex';
14
+
15
+ type PageTheme = NonNullable<z.infer<typeof itemSchema>['theme']>;
16
+ type Display = z.infer<typeof itemSchema>['display'];
17
+ type IMenuItem = z.infer<typeof menuSchema>;
18
+ type FolderWithoutChildren = Omit<Folder, 'children'>;
19
+ type Item = (MdxFile | FolderWithoutChildren) & {
20
+ title: ReactNode;
21
+ type: string;
22
+ children: Item[];
23
+ display?: Display;
24
+ theme?: PageTheme;
25
+ frontMatter: FrontMatter;
26
+ isUnderCurrentDocsTree?: boolean;
27
+ };
28
+ type PageItem = (MdxFile | FolderWithoutChildren) & {
29
+ title: ReactNode;
30
+ type: string;
31
+ href?: string;
32
+ children?: PageItem[];
33
+ firstChildRoute?: string;
34
+ display?: Display;
35
+ isUnderCurrentDocsTree?: boolean;
36
+ };
37
+ type MenuItem = (MdxFile | FolderWithoutChildren) & IMenuItem & {
38
+ children?: PageItem[];
39
+ };
40
+ type DocsItem = (MdxFile | FolderWithoutChildren) & {
41
+ title: ReactNode;
42
+ type: string;
43
+ children: DocsItem[];
44
+ firstChildRoute?: string;
45
+ isUnderCurrentDocsTree?: boolean;
46
+ };
47
+ type NormalizedResult = {
48
+ /** Active type for current page, used to determine layout in theme. */
49
+ activeType?: 'doc' | 'page' | 'menu';
50
+ /**
51
+ * Active index for current page, used for pagination in combination with `flatDocsDirectories`
52
+ * items.
53
+ */
54
+ activeIndex: number;
55
+ activeThemeContext: PageTheme;
56
+ /**
57
+ * Parsed [front matter](https://jekyllrb.com/docs/front-matter) or exported
58
+ * [Metadata](https://nextjs.org/docs/app/building-your-application/optimizing/metadata) from page.
59
+ */
60
+ activeMetadata?: FrontMatter;
61
+ /** Active path for current page, used for breadcrumb navigation. */
62
+ activePath: Item[];
63
+ /** All directories in the tree structure. */
64
+ directories: Item[];
65
+ /** Directories with `type: 'doc'` in `_meta` file. */
66
+ docsDirectories: DocsItem[];
67
+ /** Flattened directories with `type: 'doc'` in `_meta` file. */
68
+ flatDocsDirectories: DocsItem[];
69
+ /** Navbar items, items which have `type: 'page'` in `_meta` file. */
70
+ topLevelNavbarItems: (PageItem | MenuItem)[];
71
+ };
72
+ declare function normalizePages({ list, route,
73
+ /** @default '' */
74
+ docsRoot,
75
+ /** @default DEFAULT_PAGE_THEME */
76
+ pageThemeContext }: {
77
+ list: PageMapItem[];
78
+ route: string;
79
+ docsRoot?: string;
80
+ underCurrentDocsRoot?: boolean;
81
+ pageThemeContext?: PageTheme;
82
+ }): NormalizedResult;
83
+
84
+ export { type Item, type MenuItem, type PageItem, normalizePages };
@@ -0,0 +1,232 @@
1
+ "use no memo";
2
+ const DEFAULT_PAGE_THEME = {
3
+ breadcrumb: true,
4
+ collapsed: void 0,
5
+ copyPage: true,
6
+ footer: true,
7
+ layout: "default",
8
+ navbar: true,
9
+ pagination: true,
10
+ sidebar: true,
11
+ timestamp: true,
12
+ toc: true,
13
+ typesetting: "default"
14
+ };
15
+ function extendMeta(_meta = {}, fallback, metadata = {}) {
16
+ const theme = {
17
+ ...fallback.theme,
18
+ ..._meta.theme,
19
+ ...metadata.theme
20
+ };
21
+ return {
22
+ ...fallback,
23
+ ..._meta,
24
+ display: metadata.display || _meta.display || fallback.display,
25
+ theme
26
+ };
27
+ }
28
+ function findFirstRoute(items) {
29
+ for (const item of items) {
30
+ if (item.route) return item.route;
31
+ if (item.children) {
32
+ const route = findFirstRoute(item.children);
33
+ if (route) return route;
34
+ }
35
+ }
36
+ }
37
+ function normalizePages({
38
+ list,
39
+ route,
40
+ /** @default '' */
41
+ docsRoot = "",
42
+ /** @default DEFAULT_PAGE_THEME */
43
+ pageThemeContext = DEFAULT_PAGE_THEME
44
+ }) {
45
+ const underCurrentDocsRoot = route.startsWith(docsRoot);
46
+ const directories = [];
47
+ const docsDirectories = [];
48
+ const flatDocsDirectories = [];
49
+ const topLevelNavbarItems = [];
50
+ const firstItem = list[0];
51
+ const meta = "data" in firstItem ? firstItem.data : {};
52
+ const items = "data" in firstItem ? list.slice(1) : list;
53
+ const fallbackMeta = meta["*"] || {};
54
+ let activeType = fallbackMeta.type;
55
+ let activeIndex = 0;
56
+ let activeThemeContext = {
57
+ ...pageThemeContext,
58
+ ...fallbackMeta.theme
59
+ };
60
+ let activePath = [];
61
+ for (const currentItem of items) {
62
+ const extendedMeta = extendMeta(meta[currentItem.name], fallbackMeta, currentItem.frontMatter);
63
+ const {
64
+ display,
65
+ type = "doc"
66
+ } = extendedMeta;
67
+ const extendedPageThemeContext = {
68
+ ...pageThemeContext,
69
+ ...extendedMeta.theme
70
+ };
71
+ const normalizedChildren = "children" in currentItem && normalizePages({
72
+ list: currentItem.children,
73
+ route,
74
+ docsRoot: type === "page" || type === "menu" ? currentItem.route : docsRoot,
75
+ underCurrentDocsRoot,
76
+ pageThemeContext: extendedPageThemeContext
77
+ });
78
+ const getItem = () => ({
79
+ ...currentItem,
80
+ type,
81
+ ..."title" in currentItem && {
82
+ title: currentItem.title
83
+ },
84
+ ...display && {
85
+ display
86
+ },
87
+ ...normalizedChildren && {
88
+ children: []
89
+ }
90
+ });
91
+ const item = getItem();
92
+ const docsItem = getItem();
93
+ if ("children" in docsItem) {
94
+ const {
95
+ collapsed
96
+ } = extendedMeta.theme;
97
+ if (typeof collapsed === "boolean") {
98
+ docsItem.theme = {
99
+ collapsed
100
+ };
101
+ }
102
+ }
103
+ const pageItem = getItem();
104
+ docsItem.isUnderCurrentDocsTree = underCurrentDocsRoot;
105
+ if (type === "separator") {
106
+ item.isUnderCurrentDocsTree = underCurrentDocsRoot;
107
+ }
108
+ if (currentItem.route === route) {
109
+ activePath = [item];
110
+ activeType = type;
111
+ activeThemeContext = {
112
+ ...activeThemeContext,
113
+ ...extendedPageThemeContext
114
+ };
115
+ switch (type) {
116
+ case "page":
117
+ case "menu":
118
+ activeIndex = topLevelNavbarItems.length;
119
+ break;
120
+ case "doc":
121
+ activeIndex = flatDocsDirectories.length;
122
+ }
123
+ }
124
+ const isHidden = display === "hidden";
125
+ if (normalizedChildren) {
126
+ if (
127
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- fixme
128
+ normalizedChildren.activeIndex !== void 0 && normalizedChildren.activeType !== void 0
129
+ ) {
130
+ activeThemeContext = normalizedChildren.activeThemeContext;
131
+ activeType = normalizedChildren.activeType;
132
+ if (isHidden) {
133
+ continue;
134
+ }
135
+ activePath = [
136
+ item,
137
+ // Do not include folder which shows only his children
138
+ ...normalizedChildren.activePath.filter((item2) => item2.display !== "children")
139
+ ];
140
+ switch (activeType) {
141
+ case "page":
142
+ case "menu":
143
+ activeIndex = topLevelNavbarItems.length + normalizedChildren.activeIndex;
144
+ break;
145
+ case "doc":
146
+ activeIndex = flatDocsDirectories.length + normalizedChildren.activeIndex;
147
+ break;
148
+ }
149
+ if ("frontMatter" in currentItem && type === "doc") {
150
+ activeIndex++;
151
+ }
152
+ }
153
+ switch (type) {
154
+ case "page":
155
+ case "menu":
156
+ pageItem.children.push(...normalizedChildren.directories);
157
+ docsDirectories.push(...normalizedChildren.docsDirectories);
158
+ if (normalizedChildren.flatDocsDirectories.length) {
159
+ const route2 = findFirstRoute(normalizedChildren.flatDocsDirectories);
160
+ if (route2) pageItem.firstChildRoute = route2;
161
+ topLevelNavbarItems.push(pageItem);
162
+ } else if ("frontMatter" in pageItem) {
163
+ topLevelNavbarItems.push(pageItem);
164
+ }
165
+ break;
166
+ case "doc":
167
+ docsItem.children.push(...normalizedChildren.docsDirectories);
168
+ if ("frontMatter" in item && display !== "children") {
169
+ flatDocsDirectories.push(docsItem);
170
+ }
171
+ }
172
+ flatDocsDirectories.push(...normalizedChildren.flatDocsDirectories);
173
+ item.children.push(...normalizedChildren.directories);
174
+ } else {
175
+ if (isHidden) {
176
+ continue;
177
+ }
178
+ switch (type) {
179
+ case "page":
180
+ case "menu":
181
+ topLevelNavbarItems.push(pageItem);
182
+ break;
183
+ case "doc": {
184
+ const withHrefProp = "href" in item;
185
+ if (!withHrefProp) {
186
+ flatDocsDirectories.push(docsItem);
187
+ }
188
+ }
189
+ }
190
+ }
191
+ if (isHidden) {
192
+ continue;
193
+ }
194
+ if (type === "doc" && display === "children") {
195
+ if (docsItem.children) {
196
+ directories.push(...docsItem.children);
197
+ docsDirectories.push(...docsItem.children);
198
+ }
199
+ } else {
200
+ directories.push(item);
201
+ }
202
+ switch (type) {
203
+ case "page":
204
+ case "menu":
205
+ docsDirectories.push(pageItem);
206
+ break;
207
+ case "doc":
208
+ if (display !== "children") {
209
+ docsDirectories.push(docsItem);
210
+ }
211
+ break;
212
+ case "separator":
213
+ docsDirectories.push(item);
214
+ }
215
+ }
216
+ const activeMetadata = activePath.at(-1)?.frontMatter;
217
+ const result = {
218
+ activeType,
219
+ activeIndex,
220
+ activeThemeContext,
221
+ activeMetadata,
222
+ activePath,
223
+ directories,
224
+ docsDirectories: docsDirectories.filter((item) => item.isUnderCurrentDocsTree),
225
+ flatDocsDirectories,
226
+ topLevelNavbarItems
227
+ };
228
+ return result;
229
+ }
230
+ export {
231
+ normalizePages
232
+ };
@@ -0,0 +1 @@
1
+ {"sideEffects":false}