@vercel/geistdocs 1.25.1-canary.bd8995b → 1.25.1-canary.d2f4449

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/components/blockquote.d.ts +3 -0
  3. package/dist/components/blockquote.d.ts.map +1 -0
  4. package/dist/components/blockquote.js +3 -0
  5. package/dist/components/callout.d.ts +13 -10
  6. package/dist/components/callout.d.ts.map +1 -1
  7. package/dist/components/callout.js +6 -6
  8. package/dist/components/code-block-tabs.d.ts.map +1 -1
  9. package/dist/components/code-block-tabs.js +3 -1
  10. package/dist/components/code-block.d.ts.map +1 -1
  11. package/dist/components/code-block.js +1 -1
  12. package/dist/components/command-prompt.d.ts.map +1 -1
  13. package/dist/components/command-prompt.js +15 -22
  14. package/dist/components/copy-prompt.d.ts +2 -1
  15. package/dist/components/copy-prompt.d.ts.map +1 -1
  16. package/dist/components/copy-prompt.js +2 -2
  17. package/dist/components/heading.d.ts +7 -0
  18. package/dist/components/heading.d.ts.map +1 -0
  19. package/dist/components/heading.js +14 -0
  20. package/dist/components/image.d.ts +19 -0
  21. package/dist/components/image.d.ts.map +1 -0
  22. package/dist/components/image.js +9 -0
  23. package/dist/components/table.d.ts +3 -0
  24. package/dist/components/table.d.ts.map +1 -0
  25. package/dist/components/table.js +3 -0
  26. package/dist/controls.d.ts.map +1 -1
  27. package/dist/controls.js +4 -3
  28. package/dist/internal/chat/activity.d.ts +20 -0
  29. package/dist/internal/chat/activity.d.ts.map +1 -0
  30. package/dist/internal/chat/activity.js +43 -0
  31. package/dist/internal/chat/context.d.ts +2 -0
  32. package/dist/internal/chat/context.d.ts.map +1 -1
  33. package/dist/internal/chat/context.js +24 -3
  34. package/dist/internal/chat/dots-spinner.d.ts.map +1 -1
  35. package/dist/internal/chat/dots-spinner.js +15 -9
  36. package/dist/internal/chat/loading-skeleton.d.ts +7 -0
  37. package/dist/internal/chat/loading-skeleton.d.ts.map +1 -0
  38. package/dist/internal/chat/loading-skeleton.js +46 -0
  39. package/dist/internal/chat/message-metadata.d.ts.map +1 -1
  40. package/dist/internal/chat/message-metadata.js +15 -30
  41. package/dist/internal/chat/message-sources.d.ts +3 -0
  42. package/dist/internal/chat/message-sources.d.ts.map +1 -0
  43. package/dist/internal/chat/message-sources.js +23 -0
  44. package/dist/internal/chat/message.d.ts.map +1 -1
  45. package/dist/internal/chat/message.js +59 -5
  46. package/dist/internal/chat/shell.d.ts.map +1 -1
  47. package/dist/internal/chat/shell.js +17 -17
  48. package/dist/internal/chat/source-chunks.d.ts +9 -0
  49. package/dist/internal/chat/source-chunks.d.ts.map +1 -0
  50. package/dist/internal/chat/source-chunks.js +7 -0
  51. package/dist/internal/chat/sources.d.ts +1 -1
  52. package/dist/internal/chat/sources.d.ts.map +1 -1
  53. package/dist/internal/chat/sources.js +7 -1
  54. package/dist/internal/link-href.d.ts +13 -0
  55. package/dist/internal/link-href.d.ts.map +1 -0
  56. package/dist/internal/link-href.js +51 -0
  57. package/dist/internal/mdx-to-markdown.d.ts +3 -0
  58. package/dist/internal/mdx-to-markdown.d.ts.map +1 -0
  59. package/dist/internal/mdx-to-markdown.js +134 -0
  60. package/dist/internal/mousedown-navigation-utils.d.ts +5 -0
  61. package/dist/internal/mousedown-navigation-utils.d.ts.map +1 -0
  62. package/dist/internal/mousedown-navigation-utils.js +95 -0
  63. package/dist/internal/mousedown-navigation.d.ts +10 -0
  64. package/dist/internal/mousedown-navigation.d.ts.map +1 -0
  65. package/dist/internal/mousedown-navigation.js +42 -0
  66. package/dist/internal/navbar/desktop-menu.js +1 -1
  67. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -1
  68. package/dist/internal/navbar/mobile-menu.js +8 -13
  69. package/dist/internal/navbar/navbar-shell.d.ts.map +1 -1
  70. package/dist/internal/navbar/navbar-shell.js +2 -1
  71. package/dist/internal/page-actions-client.d.ts.map +1 -1
  72. package/dist/internal/page-actions-client.js +36 -32
  73. package/dist/internal/provider-client.d.ts.map +1 -1
  74. package/dist/internal/provider-client.js +29 -5
  75. package/dist/internal/react-node-text.d.ts +4 -0
  76. package/dist/internal/react-node-text.d.ts.map +1 -0
  77. package/dist/internal/react-node-text.js +11 -0
  78. package/dist/internal/search.d.ts.map +1 -1
  79. package/dist/internal/search.js +1 -1
  80. package/dist/internal/sidebar-responsive.d.ts +0 -1
  81. package/dist/internal/sidebar-responsive.d.ts.map +1 -1
  82. package/dist/internal/sidebar-responsive.js +0 -9
  83. package/dist/internal/sidebar-tree.d.ts.map +1 -1
  84. package/dist/internal/sidebar-tree.js +6 -1
  85. package/dist/internal/sidebar.d.ts.map +1 -1
  86. package/dist/internal/sidebar.js +78 -49
  87. package/dist/internal/table-of-contents.d.ts.map +1 -1
  88. package/dist/internal/table-of-contents.js +1 -1
  89. package/dist/internal/toc-items.d.ts.map +1 -1
  90. package/dist/internal/toc-items.js +18 -7
  91. package/dist/internal/ui/dropdown-menu.js +6 -6
  92. package/dist/internal/ui/navigation-menu.js +2 -2
  93. package/dist/internal/use-mobile.d.ts.map +1 -1
  94. package/dist/internal/use-mobile.js +2 -12
  95. package/dist/layout.d.ts +1 -0
  96. package/dist/layout.d.ts.map +1 -1
  97. package/dist/layout.js +2 -0
  98. package/dist/mdx.d.ts.map +1 -1
  99. package/dist/mdx.js +15 -1
  100. package/dist/pages/docs.d.ts.map +1 -1
  101. package/dist/pages/docs.js +17 -4
  102. package/dist/routes/chat.d.ts +1 -1
  103. package/dist/routes/chat.d.ts.map +1 -1
  104. package/dist/routes/chat.js +31 -14
  105. package/dist/routes/llms.d.ts +1 -1
  106. package/dist/routes/llms.d.ts.map +1 -1
  107. package/dist/routes/llms.js +12 -2
  108. package/dist/source.d.ts +10 -1
  109. package/dist/source.d.ts.map +1 -1
  110. package/dist/source.js +75 -34
  111. package/dist/versions.js +2 -2
  112. package/docs/agents.md +4 -3
  113. package/docs/llms.txt +378 -37
  114. package/docs/manifest.json +12 -3
  115. package/docs/pages/ask-ai.md +2 -2
  116. package/docs/pages/deployment.md +30 -5
  117. package/docs/pages/getting-started.md +38 -12
  118. package/docs/pages/guides/nested-navigation.md +1 -1
  119. package/docs/pages/md.md +25 -6
  120. package/docs/pages/migration-2.md +106 -0
  121. package/docs/pages/migration.md +5 -2
  122. package/docs/pages/syntax.md +163 -6
  123. package/docs/sitemap.md +3 -2
  124. package/package.json +12 -5
  125. package/template/app/[lang]/layout.tsx +4 -0
  126. package/template/app/styles/geistdocs.css +1 -1
  127. package/template/components/ui/button.tsx +1 -1
  128. package/template/content/docs/ask-ai.cn.mdx +2 -2
  129. package/template/content/docs/ask-ai.mdx +2 -2
  130. package/template/content/docs/deployment.mdx +31 -6
  131. package/template/content/docs/getting-started.mdx +39 -13
  132. package/template/content/docs/guides/nested-navigation.mdx +1 -1
  133. package/template/content/docs/md.mdx +25 -6
  134. package/template/content/docs/meta.json +1 -0
  135. package/template/content/docs/migration-2.mdx +106 -0
  136. package/template/content/docs/migration.mdx +5 -1
  137. package/template/content/docs/syntax.mdx +169 -6
  138. package/template/next.config.ts +9 -0
  139. package/template/package.json +4 -4
  140. package/theme.css +39 -105
