@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92

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 (284) hide show
  1. package/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
  2. package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
  3. package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
  4. package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
  5. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
  6. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  7. package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
  8. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
  9. package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
  10. package/compiler-assets/nextjs/shims/document.tsx +46 -0
  11. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
  12. package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
  13. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  14. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  15. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  16. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  17. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  18. package/compiler-assets/nextjs/shims/proxy.ts +254 -86
  19. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
  20. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
  21. package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
  22. package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
  23. package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
  24. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  25. package/dist/chunk-22RSSUNV.js +13 -0
  26. package/dist/chunk-3T4HVDSC.js +426 -0
  27. package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
  28. package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
  29. package/dist/chunk-5KAD7W53.js +248 -0
  30. package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
  31. package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
  32. package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
  33. package/dist/chunk-DX7PXFCM.js +2519 -0
  34. package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
  35. package/dist/chunk-EFO6AWXN.js +19 -0
  36. package/dist/chunk-IL4RJOKI.js +186 -0
  37. package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
  38. package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
  39. package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
  40. package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
  41. package/dist/compiler.d.ts +15 -2
  42. package/dist/compiler.js +111 -23
  43. package/dist/components/blocks/agent-actions.d.ts +81 -0
  44. package/dist/components/blocks/agent-actions.js +563 -0
  45. package/dist/components/blocks/toc.d.ts +43 -0
  46. package/dist/components/blocks/toc.js +136 -0
  47. package/dist/components/ui/button.d.ts +4 -0
  48. package/dist/components/ui/button.js +94 -0
  49. package/dist/compose-44GJSMXD.js +16 -0
  50. package/dist/config/createNextConfig.js +19 -3
  51. package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
  52. package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
  53. package/dist/ide-support-TG74L4FF.js +16 -0
  54. package/dist/index.d.ts +151 -95
  55. package/dist/index.js +25 -0
  56. package/dist/jsx-dev-runtime.d.ts +6 -0
  57. package/dist/jsx-dev-runtime.js +100 -0
  58. package/dist/jsx-runtime.d.ts +7 -0
  59. package/dist/jsx-runtime.js +97 -0
  60. package/dist/kernel/components/blocks/AgentActions.d.ts +37 -8
  61. package/dist/kernel/components/blocks/AgentActions.js +384 -174
  62. package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
  63. package/dist/kernel/components/blocks/agent-actions.js +563 -0
  64. package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
  65. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  66. package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
  67. package/dist/kernel/components/blocks/color-palette.js +4 -4
  68. package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
  69. package/dist/kernel/components/blocks/logo-block.js +1 -1
  70. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
  71. package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
  72. package/dist/kernel/components/blocks/navbar.d.ts +5 -4
  73. package/dist/kernel/components/blocks/navbar.js +79 -59
  74. package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
  75. package/dist/kernel/components/blocks/navigation-progress.js +2 -2
  76. package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
  77. package/dist/kernel/components/blocks/next-prev.js +30 -7
  78. package/dist/kernel/components/blocks/page-list.d.ts +4 -4
  79. package/dist/kernel/components/blocks/page-list.js +32 -9
  80. package/dist/kernel/components/blocks/search.d.ts +9 -15
  81. package/dist/kernel/components/blocks/search.js +16 -17
  82. package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
  83. package/dist/kernel/components/blocks/sidebar-node.js +13 -3
  84. package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
  85. package/dist/kernel/components/blocks/sidebar.js +137 -28
  86. package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
  87. package/dist/kernel/components/blocks/theme-toggle.js +5 -5
  88. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  89. package/dist/kernel/components/blocks/toc-client.js +495 -0
  90. package/dist/kernel/components/blocks/toc.d.ts +20 -2
  91. package/dist/kernel/components/blocks/toc.js +121 -179
  92. package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
  93. package/dist/kernel/components/mdx/components/blockquote.js +1 -1
  94. package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
  95. package/dist/kernel/components/mdx/components/callout.js +1 -1
  96. package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
  97. package/dist/kernel/components/mdx/components/code-block.js +2 -2
  98. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
  99. package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
  100. package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
  101. package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
  102. package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
  103. package/dist/kernel/components/mdx/components/figure.js +23 -13
  104. package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
  105. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  106. package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
  107. package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
  108. package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
  109. package/dist/kernel/components/mdx/components/heading.js +6 -3
  110. package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
  111. package/dist/kernel/components/mdx/components/hr.js +2 -2
  112. package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
  113. package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
  114. package/dist/kernel/components/mdx/components/image.d.ts +2 -2
  115. package/dist/kernel/components/mdx/components/image.js +22 -17
  116. package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
  117. package/dist/kernel/components/mdx/components/inline-code.js +1 -1
  118. package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
  119. package/dist/kernel/components/mdx/components/kbd.js +2 -2
  120. package/dist/kernel/components/mdx/components/link.d.ts +6 -6
  121. package/dist/kernel/components/mdx/components/link.js +2 -2
  122. package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
  123. package/dist/kernel/components/mdx/components/paragraph.js +1 -1
  124. package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
  125. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  126. package/dist/kernel/components/mdx/components/table.d.ts +7 -7
  127. package/dist/kernel/components/mdx/components/table.js +2 -2
  128. package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
  129. package/dist/kernel/components/mdx/components/task-list.js +1 -1
  130. package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
  131. package/dist/kernel/components/mdx/components/video-player.js +6 -2
  132. package/dist/kernel/components/mdx/components/video.d.ts +5 -4
  133. package/dist/kernel/components/mdx/components/video.js +7 -5
  134. package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
  135. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  136. package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
  137. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  138. package/dist/kernel/components/mdx/mdx.d.ts +57 -16
  139. package/dist/kernel/components/mdx/mdx.js +232 -35
  140. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  141. package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
  142. package/dist/kernel/components/mdx/types.d.ts +1 -1
  143. package/dist/kernel/components/next-image.d.ts +12 -0
  144. package/dist/kernel/components/next-image.js +61 -0
  145. package/dist/kernel/components/ui/accordion.d.ts +7 -7
  146. package/dist/kernel/components/ui/accordion.js +1 -1
  147. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
  148. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  149. package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
  150. package/dist/kernel/components/ui/breadcrumb.js +4 -4
  151. package/dist/kernel/components/ui/button-group.d.ts +6 -6
  152. package/dist/kernel/components/ui/button-group.js +3 -3
  153. package/dist/kernel/components/ui/button.d.ts +59 -7
  154. package/dist/kernel/components/ui/button.js +43 -39
  155. package/dist/kernel/components/ui/card.d.ts +7 -7
  156. package/dist/kernel/components/ui/card.js +1 -1
  157. package/dist/kernel/components/ui/dialog.d.ts +10 -10
  158. package/dist/kernel/components/ui/dialog.js +1 -1
  159. package/dist/kernel/components/ui/drawer.d.ts +12 -12
  160. package/dist/kernel/components/ui/drawer.js +1 -1
  161. package/dist/kernel/components/ui/input.d.ts +2 -2
  162. package/dist/kernel/components/ui/input.js +1 -1
  163. package/dist/kernel/components/ui/kbd.d.ts +4 -4
  164. package/dist/kernel/components/ui/kbd.js +1 -1
  165. package/dist/kernel/components/ui/link.d.ts +11 -5
  166. package/dist/kernel/components/ui/link.js +2 -2
  167. package/dist/kernel/components/ui/menu.d.ts +22 -22
  168. package/dist/kernel/components/ui/menu.js +1 -1
  169. package/dist/kernel/components/ui/mod-key.d.ts +2 -3
  170. package/dist/kernel/components/ui/mod-key.js +2 -2
  171. package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
  172. package/dist/kernel/components/ui/navigation-menu.js +1 -1
  173. package/dist/kernel/components/ui/popover.d.ts +11 -11
  174. package/dist/kernel/components/ui/popover.js +1 -1
  175. package/dist/kernel/components/ui/progress.d.ts +7 -7
  176. package/dist/kernel/components/ui/progress.js +1 -1
  177. package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
  178. package/dist/kernel/components/ui/scroll-area.js +1 -1
  179. package/dist/kernel/components/ui/select.d.ts +16 -16
  180. package/dist/kernel/components/ui/select.js +1 -1
  181. package/dist/kernel/components/ui/separator.d.ts +3 -3
  182. package/dist/kernel/components/ui/separator.js +1 -1
  183. package/dist/kernel/components/ui/table.d.ts +7 -7
  184. package/dist/kernel/components/ui/table.js +1 -1
  185. package/dist/kernel/components/ui/tabs.d.ts +12 -12
  186. package/dist/kernel/components/ui/tabs.js +1 -1
  187. package/dist/kernel/components/ui/tag.d.ts +3 -3
  188. package/dist/kernel/components/ui/tag.js +1 -1
  189. package/dist/kernel/components/ui/text.d.ts +4 -4
  190. package/dist/kernel/components/ui/text.js +1 -1
  191. package/dist/kernel/components/ui/toast.d.ts +11 -11
  192. package/dist/kernel/components/ui/toast.js +1 -1
  193. package/dist/kernel/components/ui/tooltip.d.ts +9 -9
  194. package/dist/kernel/components/ui/tooltip.js +1 -1
  195. package/dist/kernel/defaults.registry.d.ts +4 -17
  196. package/dist/kernel/defaults.registry.js +4 -19
  197. package/dist/kernel/routes/agent/markdown.d.ts +7 -0
  198. package/dist/kernel/routes/agent/markdown.js +229 -54
  199. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  200. package/dist/kernel/routes/layouts/group.js +5 -7
  201. package/dist/kernel/routes/metadata/feed.d.ts +1 -2
  202. package/dist/kernel/routes/metadata/feed.js +119 -88
  203. package/dist/kernel/routes/metadata/llms.d.ts +3 -23
  204. package/dist/kernel/routes/metadata/llms.js +2 -103
  205. package/dist/kernel/routes/metadata/og-image.js +1 -1
  206. package/dist/kernel/routes/metadata/robots.d.ts +5 -3
  207. package/dist/kernel/routes/metadata/robots.js +4 -25
  208. package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
  209. package/dist/kernel/routes/metadata/sitemap.js +277 -49
  210. package/dist/kernel/routes/not-found.d.ts +34 -0
  211. package/dist/kernel/routes/not-found.js +213 -0
  212. package/dist/kernel/routes/pages/group.d.ts +5 -5
  213. package/dist/kernel/routes/pages/group.js +11 -5
  214. package/dist/kernel/routes/pages/leaf.d.ts +38 -6
  215. package/dist/kernel/routes/pages/leaf.js +21 -12
  216. package/dist/kernel/routes/pages/root.d.ts +5 -5
  217. package/dist/kernel/routes/pages/root.js +21 -6
  218. package/dist/keyboard-shortcuts.d.ts +2 -2
  219. package/dist/keyboard-shortcuts.js +1 -1
  220. package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
  221. package/dist/resolvers/manifest-resolver.d.ts +2 -2
  222. package/dist/resolvers/manifest-resolver.js +65 -35
  223. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
  224. package/dist/search.d.ts +2 -9
  225. package/dist/search.js +9 -16
  226. package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
  227. package/dist/theme-scope.d.ts +2 -2
  228. package/dist/theme-scope.js +1 -1
  229. package/dist/types-BbqmOzLC.d.ts +168 -0
  230. package/dist/types-TjH1ek0X.d.ts +22 -0
  231. package/dist/types-sM2g9nW0.d.ts +12 -0
  232. package/dist/types.d.ts +117 -91
  233. package/dist/utils/heading-ids.js +30 -11
  234. package/dist/utils/toc-selection.d.ts +7 -0
  235. package/dist/utils/toc-selection.js +14 -0
  236. package/dist/validate-local-source-EN2GW4FR.js +16 -0
  237. package/dist/validate-publish-os-source-OEWQDB7B.js +14 -0
  238. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  239. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  240. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  241. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  242. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  243. package/init/seed/minimal/publish.os/blog/index.tsx +85 -0
  244. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  245. package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
  246. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  247. package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
  248. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
  249. package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
  250. package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
  251. package/init/seed/minimal/publish.os/theme.css +3 -3
  252. package/init/seed/minimal/seed.json +12 -4
  253. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
  254. package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
  255. package/package.json +48 -23
  256. package/release/app/phosphor/package.json +4 -4
  257. package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
  258. package/release/compiler/package.json +5 -3
  259. package/release/compiler/pnpm-lock.yaml.template +153 -183
  260. package/release/release.json +6 -6
  261. package/dist/button-CtzUJB8u.d.ts +0 -11
  262. package/dist/chunk-535TM4A5.js +0 -1455
  263. package/dist/chunk-B2V22WRT.js +0 -297
  264. package/dist/chunk-NECL5IBJ.js +0 -318
  265. package/dist/chunk-SVYGXXYR.js +0 -36
  266. package/dist/chunk-UF6ATARM.js +0 -1100
  267. package/dist/compose-NN23UJGC.js +0 -13
  268. package/dist/ide-support-ZNW7ODFY.js +0 -15
  269. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  270. package/dist/kernel/components/blocks/design-system-preview.js +0 -667
  271. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  272. package/dist/kernel/components/blocks/link-playground.js +0 -744
  273. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  274. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  275. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  276. package/dist/kernel/components/ui/theme-toggle.js +0 -53
  277. package/dist/sidebar-types-DKpR27II.d.ts +0 -25
  278. package/dist/types-BzkZty3r.d.ts +0 -147
  279. package/dist/types-CJWRG05y.d.ts +0 -76
  280. package/dist/types-CUtrppxt.d.ts +0 -69
  281. package/dist/validate-local-source-XRL2Y7XE.js +0 -14
  282. package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
  283. package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
  284. package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
