@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.7
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.
- package/README.md +3 -5
- package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
- package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
- package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
- package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
- package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
- package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
- package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
- package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
- package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
- package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
- package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
- package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
- package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
- package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
- package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
- package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
- package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
- package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
- package/compiler-assets/nextjs/shims/providers.tsx +13 -0
- package/compiler-assets/nextjs/shims/proxy.ts +317 -0
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
- package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
- package/dist/button-CFdx-ohV.d.ts +20 -0
- package/dist/cache/tags.js +6 -14
- package/dist/compiler.d.ts +100 -0
- package/dist/compiler.js +13379 -0
- package/dist/config/createNextConfig.d.ts +2 -1
- package/dist/config/createNextConfig.js +16 -12
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +303 -15
- package/dist/index.js +30 -1198
- package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
- package/dist/kernel/components/blocks/AgentActions.js +114 -200
- package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
- package/dist/kernel/components/blocks/color-palette.js +88 -169
- package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
- package/dist/kernel/components/blocks/design-system-preview.js +44 -52
- package/dist/kernel/components/blocks/link-playground.js +23 -71
- package/dist/kernel/components/blocks/logo-block.js +18 -47
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -42
- package/dist/kernel/components/blocks/navbar.d.ts +1 -1
- package/dist/kernel/components/blocks/navbar.js +14 -41
- package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
- package/dist/kernel/components/blocks/navigation-progress.js +53 -157
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +16 -42
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +11 -16
- package/dist/kernel/components/blocks/search.d.ts +13 -2
- package/dist/kernel/components/blocks/search.js +116 -247
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +56 -95
- package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
- package/dist/kernel/components/blocks/sidebar.js +35 -103
- package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
- package/dist/kernel/components/blocks/theme-toggle.js +2 -2
- package/dist/kernel/components/blocks/toc.js +42 -178
- package/dist/kernel/components/mdx/components/blockquote.js +3 -24
- package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
- package/dist/kernel/components/mdx/components/callout.js +15 -47
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
- package/dist/kernel/components/mdx/components/figure.js +9 -36
- package/dist/kernel/components/mdx/components/footnotes.js +3 -24
- package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
- package/dist/kernel/components/mdx/components/heading.js +32 -116
- package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
- package/dist/kernel/components/mdx/components/image.js +22 -62
- package/dist/kernel/components/mdx/components/inline-code.js +3 -24
- package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +1 -2
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +13 -41
- package/dist/kernel/components/mdx/components/pre.js +3 -24
- package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +6 -28
- package/dist/kernel/components/mdx/components/video-player.js +53 -88
- package/dist/kernel/components/mdx/components/video.js +27 -75
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +12 -15
- package/dist/kernel/components/mdx/error-fallback.js +4 -4
- package/dist/kernel/components/mdx/mdx.d.ts +68 -11
- package/dist/kernel/components/mdx/mdx.js +29 -29
- package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/accordion.js +3 -26
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +23 -7
- package/dist/kernel/components/ui/breadcrumb-trail.js +32 -80
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +20 -54
- package/dist/kernel/components/ui/button-group.d.ts +4 -3
- package/dist/kernel/components/ui/button-group.js +7 -30
- package/dist/kernel/components/ui/button.js +13 -36
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +2 -23
- package/dist/kernel/components/ui/dialog.d.ts +9 -9
- package/dist/kernel/components/ui/dialog.js +15 -33
- package/dist/kernel/components/ui/drawer.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.js +15 -33
- package/dist/kernel/components/ui/input.js +6 -30
- package/dist/kernel/components/ui/kbd.js +10 -31
- package/dist/kernel/components/ui/link.d.ts +1 -1
- package/dist/kernel/components/ui/link.js +53 -104
- package/dist/kernel/components/ui/menu.d.ts +21 -21
- package/dist/kernel/components/ui/menu.js +10 -32
- package/dist/kernel/components/ui/meta-key.d.ts +9 -4
- package/dist/kernel/components/ui/meta-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
- package/dist/kernel/components/ui/navigation-menu.js +9 -30
- package/dist/kernel/components/ui/popover.d.ts +10 -10
- package/dist/kernel/components/ui/popover.js +19 -34
- package/dist/kernel/components/ui/progress.js +2 -25
- package/dist/kernel/components/ui/scroll-area.js +39 -118
- package/dist/kernel/components/ui/select.d.ts +15 -15
- package/dist/kernel/components/ui/select.js +19 -35
- package/dist/kernel/components/ui/separator.js +2 -25
- package/dist/kernel/components/ui/table.js +2 -23
- package/dist/kernel/components/ui/tabs.js +39 -99
- package/dist/kernel/components/ui/tag.d.ts +2 -2
- package/dist/kernel/components/ui/tag.js +4 -25
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +3 -25
- package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
- package/dist/kernel/components/ui/theme-toggle.js +18 -44
- package/dist/kernel/components/ui/toast.d.ts +10 -10
- package/dist/kernel/components/ui/toast.js +13 -35
- package/dist/kernel/components/ui/tooltip.d.ts +8 -8
- package/dist/kernel/components/ui/tooltip.js +8 -29
- package/dist/kernel/defaults.registry.d.ts +1 -1
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/framework-icons.d.ts +1 -0
- package/dist/kernel/framework-icons.js +39 -0
- package/dist/kernel/routes/agent/markdown.js +36 -65
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +20 -109
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +46 -127
- package/dist/kernel/routes/metadata/llms.d.ts +1 -2
- package/dist/kernel/routes/metadata/llms.js +40 -120
- package/dist/kernel/routes/metadata/og-image.d.ts +10 -0
- package/dist/kernel/routes/metadata/og-image.js +264 -198
- package/dist/kernel/routes/metadata/robots.d.ts +1 -2
- package/dist/kernel/routes/metadata/robots.js +21 -90
- package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
- package/dist/kernel/routes/metadata/sitemap.js +36 -102
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +42 -137
- package/dist/kernel/routes/pages/leaf.d.ts +1 -1
- package/dist/kernel/routes/pages/leaf.js +74 -213
- package/dist/kernel/routes/pages/root.d.ts +1 -1
- package/dist/kernel/routes/pages/root.js +37 -108
- package/dist/keyboard-shortcuts.js +69 -141
- package/dist/link-CYaCRDb6.d.ts +35 -0
- package/dist/resolvers/manifest-resolver.d.ts +3 -3
- package/dist/resolvers/manifest-resolver.js +15 -21
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +81 -4
- package/dist/search.js +124 -195
- package/dist/sidebar-types-Bgchdfd6.d.ts +25 -0
- package/dist/theme-scope.d.ts +15 -0
- package/dist/theme-scope.js +23 -0
- package/dist/types-B_b3C0U6.d.ts +63 -0
- package/dist/types-CIwwieNw.d.ts +127 -0
- package/dist/types-DHBm7-j6.d.ts +57 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/cn.d.ts +5 -9
- package/dist/utils/cn.js +13 -7
- package/dist/utils/heading-ids.js +20 -47
- package/dist/utils/pretty-date.js +7 -13
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
- package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
- package/init/seed/minimal/publish.os/theme.css +47 -0
- package/init/seed/minimal/seed.json +13 -0
- package/package.json +469 -35
- package/release/{package.json → app/lucide/package.json} +11 -5
- package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
- package/release/app/lucide/pnpm-workspace.yaml +11 -0
- package/release/app/phosphor/package.json +30 -0
- package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
- package/release/app/phosphor/pnpm-workspace.yaml +11 -0
- package/release/app/tabler/package.json +30 -0
- package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
- package/release/app/tabler/pnpm-workspace.yaml +11 -0
- package/release/compiler/package.json +20 -0
- package/release/compiler/pnpm-lock.yaml.template +2432 -0
- package/release/compiler/pnpm-workspace.yaml +11 -0
- package/release/release.json +29 -5
- package/release/runtime-pnpm-lock.yaml +0 -1316
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
4
|
import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
declare const buttonVariants: (props?: ({
|
|
7
|
+
variant?: "solid" | "soft" | "outline" | "ghost" | null | undefined;
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
9
|
+
iconOnly?: boolean | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
6
12
|
|
|
7
13
|
type Resolvable<T> = T | ((context: AgentActionContext) => T);
|
|
8
14
|
type AgentActionContext = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
import { AnimatedIconSwap } from "
|
|
3
|
+
// src/components/block/agent-actions.tsx
|
|
4
|
+
import { AnimatedIconSwap } from "@publish.os/nextjs/kernel/components/blocks/animated-icon-swap";
|
|
5
5
|
import {
|
|
6
6
|
Button,
|
|
7
7
|
buttonVariants
|
|
8
|
-
} from "
|
|
9
|
-
import { ButtonGroup, ButtonGroupSeparator } from "
|
|
8
|
+
} from "@publish.os/nextjs/kernel/components/ui/button";
|
|
9
|
+
import { ButtonGroup, ButtonGroupSeparator } from "@publish.os/nextjs/kernel/components/ui/button-group";
|
|
10
10
|
import {
|
|
11
11
|
Menu,
|
|
12
12
|
MenuGroup,
|
|
@@ -17,42 +17,19 @@ import {
|
|
|
17
17
|
MenuPortal,
|
|
18
18
|
MenuPositioner,
|
|
19
19
|
MenuTrigger
|
|
20
|
-
} from "
|
|
21
|
-
|
|
22
|
-
// src/utils/cn.ts
|
|
23
|
-
import { clsx } from "clsx";
|
|
24
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
25
|
-
var twMerge = extendTailwindMerge({
|
|
26
|
-
extend: {
|
|
27
|
-
classGroups: {
|
|
28
|
-
z: [
|
|
29
|
-
"z-content",
|
|
30
|
-
"z-nav",
|
|
31
|
-
"z-overlay",
|
|
32
|
-
"z-modal",
|
|
33
|
-
"z-search",
|
|
34
|
-
"z-toast",
|
|
35
|
-
"z-progress"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
function cn(...inputs) {
|
|
41
|
-
return twMerge(clsx(inputs));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/kernel/components/blocks/AgentActions.tsx
|
|
20
|
+
} from "@publish.os/nextjs/kernel/components/ui/menu";
|
|
45
21
|
import {
|
|
46
|
-
Bot,
|
|
47
|
-
Check,
|
|
48
|
-
ChevronDown,
|
|
49
|
-
Clipboard,
|
|
50
|
-
ExternalLink,
|
|
51
|
-
Eye,
|
|
52
|
-
Github,
|
|
53
|
-
|
|
54
|
-
MessageCircle
|
|
55
|
-
} from "
|
|
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";
|
|
32
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
56
33
|
import {
|
|
57
34
|
useCallback,
|
|
58
35
|
useEffect,
|
|
@@ -61,18 +38,14 @@ import {
|
|
|
61
38
|
} from "react";
|
|
62
39
|
import { flushSync } from "react-dom";
|
|
63
40
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
64
|
-
var DEFAULT_PROMPT_SUFFIX = "I want to ask questions about it.";
|
|
65
|
-
var COPY_FEEDBACK_MS = 1600;
|
|
41
|
+
var DEFAULT_PROMPT_SUFFIX = "I want to ask questions about it.", COPY_FEEDBACK_MS = 1600;
|
|
66
42
|
function normalizePath(path) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (prefixed === "/") return prefixed;
|
|
70
|
-
return prefixed.replace(/\/+$/, "");
|
|
43
|
+
let [pathname = "/"] = path.split(/[?#]/), prefixed = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
44
|
+
return prefixed === "/" ? prefixed : prefixed.replace(/\/+$/, "");
|
|
71
45
|
}
|
|
72
46
|
function markdownPathForPagePath(path) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return normalized.endsWith(".md") ? normalized : `${normalized}.md`;
|
|
47
|
+
let normalized = normalizePath(path);
|
|
48
|
+
return normalized === "/" ? "/index.md" : normalized.endsWith(".md") ? normalized : `${normalized}.md`;
|
|
76
49
|
}
|
|
77
50
|
function isAbsoluteUrl(url) {
|
|
78
51
|
return /^[a-z][a-z\d+\-.]*:/i.test(url);
|
|
@@ -86,24 +59,21 @@ function absoluteUrl(url, siteUrl) {
|
|
|
86
59
|
}
|
|
87
60
|
}
|
|
88
61
|
function mergeRel(rel) {
|
|
89
|
-
|
|
90
|
-
values.add("noreferrer");
|
|
91
|
-
return Array.from(values).join(" ");
|
|
62
|
+
let values = new Set((rel ?? "").split(/\s+/).filter(Boolean));
|
|
63
|
+
return values.add("noreferrer"), Array.from(values).join(" ");
|
|
92
64
|
}
|
|
93
65
|
function createPrompt(markdownUrl) {
|
|
94
66
|
return `Read ${markdownUrl}, ${DEFAULT_PROMPT_SUFFIX}`;
|
|
95
67
|
}
|
|
96
68
|
function providerPromptUrl(baseUrl, prompt, param = "q") {
|
|
97
|
-
|
|
98
|
-
url.searchParams.set(param, prompt);
|
|
99
|
-
return url.toString();
|
|
69
|
+
let url = new URL(baseUrl);
|
|
70
|
+
return url.searchParams.set(param, prompt), url.toString();
|
|
100
71
|
}
|
|
101
72
|
var DEFAULT_PRIMARY_ACTION = {
|
|
102
73
|
id: "copy-page-markdown-primary",
|
|
103
74
|
title: "Copy Markdown",
|
|
104
75
|
copy: "page-markdown"
|
|
105
|
-
}
|
|
106
|
-
var DEFAULT_ACTION_GROUPS = [
|
|
76
|
+
}, DEFAULT_ACTION_GROUPS = [
|
|
107
77
|
{
|
|
108
78
|
id: "open-in-ai",
|
|
109
79
|
title: "Open in",
|
|
@@ -113,42 +83,42 @@ var DEFAULT_ACTION_GROUPS = [
|
|
|
113
83
|
title: "Claude",
|
|
114
84
|
icon: /* @__PURE__ */ jsx(Bot, { "aria-hidden": "true", className: "size-4" }),
|
|
115
85
|
href: ({ prompt }) => providerPromptUrl("https://claude.ai/new", prompt),
|
|
116
|
-
openInNew:
|
|
86
|
+
openInNew: !0
|
|
117
87
|
},
|
|
118
88
|
{
|
|
119
89
|
id: "open-chatgpt",
|
|
120
90
|
title: "ChatGPT",
|
|
121
91
|
icon: /* @__PURE__ */ jsx(MessageCircle, { "aria-hidden": "true", className: "size-4" }),
|
|
122
92
|
href: ({ prompt }) => providerPromptUrl("https://chatgpt.com/?hints=search", prompt),
|
|
123
|
-
openInNew:
|
|
93
|
+
openInNew: !0
|
|
124
94
|
},
|
|
125
95
|
{
|
|
126
96
|
id: "open-cursor",
|
|
127
97
|
title: "Cursor",
|
|
128
98
|
icon: /* @__PURE__ */ jsx(ExternalLink, { "aria-hidden": "true", className: "size-4" }),
|
|
129
99
|
href: ({ prompt }) => providerPromptUrl("https://cursor.com/link/prompt", prompt, "text"),
|
|
130
|
-
openInNew:
|
|
100
|
+
openInNew: !0
|
|
131
101
|
},
|
|
132
102
|
{
|
|
133
103
|
id: "open-copilot",
|
|
134
104
|
title: "Copilot",
|
|
135
105
|
icon: /* @__PURE__ */ jsx(MessageCircle, { "aria-hidden": "true", className: "size-4" }),
|
|
136
106
|
href: ({ prompt }) => providerPromptUrl("https://copilot.microsoft.com/", prompt),
|
|
137
|
-
openInNew:
|
|
107
|
+
openInNew: !0
|
|
138
108
|
},
|
|
139
109
|
{
|
|
140
110
|
id: "open-t3-chat",
|
|
141
111
|
title: "T3 Chat",
|
|
142
112
|
icon: /* @__PURE__ */ jsx(MessageCircle, { "aria-hidden": "true", className: "size-4" }),
|
|
143
113
|
href: ({ prompt }) => providerPromptUrl("https://t3.chat/new", prompt),
|
|
144
|
-
openInNew:
|
|
114
|
+
openInNew: !0
|
|
145
115
|
},
|
|
146
116
|
{
|
|
147
117
|
id: "open-github",
|
|
148
118
|
title: "GitHub source",
|
|
149
119
|
icon: /* @__PURE__ */ jsx(Github, { "aria-hidden": "true", className: "size-4" }),
|
|
150
120
|
href: ({ sourceUrl }) => sourceUrl,
|
|
151
|
-
openInNew:
|
|
121
|
+
openInNew: !0,
|
|
152
122
|
disabled: ({ sourceUrl }) => !sourceUrl
|
|
153
123
|
}
|
|
154
124
|
]
|
|
@@ -171,14 +141,14 @@ var DEFAULT_ACTION_GROUPS = [
|
|
|
171
141
|
{
|
|
172
142
|
id: "copy-page-link",
|
|
173
143
|
title: "Copy page link",
|
|
174
|
-
icon: /* @__PURE__ */ jsx(
|
|
144
|
+
icon: /* @__PURE__ */ jsx(Link, { "aria-hidden": "true", className: "size-4" }),
|
|
175
145
|
copy: "page-link"
|
|
176
146
|
}
|
|
177
147
|
]
|
|
178
148
|
}
|
|
179
149
|
];
|
|
180
150
|
function resolveValue(value, context) {
|
|
181
|
-
return typeof value
|
|
151
|
+
return typeof value == "function" ? value(context) : value;
|
|
182
152
|
}
|
|
183
153
|
async function copyText(text) {
|
|
184
154
|
await navigator.clipboard?.writeText(text);
|
|
@@ -200,43 +170,22 @@ function AgentActions({
|
|
|
200
170
|
sourceUrl,
|
|
201
171
|
...props
|
|
202
172
|
}) {
|
|
203
|
-
|
|
204
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
205
|
-
const menuActionsRef = useRef(null);
|
|
206
|
-
const menuOpenRef = useRef(false);
|
|
207
|
-
const resetTimerRef = useRef(
|
|
173
|
+
let [copiedActionId, setCopiedActionId] = useState(), [menuOpen, setMenuOpen] = useState(!1), menuActionsRef = useRef(null), menuOpenRef = useRef(!1), resetTimerRef = useRef(
|
|
208
174
|
void 0
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
setMenuOpen(open);
|
|
213
|
-
}, []);
|
|
214
|
-
const closeMenu = useCallback(() => {
|
|
175
|
+
), setMenuOpenState = useCallback((open) => {
|
|
176
|
+
menuOpenRef.current = open, setMenuOpen(open);
|
|
177
|
+
}, []), closeMenu = useCallback(() => {
|
|
215
178
|
flushSync(() => {
|
|
216
|
-
menuOpenRef.current =
|
|
217
|
-
setMenuOpen(false);
|
|
218
|
-
menuActionsRef.current?.close();
|
|
219
|
-
menuActionsRef.current?.unmount();
|
|
179
|
+
menuOpenRef.current = !1, setMenuOpen(!1), menuActionsRef.current?.close(), menuActionsRef.current?.unmount();
|
|
220
180
|
});
|
|
221
181
|
}, []);
|
|
222
|
-
useEffect(() => {
|
|
223
|
-
window.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
window.removeEventListener("pagehide", closeMenu);
|
|
227
|
-
window.removeEventListener("pageshow", closeMenu);
|
|
228
|
-
if (resetTimerRef.current) {
|
|
229
|
-
clearTimeout(resetTimerRef.current);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
}, [closeMenu]);
|
|
233
|
-
const resolvedPagePath = pagePath ?? "/";
|
|
234
|
-
const resolvedMarkdownPath = markdownPath ?? markdownPathForPagePath(resolvedPagePath);
|
|
235
|
-
const resolvedMarkdownUrl = absoluteUrl(
|
|
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]);
|
|
185
|
+
let resolvedPagePath = pagePath ?? "/", resolvedMarkdownPath = markdownPath ?? markdownPathForPagePath(resolvedPagePath), resolvedMarkdownUrl = absoluteUrl(
|
|
236
186
|
markdownUrl ?? resolvedMarkdownPath,
|
|
237
187
|
siteUrl
|
|
238
|
-
)
|
|
239
|
-
const context = {
|
|
188
|
+
), context = {
|
|
240
189
|
markdown,
|
|
241
190
|
markdownPath: resolvedMarkdownPath,
|
|
242
191
|
markdownUrl: resolvedMarkdownUrl,
|
|
@@ -244,134 +193,99 @@ function AgentActions({
|
|
|
244
193
|
pageUrl: absoluteUrl(pageUrl ?? resolvedPagePath, siteUrl),
|
|
245
194
|
prompt: prompt ?? createPrompt(resolvedMarkdownUrl),
|
|
246
195
|
sourceUrl
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS;
|
|
250
|
-
const markCopied = (actionId) => {
|
|
251
|
-
if (resetTimerRef.current) {
|
|
252
|
-
clearTimeout(resetTimerRef.current);
|
|
253
|
-
}
|
|
254
|
-
setCopiedActionId(actionId);
|
|
255
|
-
resetTimerRef.current = setTimeout(() => {
|
|
196
|
+
}, resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION, resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS, markCopied = (actionId) => {
|
|
197
|
+
resetTimerRef.current && clearTimeout(resetTimerRef.current), setCopiedActionId(actionId), resetTimerRef.current = setTimeout(() => {
|
|
256
198
|
setCopiedActionId(void 0);
|
|
257
199
|
}, COPY_FEEDBACK_MS);
|
|
258
|
-
}
|
|
259
|
-
const copyValueForAction = async (action) => {
|
|
200
|
+
}, copyValueForAction = async (action) => {
|
|
260
201
|
if (action.copy === "page-markdown") {
|
|
261
|
-
if (context.markdownUrl)
|
|
202
|
+
if (context.markdownUrl)
|
|
262
203
|
try {
|
|
263
|
-
|
|
204
|
+
let response = await fetch(context.markdownUrl);
|
|
264
205
|
if (response.ok) return response.text();
|
|
265
206
|
} catch {
|
|
266
207
|
return context.markdown ?? "";
|
|
267
208
|
}
|
|
268
|
-
}
|
|
269
209
|
return context.markdown ?? "";
|
|
270
210
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (action.copy) {
|
|
278
|
-
const value = await copyValueForAction(action);
|
|
279
|
-
if (value) {
|
|
280
|
-
await copyText(value);
|
|
281
|
-
markCopied(action.id);
|
|
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));
|
|
282
217
|
}
|
|
218
|
+
await action.onSelect?.(context);
|
|
283
219
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
"
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
),
|
|
320
|
-
"data-disabled": disabled ? "" : void 0,
|
|
321
|
-
href: disabled ? void 0 : href,
|
|
322
|
-
rel,
|
|
323
|
-
target,
|
|
324
|
-
children: [
|
|
325
|
-
iconForAction(resolvedPrimaryAction),
|
|
326
|
-
/* @__PURE__ */ jsx("span", { children: resolvedPrimaryAction.title })
|
|
327
|
-
]
|
|
328
|
-
}
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
return /* @__PURE__ */ jsx(
|
|
220
|
+
}, iconForAction = (action) => {
|
|
221
|
+
let copied = copiedActionId === action.id;
|
|
222
|
+
return action.copy === "page-markdown" ? /* @__PURE__ */ jsx(
|
|
223
|
+
AnimatedIconSwap,
|
|
224
|
+
{
|
|
225
|
+
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" }),
|
|
228
|
+
size: 16
|
|
229
|
+
}
|
|
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(
|
|
234
|
+
"a",
|
|
235
|
+
{
|
|
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,
|
|
249
|
+
children: [
|
|
250
|
+
iconForAction(resolvedPrimaryAction),
|
|
251
|
+
/* @__PURE__ */ jsx("span", { children: resolvedPrimaryAction.title })
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
) : /* @__PURE__ */ jsx(
|
|
332
255
|
Button,
|
|
333
256
|
{
|
|
334
|
-
disabled:
|
|
257
|
+
disabled: !!disabled,
|
|
335
258
|
leftIcon: iconForAction(resolvedPrimaryAction),
|
|
336
259
|
onClick: () => {
|
|
337
|
-
|
|
260
|
+
handleAction(resolvedPrimaryAction);
|
|
338
261
|
},
|
|
339
262
|
size: buttonSize,
|
|
340
263
|
variant: buttonVariant,
|
|
341
264
|
children: resolvedPrimaryAction.title
|
|
342
265
|
}
|
|
343
266
|
);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
children: [
|
|
362
|
-
icon,
|
|
363
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
|
|
364
|
-
]
|
|
365
|
-
},
|
|
366
|
-
action.id
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
return /* @__PURE__ */ jsxs(
|
|
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(
|
|
370
284
|
MenuItem,
|
|
371
285
|
{
|
|
372
|
-
disabled:
|
|
286
|
+
disabled: !!disabled,
|
|
373
287
|
onClick: () => {
|
|
374
|
-
|
|
288
|
+
handleAction(action);
|
|
375
289
|
},
|
|
376
290
|
children: [
|
|
377
291
|
icon,
|
|
@@ -394,7 +308,7 @@ function AgentActions({
|
|
|
394
308
|
Menu,
|
|
395
309
|
{
|
|
396
310
|
actionsRef: menuActionsRef,
|
|
397
|
-
modal:
|
|
311
|
+
modal: !1,
|
|
398
312
|
onOpenChange: setMenuOpenState,
|
|
399
313
|
open: menuOpen,
|
|
400
314
|
children: [
|
|
@@ -404,7 +318,7 @@ function AgentActions({
|
|
|
404
318
|
"aria-label": menuLabel,
|
|
405
319
|
className: cn(
|
|
406
320
|
buttonVariants({
|
|
407
|
-
iconOnly:
|
|
321
|
+
iconOnly: !0,
|
|
408
322
|
size: buttonSize,
|
|
409
323
|
variant: buttonVariant
|
|
410
324
|
}),
|
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
|
-
var twMerge = extendTailwindMerge({
|
|
5
|
-
extend: {
|
|
6
|
-
classGroups: {
|
|
7
|
-
z: [
|
|
8
|
-
"z-content",
|
|
9
|
-
"z-nav",
|
|
10
|
-
"z-overlay",
|
|
11
|
-
"z-modal",
|
|
12
|
-
"z-search",
|
|
13
|
-
"z-toast",
|
|
14
|
-
"z-progress"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function cn(...inputs) {
|
|
20
|
-
return twMerge(clsx(inputs));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// src/kernel/components/blocks/animated-icon-swap.tsx
|
|
1
|
+
// src/components/ui/animated-icon-swap.tsx
|
|
2
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
24
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
4
|
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";
|
|
26
5
|
function AnimatedIconSwap({
|
|
@@ -44,7 +23,7 @@ function AnimatedIconSwap({
|
|
|
44
23
|
/* @__PURE__ */ jsx(
|
|
45
24
|
"span",
|
|
46
25
|
{
|
|
47
|
-
"aria-hidden": active ?
|
|
26
|
+
"aria-hidden": active ? !0 : void 0,
|
|
48
27
|
className: cn(
|
|
49
28
|
iconSlotClassName,
|
|
50
29
|
active ? "scale-75 opacity-0" : "scale-100 opacity-100"
|
|
@@ -56,7 +35,7 @@ function AnimatedIconSwap({
|
|
|
56
35
|
/* @__PURE__ */ jsx(
|
|
57
36
|
"span",
|
|
58
37
|
{
|
|
59
|
-
"aria-hidden": active ? void 0 :
|
|
38
|
+
"aria-hidden": active ? void 0 : !0,
|
|
60
39
|
className: cn(
|
|
61
40
|
iconSlotClassName,
|
|
62
41
|
active ? "scale-100 opacity-100" : "scale-75 opacity-0"
|