@@ -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 { IconArrowUpRight, IconChevronDownSmall, IconChevronRight, } from "@vercel/geistcn-assets/icons";
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 { observeSidebarContainer } from "./sidebar-responsive";
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();
@@ -126,18 +132,19 @@ const useOpenedFolders = (nodes, activeUrl, openFirstLevel, scope) => {
126
132
  };
127
133
  return { manualToggleRef, opened, toggleFolder };
128
134
  };
129
- const SidebarSeparatorRow = ({ depth, item, }) => (_jsxs("li", { className: cn("mt-4 flex items-center gap-2 px-2 pt-2 pb-1 text-gray-900 text-label-13 first:mt-0 [&_svg]:size-4", depth > 0 && "ml-3"), children: [item.icon ? _jsx("span", { className: "shrink-0", children: item.icon }) : null, _jsx("span", { className: "min-w-0 truncate", children: item.name })] }));
135
+ const SidebarSeparatorRow = ({ depth, item, }) => (_jsxs("li", { className: cn("mt-4 flex items-center gap-2 px-2 pt-2 pb-1 font-medium text-gray-900 text-label-13 first:mt-0 [&_svg]:size-4", depth > 0 && "ml-3"), children: [item.icon ? _jsx("span", { className: "shrink-0", children: item.icon }) : null, _jsx("span", { className: "min-w-0 truncate", children: item.name })] }));
130
136
  const SidebarTreeItems = ({ depth, nodes, parentPath, state, }) => (_jsx(_Fragment, { children: nodes.map((node, index) => (_jsx(SidebarTreeNode, { depth: depth, node: node, path: [...parentPath, index], state: state }, getSidebarNodeId(node, [...parentPath, index], state.idScope)))) }));
