@vercel/geistdocs 1.2.1 → 1.2.3-canary.1d733b2
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/dist/assets/icons/icon-arrow-up-right-small.d.ts +8 -0
- package/dist/assets/icons/icon-arrow-up-right-small.d.ts.map +1 -0
- package/dist/assets/icons/icon-arrow-up-right-small.js +4 -0
- package/dist/assets/icons/icon-arrow-up-right.d.ts +5 -0
- package/dist/assets/icons/icon-arrow-up-right.d.ts.map +1 -0
- package/dist/assets/icons/icon-arrow-up-right.js +4 -0
- package/dist/assets/icons/icon-check.d.ts +5 -0
- package/dist/assets/icons/icon-check.d.ts.map +1 -0
- package/dist/assets/icons/icon-check.js +4 -0
- package/dist/assets/icons/icon-chevron-down-small.d.ts +8 -0
- package/dist/assets/icons/icon-chevron-down-small.d.ts.map +1 -0
- package/dist/assets/icons/icon-chevron-down-small.js +7 -0
- package/dist/assets/icons/icon-chevron-right.d.ts +5 -0
- package/dist/assets/icons/icon-chevron-right.d.ts.map +1 -0
- package/dist/assets/icons/icon-chevron-right.js +4 -0
- package/dist/assets/icons/icon-copy.d.ts +5 -0
- package/dist/assets/icons/icon-copy.d.ts.map +1 -0
- package/dist/assets/icons/icon-copy.js +4 -0
- package/dist/assets/icons/icon-file-text.d.ts +5 -0
- package/dist/assets/icons/icon-file-text.d.ts.map +1 -0
- package/dist/assets/icons/icon-file-text.js +4 -0
- package/dist/assets/icons/icon-menu-alt.d.ts +5 -0
- package/dist/assets/icons/icon-menu-alt.d.ts.map +1 -0
- package/dist/assets/icons/icon-menu-alt.js +4 -0
- package/dist/assets/icons/icon-slash-forward.d.ts +8 -0
- package/dist/assets/icons/icon-slash-forward.d.ts.map +1 -0
- package/dist/assets/icons/icon-slash-forward.js +4 -0
- package/dist/assets/icons/index.d.ts +10 -0
- package/dist/assets/icons/index.d.ts.map +1 -0
- package/dist/assets/icons/index.js +10 -0
- package/dist/assets/logos/index.d.ts +15 -0
- package/dist/assets/logos/index.d.ts.map +1 -0
- package/dist/assets/logos/index.js +15 -0
- package/dist/assets/logos/logo-ai-elements.d.ts +8 -0
- package/dist/assets/logos/logo-ai-elements.d.ts.map +1 -0
- package/dist/assets/logos/logo-ai-elements.js +8 -0
- package/dist/assets/logos/logo-ai-sdk.d.ts +8 -0
- package/dist/assets/logos/logo-ai-sdk.d.ts.map +1 -0
- package/dist/assets/logos/logo-ai-sdk.js +8 -0
- package/dist/assets/logos/logo-chat-sdk.d.ts +8 -0
- package/dist/assets/logos/logo-chat-sdk.d.ts.map +1 -0
- package/dist/assets/logos/logo-chat-sdk.js +8 -0
- package/dist/assets/logos/logo-flags-sdk.d.ts +8 -0
- package/dist/assets/logos/logo-flags-sdk.d.ts.map +1 -0
- package/dist/assets/logos/logo-flags-sdk.js +8 -0
- package/dist/assets/logos/logo-icon-vercel.d.ts +9 -0
- package/dist/assets/logos/logo-icon-vercel.d.ts.map +1 -0
- package/dist/assets/logos/logo-icon-vercel.js +8 -0
- package/dist/assets/logos/logo-nextjs.d.ts +8 -0
- package/dist/assets/logos/logo-nextjs.d.ts.map +1 -0
- package/dist/assets/logos/logo-nextjs.js +7 -0
- package/dist/assets/logos/logo-streamdown.d.ts +8 -0
- package/dist/assets/logos/logo-streamdown.d.ts.map +1 -0
- package/dist/assets/logos/logo-streamdown.js +8 -0
- package/dist/assets/logos/logo-svelte-kit.d.ts +8 -0
- package/dist/assets/logos/logo-svelte-kit.d.ts.map +1 -0
- package/dist/assets/logos/logo-svelte-kit.js +7 -0
- package/dist/assets/logos/logo-vercel-oss.d.ts +8 -0
- package/dist/assets/logos/logo-vercel-oss.d.ts.map +1 -0
- package/dist/assets/logos/logo-vercel-oss.js +7 -0
- package/dist/assets/logos/logo-workflow-sdk.d.ts +8 -0
- package/dist/assets/logos/logo-workflow-sdk.d.ts.map +1 -0
- package/dist/assets/logos/logo-workflow-sdk.js +8 -0
- package/dist/cli/index.js +3 -0
- package/dist/components/callout.d.ts +12 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +7 -0
- package/dist/components/code-block-tabs.d.ts +7 -0
- package/dist/components/code-block-tabs.d.ts.map +1 -0
- package/dist/components/code-block-tabs.js +7 -0
- package/dist/components/code-block.d.ts +14 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +45 -0
- package/dist/components/copy-prompt.d.ts +11 -0
- package/dist/components/copy-prompt.d.ts.map +1 -0
- package/dist/components/copy-prompt.js +58 -0
- package/dist/components/mermaid.d.ts +4 -0
- package/dist/components/mermaid.d.ts.map +1 -0
- package/dist/components/mermaid.js +44 -0
- package/dist/components/theme-aware-image.d.ts +12 -0
- package/dist/components/theme-aware-image.d.ts.map +1 -0
- package/dist/components/theme-aware-image.js +8 -0
- package/dist/components/video.d.ts +6 -0
- package/dist/components/video.d.ts.map +1 -0
- package/dist/components/video.js +3 -0
- package/dist/config.d.ts +117 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/controls.d.ts +15 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +52 -0
- package/dist/footer.d.ts +8 -0
- package/dist/footer.d.ts.map +1 -0
- package/dist/footer.js +6 -0
- package/dist/home-layout.d.ts +11 -0
- package/dist/home-layout.d.ts.map +1 -0
- package/dist/home-layout.js +31 -0
- package/dist/internal/chat/context.d.ts +19 -0
- package/dist/internal/chat/context.d.ts.map +1 -0
- package/dist/internal/chat/context.js +36 -0
- package/dist/internal/chat/conversation.d.ts +10 -0
- package/dist/internal/chat/conversation.d.ts.map +1 -0
- package/dist/internal/chat/conversation.js +16 -0
- package/dist/internal/chat/copy-chat.d.ts +5 -0
- package/dist/internal/chat/copy-chat.d.ts.map +1 -0
- package/dist/internal/chat/copy-chat.js +35 -0
- package/dist/internal/chat/db.d.ts +13 -0
- package/dist/internal/chat/db.d.ts.map +1 -0
- package/dist/internal/chat/db.js +19 -0
- package/dist/internal/chat/message-metadata.d.ts +8 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -0
- package/dist/internal/chat/message-metadata.js +29 -0
- package/dist/internal/chat/message.d.ts +11 -0
- package/dist/internal/chat/message.d.ts.map +1 -0
- package/dist/internal/chat/message.js +11 -0
- package/dist/internal/chat/prompt-input.d.ts +13 -0
- package/dist/internal/chat/prompt-input.d.ts.map +1 -0
- package/dist/internal/chat/prompt-input.js +39 -0
- package/dist/internal/chat/shell.d.ts +2 -0
- package/dist/internal/chat/shell.d.ts.map +1 -0
- package/dist/internal/chat/shell.js +194 -0
- package/dist/internal/chat/shimmer.d.ts +11 -0
- package/dist/internal/chat/shimmer.d.ts.map +1 -0
- package/dist/internal/chat/shimmer.js +18 -0
- package/dist/internal/chat/sources.d.ts +13 -0
- package/dist/internal/chat/sources.d.ts.map +1 -0
- package/dist/internal/chat/sources.js +9 -0
- package/dist/internal/chat/suggestion.d.ts +11 -0
- package/dist/internal/chat/suggestion.d.ts.map +1 -0
- package/dist/internal/chat/suggestion.js +12 -0
- package/dist/internal/cn.d.ts +3 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/cn.js +3 -0
- package/dist/internal/config-context.d.ts +10 -0
- package/dist/internal/config-context.d.ts.map +1 -0
- package/dist/internal/config-context.js +15 -0
- package/dist/internal/feedback-action.d.ts +14 -0
- package/dist/internal/feedback-action.d.ts.map +1 -0
- package/dist/internal/feedback-action.js +34 -0
- package/dist/internal/footer/github-button.d.ts +7 -0
- package/dist/internal/footer/github-button.d.ts.map +1 -0
- package/dist/internal/footer/github-button.js +10 -0
- package/dist/internal/footer/rss-button.d.ts +2 -0
- package/dist/internal/footer/rss-button.d.ts.map +1 -0
- package/dist/internal/footer/rss-button.js +4 -0
- package/dist/internal/i18n.d.ts +6 -0
- package/dist/internal/i18n.d.ts.map +1 -0
- package/dist/internal/i18n.js +18 -0
- package/dist/internal/languages.d.ts +7 -0
- package/dist/internal/languages.d.ts.map +1 -0
- package/dist/internal/languages.js +18 -0
- package/dist/internal/localized-link.d.ts +8 -0
- package/dist/internal/localized-link.d.ts.map +1 -0
- package/dist/internal/localized-link.js +13 -0
- package/dist/internal/navbar/desktop-menu.d.ts +10 -0
- package/dist/internal/navbar/desktop-menu.d.ts.map +1 -0
- package/dist/internal/navbar/desktop-menu.js +11 -0
- package/dist/internal/navbar/mobile-menu.d.ts +7 -0
- package/dist/internal/navbar/mobile-menu.d.ts.map +1 -0
- package/dist/internal/navbar/mobile-menu.js +44 -0
- package/dist/internal/navbar/navbar-logo.d.ts +16 -0
- package/dist/internal/navbar/navbar-logo.d.ts.map +1 -0
- package/dist/internal/navbar/navbar-logo.js +30 -0
- package/dist/internal/not-implemented.d.ts +2 -0
- package/dist/internal/not-implemented.d.ts.map +1 -0
- package/dist/internal/not-implemented.js +4 -0
- package/dist/internal/page-actions-client.d.ts +13 -0
- package/dist/internal/page-actions-client.d.ts.map +1 -0
- package/dist/internal/page-actions-client.js +171 -0
- package/dist/internal/page-actions.d.ts +18 -0
- package/dist/internal/page-actions.d.ts.map +1 -0
- package/dist/internal/page-actions.js +4 -0
- package/dist/internal/page-visibility.d.ts +18 -0
- package/dist/internal/page-visibility.d.ts.map +1 -0
- package/dist/internal/page-visibility.js +24 -0
- package/dist/internal/provider-client.d.ts +9 -0
- package/dist/internal/provider-client.d.ts.map +1 -0
- package/dist/internal/provider-client.js +24 -0
- package/dist/internal/search.d.ts +5 -0
- package/dist/internal/search.d.ts.map +1 -0
- package/dist/internal/search.js +14 -0
- package/dist/internal/sidebar.d.ts +9 -0
- package/dist/internal/sidebar.d.ts.map +1 -0
- package/dist/internal/sidebar.js +38 -0
- package/dist/internal/table-of-contents.d.ts +9 -0
- package/dist/internal/table-of-contents.d.ts.map +1 -0
- package/dist/internal/table-of-contents.js +5 -0
- package/dist/internal/ui/button-group.d.ts +13 -0
- package/dist/internal/ui/button-group.d.ts.map +1 -0
- package/dist/internal/ui/button-group.js +26 -0
- package/dist/internal/ui/button.d.ts +12 -0
- package/dist/internal/ui/button.d.ts.map +1 -0
- package/dist/internal/ui/button.js +33 -0
- package/dist/internal/ui/card.d.ts +6 -0
- package/dist/internal/ui/card.d.ts.map +1 -0
- package/dist/internal/ui/card.js +14 -0
- package/dist/internal/ui/collapsible.d.ts +6 -0
- package/dist/internal/ui/collapsible.d.ts.map +1 -0
- package/dist/internal/ui/collapsible.js +12 -0
- package/dist/internal/ui/drawer.d.ts +6 -0
- package/dist/internal/ui/drawer.d.ts.map +1 -0
- package/dist/internal/ui/drawer.js +13 -0
- package/dist/internal/ui/dropdown-menu.d.ts +22 -0
- package/dist/internal/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/internal/ui/dropdown-menu.js +41 -0
- package/dist/internal/ui/input-group.d.ts +15 -0
- package/dist/internal/ui/input-group.d.ts.map +1 -0
- package/dist/internal/ui/input-group.js +44 -0
- package/dist/internal/ui/input.d.ts +3 -0
- package/dist/internal/ui/input.d.ts.map +1 -0
- package/dist/internal/ui/input.js +5 -0
- package/dist/internal/ui/kbd.d.ts +4 -0
- package/dist/internal/ui/kbd.d.ts.map +1 -0
- package/dist/internal/ui/kbd.js +8 -0
- package/dist/internal/ui/navigation-menu.d.ts +17 -0
- package/dist/internal/ui/navigation-menu.d.ts.map +1 -0
- package/dist/internal/ui/navigation-menu.js +38 -0
- package/dist/internal/ui/popover.d.ts +6 -0
- package/dist/internal/ui/popover.d.ts.map +1 -0
- package/dist/internal/ui/popover.js +13 -0
- package/dist/internal/ui/scroll-area.d.ts +5 -0
- package/dist/internal/ui/scroll-area.d.ts.map +1 -0
- package/dist/internal/ui/scroll-area.js +12 -0
- package/dist/internal/ui/separator.d.ts +4 -0
- package/dist/internal/ui/separator.d.ts.map +1 -0
- package/dist/internal/ui/separator.js +7 -0
- package/dist/internal/ui/sheet.d.ts +10 -0
- package/dist/internal/ui/sheet.d.ts.map +1 -0
- package/dist/internal/ui/sheet.js +24 -0
- package/dist/internal/ui/sonner.d.ts +3 -0
- package/dist/internal/ui/sonner.d.ts.map +1 -0
- package/dist/internal/ui/sonner.js +20 -0
- package/dist/internal/ui/spinner.d.ts +3 -0
- package/dist/internal/ui/spinner.d.ts.map +1 -0
- package/dist/internal/ui/spinner.js +6 -0
- package/dist/internal/ui/textarea.d.ts +3 -0
- package/dist/internal/ui/textarea.d.ts.map +1 -0
- package/dist/internal/ui/textarea.js +5 -0
- package/dist/internal/ui/tooltip.d.ts +7 -0
- package/dist/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/internal/ui/tooltip.js +16 -0
- package/dist/internal/use-mobile.d.ts +2 -0
- package/dist/internal/use-mobile.d.ts.map +1 -0
- package/dist/internal/use-mobile.js +16 -0
- package/dist/layout.d.ts +14 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +31 -0
- package/dist/mdx.d.ts +67 -0
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +35 -0
- package/dist/mobile-docs-bar.d.ts +7 -0
- package/dist/mobile-docs-bar.d.ts.map +1 -0
- package/dist/mobile-docs-bar.js +13 -0
- package/dist/navbar.d.ts +7 -0
- package/dist/navbar.d.ts.map +1 -0
- package/dist/navbar.js +10 -0
- package/dist/pages/docs.d.ts +83 -0
- package/dist/pages/docs.d.ts.map +1 -0
- package/dist/pages/docs.js +98 -0
- package/dist/proxy.d.ts +37 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +189 -0
- package/dist/routes/agents.d.ts +21 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +201 -0
- package/dist/routes/chat.d.ts +14 -0
- package/dist/routes/chat.d.ts.map +1 -0
- package/dist/routes/chat.js +251 -0
- package/dist/routes/llms.d.ts +52 -0
- package/dist/routes/llms.d.ts.map +1 -0
- package/dist/routes/llms.js +110 -0
- package/dist/routes/search.d.ts +13 -0
- package/dist/routes/search.d.ts.map +1 -0
- package/dist/routes/search.js +81 -0
- package/dist/routes/sitemap.d.ts +47 -0
- package/dist/routes/sitemap.d.ts.map +1 -0
- package/dist/routes/sitemap.js +176 -0
- package/dist/shiki-theme.d.ts +20 -0
- package/dist/shiki-theme.d.ts.map +1 -0
- package/dist/shiki-theme.js +110 -0
- package/dist/sidebar.d.ts +11 -0
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +16 -0
- package/dist/source-config.d.ts +68 -0
- package/dist/source-config.d.ts.map +1 -0
- package/dist/source-config.js +161 -0
- package/dist/source.d.ts +181 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +142 -0
- package/dist/versions.d.ts +45 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +79 -0
- package/package.json +186 -9
- package/source-config.js +174 -0
- package/styles.css +556 -0
- package/template/AGENTS.md +82 -0
- package/template/_gitignore +29 -0
- package/template/app/[lang]/(home)/components/centered-section.tsx +24 -0
- package/template/app/[lang]/(home)/components/cta.tsx +19 -0
- package/template/app/[lang]/(home)/components/hero.tsx +27 -0
- package/template/app/[lang]/(home)/components/one-two-section.tsx +23 -0
- package/template/app/[lang]/(home)/components/templates.tsx +48 -0
- package/template/app/[lang]/(home)/components/text-grid-section.tsx +20 -0
- package/template/app/[lang]/(home)/layout.tsx +15 -0
- package/template/app/[lang]/(home)/page.tsx +126 -0
- package/template/app/[lang]/agents.md/route.ts +6 -0
- package/template/app/[lang]/docs/[[...slug]]/page.tsx +22 -0
- package/template/app/[lang]/docs/layout.tsx +14 -0
- package/template/app/[lang]/layout.tsx +29 -0
- package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +7 -0
- package/template/app/[lang]/llms.txt/route.ts +6 -0
- package/template/app/[lang]/og/[...slug]/background.png +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-regular.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/route.tsx +95 -0
- package/template/app/[lang]/rss.xml/route.ts +52 -0
- package/template/app/[lang]/sitemap.md/route.ts +9 -0
- package/template/app/api/chat/route.ts +8 -0
- package/template/app/api/search/route.ts +5 -0
- package/template/app/favicon.ico +0 -0
- package/template/app/global.css +2 -0
- package/template/app/robots.ts +14 -0
- package/template/app/sitemap.ts +36 -0
- package/template/app/styles/geistdocs.css +595 -0
- package/template/components/geistdocs/docs-layout.tsx +20 -0
- package/template/components/geistdocs/mdx-components.tsx +5 -0
- package/template/components/geistdocs/provider.tsx +31 -0
- package/template/components/ui/badge.tsx +46 -0
- package/template/components/ui/button.tsx +60 -0
- package/template/components/ui/command-prompt.tsx +488 -0
- package/template/components.json +22 -0
- package/template/content/docs/agent-readiness.mdx +103 -0
- package/template/content/docs/ask-ai.cn.mdx +85 -0
- package/template/content/docs/ask-ai.mdx +89 -0
- package/template/content/docs/configuration.cn.mdx +155 -0
- package/template/content/docs/configuration.mdx +275 -0
- package/template/content/docs/deployment.cn.mdx +34 -0
- package/template/content/docs/deployment.mdx +40 -0
- package/template/content/docs/edit-on-github.cn.mdx +47 -0
- package/template/content/docs/edit-on-github.mdx +51 -0
- package/template/content/docs/env.cn.mdx +25 -0
- package/template/content/docs/env.mdx +29 -0
- package/template/content/docs/feedback.cn.mdx +85 -0
- package/template/content/docs/feedback.mdx +89 -0
- package/template/content/docs/getting-started.cn.mdx +86 -0
- package/template/content/docs/getting-started.mdx +108 -0
- package/template/content/docs/index.cn.mdx +57 -0
- package/template/content/docs/index.mdx +95 -0
- package/template/content/docs/internationalization.cn.mdx +111 -0
- package/template/content/docs/internationalization.mdx +122 -0
- package/template/content/docs/llms-txt.cn.mdx +72 -0
- package/template/content/docs/llms-txt.mdx +86 -0
- package/template/content/docs/md.cn.mdx +65 -0
- package/template/content/docs/md.mdx +82 -0
- package/template/content/docs/meta.json +25 -0
- package/template/content/docs/migration.mdx +321 -0
- package/template/content/docs/open-in-chat.cn.mdx +78 -0
- package/template/content/docs/open-in-chat.mdx +80 -0
- package/template/content/docs/provider.cn.mdx +70 -0
- package/template/content/docs/provider.mdx +74 -0
- package/template/content/docs/proxy.cn.mdx +96 -0
- package/template/content/docs/proxy.mdx +178 -0
- package/template/content/docs/rss.cn.mdx +104 -0
- package/template/content/docs/rss.mdx +108 -0
- package/template/content/docs/syntax.cn.mdx +416 -0
- package/template/content/docs/syntax.mdx +411 -0
- package/template/content/docs/theme-aware-image.mdx +57 -0
- package/template/content/docs/versioned-docs.cn.mdx +117 -0
- package/template/content/docs/versioned-docs.mdx +228 -0
- package/template/geistdocs.tsx +77 -0
- package/template/lib/geistdocs/config.tsx +30 -0
- package/template/lib/geistdocs/fonts.ts +18 -0
- package/template/lib/geistdocs/i18n.ts +13 -0
- package/template/lib/geistdocs/md-tracking.ts +56 -0
- package/template/lib/geistdocs/source.ts +12 -0
- package/template/lib/utils.ts +6 -0
- package/template/next.config.ts +22 -0
- package/template/package.json +63 -0
- package/template/postcss.config.mjs +5 -0
- package/template/proxy.ts +17 -0
- package/template/source.config.ts +23 -0
- package/template/tsconfig.json +37 -0
- package/dist/index.js +0 -2
- /package/dist/{index.d.ts → cli/index.d.ts} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot as SlotPrimitive } from "radix-ui"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-gray-600 focus-visible:ring-gray-600/50 focus-visible:ring-[3px] aria-invalid:ring-red-800/20 dark:aria-invalid:ring-red-800/40 aria-invalid:border-red-800",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-gray-1000 text-background-100 hover:bg-gray-1000/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-red-800 text-white hover:bg-red-800/90 focus-visible:ring-red-800/20 dark:focus-visible:ring-red-800/40 dark:bg-red-800/60",
|
|
15
|
+
outline:
|
|
16
|
+
"border bg-background-100 shadow-xs hover:bg-gray-100 hover:text-gray-1000 dark:bg-gray-alpha-400/30 dark:border-gray-alpha-400 dark:hover:bg-gray-alpha-400/50",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-gray-100 text-gray-1000 hover:bg-gray-100/80",
|
|
19
|
+
ghost:
|
|
20
|
+
"hover:bg-gray-100 hover:text-gray-1000 dark:hover:bg-gray-100/50",
|
|
21
|
+
link: "text-gray-1000 underline-offset-4 hover:underline",
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
"icon-sm": "size-8",
|
|
29
|
+
"icon-lg": "size-10",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
function Button({
|
|
40
|
+
className,
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
asChild = false,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"button"> &
|
|
46
|
+
VariantProps<typeof buttonVariants> & {
|
|
47
|
+
asChild?: boolean
|
|
48
|
+
}) {
|
|
49
|
+
const Comp = asChild ? SlotPrimitive.Slot : "button"
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Comp
|
|
53
|
+
data-slot="button"
|
|
54
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
4
|
+
import {
|
|
5
|
+
Children,
|
|
6
|
+
type ComponentPropsWithoutRef,
|
|
7
|
+
createContext,
|
|
8
|
+
isValidElement,
|
|
9
|
+
type JSX,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
useContext,
|
|
12
|
+
useEffect,
|
|
13
|
+
useLayoutEffect,
|
|
14
|
+
useRef,
|
|
15
|
+
useState,
|
|
16
|
+
} from "react";
|
|
17
|
+
import { IconCheck } from "@vercel/geistdocs/assets/icons/icon-check";
|
|
18
|
+
import { IconCopy } from "@vercel/geistdocs/assets/icons/icon-copy";
|
|
19
|
+
import { cn } from "@/lib/utils";
|
|
20
|
+
|
|
21
|
+
type CommandPromptContextValue = {
|
|
22
|
+
value: string;
|
|
23
|
+
setValue: (value: string) => void;
|
|
24
|
+
copied: boolean;
|
|
25
|
+
copyActiveValue: () => void;
|
|
26
|
+
activeCopyValue: string;
|
|
27
|
+
setActiveCopyValue: (value: string) => void;
|
|
28
|
+
commandWidth?: number;
|
|
29
|
+
setCommandWidth: (value: number | undefined) => void;
|
|
30
|
+
isOverflowing: boolean;
|
|
31
|
+
setIsOverflowing: (value: boolean) => void;
|
|
32
|
+
canShowGradient: boolean;
|
|
33
|
+
setCanShowGradient: (value: boolean) => void;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const CommandPromptContext = createContext<CommandPromptContextValue | null>(
|
|
37
|
+
null
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
function useCommandPromptContext(component: string) {
|
|
41
|
+
const context = useContext(CommandPromptContext);
|
|
42
|
+
|
|
43
|
+
if (!context) {
|
|
44
|
+
throw new Error(`${component} must be used within CommandPrompt.Root`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type CommandPromptRootProps = Omit<
|
|
51
|
+
ComponentPropsWithoutRef<"div">,
|
|
52
|
+
"onChange"
|
|
53
|
+
> & {
|
|
54
|
+
value?: string;
|
|
55
|
+
defaultValue?: string;
|
|
56
|
+
onValueChange?: (value: string) => void;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function CommandPromptRoot({
|
|
60
|
+
value: valueProp,
|
|
61
|
+
defaultValue,
|
|
62
|
+
onValueChange,
|
|
63
|
+
className,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}: CommandPromptRootProps): JSX.Element {
|
|
67
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
68
|
+
defaultValue ?? ""
|
|
69
|
+
);
|
|
70
|
+
const [copied, setCopied] = useState(false);
|
|
71
|
+
const [activeCopyValue, setActiveCopyValue] = useState("");
|
|
72
|
+
const [commandWidth, setCommandWidth] = useState<number>();
|
|
73
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
74
|
+
const [canShowGradient, setCanShowGradient] = useState(true);
|
|
75
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout>>(null);
|
|
76
|
+
const value = valueProp ?? uncontrolledValue;
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
return () => {
|
|
80
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
function resetCopiedState() {
|
|
85
|
+
setCopied(false);
|
|
86
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function setValue(nextValue: string) {
|
|
90
|
+
if (valueProp === undefined) {
|
|
91
|
+
setUncontrolledValue(nextValue);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
resetCopiedState();
|
|
95
|
+
onValueChange?.(nextValue);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function copyActiveValue() {
|
|
99
|
+
if (!activeCopyValue) return;
|
|
100
|
+
|
|
101
|
+
void navigator.clipboard.writeText(activeCopyValue);
|
|
102
|
+
setCopied(true);
|
|
103
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
104
|
+
timeoutRef.current = setTimeout(() => setCopied(false), 1000);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<CommandPromptContext.Provider
|
|
109
|
+
value={{
|
|
110
|
+
value,
|
|
111
|
+
setValue,
|
|
112
|
+
copied,
|
|
113
|
+
copyActiveValue,
|
|
114
|
+
activeCopyValue,
|
|
115
|
+
setActiveCopyValue,
|
|
116
|
+
commandWidth,
|
|
117
|
+
setCommandWidth,
|
|
118
|
+
isOverflowing,
|
|
119
|
+
setIsOverflowing,
|
|
120
|
+
canShowGradient,
|
|
121
|
+
setCanShowGradient,
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
className={cn("w-full flex items-center flex-col gap-2", className)}
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{children}
|
|
129
|
+
</div>
|
|
130
|
+
</CommandPromptContext.Provider>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function CommandPromptList({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: ComponentPropsWithoutRef<"div">): JSX.Element {
|
|
138
|
+
return <div className={cn("flex items-center", className)} {...props} />;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type CommandPromptTriggerProps = ComponentPropsWithoutRef<"button"> & {
|
|
142
|
+
value: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export function CommandPromptTrigger({
|
|
146
|
+
value,
|
|
147
|
+
className,
|
|
148
|
+
onClick,
|
|
149
|
+
children,
|
|
150
|
+
...props
|
|
151
|
+
}: CommandPromptTriggerProps): JSX.Element {
|
|
152
|
+
const context = useCommandPromptContext("CommandPrompt.Trigger");
|
|
153
|
+
const active = context.value === value;
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<button
|
|
157
|
+
aria-pressed={active}
|
|
158
|
+
className={cn(
|
|
159
|
+
"cursor-pointer text-gray-900 hover:text-gray-1000 px-3 py-2",
|
|
160
|
+
"text-label-13! font-medium! touch-manipulation border-none bg-transparent rounded-sm",
|
|
161
|
+
"outline outline-2 outline-offset-2 outline-transparent focus-visible:outline-[var(--ds-focus-color)]",
|
|
162
|
+
"text-gray-900 data-[active]:text-gray-1000 data-[active]:font-medium",
|
|
163
|
+
"flex gap-1.5 items-center whitespace-nowrap",
|
|
164
|
+
className
|
|
165
|
+
)}
|
|
166
|
+
data-active={active ? "" : undefined}
|
|
167
|
+
onClick={(event) => {
|
|
168
|
+
onClick?.(event);
|
|
169
|
+
if (event.defaultPrevented) return;
|
|
170
|
+
context.setValue(value);
|
|
171
|
+
}}
|
|
172
|
+
type="button"
|
|
173
|
+
{...props}
|
|
174
|
+
>
|
|
175
|
+
{children}
|
|
176
|
+
</button>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function CommandPromptTriggerDivider({
|
|
181
|
+
className,
|
|
182
|
+
...props
|
|
183
|
+
}: ComponentPropsWithoutRef<"div">): JSX.Element {
|
|
184
|
+
return (
|
|
185
|
+
<div
|
|
186
|
+
aria-hidden
|
|
187
|
+
className={cn("w-px h-3 bg-gray-400", className)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function CommandPromptSurface({
|
|
194
|
+
className,
|
|
195
|
+
onClick,
|
|
196
|
+
children,
|
|
197
|
+
}: {
|
|
198
|
+
className?: string;
|
|
199
|
+
children: ReactNode;
|
|
200
|
+
onClick?: ComponentPropsWithoutRef<"div">["onClick"];
|
|
201
|
+
}): JSX.Element {
|
|
202
|
+
const context = useCommandPromptContext("CommandPrompt.Surface");
|
|
203
|
+
const shouldReduceMotion = useReducedMotion();
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<motion.div
|
|
207
|
+
className={cn(
|
|
208
|
+
"relative flex items-center group gap-1 material-small transition-colors pl-5 py-2 pr-3 max-w-[calc(100vw-48px)] rounded-full",
|
|
209
|
+
className
|
|
210
|
+
)}
|
|
211
|
+
layout
|
|
212
|
+
onClick={(event) => {
|
|
213
|
+
onClick?.(event);
|
|
214
|
+
if (event.defaultPrevented) return;
|
|
215
|
+
if (window.getSelection()?.toString()) return;
|
|
216
|
+
context.copyActiveValue();
|
|
217
|
+
}}
|
|
218
|
+
transition={
|
|
219
|
+
shouldReduceMotion
|
|
220
|
+
? { duration: 0 }
|
|
221
|
+
: { type: "spring", bounce: 0, duration: 0.4 }
|
|
222
|
+
}
|
|
223
|
+
>
|
|
224
|
+
{children}
|
|
225
|
+
</motion.div>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function CommandPromptPrefix({
|
|
230
|
+
className,
|
|
231
|
+
...props
|
|
232
|
+
}: ComponentPropsWithoutRef<"span">): JSX.Element {
|
|
233
|
+
return (
|
|
234
|
+
<span
|
|
235
|
+
className={cn("block text-label-16-mono! text-gray-500 pr-1", className)}
|
|
236
|
+
{...props}
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
type CommandPromptContentProps = {
|
|
242
|
+
value: string;
|
|
243
|
+
copyValue?: string;
|
|
244
|
+
className?: string;
|
|
245
|
+
children: ReactNode;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export function CommandPromptViewport({
|
|
249
|
+
className,
|
|
250
|
+
children,
|
|
251
|
+
}: {
|
|
252
|
+
className?: string;
|
|
253
|
+
children: ReactNode;
|
|
254
|
+
}): JSX.Element {
|
|
255
|
+
const context = useCommandPromptContext("CommandPrompt.Viewport");
|
|
256
|
+
const shouldReduceMotion = useReducedMotion();
|
|
257
|
+
const {
|
|
258
|
+
commandWidth,
|
|
259
|
+
canShowGradient,
|
|
260
|
+
isOverflowing,
|
|
261
|
+
setActiveCopyValue,
|
|
262
|
+
setCanShowGradient,
|
|
263
|
+
setCommandWidth,
|
|
264
|
+
setIsOverflowing,
|
|
265
|
+
} = context;
|
|
266
|
+
const measureRef = useRef<HTMLSpanElement>(null);
|
|
267
|
+
const scrollObserverCleanup = useRef<(() => void) | null>(null);
|
|
268
|
+
const items = Children.toArray(children)
|
|
269
|
+
.filter((child): child is React.ReactElement<CommandPromptContentProps> =>
|
|
270
|
+
isValidElement<CommandPromptContentProps>(child)
|
|
271
|
+
)
|
|
272
|
+
.map((child) => child.props);
|
|
273
|
+
const activeItem = items.find((item) => item.value === context.value);
|
|
274
|
+
const command = activeItem?.children ?? null;
|
|
275
|
+
const fallbackCopyValue =
|
|
276
|
+
typeof command === "string" || typeof command === "number"
|
|
277
|
+
? String(command)
|
|
278
|
+
: Children.toArray(command)
|
|
279
|
+
.filter(
|
|
280
|
+
(child): child is string | number =>
|
|
281
|
+
typeof child === "string" || typeof child === "number"
|
|
282
|
+
)
|
|
283
|
+
.join("");
|
|
284
|
+
const copyValue = activeItem?.copyValue ?? fallbackCopyValue;
|
|
285
|
+
|
|
286
|
+
useLayoutEffect(() => {
|
|
287
|
+
setIsOverflowing(false);
|
|
288
|
+
setCanShowGradient(Boolean(shouldReduceMotion));
|
|
289
|
+
}, [copyValue, setCanShowGradient, setIsOverflowing, shouldReduceMotion]);
|
|
290
|
+
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
setActiveCopyValue(copyValue);
|
|
293
|
+
|
|
294
|
+
return () => {
|
|
295
|
+
setIsOverflowing(false);
|
|
296
|
+
scrollObserverCleanup.current?.();
|
|
297
|
+
scrollObserverCleanup.current = null;
|
|
298
|
+
};
|
|
299
|
+
}, [copyValue, setActiveCopyValue, setIsOverflowing]);
|
|
300
|
+
|
|
301
|
+
useLayoutEffect(() => {
|
|
302
|
+
if (!measureRef.current) return;
|
|
303
|
+
|
|
304
|
+
setCommandWidth(measureRef.current.getBoundingClientRect().width);
|
|
305
|
+
}, [command, copyValue, setCommandWidth]);
|
|
306
|
+
|
|
307
|
+
return (
|
|
308
|
+
<motion.span
|
|
309
|
+
animate={
|
|
310
|
+
commandWidth === undefined
|
|
311
|
+
? undefined
|
|
312
|
+
: { width: shouldReduceMotion ? "auto" : commandWidth }
|
|
313
|
+
}
|
|
314
|
+
className={cn(
|
|
315
|
+
"relative block min-w-0 overflow-hidden text-label-14-mono! text-gray-1000",
|
|
316
|
+
className
|
|
317
|
+
)}
|
|
318
|
+
initial={false}
|
|
319
|
+
onAnimationComplete={() => {
|
|
320
|
+
setCanShowGradient(true);
|
|
321
|
+
}}
|
|
322
|
+
transition={
|
|
323
|
+
shouldReduceMotion
|
|
324
|
+
? { duration: 0 }
|
|
325
|
+
: { type: "spring", bounce: 0, duration: 0.4 }
|
|
326
|
+
}
|
|
327
|
+
>
|
|
328
|
+
<span
|
|
329
|
+
aria-hidden
|
|
330
|
+
className="pointer-events-none invisible absolute whitespace-nowrap"
|
|
331
|
+
ref={measureRef}
|
|
332
|
+
>
|
|
333
|
+
{command}
|
|
334
|
+
</span>
|
|
335
|
+
<AnimatePresence initial={false} mode="wait">
|
|
336
|
+
{Children.toArray(children).map((child) => {
|
|
337
|
+
if (!isValidElement<CommandPromptContentProps>(child)) return null;
|
|
338
|
+
if (child.props.value !== context.value) return null;
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
<motion.span
|
|
342
|
+
animate={{ opacity: 1, filter: "blur(0px)" }}
|
|
343
|
+
className={cn(
|
|
344
|
+
"block whitespace-nowrap min-w-0 py-2",
|
|
345
|
+
canShowGradient && isOverflowing
|
|
346
|
+
? "overflow-x-auto"
|
|
347
|
+
: "overflow-x-hidden",
|
|
348
|
+
child.props.className
|
|
349
|
+
)}
|
|
350
|
+
exit={{ opacity: 0, filter: "blur(1px)" }}
|
|
351
|
+
initial={{ opacity: 0, filter: "blur(1px)" }}
|
|
352
|
+
key={copyValue}
|
|
353
|
+
ref={(element) => {
|
|
354
|
+
scrollObserverCleanup.current?.();
|
|
355
|
+
scrollObserverCleanup.current = null;
|
|
356
|
+
if (!element) return;
|
|
357
|
+
|
|
358
|
+
const checkOverflow = () => {
|
|
359
|
+
setIsOverflowing(element.scrollWidth > element.clientWidth);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
checkOverflow();
|
|
363
|
+
const observer = new ResizeObserver(checkOverflow);
|
|
364
|
+
observer.observe(element);
|
|
365
|
+
scrollObserverCleanup.current = () => observer.disconnect();
|
|
366
|
+
}}
|
|
367
|
+
transition={
|
|
368
|
+
shouldReduceMotion ? { duration: 0 } : { duration: 0.15 }
|
|
369
|
+
}
|
|
370
|
+
>
|
|
371
|
+
{child.props.children}
|
|
372
|
+
</motion.span>
|
|
373
|
+
);
|
|
374
|
+
})}
|
|
375
|
+
</AnimatePresence>
|
|
376
|
+
<AnimatePresence>
|
|
377
|
+
{canShowGradient && isOverflowing && (
|
|
378
|
+
<motion.span
|
|
379
|
+
animate={{ opacity: 1 }}
|
|
380
|
+
aria-hidden
|
|
381
|
+
className="pointer-events-none block z-10 absolute right-0 bg-gradient-to-r from-transparent to-background-100 top-0 bottom-0 w-4"
|
|
382
|
+
exit={{ opacity: 0 }}
|
|
383
|
+
initial={{ opacity: 0 }}
|
|
384
|
+
transition={
|
|
385
|
+
shouldReduceMotion ? { duration: 0 } : { duration: 0.2 }
|
|
386
|
+
}
|
|
387
|
+
/>
|
|
388
|
+
)}
|
|
389
|
+
</AnimatePresence>
|
|
390
|
+
</motion.span>
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export function CommandPromptContent(
|
|
395
|
+
_props: CommandPromptContentProps
|
|
396
|
+
): JSX.Element | null {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export function CommandPromptCopy({
|
|
401
|
+
className,
|
|
402
|
+
onClick,
|
|
403
|
+
...props
|
|
404
|
+
}: ComponentPropsWithoutRef<"button">): JSX.Element {
|
|
405
|
+
const context = useCommandPromptContext("CommandPrompt.Copy");
|
|
406
|
+
const shouldReduceMotion = useReducedMotion();
|
|
407
|
+
|
|
408
|
+
return (
|
|
409
|
+
<button
|
|
410
|
+
aria-label={context.copied ? "Copied" : "Copy command"}
|
|
411
|
+
className={cn(
|
|
412
|
+
"text-gray-1000 rounded-full border-none bg-transparent shrink-0 cursor-pointer relative size-8 flex items-center justify-center translate-x-0.5",
|
|
413
|
+
"group-hover:bg-gray-alpha-100 hover:!bg-gray-alpha-200 transition-colors touch-manipulation",
|
|
414
|
+
"outline-2 outline-offset-2 outline-transparent focus-visible:outline-[var(--ds-focus-color)]",
|
|
415
|
+
className
|
|
416
|
+
)}
|
|
417
|
+
onClick={(event) => {
|
|
418
|
+
onClick?.(event);
|
|
419
|
+
if (event.defaultPrevented) return;
|
|
420
|
+
event.stopPropagation();
|
|
421
|
+
context.copyActiveValue();
|
|
422
|
+
}}
|
|
423
|
+
type="button"
|
|
424
|
+
{...props}
|
|
425
|
+
>
|
|
426
|
+
<AnimatePresence initial={false}>
|
|
427
|
+
{!context.copied && (
|
|
428
|
+
<motion.span
|
|
429
|
+
animate={{
|
|
430
|
+
opacity: 1,
|
|
431
|
+
transform: "scale(1)",
|
|
432
|
+
filter: "blur(0px)",
|
|
433
|
+
}}
|
|
434
|
+
className="absolute inset-0 flex items-center justify-center"
|
|
435
|
+
exit={{
|
|
436
|
+
opacity: 0,
|
|
437
|
+
transform: "scale(0.5)",
|
|
438
|
+
filter: "blur(1px)",
|
|
439
|
+
}}
|
|
440
|
+
initial={{
|
|
441
|
+
opacity: 0,
|
|
442
|
+
transform: "scale(0.5)",
|
|
443
|
+
filter: "blur(1px)",
|
|
444
|
+
}}
|
|
445
|
+
key="copy"
|
|
446
|
+
transition={
|
|
447
|
+
shouldReduceMotion
|
|
448
|
+
? { duration: 0 }
|
|
449
|
+
: { duration: 0.2, ease: [0.23, 1, 0.32, 1] }
|
|
450
|
+
}
|
|
451
|
+
>
|
|
452
|
+
<IconCopy className="block" size={16} />
|
|
453
|
+
</motion.span>
|
|
454
|
+
)}
|
|
455
|
+
</AnimatePresence>
|
|
456
|
+
<AnimatePresence initial={false}>
|
|
457
|
+
{context.copied && (
|
|
458
|
+
<motion.span
|
|
459
|
+
animate={{
|
|
460
|
+
opacity: 1,
|
|
461
|
+
transform: "scale(1)",
|
|
462
|
+
filter: "blur(0px)",
|
|
463
|
+
}}
|
|
464
|
+
className="absolute inset-0 flex items-center justify-center"
|
|
465
|
+
exit={{
|
|
466
|
+
opacity: 0,
|
|
467
|
+
transform: "scale(0.5)",
|
|
468
|
+
filter: "blur(1px)",
|
|
469
|
+
}}
|
|
470
|
+
initial={{
|
|
471
|
+
opacity: 0,
|
|
472
|
+
transform: "scale(0.5)",
|
|
473
|
+
filter: "blur(1px)",
|
|
474
|
+
}}
|
|
475
|
+
key="check"
|
|
476
|
+
transition={
|
|
477
|
+
shouldReduceMotion
|
|
478
|
+
? { duration: 0 }
|
|
479
|
+
: { duration: 0.2, ease: [0.23, 1, 0.32, 1] }
|
|
480
|
+
}
|
|
481
|
+
>
|
|
482
|
+
<IconCheck className="block" size={16} />
|
|
483
|
+
</motion.span>
|
|
484
|
+
)}
|
|
485
|
+
</AnimatePresence>
|
|
486
|
+
</button>
|
|
487
|
+
);
|
|
488
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "app/global.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Agent readiness
|
|
3
|
+
description: Expose a concise agents.md file that helps AI agents discover and use your docs site
|
|
4
|
+
type: guide
|
|
5
|
+
summary: Generate /agents.md from Geistdocs config so agents can find docs, Markdown surfaces, API specs, and MCP endpoints.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/llms-txt
|
|
8
|
+
- /docs/md
|
|
9
|
+
- /docs/proxy
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Geistdocs can generate `/agents.md`, a concise Markdown file that tells AI agents what your product is, where your docs live, and which machine-readable integration surfaces are available.
|
|
13
|
+
|
|
14
|
+
<CopyPrompt text="Review this Geistdocs site's /agents.md file. Check whether it lists the product description, documentation links, llms.txt, sitemap.md, OpenAPI specs, and MCP servers accurately.">
|
|
15
|
+
Review this Geistdocs site's `/agents.md` file. Check whether it lists the product description, documentation links, `llms.txt`, `sitemap.md`, OpenAPI specs, and MCP servers accurately.
|
|
16
|
+
</CopyPrompt>
|
|
17
|
+
|
|
18
|
+
## What it provides
|
|
19
|
+
|
|
20
|
+
The generated `/agents.md` file gives agents a stable starting point before they crawl the rest of your documentation.
|
|
21
|
+
|
|
22
|
+
It can include:
|
|
23
|
+
|
|
24
|
+
- Product name, description, category, audience, and use cases
|
|
25
|
+
- Human-readable docs entry points
|
|
26
|
+
- `/llms.txt` for full documentation context
|
|
27
|
+
- `/sitemap.md` for semantic navigation
|
|
28
|
+
- Page-level Markdown guidance for `.md` and `.mdx` URLs
|
|
29
|
+
- OpenAPI, authentication, scopes, rate limit, and error docs when configured
|
|
30
|
+
- MCP manifests and server URLs when configured
|
|
31
|
+
- Additional links and agent instructions
|
|
32
|
+
|
|
33
|
+
## Add the route
|
|
34
|
+
|
|
35
|
+
Generated projects include a thin App Router adapter:
|
|
36
|
+
|
|
37
|
+
```ts title="app/[lang]/agents.md/route.ts"
|
|
38
|
+
import { createAgentsRoute } from "@vercel/geistdocs/routes/agents";
|
|
39
|
+
import { config } from "@/lib/geistdocs/config";
|
|
40
|
+
|
|
41
|
+
export const { GET, generateStaticParams, revalidate } = createAgentsRoute({
|
|
42
|
+
config,
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Because the route is under `[lang]`, the Geistdocs proxy can serve `/agents.md` through the default language route.
|
|
47
|
+
|
|
48
|
+
## Configure agent metadata
|
|
49
|
+
|
|
50
|
+
Add agent-readiness metadata in `geistdocs.tsx`, then pass it through `defineConfig` in `lib/geistdocs/config.tsx`.
|
|
51
|
+
|
|
52
|
+
```tsx title="geistdocs.tsx"
|
|
53
|
+
import type { GeistdocsAgentReadinessConfig } from "@vercel/geistdocs/config";
|
|
54
|
+
|
|
55
|
+
export const agent = {
|
|
56
|
+
product: {
|
|
57
|
+
name: "My Product",
|
|
58
|
+
description: "My Product helps teams build and deploy applications.",
|
|
59
|
+
category: "Developer tools",
|
|
60
|
+
audience: ["Frontend developers", "Platform teams"],
|
|
61
|
+
useCases: ["Deploy applications", "Manage domains", "Inspect logs"],
|
|
62
|
+
},
|
|
63
|
+
api: {
|
|
64
|
+
openApiUrl: "https://api.example.com/openapi.json",
|
|
65
|
+
authDocsUrl: "/docs/authentication",
|
|
66
|
+
scopesDocsUrl: "/docs/scopes",
|
|
67
|
+
rateLimitsUrl: "/docs/rate-limits",
|
|
68
|
+
errorsUrl: "/docs/errors",
|
|
69
|
+
},
|
|
70
|
+
mcp: {
|
|
71
|
+
manifestUrl: "/.well-known/mcp.json",
|
|
72
|
+
servers: [
|
|
73
|
+
{
|
|
74
|
+
name: "My Product MCP",
|
|
75
|
+
url: "https://example.com/api/mcp",
|
|
76
|
+
description: "Use product tools through MCP.",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
links: [
|
|
81
|
+
{
|
|
82
|
+
label: "Support",
|
|
83
|
+
href: "https://example.com/support",
|
|
84
|
+
description: "Get help from the product team.",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
} satisfies GeistdocsAgentReadinessConfig;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```tsx title="lib/geistdocs/config.tsx"
|
|
91
|
+
import { agent } from "@/geistdocs";
|
|
92
|
+
|
|
93
|
+
export const config = defineConfig({
|
|
94
|
+
// ...
|
|
95
|
+
agent,
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Keep it honest
|
|
100
|
+
|
|
101
|
+
Only list OpenAPI specs, authentication flows, or MCP servers that actually exist. Geistdocs makes product capabilities discoverable, but it does not create APIs or MCP tools for you.
|
|
102
|
+
|
|
103
|
+
Use `/agents.md` with [llms.txt](/docs/llms-txt), [.md extension](/docs/md), and [Proxy and markdown routes](/docs/proxy) to give agents a complete discovery path.
|