@publish.os/nextjs 0.0.1-alpha.81 → 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 (265) hide show
  1. package/compiler-assets/nextjs/defaults/app/globals.css +1 -0
  2. package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
  3. package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
  4. package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
  5. package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
  6. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
  7. package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
  8. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  9. package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
  10. package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
  11. package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
  12. package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
  13. package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
  14. package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
  15. package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
  16. package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
  17. package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
  18. package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
  19. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
  20. package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
  21. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  22. package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
  23. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
  24. package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
  25. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  26. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  27. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  28. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  29. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  30. package/compiler-assets/nextjs/shims/proxy.ts +143 -65
  31. package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
  32. package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
  33. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
  34. package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
  35. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
  36. package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
  37. package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
  38. package/dist/build-operation-5QMLXF7N.js +89 -0
  39. package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
  40. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  41. package/dist/chunk-22RSSUNV.js +13 -0
  42. package/dist/chunk-4BC2L2KA.js +620 -0
  43. package/dist/chunk-5J3YUNRY.js +121 -0
  44. package/dist/chunk-5KAD7W53.js +248 -0
  45. package/dist/chunk-6C65KV7O.js +142 -0
  46. package/dist/chunk-6D2E6UMD.js +695 -0
  47. package/dist/chunk-7NY22B5U.js +161 -0
  48. package/dist/chunk-AI2UULNX.js +9 -0
  49. package/dist/chunk-EFO6AWXN.js +19 -0
  50. package/dist/chunk-F3AGNDF4.js +2377 -0
  51. package/dist/chunk-GBPLER5H.js +426 -0
  52. package/dist/chunk-IL4RJOKI.js +186 -0
  53. package/dist/chunk-NNBJZPFM.js +193 -0
  54. package/dist/chunk-ORIUWJBQ.js +58 -0
  55. package/dist/chunk-OXOFRXEI.js +7129 -0
  56. package/dist/chunk-UYGCOWRF.js +1709 -0
  57. package/dist/chunk-WL75GQ5M.js +80 -0
  58. package/dist/compiler.d.ts +54 -7
  59. package/dist/compiler.js +121 -13147
  60. package/dist/components/blocks/agent-actions.d.ts +81 -0
  61. package/dist/components/blocks/agent-actions.js +594 -0
  62. package/dist/components/blocks/toc.d.ts +43 -0
  63. package/dist/components/blocks/toc.js +136 -0
  64. package/dist/components/ui/button.d.ts +5 -0
  65. package/dist/components/ui/button.js +94 -0
  66. package/dist/compose-CVBJRAF6.js +16 -0
  67. package/dist/config/createNextConfig.js +27 -0
  68. package/dist/dev-operation-OSHHWRWK.js +1095 -0
  69. package/dist/framework-selection-ZVO323PK.js +11 -0
  70. package/dist/ide-support-CU6Z5PVR.js +16 -0
  71. package/dist/index.d.ts +55 -4
  72. package/dist/jsx-dev-runtime.d.ts +6 -0
  73. package/dist/jsx-dev-runtime.js +100 -0
  74. package/dist/jsx-runtime.d.ts +7 -0
  75. package/dist/jsx-runtime.js +97 -0
  76. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  77. package/dist/kernel/components/blocks/AgentActions.js +401 -150
  78. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  79. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  80. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  81. package/dist/kernel/components/blocks/color-palette.js +4 -4
  82. package/dist/kernel/components/blocks/logo-block.js +3 -3
  83. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
  84. package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
  85. package/dist/kernel/components/blocks/navbar.d.ts +2 -2
  86. package/dist/kernel/components/blocks/navbar.js +406 -65
  87. package/dist/kernel/components/blocks/navigation-progress.js +6 -3
  88. package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
  89. package/dist/kernel/components/blocks/next-prev.js +12 -24
  90. package/dist/kernel/components/blocks/page-list.d.ts +1 -1
  91. package/dist/kernel/components/blocks/page-list.js +7 -6
  92. package/dist/kernel/components/blocks/search.d.ts +83 -58
  93. package/dist/kernel/components/blocks/search.js +554 -428
  94. package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
  95. package/dist/kernel/components/blocks/sidebar-node.js +12 -10
  96. package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
  97. package/dist/kernel/components/blocks/sidebar.js +24 -14
  98. package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
  99. package/dist/kernel/components/blocks/theme-toggle.js +47 -1
  100. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  101. package/dist/kernel/components/blocks/toc-client.js +495 -0
  102. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  103. package/dist/kernel/components/blocks/toc.js +122 -180
  104. package/dist/kernel/components/mdx/components/blockquote.js +2 -2
  105. package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
  106. package/dist/kernel/components/mdx/components/callout.js +67 -36
  107. package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
  108. package/dist/kernel/components/mdx/components/code-block.js +106 -5
  109. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
  110. package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
  111. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  112. package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
  113. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  114. package/dist/kernel/components/mdx/components/figure.js +24 -14
  115. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  116. package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
  117. package/dist/kernel/components/mdx/components/heading.js +6 -3
  118. package/dist/kernel/components/mdx/components/hr.js +2 -2
  119. package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
  120. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  121. package/dist/kernel/components/mdx/components/image.js +94 -68
  122. package/dist/kernel/components/mdx/components/inline-code.js +2 -2
  123. package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
  124. package/dist/kernel/components/mdx/components/kbd.js +5 -4
  125. package/dist/kernel/components/mdx/components/link.d.ts +35 -4
  126. package/dist/kernel/components/mdx/components/link.js +3 -3
  127. package/dist/kernel/components/mdx/components/paragraph.js +2 -5
  128. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  129. package/dist/kernel/components/mdx/components/table.js +2 -2
  130. package/dist/kernel/components/mdx/components/task-list.js +2 -2
  131. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  132. package/dist/kernel/components/mdx/components/video-player.js +8 -4
  133. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  134. package/dist/kernel/components/mdx/components/video.js +8 -6
  135. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  136. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  137. package/dist/kernel/components/mdx/mdx.d.ts +28 -14
  138. package/dist/kernel/components/mdx/mdx.js +336 -63
  139. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  140. package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
  141. package/dist/kernel/components/next-image.d.ts +12 -0
  142. package/dist/kernel/components/next-image.js +61 -0
  143. package/dist/kernel/components/ui/accordion.js +1 -1
  144. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
  145. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  146. package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
  147. package/dist/kernel/components/ui/breadcrumb.js +10 -8
  148. package/dist/kernel/components/ui/button-group.js +8 -7
  149. package/dist/kernel/components/ui/button.d.ts +58 -6
  150. package/dist/kernel/components/ui/button.js +43 -39
  151. package/dist/kernel/components/ui/card.d.ts +2 -2
  152. package/dist/kernel/components/ui/card.js +1 -1
  153. package/dist/kernel/components/ui/dialog.js +1 -1
  154. package/dist/kernel/components/ui/drawer.d.ts +3 -1
  155. package/dist/kernel/components/ui/drawer.js +6 -2
  156. package/dist/kernel/components/ui/input.d.ts +2 -2
  157. package/dist/kernel/components/ui/input.js +1 -1
  158. package/dist/kernel/components/ui/kbd.js +10 -17
  159. package/dist/kernel/components/ui/link.d.ts +11 -3
  160. package/dist/kernel/components/ui/link.js +12 -11
  161. package/dist/kernel/components/ui/menu.js +6 -6
  162. package/dist/kernel/components/ui/mod-key.d.ts +10 -0
  163. package/dist/kernel/components/ui/mod-key.js +36 -0
  164. package/dist/kernel/components/ui/navigation-menu.js +3 -3
  165. package/dist/kernel/components/ui/popover.js +1 -1
  166. package/dist/kernel/components/ui/progress.js +2 -2
  167. package/dist/kernel/components/ui/scroll-area.js +5 -5
  168. package/dist/kernel/components/ui/select.js +8 -11
  169. package/dist/kernel/components/ui/separator.js +1 -1
  170. package/dist/kernel/components/ui/table.js +1 -1
  171. package/dist/kernel/components/ui/tabs.js +1 -1
  172. package/dist/kernel/components/ui/tag.js +1 -1
  173. package/dist/kernel/components/ui/text.d.ts +2 -2
  174. package/dist/kernel/components/ui/text.js +1 -1
  175. package/dist/kernel/components/ui/toast.js +1 -1
  176. package/dist/kernel/components/ui/tooltip.js +1 -1
  177. package/dist/kernel/defaults.registry.d.ts +11 -24
  178. package/dist/kernel/defaults.registry.js +11 -26
  179. package/dist/kernel/routes/agent/markdown.d.ts +3 -1
  180. package/dist/kernel/routes/agent/markdown.js +219 -48
  181. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  182. package/dist/kernel/routes/layouts/group.js +5 -7
  183. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  184. package/dist/kernel/routes/metadata/feed.js +111 -81
  185. package/dist/kernel/routes/metadata/llms.d.ts +12 -3
  186. package/dist/kernel/routes/metadata/llms.js +156 -59
  187. package/dist/kernel/routes/metadata/og-image.js +1 -1
  188. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  189. package/dist/kernel/routes/metadata/robots.js +2 -2
  190. package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
  191. package/dist/kernel/routes/metadata/sitemap.js +206 -38
  192. package/dist/kernel/routes/not-found.d.ts +34 -0
  193. package/dist/kernel/routes/not-found.js +213 -0
  194. package/dist/kernel/routes/pages/group.d.ts +2 -2
  195. package/dist/kernel/routes/pages/group.js +21 -13
  196. package/dist/kernel/routes/pages/leaf.d.ts +28 -1
  197. package/dist/kernel/routes/pages/leaf.js +25 -16
  198. package/dist/kernel/routes/pages/root.js +19 -13
  199. package/dist/keyboard-shortcuts.js +1 -1
  200. package/dist/resolvers/manifest-resolver.js +29 -6
  201. package/dist/search.d.ts +6 -7
  202. package/dist/search.js +52 -29
  203. package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
  204. package/dist/theme-scope.js +1 -1
  205. package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
  206. package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
  207. package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
  208. package/dist/types.d.ts +15 -6
  209. package/dist/utils/heading-ids.js +30 -11
  210. package/dist/utils/toc-selection.d.ts +7 -0
  211. package/dist/utils/toc-selection.js +14 -0
  212. package/dist/validate-local-source-SV44DBQT.js +16 -0
  213. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  214. package/init/seed/minimal/.gitignore +1 -0
  215. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  216. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  217. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  218. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  219. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  220. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  221. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  222. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  223. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  224. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
  225. package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
  226. package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
  227. package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
  228. package/init/seed/minimal/publish.os/theme.css +52 -24
  229. package/init/seed/minimal/publish.os/tsconfig.json +3 -0
  230. package/init/seed/minimal/seed.json +12 -2
  231. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
  232. package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
  233. package/init/seed/scratch/seed.json +5 -0
  234. package/package.json +55 -44
  235. package/release/app/phosphor/package.json +5 -5
  236. package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
  237. package/release/app/phosphor/pnpm-workspace.yaml +3 -0
  238. package/release/compiler/package.json +5 -3
  239. package/release/compiler/pnpm-lock.yaml.template +500 -303
  240. package/release/compiler/pnpm-workspace.yaml +3 -0
  241. package/release/release.json +8 -37
  242. package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
  243. package/dist/icons.d.ts +0 -1
  244. package/dist/icons.js +0 -2
  245. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  246. package/dist/kernel/components/blocks/design-system-preview.js +0 -648
  247. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  248. package/dist/kernel/components/blocks/link-playground.js +0 -744
  249. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  250. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  251. package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
  252. package/dist/kernel/components/mdx/components/pre.js +0 -18
  253. package/dist/kernel/components/ui/meta-key.d.ts +0 -17
  254. package/dist/kernel/components/ui/meta-key.js +0 -9
  255. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  256. package/dist/kernel/components/ui/theme-toggle.js +0 -58
  257. package/dist/kernel/framework-icons.d.ts +0 -1
  258. package/dist/kernel/framework-icons.js +0 -39
  259. package/dist/link-CYaCRDb6.d.ts +0 -35
  260. package/release/app/lucide/package.json +0 -30
  261. package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
  262. package/release/app/lucide/pnpm-workspace.yaml +0 -11
  263. package/release/app/tabler/package.json +0 -30
  264. package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
  265. package/release/app/tabler/pnpm-workspace.yaml +0 -11
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
 