131
137
  const getSidebarRowTone = (isSelected, isGroup) => {
132
138
  if (isSelected) {
133
- return "bg-gray-200 text-gray-1000 active:bg-gray-300";
139
+ return "bg-gray-200 text-gray-1000";
134
140
  }
135
141
  if (isGroup) {
136
- return "text-gray-1000 hover:bg-gray-alpha-100 focus-visible:bg-gray-alpha-100 active:bg-gray-alpha-300";
142
+ return "text-gray-1000 hover:bg-gray-100 focus-visible:bg-gray-100";
137
143
  }
138
- return "text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000 focus-visible:bg-gray-alpha-100 focus-visible:text-gray-1000 active:bg-gray-alpha-300";
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(_Fragment, { children: expanded ? (_jsx(IconChevronDownSmall, { size: 16 })) : (_jsx(IconChevronRight, { size: 16 })) }));
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,11 +161,13 @@ 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: "flex min-w-0 flex-1 items-center gap-1.5 truncate text-button-14", children: [_jsx(SidebarBadge, { label: badge }), _jsx("span", { className: "min-w-0 flex-1 truncate", id: labelId, children: node.name }), isExternalSidebarItem(item) ? (_jsx(IconArrowUpRight, { className: "ml-auto size-4 shrink-0 text-gray-900" })) : null] })] }));
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
- if (opensOutsideCurrentPage(event, item?.external, item?.url ?? "") ||
161
- !(folder && hasChildren && (isSelected || !isExpanded))) {
167
+ if (opensOutsideCurrentPage(event, item?.external, item?.url ?? "")) {
168
+ return;
169
+ }
170
+ if (!(folder && hasChildren && (isSelected || !isExpanded))) {
162
171
  return;
163
172
  }
164
173
  state.toggleFolder(folder, path);
@@ -168,12 +177,12 @@ const SidebarTreeNode = ({ depth, node, path, state, }) => {
168
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 }));
169
178
  }
170
179
  else if (folder && hasChildren) {
171
- 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("span", { className: "grid size-8 flex-none place-content-center text-gray-900", children: _jsx(SidebarDisclosureIcon, { expanded: isExpanded }) })] }));
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 }) })] }));
172
181
  }
173
182
  else {
174
183
  primaryControl = (_jsx("span", { className: cn(rowClassName, "min-w-0 flex-1"), children: content }));
175
184
  }
