@vercel/geistdocs 1.25.1-canary.984aaa9 → 1.25.1-canary.9c4de00
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/cli/index.js +1 -1
- package/dist/components/callout.d.ts.map +1 -1
- package/dist/components/callout.js +2 -2
- package/dist/components/code-block-tabs.js +1 -1
- package/dist/components/code-block.d.ts.map +1 -1
- package/dist/components/code-block.js +1 -1
- package/dist/components/command-prompt.d.ts.map +1 -1
- package/dist/components/command-prompt.js +15 -22
- package/dist/components/copy-prompt.js +1 -1
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +3 -2
- package/dist/internal/chat/activity.d.ts +20 -0
- package/dist/internal/chat/activity.d.ts.map +1 -0
- package/dist/internal/chat/activity.js +43 -0
- package/dist/internal/chat/context.d.ts +2 -0
- package/dist/internal/chat/context.d.ts.map +1 -1
- package/dist/internal/chat/context.js +24 -3
- package/dist/internal/chat/dots-spinner.d.ts.map +1 -1
- package/dist/internal/chat/dots-spinner.js +15 -9
- package/dist/internal/chat/loading-skeleton.d.ts +7 -0
- package/dist/internal/chat/loading-skeleton.d.ts.map +1 -0
- package/dist/internal/chat/loading-skeleton.js +46 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -1
- package/dist/internal/chat/message-metadata.js +15 -30
- package/dist/internal/chat/message-sources.d.ts +3 -0
- package/dist/internal/chat/message-sources.d.ts.map +1 -0
- package/dist/internal/chat/message-sources.js +23 -0
- package/dist/internal/chat/message.d.ts.map +1 -1
- package/dist/internal/chat/message.js +59 -5
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +17 -17
- package/dist/internal/chat/source-chunks.d.ts +9 -0
- package/dist/internal/chat/source-chunks.d.ts.map +1 -0
- package/dist/internal/chat/source-chunks.js +7 -0
- package/dist/internal/chat/sources.d.ts +1 -1
- package/dist/internal/chat/sources.d.ts.map +1 -1
- package/dist/internal/chat/sources.js +7 -1
- package/dist/internal/link-href.d.ts +13 -0
- package/dist/internal/link-href.d.ts.map +1 -0
- package/dist/internal/link-href.js +51 -0
- package/dist/internal/mousedown-navigation-utils.d.ts +5 -0
- package/dist/internal/mousedown-navigation-utils.d.ts.map +1 -0
- package/dist/internal/mousedown-navigation-utils.js +95 -0
- package/dist/internal/mousedown-navigation.d.ts +10 -0
- package/dist/internal/mousedown-navigation.d.ts.map +1 -0
- package/dist/internal/mousedown-navigation.js +42 -0
- package/dist/internal/navbar/desktop-menu.js +1 -1
- package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
- package/dist/internal/navbar/mobile-menu.js +8 -13
- package/dist/internal/navbar/navbar-shell.d.ts.map +1 -1
- package/dist/internal/navbar/navbar-shell.js +2 -1
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +6 -23
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +29 -5
- package/dist/internal/search.js +1 -1
- package/dist/internal/sidebar-responsive.d.ts +0 -1
- package/dist/internal/sidebar-responsive.d.ts.map +1 -1
- package/dist/internal/sidebar-responsive.js +0 -9
- package/dist/internal/sidebar-tree.d.ts.map +1 -1
- package/dist/internal/sidebar-tree.js +6 -1
- package/dist/internal/sidebar.d.ts.map +1 -1
- package/dist/internal/sidebar.js +65 -39
- package/dist/internal/toc-items.d.ts.map +1 -1
- package/dist/internal/toc-items.js +16 -6
- package/dist/internal/ui/navigation-menu.js +2 -2
- package/dist/internal/use-mobile.d.ts.map +1 -1
- package/dist/internal/use-mobile.js +2 -12
- package/dist/layout.d.ts +1 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +2 -0
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +2 -4
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +17 -9
- package/dist/routes/chat.d.ts +1 -1
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +31 -14
- package/dist/routes/llms.d.ts +1 -1
- package/dist/routes/llms.d.ts.map +1 -1
- package/dist/routes/llms.js +12 -2
- package/dist/source.d.ts +6 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +1 -0
- package/dist/versions.js +2 -2
- package/docs/agents.md +4 -3
- package/docs/llms.txt +231 -29
- package/docs/manifest.json +12 -3
- package/docs/pages/ask-ai.md +2 -2
- package/docs/pages/deployment.md +30 -5
- package/docs/pages/getting-started.md +38 -12
- package/docs/pages/guides/nested-navigation.md +1 -1
- package/docs/pages/md.md +1 -1
- package/docs/pages/migration-2.md +106 -0
- package/docs/pages/migration.md +5 -2
- package/docs/pages/syntax.md +40 -3
- package/docs/sitemap.md +3 -2
- package/package.json +5 -5
- package/template/app/[lang]/layout.tsx +4 -0
- package/template/components/ui/button.tsx +1 -1
- package/template/content/docs/ask-ai.cn.mdx +2 -2
- package/template/content/docs/ask-ai.mdx +2 -2
- package/template/content/docs/deployment.mdx +31 -6
- package/template/content/docs/getting-started.mdx +39 -13
- package/template/content/docs/guides/nested-navigation.mdx +1 -1
- package/template/content/docs/md.mdx +1 -1
- package/template/content/docs/meta.json +1 -0
- package/template/content/docs/migration-2.mdx +106 -0
- package/template/content/docs/migration.mdx +5 -1
- package/template/content/docs/syntax.mdx +41 -3
- package/template/package.json +4 -4
- package/theme.css +0 -4
|
@@ -184,11 +184,11 @@ const InlinePageActions = ({ askAIEnabled, checked, copyEnabled, onAskAI, onCopy
|
|
|
184
184
|
// The desktop action control: a compact copy button plus an actions dropdown,
|
|
185
185
|
// aligned beside the page title.
|
|
186
186
|
const DesktopPageActions = ({ askAIEnabled, checked, copyEnabled, editSourceEnabled, editSourceUrl, isMobile, menuView, onAskAI, onCopy, onPrefetchMarkdown, onViewMarkdown, openInChatEnabled, openInChatRef, otherProviders, providersBackRef, query, setMenuView, v0Provider, }) => {
|
|
187
|
-
return (_jsxs("div", { className: "inline-flex shrink-0 overflow-hidden rounded-md border border-gray-400 bg-background-100", children: [copyEnabled ? (_jsxs("button", { "aria-label": "Copy page", className: "inline-flex h-8 touch-manipulation items-center gap-1.5 whitespace-nowrap px-3 font-medium text-sm transition-colors hover:bg-gray-100 hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50", onClick: onCopy, onFocus: onPrefetchMarkdown, onPointerEnter: onPrefetchMarkdown, type: "button", children: [_jsxs("span", { className: "relative size-4", children: [_jsx(IconCopy, { className: cn("absolute inset-0 size-4 transition-
|
|
187
|
+
return (_jsxs("div", { className: "inline-flex shrink-0 overflow-hidden rounded-md border border-gray-400 bg-background-100", children: [copyEnabled ? (_jsxs("button", { "aria-label": "Copy page", className: "inline-flex h-8 touch-manipulation items-center gap-1.5 whitespace-nowrap px-3 font-medium text-sm transition-colors hover:bg-gray-100 hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50", onClick: onCopy, onFocus: onPrefetchMarkdown, onPointerEnter: onPrefetchMarkdown, type: "button", children: [_jsxs("span", { className: "relative size-4", children: [_jsx(IconCopy, { className: cn("absolute inset-0 size-4 transition-[transform,opacity] duration-200", checked ? "scale-75 opacity-0" : "scale-100 opacity-100") }), _jsx(IconCheck, { className: cn("absolute inset-0 size-4 transition-[transform,opacity] duration-200", checked ? "scale-100 opacity-100" : "scale-75 opacity-0") })] }), _jsx("span", { children: "Copy page" })] })) : null, _jsxs(DropdownMenu, { onOpenChange: (open) => {
|
|
188
188
|
if (!open) {
|
|
189
189
|
setMenuView("main");
|
|
190
190
|
}
|
|
191
|
-
}, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { "aria-label": copyEnabled ? "Open page actions" : "Page actions", className: "inline-flex h-8 touch-manipulation items-center justify-center gap-1.5 border-gray-400 border-l px-2 transition-colors hover:
|
|
191
|
+
}, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { "aria-label": copyEnabled ? "Open page actions" : "Page actions", className: "inline-flex h-8 touch-manipulation items-center justify-center gap-1.5 border-gray-400 border-l px-2 transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50 data-[state=closed]:bg-transparent data-[state=open]:bg-gray-100 data-[state=closed]:hover:bg-gray-100", type: "button", children: [copyEnabled ? null : _jsx("span", { children: "Page actions" }), _jsx(IconChevronDown, { className: "size-4" })] }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-80 max-w-[calc(100vw-1rem)]", sideOffset: 8, children: isMobile && menuView === "providers" ? (_jsx(ProviderMenuView, { backRef: providersBackRef, onBack: () => {
|
|
192
192
|
setMenuView("main");
|
|
193
193
|
requestAnimationFrame(() => openInChatRef.current?.focus());
|
|
194
194
|
}, providers: otherProviders, query: query })) : (_jsx(PageActionsMainMenu, { askAIEnabled: askAIEnabled, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, handleCopy: onCopy, isMobile: isMobile, onAskAI: onAskAI, onShowProviders: () => {
|
|
@@ -198,7 +198,7 @@ const DesktopPageActions = ({ askAIEnabled, checked, copyEnabled, editSourceEnab
|
|
|
198
198
|
};
|
|
199
199
|
export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
200
200
|
const isMobile = useIsMobile();
|
|
201
|
-
const { enabled: chatEnabled, setIsOpen, setPrompt } = useGeistdocsChat();
|
|
201
|
+
const { enabled: chatEnabled, preloadChat, setIsOpen, setPrompt, } = useGeistdocsChat();
|
|
202
202
|
const [menuView, setMenuView] = useState("main");
|
|
203
203
|
const openInChatRef = useRef(null);
|
|
204
204
|
const providersBackRef = useRef(null);
|
|
@@ -211,25 +211,7 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
211
211
|
await navigator.clipboard.writeText(await fetchMarkdown());
|
|
212
212
|
});
|
|
213
213
|
const handleViewMarkdown = () => {
|
|
214
|
-
|
|
215
|
-
// markdown into a blob URL — keeps `.md` URLs out of the address bar
|
|
216
|
-
// and browser history (agents should cite canonical page URLs).
|
|
217
|
-
const viewer = window.open("about:blank", "_blank");
|
|
218
|
-
if (!viewer) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
fetchMarkdown()
|
|
222
|
-
.then((markdown) => {
|
|
223
|
-
const blob = new Blob([markdown], {
|
|
224
|
-
type: "text/plain;charset=utf-8",
|
|
225
|
-
});
|
|
226
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
227
|
-
viewer.location.href = blobUrl;
|
|
228
|
-
setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000);
|
|
229
|
-
})
|
|
230
|
-
.catch(() => {
|
|
231
|
-
viewer.close();
|
|
232
|
-
});
|
|
214
|
+
window.open(markdownUrl, "_blank", "noopener");
|
|
233
215
|
};
|
|
234
216
|
const editSourceUrl = getEditSourceUrl({
|
|
235
217
|
github: config.github,
|
|
@@ -250,13 +232,14 @@ export const GeistdocsPageActions = ({ config, page, only, }) => {
|
|
|
250
232
|
const showDesktop = only !== "mobile";
|
|
251
233
|
const showMobile = only !== "desktop";
|
|
252
234
|
const onAskAI = () => {
|
|
235
|
+
preloadChat();
|
|
253
236
|
setPrompt(getPageQuery(page.url, window.location.origin));
|
|
254
237
|
setIsOpen(true);
|
|
255
238
|
};
|
|
256
239
|
// Desktop variant aligns beside the title (self-end); the mobile variant is
|
|
257
240
|
// rendered below the description and left-aligned.
|
|
258
241
|
const rootClassName = only === "mobile" ? "@min-[961px]:hidden" : "self-end @max-[960px]:hidden";
|
|
259
|
-
return (_jsxs("div", { className: rootClassName, children: [showDesktop ? (_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider })) : null, showMobile && (copyEnabled || askAIEnabled) ? (_jsx(InlinePageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
|
|
242
|
+
return (_jsxs("div", { className: rootClassName, onFocusCapture: preloadChat, onPointerEnter: preloadChat, children: [showDesktop ? (_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, editSourceEnabled: editSourceEnabled, editSourceUrl: editSourceUrl, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider })) : null, showMobile && (copyEnabled || askAIEnabled) ? (_jsx(InlinePageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown })) : null, _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
|
|
260
243
|
};
|
|
261
244
|
export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
|
|
262
245
|
const actions = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"provider-client.d.ts","sourceRoot":"","sources":["../../src/internal/provider-client.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAcjD,MAAM,WAAW,sBACf,SAAQ,cAAc,CAAC,OAAO,YAAY,CAAC;IAC3C,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgFD,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAQ9D,CAAC"}
|
|
@@ -4,21 +4,45 @@ import { Toasts } from "@vercel/geistcn/components/toasts";
|
|
|
4
4
|
import { GeistProvider } from "@vercel/geistcn/core";
|
|
5
5
|
import { cn } from "@vercel/geistcn/utils";
|
|
6
6
|
import { RootProvider } from "fumadocs-ui/provider/next";
|
|
7
|
-
import { useCallback } from "react";
|
|
7
|
+
import { lazy, Suspense, useCallback, useEffect, } from "react";
|
|
8
8
|
import { GeistdocsChatProvider, useGeistdocsChat } from "./chat/context";
|
|
9
|
-
import {
|
|
9
|
+
import { ChatLoadingSkeleton } from "./chat/loading-skeleton";
|
|
10
10
|
import { GeistdocsConfigProvider } from "./config-context";
|
|
11
11
|
import { createGeistdocsI18n } from "./i18n";
|
|
12
12
|
import { GeistdocsSearchDialog } from "./search";
|
|
13
13
|
import { useIsMobile } from "./use-mobile";
|
|
14
|
+
const GeistdocsChatShell = lazy(() => import("./chat/shell").then(({ GeistdocsChatShell: Component }) => ({
|
|
15
|
+
default: Component,
|
|
16
|
+
})));
|
|
14
17
|
const GeistdocsProviderInner = ({ config, search, theme: _theme, lang, ...props }) => {
|
|
15
18
|
const { i18n, i18nProvider } = createGeistdocsI18n(config);
|
|
16
|
-
const { enabled, isOpen } = useGeistdocsChat();
|
|
19
|
+
const { enabled, hasBeenOpened, isOpen, setIsOpen } = useGeistdocsChat();
|
|
17
20
|
const isMobile = useIsMobile();
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!enabled) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const handleKeyDown = (event) => {
|
|
26
|
+
if (event.key === "Escape" && isOpen) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
setIsOpen(false);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if ((event.metaKey || event.ctrlKey) &&
|
|
32
|
+
!event.altKey &&
|
|
33
|
+
!event.shiftKey &&
|
|
34
|
+
event.key.toLowerCase() === "i") {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
setIsOpen((open) => !open);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
40
|
+
return () => document.removeEventListener("keydown", handleKeyDown, true);
|
|
41
|
+
}, [enabled, isOpen, setIsOpen]);
|
|
18
42
|
const SearchDialogComponent = useCallback((searchProps) => (_jsx(GeistdocsSearchDialog, { basePath: config.basePath, ...searchProps })), [config.basePath]);
|
|
19
43
|
return (_jsxs("div", { className: cn("@container transition-[padding-right] duration-150 ease-[cubic-bezier(0.175,0.885,0.32,1.1)] motion-reduce:transition-none", enabled && isOpen && !isMobile ? "pr-[400px]!" : null), "data-geistdocs-container": true, children: [_jsx(RootProvider, { i18n: i18nProvider(lang ?? i18n.defaultLanguage), search: {
|
|
20
44
|
SearchDialog: SearchDialogComponent,
|
|
21
45
|
...search,
|
|
22
|
-
}, theme: { enabled: false }, ...props }), _jsx(Toasts, {}), _jsx(GeistdocsChatShell, {})] }));
|
|
46
|
+
}, theme: { enabled: false }, ...props }), _jsx(Toasts, {}), hasBeenOpened ? (_jsx(Suspense, { fallback: isOpen ? (_jsx(ChatLoadingSkeleton, { isMobile: isMobile, title: config.title })) : null, children: _jsx(GeistdocsChatShell, {}) })) : null] }));
|
|
23
47
|
};
|
|
24
|
-
export const GeistdocsProvider = (props) => (_jsx(GeistProvider, { storageKey: "geistdocs-theme", children: _jsx(GeistdocsConfigProvider, { config: props.config, children: _jsx(GeistdocsChatProvider, { config: props.config, children: _jsx(GeistdocsProviderInner, { ...props }) }) }) }));
|
|
48
|
+
export const GeistdocsProvider = (props) => (_jsx(GeistProvider, { storageKey: "geistdocs-theme", withScript: false, children: _jsx(GeistdocsConfigProvider, { config: props.config, children: _jsx(GeistdocsChatProvider, { config: props.config, children: _jsx(GeistdocsProviderInner, { ...props }) }) }) }));
|
package/dist/internal/search.js
CHANGED
|
@@ -11,5 +11,5 @@ export const GeistdocsSearchDialog = ({ basePath, ...props }) => {
|
|
|
11
11
|
locale,
|
|
12
12
|
api: getPublicPath("/api/search", basePath),
|
|
13
13
|
});
|
|
14
|
-
return (_jsxs(FumadocsSearchDialog, { isLoading: query.isLoading, onSearchChange: setSearch, search: search, ...props, children: [_jsx(SearchDialogOverlay, { className: "bg-background-100/80 backdrop-blur-none" }), _jsxs(SearchDialogContent, { className: "border-none", "data-geistdocs-command-modal": true, onEscapeKeyDown: () => props.onOpenChange(false), children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { "aria-label": "Search results", Item: (itemProps) => (_jsx(SearchDialogListItem, { ...itemProps, role: "option" })), items: query.data === "empty" ? null : query.data, role: "listbox" })] })] }));
|
|
14
|
+
return (_jsxs(FumadocsSearchDialog, { isLoading: query.isLoading, onSearchChange: setSearch, search: search, ...props, children: [_jsx(SearchDialogOverlay, { className: "bg-background-100/80 backdrop-blur-none" }), _jsxs(SearchDialogContent, { className: "w-[640px] max-w-[calc(100vw-1rem)] border-none shadow-[var(--ds-shadow-modal)]", "data-geistdocs-command-modal": true, onEscapeKeyDown: () => props.onOpenChange(false), children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { "aria-label": "Search results", Item: (itemProps) => (_jsx(SearchDialogListItem, { ...itemProps, role: "option" })), items: query.data === "empty" ? null : query.data, role: "listbox" })] })] }));
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-responsive.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar-responsive.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"sidebar-responsive.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar-responsive.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,MAAM,CAAC"}
|
|
@@ -1,10 +1 @@
|
|
|
1
1
|
export const SIDEBAR_DESKTOP_MIN_WIDTH = 961;
|
|
2
|
-
export const observeSidebarContainer = (container, onDesktop) => {
|
|
3
|
-
const resizeObserver = new ResizeObserver(([entry]) => {
|
|
4
|
-
if (entry && entry.contentRect.width >= SIDEBAR_DESKTOP_MIN_WIDTH) {
|
|
5
|
-
onDesktop();
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
resizeObserver.observe(container);
|
|
9
|
-
return () => resizeObserver.disconnect();
|
|
10
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-tree.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,GAC9B,MAA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;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,GAAG,IAAI,KAAG,IAAI,EAsBnE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,OAAO,IAAI,EAAE,KAAG,gBAAgB,EA8BpE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,OAAO,IAAI,EAAE,EACb,WAAW,MAAM,GAAG,SAAS,EAC7B,wBAAsB,EACtB,cAAiB,KAChB,MAAM,EAyBR,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,EACd,YAAY,MAAM,EAAE,EACpB,cAAiB,KAChB,MAAM,EAiBR,CAAC"}
|
|
@@ -14,7 +14,12 @@ const METHOD_BADGE_TONES = {
|
|
|
14
14
|
POST: "bg-blue-200 text-blue-1000",
|
|
15
15
|
PUT: "bg-amber-200 text-amber-1000",
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
const STATUS_BADGE_TONES = {
|
|
18
|
+
New: "bg-blue-200 text-blue-900",
|
|
19
|
+
};
|
|
20
|
+
export const getSidebarBadgeTone = (label) => STATUS_BADGE_TONES[label] ??
|
|
21
|
+
METHOD_BADGE_TONES[label] ??
|
|
22
|
+
"bg-gray-alpha-400 text-gray-1000";
|
|
18
23
|
export const isExternalSidebarItem = (item) => Boolean(item && (item.external || EXTERNAL_URL.test(item.url)));
|
|
19
24
|
export const isExternalSidebarUrl = (url) => EXTERNAL_URL.test(url);
|
|
20
25
|
export const hasSeparateRootDisclosure = (node) => node.type === "folder" &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/internal/sidebar.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,oBAAoB,EAAuB,MAAM,YAAY,CAAC;AAk9B5E,eAAO,MAAM,gBAAgB,GAAI,6BAI9B;IACD,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,4CAiEA,CAAC"}
|
package/dist/internal/sidebar.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "@vercel/geistcn/components/sheet";
|
|
4
4
|
import { cn } from "@vercel/geistcn/utils";
|
|
5
|
-
import {
|
|
5
|
+
import { IconArrowUpRightSmall, IconChevronRightSmall, } from "@vercel/geistcn-assets/icons";
|
|
6
6
|
import Link from "fumadocs-core/link";
|
|
7
7
|
import { useTreeContext } from "fumadocs-ui/contexts/tree";
|
|
8
8
|
import { useParams, usePathname } from "next/navigation";
|
|
9
|
+
import { useSize } from "phase/react";
|
|
9
10
|
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
10
11
|
import { SearchButton } from "../controls";
|
|
11
12
|
import { useGeistdocsSidebar } from "../sidebar";
|
|
12
|
-
import {
|
|
13
|
+
import { MouseDownNavigation } from "./mousedown-navigation";
|
|
14
|
+
import { SIDEBAR_DESKTOP_MIN_WIDTH } from "./sidebar-responsive";
|
|
13
15
|
import { findActiveRootSection, getDescendantFolderIds, getInitialOpenFolderIds, getSidebarBadgeTone, getSidebarItemBadge, getSidebarNodeId, getSidebarRootGroups, getSidebarSectionItems, hasSeparateRootDisclosure, isExternalSidebarItem, isExternalSidebarUrl, } from "./sidebar-tree";
|
|
14
16
|
const UNSAFE_ID_CHARACTERS = /[^a-zA-Z0-9_-]/g;
|
|
15
17
|
const collectPageUrls = (nodes) => {
|
|
@@ -66,6 +68,10 @@ const getDomId = (prefix, id) => `${prefix}-${id.replace(UNSAFE_ID_CHARACTERS, "
|
|
|
66
68
|
const getRootDisclosureLabel = (name) => typeof name === "string" || typeof name === "number"
|
|
67
69
|
? `Browse ${name}`
|
|
68
70
|
: "Browse Section";
|
|
71
|
+
const updateSidebarFades = (nav) => {
|
|
72
|
+
nav.dataset.fadeTop = String(nav.scrollTop > 0);
|
|
73
|
+
nav.dataset.fadeBottom = String(nav.scrollTop + nav.clientHeight < nav.scrollHeight - 1);
|
|
74
|
+
};
|
|
69
75
|
const scrollItemIntoView = (scrollContainer, item) => {
|
|
70
76
|
const containerRect = scrollContainer.getBoundingClientRect();
|
|
71
77
|
const itemRect = item.getBoundingClientRect();
|
|
@@ -137,7 +143,8 @@ const getSidebarRowTone = (isSelected, isGroup) => {
|
|
|
137
143
|
}
|
|
138
144
|
return "text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000";
|
|
139
145
|
};
|
|
140
|
-
const SidebarDisclosureIcon = ({ expanded }) => (_jsx(
|
|
146
|
+
const SidebarDisclosureIcon = ({ expanded }) => (_jsx(IconChevronRightSmall, { className: cn(expanded && "rotate-90"), size: 16 }));
|
|
147
|
+
const SidebarTrailingIcon = ({ children, className, }) => (_jsx("span", { className: cn("grid h-9 w-8 flex-none place-content-center text-gray-900", className), children: children }));
|
|
141
148
|
const SidebarBadge = ({ label }) => label ? (_jsx("span", { className: cn("inline-flex h-6 max-w-24 shrink-0 items-center truncate rounded-full px-2 text-button-12", getSidebarBadgeTone(label)), children: label })) : null;
|
|
142
149
|
const SidebarTreeNode = ({ depth, node, path, state, }) => {
|
|
143
150
|
const nodeId = getSidebarNodeId(node, path, state.idScope);
|
|
@@ -154,7 +161,7 @@ const SidebarTreeNode = ({ depth, node, path, state, }) => {
|
|
|
154
161
|
const menuId = getDomId(state.idPrefix, nodeId);
|
|
155
162
|
const labelId = `${menuId}-label`;
|
|
156
163
|
const rowClassName = cn("flex h-9 origin-left touch-manipulation flex-row items-center rounded-md pr-1 pl-2.5 motion-reduce:transition-none", getSidebarRowTone(isSelected, isGroup));
|
|
157
|
-
const content = (_jsxs(_Fragment, { children: [node.icon ? (_jsx("span", { className: "shrink-0 [&_svg]:size-4", children: node.icon })) : null, _jsxs("span", { className: cn("flex min-w-0 flex-1 items-center gap-1.5 truncate text-button-14", depth > 0 && "font-normal"), children: [_jsx(SidebarBadge, { label: badge }), _jsx("span", { className: "min-w-0 flex-1 truncate", id: labelId, children: node.name }), isExternalSidebarItem(item) ? (_jsx(
|
|
164
|
+
const content = (_jsxs(_Fragment, { children: [node.icon ? (_jsx("span", { className: "shrink-0 [&_svg]:size-4", children: node.icon })) : null, _jsxs("span", { className: cn("flex min-w-0 flex-1 items-center gap-1.5 truncate text-button-14", depth > 0 && "font-normal"), children: [_jsx(SidebarBadge, { label: badge }), _jsx("span", { className: "min-w-0 flex-1 truncate", id: labelId, children: node.name }), isExternalSidebarItem(item) ? (_jsx(SidebarTrailingIcon, { children: _jsx(IconArrowUpRightSmall, { size: 16 }) })) : null] })] }));
|
|
158
165
|
const handleLinkClick = (event) => {
|
|
159
166
|
state.onNavigate?.();
|
|
160
167
|
if (opensOutsideCurrentPage(event, item?.external, item?.url ?? "")) {
|
|
@@ -170,7 +177,7 @@ const SidebarTreeNode = ({ depth, node, path, state, }) => {
|
|
|
170
177
|
primaryControl = (_jsx(Link, { "aria-current": isSelected ? "page" : undefined, className: cn(rowClassName, "min-w-0 flex-1 no-underline outline-none focus-visible:shadow-[var(--ds-focus-ring)]"), external: item.external, href: item.url, onClick: handleLinkClick, prefetch: true, children: content }));
|
|
171
178
|
}
|
|
172
179
|
else if (folder && hasChildren) {
|
|
173
|
-
primaryControl = (_jsxs("button", { "aria-controls": menuId, "aria-expanded": isExpanded, className: cn(rowClassName, "w-full min-w-0 flex-1 cursor-pointer border-0 bg-transparent text-left outline-none focus-visible:shadow-[var(--ds-focus-ring)]"), onClick: () => state.toggleFolder(folder, path), type: "button", children: [content, _jsx(
|
|
180
|
+
primaryControl = (_jsxs("button", { "aria-controls": menuId, "aria-expanded": isExpanded, className: cn(rowClassName, "w-full min-w-0 flex-1 cursor-pointer border-0 bg-transparent text-left outline-none focus-visible:shadow-[var(--ds-focus-ring)]"), onClick: () => state.toggleFolder(folder, path), type: "button", children: [content, _jsx(SidebarTrailingIcon, { className: "-mr-1", children: _jsx(SidebarDisclosureIcon, { expanded: isExpanded }) })] }));
|
|
174
181
|
}
|
|
175
182
|
else {
|
|
176
183
|
primaryControl = (_jsx("span", { className: cn(rowClassName, "min-w-0 flex-1"), children: content }));
|
|
@@ -210,7 +217,7 @@ const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
|
|
|
210
217
|
const className = cn("flex h-9 touch-manipulation items-center gap-2 rounded-md pr-2 pl-2.5 no-underline outline-none focus-visible:shadow-[var(--ds-focus-ring)] motion-reduce:transition-none", isActive
|
|
211
218
|
? "bg-gray-200 text-gray-1000"
|
|
212
219
|
: "text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100");
|
|
213
|
-
const content = (_jsxs(_Fragment, { children: [item.icon ? (_jsx("span", { className: "shrink-0 [&_svg]:size-4", children: item.icon })) : null, _jsx(SidebarBadge, { label: badge }), _jsx("span", { className: cn("min-w-0 flex-1 truncate text-button-14", labelWeight), children: item.name }), isExternalSidebarItem(linkItem) ? (_jsx(
|
|
220
|
+
const content = (_jsxs(_Fragment, { children: [item.icon ? (_jsx("span", { className: "shrink-0 [&_svg]:size-4", children: item.icon })) : null, _jsx(SidebarBadge, { label: badge }), _jsx("span", { className: cn("min-w-0 flex-1 truncate text-button-14", labelWeight), children: item.name }), isExternalSidebarItem(linkItem) ? (_jsx(SidebarTrailingIcon, { children: _jsx(IconArrowUpRightSmall, { size: 16 }) })) : null, opensSection && !separateDisclosure ? (_jsx(SidebarTrailingIcon, { children: _jsx(IconChevronRightSmall, { size: 16 }) })) : null] }));
|
|
214
221
|
let renderedItem;
|
|
215
222
|
if (linkItem) {
|
|
216
223
|
renderedItem = (_jsx(Link, { "aria-current": isCurrentPage ? "page" : undefined, className: cn(className, separateDisclosure && "min-w-0 flex-1"), "data-sidebar-active": isActive, external: linkItem.external, href: linkItem.url, onClick: folder && opensSection
|
|
@@ -227,9 +234,9 @@ const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
|
|
|
227
234
|
else {
|
|
228
235
|
renderedItem = _jsx("span", { className: className, children: content });
|
|
229
236
|
}
|
|
230
|
-
return (_jsxs("li", { className: cn(separateDisclosure && "flex items-center gap-px"), children: [renderedItem, separateDisclosure ? (_jsx("button", { "aria-label": getRootDisclosureLabel(item.name), className: "grid size-8 flex-none cursor-pointer touch-manipulation place-content-center rounded-md bg-transparent p-0 text-gray-900 hover:bg-gray-100 focus-visible:bg-gray-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none motion-reduce:transition-none", onClick: (event) => onSelect(item, event.currentTarget), type: "button", children: _jsx(
|
|
237
|
+
return (_jsxs("li", { className: cn(separateDisclosure && "flex items-center gap-px"), children: [renderedItem, separateDisclosure ? (_jsx("button", { "aria-label": getRootDisclosureLabel(item.name), className: "grid size-8 flex-none cursor-pointer touch-manipulation place-content-center rounded-md bg-transparent p-0 text-gray-900 hover:bg-gray-100 focus-visible:bg-gray-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none motion-reduce:transition-none", onClick: (event) => onSelect(item, event.currentTarget), type: "button", children: _jsx(IconChevronRightSmall, { size: 16 }) })) : null] }));
|
|
231
238
|
};
|
|
232
|
-
const SidebarSectionHeader = ({ buttonRef, onBack, section, }) => (_jsx("div", { className: "mb-2 px-2 pt-1", children: _jsxs("button", { "aria-label": "Back to all documentation sections", className: "flex w-full cursor-pointer touch-manipulation flex-row items-center justify-between gap-1 rounded-md border-0 bg-transparent p-0 text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none motion-reduce:transition-none", onClick: onBack, ref: buttonRef, type: "button", children: [_jsx("span", { className: "grid size-9 flex-none place-content-center", children: _jsx(
|
|
239
|
+
const SidebarSectionHeader = ({ buttonRef, onBack, section, }) => (_jsx("div", { className: "mb-2 px-2 pt-1", children: _jsxs("button", { "aria-label": "Back to all documentation sections", className: "flex w-full cursor-pointer touch-manipulation flex-row items-center justify-between gap-1 rounded-md border-0 bg-transparent p-0 text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none motion-reduce:transition-none", onClick: onBack, ref: buttonRef, type: "button", children: [_jsx("span", { className: "grid size-9 flex-none place-content-center", children: _jsx(IconChevronRightSmall, { className: "rotate-180", size: 16 }) }), _jsx("span", { className: "flex min-w-0 flex-1 items-center justify-center text-button-14", children: _jsx("span", { className: "truncate", children: section.name }) }), _jsx("span", { className: "size-9 flex-none" })] }) }));
|
|
233
240
|
const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
|
|
234
241
|
const groups = useMemo(() => getSidebarRootGroups(nodes), [nodes]);
|
|
235
242
|
const currentSection = useMemo(() => findActiveRootSection(nodes, activeUrl), [activeUrl, nodes]);
|
|
@@ -238,6 +245,14 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
|
|
|
238
245
|
const [view, setView] = useState(currentSection ? "section" : "root");
|
|
239
246
|
const [sectionRevealed, setSectionRevealed] = useState(view === "section");
|
|
240
247
|
const navRef = useRef(null);
|
|
248
|
+
useSize({
|
|
249
|
+
onResize: () => {
|
|
250
|
+
if (navRef.current) {
|
|
251
|
+
updateSidebarFades(navRef.current);
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
ref: navRef,
|
|
255
|
+
});
|
|
241
256
|
const returnFocusRef = useRef(null);
|
|
242
257
|
const sectionHeaderRef = useRef(null);
|
|
243
258
|
const shouldFocusRootRef = useRef(false);
|
|
@@ -263,17 +278,24 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
|
|
|
263
278
|
if (!nav) {
|
|
264
279
|
return;
|
|
265
280
|
}
|
|
266
|
-
const updateFades = () =>
|
|
267
|
-
|
|
268
|
-
|
|
281
|
+
const updateFades = () => updateSidebarFades(nav);
|
|
282
|
+
let frame;
|
|
283
|
+
const scheduleFadeUpdate = () => {
|
|
284
|
+
if (frame !== undefined) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
frame = requestAnimationFrame(() => {
|
|
288
|
+
frame = undefined;
|
|
289
|
+
updateFades();
|
|
290
|
+
});
|
|
269
291
|
};
|
|
270
|
-
const resizeObserver = new ResizeObserver(updateFades);
|
|
271
292
|
updateFades();
|
|
272
|
-
nav.addEventListener("scroll",
|
|
273
|
-
resizeObserver.observe(nav);
|
|
293
|
+
nav.addEventListener("scroll", scheduleFadeUpdate, { passive: true });
|
|
274
294
|
return () => {
|
|
275
|
-
|
|
276
|
-
|
|
295
|
+
if (frame !== undefined) {
|
|
296
|
+
cancelAnimationFrame(frame);
|
|
297
|
+
}
|
|
298
|
+
nav.removeEventListener("scroll", scheduleFadeUpdate);
|
|
277
299
|
};
|
|
278
300
|
}, []);
|
|
279
301
|
const sectionShown = view === "section" && sectionRevealed;
|
|
@@ -294,31 +316,39 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
|
|
|
294
316
|
shouldFocusRootRef.current = false;
|
|
295
317
|
}
|
|
296
318
|
}, [sectionShown]);
|
|
297
|
-
return (_jsx("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 @min-[961px]:block hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] @min-[961px]:layout:[--fd-sidebar-width:300px] [grid-area:sidebar] *:pointer-events-auto", "data-sidebar-placeholder": true, children: _jsx("aside", { className: "h-full w-[300px] pr-3 text-gray-900", children: _jsxs("nav", { "aria-label": "Documentation", className: "geistdocs-sidebar-scroll h-full w-full overflow-auto overflow-x-hidden px-1 pt-14 pb-1 outline-none", "data-geistdocs-sidebar-scroll": true, ref: navRef, children: [top ? _jsx("div", { className: "px-2 pb-3", children: top }) : null, _jsxs("div", { className: "relative overflow-hidden", children: [_jsx("div", { className: cn("geistdocs-sidebar-pane", rootHidden &&
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
319
|
+
return (_jsx("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 @min-[961px]:block hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] @min-[961px]:layout:[--fd-sidebar-width:300px] [grid-area:sidebar] *:pointer-events-auto", "data-sidebar-placeholder": true, children: _jsx("aside", { className: "h-full w-[300px] pr-3 text-gray-900", children: _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "geistdocs-sidebar-scroll h-full w-full overflow-auto overflow-x-hidden px-1 pt-14 pb-1 outline-none", "data-geistdocs-sidebar-scroll": true, ref: navRef, children: [top ? _jsx("div", { className: "px-2 pb-3", children: top }) : null, _jsxs("div", { className: "relative overflow-hidden", children: [_jsx("div", { className: cn("geistdocs-sidebar-pane", rootHidden &&
|
|
320
|
+
"pointer-events-none absolute inset-x-0 top-0 opacity-0 [transform:translateX(-8px)] motion-reduce:invisible"), "data-sidebar-pane": "root", inert: rootHidden || undefined, children: _jsx(SidebarRootList, { activeSection: activeSection, activeUrl: activeUrl, groups: groups, onSelect: (section, trigger) => {
|
|
321
|
+
returnFocusRef.current = trigger;
|
|
322
|
+
shouldFocusSectionRef.current = true;
|
|
323
|
+
setSelectedSection(section);
|
|
324
|
+
setView("section");
|
|
325
|
+
}, visible: !rootHidden }) }), activeSection ? (_jsxs("div", { className: cn("geistdocs-sidebar-pane", sectionHidden &&
|
|
326
|
+
"pointer-events-none absolute inset-x-0 top-0 opacity-0 [transform:translateX(8px)] motion-reduce:invisible"), "data-sidebar-pane": "section", inert: sectionHidden || undefined, children: [_jsx(SidebarSectionHeader, { buttonRef: sectionHeaderRef, onBack: () => {
|
|
327
|
+
shouldFocusRootRef.current = true;
|
|
328
|
+
setSelectedSection(null);
|
|
329
|
+
setView("root");
|
|
330
|
+
}, section: activeSection }), _jsx("div", { className: "px-2", children: _jsx(SidebarTree, { activeUrl: activeUrl, idScope: sectionScope, nodes: sectionItems, openFirstLevel: true, scrollActive: true, visible: !sectionHidden }) })] })) : null] })] }) }) }) }));
|
|
309
331
|
};
|
|
310
|
-
const DesktopTreeSidebar = ({ activeUrl, nodes, rootScope, top, }) => (_jsx("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 @min-[961px]:block hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] @min-[961px]:layout:[--fd-sidebar-width:300px] [grid-area:sidebar] *:pointer-events-auto", "data-sidebar-mode": "tree", "data-sidebar-placeholder": true, children: _jsx("aside", { className: "h-full w-[300px] pr-3 text-gray-900", children: _jsxs("nav", { "aria-label": "Documentation", className: "geistdocs-sidebar-scroll h-full w-full overflow-auto overflow-x-hidden px-3 pt-14 pb-1 outline-none", "data-geistdocs-sidebar-scroll": true, children: [top ? _jsx("div", { className: "pb-3", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: rootScope, nodes: nodes, openFirstLevel: true, scrollActive: true })] }) }) }));
|
|
332
|
+
const DesktopTreeSidebar = ({ activeUrl, nodes, rootScope, top, }) => (_jsx("div", { className: "pointer-events-none sticky top-(--fd-docs-row-1) z-20 @min-[961px]:block hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] @min-[961px]:layout:[--fd-sidebar-width:300px] [grid-area:sidebar] *:pointer-events-auto", "data-sidebar-mode": "tree", "data-sidebar-placeholder": true, children: _jsx("aside", { className: "h-full w-[300px] pr-3 text-gray-900", children: _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "geistdocs-sidebar-scroll h-full w-full overflow-auto overflow-x-hidden px-3 pt-14 pb-1 outline-none", "data-geistdocs-sidebar-scroll": true, children: [top ? _jsx("div", { className: "pb-3", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: rootScope, nodes: nodes, openFirstLevel: true, scrollActive: true })] }) }) }) }));
|
|
311
333
|
const DesktopSidebar = ({ mode, ...props }) => {
|
|
312
334
|
if (mode === "tree") {
|
|
313
335
|
return _jsx(DesktopTreeSidebar, { ...props });
|
|
314
336
|
}
|
|
315
337
|
return _jsx(DesktopSectionsSidebar, { ...props });
|
|
316
338
|
};
|
|
317
|
-
const MobileSidebar = ({ activeUrl, idScope, nodes, onOpenChange, open, top, }) => (_jsx(Sheet, { onOpenChange: onOpenChange, open: open, children: _jsxs(SheetContent, { className: "w-full gap-0 bg-background-200 p-0 sm:max-w-none", "data-geistdocs-mobile-sidebar": true, noOverlay: true, side: "left", children: [_jsxs(SheetHeader, { className: "h-16 shrink-0 justify-center border-b px-4 py-0", children: [_jsx(SheetTitle, { className: "text-label-16", children: "Browse" }), _jsx(SheetDescription, { className: "sr-only", children: "Navigation for the documentation." })] }), _jsxs("nav", { "aria-label": "Documentation", className: "flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-3 text-gray-900", "data-geistdocs-sidebar-scroll": true, children: [_jsx("div", { className: "pb-4 [&>button]:w-full", children: _jsx(SearchButton, { onClick: () => onOpenChange(false) }) }), top ? _jsx("div", { className: "pb-4", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: idScope, nodes: nodes, onNavigate: () => onOpenChange(false), scrollActive: true, visible: open })] })] }) }));
|
|
339
|
+
const MobileSidebar = ({ activeUrl, idScope, nodes, onOpenChange, open, top, }) => (_jsx(Sheet, { onOpenChange: onOpenChange, open: open, children: _jsxs(SheetContent, { className: "w-full gap-0 bg-background-200 p-0 sm:max-w-none", "data-geistdocs-mobile-sidebar": true, noOverlay: true, side: "left", children: [_jsxs(SheetHeader, { className: "h-16 shrink-0 justify-center border-b px-4 py-0", children: [_jsx(SheetTitle, { className: "text-label-16", children: "Browse" }), _jsx(SheetDescription, { className: "sr-only", children: "Navigation for the documentation." })] }), _jsx(MouseDownNavigation, { children: _jsxs("nav", { "aria-label": "Documentation", className: "flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-3 text-gray-900", "data-geistdocs-sidebar-scroll": true, children: [_jsx("div", { className: "pb-4 [&>button]:w-full", children: _jsx(SearchButton, { onClick: () => onOpenChange(false) }) }), top ? _jsx("div", { className: "pb-4", children: top }) : null, _jsx(SidebarTree, { activeUrl: activeUrl, idScope: idScope, nodes: nodes, onNavigate: () => onOpenChange(false), scrollActive: true, visible: open })] }) })] }) }));
|
|
318
340
|
export const GeistdocsSidebar = ({ mode = "sections", showDesktop = true, top, }) => {
|
|
319
341
|
const { root, full } = useTreeContext();
|
|
320
342
|
const { isOpen, setIsOpen } = useGeistdocsSidebar();
|
|
321
|
-
const
|
|
343
|
+
const containerRef = useRef(null);
|
|
344
|
+
useSize({
|
|
345
|
+
onResize: ({ width }) => {
|
|
346
|
+
if (width >= SIDEBAR_DESKTOP_MIN_WIDTH) {
|
|
347
|
+
setIsOpen(false);
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
ref: containerRef,
|
|
351
|
+
});
|
|
322
352
|
const pathname = usePathname();
|
|
323
353
|
const previousPathname = useRef(pathname);
|
|
324
354
|
const params = useParams();
|
|
@@ -334,12 +364,8 @@ export const GeistdocsSidebar = ({ mode = "sections", showDesktop = true, top, }
|
|
|
334
364
|
previousPathname.current = pathname;
|
|
335
365
|
}
|
|
336
366
|
}, [pathname, setIsOpen]);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
return observeSidebarContainer(container, () => setIsOpen(false));
|
|
343
|
-
}, [setIsOpen]);
|
|
344
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { hidden: true, ref: containerMarkerRef }), showDesktop ? (_jsx(DesktopSidebar, { activeUrl: activeUrl, mode: mode, nodes: root.children, rootScope: rootScope, top: top }, root.$id)) : null, _jsx(MobileSidebar, { activeUrl: activeUrl, idScope: rootScope, nodes: root.children, onOpenChange: setIsOpen, open: isOpen, top: top })] }));
|
|
367
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { hidden: true, ref: (marker) => {
|
|
368
|
+
containerRef.current =
|
|
369
|
+
marker?.closest("[data-geistdocs-container]") ?? null;
|
|
370
|
+
} }), showDesktop ? (_jsx(DesktopSidebar, { activeUrl: activeUrl, mode: mode, nodes: root.children, rootScope: rootScope, top: top }, root.$id)) : null, _jsx(MobileSidebar, { activeUrl: activeUrl, idScope: rootScope, nodes: root.children, onOpenChange: setIsOpen, open: isOpen, top: top })] }));
|
|
345
371
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toc-items.d.ts","sourceRoot":"","sources":["../../src/internal/toc-items.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAsCf,eAAO,MAAM,QAAQ,GAAI,yBAAyB,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"toc-items.d.ts","sourceRoot":"","sources":["../../src/internal/toc-items.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAsCf,eAAO,MAAM,QAAQ,GAAI,yBAAyB,cAAc,CAAC,KAAK,CAAC,4CA2FtE,CAAC"}
|
|
@@ -40,6 +40,7 @@ export const TOCItems = ({ className, ...props }) => {
|
|
|
40
40
|
}, ANCHOR_SCROLL_MS);
|
|
41
41
|
}, []);
|
|
42
42
|
useEffect(() => {
|
|
43
|
+
let frame;
|
|
43
44
|
const syncFromHash = () => select(window.location.hash.slice(1) || null);
|
|
44
45
|
const updateAtBottom = () => {
|
|
45
46
|
const doc = document.documentElement;
|
|
@@ -50,21 +51,30 @@ export const TOCItems = ({ className, ...props }) => {
|
|
|
50
51
|
// Any real scroll — wheel, touch, keyboard, or scrollbar drag — hands the
|
|
51
52
|
// indicator back to viewport-based tracking, unless it is the programmatic
|
|
52
53
|
// jump from a click/deep-link.
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setSelected(null);
|
|
54
|
+
const scheduleScrollUpdate = () => {
|
|
55
|
+
if (frame !== undefined) {
|
|
56
|
+
return;
|
|
57
57
|
}
|
|
58
|
+
frame = requestAnimationFrame(() => {
|
|
59
|
+
frame = undefined;
|
|
60
|
+
updateAtBottom();
|
|
61
|
+
if (!ignoreScroll.current) {
|
|
62
|
+
setSelected(null);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
58
65
|
};
|
|
59
66
|
syncFromHash();
|
|
60
67
|
updateAtBottom();
|
|
61
68
|
window.addEventListener("hashchange", syncFromHash);
|
|
62
|
-
window.addEventListener("scroll",
|
|
69
|
+
window.addEventListener("scroll", scheduleScrollUpdate, { passive: true });
|
|
63
70
|
window.addEventListener("resize", updateAtBottom);
|
|
64
71
|
return () => {
|
|
65
72
|
clearTimeout(ignoreTimer.current);
|
|
73
|
+
if (frame !== undefined) {
|
|
74
|
+
cancelAnimationFrame(frame);
|
|
75
|
+
}
|
|
66
76
|
window.removeEventListener("hashchange", syncFromHash);
|
|
67
|
-
window.removeEventListener("scroll",
|
|
77
|
+
window.removeEventListener("scroll", scheduleScrollUpdate);
|
|
68
78
|
window.removeEventListener("resize", updateAtBottom);
|
|
69
79
|
};
|
|
70
80
|
}, [select]);
|
|
@@ -15,7 +15,7 @@ export function NavigationMenuItem({ className, ...props }) {
|
|
|
15
15
|
}
|
|
16
16
|
export const navigationMenuTriggerStyle = cva("group relative inline-flex w-max items-center justify-center gap-1 px-3 text-gray-900 text-sm transition-colors hover:text-gray-1000 focus:text-gray-1000 focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:text-gray-1000 data-[state=open]:text-gray-1000");
|
|
17
17
|
export function NavigationMenuTrigger({ className, children, ...props }) {
|
|
18
|
-
return (_jsxs(NavigationMenuPrimitive.Trigger, { className: cn(navigationMenuTriggerStyle(), "group", className), "data-slot": "navigation-menu-trigger", ...props, children: [children, _jsx(IconChevronDownSmall, { "aria-hidden": "true", className: "ease relative top-px size-3.5 text-gray-900 transition-
|
|
18
|
+
return (_jsxs(NavigationMenuPrimitive.Trigger, { className: cn(navigationMenuTriggerStyle(), "group", className), "data-slot": "navigation-menu-trigger", ...props, children: [children, _jsx(IconChevronDownSmall, { "aria-hidden": "true", className: "ease relative top-px size-3.5 text-gray-900 transition-[transform,color] duration-200 group-hover:text-gray-1000 group-data-[state=open]:rotate-180" }), _jsx("div", { className: "absolute inset-x-0 bottom-0 z-50 -mx-12 hidden h-[18px] group-data-[state=open]:flex" })] }));
|
|
19
19
|
}
|
|
20
20
|
export function NavigationMenuContent({ className, ...props }) {
|
|
21
21
|
return (_jsx(NavigationMenuPrimitive.Content, { className: cn("data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out top-0 left-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out md:absolute md:w-auto", "group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 **:data-[slot=navigation-menu-link]:focus:outline-none **:data-[slot=navigation-menu-link]:focus:ring-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:bg-background-100 group-data-[viewport=false]/navigation-menu:text-gray-1000 group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in", className), "data-slot": "navigation-menu-content", ...props }));
|
|
@@ -27,5 +27,5 @@ export function NavigationMenuLink({ className, ...props }) {
|
|
|
27
27
|
return (_jsx(NavigationMenuPrimitive.Link, { className: cn("block w-full text-sm outline-none transition-colors", className), "data-slot": "navigation-menu-link", ...props }));
|
|
28
28
|
}
|
|
29
29
|
export function NavigationMenuIndicator({ className, ...props }) {
|
|
30
|
-
return (_jsx(NavigationMenuPrimitive.Indicator, { className: cn("data-[state=hidden]:fade-out data-[state=visible]:fade-in top-[70%] z-[1] flex items-end justify-center overflow-hidden transition-
|
|
30
|
+
return (_jsx(NavigationMenuPrimitive.Indicator, { className: cn("data-[state=hidden]:fade-out data-[state=visible]:fade-in top-[70%] z-[1] flex items-end justify-center overflow-hidden transition-[transform,opacity] duration-200 data-[state=hidden]:animate-out data-[state=visible]:animate-in", className), "data-slot": "navigation-menu-indicator", ...props, children: _jsx("div", { className: "relative top-[6.5px] size-4 rotate-45 rounded-tl-sm border border-gray-200 border-r-0 border-b-0 bg-white" }) }));
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mobile.d.ts","sourceRoot":"","sources":["../../src/internal/use-mobile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"use-mobile.d.ts","sourceRoot":"","sources":["../../src/internal/use-mobile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,eAEvB,CAAC"}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useMediaQuery } from "phase/react";
|
|
3
3
|
const MOBILE_BREAKPOINT = 768;
|
|
4
4
|
export const useIsMobile = () => {
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
8
|
-
const onChange = () => {
|
|
9
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
10
|
-
};
|
|
11
|
-
mql.addEventListener("change", onChange);
|
|
12
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
13
|
-
return () => mql.removeEventListener("change", onChange);
|
|
14
|
-
}, []);
|
|
15
|
-
return !!isMobile;
|
|
5
|
+
return useMediaQuery(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
16
6
|
};
|
package/dist/layout.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ComponentProps, ReactNode } from "react";
|
|
|
3
3
|
import type { GeistdocsConfig } from "./config";
|
|
4
4
|
import { type GeistdocsSidebarMode } from "./sidebar";
|
|
5
5
|
export declare const GeistdocsProvider: (props: import("./internal/provider-client").GeistdocsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const GeistdocsThemeScript: () => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
interface GeistdocsDocsLayoutProps {
|
|
7
8
|
children: ReactNode;
|
|
8
9
|
config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
|
package/dist/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,OAAO,EAAE,KAAK,oBAAoB,EAA4B,MAAM,WAAW,CAAC;AAEhF,eAAO,MAAM,iBAAiB,iHAA0B,CAAC;AAEzD,eAAO,MAAM,oBAAoB,+CAEhC,CAAC;AAEF,UAAU,wBAAwB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC7E,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,mBAAmB,GAAI,sEAOjC,wBAAwB,4CAkC1B,CAAC"}
|
package/dist/layout.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { GeistThemeScript } from "@vercel/geistcn/core";
|
|
2
3
|
import { DocsLayout as FumadocsDocsLayout } from "fumadocs-ui/layouts/docs";
|
|
3
4
|
import { createGeistdocsI18n } from "./internal/i18n";
|
|
4
5
|
import { GeistdocsProvider as GeistdocsProviderClient } from "./internal/provider-client";
|
|
5
6
|
import { GeistdocsSidebar } from "./internal/sidebar";
|
|
6
7
|
import { GeistdocsSidebarProvider } from "./sidebar";
|
|
7
8
|
export const GeistdocsProvider = GeistdocsProviderClient;
|
|
9
|
+
export const GeistdocsThemeScript = () => (_jsx(GeistThemeScript, { storageKey: "geistdocs-theme" }));
|
|
8
10
|
export const GeistdocsDocsLayout = ({ config, containerProps, sidebarMode, sidebarTop, tree, children, }) => {
|
|
9
11
|
const { i18n } = createGeistdocsI18n(config);
|
|
10
12
|
return (_jsx(GeistdocsSidebarProvider, { children: _jsx(FumadocsDocsLayout, { containerProps: {
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAsB/C,OAAO,EAGL,KAAK,4BAA4B,IAAI,mBAAmB,EAGzD,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,2BAA2B,8EAAe,CAAC;AACxD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAoB,CAAC;AAC5D,eAAO,MAAM,mBAAmB;;;;;;;gCAAa,CAAC;AAC9C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBAiDD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@vercel/geistcn/utils";
|
|
3
|
-
import { IconArrowUpRightSmall } from "@vercel/geistcn-assets/icons";
|
|
4
3
|
import { TypeTable } from "fumadocs-ui/components/type-table";
|
|
5
4
|
import defaultMdxComponents from "fumadocs-ui/mdx";
|
|
6
5
|
import { Blockquote } from "./components/blockquote";
|
|
@@ -18,7 +17,6 @@ export const defineGeistdocsSourceConfig = sourceConfig;
|
|
|
18
17
|
export const geistdocsFrontmatterSchema = frontmatterSchema;
|
|
19
18
|
export const geistdocsMetaSchema = metaSchema;
|
|
20
19
|
export const geistShikiTheme = shikiTheme;
|
|
21
|
-
const HTTP_URL = /^https?:\/\//;
|
|
22
20
|
export const getGeistdocsMDXComponents = (components) => ({
|
|
23
21
|
...defaultMdxComponents,
|
|
24
22
|
h1: (props) => _jsx(Heading, { as: "h1", ...props }),
|
|
@@ -30,7 +28,7 @@ export const getGeistdocsMDXComponents = (components) => ({
|
|
|
30
28
|
pre: CodeBlock,
|
|
31
29
|
blockquote: Blockquote,
|
|
32
30
|
table: Table,
|
|
33
|
-
a: ({ children, className, href, ...props }) => typeof href === "string" && href.startsWith("/") ? (_jsx(LocalizedLink, { className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: href, ...props, children: children })) : (
|
|
31
|
+
a: ({ children, className, href, ...props }) => typeof href === "string" && href.startsWith("/") ? (_jsx(LocalizedLink, { className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: href, ...props, children: children })) : (_jsx("a", { className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: href, ...props, children: children })),
|
|
34
32
|
CodeBlockTabs,
|
|
35
33
|
CompactCodeBlockTabs,
|
|
36
34
|
CodeBlockTabsList,
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,QAAQ,IAAI,gBAAg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