3
- // src/components/block/agent-actions.tsx
4
- import { AnimatedIconSwap } from "@publish.os/nextjs/kernel/components/blocks/animated-icon-swap";
3
+ // src/modules/agent-actions/agent-actions.tsx
4
+ import { AnimatedIconSwap } from "@components/blocks/animated-icon-swap";
5
5
  import {
6
6
  Button,
7
7
  buttonVariants
8
- } from "@publish.os/nextjs/kernel/components/ui/button";
9
- import { ButtonGroup, ButtonGroupSeparator } from "@publish.os/nextjs/kernel/components/ui/button-group";
8
+ } from "@components/ui/button";
9
+ import { ButtonGroup, ButtonGroupSeparator } from "@components/ui/button-group";
10
10
  import {
11
11
  Menu,
12
12
  MenuGroup,
@@ -16,28 +16,27 @@ import {
16
16
  MenuPopup,
17
17
  MenuPortal,
18
18
  MenuPositioner,
19
+ MenuSeparator,
19
20
  MenuTrigger
20
- } from "@publish.os/nextjs/kernel/components/ui/menu";
21
+ } from "@components/ui/menu";
21
22
  import {
22
- FrameworkBotIcon as Bot,
23
- FrameworkCheckIcon as Check,
24
- FrameworkChevronDownIcon as ChevronDown,
25
- FrameworkClipboardIcon as Clipboard,
26
- FrameworkExternalLinkIcon as ExternalLink,
27
- FrameworkEyeIcon as Eye,
28
- FrameworkGithubIcon as Github,
29
- FrameworkLinkIcon as Link,
30
- FrameworkMessageCircleIcon as MessageCircle
31
- } from "@publish.os/nextjs/kernel/framework-icons";
23
+ CaretDownIcon,
24
+ CheckIcon,
25
+ CopyIcon,
26
+ MarkdownLogoIcon
27
+ } from "@phosphor-icons/react/ssr";
32
28
  import { cn } from "@publish.os/nextjs/utils/cn";