176
- return (_jsxs("li", { className: cn("relative flex w-full select-none flex-col items-stretch", depth > 0 && "pl-3"), children: [_jsxs("div", { className: "relative flex w-full items-center gap-px", children: [primaryControl, item && folder && hasChildren ? (_jsx("button", { "aria-controls": menuId, "aria-expanded": isExpanded, "aria-labelledby": labelId, 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-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", onClick: () => state.toggleFolder(folder, path), type: "button", children: _jsx(SidebarDisclosureIcon, { expanded: isExpanded }) })) : null] }), folder && hasChildren && isExpanded ? (_jsx("ul", { className: "relative mt-px mb-1 flex w-full list-none flex-col gap-px p-0", id: menuId, children: _jsx(SidebarTreeItems, { depth: depth + 1, nodes: folder.children, parentPath: path, state: state }) })) : null] }));
185
+ return (_jsxs("li", { className: cn("relative flex w-full select-none flex-col items-stretch", depth > 0 && "pl-3"), children: [_jsxs("div", { className: "relative flex w-full items-center gap-px", children: [primaryControl, item && folder && hasChildren ? (_jsx("button", { "aria-controls": menuId, "aria-expanded": isExpanded, "aria-labelledby": labelId, className: "grid h-9 w-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: () => state.toggleFolder(folder, path), type: "button", children: _jsx(SidebarDisclosureIcon, { expanded: isExpanded }) })) : null] }), folder && hasChildren && isExpanded ? (_jsx("ul", { className: "relative mt-px mb-1 flex w-full list-none flex-col gap-px p-0", id: menuId, children: _jsx(SidebarTreeItems, { depth: depth + 1, nodes: folder.children, parentPath: path, state: state }) })) : null] }));
177
186
  };
178
187
  const SidebarTree = ({ activeUrl, idScope, nodes, onNavigate, openFirstLevel = false, scrollActive = false, visible = true, }) => {
179
188
  const generatedId = useId().replace(UNSAFE_ID_CHARACTERS, "");
@@ -194,7 +203,7 @@ const SidebarTree = ({ activeUrl, idScope, nodes, onNavigate, openFirstLevel = f
194
203
  const SidebarRootList = ({ activeSection, activeUrl, groups, onSelect, visible, }) => {
195
204
  const contentRef = useRef(null);
196
205
  useActiveItemScroll(contentRef, activeUrl, visible, activeSection?.$id ?? "root");
197
- return (_jsx("div", { className: "flex flex-col gap-4 px-2 pt-1 pb-2", ref: contentRef, children: groups.map((group) => (_jsxs("div", { className: "flex flex-col", children: [group.label || group.icon ? (_jsxs("div", { className: "flex items-center gap-2 px-2 pt-2 pb-1 text-gray-900 text-label-13 [&_svg]:size-4", children: [group.icon ? (_jsx("span", { className: "shrink-0", children: group.icon })) : null, _jsx("span", { className: "min-w-0 truncate", children: group.label })] })) : null, _jsx("ul", { className: "m-0 flex list-none flex-col gap-px p-0", children: group.items.map((section, index) => (_jsx(SidebarRootItem, { activeSection: activeSection, activeUrl: activeUrl, item: section, onSelect: onSelect }, getSidebarNodeId(section, [index])))) })] }, group.id))) }));
206
+ return (_jsx("div", { className: "flex flex-col gap-4 px-2 pt-1 pb-2", ref: contentRef, children: groups.map((group) => (_jsxs("div", { className: "flex flex-col", children: [group.label || group.icon ? (_jsxs("div", { className: "flex items-center gap-2 px-2 pt-2 pb-1 font-medium text-gray-900 text-label-13 [&_svg]:size-4", children: [group.icon ? (_jsx("span", { className: "shrink-0", children: group.icon })) : null, _jsx("span", { className: "min-w-0 truncate", children: group.label })] })) : null, _jsx("ul", { className: "m-0 flex list-none flex-col gap-px p-0", children: group.items.map((section, index) => (_jsx(SidebarRootItem, { activeSection: activeSection, activeUrl: activeUrl, item: section, onSelect: onSelect }, getSidebarNodeId(section, [index])))) })] }, group.id))) }));
198
207
  };
199
208
  const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
200
209
  const folder = item.type === "folder" ? item : null;
@@ -204,10 +213,11 @@ const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
204
213
  const separateDisclosure = hasSeparateRootDisclosure(item);
205
214
  const isCurrentPage = linkItem?.url === activeUrl;
206
215
  const isActive = item === activeSection || isCurrentPage;
216
+ const labelWeight = { folder: "font-medium", page: "font-normal" }[item.type];
207
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
208
- ? "bg-gray-200 text-gray-1000 active:bg-gray-300"
209
- : "text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000 active:bg-gray-alpha-300");
210
- 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: "min-w-0 flex-1 truncate text-button-14", children: item.name }), isExternalSidebarItem(linkItem) ? (_jsx(IconArrowUpRight, { className: "size-4 shrink-0 text-gray-900" })) : null, opensSection && !separateDisclosure ? (_jsx(IconChevronRight, { className: "shrink-0 text-gray-900", size: 16 })) : null] }));
218
+ ? "bg-gray-200 text-gray-1000"
219
+ : "text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100");
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] }));
211
221
  let renderedItem;
212
222
  if (linkItem) {
213
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
@@ -224,9 +234,9 @@ const SidebarRootItem = ({ activeSection, activeUrl, item, onSelect, }) => {
224
234
  else {
225
235
  renderedItem = _jsx("span", { className: className, children: content });
226
236
  }
227
- 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-alpha-100 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", onClick: (event) => onSelect(item, event.currentTarget), type: "button", children: _jsx(IconChevronRight, { size: 16 }) })) : null] }));
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] }));
228
238
  };
229
- 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-alpha-100 hover:text-gray-1000 focus-visible:bg-gray-alpha-100 focus-visible:text-gray-1000 focus-visible:shadow-[var(--ds-focus-ring)] focus-visible:outline-none active:bg-gray-alpha-300 motion-reduce:transition-none", onClick: onBack, ref: buttonRef, type: "button", children: [_jsx("span", { className: "grid size-9 flex-none place-content-center", children: _jsx(IconChevronRight, { 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" })] }) }));
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" })] }) }));
230
240
  const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
231
241
  const groups = useMemo(() => getSidebarRootGroups(nodes), [nodes]);
232
242
  const currentSection = useMemo(() => findActiveRootSection(nodes, activeUrl), [activeUrl, nodes]);
@@ -235,6 +245,14 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
235
245
  const [view, setView] = useState(currentSection ? "section" : "root");
236
246
  const [sectionRevealed, setSectionRevealed] = useState(view === "section");
237
247
  const navRef = useRef(null);
