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

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 (223) hide show
  1. package/compiler-assets/nextjs/defaults/group/layout.tsx +1 -5
  2. package/compiler-assets/nextjs/defaults/group/page.tsx +31 -22
  3. package/compiler-assets/nextjs/defaults/project/next.config.mjs +19 -10
  4. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
  5. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  6. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  7. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +2 -0
  8. package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
  9. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  10. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  11. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  12. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  13. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  14. package/compiler-assets/nextjs/shims/proxy.ts +126 -60
  15. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
  16. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
  17. package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
  18. package/dist/{build-operation-2JAYBSKF.js → build-operation-5QMLXF7N.js} +29 -23
  19. package/dist/{button-c3WGnxIj.d.ts → button-BdCScEKi.d.ts} +3 -3
  20. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  21. package/dist/chunk-22RSSUNV.js +13 -0
  22. package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
  23. package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
  24. package/dist/chunk-5KAD7W53.js +248 -0
  25. package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
  26. package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
  27. package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
  28. package/dist/chunk-EFO6AWXN.js +19 -0
  29. package/dist/{chunk-726GV2NF.js → chunk-F3AGNDF4.js} +100 -67
  30. package/dist/chunk-GBPLER5H.js +426 -0
  31. package/dist/chunk-IL4RJOKI.js +186 -0
  32. package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
  33. package/dist/{chunk-VO2I7MTM.js → chunk-ORIUWJBQ.js} +8 -6
  34. package/dist/{chunk-H6XILMZX.js → chunk-OXOFRXEI.js} +1806 -831
  35. package/dist/chunk-UYGCOWRF.js +1709 -0
  36. package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
  37. package/dist/compiler.d.ts +15 -2
  38. package/dist/compiler.js +90 -21
  39. package/dist/components/blocks/agent-actions.d.ts +81 -0
  40. package/dist/components/blocks/agent-actions.js +594 -0
  41. package/dist/components/blocks/toc.d.ts +43 -0
  42. package/dist/components/blocks/toc.js +136 -0
  43. package/dist/components/ui/button.d.ts +5 -0
  44. package/dist/components/ui/button.js +94 -0
  45. package/dist/compose-CVBJRAF6.js +16 -0
  46. package/dist/config/createNextConfig.js +17 -3
  47. package/dist/{dev-operation-TZDVJCN7.js → dev-operation-OSHHWRWK.js} +121 -81
  48. package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
  49. package/dist/ide-support-CU6Z5PVR.js +16 -0
  50. package/dist/index.d.ts +40 -1
  51. package/dist/jsx-dev-runtime.d.ts +6 -0
  52. package/dist/jsx-dev-runtime.js +100 -0
  53. package/dist/jsx-runtime.d.ts +7 -0
  54. package/dist/jsx-runtime.js +97 -0
  55. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  56. package/dist/kernel/components/blocks/AgentActions.js +383 -142
  57. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  58. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  59. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  60. package/dist/kernel/components/blocks/color-palette.js +4 -4
  61. package/dist/kernel/components/blocks/logo-block.js +1 -1
  62. package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -2
  63. package/dist/kernel/components/blocks/navbar.js +17 -17
  64. package/dist/kernel/components/blocks/navigation-progress.js +2 -2
  65. package/dist/kernel/components/blocks/next-prev.js +1 -1
  66. package/dist/kernel/components/blocks/page-list.js +2 -2
  67. package/dist/kernel/components/blocks/search.d.ts +1 -1
  68. package/dist/kernel/components/blocks/search.js +16 -17
  69. package/dist/kernel/components/blocks/sidebar-node.js +1 -1
  70. package/dist/kernel/components/blocks/sidebar.js +7 -4
  71. package/dist/kernel/components/blocks/theme-toggle.d.ts +1 -1
  72. package/dist/kernel/components/blocks/theme-toggle.js +5 -5
  73. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  74. package/dist/kernel/components/blocks/toc-client.js +495 -0
  75. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  76. package/dist/kernel/components/blocks/toc.js +121 -179
  77. package/dist/kernel/components/mdx/components/blockquote.js +1 -1
  78. package/dist/kernel/components/mdx/components/callout.js +1 -1
  79. package/dist/kernel/components/mdx/components/code-block.js +2 -2
  80. package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
  81. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  82. package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
  83. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  84. package/dist/kernel/components/mdx/components/figure.js +23 -13
  85. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  86. package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
  87. package/dist/kernel/components/mdx/components/heading.js +6 -3
  88. package/dist/kernel/components/mdx/components/hr.js +2 -2
  89. package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
  90. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  91. package/dist/kernel/components/mdx/components/image.js +21 -16
  92. package/dist/kernel/components/mdx/components/inline-code.js +1 -1
  93. package/dist/kernel/components/mdx/components/kbd.js +2 -2
  94. package/dist/kernel/components/mdx/components/link.d.ts +3 -3
  95. package/dist/kernel/components/mdx/components/link.js +2 -2
  96. package/dist/kernel/components/mdx/components/paragraph.js +1 -1
  97. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  98. package/dist/kernel/components/mdx/components/table.js +2 -2
  99. package/dist/kernel/components/mdx/components/task-list.js +1 -1
  100. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  101. package/dist/kernel/components/mdx/components/video-player.js +6 -2
  102. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  103. package/dist/kernel/components/mdx/components/video.js +7 -5
  104. package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
  105. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  106. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  107. package/dist/kernel/components/mdx/mdx.d.ts +20 -10
  108. package/dist/kernel/components/mdx/mdx.js +231 -34
  109. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  110. package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
  111. package/dist/kernel/components/mdx/types.d.ts +1 -1
  112. package/dist/kernel/components/next-image.d.ts +12 -0
  113. package/dist/kernel/components/next-image.js +61 -0
  114. package/dist/kernel/components/ui/accordion.js +1 -1
  115. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -2
  116. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  117. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
  118. package/dist/kernel/components/ui/breadcrumb.js +4 -4
  119. package/dist/kernel/components/ui/button-group.d.ts +1 -1
  120. package/dist/kernel/components/ui/button-group.js +3 -3
  121. package/dist/kernel/components/ui/button.d.ts +56 -4
  122. package/dist/kernel/components/ui/button.js +43 -39
  123. package/dist/kernel/components/ui/card.js +1 -1
  124. package/dist/kernel/components/ui/dialog.js +1 -1
  125. package/dist/kernel/components/ui/drawer.js +1 -1
  126. package/dist/kernel/components/ui/input.d.ts +2 -2
  127. package/dist/kernel/components/ui/input.js +1 -1
  128. package/dist/kernel/components/ui/kbd.d.ts +1 -1
  129. package/dist/kernel/components/ui/kbd.js +1 -1
  130. package/dist/kernel/components/ui/link.d.ts +8 -2
  131. package/dist/kernel/components/ui/link.js +2 -2
  132. package/dist/kernel/components/ui/menu.js +1 -1
  133. package/dist/kernel/components/ui/mod-key.js +2 -2
  134. package/dist/kernel/components/ui/navigation-menu.js +1 -1
  135. package/dist/kernel/components/ui/popover.js +1 -1
  136. package/dist/kernel/components/ui/progress.js +1 -1
  137. package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
  138. package/dist/kernel/components/ui/scroll-area.js +1 -1
  139. package/dist/kernel/components/ui/select.js +1 -1
  140. package/dist/kernel/components/ui/separator.js +1 -1
  141. package/dist/kernel/components/ui/table.js +1 -1
  142. package/dist/kernel/components/ui/tabs.js +1 -1
  143. package/dist/kernel/components/ui/tag.js +1 -1
  144. package/dist/kernel/components/ui/text.d.ts +1 -1
  145. package/dist/kernel/components/ui/text.js +1 -1
  146. package/dist/kernel/components/ui/toast.js +1 -1
  147. package/dist/kernel/components/ui/tooltip.js +1 -1
  148. package/dist/kernel/defaults.registry.d.ts +2 -15
  149. package/dist/kernel/defaults.registry.js +2 -17
  150. package/dist/kernel/routes/agent/markdown.d.ts +3 -0
  151. package/dist/kernel/routes/agent/markdown.js +219 -48
  152. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  153. package/dist/kernel/routes/layouts/group.js +5 -7
  154. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  155. package/dist/kernel/routes/metadata/feed.js +109 -83
  156. package/dist/kernel/routes/metadata/llms.d.ts +11 -3
  157. package/dist/kernel/routes/metadata/llms.js +154 -57
  158. package/dist/kernel/routes/metadata/og-image.js +1 -1
  159. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  160. package/dist/kernel/routes/metadata/sitemap.d.ts +22 -3
  161. package/dist/kernel/routes/metadata/sitemap.js +183 -43
  162. package/dist/kernel/routes/not-found.d.ts +34 -0
  163. package/dist/kernel/routes/not-found.js +213 -0
  164. package/dist/kernel/routes/pages/group.d.ts +2 -2
  165. package/dist/kernel/routes/pages/group.js +1 -1
  166. package/dist/kernel/routes/pages/leaf.d.ts +30 -3
  167. package/dist/kernel/routes/pages/leaf.js +5 -4
  168. package/dist/kernel/routes/pages/root.d.ts +2 -2
  169. package/dist/kernel/routes/pages/root.js +1 -1
  170. package/dist/keyboard-shortcuts.js +1 -1
  171. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
  172. package/dist/search.js +7 -9
  173. package/dist/theme-scope.js +1 -1
  174. package/dist/{types-BzkZty3r.d.ts → types-J2w_puPF.d.ts} +1 -20
  175. package/dist/types-sM2g9nW0.d.ts +12 -0
  176. package/dist/types.d.ts +1 -0
  177. package/dist/utils/heading-ids.js +30 -11
  178. package/dist/utils/toc-selection.d.ts +7 -0
  179. package/dist/utils/toc-selection.js +14 -0
  180. package/dist/validate-local-source-SV44DBQT.js +16 -0
  181. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  182. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  183. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  184. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  185. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  186. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  187. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  188. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  189. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  190. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  191. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
  192. package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
  193. package/init/seed/minimal/publish.os/publish.os.config.json +6 -2
  194. package/init/seed/minimal/publish.os/theme.css +3 -3
  195. package/init/seed/minimal/seed.json +11 -4
  196. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
  197. package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
  198. package/package.json +45 -20
  199. package/release/app/phosphor/package.json +3 -3
  200. package/release/app/phosphor/pnpm-lock.yaml.template +88 -75
  201. package/release/compiler/package.json +5 -3
  202. package/release/compiler/pnpm-lock.yaml.template +118 -74
  203. package/release/release.json +6 -6
  204. package/dist/button-CtzUJB8u.d.ts +0 -11
  205. package/dist/chunk-535TM4A5.js +0 -1455
  206. package/dist/chunk-B2V22WRT.js +0 -297
  207. package/dist/chunk-NECL5IBJ.js +0 -318
  208. package/dist/chunk-SVYGXXYR.js +0 -36
  209. package/dist/chunk-UF6ATARM.js +0 -1100
  210. package/dist/compose-NN23UJGC.js +0 -13
  211. package/dist/ide-support-ZNW7ODFY.js +0 -15
  212. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  213. package/dist/kernel/components/blocks/design-system-preview.js +0 -667
  214. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  215. package/dist/kernel/components/blocks/link-playground.js +0 -744
  216. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  217. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  218. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  219. package/dist/kernel/components/ui/theme-toggle.js +0 -53
  220. package/dist/validate-local-source-XRL2Y7XE.js +0 -14
  221. package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
  222. package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
  223. 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
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",
@@ -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,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,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
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- type FigureCaptionProps = React.ComponentPropsWithoutRef<"figcaption">;
3
+ type FigureCaptionProps = React.ComponentProps<"figcaption">;
4
4
  declare function FigureCaption({ className, ...props }: FigureCaptionProps): react_jsx_runtime.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
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { FigureCaption } from './figure-caption.js';
2
3
  import { ReactNode } from 'react';
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
9
  declare function Figure({ caption, children, className, ...props }: FigureProps): react_jsx_runtime.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
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",
@@ -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,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,6 +1,6 @@
1
1
  // src/components/mdx/hr.tsx