33
29
  import {
30
+ createContext,
31
+ Fragment,
32
+ use,
34
33
  useCallback,
35
34
  useEffect,
36
35
  useRef,
37
36
  useState
38
37
  } from "react";
39
38
  import { flushSync } from "react-dom";
40
- import { jsx, jsxs } from "react/jsx-runtime";
39
+ import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
41
40
  var DEFAULT_PROMPT_SUFFIX = "I want to ask questions about it.", COPY_FEEDBACK_MS = 1600;
42
41
  function normalizePath(path) {
43
42
  let [pathname = "/"] = path.split(/[?#]/), prefixed = pathname.startsWith("/") ? pathname : `/${pathname}`;
@@ -81,42 +80,36 @@ var DEFAULT_PRIMARY_ACTION = {
81
80
  {
82
81
  id: "open-claude",
83
82
  title: "Claude",
84
- icon: /* @__PURE__ */ jsx(Bot, { "aria-hidden": "true", className: "size-4" }),
85
83
  href: ({ prompt }) => providerPromptUrl("https://claude.ai/new", prompt),
86
84
  openInNew: !0
87
85
  },
88
86
  {
89
87
  id: "open-chatgpt",
90
88
  title: "ChatGPT",
91
- icon: /* @__PURE__ */ jsx(MessageCircle, { "aria-hidden": "true", className: "size-4" }),
92
89
  href: ({ prompt }) => providerPromptUrl("https://chatgpt.com/?hints=search", prompt),
93
90
  openInNew: !0
94
91
  },
95
92
  {
96
93
  id: "open-cursor",
97
94
  title: "Cursor",
98
- icon: /* @__PURE__ */ jsx(ExternalLink, { "aria-hidden": "true", className: "size-4" }),
99
95
  href: ({ prompt }) => providerPromptUrl("https://cursor.com/link/prompt", prompt, "text"),
100
96
  openInNew: !0
101
97
  },
102
98
  {
103
99
  id: "open-copilot",
104
100
  title: "Copilot",
105
- icon: /* @__PURE__ */ jsx(MessageCircle, { "aria-hidden": "true", className: "size-4" }),
106
101
  href: ({ prompt }) => providerPromptUrl("https://copilot.microsoft.com/", prompt),
107
102
  openInNew: !0
108
103
  },
109
104
  {
110
105
  id: "open-t3-chat",
111
106
  title: "T3 Chat",
112
- icon: /* @__PURE__ */ jsx(MessageCircle, { "aria-hidden": "true", className: "size-4" }),
113
107
  href: ({ prompt }) => providerPromptUrl("https://t3.chat/new", prompt),
114
108
  openInNew: !0
115
109
  },
116
110
  {
117
111
  id: "open-github",
118
112
  title: "GitHub source",
119
- icon: /* @__PURE__ */ jsx(Github, { "aria-hidden": "true", className: "size-4" }),
120
113
  href: ({ sourceUrl }) => sourceUrl,
121
114
  openInNew: !0,
122
115
  disabled: ({ sourceUrl }) => !sourceUrl
@@ -129,19 +122,17 @@ var DEFAULT_PRIMARY_ACTION = {
129
122
  actions: [
130
123
  {
131
124
  id: "copy-page-markdown",
132
- title: "Copy page Markdown",
125
+ title: "Copy markdown",
133
126
  copy: "page-markdown"
134
127
  },
135
128
  {
136
129
  id: "view-page-markdown",
137
130
  title: "View as Markdown",
138
- icon: /* @__PURE__ */ jsx(Eye, { "aria-hidden": "true", className: "size-4" }),
139
131
  href: ({ markdownPath }) => markdownPath
140
132
  },
141
133
  {
142
134
  id: "copy-page-link",
143
- title: "Copy page link",
144
- icon: /* @__PURE__ */ jsx(Link, { "aria-hidden": "true", className: "size-4" }),
135
+ title: "Copy link",
145
136
  copy: "page-link"
146
137
  }
147
138
  ]
@@ -151,37 +142,67 @@ function resolveValue(value, context) {
151
142
  return typeof value == "function" ? value(context) : value;
152
143
  }
153
144
  async function copyText(text) {
154
- await navigator.clipboard?.writeText(text);
145
+ if (!navigator.clipboard?.writeText)
146
+ throw new Error("Clipboard access is not available in this browser.");
147
+ await navigator.clipboard.writeText(text);
155
148
  }
156
- function AgentActions({
149
+ function revisionRequestPath(path, revision) {
150
+ if (!revision) return path;
151
+ let separator = path.includes("?") ? "&" : "?";
152
+ return `${path}${separator}publishos_revision=${encodeURIComponent(revision)}`;
153
+ }
154
+ async function markdownHash(text) {
155
+ if (!globalThis.crypto?.subtle)
156
+ throw new Error("This browser cannot verify the current Markdown version.");
157
+ let digest = await globalThis.crypto.subtle.digest(
158
+ "SHA-256",
159
+ new TextEncoder().encode(text)
160
+ );
161
+ return `sha256-${Array.from(
162
+ new Uint8Array(digest),
163
+ (byte) => byte.toString(16).padStart(2, "0")
164
+ ).join("").slice(0, 32)}`;
165
+ }
166
+ var AgentActionsContext = createContext(
167
+ null
168
+ );
169
+ function useAgentActions() {
170
+ let context = use(AgentActionsContext);
171
+ if (!context)
172
+ throw new Error("AgentActions parts must be inside AgentActions.Root.");
173
+ return context;
174
+ }
175
+ function AgentActionsProvider({
157
176
  actionGroups,
158
- buttonSize = "sm",
177
+ buttonSize = "xs",
159
178
  buttonVariant = "outline",
160
179
  className,
161
180
  markdown,
162
181
  markdownPath,
182
+ markdownRevision,
163
183
  markdownUrl,
164
184
  menuLabel = "More agent actions",
185
+ markdownLinkLabel = "View as Markdown",
165
186
  pagePath,
166
187
  pageUrl,
167
188
  primaryAction,
168
189
  prompt,
169
190
  siteUrl,
170
191
  sourceUrl,
192
+ showMarkdownLink = !0,
193
+ children,
171
194
  ...props
172
195
  }) {
173
- let [copiedActionId, setCopiedActionId] = useState(), [menuOpen, setMenuOpen] = useState(!1), menuActionsRef = useRef(null), menuOpenRef = useRef(!1), resetTimerRef = useRef(
196
+ let [copiedActionId, setCopiedActionId] = useState(), [copyFeedback, setCopyFeedback] = useState(), [menuOpen, setMenuOpen] = useState(!1), menuTriggerRef = useRef(null), menuActionsRef = useRef(null), menuOpenRef = useRef(!1), markdownPreparationRef = useRef(null), currentMarkdownKeyRef = useRef(""), resetTimerRef = useRef(
174
197
  void 0
175
- ), setMenuOpenState = useCallback((open) => {
176
- menuOpenRef.current = open, setMenuOpen(open);
177
- }, []), closeMenu = useCallback(() => {
198
+ ), closeMenu = useCallback(() => {
178
199
  flushSync(() => {
179
200
  menuOpenRef.current = !1, setMenuOpen(!1), menuActionsRef.current?.close(), menuActionsRef.current?.unmount();
180
201
  });
181
202
  }, []);
182
- useEffect(() => (window.addEventListener("pagehide", closeMenu), window.addEventListener("pageshow", closeMenu), () => {
183
- window.removeEventListener("pagehide", closeMenu), window.removeEventListener("pageshow", closeMenu), resetTimerRef.current && clearTimeout(resetTimerRef.current);
184
- }), [closeMenu]);
203
+ useEffect(() => () => {
204
+ resetTimerRef.current && clearTimeout(resetTimerRef.current);
205
+ }, []);
185
206
  let resolvedPagePath = pagePath ?? "/", resolvedMarkdownPath = markdownPath ?? markdownPathForPagePath(resolvedPagePath), resolvedMarkdownUrl = absoluteUrl(
186
207
  markdownUrl ?? resolvedMarkdownPath,
187
208
  siteUrl
@@ -193,151 +214,381 @@ function AgentActions({
193
214
  pageUrl: absoluteUrl(pageUrl ?? resolvedPagePath, siteUrl),
194
215
  prompt: prompt ?? createPrompt(resolvedMarkdownUrl),
195
216
  sourceUrl
196
- }, resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION, resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS, markCopied = (actionId) => {
217
+ }, markdownKey = `${context.markdownUrl}\0${markdownRevision ?? "unversioned"}`;
218
+ currentMarkdownKeyRef.current = markdownKey, useEffect(
219
+ () => () => {
220
+ markdownPreparationRef.current?.controller?.abort(), markdownPreparationRef.current = null;
221
+ },
222
+ []
223
+ ), useEffect(() => {
224
+ let preparation = markdownPreparationRef.current;
225
+ preparation && preparation.key !== markdownKey && (preparation.controller?.abort(), markdownPreparationRef.current = null, setCopyFeedback(void 0), setCopiedActionId(void 0));
226
+ }, [markdownKey]);
227
+ let resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION, resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS, markCopied = (actionId) => {
197
228
  resetTimerRef.current && clearTimeout(resetTimerRef.current), setCopiedActionId(actionId), resetTimerRef.current = setTimeout(() => {
198
229
  setCopiedActionId(void 0);
199
230
  }, COPY_FEEDBACK_MS);
200
- }, copyValueForAction = async (action) => {
201
- if (action.copy === "page-markdown") {
202
- if (context.markdownUrl)
203
- try {
204
- let response = await fetch(context.markdownUrl);
205
- if (response.ok) return response.text();
206
- } catch {
207
- return context.markdown ?? "";
231
+ }, markdownPreparation = () => {
232
+ let current = markdownPreparationRef.current;
233
+ if (current?.key === markdownKey) return current;
234
+ current?.controller?.abort();
235
+ let next = { key: markdownKey };
236
+ return markdownPreparationRef.current = next, next;
237
+ }, prepareMarkdown = () => {
238
+ if (context.markdown !== void 0 || !context.markdownUrl) return;
239
+ let record = markdownPreparation();
240
+ if (record.text !== void 0 || record.pending) return;
241
+ let controller = new AbortController();
242
+ record.controller = controller;
243
+ let requestPath = revisionRequestPath(
244
+ context.markdownPath,
245
+ markdownRevision
246
+ ), localPreview = process.env.NODE_ENV !== "production", request = async (cache) => {
247
+ let response;
248
+ try {
249
+ response = await fetch(requestPath, {
250
+ cache,
251
+ signal: controller.signal
252
+ });
253
+ } catch {
254
+ throw new Error("The Markdown page could not be loaded.");
255
+ }
256
+ if (!response.ok)
257
+ throw new Error(
258
+ `The Markdown page could not be loaded (${response.status}).`
259
+ );
260
+ return response.text();
261
+ }, pending = (async () => {
262
+ let firstBody = await request(localPreview ? "no-store" : "default");
263
+ if (!markdownRevision || await markdownHash(firstBody) === markdownRevision)
264
+ return firstBody;
265
+ let refreshedBody = await request(localPreview ? "no-store" : "reload");
266
+ if (await markdownHash(refreshedBody) !== markdownRevision)
267
+ throw new Error(
268
+ "The Markdown page changed while loading. Refresh the page and try again."
269
+ );
270
+ return refreshedBody;
271
+ })().then((text) => (markdownPreparationRef.current === record && currentMarkdownKeyRef.current === record.key && (record.text = text), text)).catch((error) => {
272
+ throw markdownPreparationRef.current === record && (markdownPreparationRef.current = null), error;
273
+ }).finally(() => {
274
+ record.pending = void 0, record.controller = void 0;
275
+ });
276
+ record.pending = pending, pending.catch(() => {
277
+ });
278
+ }, setMenuOpenState = (open) => {
279
+ menuOpenRef.current = open, setMenuOpen(open), open && resolvedActionGroups.some(
280
+ (group) => group.actions.some(
281
+ (action) => action.copy === "page-markdown" && !resolveValue(action.disabled, context)
282
+ )
283
+ ) && prepareMarkdown();
284
+ }, prepareAction = (action) => {
285
+ action.copy === "page-markdown" && !resolveValue(action.disabled, context) && prepareMarkdown();
286
+ }, finishAction = async (action, clipboardWrite, actionMarkdownKey) => {
287
+ try {
288
+ if (await clipboardWrite, actionMarkdownKey && currentMarkdownKeyRef.current !== actionMarkdownKey)
289
+ return;
290
+ markCopied(action.id), setCopyFeedback("Copied to clipboard."), await action.onSelect?.(context);
291
+ } catch (error) {
292
+ if (actionMarkdownKey && currentMarkdownKeyRef.current !== actionMarkdownKey)
293
+ return;
294
+ setCopyFeedback(
295
+ error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
296
+ );
297
+ }
298
+ }, handleAction = (action) => {
299
+ if (resolveValue(action.disabled, context)) return;
300
+ if (setCopyFeedback(void 0), setCopiedActionId(void 0), !action.copy) {
301
+ Promise.resolve(action.onSelect?.(context)).catch(
302
+ (error) => {
303
+ setCopyFeedback(
304
+ error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
305
+ );
208
306
  }
209
- return context.markdown ?? "";
307
+ );
308
+ return;
210
309
  }
211
- return action.copy === "page-link" ? context.pageUrl : action.copy === "markdown-link" ? context.markdownUrl : action.copy ?? "";
212
- }, handleAction = async (action) => {
213
- if (!resolveValue(action.disabled, context)) {
214
- if (action.copy) {
215
- let value = await copyValueForAction(action);
216
- value && (await copyText(value), markCopied(action.id));
310
+ if (action.copy === "page-markdown" && context.markdown === void 0) {
311
+ if (!context.markdownUrl) {
312
+ setCopyFeedback("The Markdown page URL is not available. Try again.");
313
+ return;
217
314
  }
218
- await action.onSelect?.(context);
315
+ let record = markdownPreparation();
316
+ if (record.text !== void 0) {
317
+ if (!record.text) {
318
+ setCopyFeedback("There is no Markdown content to copy. Try again.");
319
+ return;
320
+ }
321
+ finishAction(action, copyText(record.text), record.key);
322
+ return;
323
+ }
324
+ setCopyFeedback("Preparing Markdown\u2026"), prepareMarkdown();
325
+ let pending = markdownPreparationRef.current?.pending;
326
+ if (!pending) return;
327
+ pending.then(
328
+ (text) => {
329
+ if (currentMarkdownKeyRef.current === record.key) {
330
+ if (!text) {
331
+ setCopyFeedback("There is no Markdown content to copy. Try again.");
332
+ return;
333
+ }
334
+ finishAction(action, copyText(text), record.key);
335
+ }
336
+ },
337
+ (error) => {
338
+ currentMarkdownKeyRef.current === record.key && setCopyFeedback(
339
+ error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
340
+ );
341
+ }
342
+ );
343
+ return;
344
+ }
345
+ let value = action.copy === "page-markdown" ? context.markdown : action.copy === "page-link" ? context.pageUrl : action.copy === "markdown-link" ? context.markdownUrl : action.copy;
346
+ if (!value) {
347
+ setCopyFeedback("There is no Markdown content to copy. Try again.");
348
+ return;
219
349
  }
350
+ finishAction(action, copyText(value));
220
351
  }, iconForAction = (action) => {
221
352
  let copied = copiedActionId === action.id;
222
353
  return action.copy === "page-markdown" ? /* @__PURE__ */ jsx(
223
354
  AnimatedIconSwap,
224
355
  {
225
356
  active: copied,
226
- activeIcon: /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "size-4" }),
227
- defaultIcon: action.icon ?? /* @__PURE__ */ jsx(Clipboard, { "aria-hidden": "true", className: "size-4" }),
357
+ activeIcon: /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-4" }),
358
+ defaultIcon: action.icon ?? /* @__PURE__ */ jsx(CopyIcon, { "aria-hidden": "true", className: "size-4" }),
228
359
  size: 16
229
360
  }
230
- ) : copied ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "size-4" }) : action.icon;
231
- }, renderPrimaryAction = () => {
232
- let href = resolveValue(resolvedPrimaryAction.href, context), disabled = resolveValue(resolvedPrimaryAction.disabled, context), target = resolvedPrimaryAction.target ?? (resolvedPrimaryAction.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(resolvedPrimaryAction.rel) : void 0;
233
- return href && !resolvedPrimaryAction.copy && !resolvedPrimaryAction.onSelect ? /* @__PURE__ */ jsxs(
361
+ ) : copied ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-4" }) : action.icon;
362
+ }, contextValue = {
363
+ buttonSize,
364
+ buttonVariant,
365
+ closeMenu,
366
+ copyFeedback,
367
+ menuActionsRef,
368
+ menuLabel,
369
+ menuOpen,
370
+ menuTriggerRef,
371
+ markdownLink: showMarkdownLink ? /* @__PURE__ */ jsxs(
234
372
  "a",
235
373
  {
236
- "aria-disabled": disabled ? "true" : void 0,
237
- className: cn(
238
- buttonVariants({
239
- iconOnly: !1,
240
- size: buttonSize,
241
- variant: buttonVariant
242
- }),
243
- disabled && "pointer-events-none opacity-50"
244
- ),
245
- "data-disabled": disabled ? "" : void 0,
246
- href: disabled ? void 0 : href,
247
- rel,
248
- target,
374
+ className: "inline-flex min-h-7 items-center gap-1.5 text-xs font-medium text-foreground-2 no-underline transition-colors hover:text-foreground-1 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke motion-reduce:transition-none",
375
+ "data-slot": "agent-actions-markdown-link",
376
+ href: resolvedMarkdownPath,
249
377
  children: [
250
- iconForAction(resolvedPrimaryAction),
251
- /* @__PURE__ */ jsx("span", { children: resolvedPrimaryAction.title })
378
+ /* @__PURE__ */ jsx(
379
+ MarkdownLogoIcon,
380
+ {
381
+ "aria-hidden": "true",
382
+ className: "size-4 shrink-0",
383
+ weight: "fill"
384
+ }
385
+ ),
386
+ /* @__PURE__ */ jsx("span", { children: markdownLinkLabel })
252
387
  ]
253
388
  }
254
- ) : /* @__PURE__ */ jsx(
255
- Button,
256
- {
257
- disabled: !!disabled,
258
- leftIcon: iconForAction(resolvedPrimaryAction),
259
- onClick: () => {
260
- handleAction(resolvedPrimaryAction);
389
+ ) : null,
390
+ renderPrimaryAction: (action = resolvedPrimaryAction) => {
391
+ let href = resolveValue(action.href, context), disabled = resolveValue(action.disabled, context), target = action.target ?? (action.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(action.rel) : void 0;
392
+ return href && !action.copy && !action.onSelect ? /* @__PURE__ */ jsxs(
393
+ "a",
394
+ {
395
+ "aria-disabled": disabled ? "true" : void 0,
396
+ className: cn(
397
+ buttonVariants({
398
+ iconOnly: !1,
399
+ size: buttonSize,
400
+ variant: buttonVariant
401
+ }),
402
+ disabled && "pointer-events-none opacity-50"
403
+ ),
404
+ "data-disabled": disabled ? "" : void 0,
405
+ href: disabled ? void 0 : href,
406
+ rel,
407
+ target,
408
+ children: [
409
+ iconForAction(action),
410
+ /* @__PURE__ */ jsx("span", { children: action.title })
411
+ ]
412
+ }
413
+ ) : /* @__PURE__ */ jsx(
414
+ Button,
415
+ {
416
+ disabled: !!disabled,
417
+ leftIcon: iconForAction(action),
418
+ onFocus: () => prepareAction(action),
419
+ onClick: () => {
420
+ handleAction(action);
421
+ },
422
+ onPointerDown: () => prepareAction(action),
423
+ onPointerEnter: () => prepareAction(action),
424
+ size: buttonSize,
425
+ variant: buttonVariant,
426
+ children: action.title
427
+ }
428
+ );
429
+ },
430
+ renderMenuAction: (action) => {
431
+ let href = resolveValue(action.href, context), disabled = resolveValue(action.disabled, context), target = action.target ?? (action.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(action.rel) : void 0, label = action.title;
432
+ return href && !action.copy && !action.onSelect && !disabled ? /* @__PURE__ */ jsxs(
433
+ MenuLinkItem,
434
+ {
435
+ closeOnClick: !0,
436
+ href,
437
+ onClick: closeMenu,
438
+ rel,
439
+ target,
440
+ children: [
441
+ action.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0", children: action.icon }) : null,
442
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
443
+ ]
261
444
  },
262
- size: buttonSize,
263
- variant: buttonVariant,
264
- children: resolvedPrimaryAction.title
265
- }
266
- );
267
- }, renderMenuAction = (action) => {
268
- let href = resolveValue(action.href, context), disabled = resolveValue(action.disabled, context), icon = iconForAction(action), target = action.target ?? (action.openInNew ? "_blank" : void 0), rel = target === "_blank" ? mergeRel(action.rel) : void 0, label = action.title;
269
- return href && !action.copy && !action.onSelect && !disabled ? /* @__PURE__ */ jsxs(
270
- MenuLinkItem,
271
- {
272
- closeOnClick: !0,
273
- href,
274
- onClick: closeMenu,
275
- rel,
276
- target,
277
- children: [
278
- icon,
279
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
280
- ]
281
- },
282
- action.id
283
- ) : /* @__PURE__ */ jsxs(
284
- MenuItem,
285
- {
286
- disabled: !!disabled,
287
- onClick: () => {
288
- handleAction(action);
445
+ action.id
446
+ ) : /* @__PURE__ */ jsxs(
447
+ MenuItem,
448
+ {
449
+ disabled: !!disabled,
450
+ onFocus: () => prepareAction(action),
451
+ onClick: () => {
452
+ handleAction(action);
453
+ },
454
+ onPointerDown: () => prepareAction(action),
455
+ onPointerEnter: () => prepareAction(action),
456
+ children: [
457
+ action.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0", children: action.icon }) : null,
458
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
459
+ ]
289
460
  },
290
- children: [
291
- icon,
292
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
293
- ]
294
- },
295
- action.id
296
- );
461
+ action.id
462
+ );
463
+ },
464
+ resolvedActionGroups,
465
+ setMenuOpenState
297
466
  };
467
+ return /* @__PURE__ */ jsx(AgentActionsContext.Provider, { value: contextValue, children: children ?? /* @__PURE__ */ jsx(AgentActionsDefaultLayout, { className, ...props }) });
468
+ }
469
+ function AgentActionsDefaultLayout({
470
+ className,
471
+ ...props
472
+ }) {
473
+ return /* @__PURE__ */ jsxs(AgentActionsToolbar, { className, ...props, children: [
474
+ /* @__PURE__ */ jsx(AgentActionsMarkdownLink, {}),
475
+ /* @__PURE__ */ jsxs(ButtonGroup, { children: [
476
+ /* @__PURE__ */ jsx(AgentActionsPrimaryAction, {}),
477
+ /* @__PURE__ */ jsx(ButtonGroupSeparator, {}),
478
+ /* @__PURE__ */ jsx(AgentActionsMenu, {})
479
+ ] }),
480
+ /* @__PURE__ */ jsx(AgentActionsFeedback, {})
481
+ ] });
482
+ }
483
+ function AgentActionsToolbar({
484
+ className,
485
+ ...props
486
+ }) {
298
487
  return /* @__PURE__ */ jsx(
299
488
  "div",
300
489
  {
301
- className: cn("inline-flex", className),
490
+ className: cn(
491
+ "inline-flex flex-wrap items-center gap-x-3 gap-y-2",
492
+ className
493
+ ),
302
494
  "data-slot": "agent-actions",
303
- ...props,
304
- children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
305
- renderPrimaryAction(),
306
- /* @__PURE__ */ jsx(ButtonGroupSeparator, {}),
307
- /* @__PURE__ */ jsxs(
308
- Menu,
495
+ ...props
496
+ }
497
+ );
498
+ }
499
+ function AgentActionsMarkdownLink() {
500
+ return useAgentActions().markdownLink;
501
+ }
502
+ function AgentActionsPrimaryAction({ action }) {
503
+ return useAgentActions().renderPrimaryAction(action);
504
+ }
505
+ function AgentActionsFeedback() {
506
+ let { copyFeedback } = useAgentActions();
507
+ return /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", role: "status", children: copyFeedback });
508
+ }
509
+ function AgentActionsGroup({
510
+ title,
511
+ children
512
+ }) {
513
+ return /* @__PURE__ */ jsxs(MenuGroup, { children: [
514
+ title ? /* @__PURE__ */ jsx(MenuGroupLabel, { children: title }) : null,
515
+ children
516
+ ] });
517
+ }
518
+ function AgentActionsItem({ action }) {
519
+ return useAgentActions().renderMenuAction(action);
520
+ }
521
+ function AgentActionsMenu({ children }) {
522
+ let {
523
+ buttonSize,
524
+ buttonVariant,
525
+ closeMenu,
526
+ menuActionsRef,
527
+ menuLabel,
528
+ menuOpen,
529
+ menuTriggerRef,
530
+ resolvedActionGroups,
531
+ setMenuOpenState
532
+ } = useAgentActions();
533
+ return useEffect(() => {
534
+ let view = menuTriggerRef.current?.ownerDocument.defaultView;
535
+ if (view)
536
+ return view.addEventListener("pagehide", closeMenu), view.addEventListener("pageshow", closeMenu), () => {
537
+ view.removeEventListener("pagehide", closeMenu), view.removeEventListener("pageshow", closeMenu);
538
+ };
539
+ }, [closeMenu, menuTriggerRef]), /* @__PURE__ */ jsxs(
540
+ Menu,
541
+ {
542
+ actionsRef: menuActionsRef,
543
+ modal: !1,
544
+ onOpenChange: setMenuOpenState,
545
+ open: menuOpen,
546
+ children: [
547
+ /* @__PURE__ */ jsx(
548
+ MenuTrigger,
309
549
  {
310
- actionsRef: menuActionsRef,
311
- modal: !1,
312
- onOpenChange: setMenuOpenState,
313
- open: menuOpen,
314
- children: [
315
- /* @__PURE__ */ jsx(
316
- MenuTrigger,
317
- {
318
- "aria-label": menuLabel,
319
- className: cn(
320
- buttonVariants({
321
- iconOnly: !0,
322
- size: buttonSize,
323
- variant: buttonVariant
324
- }),
325
- "data-[popup-open]:!rounded-r-button"
326
- ),
327
- children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true", className: "size-4" })
328
- }
329
- ),
330
- /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, { align: "end", children: /* @__PURE__ */ jsx(MenuPopup, { className: "min-w-56", children: resolvedActionGroups.map((group) => /* @__PURE__ */ jsxs(MenuGroup, { children: [
331
- group.title ? /* @__PURE__ */ jsx(MenuGroupLabel, { children: group.title }) : null,
332
- group.actions.map(renderMenuAction)
333
- ] }, group.id)) }) }) })
334
- ]
550
+ "aria-label": menuLabel,
551
+ ref: menuTriggerRef,
552
+ className: cn(
553
+ buttonVariants({
554
+ iconOnly: !0,
555
+ size: buttonSize,
556
+ variant: buttonVariant
557
+ }),
558
+ "data-popup-open:rounded-r-button!"
559
+ ),
560
+ children: /* @__PURE__ */ jsx(CaretDownIcon, { "aria-hidden": "true", className: "size-4" })
335
561
  }
336
- )
337
- ] })
562
+ ),
563
+ /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, { align: "end", children: /* @__PURE__ */ jsx(MenuPopup, { className: "min-w-56", onClick: closeMenu, children: children ?? resolvedActionGroups.map((group, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
564
+ index > 0 ? /* @__PURE__ */ jsx(MenuSeparator, {}) : null,
565
+ /* @__PURE__ */ jsx(AgentActionsGroup, { title: group.title, children: group.actions.map((action) => /* @__PURE__ */ jsx(AgentActionsItem, { action }, action.id)) })
566
+ ] }, group.id)) }) }) })
567
+ ]
338
568
  }
339
569
  );
340
570
  }
571
+ function AgentActionsRoot(props) {
572
+ return /* @__PURE__ */ jsx(AgentActionsProvider, { ...props });
573
+ }
574
+ var AgentActions = Object.assign(AgentActionsRoot, {
575
+ Feedback: AgentActionsFeedback,
576
+ Group: AgentActionsGroup,
577
+ Item: AgentActionsItem,
578
+ MarkdownLink: AgentActionsMarkdownLink,
579
+ Menu: AgentActionsMenu,
580
+ PrimaryAction: AgentActionsPrimaryAction,
581
+ Root: AgentActionsRoot,
582
+ Toolbar: AgentActionsToolbar
583
+ });
341
584
  export {
342
- AgentActions
585
+ AgentActions,
586
+ AgentActionsFeedback as Feedback,
587
+ AgentActionsGroup as Group,
588
+ AgentActionsItem as Item,
589
+ AgentActionsMarkdownLink as MarkdownLink,
590
+ AgentActionsMenu as Menu,
591
+ AgentActionsPrimaryAction as PrimaryAction,
592
+ AgentActionsRoot as Root,
593
+ AgentActionsToolbar as Toolbar
343
594
  };