248
+ useSize({
249
+ onResize: () => {
250
+ if (navRef.current) {
251
+ updateSidebarFades(navRef.current);
252
+ }
253
+ },
254
+ ref: navRef,
255
+ });
238
256
  const returnFocusRef = useRef(null);
239
257
  const sectionHeaderRef = useRef(null);
240
258
  const shouldFocusRootRef = useRef(false);
@@ -260,17 +278,24 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
260
278
  if (!nav) {
261
279
  return;
262
280
  }
263
- const updateFades = () => {
264
- nav.dataset.fadeTop = String(nav.scrollTop > 0);
265
- nav.dataset.fadeBottom = String(nav.scrollTop + nav.clientHeight < nav.scrollHeight - 1);
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
+ });
266
291
  };
267
- const resizeObserver = new ResizeObserver(updateFades);
268
292
  updateFades();
269
- nav.addEventListener("scroll", updateFades, { passive: true });
270
- resizeObserver.observe(nav);
293
+ nav.addEventListener("scroll", scheduleFadeUpdate, { passive: true });
271
294
  return () => {
272
- nav.removeEventListener("scroll", updateFades);
273
- resizeObserver.disconnect();
295
+ if (frame !== undefined) {
296
+ cancelAnimationFrame(frame);
297
+ }
298
+ nav.removeEventListener("scroll", scheduleFadeUpdate);
274
299
  };
275
300
  }, []);
276
301
  const sectionShown = view === "section" && sectionRevealed;
@@ -291,31 +316,39 @@ const DesktopSectionsSidebar = ({ activeUrl, nodes, rootScope, top, }) => {
291
316
  shouldFocusRootRef.current = false;
292
317
  }
293
318
  }, [sectionShown]);
294
- 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 &&
295
- "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) => {
296
- returnFocusRef.current = trigger;
297
- shouldFocusSectionRef.current = true;
298
- setSelectedSection(section);
299
- setView("section");
300
- }, visible: !rootHidden }) }), activeSection ? (_jsxs("div", { className: cn("geistdocs-sidebar-pane", sectionHidden &&
301
- "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: () => {
302
- shouldFocusRootRef.current = true;
303
- setSelectedSection(null);
304
- setView("root");
305
- }, section: activeSection }), _jsx("div", { className: "px-2", children: _jsx(SidebarTree, { activeUrl: activeUrl, idScope: sectionScope, nodes: sectionItems, openFirstLevel: true, scrollActive: true, visible: !sectionHidden }) })] })) : null] })] }) }) }));
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] })] }) }) }) }));
306
331
  };
307
- 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 })] }) }) }) }));
308
333
  const DesktopSidebar = ({ mode, ...props }) => {
309
334
  if (mode === "tree") {
310
335
  return _jsx(DesktopTreeSidebar, { ...props });
311
336
  }
312
337
  return _jsx(DesktopSectionsSidebar, { ...props });
313
338
  };
314
- 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 })] }) })] }) }));
315
340
  export const GeistdocsSidebar = ({ mode = "sections", showDesktop = true, top, }) => {
316
341
  const { root, full } = useTreeContext();
317
342
  const { isOpen, setIsOpen } = useGeistdocsSidebar();
318
- const containerMarkerRef = useRef(null);
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
+ });
319
352
  const pathname = usePathname();
320
353
  const previousPathname = useRef(pathname);
321
354
  const params = useParams();
@@ -331,12 +364,8 @@ export const GeistdocsSidebar = ({ mode = "sections", showDesktop = true, top, }
331
364
  previousPathname.current = pathname;
332
365
  }
333
366
  }, [pathname, setIsOpen]);
334
- useEffect(() => {
335
- const container = containerMarkerRef.current?.closest("[data-geistdocs-container]");
336
- if (!container) {
337
- return;
338
- }
339
- return observeSidebarContainer(container, () => setIsOpen(false));
340
- }, [setIsOpen]);
341
- 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 })] }));
342
371
  };