@@ -1,194 +1,136 @@
1
- "use client";
2
-
3
1
  // src/components/block/toc/toc.tsx
4
- import { cn } from "@publish.os/nextjs/utils/cn";
5
2
  import {
6
- extractMdxHeadings
7
- } from "@publish.os/nextjs/utils/heading-ids";
8
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var DEFAULT_LEVELS = [2, 3], ACTIVATION_OFFSET = 96, BOTTOM_THRESHOLD = 2, SCROLL_KEYS = /* @__PURE__ */ new Set([
11
- " ",
12
- "ArrowDown",
13
- "ArrowUp",
14
- "End",
15
- "Home",
16
- "PageDown",
17
- "PageUp"
18
- ]);
19
- function documentIsAtBottom() {
20
- let root = document.documentElement;
21
- return Math.ceil(window.scrollY + window.innerHeight) >= root.scrollHeight - BOTTOM_THRESHOLD;
3
+ TocClientProvider,
4
+ TocDesktop,
5
+ TocLinksSlot,
6
+ TocMobile,
7
+ TocMobileHeader,
8
+ TocTitle
9
+ } from "@publish.os/nextjs/kernel/components/blocks/toc-client";
10
+ import { cn } from "@publish.os/nextjs/utils/cn";
11
+
12
+ // src/components/block/toc/extract-headings.ts
13
+ import remarkGfm from "remark-gfm";
14
+ import remarkMdx from "remark-mdx";
15
+ import remarkParse from "remark-parse";
16
+ import { unified } from "unified";
17
+
18
+ // src/components/mdx/heading-string.ts
19
+ var SELF_CLOSING_TAG_RE = /<[^>]+\/>/g, PAIRED_TAG_RE = /<\/?\w[^>]*>/g, MDX_BOLD_RE = /\*\*(.*?)\*\*/g, MDX_ITALIC_RE = /\*(.*?)\*/g, MDX_UNDERLINE_BOLD_RE = /__(.*?)__/g, MDX_UNDERLINE_ITALIC_RE = /_(.*?)_/g, MDX_STRIKETHROUGH_RE = /~~(.*?)~~/g, MDX_INLINE_CODE_RE = /`(.*?)`/g, MDX_LINK_RE = /\[(.*?)\]\(.*?\)/g, NON_ALPHANUMERIC_RE = /[^a-z0-9]+/g, LEADING_TRAILING_HYPHEN_RE = /^-+|-+$/g, LEADING_DIGIT_RE = /^(\d)/;
20
+ function cleanHeadingString(input) {
21
+ return input.replace(SELF_CLOSING_TAG_RE, "").replace(PAIRED_TAG_RE, "").replace(MDX_BOLD_RE, "$1").replace(MDX_ITALIC_RE, "$1").replace(MDX_UNDERLINE_BOLD_RE, "$1").replace(MDX_UNDERLINE_ITALIC_RE, "$1").replace(MDX_STRIKETHROUGH_RE, "$1").replace(MDX_INLINE_CODE_RE, "$1").replace(MDX_LINK_RE, "$1").trim();
22
22
  }
