@vx-oss/docs-react 1.0.3

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 (262) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/css/aspen.css +39 -0
  4. package/css/black.css +39 -0
  5. package/css/catppuccin.css +49 -0
  6. package/css/dusk.css +47 -0
  7. package/css/emerald.css +39 -0
  8. package/css/generated/docs.css +1 -0
  9. package/css/generated/flux.css +1 -0
  10. package/css/generated/glass.css +1 -0
  11. package/css/generated/home.css +1 -0
  12. package/css/generated/notebook.css +1 -0
  13. package/css/generated/shared.css +1 -0
  14. package/css/lib/base.css +296 -0
  15. package/css/lib/default-colors.css +51 -0
  16. package/css/lib/shiki.css +108 -0
  17. package/css/neutral.css +7 -0
  18. package/css/ocean.css +44 -0
  19. package/css/preset-legacy.css +43 -0
  20. package/css/preset.css +11 -0
  21. package/css/purple.css +39 -0
  22. package/css/ruby.css +39 -0
  23. package/css/shadcn.css +36 -0
  24. package/css/solar.css +65 -0
  25. package/css/style.css +9 -0
  26. package/css/vitepress.css +72 -0
  27. package/dist/.translations/index.d.ts +55 -0
  28. package/dist/.translations/keys.js +55 -0
  29. package/dist/_virtual/_rolldown/runtime.js +13 -0
  30. package/dist/components/accordion.d.ts +10 -0
  31. package/dist/components/accordion.js +68 -0
  32. package/dist/components/banner.d.ts +25 -0
  33. package/dist/components/banner.js +85 -0
  34. package/dist/components/callout.d.ts +21 -0
  35. package/dist/components/callout.js +60 -0
  36. package/dist/components/card.d.ts +13 -0
  37. package/dist/components/card.js +39 -0
  38. package/dist/components/codeblock.d.ts +45 -0
  39. package/dist/components/codeblock.js +126 -0
  40. package/dist/components/codeblock.rsc.d.ts +15 -0
  41. package/dist/components/codeblock.rsc.js +22 -0
  42. package/dist/components/dialog/search-algolia.d.ts +27 -0
  43. package/dist/components/dialog/search-algolia.js +64 -0
  44. package/dist/components/dialog/search-default.d.ts +29 -0
  45. package/dist/components/dialog/search-default.js +66 -0
  46. package/dist/components/dialog/search-orama.d.ts +32 -0
  47. package/dist/components/dialog/search-orama.js +69 -0
  48. package/dist/components/dialog/search.d.ts +76 -0
  49. package/dist/components/dialog/search.js +351 -0
  50. package/dist/components/dynamic-codeblock.core.d.ts +26 -0
  51. package/dist/components/dynamic-codeblock.core.js +51 -0
  52. package/dist/components/dynamic-codeblock.d.ts +8 -0
  53. package/dist/components/dynamic-codeblock.js +17 -0
  54. package/dist/components/files.d.ts +21 -0
  55. package/dist/components/files.js +40 -0
  56. package/dist/components/github-info.d.ts +20 -0
  57. package/dist/components/github-info.js +75 -0
  58. package/dist/components/heading.d.ts +9 -0
  59. package/dist/components/heading.js +38 -0
  60. package/dist/components/image-zoom.d.ts +18 -0
  61. package/dist/components/image-zoom.js +32 -0
  62. package/dist/components/image-zoom2.css +71 -0
  63. package/dist/components/inline-toc.d.ts +10 -0
  64. package/dist/components/inline-toc.js +28 -0
  65. package/dist/components/sidebar/base.d.ts +85 -0
  66. package/dist/components/sidebar/base.js +277 -0
  67. package/dist/components/sidebar/link-item.d.ts +12 -0
  68. package/dist/components/sidebar/link-item.js +37 -0
  69. package/dist/components/sidebar/page-tree.d.ts +20 -0
  70. package/dist/components/sidebar/page-tree.js +69 -0
  71. package/dist/components/sidebar/tabs/dropdown.d.ts +15 -0
  72. package/dist/components/sidebar/tabs/dropdown.js +83 -0
  73. package/dist/components/sidebar/tabs/index.d.ts +8 -0
  74. package/dist/components/sidebar/tabs/index.js +46 -0
  75. package/dist/components/steps.d.ts +10 -0
  76. package/dist/components/steps.js +16 -0
  77. package/dist/components/tabs.d.ts +33 -0
  78. package/dist/components/tabs.js +95 -0
  79. package/dist/components/toc/clerk.d.ts +11 -0
  80. package/dist/components/toc/clerk.js +227 -0
  81. package/dist/components/toc/default.d.ts +13 -0
  82. package/dist/components/toc/default.js +260 -0
  83. package/dist/components/toc/index.d.ts +10 -0
  84. package/dist/components/toc/index.js +45 -0
  85. package/dist/components/type-table.d.ts +37 -0
  86. package/dist/components/type-table.js +117 -0
  87. package/dist/components/ui/accordion.d.ts +10 -0
  88. package/dist/components/ui/accordion.js +42 -0
  89. package/dist/components/ui/button.d.ts +10 -0
  90. package/dist/components/ui/button.js +20 -0
  91. package/dist/components/ui/collapsible.d.ts +11 -0
  92. package/dist/components/ui/collapsible.js +21 -0
  93. package/dist/components/ui/navigation-menu.d.ts +14 -0
  94. package/dist/components/ui/navigation-menu.js +41 -0
  95. package/dist/components/ui/popover.d.ts +9 -0
  96. package/dist/components/ui/popover.js +20 -0
  97. package/dist/components/ui/scroll-area.d.ts +9 -0
  98. package/dist/components/ui/scroll-area.js +34 -0
  99. package/dist/components/ui/tabs.d.ts +23 -0
  100. package/dist/components/ui/tabs.js +102 -0
  101. package/dist/contexts/i18n.d.ts +34 -0
  102. package/dist/contexts/i18n.js +37 -0
  103. package/dist/contexts/search.d.ts +64 -0
  104. package/dist/contexts/search.js +68 -0
  105. package/dist/contexts/tree.d.ts +29 -0
  106. package/dist/contexts/tree.js +91 -0
  107. package/dist/i18n.d.ts +15 -0
  108. package/dist/i18n.js +38 -0
  109. package/dist/layouts/docs/client.d.ts +33 -0
  110. package/dist/layouts/docs/client.js +94 -0
  111. package/dist/layouts/docs/index.d.ts +32 -0
  112. package/dist/layouts/docs/index.js +23 -0
  113. package/dist/layouts/docs/page/index.d.ts +76 -0
  114. package/dist/layouts/docs/page/index.js +124 -0
  115. package/dist/layouts/docs/page/slots/breadcrumb.d.ts +7 -0
  116. package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
  117. package/dist/layouts/docs/page/slots/container.d.ts +5 -0
  118. package/dist/layouts/docs/page/slots/container.js +22 -0
  119. package/dist/layouts/docs/page/slots/footer.d.ts +16 -0
  120. package/dist/layouts/docs/page/slots/footer.js +56 -0
  121. package/dist/layouts/docs/page/slots/toc.d.ts +47 -0
  122. package/dist/layouts/docs/page/slots/toc.js +182 -0
  123. package/dist/layouts/docs/slots/container.d.ts +5 -0
  124. package/dist/layouts/docs/slots/container.js +36 -0
  125. package/dist/layouts/docs/slots/header.d.ts +5 -0
  126. package/dist/layouts/docs/slots/header.js +38 -0
  127. package/dist/layouts/docs/slots/sidebar.d.ts +22 -0
  128. package/dist/layouts/docs/slots/sidebar.js +268 -0
  129. package/dist/layouts/flux/index.d.ts +61 -0
  130. package/dist/layouts/flux/index.js +146 -0
  131. package/dist/layouts/flux/page/index.d.ts +67 -0
  132. package/dist/layouts/flux/page/index.js +104 -0
  133. package/dist/layouts/flux/page/slots/breadcrumb.d.ts +7 -0
  134. package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
  135. package/dist/layouts/flux/page/slots/container.d.ts +5 -0
  136. package/dist/layouts/flux/page/slots/container.js +22 -0
  137. package/dist/layouts/flux/page/slots/footer.d.ts +16 -0
  138. package/dist/layouts/flux/page/slots/footer.js +56 -0
  139. package/dist/layouts/flux/page/slots/toc.d.ts +29 -0
  140. package/dist/layouts/flux/page/slots/toc.js +181 -0
  141. package/dist/layouts/flux/slots/container.d.ts +5 -0
  142. package/dist/layouts/flux/slots/container.js +13 -0
  143. package/dist/layouts/flux/slots/sidebar.d.ts +16 -0
  144. package/dist/layouts/flux/slots/sidebar.js +243 -0
  145. package/dist/layouts/flux/slots/tab-dropdown.d.ts +10 -0
  146. package/dist/layouts/flux/slots/tab-dropdown.js +88 -0
  147. package/dist/layouts/glass/index.d.ts +39 -0
  148. package/dist/layouts/glass/index.js +70 -0
  149. package/dist/layouts/glass/layout-tabs.js +54 -0
  150. package/dist/layouts/glass/page/index.d.ts +31 -0
  151. package/dist/layouts/glass/page/index.js +92 -0
  152. package/dist/layouts/glass/page/slots/breadcrumb.d.ts +7 -0
  153. package/dist/layouts/glass/page/slots/breadcrumb.js +44 -0
  154. package/dist/layouts/glass/page/slots/footer.d.ts +16 -0
  155. package/dist/layouts/glass/page/slots/footer.js +56 -0
  156. package/dist/layouts/glass/page/slots/toc.d.ts +19 -0
  157. package/dist/layouts/glass/page/slots/toc.js +108 -0
  158. package/dist/layouts/glass/slots/header.d.ts +6 -0
  159. package/dist/layouts/glass/slots/header.js +68 -0
  160. package/dist/layouts/glass/slots/sidebar.d.ts +21 -0
  161. package/dist/layouts/glass/slots/sidebar.js +267 -0
  162. package/dist/layouts/home/index.d.ts +27 -0
  163. package/dist/layouts/home/index.js +40 -0
  164. package/dist/layouts/home/navbar.d.ts +9 -0
  165. package/dist/layouts/home/navbar.js +34 -0
  166. package/dist/layouts/home/not-found.d.ts +7 -0
  167. package/dist/layouts/home/not-found.js +41 -0
  168. package/dist/layouts/home/slots/container.d.ts +5 -0
  169. package/dist/layouts/home/slots/container.js +13 -0
  170. package/dist/layouts/home/slots/header.d.ts +8 -0
  171. package/dist/layouts/home/slots/header.js +239 -0
  172. package/dist/layouts/notebook/client.d.ts +35 -0
  173. package/dist/layouts/notebook/client.js +69 -0
  174. package/dist/layouts/notebook/index.d.ts +26 -0
  175. package/dist/layouts/notebook/index.js +23 -0
  176. package/dist/layouts/notebook/page/index.d.ts +76 -0
  177. package/dist/layouts/notebook/page/index.js +124 -0
  178. package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +7 -0
  179. package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
  180. package/dist/layouts/notebook/page/slots/container.d.ts +5 -0
  181. package/dist/layouts/notebook/page/slots/container.js +22 -0
  182. package/dist/layouts/notebook/page/slots/footer.d.ts +16 -0
  183. package/dist/layouts/notebook/page/slots/footer.js +56 -0
  184. package/dist/layouts/notebook/page/slots/toc.d.ts +47 -0
  185. package/dist/layouts/notebook/page/slots/toc.js +181 -0
  186. package/dist/layouts/notebook/slots/container.d.ts +5 -0
  187. package/dist/layouts/notebook/slots/container.js +38 -0
  188. package/dist/layouts/notebook/slots/header.d.ts +5 -0
  189. package/dist/layouts/notebook/slots/header.js +204 -0
  190. package/dist/layouts/notebook/slots/sidebar.d.ts +23 -0
  191. package/dist/layouts/notebook/slots/sidebar.js +240 -0
  192. package/dist/layouts/shared/client.d.ts +37 -0
  193. package/dist/layouts/shared/client.js +85 -0
  194. package/dist/layouts/shared/index.d.ts +169 -0
  195. package/dist/layouts/shared/index.js +98 -0
  196. package/dist/layouts/shared/page-actions.d.ts +27 -0
  197. package/dist/layouts/shared/page-actions.js +199 -0
  198. package/dist/layouts/shared/slots/language-select.d.ts +12 -0
  199. package/dist/layouts/shared/slots/language-select.js +43 -0
  200. package/dist/layouts/shared/slots/search-trigger.d.ts +13 -0
  201. package/dist/layouts/shared/slots/search-trigger.js +53 -0
  202. package/dist/layouts/shared/slots/theme-switch.d.ts +8 -0
  203. package/dist/layouts/shared/slots/theme-switch.js +70 -0
  204. package/dist/legacy/layout.d.ts +29 -0
  205. package/dist/legacy/layout.js +44 -0
  206. package/dist/legacy/sidebar.d.ts +14 -0
  207. package/dist/legacy/sidebar.js +34 -0
  208. package/dist/mdx.d.ts +44 -0
  209. package/dist/mdx.js +70 -0
  210. package/dist/mdx.server.d.ts +14 -0
  211. package/dist/mdx.server.js +20 -0
  212. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +30 -0
  213. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
  214. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +3 -0
  215. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +6 -0
  216. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
  217. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
  218. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
  219. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
  220. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
  221. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +10 -0
  222. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +57 -0
  223. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
  224. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
  225. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
  226. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
  227. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
  228. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
  229. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
  230. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
  231. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
  232. package/dist/og/takumi.d.ts +15 -0
  233. package/dist/og/takumi.js +91 -0
  234. package/dist/og.d.ts +16 -0
  235. package/dist/og.js +91 -0
  236. package/dist/page.d.ts +29 -0
  237. package/dist/page.js +33 -0
  238. package/dist/provider/astro.d.ts +29 -0
  239. package/dist/provider/astro.js +20 -0
  240. package/dist/provider/base.d.ts +48 -0
  241. package/dist/provider/base.js +73 -0
  242. package/dist/provider/next.d.ts +16 -0
  243. package/dist/provider/next.js +17 -0
  244. package/dist/provider/react-router.d.ts +16 -0
  245. package/dist/provider/react-router.js +17 -0
  246. package/dist/provider/tanstack.d.ts +16 -0
  247. package/dist/provider/tanstack.js +17 -0
  248. package/dist/provider/waku.d.ts +16 -0
  249. package/dist/provider/waku.js +17 -0
  250. package/dist/style.css +3640 -0
  251. package/dist/tailwind/typography.d.ts +2 -0
  252. package/dist/tailwind/typography.js +2 -0
  253. package/dist/utils/cn.js +2 -0
  254. package/dist/utils/merge-refs.js +11 -0
  255. package/dist/utils/urls.js +15 -0
  256. package/dist/utils/use-copy-button.d.ts +5 -0
  257. package/dist/utils/use-copy-button.js +26 -0
  258. package/dist/utils/use-footer-items.d.ts +8 -0
  259. package/dist/utils/use-footer-items.js +24 -0
  260. package/dist/utils/use-is-scroll-top.d.ts +6 -0
  261. package/dist/utils/use-is-scroll-top.js +20 -0
  262. package/package.json +212 -0
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { useTabsGroups } from "../../../contexts/tree.js";
4
+ import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
5
+ import { isLayoutTabActive } from "../../shared/index.js";
6
+ import Link from "@vx-oss/docs-core/link";
7
+ import { usePathname } from "@vx-oss/docs-core/framework";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Check, ChevronsUpDown } from "lucide-react";
10
+ import { useMemo, useState } from "react";
11
+ import { AnimatePresence, motion } from "motion/react";
12
+ //#region src/layouts/flux/slots/tab-dropdown.tsx
13
+ function TabDropdown({ tabs: allTabs, placeholder, className, ...props }) {
14
+ const [open, setOpen] = useState(false);
15
+ const pathname = usePathname();
16
+ const tabs = useTabsGroups(allTabs).findLast((group) => typeof group.active?.root !== "string")?.options;
17
+ const selectedIdx = useMemo(() => {
18
+ return tabs?.findLastIndex((item) => isLayoutTabActive(item, pathname)) ?? -1;
19
+ }, [tabs, pathname]);
20
+ if (!tabs) return;
21
+ const selected = selectedIdx !== -1 ? tabs[selectedIdx] : void 0;
22
+ const onClick = () => {
23
+ setOpen(false);
24
+ };
25
+ const item = selected ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
26
+ className: "size-4.5 shrink-0 empty:hidden",
27
+ children: selected.icon
28
+ }), /* @__PURE__ */ jsx("p", {
29
+ className: "font-medium",
30
+ children: selected.title
31
+ })] }) : placeholder;
32
+ return /* @__PURE__ */ jsxs(Popover, {
33
+ open,
34
+ onOpenChange: setOpen,
35
+ children: [item && /* @__PURE__ */ jsxs(PopoverTrigger, {
36
+ className: cn("flex items-center gap-2 rounded-xl overflow-hidden p-1.5 border shadow-sm text-sm text-start transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground", className),
37
+ ...props,
38
+ children: [/* @__PURE__ */ jsx(AnimatePresence, {
39
+ mode: "popLayout",
40
+ children: /* @__PURE__ */ jsx(motion.span, {
41
+ className: "flex w-full min-w-0 overflow-hidden items-center text-nowrap gap-1.5",
42
+ initial: {
43
+ opacity: 0,
44
+ y: "100%"
45
+ },
46
+ animate: {
47
+ opacity: 1,
48
+ y: 0
49
+ },
50
+ exit: {
51
+ opacity: 0,
52
+ y: "-100%"
53
+ },
54
+ children: item
55
+ }, selectedIdx)
56
+ }), /* @__PURE__ */ jsx(ChevronsUpDown, { className: "shrink-0 ms-auto size-4 text-fd-muted-foreground" })]
57
+ }), /* @__PURE__ */ jsx(PopoverContent, {
58
+ align: "start",
59
+ className: "flex flex-col gap-1 max-w-svw p-1 fd-scroll-container",
60
+ children: tabs.map((item, i) => {
61
+ const isActive = i === selectedIdx;
62
+ if (!isActive && item.unlisted) return;
63
+ return /* @__PURE__ */ jsxs(Link, {
64
+ href: item.url,
65
+ onClick,
66
+ ...item.props,
67
+ className: cn("flex items-center gap-1.5 rounded-lg p-1.5 hover:bg-fd-accent hover:text-fd-accent-foreground", item.props?.className),
68
+ children: [
69
+ /* @__PURE__ */ jsx("div", {
70
+ className: "shrink-0 mb-auto size-4.5 empty:hidden",
71
+ children: item.icon
72
+ }),
73
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
74
+ className: "text-sm font-medium leading-none",
75
+ children: item.title
76
+ }), /* @__PURE__ */ jsx("p", {
77
+ className: "text-[0.8125rem] text-fd-muted-foreground mt-1 empty:hidden",
78
+ children: item.description
79
+ })] }),
80
+ /* @__PURE__ */ jsx(Check, { className: cn("shrink-0 ms-auto size-3.5 text-fd-primary", !isActive && "invisible") })
81
+ ]
82
+ }, item.url);
83
+ })
84
+ })]
85
+ });
86
+ }
87
+ //#endregion
88
+ export { TabDropdown };
@@ -0,0 +1,39 @@
1
+ import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
2
+ import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab, LinkItemType } from "../shared/index.js";
3
+ import { SidebarDrawerProps, SidebarProps, SidebarProviderProps, useSidebar } from "./slots/sidebar.js";
4
+ import { HeaderProps } from "./slots/header.js";
5
+ import { FC } from "react";
6
+ import * as PageTree from "@vx-oss/docs-core/page-tree";
7
+ //#region src/layouts/glass/index.d.ts
8
+ interface GlassSlots extends BaseSlots {
9
+ header: FC<HeaderProps>;
10
+ sidebar: {
11
+ main: FC<SidebarProps>;
12
+ provider: FC<SidebarProviderProps>;
13
+ use: typeof useSidebar;
14
+ drawer: FC<SidebarDrawerProps>;
15
+ };
16
+ }
17
+ interface GlassLayoutProps extends BaseLayoutProps {
18
+ tree: PageTree.Root;
19
+ tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
20
+ aiChat?: {
21
+ open: boolean;
22
+ onOpenChange: (v: boolean) => void;
23
+ };
24
+ slots?: Partial<GlassSlots>;
25
+ sidebar?: Omit<SidebarProviderProps, 'children'>;
26
+ }
27
+ interface SlotsProps extends BaseSlotsProps<GlassLayoutProps> {
28
+ tabs: LayoutTab[];
29
+ aiChat?: GlassLayoutProps['aiChat'];
30
+ }
31
+ declare function useGlassLayout(): {
32
+ props: SlotsProps;
33
+ navItems: LinkItemType[];
34
+ menuItems: LinkItemType[];
35
+ slots: GlassSlots;
36
+ };
37
+ declare function GlassLayout(props: GlassLayoutProps): import("react").JSX.Element;
38
+ //#endregion
39
+ export { GlassLayout, GlassLayoutProps, GlassSlots, useGlassLayout };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { TreeContextProvider } from "../../contexts/tree.js";
3
+ import { baseSlots } from "../shared/client.js";
4
+ import { getLayoutTabs, useLinkItems } from "../shared/index.js";
5
+ import { Sidebar, SidebarDrawer, SidebarProvider, useSidebar } from "./slots/sidebar.js";
6
+ import { Header } from "./slots/header.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { createContext, use, useMemo } from "react";
9
+ //#region src/layouts/glass/index.tsx
10
+ const LayoutContext = createContext(null);
11
+ function useGlassLayout() {
12
+ const context = use(LayoutContext);
13
+ if (!context) throw new Error("Please use Glass layout components under <GlassLayout /> (`@vx-oss/docs-react/layouts/glass`).");
14
+ return context;
15
+ }
16
+ const { useBaseSlots } = baseSlots({ useProps() {
17
+ return useGlassLayout().props;
18
+ } });
19
+ function GlassLayout(props) {
20
+ const { tree, tabs: defaultTabs, aiChat, children, slots: defaultSlots = {} } = props;
21
+ const linkItems = useLinkItems(props);
22
+ const { baseSlots, baseProps } = useBaseSlots(props);
23
+ const tabs = useMemo(() => {
24
+ if (Array.isArray(defaultTabs)) return defaultTabs;
25
+ if (typeof defaultTabs === "object") return getLayoutTabs(tree, defaultTabs);
26
+ if (defaultTabs !== false) return getLayoutTabs(tree);
27
+ return [];
28
+ }, [tree, defaultTabs]);
29
+ const slots = {
30
+ ...baseSlots,
31
+ header: defaultSlots.header ?? Header,
32
+ sidebar: defaultSlots.sidebar ?? {
33
+ drawer: SidebarDrawer,
34
+ main: Sidebar,
35
+ provider: SidebarProvider,
36
+ use: useSidebar
37
+ }
38
+ };
39
+ const leftSpace = "calc(50% - var(--fd-main-width)/2 - var(--fd-left-width))";
40
+ return /* @__PURE__ */ jsx(LayoutContext, {
41
+ value: {
42
+ props: {
43
+ tabs,
44
+ aiChat,
45
+ ...baseProps
46
+ },
47
+ slots,
48
+ ...linkItems
49
+ },
50
+ children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
51
+ ...props.sidebar,
52
+ children: /* @__PURE__ */ jsx(TreeContextProvider, {
53
+ tree,
54
+ children: /* @__PURE__ */ jsxs("div", {
55
+ id: "fd-glass-layout",
56
+ className: "grid overflow-x-clip min-h-dvh [--fd-main-width:900px] [--fd-left-width:0px] [--fd-right-width:0px]",
57
+ style: { gridTemplate: `"left left-margin main right-margin right" 1fr / var(--fd-left-width) ${leftSpace} 1fr calc(50% - var(--fd-main-width)/2 - var(--fd-right-width) + min(${leftSpace}, 0px)) var(--fd-right-width)` },
58
+ children: [
59
+ /* @__PURE__ */ jsx(slots.sidebar.drawer, {}),
60
+ /* @__PURE__ */ jsx(slots.sidebar.main, {}),
61
+ /* @__PURE__ */ jsx(slots.header, {}),
62
+ children
63
+ ]
64
+ })
65
+ })
66
+ })
67
+ });
68
+ }
69
+ //#endregion
70
+ export { GlassLayout, useGlassLayout };
@@ -0,0 +1,54 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { useTabsGroups } from "../../contexts/tree.js";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
4
+ import { isLayoutTabActive } from "../shared/index.js";
5
+ import Link from "@vx-oss/docs-core/link";
6
+ import { usePathname } from "@vx-oss/docs-core/framework";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { ChevronsUpDown } from "lucide-react";
9
+ import { useState } from "react";
10
+ import { useTranslations } from "@fuma-translate/react";
11
+ //#region src/layouts/glass/layout-tabs.tsx
12
+ function LayoutTabsDropdown({ tabs: allTabs, className, size = "default", ...props }) {
13
+ const pathname = usePathname();
14
+ const t = useTranslations();
15
+ const tabs = useTabsGroups(allTabs).findLast((group) => typeof group.active?.root !== "string")?.options ?? [];
16
+ const selected = tabs.findLast((t) => isLayoutTabActive(t, pathname));
17
+ const [open, setOpen] = useState(false);
18
+ if (tabs.length === 0) return;
19
+ return /* @__PURE__ */ jsxs(Popover, {
20
+ open,
21
+ onOpenChange: setOpen,
22
+ children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
23
+ className: cn("inline-flex items-center gap-2 text-sm font-medium rounded-full transition-colors hover:bg-fd-accent data-[state=open]:bg-fd-accent", size === "lg" && "text-[0.9375rem]", className),
24
+ ...props,
25
+ children: [selected ? /* @__PURE__ */ jsxs(Fragment, { children: [selected.icon, /* @__PURE__ */ jsx("span", {
26
+ className: "truncate",
27
+ children: selected.title
28
+ })] }) : /* @__PURE__ */ jsx("span", {
29
+ className: "text-fd-muted-foreground truncate",
30
+ children: t("Layout Tab", { note: "layout tab trigger" })
31
+ }), /* @__PURE__ */ jsx(ChevronsUpDown, { className: cn("ms-auto shrink-0 text-fd-muted-foreground", size === "default" && "size-3.5!", size === "lg" && "size-4!") })]
32
+ }), /* @__PURE__ */ jsx(PopoverContent, {
33
+ className: "flex flex-col p-1 rounded-xl w-(--radix-popover-trigger-width)",
34
+ align: "start",
35
+ children: tabs.map((t, i) => {
36
+ if (t.unlisted && t !== selected) return;
37
+ return /* @__PURE__ */ jsxs(Link, {
38
+ href: t.url,
39
+ className: cn("text-sm px-2 py-1.5 rounded-lg", selected === t ? "bg-fd-primary/10 text-fd-primary" : "hover:bg-fd-accent hover:text-fd-accent-foreground"),
40
+ onClick: () => setOpen(false),
41
+ children: [/* @__PURE__ */ jsxs("div", {
42
+ className: "font-medium inline-flex items-center gap-2 [&_svg]:size-4",
43
+ children: [t.icon, t.title]
44
+ }), /* @__PURE__ */ jsx("p", {
45
+ className: cn("mt-1 text-xs text-fd-muted-foreground empty:hidden", selected === t && "text-fd-primary/80"),
46
+ children: t.description
47
+ })]
48
+ }, i);
49
+ })
50
+ })]
51
+ });
52
+ }
53
+ //#endregion
54
+ export { LayoutTabsDropdown };
@@ -0,0 +1,31 @@
1
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
+ import { TOCProps } from "./slots/toc.js";
3
+ import { ComponentProps } from "react";
4
+ import { TOCItemType } from "@vx-oss/docs-core/toc";
5
+ //#region src/layouts/glass/page/index.d.ts
6
+ interface DocsPageProps extends ComponentProps<'article'> {
7
+ toc?: TOCItemType[];
8
+ /**
9
+ * Extend the page to fill all available space
10
+ *
11
+ * @defaultValue false
12
+ */
13
+ full?: boolean | undefined;
14
+ tableOfContent?: TOCProps;
15
+ }
16
+ declare function useDocsPage(): {
17
+ full: boolean;
18
+ };
19
+ declare function DocsPage({ full, toc, tableOfContent, children }: DocsPageProps): import("react").JSX.Element;
20
+ declare function EditOnGitHub(props: ComponentProps<'a'>): import("react").JSX.Element;
21
+ /**
22
+ * Add typography styles
23
+ */
24
+ declare function DocsBody({ children, className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
25
+ declare function DocsDescription({ children, className, ...props }: ComponentProps<'p'>): import("react").JSX.Element | null;
26
+ declare function DocsTitle({ children, className, ...props }: ComponentProps<'h1'>): import("react").JSX.Element;
27
+ declare function PageLastUpdate({ date: value, ...props }: Omit<ComponentProps<'p'>, 'children'> & {
28
+ date: Date;
29
+ }): import("react").JSX.Element;
30
+ //#endregion
31
+ export { DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, MarkdownCopyButton, PageLastUpdate, ViewOptionsPopover, useDocsPage };
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
5
+ import { Footer } from "./slots/footer.js";
6
+ import { Breadcrumb } from "./slots/breadcrumb.js";
7
+ import { TOC, TOCProvider } from "./slots/toc.js";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Edit } from "lucide-react";
10
+ import { createContext, use, useEffect, useState } from "react";
11
+ import { useTranslations } from "@fuma-translate/react";
12
+ //#region src/layouts/glass/page/index.tsx
13
+ const PageContext = createContext(null);
14
+ function useDocsPage() {
15
+ const context = use(PageContext);
16
+ if (!context) throw new Error("Please use page components under <DocsPage /> (`@vx-oss/docs-react/layouts/glass/page`).");
17
+ return context;
18
+ }
19
+ const Empty = [];
20
+ function DocsPage({ full = false, toc = Empty, tableOfContent, children }) {
21
+ return /* @__PURE__ */ jsx(PageContext, {
22
+ value: { full },
23
+ children: /* @__PURE__ */ jsxs(TOCProvider, {
24
+ toc,
25
+ children: [/* @__PURE__ */ jsxs("div", {
26
+ "data-fd-full": full,
27
+ className: cn("flex flex-col gap-2 p-6 pb-16 min-w-0 [grid-area:main] md:pt-16 md:pb-8", full && "layout:[--fd-main-width:1200px]"),
28
+ children: [
29
+ /* @__PURE__ */ jsx(Breadcrumb, {}),
30
+ children,
31
+ /* @__PURE__ */ jsx(Footer, {})
32
+ ]
33
+ }), /* @__PURE__ */ jsx(TOC, { ...tableOfContent })]
34
+ })
35
+ });
36
+ }
37
+ function EditOnGitHub(props) {
38
+ const t = useTranslations({ note: "edit page" });
39
+ return /* @__PURE__ */ jsx("a", {
40
+ target: "_blank",
41
+ rel: "noreferrer noopener",
42
+ ...props,
43
+ className: cn(buttonVariants({
44
+ color: "secondary",
45
+ size: "sm"
46
+ }), "gap-1.5 not-prose", props.className),
47
+ children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), t("Edit on GitHub")] })
48
+ });
49
+ }
50
+ /**
51
+ * Add typography styles
52
+ */
53
+ function DocsBody({ children, className, ...props }) {
54
+ return /* @__PURE__ */ jsx("div", {
55
+ ...props,
56
+ className: cn("prose flex-1", className),
57
+ children
58
+ });
59
+ }
60
+ function DocsDescription({ children, className, ...props }) {
61
+ if (children === void 0) return null;
62
+ return /* @__PURE__ */ jsx("p", {
63
+ ...props,
64
+ className: cn("mb-8 text-lg text-fd-muted-foreground", className),
65
+ children
66
+ });
67
+ }
68
+ function DocsTitle({ children, className, ...props }) {
69
+ return /* @__PURE__ */ jsx("h1", {
70
+ ...props,
71
+ className: cn("text-[1.75em] font-semibold", className),
72
+ children
73
+ });
74
+ }
75
+ function PageLastUpdate({ date: value, ...props }) {
76
+ const t = useTranslations({ note: "page footer" });
77
+ const [date, setDate] = useState("");
78
+ useEffect(() => {
79
+ setDate(value.toLocaleDateString());
80
+ }, [value]);
81
+ return /* @__PURE__ */ jsxs("p", {
82
+ ...props,
83
+ className: cn("text-sm text-fd-muted-foreground", props.className),
84
+ children: [
85
+ t("Last updated on"),
86
+ " ",
87
+ date
88
+ ]
89
+ });
90
+ }
91
+ //#endregion
92
+ export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, MarkdownCopyButton, PageLastUpdate, ViewOptionsPopover, useDocsPage };
@@ -0,0 +1,7 @@
1
+ import { ComponentProps } from "react";
2
+ import { BreadcrumbOptions } from "@vx-oss/docs-core/breadcrumb";
3
+ //#region src/layouts/glass/page/slots/breadcrumb.d.ts
4
+ type BreadcrumbProps = BreadcrumbOptions & ComponentProps<'div'>;
5
+ declare function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }: BreadcrumbProps): import("react").JSX.Element | null;
6
+ //#endregion
7
+ export { Breadcrumb, BreadcrumbProps };
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { cn } from "../../../../utils/cn.js";
3
+ import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
4
+ import Link from "@vx-oss/docs-core/link";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { ChevronRight } from "lucide-react";
7
+ import { Fragment as Fragment$1, useMemo } from "react";
8
+ import { getBreadcrumbItemsFromPath } from "@vx-oss/docs-core/breadcrumb";
9
+ //#region src/layouts/glass/page/slots/breadcrumb.tsx
10
+ function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
11
+ const path = useTreePath();
12
+ const { root } = useTreeContext();
13
+ const items = useMemo(() => {
14
+ return getBreadcrumbItemsFromPath(root, path, {
15
+ includePage,
16
+ includeSeparator,
17
+ includeRoot
18
+ });
19
+ }, [
20
+ includePage,
21
+ includeRoot,
22
+ includeSeparator,
23
+ path,
24
+ root
25
+ ]);
26
+ if (items.length === 0) return null;
27
+ return /* @__PURE__ */ jsx("div", {
28
+ ...props,
29
+ className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
30
+ children: items.map((item, i) => {
31
+ const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
32
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
33
+ href: item.url,
34
+ className: cn(className, "transition-opacity hover:opacity-80"),
35
+ children: item.name
36
+ }) : /* @__PURE__ */ jsx("span", {
37
+ className,
38
+ children: item.name
39
+ })] }, i);
40
+ })
41
+ });
42
+ }
43
+ //#endregion
44
+ export { Breadcrumb };
@@ -0,0 +1,16 @@
1
+ import { ComponentProps } from "react";
2
+ import * as PageTree from "@vx-oss/docs-core/page-tree";
3
+ //#region src/layouts/glass/page/slots/footer.d.ts
4
+ type Item = Pick<PageTree.Item, 'name' | 'description' | 'url'>;
5
+ interface FooterProps extends ComponentProps<'div'> {
6
+ /**
7
+ * Items including information for the next and previous page
8
+ */
9
+ items?: {
10
+ previous?: Item;
11
+ next?: Item;
12
+ };
13
+ }
14
+ declare function Footer({ items, children, className, ...props }: FooterProps): import("react").JSX.Element;
15
+ //#endregion
16
+ export { Footer, FooterProps };
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { cn } from "../../../../utils/cn.js";
3
+ import { isActive } from "../../../../utils/urls.js";
4
+ import { useFooterItems } from "../../../../utils/use-footer-items.js";
5
+ import Link from "@vx-oss/docs-core/link";
6
+ import { usePathname } from "@vx-oss/docs-core/framework";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { ChevronLeft, ChevronRight } from "lucide-react";
9
+ import { useMemo } from "react";
10
+ import { useTranslations } from "@fuma-translate/react";
11
+ //#region src/layouts/glass/page/slots/footer.tsx
12
+ function Footer({ items, children, className, ...props }) {
13
+ const footerList = useFooterItems();
14
+ const pathname = usePathname();
15
+ const { previous, next } = useMemo(() => {
16
+ if (items) return items;
17
+ const idx = footerList.findIndex((item) => isActive(item.url, pathname));
18
+ if (idx === -1) return {};
19
+ return {
20
+ previous: footerList[idx - 1],
21
+ next: footerList[idx + 1]
22
+ };
23
+ }, [
24
+ footerList,
25
+ items,
26
+ pathname
27
+ ]);
28
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
29
+ className: cn("@container grid gap-4", previous && next ? "grid-cols-2" : "grid-cols-1", className),
30
+ ...props,
31
+ children: [previous && /* @__PURE__ */ jsx(FooterItem, {
32
+ item: previous,
33
+ index: 0
34
+ }), next && /* @__PURE__ */ jsx(FooterItem, {
35
+ item: next,
36
+ index: 1
37
+ })]
38
+ }), children] });
39
+ }
40
+ function FooterItem({ item, index }) {
41
+ const t = useTranslations({ note: "pagination" });
42
+ const Icon = index === 0 ? ChevronLeft : ChevronRight;
43
+ return /* @__PURE__ */ jsxs(Link, {
44
+ href: item.url,
45
+ className: cn("flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full", index === 1 && "text-end"),
46
+ children: [/* @__PURE__ */ jsxs("div", {
47
+ className: cn("inline-flex items-center gap-1.5 font-medium", index === 1 && "flex-row-reverse"),
48
+ children: [/* @__PURE__ */ jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), /* @__PURE__ */ jsx("p", { children: item.name })]
49
+ }), /* @__PURE__ */ jsx("p", {
50
+ className: "text-fd-muted-foreground truncate",
51
+ children: item.description ?? (index === 0 ? t("Previous Page") : t("Next Page"))
52
+ })]
53
+ });
54
+ }
55
+ //#endregion
56
+ export { Footer };
@@ -0,0 +1,19 @@
1
+ import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
2
+ import { ComponentProps, ReactNode } from "react";
3
+ //#region src/layouts/glass/page/slots/toc.d.ts
4
+ type TOCProviderProps = TOCProviderProps$1;
5
+ declare function TOCProvider(props: TOCProviderProps): import("react").JSX.Element;
6
+ interface TOCProps {
7
+ container?: ComponentProps<'div'>;
8
+ /**
9
+ * Custom content in TOC container, before the main TOC
10
+ */
11
+ header?: ReactNode;
12
+ /**
13
+ * Custom content in TOC container, after the main TOC
14
+ */
15
+ footer?: ReactNode;
16
+ }
17
+ declare function TOC({ container, header, footer }: TOCProps): import("react").JSX.Element | undefined;
18
+ //#endregion
19
+ export { TOC, TOCProps, TOCProvider, TOCProviderProps };
@@ -0,0 +1,108 @@
1
+ "use client";
2
+ import { cn } from "../../../../utils/cn.js";
3
+ import { TOCProvider as TOCProvider$1, TOCScrollArea, useTOCItems } from "../../../../components/toc/index.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Text } from "lucide-react";
6
+ import { createContext, use, useMemo, useRef, useState } from "react";
7
+ import { useTranslations } from "@fuma-translate/react";
8
+ import { TOCItem } from "@vx-oss/docs-core/toc";
9
+ import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
10
+ //#region src/layouts/glass/page/slots/toc.tsx
11
+ const Context = createContext(null);
12
+ function TOCProvider(props) {
13
+ return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
14
+ }
15
+ function useContext$1() {
16
+ return use(Context);
17
+ }
18
+ function TOC({ container, header, footer }) {
19
+ const t = useTranslations({ note: "table of contents" });
20
+ const items = useTOCItems();
21
+ const [hover, setHover] = useState(false);
22
+ const [mobileOpen, setMobileOpen] = useState(false);
23
+ const [inAnimation, setInAnimation] = useState(false);
24
+ const exitTimerRef = useRef(null);
25
+ const transitionTimerRef = useRef(null);
26
+ const open = hover || mobileOpen;
27
+ useOnChange(open, () => {
28
+ setInAnimation(true);
29
+ if (transitionTimerRef.current) window.clearTimeout(transitionTimerRef.current);
30
+ transitionTimerRef.current = window.setTimeout(() => {
31
+ setInAnimation(false);
32
+ }, 300);
33
+ });
34
+ const ctx = useMemo(() => ({
35
+ open,
36
+ setMobileOpen,
37
+ inAnimation
38
+ }), [open, inAnimation]);
39
+ if (items.length === 0 && !footer && !header) return;
40
+ return /* @__PURE__ */ jsxs(Context, {
41
+ value: ctx,
42
+ children: [/* @__PURE__ */ jsx("div", {
43
+ className: cn("fixed inset-0 z-10 backdrop-blur-sm transition-opacity duration-300 [mask-image:radial-gradient(circle_at_center_right,white,white_200px,transparent_500px)] xl:hidden", !open && "opacity-0 pointer-events-none"),
44
+ onClick: () => setMobileOpen(false)
45
+ }), /* @__PURE__ */ jsx(TOCScrollArea, {
46
+ id: "nd-toc",
47
+ ...container,
48
+ className: cn("z-10 grid transition-[width,padding] duration-300 [grid-area:right]", "xl:sticky xl:top-10 xl:h-[calc(100dvh---spacing(10))] md:layout:[--fd-right-width:12px] xl:layout:[--fd-right-width:240px] xl:items-center xl:pe-4", "max-xl:fixed max-xl:top-1/2 max-xl:-translate-y-1/2 max-xl:end-1 max-xl:bg-fd-popover max-xl:text-fd-popover-foreground max-xl:border max-xl:rounded-xl max-xl:shadow-md max-xl:mask-none max-xl:max-h-[calc(100dvh---spacing(32))] max-xl:grid-cols-[calc(240px---spacing(6))]", inAnimation && "overflow-y-hidden", open ? "max-xl:w-[240px] max-xl:p-3" : "max-md:w-4 max-md:ps-[calc(--spacing(1.5)-1px)] max-xl:w-6 max-xl:ps-[calc(--spacing(2.5)-1px)] max-xl:overflow-clip", container?.className),
49
+ onPointerDown: (e) => {
50
+ if (!mobileOpen && (e.pointerType === "touch" || e.pointerType === "pen")) setMobileOpen(true);
51
+ },
52
+ onPointerEnter: (e) => {
53
+ if (e.pointerType === "mouse") {
54
+ if (exitTimerRef.current) window.clearTimeout(exitTimerRef.current);
55
+ if (!hover) setHover(true);
56
+ }
57
+ },
58
+ onPointerLeave: (e) => {
59
+ if (hover && e.pointerType === "mouse") {
60
+ if (exitTimerRef.current) window.clearTimeout(exitTimerRef.current);
61
+ exitTimerRef.current = window.setTimeout(() => {
62
+ setHover(false);
63
+ }, window.innerWidth - e.clientX < 30 ? 700 : 50);
64
+ }
65
+ },
66
+ children: /* @__PURE__ */ jsxs("div", {
67
+ className: "flex flex-col xl:items-end xl:text-end",
68
+ children: [
69
+ header,
70
+ /* @__PURE__ */ jsxs("h3", {
71
+ id: "nd-toc-title",
72
+ className: cn("inline-flex items-center gap-1.5 overflow-hidden text-xs text-fd-muted-foreground transition-[opacity,height] opacity-0 h-0", open ? "opacity-100 h-6" : "xl:[@media(hover:none)]:opacity-100 xl:[@media(hover:none)]:h-6"),
73
+ children: [/* @__PURE__ */ jsx(Text, { className: "size-3.5 shrink-0" }), t("On this page")]
74
+ }),
75
+ /* @__PURE__ */ jsx(TOCPanel, {}),
76
+ footer
77
+ ]
78
+ })
79
+ })]
80
+ });
81
+ }
82
+ function TOCPanel({ className, style, ...props }) {
83
+ const items = useTOCItems();
84
+ const { open, inAnimation, setMobileOpen } = useContext$1();
85
+ return /* @__PURE__ */ jsx("div", {
86
+ className: cn("grid grid-cols-1 transition-[grid-template-rows]", open ? "[--row:calc(6*var(--spacing))]" : "[--row:calc(3*var(--spacing))] xl:[@media(hover:none)]:[--row:calc(6*var(--spacing))]", (!open || inAnimation) && "pointer-events-none xl:[@media(hover:none)]:pointer-events-auto", className),
87
+ style: {
88
+ ...style,
89
+ gridTemplateRows: `repeat(${items.length}, var(--row))`
90
+ },
91
+ ...props,
92
+ children: items.map((item) => /* @__PURE__ */ jsxs(TOCItem, {
93
+ href: item.url,
94
+ className: "group prose prose-sm flex items-center gap-2 text-xs text-fd-muted-foreground transition-colors data-[active=true]:text-fd-primary data-[active=false]:hover:text-fd-accent-foreground xl:flex-row-reverse",
95
+ onClick: () => setMobileOpen(false),
96
+ autoScroll: open && !inAnimation,
97
+ children: [/* @__PURE__ */ jsx("div", {
98
+ className: cn("shrink-0 bg-fd-muted-foreground/50 rounded-full size-1 transition-[background-color,width,height] group-data-[active=true]:bg-fd-primary", open ? "w-(--width) h-px" : "transition-[width,height] duration-300 xl:[@media(hover:none)]:w-(--width) xl:[@media(hover:none)]:h-px"),
99
+ style: { "--width": `calc(pow(${item.depth}, 1.5) * var(--spacing))` }
100
+ }), /* @__PURE__ */ jsx("span", {
101
+ className: cn("truncate transition-opacity opacity-0", open ? "opacity-100" : "xl:[@media(hover:none)]:opacity-100"),
102
+ children: item.title
103
+ })]
104
+ }, item.url))
105
+ });
106
+ }
107
+ //#endregion
108
+ export { TOC, TOCProvider };
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from "react";
2
+ //#region src/layouts/glass/slots/header.d.ts
3
+ type HeaderProps = ComponentProps<'div'>;
4
+ declare function Header({ className, ...props }: HeaderProps): import("react").JSX.Element;
5
+ //#endregion
6
+ export { Header, HeaderProps };