@@ -1 +1 @@
1
- {"version":3,"file":"table-of-contents.d.ts","sourceRoot":"","sources":["../../src/internal/table-of-contents.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,6BAA6B;IACrC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,GAAG,EAAE,eAAe,CAAC;CACtB;AAED,eAAO,MAAM,wBAAwB,GAAI,0BAItC,6BAA6B,4CAqB/B,CAAC"}
1
+ {"version":3,"file":"table-of-contents.d.ts","sourceRoot":"","sources":["../../src/internal/table-of-contents.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,6BAA6B;IACrC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,GAAG,EAAE,eAAe,CAAC;CACtB;AAED,eAAO,MAAM,wBAAwB,GAAI,0BAItC,6BAA6B,4CAwB/B,CAAC"}
@@ -2,4 +2,4 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { TOCScrollArea } from "fumadocs-ui/components/toc/index";
4
4
  import { TOCItems } from "./toc-items";
5
- export const GeistdocsTableOfContents = ({ footer, header, toc, }) => (_jsx("aside", { "aria-label": "Page navigation", className: "sticky top-(--fd-docs-row-1) hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] w-(--fd-toc-width) flex-col pt-14 pr-4 pb-2 [grid-area:toc] xl:flex", id: "nd-toc", children: _jsxs("nav", { "aria-label": "On this page", className: "flex min-h-0 flex-1 flex-col", children: [header, toc.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "mb-2 font-medium text-gray-1000 text-sm", children: "On this page" }), _jsx(TOCScrollArea, { className: "geistdocs-toc-scroll", children: _jsx(TOCItems, {}) })] })) : null, footer] }) }));
5
+ export const GeistdocsTableOfContents = ({ footer, header, toc, }) => (_jsx("aside", { "aria-label": "Page navigation", className: "sticky top-(--fd-docs-row-1) hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] w-(--fd-toc-width) flex-col pt-14 pr-4 pb-2 [grid-area:toc] xl:flex", id: "nd-toc", children: _jsxs("nav", { "aria-label": "On this page", className: "ml-0.5 flex min-h-0 flex-1 flex-col", children: [header, toc.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "mb-2 font-medium text-gray-1000 text-sm", children: "On this page" }), _jsx(TOCScrollArea, { className: "geistdocs-toc-scroll", children: _jsx(TOCItems, {}) })] })) : null, footer] }) }));
@@ -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,4CAiFtE,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;AAuCf,eAAO,MAAM,QAAQ,GAAI,yBAAyB,cAAc,CAAC,KAAK,CAAC,4CA2FtE,CAAC"}
@@ -4,6 +4,7 @@ import { cn } from "@vercel/geistcn/utils";
4
4
  import { TOCItem as TOCItemLink, useActiveAnchors, } from "fumadocs-core/toc";
5
5
  import { useTOCItems } from "fumadocs-ui/components/toc/index";
6
6
  import { useCallback, useEffect, useRef, useState, } from "react";
7
+ import { reactNodeToText } from "./react-node-text";
7
8
  // Text indentation per heading depth; the guide rail stays straight.