23
- function resolveActiveHeading(elements) {
24
- if (documentIsAtBottom()) return elements.at(-1)?.id ?? "";
25
- let nextActiveId = elements[0]?.id ?? "";
26
- for (let element of elements)
27
- if (element.getBoundingClientRect().top <= ACTIVATION_OFFSET)
28
- nextActiveId = element.id;
29
- else
30
- break;
31
- return nextActiveId;
23
+ function headingStringToHTMLId(input) {
24
+ let text = cleanHeadingString(input);
25
+ return text ? text.toLowerCase().replace(NON_ALPHANUMERIC_RE, "-").replace(LEADING_TRAILING_HYPHEN_RE, "").replace(LEADING_DIGIT_RE, "id-$1") || "heading" : "empty-heading";
32
26
  }
33
- function useTocActiveState(headingIds) {
34
- let [activeId, setActiveId] = useState(""), [indicatorStyle, setIndicatorStyle] = useState({
35
- height: 0,
36
- transform: 0
37
- }), [scrollMask, setScrollMask] = useState({
38
- bottom: !1,
39
- top: !1
40
- }), clickedIdRef = useRef(null), contentRef = useRef(null), frameRef = useRef(null), viewportRef = useRef(null), clearClickedId = useCallback(() => {
41
- clickedIdRef.current = null;
42
- }, []), updateActiveHeading = useCallback(() => {
43
- if (clickedIdRef.current) {
44
- setActiveId(
45
- (current) => current === clickedIdRef.current ? current : clickedIdRef.current ?? ""
46
- );
47
- return;
48
- }
49
- let elements = headingIds.map((id) => document.getElementById(id)).filter((element) => !!element);
50
- if (elements.length === 0) return;
51
- let nextActiveId = resolveActiveHeading(elements);
52
- setActiveId(
53
- (current) => current === nextActiveId ? current : nextActiveId
54
- );
55
- }, [headingIds]), updateIndicator = useCallback(() => {
56
- let container = contentRef.current;
57
- if (!container || !activeId) {
58
- setIndicatorStyle({ height: 0, transform: 0 });
59
- return;
60
- }
61
- let activeLink = Array.from(
62
- container.querySelectorAll("[data-toc-link]")
63
- ).find((link) => link.dataset.tocId === activeId);
64
- if (!activeLink) {
65
- setIndicatorStyle({ height: 0, transform: 0 });
66
- return;
67
- }
68
- let containerRect = container.getBoundingClientRect(), activeRect = activeLink.getBoundingClientRect(), nextStyle = {
69
- height: activeRect.height,
70
- transform: activeRect.top - containerRect.top
71
- };
72
- setIndicatorStyle(
73
- (current) => current.height === nextStyle.height && current.transform === nextStyle.transform ? current : nextStyle
74
- );
75
- }, [activeId]), updateViewport = useCallback(() => {
76
- updateIndicator();
77
- let viewport = viewportRef.current;
78
- if (!viewport) return;
79
- let hasOverflow = viewport.scrollHeight > viewport.clientHeight + 1, nextMask = {
80
- bottom: hasOverflow && viewport.scrollTop + viewport.clientHeight < viewport.scrollHeight - 1,
81
- top: hasOverflow && viewport.scrollTop > 0
82
- };
83
- setScrollMask(
84
- (current) => current.top === nextMask.top && current.bottom === nextMask.bottom ? current : nextMask
85
- );
86
- }, [updateIndicator]);
87
- useEffect(() => {
88
- let scheduleUpdate = () => {
89
- frameRef.current === null && (frameRef.current = window.requestAnimationFrame(() => {
90
- frameRef.current = null, updateActiveHeading(), updateViewport();
91
- }));
92
- }, handleKeyDown = (event) => {
93
- SCROLL_KEYS.has(event.key) && clearClickedId();
94
- };
95
- return scheduleUpdate(), window.addEventListener("scroll", scheduleUpdate, { passive: !0 }), window.addEventListener("resize", scheduleUpdate), window.addEventListener("hashchange", scheduleUpdate), window.addEventListener("wheel", clearClickedId, { passive: !0 }), window.addEventListener("touchstart", clearClickedId, { passive: !0 }), window.addEventListener("keydown", handleKeyDown), () => {
96
- window.removeEventListener("scroll", scheduleUpdate), window.removeEventListener("resize", scheduleUpdate), window.removeEventListener("hashchange", scheduleUpdate), window.removeEventListener("wheel", clearClickedId), window.removeEventListener("touchstart", clearClickedId), window.removeEventListener("keydown", handleKeyDown), frameRef.current !== null && (window.cancelAnimationFrame(frameRef.current), frameRef.current = null);
97
- };
98
- }, [clearClickedId, updateActiveHeading, updateViewport]), useEffect(() => {
99
- updateViewport();
100
- }, [updateViewport]);
101
- let handleTocClick = useCallback((id) => {
102
- clickedIdRef.current = id, setActiveId(id);
103
- }, []);
104
- return {
105
- activeId,
106
- contentRef,
107
- handleTocClick,
108
- indicatorStyle,
109
- scrollMask,
110
- updateViewport,
111
- viewportRef
27
+ function createHeadingStringIdGenerator() {
28
+ let nextSuffix = /* @__PURE__ */ new Map(), usedIds = /* @__PURE__ */ new Set();
29
+ return (input) => {
30
+ let baseId = headingStringToHTMLId(input);
31
+ if (baseId === "empty-heading") return baseId;
32
+ let suffix = nextSuffix.get(baseId) ?? 0, id = suffix === 0 ? baseId : `${baseId}-${suffix}`;
33
+ for (; usedIds.has(id); )
34
+ suffix += 1, id = `${baseId}-${suffix}`;
35
+ return nextSuffix.set(baseId, suffix + 1), usedIds.add(id), id;
112
36
  };
113
37
  }
114
- function Toc({ className, content, levels = DEFAULT_LEVELS }) {
115
- let headings = useMemo(
116
- () => extractMdxHeadings(content, levels),
117
- [content, levels]
118
- ), headingIds = useMemo(
119
- () => headings.map((heading) => heading.id),
120
- [headings]
121
- ), {
122
- activeId,
123
- contentRef,
124
- handleTocClick,
125
- indicatorStyle,
126
- scrollMask,
127
- updateViewport,
128
- viewportRef
129
- } = useTocActiveState(headingIds);
130
- if (headings.length <= 1) return null;
131
- let maskImage = scrollMask.top || scrollMask.bottom ? `linear-gradient(to bottom, ${scrollMask.top ? "transparent, black 14px" : "black 0, black 14px"}, ${scrollMask.bottom ? "black calc(100% - 14px), transparent" : "black calc(100% - 14px), black 100%"})` : void 0;
132
- return /* @__PURE__ */ jsxs("nav", { "aria-label": "On this page", className: cn("text-sm", className), children: [
133
- /* @__PURE__ */ jsx("p", { className: "mb-3 px-3 text-[11px] font-semibold uppercase leading-none tracking-wide text-foreground-3", children: "On this page" }),
38
+
39
+ // src/components/block/toc/extract-headings.ts
40
+ var parser = unified().use(remarkParse).use(remarkMdx).use(remarkGfm);
41
+ function nodeText(node) {
42
+ return node.type === "text" || node.type === "inlineCode" ? typeof node.value == "string" ? node.value : "" : node.type === "image" || node.type === "imageReference" ? node.alt ?? "" : node.type === "break" || node.name === "br" ? " " : node.type === "mdxTextExpression" || node.type === "mdxFlowExpression" ? "" : (node.children ?? []).map(nodeText).join("");
43
+ }
44
+ function extractTocHeadings(content, levels) {
45
+ let [minDepth, maxDepth] = levels, headingId = createHeadingStringIdGenerator(), headings = [], tree = parser.parse(content);
46
+ function visit(node) {
47
+ if (node.type === "heading" && node.depth) {
48
+ let text = nodeText(node).trim();
49
+ if (text) {
50
+ let id = headingId(text);
51
+ node.depth >= minDepth && node.depth <= maxDepth && headings.push({ id, level: node.depth, text });
52
+ }
53
+ }
54
+ for (let child of node.children ?? []) visit(child);
55
+ }
56
+ return visit(tree), headings;
57
+ }
58
+
59
+ // src/components/block/toc/toc.tsx
60
+ import { Fragment, jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
61
+ var DEFAULT_LEVELS = [2, 3];
62
+ function TocRoot({
63
+ className,
64
+ content = "",
65
+ desktopClassName,
66
+ desktopListClassName,
67
+ levels = DEFAULT_LEVELS,
68
+ listClassName,
69
+ mobileClassName,
70
+ mobileQuery = "(max-width: 1279px)",
71
+ readingOffset,
72
+ title = "On this page",
73
+ children
74
+ }) {
75
+ let headings = extractTocHeadings(content, levels);
76
+ return headings.length <= 1 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
134
77
  /* @__PURE__ */ jsx(
135
- "div",
78
+ TocClientProvider,
136
79
  {
137
- ref: viewportRef,
138
- className: "max-h-[calc(100dvh-var(--layout-global-nav-height)-3rem)] overflow-y-auto pr-2 scrollbar-gutter-stable supports-[top:anchor-size(--global-navbar_height)]:max-h-[calc(100dvh-anchor-size(--global-navbar_height,3.5rem)-3rem)]",
139
- onScroll: updateViewport,
140
- style: {
141
- WebkitMaskImage: maskImage,
142
- maskImage
143
- },
144
- children: /* @__PURE__ */ jsxs("div", { ref: contentRef, className: "relative min-w-0 py-1", children: [
145
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-1 left-0 top-1 w-px rounded-full bg-stroke-3" }),
146
- /* @__PURE__ */ jsx(
147
- "div",
148
- {
149
- "aria-hidden": "true",
150
- className: "absolute left-0 w-px rounded-full bg-accent-1 transition-all duration-300 ease-out will-change-transform",
151
- style: {
152
- height: indicatorStyle.height,
153
- transform: `translateY(${indicatorStyle.transform}px) scaleY(${activeId ? 1 : 0.5})`,
154
- transformOrigin: "top"
155
- }
156
- }
157
- ),
158
- /* @__PURE__ */ jsx("ol", { className: "flex min-w-0 flex-col gap-0.5 pl-3", children: headings.map((heading, index) => {
159
- let active = activeId === heading.id;
160
- return /* @__PURE__ */ jsx(
161
- "li",
162
- {
163
- style: {
164
- marginLeft: Math.max(heading.level - levels[0], 0) * 12,
165
- marginTop: heading.level === levels[0] && index > 0 ? 4 : 0
166
- },
167
- children: /* @__PURE__ */ jsx(
168
- "a",
169
- {
170
- "aria-current": active ? "location" : void 0,
171
- className: cn(
172
- "block rounded-button px-2 py-1 text-[13px] leading-snug text-foreground-3 no-underline transition-[background-color,color,font-weight] duration-200 hover:bg-surface-hover hover:text-foreground-1 hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke",
173
- active && "bg-surface-active font-medium text-accent-1 shadow-xs"
174
- ),
175
- "data-state": active ? "heading-active" : void 0,
176
- "data-toc-id": heading.id,
177
- "data-toc-link": "",
178
- href: `#${heading.id}`,
179
- onClick: () => handleTocClick(heading.id),
180
- children: /* @__PURE__ */ jsx("span", { className: "block min-w-0 text-wrap wrap-break-word", children: heading.text })
181
- }
182
- )
183
- },
184
- heading.id
185
- );
186
- }) })
80
+ className: cn("text-xs leading-5", className),
81
+ desktopClassName: cn("hidden xl:block", desktopClassName),
82
+ desktopListClassName,
83
+ headings,
84
+ levels,
85
+ listClassName,
86
+ mobileClassName: cn("xl:hidden", mobileClassName),
87
+ mobileQuery,
88
+ readingOffset,
89
+ title,
90
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
91
+ /* @__PURE__ */ jsx(TocDesktop, {}),
92
+ /* @__PURE__ */ jsx(TocMobile, {})
187
93
  ] })
188
94
  }
189
- )
95
+ ),
96
+ /* @__PURE__ */ jsxs("noscript", { children: [
97
+ /* @__PURE__ */ jsx("style", { children: "[data-toc-mobile-trigger]{display:none}" }),
98
+ /* @__PURE__ */ jsx(
99
+ "nav",
100
+ {
101
+ "aria-label": title,
102
+ className: cn(
103
+ "xl:hidden max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain border-b border-stroke-3 px-6 py-4 text-xs leading-5",
104
+ mobileClassName
105
+ ),
106
+ children: /* @__PURE__ */ jsx("ol", { className: cn("space-y-1", listClassName), children: headings.map((heading) => /* @__PURE__ */ jsx(
107
+ "li",
108
+ {
109
+ className: heading.level === levels[0] + 1 ? "ps-3" : void 0,
110
+ children: /* @__PURE__ */ jsx(
111
+ "a",
112
+ {
113
+ className: "block min-h-6 whitespace-normal break-words text-foreground-3 no-underline hover:text-foreground-1 hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke",
114
+ href: `#${heading.id}`,
115
+ children: heading.text
116
+ }
117
+ )
118
+ },
119
+ heading.id
120
+ )) })
121
+ }
122
+ )
123
+ ] })
190
124
  ] });
191
125
  }
126
+ var Toc = Object.assign(TocRoot, {
127
+ Desktop: TocDesktop,
128
+ Links: TocLinksSlot,
129
+ Mobile: TocMobile,
130
+ MobileHeader: TocMobileHeader,
131
+ Root: TocRoot,
132
+ Title: TocTitle
133
+ });
192
134
  export {
193
135
  Toc
194
136
  };
@@ -1,6 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
 
3
3
  type BlockquoteProps = React.ComponentPropsWithoutRef<"blockquote">;
4
- declare function Blockquote({ className, ...props }: BlockquoteProps): react_jsx_runtime.JSX.Element;
4
+ declare function Blockquote({ className, ...props }: BlockquoteProps): react.JSX.Element;
5
5
 
6
6
  export { Blockquote, type BlockquoteProps };
@@ -1,6 +1,6 @@
1
1
  // src/components/mdx/blockquote.tsx
2
2
  import { cn } from "@publish.os/nextjs/utils/cn";
3
- import { jsx } from "react/jsx-runtime";
3
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
4
4
  function Blockquote({ className, ...props }) {
5
5
  return /* @__PURE__ */ jsx(
6
6
  "blockquote",
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
3
4
  import { VariantProps } from 'class-variance-authority';
4
- import { ComponentPropsWithoutRef, ReactNode } from 'react';
5
5
 
6
6
  declare const calloutVariants: (props?: ({
7
7
  color?: "neutral" | "info" | "warning" | "danger" | "success" | null | undefined;
@@ -11,6 +11,6 @@ type CalloutProps = Omit<ComponentPropsWithoutRef<"aside">, "color" | "title" |
11
11
  icon?: ReactNode;
12
12
  title?: ReactNode;
13
13
  };
14
- declare function Callout({ children, className, color, icon, title, variant, ...props }: CalloutProps): react_jsx_runtime.JSX.Element;
14
+ declare function Callout({ children, className, color, icon, title, variant, ...props }: CalloutProps): react.JSX.Element;
15
15
 
16
16
  export { Callout, type CalloutProps, calloutVariants };
@@ -2,7 +2,7 @@
2
2
  import { cn } from "@publish.os/nextjs/utils/cn";
3
3
  import { cva } from "class-variance-authority";
4
4
  import { useId } from "react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
6
6
  var calloutVariants = cva(
7
7
  "not-markdown-prose my-6 grid min-w-0 items-start gap-2.5 rounded-callout p-3 [&_[data-slot=callout-icon]_svg]:size-[1.125em]",
8
8
  {
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { BundledTheme } from 'shiki';
3
3
 
4
4
  type CodeBlockProps = Omit<React.ComponentPropsWithoutRef<"div">, "style"> & {
@@ -7,6 +7,6 @@ type CodeBlockProps = Omit<React.ComponentPropsWithoutRef<"div">, "style"> & {
7
7
  lightTheme?: BundledTheme;
8
8
  darkTheme?: BundledTheme;
9
9
  };
10
- declare function CodeBlock({ children, className, code, language, lightTheme, darkTheme, title, ...props }: CodeBlockProps): Promise<react_jsx_runtime.JSX.Element>;
10
+ declare function CodeBlock({ children, className, code, language, lightTheme, darkTheme, title, ...props }: CodeBlockProps): Promise<react.JSX.Element>;
11
11
 
12
12
  export { CodeBlock, type CodeBlockProps };
@@ -1,12 +1,12 @@
1
1
  // src/components/mdx/code-block/code-block.tsx
2
- import { CopyCodeButton } from "@publish.os/nextjs/kernel/components/mdx/components/copy-code-button";
2
+ import { CopyCodeButton } from "@components/mdx/components/copy-code-button";
3
3
  import { cn } from "@publish.os/nextjs/utils/cn";
4
4
  import { isValidElement } from "react";
5
5
  import {
6
6
  bundledLanguages,
7
7
  codeToHtml
8
8
  } from "shiki";
9
- import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
10
10
  var copyButtonRadius = "rounded-[max(calc(var(--radius-codeblock)-0.5rem),0px)]";
11
11
  function codeChild(children) {
12
12
  if (!isValidElement(children))
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
 
3
3
  declare function CopyCodeButton({ className, code, }: {
4
4
  className?: string;
5
5
  code: string;
6
- }): react_jsx_runtime.JSX.Element;
6
+ }): react.JSX.Element;
7
7
 
8
8
  export { CopyCodeButton };
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
 
3
3
  // src/components/mdx/code-block/copy-code-button.tsx
4
- import { AnimatedIconSwap } from "@publish.os/nextjs/kernel/components/blocks/animated-icon-swap";
5
- import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
4
+ import { AnimatedIconSwap } from "@components/blocks/animated-icon-swap";
5
+ import { Button } from "@components/ui/button";
6
6
  import { CheckIcon, CopyIcon } from "@phosphor-icons/react/ssr";
7
7
  import { cn } from "@publish.os/nextjs/utils/cn";
8
8
  import { useEffect, useRef, useState } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
10
10
  function CopyCodeButton({
11
11
  className,
12
12
  code
@@ -30,9 +30,10 @@ function CopyCodeButton({
30
30
  {
31
31
  "aria-label": copied ? "Copied code" : "Copy code",
32
32
  className: cn(
33
- "relative z-content touch-manipulation after:absolute after:-inset-2 after:content-[''] motion-reduce:transition-none",
33
+ "relative z-content touch-manipulation after:absolute after:-inset-2 after:content-['']",
34
34
  className
35
35
  ),
36
+ "data-copied": copied ? "true" : void 0,
36
37
  "data-slot": "copy-code-button",
37
38
  iconOnly: !0,
38
39
  onClick: copy,
@@ -1,6 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
 
3
- type FigureCaptionProps = React.ComponentPropsWithoutRef<"figcaption">;
4
- declare function FigureCaption({ className, ...props }: FigureCaptionProps): react_jsx_runtime.JSX.Element;
3
+ type FigureCaptionProps = React.ComponentProps<"figcaption">;
4
+ declare function FigureCaption({ className, ...props }: FigureCaptionProps): react.JSX.Element;
5
5
 
6
6
  export { FigureCaption, type FigureCaptionProps };
@@ -1,12 +1,13 @@
1
1
  // src/components/mdx/figure/figure-caption.tsx
2
2
  import { cn } from "@publish.os/nextjs/utils/cn";
3
- import { jsx } from "react/jsx-runtime";
3
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
4
4
  function FigureCaption({ className, ...props }) {
5
5
  return /* @__PURE__ */ jsx(
6
6
  "figcaption",
7
7
  {
8
+ "data-slot": "figure-caption",
8
9
  className: cn(
9
- "mt-2 text-sm leading-6 text-typography-caption-foreground",
10
+ "my-2 px-1 text-start text-xs leading-relaxed text-foreground-3 first:mt-0 last:mb-0 [&>p]:my-0 [&>p]:text-inherit [&>p+p]:mt-2",
10
11
  className
11
12
  ),
12
13
  ...props
@@ -1,10 +1,14 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
+ import { FigureCaption } from './figure-caption.js';
3
4
 
4
- type FigureProps = React.ComponentPropsWithoutRef<"figure"> & {
5
+ type FigureProps = React.ComponentProps<"figure"> & {
6
+ /** A fallback caption after the children. An authored caption takes precedence. */
5
7
  caption?: ReactNode;
6
- frame?: boolean | "default" | "none";
7
8
  };
8
- declare function Figure({ caption, children, className, ...props }: FigureProps): react_jsx_runtime.JSX.Element;
9
+ declare function Figure({ caption, children, className, ...props }: FigureProps): react.JSX.Element;
10
+ declare namespace Figure {
11
+ var Caption: typeof FigureCaption;
12
+ }
9
13
 
10
14
  export { Figure, type FigureProps };
@@ -1,26 +1,36 @@
1
1
  // src/components/mdx/figure/figure.tsx
2
- import { FigureCaption } from "@publish.os/nextjs/kernel/components/mdx/components/figure-caption";
2
+ import { FigureCaption } from "@components/mdx/components/figure-caption";
3
3
  import { cn } from "@publish.os/nextjs/utils/cn";
4
- import { Children, isValidElement } from "react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Children, Fragment, isValidElement } from "react";
5
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
6
+ function containsCaption(children) {
7
+ return Children.toArray(children).some(
8
+ (child) => isValidElement(child) && (child.type === "figcaption" || child.type === FigureCaption || child.type === Fragment && containsCaption(child.props.children))
9
+ );
10
+ }
6
11
  function Figure({
7
12
  caption,
8
13
  children,
9
14
  className,
10
15
  ...props
11
16
  }) {
12
- let authoredCaption = caption, mediaChildren = [];
13
- return Children.forEach(children, (child) => {
14
- if (isValidElement(child) && child.type === "figcaption") {
15
- authoredCaption = child.props.children;
16
- return;
17
+ let showFallbackCaption = caption != null && caption !== !1 && !containsCaption(children);
18
+ return /* @__PURE__ */ jsxs(
19
+ "figure",
20
+ {
21
+ className: cn(
22
+ "not-markdown-prose my-8 [&>*:has(+figcaption)]:mb-0 [&>figcaption+*]:mt-0",
23
+ className
24
+ ),
25
+ ...props,
26
+ children: [
27
+ children,
28
+ showFallbackCaption ? /* @__PURE__ */ jsx(FigureCaption, { children: caption }) : null
29
+ ]
17
30
  }
18
- mediaChildren.push(child);
19
- }), /* @__PURE__ */ jsxs("figure", { className: cn("not-markdown-prose my-8", className), ...props, children: [
20
- /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-3", children: mediaChildren }),
21
- authoredCaption ? /* @__PURE__ */ jsx(FigureCaption, { className: "mx-auto max-w-prose text-center", children: authoredCaption }) : null
22
- ] });
31
+ );
23
32
  }
33
+ Figure.Caption = FigureCaption;
24
34
  export {
25
35
  Figure
26
36
  };
@@ -1,6 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
 
3
3
  type FootnotesProps = React.ComponentPropsWithoutRef<"section">;
4
- declare function Footnotes({ className, ...props }: FootnotesProps): react_jsx_runtime.JSX.Element;
4
+ declare function Footnotes({ className, ...props }: FootnotesProps): react.JSX.Element;
5
5
 
6
6
  export { Footnotes, type FootnotesProps };
@@ -1,6 +1,6 @@
1
1
  // src/components/mdx/footnotes.tsx
2
2
  import { cn } from "@publish.os/nextjs/utils/cn";
3
- import { jsx } from "react/jsx-runtime";
3
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
4
4
  function Footnotes({ className, ...props }) {
5
5
  return /* @__PURE__ */ jsx(
6
6
  "section",
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  declare function headingCopyUrl({ href, id }: {
@@ -18,6 +18,6 @@ declare function HeadingCopyLink({ className, id, children, iconOnly, }: {
18
18
  id: string;
19
19
  children?: ReactNode;
20
20
  iconOnly?: boolean;
21
- }): react_jsx_runtime.JSX.Element;
21
+ }): react.JSX.Element;
22
22
 
23
23
  export { HeadingCopyLink, headingCopyUrl };
@@ -3,7 +3,7 @@
3
3
  // src/components/mdx/heading-copy-link.tsx
4
4
  import { LinkIcon } from "@phosphor-icons/react/ssr";
5
5
  import { cn } from "@publish.os/nextjs/utils/cn";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
7
7
  function headingCopyUrl({ href, id }) {
8
8
  let url = new URL(href);
9
9
  return url.hash = id, url.toString();
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ComponentPropsWithoutRef } from 'react';
3
3
 
4
4
  type HeadingElement = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
@@ -8,6 +8,6 @@ type HeadingProps<T extends HeadingElement> = {
8
8
  className?: string;
9
9
  };
10
10
 
11
- declare function Heading<T extends HeadingElement>({ as: Tag, children, className, id, ...props }: HeadingProps<T>): react_jsx_runtime.JSX.Element;
11
+ declare function Heading<T extends HeadingElement>({ as: Tag, children, className, id, ...props }: HeadingProps<T>): react.JSX.Element;
12
12
 
13
13
  export { Heading };
@@ -1,12 +1,12 @@
1
1
  // src/components/mdx/heading.tsx
2
- import { HeadingCopyLink } from "@publish.os/nextjs/kernel/components/mdx/components/heading-copy-link";
2
+ import { HeadingCopyLink } from "@components/mdx/components/heading-copy-link";
3
3
  import { cn } from "@publish.os/nextjs/utils/cn";
4
4
  import { headingToHTMLId } from "@publish.os/nextjs/utils/heading-ids";
5
5
  import {
6
6
  Children,
7
7
  isValidElement
8
8
  } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
10
10
  function isBrElement(node) {
11
11
  return isValidElement(node) && node.type === "br";
12
12
  }
@@ -33,7 +33,10 @@ function Heading({
33
33
  id,
34
34
  ...props
35
35
  }) {
36
- let cleaned = cleanHeadingChildren(children), headingId = id ?? headingToHTMLId(cleaned), isEmpty = !headingId || headingId === "empty-heading", classes = cn("scroll-mt-20", className);
36
+ let cleaned = cleanHeadingChildren(children), headingId = id ?? headingToHTMLId(cleaned), isEmpty = !headingId || headingId === "empty-heading", classes = cn(
37
+ "scroll-mt-[calc(var(--layout-global-nav-height)_+_1.5rem)] supports-[scroll-margin-top:anchor-size(--global-navbar_height)]:scroll-mt-[calc(anchor-size(--global-navbar_height,3.5rem)_+_1.5rem)]",
38
+ className
39
+ );
37
40
  return isEmpty ? (
38
41
  // @ts-expect-error — polymorphic `as` prop with spread is safe at runtime
39
42
  /* @__PURE__ */ jsx(Tag, { className, ...props, children: cleaned })
@@ -1,11 +1,11 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Separator as Separator$1 } from '@base-ui/react/separator';
1
+ import * as react from 'react';
3
2
  import { ComponentPropsWithoutRef } from 'react';
3
+ import { Separator as Separator$1 } from '@base-ui/react/separator';
4
4
 
5
5
  type SeparatorProps = ComponentPropsWithoutRef<typeof Separator$1>;
6
- declare function Separator({ className, orientation, ...props }: SeparatorProps): react_jsx_runtime.JSX.Element;
6
+ declare function Separator({ className, orientation, ...props }: SeparatorProps): react.JSX.Element;
7
7
 
8
8
  type HrProps = React.ComponentPropsWithoutRef<typeof Separator>;
9
- declare function Hr({ className, ...props }: HrProps): react_jsx_runtime.JSX.Element;
9
+ declare function Hr({ className, ...props }: HrProps): react.JSX.Element;
10
10
 
11
11
  export { Hr, type HrProps };