2
- import { Separator } from "@publish.os/nextjs/kernel/components/ui/separator";
3
- import { jsx } from "react/jsx-runtime";
2
+ import { Separator } from "@components/ui/separator";
3
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
4
4
  function Hr({ className, ...props }) {
5
5
  return /* @__PURE__ */ jsx(Separator, { className, ...props });
6
6
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/components/mdx/image/image-zoom.tsx
4
4
  import Zoom from "react-medium-image-zoom";
5
- import { jsx } from "react/jsx-runtime";
5
+ import { jsx } from "@publish.os/nextjs/jsx-runtime";
6
6
  function ImageZoom({
7
7
  children,
8
8
  enabled
@@ -16,6 +16,6 @@ type ImageProps = Omit<React.ComponentPropsWithoutRef<"img">, "height" | "sizes"
16
16
  width?: number;
17
17
  zoom?: boolean;
18
18
  };
19
- declare function Image({ alt, aspect, caption, className, decorative, fill, frame, height, intrinsicHeight, intrinsicWidth, optimized, priority, quality, sizes, src, width, zoom, ...props }: ImageProps): react_jsx_runtime.JSX.Element | null;
19
+ declare function Image({ alt, aspect, caption, className, decorative: authoredDecorative, fill: authoredFill, frame, height, intrinsicHeight, intrinsicWidth, optimized: authoredOptimized, priority: authoredPriority, quality, sizes, src, width, zoom: authoredZoom, ...props }: ImageProps): react_jsx_runtime.JSX.Element | null;
20
20
 
21
21
  export { Image, type ImageProps };
@@ -1,9 +1,13 @@
1
1
  // src/components/mdx/image/image.tsx
2
- import { FigureCaption } from "@publish.os/nextjs/kernel/components/mdx/components/figure-caption";
3
- import { ImageZoom } from "@publish.os/nextjs/kernel/components/mdx/components/image-zoom";
2
+ import { FigureCaption } from "@components/mdx/components/figure-caption";
3
+ import { ImageZoom } from "@components/mdx/components/image-zoom";
4
4
  import { cn } from "@publish.os/nextjs/utils/cn";
5
5
  import NextImage from "next/image";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
7
+ function resolveImageBoolean(value) {
8
+ if (value === !0 || value === "true") return !0;
9
+ if (value === !1 || value === "false") return !1;
10
+ }
7
11
  function parseAspect(value) {
8
12
  if (typeof value == "number" && Number.isFinite(value) && value > 0)
9
13
  return value;
@@ -41,7 +45,7 @@ function renderImage({
41
45
  sizes,
42
46
  width
43
47
  }) {
44
- if (optimized && (fill || width && height)) {
48
+ if (optimized && imageProps.src && (fill || width && height)) {
45
49
  let maxWidth = fill ? "var(--publish-content-width, 72rem)" : `${width}px`;
46
50
  return /* @__PURE__ */ jsx(
47
51
  NextImage,
@@ -50,7 +54,8 @@ function renderImage({
50
54
  priority,
51
55
  quality,
52
56
  sizes: sizes ?? `(max-width: 768px) 100vw, min(${maxWidth}, 100vw)`,
53
- ...imageProps
57
+ ...imageProps,
58
+ src: imageProps.src
54
59
  }
55
60
  );
56
61
  }
@@ -74,30 +79,30 @@ function Image({
74
79
  aspect,
75
80
  caption,
76
81
  className,
77
- decorative = !1,
78
- fill = !1,
82
+ decorative: authoredDecorative,
83
+ fill: authoredFill,
79
84
  frame = "default",
80
85
  height,
81
86
  intrinsicHeight,
82
87
  intrinsicWidth,
83
- optimized = !1,
84
- priority,
88
+ optimized: authoredOptimized,
89
+ priority: authoredPriority,
85
90
  quality,
86
91
  sizes,
87
92
  src,
88
93
  width,
89
- zoom = !0,
94
+ zoom: authoredZoom,
90
95
  ...props
91
96
  }) {
92
- if (!src) return null;
93
- let layout = resolveImageLayout({
97
+ if (!src && !props.srcSet) return null;
98
+ let decorative = resolveImageBoolean(authoredDecorative) ?? !1, fill = resolveImageBoolean(authoredFill) ?? !1, optimized = resolveImageBoolean(authoredOptimized) ?? !1, priority = resolveImageBoolean(authoredPriority), zoom = resolveImageBoolean(authoredZoom) ?? !0, layout = resolveImageLayout({
94
99
  aspect,
95
100
  fill,
96
101
  height,
97
102
  intrinsicHeight,
98
103
  intrinsicWidth,
99
104
  width
100
- }), imageAlt = decorative ? "" : alt ?? "", framed = frame !== !1 && frame !== "none", stringSrc = String(src), useNextImage = optimized && stringSrc.startsWith("/"), imageClassName = cn(
105
+ }), imageAlt = decorative ? "" : alt ?? "", framed = resolveImageBoolean(frame) ?? frame !== "none", stringSrc = src ? String(src) : void 0, useNextImage = !!(optimized && stringSrc?.startsWith("/")), imageClassName = cn(
101
106
  "block h-full w-full transition-opacity duration-200",
102
107
  fill ? "object-cover" : "object-contain",
103
108
  zoom && "cursor-zoom-in hover:opacity-90",
@@ -128,10 +133,10 @@ function Image({
128
133
  children: /* @__PURE__ */ jsx(ImageZoom, { enabled: zoom, children: image })
129
134
  }
130
135
  );
131
- return caption ? /* @__PURE__ */ jsxs("figure", { className: "not-markdown-prose my-8", children: [
136
+ return caption ? /* @__PURE__ */ jsxs("figure", { className: "not-markdown-prose my-8 w-full", children: [
132
137
  content,
133
- /* @__PURE__ */ jsx(FigureCaption, { className: "mx-auto max-w-prose text-center", children: caption })
134
- ] }) : /* @__PURE__ */ jsx("div", { className: "not-markdown-prose my-6 flex justify-center", children: content });
138
+ /* @__PURE__ */ jsx(FigureCaption, { children: caption })
139
+ ] }) : /* @__PURE__ */ jsx("div", { className: "not-markdown-prose my-6 flex w-full justify-center", children: content });
135
140
  }
136
141
  export {
137
142
  Image