8
9
  const getItemOffset = (depth) => {
9
10
  if (depth <= 2) {
@@ -17,7 +18,7 @@ const getItemOffset = (depth) => {
17
18
  // Ignore programmatic scrolling this long after a click/deep-link so the jump
18
19
  // to the anchor does not immediately release the selection.
19
20
  const ANCHOR_SCROLL_MS = 600;
20
- const TOCItem = ({ item, active, onSelect, }) => (_jsx(TOCItemLink, { className: "prose wrap-anywhere border-fd-foreground/10 border-s py-1.5 text-gray-900 text-sm transition-colors first:pt-0 last:pb-0 hover:text-fd-accent-foreground data-[active=true]:border-fd-primary data-[active=true]:text-fd-primary", "data-active": active ? "true" : undefined, href: item.url, onClick: onSelect, style: { paddingInlineStart: getItemOffset(item.depth) }, children: item.title }));
21
+ const TOCItem = ({ item, active, onSelect, }) => (_jsx(TOCItemLink, { className: "prose wrap-anywhere border-fd-foreground/10 border-s py-1.5 text-gray-900 text-sm transition-colors first:pt-0 last:pb-0 hover:text-fd-accent-foreground data-[active=true]:border-fd-primary data-[active=true]:text-fd-primary", "data-active": active ? "true" : undefined, href: item.url, onClick: onSelect, style: { paddingInlineStart: getItemOffset(item.depth) }, children: reactNodeToText(item.title) }));
21
22
  export const TOCItems = ({ className, ...props }) => {
22
23
  const items = useTOCItems();
23
24
  const anchors = useActiveAnchors();
@@ -40,6 +41,7 @@ export const TOCItems = ({ className, ...props }) => {
40
41
  }, ANCHOR_SCROLL_MS);
41
42
  }, []);
42
43
  useEffect(() => {
44
+ let frame;
43
45
  const syncFromHash = () => select(window.location.hash.slice(1) || null);
44
46
  const updateAtBottom = () => {
45
47
  const doc = document.documentElement;
@@ -50,21 +52,30 @@ export const TOCItems = ({ className, ...props }) => {
50
52
  // Any real scroll — wheel, touch, keyboard, or scrollbar drag — hands the
51
53
  // indicator back to viewport-based tracking, unless it is the programmatic
52
54
  // jump from a click/deep-link.
53
- const onScroll = () => {
54
- updateAtBottom();
55
- if (!ignoreScroll.current) {
56
- setSelected(null);
55
+ const scheduleScrollUpdate = () => {
56
+ if (frame !== undefined) {
57
+ return;
57
58
  }
59
+ frame = requestAnimationFrame(() => {
60
+ frame = undefined;
61
+ updateAtBottom();
62
+ if (!ignoreScroll.current) {
63
+ setSelected(null);
64
+ }
65
+ });
58
66
  };
59
67
  syncFromHash();
60
68
  updateAtBottom();
61
69
  window.addEventListener("hashchange", syncFromHash);
62
- window.addEventListener("scroll", onScroll, { passive: true });
70
+ window.addEventListener("scroll", scheduleScrollUpdate, { passive: true });
63
71
  window.addEventListener("resize", updateAtBottom);
64
72
  return () => {
65
73
  clearTimeout(ignoreTimer.current);
74
+ if (frame !== undefined) {
75
+ cancelAnimationFrame(frame);
76
+ }
66
77
  window.removeEventListener("hashchange", syncFromHash);
67
- window.removeEventListener("scroll", onScroll);
78
+ window.removeEventListener("scroll", scheduleScrollUpdate);
68
79
  window.removeEventListener("resize", updateAtBottom);
69
80
  };
70
81
  }, [select]);
@@ -10,10 +10,10 @@ export function DropdownMenuTrigger(props) {
10
10
  return (_jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props }));
11
11
  }
12
12
  export function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
13
- return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 material-menu z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-y-auto overflow-x-hidden overscroll-contain p-1 text-gray-1000 data-[state=closed]:animate-out motion-reduce:animate-none", className), "data-slot": "dropdown-menu-content", sideOffset: sideOffset, ...props }) }));
13
+ return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 material-menu z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-y-auto overflow-x-hidden overscroll-contain p-(--ds-popover-padding) text-gray-1000 data-[state=closed]:animate-out motion-reduce:animate-none", className), "data-slot": "dropdown-menu-content", sideOffset: sideOffset, ...props }) }));
14
14
  }
15
15
  export function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
16
- return (_jsx(DropdownMenuPrimitive.Item, { className: cn("data-[variant=destructive]:*:[svg]:!text-red-800 relative flex cursor-default touch-manipulation select-none items-center gap-2 rounded-sm px-2 py-1.5 text-label-14 outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[variant=destructive]:text-red-800 data-[disabled]:opacity-50 data-[variant=destructive]:focus:bg-red-800/10 data-[variant=destructive]:focus:text-red-800 dark:data-[variant=destructive]:focus:bg-red-800/20 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-gray-900 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-inset": inset, "data-slot": "dropdown-menu-item", "data-variant": variant, ...props }));
16
+ return (_jsx(DropdownMenuPrimitive.Item, { className: cn("data-[variant=destructive]:*:[svg]:!text-red-800 relative flex cursor-default touch-manipulation select-none items-center gap-2 rounded-(--ds-popover-row-radius) px-2 py-1.5 text-label-14 outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[variant=destructive]:text-red-800 data-[disabled]:opacity-50 data-[variant=destructive]:focus:bg-red-800/10 data-[variant=destructive]:focus:text-red-800 dark:data-[variant=destructive]:focus:bg-red-800/20 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-gray-900 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-inset": inset, "data-slot": "dropdown-menu-item", "data-variant": variant, ...props }));
17
17
  }
18
18
  export function DropdownMenuLabel({ className, inset, ...props }) {
19
19
  return (_jsx(DropdownMenuPrimitive.Label, { className: cn("px-2 py-1.5 font-medium text-sm data-[inset]:pl-8", className), "data-inset": inset, "data-slot": "dropdown-menu-label", ...props }));
@@ -22,20 +22,20 @@ export function DropdownMenuSeparator({ className, ...props }) {
22
22
  return (_jsx(DropdownMenuPrimitive.Separator, { className: cn("-mx-1 my-1 h-px bg-gray-alpha-400", className), "data-slot": "dropdown-menu-separator", ...props }));
23
23
  }
24
24
  export function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
25
- return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { checked: checked, className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-slot": "dropdown-menu-checkbox-item", ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(IconCheck, { className: "size-4" }) }) }), children] }));
25
+ return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { checked: checked, className: cn("relative flex cursor-default select-none items-center gap-2 rounded-(--ds-popover-row-radius) py-1.5 pr-2 pl-8 text-sm outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-slot": "dropdown-menu-checkbox-item", ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(IconCheck, { className: "size-4" }) }) }), children] }));
26
26
  }
27
27
  export function DropdownMenuRadioGroup(props) {
28
28
  return (_jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props }));
29
29
  }
30
30
  export function DropdownMenuRadioItem({ className, children, ...props }) {
31
- return (_jsxs(DropdownMenuPrimitive.RadioItem, { className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-slot": "dropdown-menu-radio-item", ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(IconCircle, { className: "size-2 fill-current" }) }) }), children] }));
31
+ return (_jsxs(DropdownMenuPrimitive.RadioItem, { className: cn("relative flex cursor-default select-none items-center gap-2 rounded-(--ds-popover-row-radius) py-1.5 pr-2 pl-8 text-sm outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-slot": "dropdown-menu-radio-item", ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(IconCircle, { className: "size-2 fill-current" }) }) }), children] }));
32
32
  }
33
33
  export function DropdownMenuSub(props) {
34
34
  return _jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
35
35
  }
36
36
  export function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
