@publish.os/nextjs 0.0.1-alpha.4 → 0.0.1-alpha.6

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 (229) hide show
  1. package/README.md +1 -1
  2. package/dist/config/createNextConfig.js +3 -3
  3. package/dist/index.js +7 -5
  4. package/dist/kernel/components/blocks/color-palette.js +35 -4
  5. package/dist/kernel/components/blocks/design-system-preview.js +18 -17
  6. package/dist/kernel/components/blocks/link-playground.js +3 -3
  7. package/dist/kernel/components/blocks/logo-block.js +1 -1
  8. package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -12
  9. package/dist/kernel/components/blocks/navbar.js +1 -1
  10. package/dist/kernel/components/blocks/navigation-progress-playground.js +2 -2
  11. package/dist/kernel/components/mdx/components/image.js +1 -1
  12. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -1
  13. package/dist/kernel/components/ui/breadcrumb-trail.js +1 -0
  14. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -5
  15. package/dist/kernel/components/ui/breadcrumb.js +1 -16
  16. package/dist/kernel/components/ui/button-group.d.ts +2 -2
  17. package/dist/kernel/components/ui/button-group.js +2 -3
  18. package/dist/kernel/components/ui/button.d.ts +3 -4
  19. package/dist/kernel/components/ui/button.js +4 -12
  20. package/dist/kernel/components/ui/card.d.ts +1 -1
  21. package/dist/kernel/components/ui/menu.js +5 -5
  22. package/dist/kernel/components/ui/navigation-menu.js +2 -2
  23. package/dist/kernel/components/ui/popover.js +5 -11
  24. package/dist/kernel/components/ui/select.js +5 -5
  25. package/dist/kernel/components/ui/tag.d.ts +14 -0
  26. package/dist/kernel/components/ui/tag.js +76 -0
  27. package/dist/kernel/components/ui/text.d.ts +1 -1
  28. package/dist/kernel/components/ui/text.js +109 -106
  29. package/dist/kernel/components/ui/theme-toggle.js +1 -1
  30. package/dist/kernel/components/ui/tooltip.js +2 -2
  31. package/dist/kernel/defaults.registry.d.ts +63 -72
  32. package/dist/kernel/defaults.registry.js +62 -70
  33. package/dist/kernel/routes/agent/markdown.js +2 -2
  34. package/dist/kernel/routes/metadata/feed.js +2 -2
  35. package/dist/kernel/routes/metadata/llms.js +4 -2
  36. package/dist/kernel/routes/metadata/og-image.d.ts +1 -1
  37. package/dist/kernel/routes/metadata/robots.js +2 -2
  38. package/dist/kernel/routes/metadata/sitemap.js +2 -2
  39. package/dist/utils/cn.d.ts +1 -1
  40. package/package.json +4 -9
  41. package/release/package.json +4 -3
  42. package/release/release.json +5 -5
  43. package/release/{pnpm-lock.yaml → runtime-pnpm-lock.yaml} +348 -224
  44. package/dist/cache/tags.cjs +0 -79
  45. package/dist/cache/tags.d.cts +0 -13
  46. package/dist/config/createNextConfig.cjs +0 -52
  47. package/dist/config/createNextConfig.d.cts +0 -8
  48. package/dist/config.cjs +0 -78
  49. package/dist/config.d.cts +0 -101
  50. package/dist/config.d.ts +0 -101
  51. package/dist/config.js +0 -48
  52. package/dist/index.cjs +0 -1266
  53. package/dist/index.d.cts +0 -18
  54. package/dist/kernel/components/blocks/AgentActions.cjs +0 -425
  55. package/dist/kernel/components/blocks/AgentActions.d.cts +0 -52
  56. package/dist/kernel/components/blocks/animated-icon-swap.cjs +0 -101
  57. package/dist/kernel/components/blocks/animated-icon-swap.d.cts +0 -16
  58. package/dist/kernel/components/blocks/color-palette.cjs +0 -413
  59. package/dist/kernel/components/blocks/color-palette.d.cts +0 -7
  60. package/dist/kernel/components/blocks/design-system-preview.cjs +0 -592
  61. package/dist/kernel/components/blocks/design-system-preview.d.cts +0 -29
  62. package/dist/kernel/components/blocks/link-playground.cjs +0 -816
  63. package/dist/kernel/components/blocks/link-playground.d.cts +0 -5
  64. package/dist/kernel/components/blocks/logo-block.cjs +0 -156
  65. package/dist/kernel/components/blocks/logo-block.d.cts +0 -21
  66. package/dist/kernel/components/blocks/nav-breadcrumb.cjs +0 -122
  67. package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +0 -11
  68. package/dist/kernel/components/blocks/navbar.cjs +0 -154
  69. package/dist/kernel/components/blocks/navbar.d.cts +0 -16
  70. package/dist/kernel/components/blocks/navigation-progress-playground.cjs +0 -735
  71. package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +0 -5
  72. package/dist/kernel/components/blocks/navigation-progress.cjs +0 -270
  73. package/dist/kernel/components/blocks/navigation-progress.d.cts +0 -16
  74. package/dist/kernel/components/blocks/next-prev.cjs +0 -142
  75. package/dist/kernel/components/blocks/next-prev.d.cts +0 -11
  76. package/dist/kernel/components/blocks/page-list.cjs +0 -59
  77. package/dist/kernel/components/blocks/page-list.d.cts +0 -11
  78. package/dist/kernel/components/blocks/search.cjs +0 -717
  79. package/dist/kernel/components/blocks/search.d.cts +0 -77
  80. package/dist/kernel/components/blocks/sidebar-node.cjs +0 -309
  81. package/dist/kernel/components/blocks/sidebar-node.d.cts +0 -8
  82. package/dist/kernel/components/blocks/sidebar.cjs +0 -317
  83. package/dist/kernel/components/blocks/sidebar.d.cts +0 -33
  84. package/dist/kernel/components/blocks/theme-toggle.cjs +0 -31
  85. package/dist/kernel/components/blocks/theme-toggle.d.cts +0 -6
  86. package/dist/kernel/components/blocks/toc.cjs +0 -356
  87. package/dist/kernel/components/blocks/toc.d.cts +0 -10
  88. package/dist/kernel/components/mdx/components/blockquote.cjs +0 -66
  89. package/dist/kernel/components/mdx/components/blockquote.d.cts +0 -6
  90. package/dist/kernel/components/mdx/components/callout.cjs +0 -137
  91. package/dist/kernel/components/mdx/components/callout.d.cts +0 -18
  92. package/dist/kernel/components/mdx/components/code-block.cjs +0 -39
  93. package/dist/kernel/components/mdx/components/code-block.d.cts +0 -9
  94. package/dist/kernel/components/mdx/components/figure-caption.cjs +0 -63
  95. package/dist/kernel/components/mdx/components/figure-caption.d.cts +0 -6
  96. package/dist/kernel/components/mdx/components/figure.cjs +0 -78
  97. package/dist/kernel/components/mdx/components/figure.d.cts +0 -10
  98. package/dist/kernel/components/mdx/components/footnotes.cjs +0 -66
  99. package/dist/kernel/components/mdx/components/footnotes.d.cts +0 -6
  100. package/dist/kernel/components/mdx/components/heading-copy-link.cjs +0 -108
  101. package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +0 -23
  102. package/dist/kernel/components/mdx/components/heading.cjs +0 -166
  103. package/dist/kernel/components/mdx/components/heading.d.cts +0 -8
  104. package/dist/kernel/components/mdx/components/hr.cjs +0 -34
  105. package/dist/kernel/components/mdx/components/hr.d.cts +0 -9
  106. package/dist/kernel/components/mdx/components/image-zoom.cjs +0 -49
  107. package/dist/kernel/components/mdx/components/image-zoom.d.cts +0 -10
  108. package/dist/kernel/components/mdx/components/image.cjs +0 -192
  109. package/dist/kernel/components/mdx/components/image.d.cts +0 -21
  110. package/dist/kernel/components/mdx/components/inline-code.cjs +0 -66
  111. package/dist/kernel/components/mdx/components/inline-code.d.cts +0 -6
  112. package/dist/kernel/components/mdx/components/kbd.cjs +0 -34
  113. package/dist/kernel/components/mdx/components/kbd.d.cts +0 -10
  114. package/dist/kernel/components/mdx/components/link.cjs +0 -49
  115. package/dist/kernel/components/mdx/components/link.d.cts +0 -11
  116. package/dist/kernel/components/mdx/components/paragraph.cjs +0 -87
  117. package/dist/kernel/components/mdx/components/paragraph.d.cts +0 -5
  118. package/dist/kernel/components/mdx/components/pre.cjs +0 -66
  119. package/dist/kernel/components/mdx/components/pre.d.cts +0 -6
  120. package/dist/kernel/components/mdx/components/strikethrough.cjs +0 -63
  121. package/dist/kernel/components/mdx/components/strikethrough.d.cts +0 -6
  122. package/dist/kernel/components/mdx/components/table.cjs +0 -59
  123. package/dist/kernel/components/mdx/components/table.d.cts +0 -10
  124. package/dist/kernel/components/mdx/components/task-list.cjs +0 -88
  125. package/dist/kernel/components/mdx/components/task-list.d.cts +0 -8
  126. package/dist/kernel/components/mdx/components/video-player.cjs +0 -173
  127. package/dist/kernel/components/mdx/components/video-player.d.cts +0 -18
  128. package/dist/kernel/components/mdx/components/video.cjs +0 -185
  129. package/dist/kernel/components/mdx/components/video.d.cts +0 -15
  130. package/dist/kernel/components/mdx/error-boundary.cjs +0 -62
  131. package/dist/kernel/components/mdx/error-boundary.d.cts +0 -8
  132. package/dist/kernel/components/mdx/error-fallback.cjs +0 -58
  133. package/dist/kernel/components/mdx/error-fallback.d.cts +0 -9
  134. package/dist/kernel/components/mdx/mdx.cjs +0 -141
  135. package/dist/kernel/components/mdx/mdx.d.cts +0 -22
  136. package/dist/kernel/components/mdx/rehype-heading-ids.cjs +0 -113
  137. package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +0 -10
  138. package/dist/kernel/components/mdx/types.cjs +0 -18
  139. package/dist/kernel/components/mdx/types.d.cts +0 -18
  140. package/dist/kernel/components/ui/accordion.cjs +0 -104
  141. package/dist/kernel/components/ui/accordion.d.cts +0 -16
  142. package/dist/kernel/components/ui/badge.cjs +0 -75
  143. package/dist/kernel/components/ui/badge.d.cts +0 -12
  144. package/dist/kernel/components/ui/badge.d.ts +0 -12
  145. package/dist/kernel/components/ui/badge.js +0 -47
  146. package/dist/kernel/components/ui/breadcrumb-trail.cjs +0 -238
  147. package/dist/kernel/components/ui/breadcrumb-trail.d.cts +0 -13
  148. package/dist/kernel/components/ui/breadcrumb.cjs +0 -399
  149. package/dist/kernel/components/ui/breadcrumb.d.cts +0 -52
  150. package/dist/kernel/components/ui/button-group.cjs +0 -144
  151. package/dist/kernel/components/ui/button-group.d.cts +0 -19
  152. package/dist/kernel/components/ui/button.cjs +0 -147
  153. package/dist/kernel/components/ui/button.d.cts +0 -23
  154. package/dist/kernel/components/ui/card.cjs +0 -133
  155. package/dist/kernel/components/ui/card.d.cts +0 -17
  156. package/dist/kernel/components/ui/dialog.cjs +0 -149
  157. package/dist/kernel/components/ui/dialog.d.cts +0 -22
  158. package/dist/kernel/components/ui/drawer.cjs +0 -163
  159. package/dist/kernel/components/ui/drawer.d.cts +0 -24
  160. package/dist/kernel/components/ui/input.cjs +0 -96
  161. package/dist/kernel/components/ui/input.d.cts +0 -18
  162. package/dist/kernel/components/ui/kbd.cjs +0 -105
  163. package/dist/kernel/components/ui/kbd.d.cts +0 -13
  164. package/dist/kernel/components/ui/link.cjs +0 -253
  165. package/dist/kernel/components/ui/link.d.cts +0 -31
  166. package/dist/kernel/components/ui/menu.cjs +0 -301
  167. package/dist/kernel/components/ui/menu.d.cts +0 -70
  168. package/dist/kernel/components/ui/meta-key.cjs +0 -34
  169. package/dist/kernel/components/ui/meta-key.d.cts +0 -12
  170. package/dist/kernel/components/ui/navigation-menu.cjs +0 -253
  171. package/dist/kernel/components/ui/navigation-menu.d.cts +0 -47
  172. package/dist/kernel/components/ui/popover.cjs +0 -168
  173. package/dist/kernel/components/ui/popover.d.cts +0 -24
  174. package/dist/kernel/components/ui/progress.cjs +0 -112
  175. package/dist/kernel/components/ui/progress.d.cts +0 -16
  176. package/dist/kernel/components/ui/scroll-area.cjs +0 -413
  177. package/dist/kernel/components/ui/scroll-area.d.cts +0 -58
  178. package/dist/kernel/components/ui/select.cjs +0 -244
  179. package/dist/kernel/components/ui/select.d.cts +0 -40
  180. package/dist/kernel/components/ui/separator.cjs +0 -73
  181. package/dist/kernel/components/ui/separator.d.cts +0 -8
  182. package/dist/kernel/components/ui/table.cjs +0 -131
  183. package/dist/kernel/components/ui/table.d.cts +0 -11
  184. package/dist/kernel/components/ui/tabs.cjs +0 -450
  185. package/dist/kernel/components/ui/tabs.d.cts +0 -82
  186. package/dist/kernel/components/ui/text.cjs +0 -184
  187. package/dist/kernel/components/ui/text.d.cts +0 -17
  188. package/dist/kernel/components/ui/theme-toggle.cjs +0 -108
  189. package/dist/kernel/components/ui/theme-toggle.d.cts +0 -10
  190. package/dist/kernel/components/ui/toast.cjs +0 -154
  191. package/dist/kernel/components/ui/toast.d.cts +0 -26
  192. package/dist/kernel/components/ui/tooltip.cjs +0 -127
  193. package/dist/kernel/components/ui/tooltip.d.cts +0 -20
  194. package/dist/kernel/defaults.registry.cjs +0 -541
  195. package/dist/kernel/defaults.registry.d.cts +0 -469
  196. package/dist/kernel/routes/agent/markdown.cjs +0 -202
  197. package/dist/kernel/routes/agent/markdown.d.cts +0 -58
  198. package/dist/kernel/routes/layouts/group.cjs +0 -181
  199. package/dist/kernel/routes/layouts/group.d.cts +0 -20
  200. package/dist/kernel/routes/metadata/feed.cjs +0 -293
  201. package/dist/kernel/routes/metadata/feed.d.cts +0 -20
  202. package/dist/kernel/routes/metadata/llms.cjs +0 -239
  203. package/dist/kernel/routes/metadata/llms.d.cts +0 -26
  204. package/dist/kernel/routes/metadata/og-image.cjs +0 -630
  205. package/dist/kernel/routes/metadata/og-image.d.cts +0 -62
  206. package/dist/kernel/routes/metadata/robots.cjs +0 -148
  207. package/dist/kernel/routes/metadata/robots.d.cts +0 -6
  208. package/dist/kernel/routes/metadata/sitemap.cjs +0 -192
  209. package/dist/kernel/routes/metadata/sitemap.d.cts +0 -8
  210. package/dist/kernel/routes/pages/group.cjs +0 -263
  211. package/dist/kernel/routes/pages/group.d.cts +0 -17
  212. package/dist/kernel/routes/pages/leaf.cjs +0 -421
  213. package/dist/kernel/routes/pages/leaf.d.cts +0 -36
  214. package/dist/kernel/routes/pages/root.cjs +0 -229
  215. package/dist/kernel/routes/pages/root.d.cts +0 -16
  216. package/dist/keyboard-shortcuts.cjs +0 -345
  217. package/dist/keyboard-shortcuts.d.cts +0 -34
  218. package/dist/resolvers/manifest-resolver.cjs +0 -111
  219. package/dist/resolvers/manifest-resolver.d.cts +0 -13
  220. package/dist/search.cjs +0 -411
  221. package/dist/search.d.cts +0 -20
  222. package/dist/types.cjs +0 -30
  223. package/dist/types.d.cts +0 -269
  224. package/dist/utils/cn.cjs +0 -49
  225. package/dist/utils/cn.d.cts +0 -15
  226. package/dist/utils/heading-ids.cjs +0 -119
  227. package/dist/utils/heading-ids.d.cts +0 -15
  228. package/dist/utils/pretty-date.cjs +0 -55
  229. package/dist/utils/pretty-date.d.cts +0 -6
