@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
- package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
- package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
- package/compiler-assets/nextjs/shims/document.tsx +46 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
- package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
- package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
- package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
- package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
- package/compiler-assets/nextjs/shims/proxy.ts +254 -86
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
- package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
- package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-3T4HVDSC.js +426 -0
- package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
- package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
- package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
- package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
- package/dist/chunk-DX7PXFCM.js +2519 -0
- package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +111 -23
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +563 -0
- package/dist/components/blocks/toc.d.ts +43 -0
- package/dist/components/blocks/toc.js +136 -0
- package/dist/components/ui/button.d.ts +4 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-44GJSMXD.js +16 -0
- package/dist/config/createNextConfig.js +19 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-TG74L4FF.js +16 -0
- package/dist/index.d.ts +151 -95
- package/dist/index.js +25 -0
- package/dist/jsx-dev-runtime.d.ts +6 -0
- package/dist/jsx-dev-runtime.js +100 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.js +97 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +37 -8
- package/dist/kernel/components/blocks/AgentActions.js +384 -174
- package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
- package/dist/kernel/components/blocks/agent-actions.js +563 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +79 -59
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +30 -7
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +32 -9
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +13 -3
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +137 -28
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/theme-toggle.js +5 -5
- package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
- package/dist/kernel/components/blocks/toc-client.js +495 -0
- package/dist/kernel/components/blocks/toc.d.ts +20 -2
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +22 -17
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +6 -6
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -4
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +57 -16
- package/dist/kernel/components/mdx/mdx.js +232 -35
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/next-image.d.ts +12 -0
- package/dist/kernel/components/next-image.js +61 -0
- package/dist/kernel/components/ui/accordion.d.ts +7 -7
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +6 -6
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +59 -7
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/drawer.js +1 -1
- package/dist/kernel/components/ui/input.d.ts +2 -2
- package/dist/kernel/components/ui/input.js +1 -1
- package/dist/kernel/components/ui/kbd.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +11 -5
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/select.js +1 -1
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +4 -17
- package/dist/kernel/defaults.registry.js +4 -19
- package/dist/kernel/routes/agent/markdown.d.ts +7 -0
- package/dist/kernel/routes/agent/markdown.js +229 -54
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +5 -7
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +119 -88
- package/dist/kernel/routes/metadata/llms.d.ts +3 -23
- package/dist/kernel/routes/metadata/llms.js +2 -103
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +5 -3
- package/dist/kernel/routes/metadata/robots.js +4 -25
- package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
- package/dist/kernel/routes/metadata/sitemap.js +277 -49
- package/dist/kernel/routes/not-found.d.ts +34 -0
- package/dist/kernel/routes/not-found.js +213 -0
- package/dist/kernel/routes/pages/group.d.ts +5 -5
- package/dist/kernel/routes/pages/group.js +11 -5
- package/dist/kernel/routes/pages/leaf.d.ts +38 -6
- package/dist/kernel/routes/pages/leaf.js +21 -12
- package/dist/kernel/routes/pages/root.d.ts +5 -5
- package/dist/kernel/routes/pages/root.js +21 -6
- package/dist/keyboard-shortcuts.d.ts +2 -2
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +65 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +2 -9
- package/dist/search.js +9 -16
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/theme-scope.js +1 -1
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +117 -91
- package/dist/utils/heading-ids.js +30 -11
- package/dist/utils/toc-selection.d.ts +7 -0
- package/dist/utils/toc-selection.js +14 -0
- package/dist/validate-local-source-EN2GW4FR.js +16 -0
- package/dist/validate-publish-os-source-OEWQDB7B.js +14 -0
- package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
- package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
- package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
- package/init/seed/minimal/publish.os/blog/index.tsx +85 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
- package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +12 -4
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +48 -23
- package/release/app/phosphor/package.json +4 -4
- package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +153 -183
- package/release/release.json +6 -6
- package/dist/button-CtzUJB8u.d.ts +0 -11
- package/dist/chunk-535TM4A5.js +0 -1455
- package/dist/chunk-B2V22WRT.js +0 -297
- package/dist/chunk-NECL5IBJ.js +0 -318
- package/dist/chunk-SVYGXXYR.js +0 -36
- package/dist/chunk-UF6ATARM.js +0 -1100
- package/dist/compose-NN23UJGC.js +0 -13
- package/dist/ide-support-ZNW7ODFY.js +0 -15
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -667
- package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/link-playground.js +0 -744
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
- package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -53
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-BzkZty3r.d.ts +0 -147
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/validate-local-source-XRL2Y7XE.js +0 -14
- package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
- package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { AgentActionConfig, AgentActionContext, AgentActionCopyTarget, AgentActionGroup, AgentActions, AgentActionsProps, Feedback, Group, Item, MarkdownLink, Menu, PrimaryAction, Root, Toolbar } from './AgentActions.js';
|
|
3
|
+
import 'class-variance-authority/types';
|
|
4
|
+
import 'class-variance-authority';
|
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/modules/agent-actions/agent-actions.tsx
|
|
4
|
+
import { AnimatedIconSwap } from "@components/blocks/animated-icon-swap";
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
buttonVariants
|
|
8
|
+
} from "@components/ui/button";
|
|
9
|
+
import { ButtonGroup, ButtonGroupSeparator } from "@components/ui/button-group";
|
|
10
|
+
import {
|
|
11
|
+
Menu,
|
|
12
|
+
MenuGroup,
|
|
13
|
+
MenuGroupLabel,
|
|
14
|
+
MenuItem,
|
|
15
|
+
MenuLinkItem,
|
|
16
|
+
MenuPopup,
|
|
17
|
+
MenuPortal,
|
|
18
|
+
MenuPositioner,
|
|
19
|
+
MenuSeparator,
|
|
20
|
+
MenuTrigger
|
|
21
|
+
} from "@components/ui/menu";
|
|
22
|
+
import {
|
|
23
|
+
CaretDownIcon,
|
|
24
|
+
CheckIcon,
|
|
25
|
+
CopyIcon,
|
|
26
|
+
MarkdownLogoIcon
|
|
27
|
+
} from "@phosphor-icons/react/ssr";
|
|
28
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
29
|
+
import {
|
|
30
|
+
createContext,
|
|
31
|
+
Fragment,
|
|
32
|
+
use,
|
|
33
|
+
useCallback,
|
|
34
|
+
useEffect,
|
|
35
|
+
useRef,
|
|
36
|
+
useState
|
|
37
|
+
} from "react";
|
|
38
|
+
import { flushSync } from "react-dom";
|
|
39
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
40
|
+
var DEFAULT_PROMPT_SUFFIX = "I want to ask questions about it.", COPY_FEEDBACK_MS = 1600;
|
|
41
|
+
function normalizePath(path) {
|
|
42
|
+
let [pathname = "/"] = path.split(/[?#]/), prefixed = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
43
|
+
return prefixed === "/" ? prefixed : prefixed.replace(/\/+$/, "");
|
|
44
|
+
}
|
|
45
|
+
function markdownPathForPagePath(path) {
|
|
46
|
+
let normalized = normalizePath(path);
|
|
47
|
+
return normalized === "/" ? "/index.md" : `${normalized}.md`;
|
|
48
|
+
}
|
|
49
|
+
function isAbsoluteUrl(url) {
|
|
50
|
+
return /^[a-z][a-z\d+\-.]*:/i.test(url);
|
|
51
|
+
}
|
|
52
|
+
function absoluteUrl(url, siteUrl) {
|
|
53
|
+
if (isAbsoluteUrl(url) || !siteUrl) return url;
|
|
54
|
+
try {
|
|
55
|
+
return new URL(url, siteUrl).toString();
|
|
56
|
+
} catch {
|
|
57
|
+
return url;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function mergeRel(rel) {
|
|
61
|
+
let values = new Set((rel ?? "").split(/\s+/).filter(Boolean));
|
|
62
|
+
return values.add("noreferrer"), Array.from(values).join(" ");
|
|
63
|
+
}
|
|
64
|
+
function createPrompt(markdownUrl) {
|
|
65
|
+
return `Read ${markdownUrl}, ${DEFAULT_PROMPT_SUFFIX}`;
|
|
66
|
+
}
|
|
67
|
+
function providerPromptUrl(baseUrl, prompt, param = "q") {
|
|
68
|
+
let url = new URL(baseUrl);
|
|
69
|
+
return url.searchParams.set(param, prompt), url.toString();
|
|
70
|
+
}
|
|
71
|
+
var DEFAULT_PRIMARY_ACTION = {
|
|
72
|
+
id: "copy-page-markdown-primary",
|
|
73
|
+
title: "Copy Markdown",
|
|
74
|
+
copy: "page-markdown"
|
|
75
|
+
}, DEFAULT_ACTION_GROUPS = [
|
|
76
|
+
{
|
|
77
|
+
id: "open-in-ai",
|
|
78
|
+
title: "Open in",
|
|
79
|
+
actions: [
|
|
80
|
+
{
|
|
81
|
+
id: "open-chatgpt",
|
|
82
|
+
title: "ChatGPT",
|
|
83
|
+
href: ({ prompt }) => providerPromptUrl("https://chatgpt.com/?hints=search", prompt),
|
|
84
|
+
openInNew: !0
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "page-actions",
|
|
90
|
+
title: "Page",
|
|
91
|
+
actions: [
|
|
92
|
+
{
|
|
93
|
+
id: "copy-page-markdown",
|
|
94
|
+
title: "Copy markdown",
|
|
95
|
+
copy: "page-markdown"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "view-page-markdown",
|
|
99
|
+
title: "View as Markdown",
|
|
100
|
+
href: ({ markdownPath }) => markdownPath
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "copy-page-link",
|
|
104
|
+
title: "Copy link",
|
|
105
|
+
copy: "page-link"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
function resolveValue(value, context) {
|
|
111
|
+
return typeof value == "function" ? value(context) : value;
|
|
112
|
+
}
|
|
113
|
+
async function copyText(text) {
|
|
114
|
+
if (!navigator.clipboard?.writeText)
|
|
115
|
+
throw new Error("Clipboard access is not available in this browser.");
|
|
116
|
+
await navigator.clipboard.writeText(text);
|
|
117
|
+
}
|
|
118
|
+
function revisionRequestPath(path, revision) {
|
|
119
|
+
if (!revision) return path;
|
|
120
|
+
let separator = path.includes("?") ? "&" : "?";
|
|
121
|
+
return `${path}${separator}publishos_revision=${encodeURIComponent(revision)}`;
|
|
122
|
+
}
|
|
123
|
+
async function markdownHash(text) {
|
|
124
|
+
if (!globalThis.crypto?.subtle)
|
|
125
|
+
throw new Error("This browser cannot verify the current Markdown version.");
|
|
126
|
+
let digest = await globalThis.crypto.subtle.digest(
|
|
127
|
+
"SHA-256",
|
|
128
|
+
new TextEncoder().encode(text)
|
|
129
|
+
);
|
|
130
|
+
return `sha256-${Array.from(
|
|
131
|
+
new Uint8Array(digest),
|
|
132
|
+
(byte) => byte.toString(16).padStart(2, "0")
|
|
133
|
+
).join("").slice(0, 32)}`;
|
|
134
|
+
}
|
|
135
|
+
var AgentActionsContext = createContext(
|
|
136
|
+
null
|
|
137
|
+
);
|
|
138
|
+
function useAgentActions() {
|
|
139
|
+
let context = use(AgentActionsContext);
|
|
140
|
+
if (!context)
|
|
141
|
+
throw new Error("AgentActions parts must be inside AgentActions.Root.");
|
|
142
|
+
return context;
|
|
143
|
+
}
|
|
144
|
+
function AgentActionsProvider({
|
|
145
|
+
actionGroups,
|
|
146
|
+
buttonSize = "xs",
|
|
147
|
+
buttonVariant = "outline",
|
|
148
|
+
className,
|
|
149
|
+
markdown,
|
|
150
|
+
markdownPath,
|
|
151
|
+
markdownRevision,
|
|
152
|
+
markdownUrl,
|
|
153
|
+
menuLabel = "More agent actions",
|
|
154
|
+
markdownLinkLabel = "View as Markdown",
|
|
155
|
+
pagePath,
|
|
156
|
+
pageUrl,
|
|
157
|
+
primaryAction,
|
|
158
|
+
prompt,
|
|
159
|
+
siteUrl,
|
|
160
|
+
sourceUrl,
|
|
161
|
+
showMarkdownLink = !0,
|
|
162
|
+
children,
|
|
163
|
+
...props
|
|
164
|
+
}) {
|
|
165
|
+
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(
|
|
166
|
+
void 0
|
|
167
|
+
), closeMenu = useCallback(() => {
|
|
168
|
+
flushSync(() => {
|
|
169
|
+
menuOpenRef.current = !1, setMenuOpen(!1), menuActionsRef.current?.close(), menuActionsRef.current?.unmount();
|
|
170
|
+
});
|
|
171
|
+
}, []);
|
|
172
|
+
useEffect(() => () => {
|
|
173
|
+
resetTimerRef.current && clearTimeout(resetTimerRef.current);
|
|
174
|
+
}, []);
|
|
175
|
+
let resolvedPagePath = pagePath ?? "/", resolvedMarkdownPath = markdownPath ?? markdownPathForPagePath(resolvedPagePath), resolvedMarkdownUrl = absoluteUrl(
|
|
176
|
+
markdownUrl ?? resolvedMarkdownPath,
|
|
177
|
+
siteUrl
|
|
178
|
+
), context = {
|
|
179
|
+
markdown,
|
|
180
|
+
markdownPath: resolvedMarkdownPath,
|
|
181
|
+
markdownUrl: resolvedMarkdownUrl,
|
|
182
|
+
pagePath: resolvedPagePath,
|
|
183
|
+
pageUrl: absoluteUrl(pageUrl ?? resolvedPagePath, siteUrl),
|
|
184
|
+
prompt: prompt ?? createPrompt(resolvedMarkdownUrl),
|
|
185
|
+
sourceUrl
|
|
186
|
+
}, markdownKey = `${context.markdownUrl}\0${markdownRevision ?? "unversioned"}`;
|
|
187
|
+
currentMarkdownKeyRef.current = markdownKey, useEffect(
|
|
188
|
+
() => () => {
|
|
189
|
+
markdownPreparationRef.current?.controller?.abort(), markdownPreparationRef.current = null;
|
|
190
|
+
},
|
|
191
|
+
[]
|
|
192
|
+
), useEffect(() => {
|
|
193
|
+
let preparation = markdownPreparationRef.current;
|
|
194
|
+
preparation && preparation.key !== markdownKey && (preparation.controller?.abort(), markdownPreparationRef.current = null, setCopyFeedback(void 0), setCopiedActionId(void 0));
|
|
195
|
+
}, [markdownKey]);
|
|
196
|
+
let resolvedPrimaryAction = primaryAction ?? DEFAULT_PRIMARY_ACTION, resolvedActionGroups = actionGroups ?? DEFAULT_ACTION_GROUPS, markCopied = (actionId) => {
|
|
197
|
+
resetTimerRef.current && clearTimeout(resetTimerRef.current), setCopiedActionId(actionId), resetTimerRef.current = setTimeout(() => {
|
|
198
|
+
setCopiedActionId(void 0);
|
|
199
|
+
}, COPY_FEEDBACK_MS);
|
|
200
|
+
}, markdownPreparation = () => {
|
|
201
|
+
let current = markdownPreparationRef.current;
|
|
202
|
+
if (current?.key === markdownKey) return current;
|
|
203
|
+
current?.controller?.abort();
|
|
204
|
+
let next = { key: markdownKey };
|
|
205
|
+
return markdownPreparationRef.current = next, next;
|
|
206
|
+
}, prepareMarkdown = () => {
|
|
207
|
+
if (context.markdown !== void 0 || !context.markdownUrl) return;
|
|
208
|
+
let record = markdownPreparation();
|
|
209
|
+
if (record.text !== void 0 || record.pending) return;
|
|
210
|
+
let controller = new AbortController();
|
|
211
|
+
record.controller = controller;
|
|
212
|
+
let requestPath = revisionRequestPath(
|
|
213
|
+
context.markdownPath,
|
|
214
|
+
markdownRevision
|
|
215
|
+
), localPreview = process.env.NODE_ENV !== "production", request = async (cache) => {
|
|
216
|
+
let response;
|
|
217
|
+
try {
|
|
218
|
+
response = await fetch(requestPath, {
|
|
219
|
+
cache,
|
|
220
|
+
signal: controller.signal
|
|
221
|
+
});
|
|
222
|
+
} catch {
|
|
223
|
+
throw new Error("The Markdown page could not be loaded.");
|
|
224
|
+
}
|
|
225
|
+
if (!response.ok)
|
|
226
|
+
throw new Error(
|
|
227
|
+
`The Markdown page could not be loaded (${response.status}).`
|
|
228
|
+
);
|
|
229
|
+
return response.text();
|
|
230
|
+
}, pending = (async () => {
|
|
231
|
+
let firstBody = await request(localPreview ? "no-store" : "default");
|
|
232
|
+
if (!markdownRevision || await markdownHash(firstBody) === markdownRevision)
|
|
233
|
+
return firstBody;
|
|
234
|
+
let refreshedBody = await request(localPreview ? "no-store" : "reload");
|
|
235
|
+
if (await markdownHash(refreshedBody) !== markdownRevision)
|
|
236
|
+
throw new Error(
|
|
237
|
+
"The Markdown page changed while loading. Refresh the page and try again."
|
|
238
|
+
);
|
|
239
|
+
return refreshedBody;
|
|
240
|
+
})().then((text) => (markdownPreparationRef.current === record && currentMarkdownKeyRef.current === record.key && (record.text = text), text)).catch((error) => {
|
|
241
|
+
throw markdownPreparationRef.current === record && (markdownPreparationRef.current = null), error;
|
|
242
|
+
}).finally(() => {
|
|
243
|
+
record.pending = void 0, record.controller = void 0;
|
|
244
|
+
});
|
|
245
|
+
record.pending = pending, pending.catch(() => {
|
|
246
|
+
});
|
|
247
|
+
}, setMenuOpenState = (open) => {
|
|
248
|
+
menuOpenRef.current = open, setMenuOpen(open), open && resolvedActionGroups.some(
|
|
249
|
+
(group) => group.actions.some(
|
|
250
|
+
(action) => action.copy === "page-markdown" && !resolveValue(action.disabled, context)
|
|
251
|
+
)
|
|
252
|
+
) && prepareMarkdown();
|
|
253
|
+
}, prepareAction = (action) => {
|
|
254
|
+
action.copy === "page-markdown" && !resolveValue(action.disabled, context) && prepareMarkdown();
|
|
255
|
+
}, finishAction = async (action, clipboardWrite, actionMarkdownKey) => {
|
|
256
|
+
try {
|
|
257
|
+
if (await clipboardWrite, actionMarkdownKey && currentMarkdownKeyRef.current !== actionMarkdownKey)
|
|
258
|
+
return;
|
|
259
|
+
markCopied(action.id), setCopyFeedback("Copied to clipboard."), await action.onSelect?.(context);
|
|
260
|
+
} catch (error) {
|
|
261
|
+
if (actionMarkdownKey && currentMarkdownKeyRef.current !== actionMarkdownKey)
|
|
262
|
+
return;
|
|
263
|
+
setCopyFeedback(
|
|
264
|
+
error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}, handleAction = (action) => {
|
|
268
|
+
if (resolveValue(action.disabled, context)) return;
|
|
269
|
+
if (setCopyFeedback(void 0), setCopiedActionId(void 0), !action.copy) {
|
|
270
|
+
Promise.resolve(action.onSelect?.(context)).catch(
|
|
271
|
+
(error) => {
|
|
272
|
+
setCopyFeedback(
|
|
273
|
+
error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (action.copy === "page-markdown" && context.markdown === void 0) {
|
|
280
|
+
if (!context.markdownUrl) {
|
|
281
|
+
setCopyFeedback("The Markdown page URL is not available. Try again.");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
let record = markdownPreparation();
|
|
285
|
+
if (record.text !== void 0) {
|
|
286
|
+
if (!record.text) {
|
|
287
|
+
setCopyFeedback("There is no Markdown content to copy. Try again.");
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
finishAction(action, copyText(record.text), record.key);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
setCopyFeedback("Preparing Markdown\u2026"), prepareMarkdown();
|
|
294
|
+
let pending = markdownPreparationRef.current?.pending;
|
|
295
|
+
if (!pending) return;
|
|
296
|
+
pending.then(
|
|
297
|
+
(text) => {
|
|
298
|
+
if (currentMarkdownKeyRef.current === record.key) {
|
|
299
|
+
if (!text) {
|
|
300
|
+
setCopyFeedback("There is no Markdown content to copy. Try again.");
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
finishAction(action, copyText(text), record.key);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
(error) => {
|
|
307
|
+
currentMarkdownKeyRef.current === record.key && setCopyFeedback(
|
|
308
|
+
error instanceof Error ? `${error.message} Try again.` : "The action failed. Try again."
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
let value = action.copy === "page-markdown" ? context.markdown : action.copy === "page-link" ? context.pageUrl : action.copy === "markdown-link" ? context.markdownUrl : action.copy;
|
|
315
|
+
if (!value) {
|
|
316
|
+
setCopyFeedback("There is no Markdown content to copy. Try again.");
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
finishAction(action, copyText(value));
|
|
320
|
+
}, iconForAction = (action) => {
|
|
321
|
+
let copied = copiedActionId === action.id;
|
|
322
|
+
return action.copy === "page-markdown" ? /* @__PURE__ */ jsx(
|
|
323
|
+
AnimatedIconSwap,
|
|
324
|
+
{
|
|
325
|
+
active: copied,
|
|
326
|
+
activeIcon: /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
327
|
+
defaultIcon: action.icon ?? /* @__PURE__ */ jsx(CopyIcon, { "aria-hidden": "true", className: "size-4" }),
|
|
328
|
+
size: 16
|
|
329
|
+
}
|
|
330
|
+
) : copied ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-4" }) : action.icon;
|
|
331
|
+
}, contextValue = {
|
|
332
|
+
buttonSize,
|
|
333
|
+
buttonVariant,
|
|
334
|
+
closeMenu,
|
|
335
|
+
copyFeedback,
|
|
336
|
+
menuActionsRef,
|
|
337
|
+
menuLabel,
|
|
338
|
+
menuOpen,
|
|
339
|
+
menuTriggerRef,
|
|
340
|
+
markdownLink: showMarkdownLink ? /* @__PURE__ */ jsxs(
|
|
341
|
+
"a",
|
|
342
|
+
{
|
|
343
|
+
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",
|
|
344
|
+
"data-slot": "agent-actions-markdown-link",
|
|
345
|
+
href: resolvedMarkdownPath,
|
|
346
|
+
children: [
|
|
347
|
+
/* @__PURE__ */ jsx(
|
|
348
|
+
MarkdownLogoIcon,
|
|
349
|
+
{
|
|
350
|
+
"aria-hidden": "true",
|
|
351
|
+
className: "size-4 shrink-0",
|
|
352
|
+
weight: "fill"
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ jsx("span", { children: markdownLinkLabel })
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
) : null,
|
|
359
|
+
renderPrimaryAction: (action = resolvedPrimaryAction) => {
|
|
360
|
+
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;
|
|
361
|
+
return href && !action.copy && !action.onSelect ? /* @__PURE__ */ jsxs(
|
|
362
|
+
"a",
|
|
363
|
+
{
|
|
364
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
365
|
+
className: cn(
|
|
366
|
+
buttonVariants({
|
|
367
|
+
iconOnly: !1,
|
|
368
|
+
size: buttonSize,
|
|
369
|
+
variant: buttonVariant
|
|
370
|
+
}),
|
|
371
|
+
disabled && "pointer-events-none opacity-50"
|
|
372
|
+
),
|
|
373
|
+
"data-disabled": disabled ? "" : void 0,
|
|
374
|
+
href: disabled ? void 0 : href,
|
|
375
|
+
rel,
|
|
376
|
+
target,
|
|
377
|
+
children: [
|
|
378
|
+
iconForAction(action),
|
|
379
|
+
/* @__PURE__ */ jsx("span", { children: action.title })
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
) : /* @__PURE__ */ jsx(
|
|
383
|
+
Button,
|
|
384
|
+
{
|
|
385
|
+
disabled: !!disabled,
|
|
386
|
+
leftIcon: iconForAction(action),
|
|
387
|
+
onFocus: () => prepareAction(action),
|
|
388
|
+
onClick: () => {
|
|
389
|
+
handleAction(action);
|
|
390
|
+
},
|
|
391
|
+
onPointerDown: () => prepareAction(action),
|
|
392
|
+
onPointerEnter: () => prepareAction(action),
|
|
393
|
+
size: buttonSize,
|
|
394
|
+
variant: buttonVariant,
|
|
395
|
+
children: action.title
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
},
|
|
399
|
+
renderMenuAction: (action) => {
|
|
400
|
+
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;
|
|
401
|
+
return href && !action.copy && !action.onSelect && !disabled ? /* @__PURE__ */ jsxs(
|
|
402
|
+
MenuLinkItem,
|
|
403
|
+
{
|
|
404
|
+
closeOnClick: !0,
|
|
405
|
+
href,
|
|
406
|
+
onClick: closeMenu,
|
|
407
|
+
rel,
|
|
408
|
+
target,
|
|
409
|
+
children: [
|
|
410
|
+
action.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0", children: action.icon }) : null,
|
|
411
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
action.id
|
|
415
|
+
) : /* @__PURE__ */ jsxs(
|
|
416
|
+
MenuItem,
|
|
417
|
+
{
|
|
418
|
+
disabled: !!disabled,
|
|
419
|
+
onFocus: () => prepareAction(action),
|
|
420
|
+
onClick: () => {
|
|
421
|
+
handleAction(action);
|
|
422
|
+
},
|
|
423
|
+
onPointerDown: () => prepareAction(action),
|
|
424
|
+
onPointerEnter: () => prepareAction(action),
|
|
425
|
+
children: [
|
|
426
|
+
action.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0", children: action.icon }) : null,
|
|
427
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: label })
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
action.id
|
|
431
|
+
);
|
|
432
|
+
},
|
|
433
|
+
resolvedActionGroups,
|
|
434
|
+
setMenuOpenState
|
|
435
|
+
};
|
|
436
|
+
return /* @__PURE__ */ jsx(AgentActionsContext.Provider, { value: contextValue, children: children ?? /* @__PURE__ */ jsx(AgentActionsDefaultLayout, { className, ...props }) });
|
|
437
|
+
}
|
|
438
|
+
function AgentActionsDefaultLayout({
|
|
439
|
+
className,
|
|
440
|
+
...props
|
|
441
|
+
}) {
|
|
442
|
+
return /* @__PURE__ */ jsxs(AgentActionsToolbar, { className, ...props, children: [
|
|
443
|
+
/* @__PURE__ */ jsx(AgentActionsMarkdownLink, {}),
|
|
444
|
+
/* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
445
|
+
/* @__PURE__ */ jsx(AgentActionsPrimaryAction, {}),
|
|
446
|
+
/* @__PURE__ */ jsx(ButtonGroupSeparator, {}),
|
|
447
|
+
/* @__PURE__ */ jsx(AgentActionsMenu, {})
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ jsx(AgentActionsFeedback, {})
|
|
450
|
+
] });
|
|
451
|
+
}
|
|
452
|
+
function AgentActionsToolbar({
|
|
453
|
+
className,
|
|
454
|
+
...props
|
|
455
|
+
}) {
|
|
456
|
+
return /* @__PURE__ */ jsx(
|
|
457
|
+
"div",
|
|
458
|
+
{
|
|
459
|
+
className: cn(
|
|
460
|
+
"inline-flex flex-wrap items-center gap-x-3 gap-y-2",
|
|
461
|
+
className
|
|
462
|
+
),
|
|
463
|
+
"data-slot": "agent-actions",
|
|
464
|
+
...props
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
function AgentActionsMarkdownLink() {
|
|
469
|
+
return useAgentActions().markdownLink;
|
|
470
|
+
}
|
|
471
|
+
function AgentActionsPrimaryAction({ action }) {
|
|
472
|
+
return useAgentActions().renderPrimaryAction(action);
|
|
473
|
+
}
|
|
474
|
+
function AgentActionsFeedback() {
|
|
475
|
+
let { copyFeedback } = useAgentActions();
|
|
476
|
+
return /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", role: "status", children: copyFeedback });
|
|
477
|
+
}
|
|
478
|
+
function AgentActionsGroup({
|
|
479
|
+
title,
|
|
480
|
+
children
|
|
481
|
+
}) {
|
|
482
|
+
return /* @__PURE__ */ jsxs(MenuGroup, { children: [
|
|
483
|
+
title ? /* @__PURE__ */ jsx(MenuGroupLabel, { children: title }) : null,
|
|
484
|
+
children
|
|
485
|
+
] });
|
|
486
|
+
}
|
|
487
|
+
function AgentActionsItem({ action }) {
|
|
488
|
+
return useAgentActions().renderMenuAction(action);
|
|
489
|
+
}
|
|
490
|
+
function AgentActionsMenu({ children }) {
|
|
491
|
+
let {
|
|
492
|
+
buttonSize,
|
|
493
|
+
buttonVariant,
|
|
494
|
+
closeMenu,
|
|
495
|
+
menuActionsRef,
|
|
496
|
+
menuLabel,
|
|
497
|
+
menuOpen,
|
|
498
|
+
menuTriggerRef,
|
|
499
|
+
resolvedActionGroups,
|
|
500
|
+
setMenuOpenState
|
|
501
|
+
} = useAgentActions();
|
|
502
|
+
return useEffect(() => {
|
|
503
|
+
let view = menuTriggerRef.current?.ownerDocument.defaultView;
|
|
504
|
+
if (view)
|
|
505
|
+
return view.addEventListener("pagehide", closeMenu), view.addEventListener("pageshow", closeMenu), () => {
|
|
506
|
+
view.removeEventListener("pagehide", closeMenu), view.removeEventListener("pageshow", closeMenu);
|
|
507
|
+
};
|
|
508
|
+
}, [closeMenu, menuTriggerRef]), /* @__PURE__ */ jsxs(
|
|
509
|
+
Menu,
|
|
510
|
+
{
|
|
511
|
+
actionsRef: menuActionsRef,
|
|
512
|
+
modal: !1,
|
|
513
|
+
onOpenChange: setMenuOpenState,
|
|
514
|
+
open: menuOpen,
|
|
515
|
+
children: [
|
|
516
|
+
/* @__PURE__ */ jsx(
|
|
517
|
+
MenuTrigger,
|
|
518
|
+
{
|
|
519
|
+
"aria-label": menuLabel,
|
|
520
|
+
ref: menuTriggerRef,
|
|
521
|
+
className: cn(
|
|
522
|
+
buttonVariants({
|
|
523
|
+
iconOnly: !0,
|
|
524
|
+
size: buttonSize,
|
|
525
|
+
variant: buttonVariant
|
|
526
|
+
}),
|
|
527
|
+
"data-popup-open:rounded-r-button!"
|
|
528
|
+
),
|
|
529
|
+
children: /* @__PURE__ */ jsx(CaretDownIcon, { "aria-hidden": "true", className: "size-4" })
|
|
530
|
+
}
|
|
531
|
+
),
|
|
532
|
+
/* @__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: [
|
|
533
|
+
index > 0 ? /* @__PURE__ */ jsx(MenuSeparator, {}) : null,
|
|
534
|
+
/* @__PURE__ */ jsx(AgentActionsGroup, { title: group.title, children: group.actions.map((action) => /* @__PURE__ */ jsx(AgentActionsItem, { action }, action.id)) })
|
|
535
|
+
] }, group.id)) }) }) })
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
function AgentActionsRoot(props) {
|
|
541
|
+
return /* @__PURE__ */ jsx(AgentActionsProvider, { ...props });
|
|
542
|
+
}
|
|
543
|
+
var AgentActions = Object.assign(AgentActionsRoot, {
|
|
544
|
+
Feedback: AgentActionsFeedback,
|
|
545
|
+
Group: AgentActionsGroup,
|
|
546
|
+
Item: AgentActionsItem,
|
|
547
|
+
MarkdownLink: AgentActionsMarkdownLink,
|
|
548
|
+
Menu: AgentActionsMenu,
|
|
549
|
+
PrimaryAction: AgentActionsPrimaryAction,
|
|
550
|
+
Root: AgentActionsRoot,
|
|
551
|
+
Toolbar: AgentActionsToolbar
|
|
552
|
+
});
|
|
553
|
+
export {
|
|
554
|
+
AgentActions,
|
|
555
|
+
AgentActionsFeedback as Feedback,
|
|
556
|
+
AgentActionsGroup as Group,
|
|
557
|
+
AgentActionsItem as Item,
|
|
558
|
+
AgentActionsMarkdownLink as MarkdownLink,
|
|
559
|
+
AgentActionsMenu as Menu,
|
|
560
|
+
AgentActionsPrimaryAction as PrimaryAction,
|
|
561
|
+
AgentActionsRoot as Root,
|
|
562
|
+
AgentActionsToolbar as Toolbar
|
|
563
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type AnimatedIconSwapProps = Omit<ComponentPropsWithoutRef<"span">, "children"> & {
|
|
@@ -11,6 +11,6 @@ type AnimatedIconSwapProps = Omit<ComponentPropsWithoutRef<"span">, "children">
|
|
|
11
11
|
/** Square wrapper size in pixels. */
|
|
12
12
|
size: number;
|
|
13
13
|
};
|
|
14
|
-
declare function AnimatedIconSwap({ active, activeIcon, className, defaultIcon, size, style, ...props }: AnimatedIconSwapProps):
|
|
14
|
+
declare function AnimatedIconSwap({ active, activeIcon, className, defaultIcon, size, style, ...props }: AnimatedIconSwapProps): react.JSX.Element;
|
|
15
15
|
|
|
16
16
|
export { AnimatedIconSwap, type AnimatedIconSwapProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/components/ui/animated-icon-swap.tsx
|
|
2
2
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
3
|
-
import { jsx, jsxs } from "
|
|
3
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
4
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";
|
|
5
5
|
function AnimatedIconSwap({
|
|
6
6
|
active,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
declare function collectTokenNamesFromCssText(css: string): string[];
|
|
4
4
|
declare function deriveTokenGroup(name: string): string;
|
|
5
|
-
declare function ColorPalette():
|
|
5
|
+
declare function ColorPalette(): react.JSX.Element;
|
|
6
6
|
|
|
7
7
|
export { collectTokenNamesFromCssText, ColorPalette as default, deriveTokenGroup };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/modules/design-system/color-palette.tsx
|
|
4
|
-
import { Button } from "@
|
|
4
|
+
import { Button } from "@components/ui/button";
|
|
5
5
|
import {
|
|
6
6
|
Menu,
|
|
7
7
|
MenuItem,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
MenuPortal,
|
|
10
10
|
MenuPositioner,
|
|
11
11
|
MenuTrigger
|
|
12
|
-
} from "@
|
|
12
|
+
} from "@components/ui/menu";
|
|
13
13
|
import {
|
|
14
14
|
Select,
|
|
15
15
|
SelectIcon,
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
SelectPositioner,
|
|
23
23
|
SelectTrigger,
|
|
24
24
|
SelectValue
|
|
25
|
-
} from "@
|
|
25
|
+
} from "@components/ui/select";
|
|
26
26
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
27
|
-
import { Fragment, jsx, jsxs } from "
|
|
27
|
+
import { Fragment, jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
28
28
|
var DEFAULT_TOKEN_NAMES = [
|
|
29
29
|
"surface-page",
|
|
30
30
|
"surface-1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
type LogoBlockAsset = {
|
|
4
4
|
readonly outputPath: string;
|
|
@@ -16,6 +16,6 @@ type LogoBlockProps = {
|
|
|
16
16
|
maxWidth?: number;
|
|
17
17
|
siteName: string;
|
|
18
18
|
};
|
|
19
|
-
declare function LogoBlock({ className, logo, maxHeight, maxWidth, siteName, }: LogoBlockProps):
|
|
19
|
+
declare function LogoBlock({ className, logo, maxHeight, maxWidth, siteName, }: LogoBlockProps): react.JSX.Element;
|
|
20
20
|
|
|
21
21
|
export { LogoBlock, type LogoBlockAsset, type LogoBlockLogo, type LogoBlockProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/components/block/logo-block.tsx
|
|
2
2
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "
|
|
3
|
+
import { Fragment, jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
4
4
|
var DEFAULT_LOGO_MAX_HEIGHT = 24, DEFAULT_LOGO_MAX_WIDTH = 160;
|
|
5
5
|
function isValidLogoAsset(asset) {
|
|
6
6
|
return typeof asset?.outputPath == "string" && asset.outputPath.trim() !== "";
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import { S as SiteData
|
|
4
|
+
import { S as SiteData } from '../../../types-TjH1ek0X.js';
|
|
5
|
+
import { R as ResolvedNavigation } from '../../../manifest-types-CcVPH_jh.js';
|
|
5
6
|
|
|
6
7
|
declare const breadcrumbVariants: (props?: ({
|
|
7
8
|
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
8
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
10
|
type BreadcrumbVariantProps = VariantProps<typeof breadcrumbVariants>;
|
|
10
11
|
|
|
11
|
-
declare function NavBreadcrumb({ currentPath, showRoot, size, site,
|
|
12
|
+
declare function NavBreadcrumb({ currentPath, showRoot, size, site, navigation, }: {
|
|
12
13
|
currentPath?: string;
|
|
13
14
|
showRoot?: boolean;
|
|
14
15
|
size?: BreadcrumbVariantProps["size"];
|
|
15
16
|
site: SiteData;
|
|
16
|
-
|
|
17
|
-
}):
|
|
17
|
+
navigation: ResolvedNavigation;
|
|
18
|
+
}): react.JSX.Element | null;
|
|
18
19
|
|
|
19
20
|
export { NavBreadcrumb };
|