37
- return (_jsxs(DropdownMenuPrimitive.SubTrigger, { className: cn("flex cursor-default touch-manipulation select-none items-center gap-2 rounded-sm px-2 py-1.5 text-label-14 outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[state=open]:bg-gray-100 data-[inset]:pl-8 data-[state=open]:text-gray-1000 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-gray-900 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-inset": inset, "data-slot": "dropdown-menu-sub-trigger", ...props, children: [children, _jsx(IconChevronRight, { className: "ml-auto size-4" })] }));
37
+ return (_jsxs(DropdownMenuPrimitive.SubTrigger, { className: cn("flex cursor-default touch-manipulation select-none items-center gap-2 rounded-(--ds-popover-row-radius) px-2 py-1.5 text-label-14 outline-hidden focus:bg-gray-100 focus:text-gray-1000 data-[state=open]:bg-gray-100 data-[inset]:pl-8 data-[state=open]:text-gray-1000 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-gray-900 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), "data-inset": inset, "data-slot": "dropdown-menu-sub-trigger", ...props, children: [children, _jsx(IconChevronRight, { className: "ml-auto size-4" })] }));
38
38
  }
39
39
  export function DropdownMenuSubContent({ className, ...props }) {
40
- return (_jsx(DropdownMenuPrimitive.SubContent, { className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 material-menu z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden overscroll-contain p-1 text-gray-1000 data-[state=closed]:animate-out motion-reduce:animate-none", className), "data-slot": "dropdown-menu-sub-content", ...props }));
40
+ return (_jsx(DropdownMenuPrimitive.SubContent, { className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 material-menu z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden overscroll-contain p-(--ds-popover-padding) text-gray-1000 data-[state=closed]:animate-out motion-reduce:animate-none", className), "data-slot": "dropdown-menu-sub-content", ...props }));
41
41
  }
@@ -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-all 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" })] }));
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-all 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" }) }));
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,eAgBvB,CAAC"}
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 { useEffect, useState } from "react";
2
+ import { useMediaQuery } from "phase/react";
3
3
  const MOBILE_BREAKPOINT = 768;
4
4
  export const useIsMobile = () => {
5
- const [isMobile, setIsMobile] = useState(undefined);
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">;
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.tsx"],"names":[],"mappings":"AAAA,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,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"}
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":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAmB/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,sBA+BD,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"}
1
+ {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAuB/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,sBAkDD,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,11 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@vercel/geistcn/utils";
2
3
  import { TypeTable } from "fumadocs-ui/components/type-table";
3
4
  import defaultMdxComponents from "fumadocs-ui/mdx";
5
+ import { Blockquote } from "./components/blockquote";
4
6
  import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from "./components/callout";
5
7
  import { CodeBlock } from "./components/code-block";
6
8
  import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, } from "./components/code-block-tabs";
7
9
  import { CopyPrompt } from "./components/copy-prompt";
10
+ import { Heading } from "./components/heading";
11
+ import { Image } from "./components/image";
8
12
  import { Mermaid } from "./components/mermaid";
13
+ import { Table } from "./components/table";
9
14
  import { Video } from "./components/video";
10
15
  import { LocalizedLink } from "./internal/localized-link";
11
16
  import { geistdocsFrontmatterSchema as frontmatterSchema, geistdocsMetaSchema as metaSchema, geistShikiTheme as shikiTheme, defineGeistdocsSourceConfig as sourceConfig, } from "./source-config";
@@ -15,8 +20,16 @@ export const geistdocsMetaSchema = metaSchema;
15
20
  export const geistShikiTheme = shikiTheme;
16
21
  export const getGeistdocsMDXComponents = (components) => ({
17
22
  ...defaultMdxComponents,
23
+ h1: (props) => _jsx(Heading, { as: "h1", ...props }),
24
+ h2: (props) => _jsx(Heading, { as: "h2", ...props }),
25
+ h3: (props) => _jsx(Heading, { as: "h3", ...props }),
26
+ h4: (props) => _jsx(Heading, { as: "h4", ...props }),
27
+ h5: (props) => _jsx(Heading, { as: "h5", ...props }),
28
+ h6: (props) => _jsx(Heading, { as: "h6", ...props }),
18
29
  pre: CodeBlock,
19
- a: ({ href, ...props }) => typeof href === "string" && href.startsWith("/") ? (_jsx(LocalizedLink, { className: "font-normal text-gray-1000 no-underline", href: href, ...props })) : (_jsx("a", { href: href, ...props, className: "font-normal text-gray-1000 no-underline" })),
30
+ blockquote: Blockquote,
31
+ table: Table,
32
+ 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 })),
20
33
  CodeBlockTabs,
21
34
  CompactCodeBlockTabs,
22
35
  CodeBlockTabsList,
@@ -28,6 +41,7 @@ export const getGeistdocsMDXComponents = (components) => ({
28
41
  CalloutTitle,
29
42
  CalloutDescription,
30
43
  CopyPrompt,
44
+ Image,
31
45
  Mermaid,
32
46
  Video,
33
47
  ...components,
@@ -1 +1 @@
1
- {"version":3,"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