package/dist/index.d.cts DELETED
@@ -1,18 +0,0 @@
1
- export { tags } from './cache/tags.cjs';
2
- export { createNextConfig } from './config/createNextConfig.cjs';
3
- export { PageList } from './kernel/components/blocks/page-list.cjs';
4
- export { createAtomFeedRoute, createJsonFeedRoute, createRssFeedRoute } from './kernel/routes/metadata/feed.cjs';
5
- export { createLlmsTxtRoute } from './kernel/routes/metadata/llms.cjs';
6
- export { createOgImageRoute, createOgImageStaticParams } from './kernel/routes/metadata/og-image.cjs';
7
- export { createRobotsTxtRoute } from './kernel/routes/metadata/robots.cjs';
8
- export { createSitemapXmlRoute } from './kernel/routes/metadata/sitemap.cjs';
9
- export { listStaticParams, resolveGroup, resolveGroupLayout, resolveLeaf } from './resolvers/manifest-resolver.cjs';
10
- export { GroupContext, IndexPageProps, LayoutProps, ManifestLike, NavFolder, NavItem, NavLink, NavPage, NavSection, OgImageMetadata, OgMetadata, PageData, PageProps, ResolvedAttribution, RootLayoutProps, RootPageProps, SiteData, TreeNode } from './types.cjs';
11
- export { cn } from './utils/cn.cjs';
12
- export { HeadingIdGenerator, MdxHeadingItem, cleanHeadingText, createHeadingIdGenerator, extractMdxHeadings, headingToHTMLId, urlIdToText } from './utils/heading-ids.cjs';
13
- import 'next';
14
- import 'react/jsx-runtime';
15
- import '@publish.os/nextjs/types';
16
- import './kernel/routes/agent/markdown.cjs';
17
- import 'react';
18
- import 'clsx';
@@ -1,425 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/kernel/components/blocks/AgentActions.tsx
22
- var AgentActions_exports = {};
23
- __export(AgentActions_exports, {
24
- AgentActions: () => AgentActions
25
- });
26
- module.exports = __toCommonJS(AgentActions_exports);
27
- var import_animated_icon_swap = require("./animated-icon-swap.js");
28
- var import_button = require("../ui/button.js");
29
- var import_button_group = require("../ui/button-group.js");
30
- var import_menu = require("../ui/menu.js");
31
-
32
- // src/utils/cn.ts
33
- var import_clsx = require("clsx");
34
- var import_tailwind_merge = require("tailwind-merge");
35
- var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
36
- extend: {
37
- classGroups: {
38
- z: [
39
- "z-content",
40
- "z-nav",
41
- "z-overlay",
42
- "z-modal",
43
- "z-search",
44
- "z-toast",
45
- "z-progress"
46
- ]
47
- }
48
- }
49
- });
50
- function cn(...inputs) {
51
- return twMerge((0, import_clsx.clsx)(inputs));
52
- }
53
-
54
- // src/kernel/components/blocks/AgentActions.tsx
55
- var import_lucide_react = require("lucide-react");
56
- var import_react = require("react");
57
- var import_react_dom = require("react-dom");
58
- var import_jsx_runtime = require("react/jsx-runtime");
59
- var DEFAULT_PROMPT_SUFFIX = "I want to ask questions about it.";
60
- var COPY_FEEDBACK_MS = 1600;
61
- function normalizePath(path) {
62
- const [pathname = "/"] = path.split(/[?#]/);
63
- const prefixed = pathname.startsWith("/") ? pathname : `/${pathname}`;
64
- if (prefixed === "/") return prefixed;
65
- return prefixed.replace(/\/+$/, "");
66
- }
67
- function markdownPathForPagePath(path) {
68
- const normalized = normalizePath(path);
69
- if (normalized === "/") return "/index.md";
70
- return normalized.endsWith(".md") ? normalized : `${normalized}.md`;
71
- }
72
- function isAbsoluteUrl(url) {
73
- return /^[a-z][a-z\d+\-.]*:/i.test(url);
74
- }
75
- function absoluteUrl(url, siteUrl) {
76
- if (isAbsoluteUrl(url) || !siteUrl) return url;
77
- try {
78
- return new URL(url, siteUrl).toString();
79
- } catch {
80
- return url;
81
- }
82
- }
83
- function mergeRel(rel) {
84
- const values = new Set((rel ?? "").split(/\s+/).filter(Boolean));
85
- values.add("noreferrer");
86
- return Array.from(values).join(" ");
87
- }
88
- function createPrompt(markdownUrl) {
89
- return `Read ${markdownUrl}, ${DEFAULT_PROMPT_SUFFIX}`;
90
- }
91
- function providerPromptUrl(baseUrl, prompt, param = "q") {
92
- const url = new URL(baseUrl);
93
- url.searchParams.set(param, prompt);
94
- return url.toString();
95
- }
96
- var DEFAULT_PRIMARY_ACTION = {
97
- id: "copy-page-markdown-primary",
98
- title: "Copy Markdown",
99
- copy: "page-markdown"
100
- };
101
- var DEFAULT_ACTION_GROUPS = [
102
- {
103
- id: "open-in-ai",
104
- title: "Open in",
105
- actions: [
106
- {
107
- id: "open-claude",
108
- title: "Claude",
109
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Bot, { "aria-hidden": "true", className: "size-4" }),
110
- href: ({ prompt }) => providerPromptUrl("https://claude.ai/new", prompt),
111
- openInNew: true
112
- },
113
- {
114
- id: "open-chatgpt",
115
- title: "ChatGPT",
116
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MessageCircle, { "aria-hidden": "true", className: "size-4" }),
117
- href: ({ prompt }) => providerPromptUrl("https://chatgpt.com/?hints=search", prompt),
118
- openInNew: true
119
- },
120
- {
121
- id: "open-cursor",
122
- title: "Cursor",
123
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ExternalLink, { "aria-hidden": "true", className: "size-4" }),
124
- href: ({ prompt }) => providerPromptUrl("https://cursor.com/link/prompt", prompt, "text"),
125
- openInNew: true
126
- },
127
- {
128
- id: "open-copilot",
129
- title: "Copilot",
130
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MessageCircle, { "aria-hidden": "true", className: "size-4" }),
131
- href: ({ prompt }) => providerPromptUrl("https://copilot.microsoft.com/", prompt),
132
- openInNew: true
133
- },
134
- {
135
- id: "open-t3-chat",
136
- title: "T3 Chat",
137
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.MessageCircle, { "aria-hidden": "true", className: "size-4" }),
138
- href: ({ prompt }) => providerPromptUrl("https://t3.chat/new", prompt),
139
- openInNew: true
140
- },
141
- {
142
- id: "open-github",
143
- title: "GitHub source",
144
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Github, { "aria-hidden": "true", className: "size-4" }),
145
- href: ({ sourceUrl }) => sourceUrl,
146
- openInNew: true,
147
- disabled: ({ sourceUrl }) => !sourceUrl
148
- }
149
- ]
150
- },
151
- {
152
- id: "page-actions",
153
- title: "Page",
154
- actions: [
155
- {
156
- id: "copy-page-markdown",
157
- title: "Copy page Markdown",
158
- copy: "page-markdown"
159
- },
160
- {
161
- id: "view-page-markdown",
162
- title: "View as Markdown",
163
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Eye, { "aria-hidden": "true", className: "size-4" }),
164
- href: ({ markdownPath }) => markdownPath
165
- },
166
- {
167
- id: "copy-page-link",
168
- title: "Copy page link",
169
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.LinkIcon, { "aria-hidden": "true", className: "size-4" }),
170
- copy: "page-link"
171
- }
172
- ]
173
- }
174
- ];
175
- function resolveValue(value, context) {
176
- return typeof value === "function" ? value(context) : value;
177
- }
178
- async function copyText(text) {
179
- await navigator.clipboard?.writeText(text);
180
- }
181
- function AgentActions({
182
- actionGroups,
183
- buttonSize = "sm",
184
- buttonVariant = "outline",
185
- className,
186
- markdown,
187
- markdownPath,
188
- markdownUrl,
189
- menuLabel = "More agent actions",
190
- pagePath,
191
- pageUrl,
192
- primaryAction,
193
- prompt,
194
- siteUrl,
195
- sourceUrl,
196
- ...props
197
- }) {
198
- const [copiedActionId, setCopiedActionId] = (0, import_react.useState)();
199
- const [menuOpen, setMenuOpen] = (0, import_react.useState)(false);
200
- const menuActionsRef = (0, import_react.useRef)(null);
201
- const menuOpenRef = (0, import_react.useRef)(false);
202
- const resetTimerRef = (0, import_react.useRef)(
203
- void 0
204
- );
205
- const setMenuOpenState = (0, import_react.useCallback)((open) => {
206
- menuOpenRef.current = open;
207
- setMenuOpen(open);
208
- }, []);
209
- const closeMenu = (0, import_react.useCallback)(() => {
210
- (0, import_react_dom.flushSync)(() => {
211
- menuOpenRef.current = false;
212
- setMenuOpen(false);
213
- menuActionsRef.current?.close();
214
- menuActionsRef.current?.unmount();
215
- });
216
- }, []);
217
- (0, import_react.useEffect)(() => {
218
- window.addEventListener("pagehide", closeMenu);
219
- window.addEventListener("pageshow", closeMenu);
220
- return () => {
221
- window.removeEventListener("pagehide", closeMenu);
222
- window.removeEventListener("pageshow", closeMenu);
223
- if (resetTimerRef.current) {
224
- clearTimeout(resetTimerRef.current);
225
- }
226
- };
227
- }, [closeMenu]);
228
- const resolvedPagePath = pagePath ?? "/";
229
- const resolvedMarkdownPath = markdownPath ?? markdownPathForPagePath(resolvedPagePath);
230
- const resolvedMarkdownUrl = absoluteUrl(
231
- markdownUrl ?? resolvedMarkdownPath,
232
- siteUrl
233
- );
234
- const context = {
235
- markdown,
236
- markdownPath: resolvedMarkdownPath,
237
- markdownUrl: resolvedMarkdownUrl,
238
- pagePath: resolvedPagePath,
239
- pageUrl: absoluteUrl(pageUrl ?? resolvedPagePath, siteUrl),
240
- prompt: prompt ?? createPrompt(resolvedMarkdownUrl),
241
- sourceUrl
242
- };
243
- const resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION;
244
- const resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS;
245
- const markCopied = (actionId) => {
246
- if (resetTimerRef.current) {
247
- clearTimeout(resetTimerRef.current);
248
- }
249
- setCopiedActionId(actionId);
250
- resetTimerRef.current = setTimeout(() => {
251
- setCopiedActionId(void 0);
252
- }, COPY_FEEDBACK_MS);
253
- };
254
- const copyValueForAction = async (action) => {
255
- if (action.copy === "page-markdown") {
256
- if (context.markdownUrl) {
257
- try {
258
- const response = await fetch(context.markdownUrl);
259
- if (response.ok) return response.text();
260
- } catch {
261
- return context.markdown ?? "";
262
- }
263
- }
264
- return context.markdown ?? "";
265
- }
266
- if (action.copy === "page-link") return context.pageUrl;
267
- if (action.copy === "markdown-link") return context.markdownUrl;
268
- return action.copy ?? "";
269
- };
270
- const handleAction = async (action) => {
271
- if (resolveValue(action.disabled, context)) return;
272
- if (action.copy) {
273
- const value = await copyValueForAction(action);
274
- if (value) {
275
- await copyText(value);
276
- markCopied(action.id);
277
- }
278
- }
279
- await action.onSelect?.(context);
280
- };
281
- const iconForAction = (action) => {
282
- const copied = copiedActionId === action.id;
283
- if (action.copy === "page-markdown") {
284
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
285
- import_animated_icon_swap.AnimatedIconSwap,
286
- {
287
- active: copied,
288
- activeIcon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { "aria-hidden": "true", className: "size-4" }),
289
- defaultIcon: action.icon ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Clipboard, { "aria-hidden": "true", className: "size-4" }),
290
- size: 16
291
- }
292
- );
293
- }
294
- if (copied) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { "aria-hidden": "true", className: "size-4" });
295
- return action.icon;
296
- };
297
- const renderPrimaryAction = () => {
298
- const href = resolveValue(resolvedPrimaryAction.href, context);
299
- const disabled = resolveValue(resolvedPrimaryAction.disabled, context);
300
- const target = resolvedPrimaryAction.target ?? (resolvedPrimaryAction.openInNew ? "_blank" : void 0);
301
- const rel = target === "_blank" ? mergeRel(resolvedPrimaryAction.rel) : void 0;
302
- if (href && !resolvedPrimaryAction.copy && !resolvedPrimaryAction.onSelect) {
303
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
304
- "a",
305
- {
306
- "aria-disabled": disabled ? "true" : void 0,
307
- className: cn(
308
- (0, import_button.buttonVariants)({
309
- iconOnly: false,
310
- size: buttonSize,
311
- variant: buttonVariant
312
- }),
313
- disabled && "pointer-events-none opacity-50"
314
- ),
315
- "data-disabled": disabled ? "" : void 0,
316
- href: disabled ? void 0 : href,
317
- rel,
318
- target,
319
- children: [
320
- iconForAction(resolvedPrimaryAction),
321
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: resolvedPrimaryAction.title })
322
- ]
323
- }
324
- );
325
- }
326
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
327
- import_button.Button,
328
- {
329
- disabled: Boolean(disabled),
330
- leftIcon: iconForAction(resolvedPrimaryAction),
331
- onClick: () => {
332
- void handleAction(resolvedPrimaryAction);
333
- },
334
- size: buttonSize,
335
- variant: buttonVariant,
336
- children: resolvedPrimaryAction.title
337
- }
338
- );
339
- };
340
- const renderMenuAction = (action) => {
341
- const href = resolveValue(action.href, context);
342
- const disabled = resolveValue(action.disabled, context);
343
- const icon = iconForAction(action);
344
- const target = action.target ?? (action.openInNew ? "_blank" : void 0);
345
- const rel = target === "_blank" ? mergeRel(action.rel) : void 0;
346
- const label = action.title;
347
- if (href && !action.copy && !action.onSelect && !disabled) {
348
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
349
- import_menu.MenuLinkItem,
350
- {
351
- closeOnClick: true,
352
- href,
353
- onClick: closeMenu,
354
- rel,
355
- target,
356
- children: [
357
- icon,
358
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "min-w-0 flex-1 truncate", children: label })
359
- ]
360
- },
361
- action.id
362
- );
363
- }
364
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
365
- import_menu.MenuItem,
366
- {
367
- disabled: Boolean(disabled),
368
- onClick: () => {
369
- void handleAction(action);
370
- },
371
- children: [
372
- icon,
373
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "min-w-0 flex-1 truncate", children: label })
374
- ]
375
- },
376
- action.id
377
- );
378
- };
379
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
380
- "div",
381
- {
382
- className: cn("inline-flex", className),
383
- "data-slot": "agent-actions",
384
- ...props,
385
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button_group.ButtonGroup, { children: [
386
- renderPrimaryAction(),
387
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button_group.ButtonGroupSeparator, {}),
388
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
389
- import_menu.Menu,
390
- {
391
- actionsRef: menuActionsRef,
392
- modal: false,
393
- onOpenChange: setMenuOpenState,
394
- open: menuOpen,
395
- children: [
396
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
397
- import_menu.MenuTrigger,
398
- {
399
- "aria-label": menuLabel,
400
- className: cn(
401
- (0, import_button.buttonVariants)({
402
- iconOnly: true,
403
- size: buttonSize,
404
- variant: buttonVariant
405
- }),
406
- "data-[popup-open]:!rounded-r-button"
407
- ),
408
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { "aria-hidden": "true", className: "size-4" })
409
- }
410
- ),
411
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu.MenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu.MenuPositioner, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu.MenuPopup, { className: "min-w-56", children: resolvedActionGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_menu.MenuGroup, { children: [
412
- group.title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu.MenuGroupLabel, { children: group.title }) : null,
413
- group.actions.map(renderMenuAction)
414
- ] }, group.id)) }) }) })
415
- ]
416
- }
417
- )
418
- ] })
419
- }
420
- );
421
- }
422
- // Annotate the CommonJS export names for ESM import in node:
423
- 0 && (module.exports = {
424
- AgentActions
425
- });
@@ -1,52 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ButtonVariantProps } from '../ui/button.cjs';
3
- import { ReactNode, ComponentPropsWithoutRef } from 'react';
4
- import 'class-variance-authority/types';
5
- import 'class-variance-authority';
6
-
7
- type Resolvable<T> = T | ((context: AgentActionContext) => T);
8
- type AgentActionContext = {
9
- pagePath: string;
10
- pageUrl: string;
11
- markdownPath: string;
12
- markdownUrl: string;
13
- markdown?: string;
14
- sourceUrl?: string;
15
- prompt: string;
16
- };
17
- type AgentActionCopyTarget = "markdown-link" | "page-link" | "page-markdown" | string;
18
- type AgentActionConfig = {
19
- id: string;
20
- title: string;
21
- icon?: ReactNode;
22
- href?: Resolvable<string | undefined>;
23
- target?: ComponentPropsWithoutRef<"a">["target"];
24
- rel?: string;
25
- openInNew?: boolean;
26
- copy?: AgentActionCopyTarget;
27
- disabled?: Resolvable<boolean | undefined>;
28
- onSelect?: (context: AgentActionContext) => void | Promise<void>;
29
- };
30
- type AgentActionGroup = {
31
- id: string;
32
- title?: string;
33
- actions: AgentActionConfig[];
34
- };
35
- type AgentActionsProps = Omit<ComponentPropsWithoutRef<"div">, "children"> & {
36
- pagePath?: string;
37
- pageUrl?: string;
38
- markdownPath?: string;
39
- markdownUrl?: string;
40
- markdown?: string;
41
- siteUrl?: string;
42
- sourceUrl?: string;
43
- prompt?: string;
44
- primaryAction?: AgentActionConfig;
45
- actionGroups?: AgentActionGroup[];
46
- buttonSize?: ButtonVariantProps["size"];
47
- buttonVariant?: ButtonVariantProps["variant"];
48
- menuLabel?: string;
49
- };
50
- declare function AgentActions({ actionGroups, buttonSize, buttonVariant, className, markdown, markdownPath, markdownUrl, menuLabel, pagePath, pageUrl, primaryAction, prompt, siteUrl, sourceUrl, ...props }: AgentActionsProps): react_jsx_runtime.JSX.Element;
51
-
52
- export { type AgentActionConfig, type AgentActionContext, type AgentActionCopyTarget, type AgentActionGroup, AgentActions, type AgentActionsProps };
@@ -1,101 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/kernel/components/blocks/animated-icon-swap.tsx
21
- var animated_icon_swap_exports = {};
22
- __export(animated_icon_swap_exports, {
23
- AnimatedIconSwap: () => AnimatedIconSwap
24
- });
25
- module.exports = __toCommonJS(animated_icon_swap_exports);
26
-
27
- // src/utils/cn.ts
28
- var import_clsx = require("clsx");
29
- var import_tailwind_merge = require("tailwind-merge");
30
- var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
31
- extend: {
32
- classGroups: {
33
- z: [
34
- "z-content",
35
- "z-nav",
36
- "z-overlay",
37
- "z-modal",
38
- "z-search",
39
- "z-toast",
40
- "z-progress"
41
- ]
42
- }
43
- }
44
- });
45
- function cn(...inputs) {
46
- return twMerge((0, import_clsx.clsx)(inputs));
47
- }
48
-
49
- // src/kernel/components/blocks/animated-icon-swap.tsx
50
- var import_jsx_runtime = require("react/jsx-runtime");
51
- var iconSlotClassName = "pointer-events-none absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-200 ease-out motion-reduce:scale-100 motion-reduce:transition-opacity motion-reduce:duration-100";
52
- function AnimatedIconSwap({
53
- active,
54
- activeIcon,
55
- className,
56
- defaultIcon,
57
- size,
58
- style,
59
- ...props
60
- }) {
61
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
62
- "span",
63
- {
64
- className: cn("relative inline-flex shrink-0", className),
65
- "data-slot": "animated-icon-swap",
66
- "data-state": active ? "active" : "inactive",
67
- style: { width: size, height: size, ...style },
68
- ...props,
69
- children: [
70
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
- "span",
72
- {
73
- "aria-hidden": active ? true : void 0,
74
- className: cn(
75
- iconSlotClassName,
76
- active ? "scale-75 opacity-0" : "scale-100 opacity-100"
77
- ),
78
- "data-slot": "animated-icon-swap-default",
79
- children: defaultIcon
80
- }
81
- ),
82
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
- "span",
84
- {
85
- "aria-hidden": active ? void 0 : true,
86
- className: cn(
87
- iconSlotClassName,
88
- active ? "scale-100 opacity-100" : "scale-75 opacity-0"
89
- ),
90
- "data-slot": "animated-icon-swap-active",
91
- children: activeIcon
92
- }
93
- )
94
- ]
95
- }
96
- );
97
- }
98
- // Annotate the CommonJS export names for ESM import in node:
99
- 0 && (module.exports = {
100
- AnimatedIconSwap
101
- });
@@ -1,16 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
-
4
- type AnimatedIconSwapProps = Omit<ComponentPropsWithoutRef<"span">, "children"> & {
5
- /** Whether to show the active icon. */
6
- active: boolean;
7
- /** Icon shown when active is false. */
8
- defaultIcon: ReactNode;
9
- /** Icon shown when active is true. */
10
- activeIcon: ReactNode;
11
- /** Square wrapper size in pixels. */
12
- size: number;
13
- };
14
- declare function AnimatedIconSwap({ active, activeIcon, className, defaultIcon, size, style, ...props }: AnimatedIconSwapProps): react_jsx_runtime.JSX.Element;
15
-
16
- export { AnimatedIconSwap, type AnimatedIconSwapProps };