@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,268 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { mergeRefs } from "../../../utils/merge-refs.js";
5
+ import { SearchTrigger } from "../../shared/slots/search-trigger.js";
6
+ import { LinkItem } from "../../shared/client.js";
7
+ import "../../shared/index.js";
8
+ import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
9
+ import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
10
+ import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
11
+ import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
12
+ import { useDocsLayout } from "../client.js";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ import { ChevronDown, Languages, SidebarIcon } from "lucide-react";
15
+ import { cva } from "class-variance-authority";
16
+ import { useRef } from "react";
17
+ //#region src/layouts/docs/slots/sidebar.tsx
18
+ const itemVariants = cva("relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0", { variants: {
19
+ variant: {
20
+ link: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors",
21
+ button: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none"
22
+ },
23
+ highlight: { true: "data-[active=true]:before:content-[''] data-[active=true]:before:bg-fd-primary data-[active=true]:before:absolute data-[active=true]:before:w-px data-[active=true]:before:inset-y-2.5 data-[active=true]:before:inset-s-2.5" }
24
+ } });
25
+ const { useSidebar } = base_exports;
26
+ function SidebarProvider(props) {
27
+ return /* @__PURE__ */ jsx(SidebarProvider$1, { ...props });
28
+ }
29
+ function Sidebar({ footer, banner, collapsible = true, components, ...rest }) {
30
+ const { menuItems, slots, props: { tabs, nav, tabMode } } = useDocsLayout();
31
+ const iconLinks = menuItems.filter((item) => item.type === "icon");
32
+ const viewport = /* @__PURE__ */ jsxs(SidebarViewport, { children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
33
+ item,
34
+ className: cn(i === list.length - 1 && "mb-4")
35
+ }, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })] });
36
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
37
+ ...rest,
38
+ children: [
39
+ /* @__PURE__ */ jsxs("div", {
40
+ className: "flex flex-col gap-3 p-4 pb-2",
41
+ children: [
42
+ /* @__PURE__ */ jsxs("div", {
43
+ className: "flex",
44
+ children: [
45
+ slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex text-[0.9375rem] items-center gap-2.5 font-medium me-auto" }),
46
+ nav?.children,
47
+ collapsible && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
48
+ className: cn(buttonVariants({
49
+ color: "ghost",
50
+ size: "icon-sm",
51
+ className: "mb-auto text-fd-muted-foreground"
52
+ })),
53
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
54
+ })
55
+ ]
56
+ }),
57
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, { hideIfDisabled: true }),
58
+ tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, { options: tabMode === "auto" ? tabs : tabs.filter((tab) => typeof tab.$folder?.root === "string") }),
59
+ banner
60
+ ]
61
+ }),
62
+ viewport,
63
+ (slots.languageSelect || iconLinks.length > 0 || slots.themeSwitch || footer) && /* @__PURE__ */ jsxs("div", {
64
+ className: "flex flex-col p-4 pt-2",
65
+ children: [
66
+ slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
67
+ variant: "secondary",
68
+ className: "text-fd-muted-foreground text-start justify-start bg-fd-secondary/50 mb-2",
69
+ children: [
70
+ /* @__PURE__ */ jsx(Languages, { className: "size-4.5" }),
71
+ /* @__PURE__ */ jsx(slots.languageSelect.text, {}),
72
+ /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5" })
73
+ ]
74
+ }),
75
+ /* @__PURE__ */ jsxs("div", {
76
+ className: "flex text-fd-muted-foreground items-center border bg-fd-secondary/50 p-0.5 pe-0 rounded-lg empty:hidden",
77
+ children: [iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
78
+ item,
79
+ className: cn(buttonVariants({
80
+ size: "icon-sm",
81
+ color: "ghost"
82
+ })),
83
+ "aria-label": item.label,
84
+ children: item.icon
85
+ }, i)), slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "px-1 py-0 border-y-0 border-e-0 rounded-none ms-auto *:rounded-md" })]
86
+ }),
87
+ footer
88
+ ]
89
+ })
90
+ ]
91
+ }), /* @__PURE__ */ jsxs(SidebarDrawer, { children: [
92
+ /* @__PURE__ */ jsxs("div", {
93
+ className: "flex flex-col gap-3 p-4 pb-2",
94
+ children: [
95
+ /* @__PURE__ */ jsxs("div", {
96
+ className: "flex text-fd-muted-foreground items-center gap-1.5",
97
+ children: [
98
+ /* @__PURE__ */ jsx("div", {
99
+ className: "flex flex-1",
100
+ children: iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
101
+ item,
102
+ className: cn(buttonVariants({
103
+ size: "icon-sm",
104
+ color: "ghost",
105
+ className: "p-2"
106
+ })),
107
+ "aria-label": item.label,
108
+ children: item.icon
109
+ }, i))
110
+ }),
111
+ slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, { children: [/* @__PURE__ */ jsx(Languages, { className: "size-4.5" }), /* @__PURE__ */ jsx(slots.languageSelect.text, {})] }),
112
+ slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-0" }),
113
+ /* @__PURE__ */ jsx(SidebarTrigger, {
114
+ className: cn(buttonVariants({
115
+ color: "ghost",
116
+ size: "icon-sm",
117
+ className: "p-2"
118
+ })),
119
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
120
+ })
121
+ ]
122
+ }),
123
+ tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, { options: tabs }),
124
+ banner
125
+ ]
126
+ }),
127
+ viewport,
128
+ /* @__PURE__ */ jsx("div", {
129
+ className: "flex flex-col border-t p-4 pt-2 empty:hidden",
130
+ children: footer
131
+ })
132
+ ] })] });
133
+ }
134
+ function SidebarFolder(props) {
135
+ return /* @__PURE__ */ jsx(SidebarFolder$1, { ...props });
136
+ }
137
+ function SidebarCollapseTrigger(props) {
138
+ return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
139
+ }
140
+ function SidebarTrigger(props) {
141
+ return /* @__PURE__ */ jsx(SidebarTrigger$1, { ...props });
142
+ }
143
+ function SidebarContent({ ref: refProp, className, children, ...props }) {
144
+ const ref = useRef(null);
145
+ return /* @__PURE__ */ jsx(SidebarContent$1, { children: ({ collapsed, hovered, ref: asideRef, ...rest }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
146
+ "data-sidebar-placeholder": "",
147
+ className: "sticky top-(--fd-docs-row-1) z-20 [grid-area:sidebar] pointer-events-none *:pointer-events-auto h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] md:layout:[--fd-sidebar-width:268px] max-md:hidden",
148
+ children: [collapsed && /* @__PURE__ */ jsx("div", {
149
+ className: "absolute inset-s-0 inset-y-0 w-4",
150
+ ...rest
151
+ }), /* @__PURE__ */ jsx("aside", {
152
+ id: "nd-sidebar",
153
+ ref: mergeRefs(ref, refProp, asideRef),
154
+ "data-collapsed": collapsed,
155
+ "data-hovered": collapsed && hovered,
156
+ className: cn("absolute flex flex-col w-full inset-s-0 inset-y-0 items-end bg-fd-card text-sm border-e duration-250 *:w-(--fd-sidebar-width)", collapsed && ["inset-y-2 rounded-xl transition-transform border w-(--fd-sidebar-width)", hovered ? "shadow-lg translate-x-2 rtl:-translate-x-2" : "-translate-x-(--fd-sidebar-width) rtl:translate-x-full"], ref.current && ref.current.getAttribute("data-collapsed") === "true" !== collapsed && "transition-[width,inset-block,translate,background-color]", className),
157
+ ...props,
158
+ ...rest,
159
+ children
160
+ })]
161
+ }), /* @__PURE__ */ jsxs("div", {
162
+ "data-sidebar-panel": "",
163
+ className: cn("fixed flex top-[calc(--spacing(4)+var(--fd-docs-row-3))] inset-s-4 shadow-lg transition-opacity rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10", (!collapsed || hovered) && "pointer-events-none opacity-0"),
164
+ children: [/* @__PURE__ */ jsx(SidebarCollapseTrigger$1, {
165
+ className: cn(buttonVariants({
166
+ color: "ghost",
167
+ size: "icon-sm",
168
+ className: "rounded-lg"
169
+ })),
170
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
171
+ }), /* @__PURE__ */ jsx(SearchTrigger, {
172
+ className: "rounded-lg",
173
+ hideIfDisabled: true
174
+ })]
175
+ })] }) });
176
+ }
177
+ function SidebarDrawer({ children, className, ...props }) {
178
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarDrawerOverlay, { className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), /* @__PURE__ */ jsx(SidebarDrawerContent, {
179
+ className: cn("fixed text-[0.9375rem] flex flex-col shadow-lg border-s inset-e-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out", className),
180
+ ...props,
181
+ children
182
+ })] });
183
+ }
184
+ function SidebarSeparator({ className, style, children, ...props }) {
185
+ const depth = useFolderDepth();
186
+ return /* @__PURE__ */ jsx(SidebarSeparator$1, {
187
+ className: cn("inline-flex items-center gap-2 mb-1 px-2 mt-6 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0", depth === 0 && "first:mt-0", className),
188
+ style: {
189
+ paddingInlineStart: getItemOffset(depth),
190
+ ...style
191
+ },
192
+ ...props,
193
+ children
194
+ });
195
+ }
196
+ function SidebarItem({ className, style, children, ...props }) {
197
+ const depth = useFolderDepth();
198
+ return /* @__PURE__ */ jsx(SidebarItem$1, {
199
+ className: cn(itemVariants({
200
+ variant: "link",
201
+ highlight: depth >= 1
202
+ }), className),
203
+ style: {
204
+ paddingInlineStart: getItemOffset(depth),
205
+ ...style
206
+ },
207
+ ...props,
208
+ children
209
+ });
210
+ }
211
+ function SidebarFolderTrigger({ className, style, ...props }) {
212
+ const { depth, collapsible } = useFolder();
213
+ return /* @__PURE__ */ jsx(SidebarFolderTrigger$1, {
214
+ className: cn(itemVariants({ variant: collapsible ? "button" : null }), "w-full", className),
215
+ style: {
216
+ paddingInlineStart: getItemOffset(depth - 1),
217
+ ...style
218
+ },
219
+ ...props,
220
+ children: props.children
221
+ });
222
+ }
223
+ function SidebarFolderLink({ className, style, ...props }) {
224
+ const depth = useFolderDepth();
225
+ return /* @__PURE__ */ jsx(SidebarFolderLink$1, {
226
+ className: cn(itemVariants({
227
+ variant: "link",
228
+ highlight: depth > 1
229
+ }), "w-full", className),
230
+ style: {
231
+ paddingInlineStart: getItemOffset(depth - 1),
232
+ ...style
233
+ },
234
+ ...props,
235
+ children: props.children
236
+ });
237
+ }
238
+ function SidebarFolderContent({ className, children, ...props }) {
239
+ const depth = useFolderDepth();
240
+ return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
241
+ className: cn("relative", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:inset-s-2.5", className),
242
+ ...props,
243
+ children: /* @__PURE__ */ jsx("div", {
244
+ className: "flex flex-col gap-0.5 pt-0.5",
245
+ children
246
+ })
247
+ });
248
+ }
249
+ function getItemOffset(depth) {
250
+ return `calc(${2 + 3 * depth} * var(--spacing))`;
251
+ }
252
+ const SidebarPageTree = createPageTreeRenderer({
253
+ SidebarFolder,
254
+ SidebarFolderContent,
255
+ SidebarFolderLink,
256
+ SidebarFolderTrigger,
257
+ SidebarItem,
258
+ SidebarSeparator
259
+ });
260
+ const SidebarLinkItem = createLinkItemRenderer({
261
+ SidebarFolder,
262
+ SidebarFolderContent,
263
+ SidebarFolderLink,
264
+ SidebarFolderTrigger,
265
+ SidebarItem
266
+ });
267
+ //#endregion
268
+ export { Sidebar, SidebarProvider, SidebarTrigger, useSidebar };
@@ -0,0 +1,61 @@
1
+ import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
2
+ import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab, LinkItemType } from "../shared/index.js";
3
+ import { TabDropdownProps } from "./slots/tab-dropdown.js";
4
+ import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
5
+ import { ComponentProps, FC, ReactNode } from "react";
6
+ import * as PageTree from "@vx-oss/docs-core/page-tree";
7
+ import { motion } from "motion/react";
8
+ //#region src/layouts/flux/index.d.ts
9
+ interface DocsSlots extends BaseSlots {
10
+ container: FC<ComponentProps<'div'>>;
11
+ tabDropdown: FC<TabDropdownProps>;
12
+ sidebar: {
13
+ provider: FC<SidebarProviderProps>;
14
+ trigger: FC<ComponentProps<'button'>>;
15
+ root: FC<SidebarProps>;
16
+ useSidebar: () => {
17
+ collapsed: boolean;
18
+ open: boolean;
19
+ setOpen: (v: boolean) => void;
20
+ };
21
+ };
22
+ }
23
+ interface DocsLayoutProps extends BaseLayoutProps {
24
+ tree: PageTree.Root;
25
+ sidebar?: SidebarOptions;
26
+ tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
27
+ slots?: Partial<DocsSlots>;
28
+ renderNavigationPanel?: (props: NavigationPanelProps) => ReactNode;
29
+ containerProps?: ComponentProps<'div'>;
30
+ }
31
+ interface SidebarOptions extends SidebarProps, SidebarProviderProps {
32
+ enabled?: boolean;
33
+ /**
34
+ * @deprecated use layout-level `tabs` instead.
35
+ */
36
+ tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
37
+ }
38
+ declare function useFluxLayout(): {
39
+ props: BaseSlotsProps;
40
+ menuItems: LinkItemType[];
41
+ navItems: LinkItemType[];
42
+ slots: DocsSlots;
43
+ };
44
+ declare function DocsLayout(props: DocsLayoutProps): import("react").JSX.Element;
45
+ interface NavigationPanelProps {
46
+ head: ReactNode;
47
+ tabDropdown: ReactNode;
48
+ tool: ReactNode;
49
+ link: ReactNode;
50
+ }
51
+ declare function NavigationPanel({ head, tabDropdown, tool, link, children, ...props }: NavigationPanelProps & Omit<ComponentProps<typeof motion.div>, 'children'> & {
52
+ /**
53
+ * replace default children
54
+ */
55
+ children?: (defaultChildren: ReactNode) => ReactNode;
56
+ }): import("react").JSX.Element;
57
+ declare function NavigationPanelOverlay({ enabled, className, ...props }: ComponentProps<typeof motion.div> & {
58
+ enabled?: boolean;
59
+ }): import("react").JSX.Element;
60
+ //#endregion
61
+ export { DocsLayout, DocsLayoutProps, DocsSlots, NavigationPanel, NavigationPanelOverlay, NavigationPanelProps, useFluxLayout };
@@ -0,0 +1,146 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { buttonVariants } from "../../components/ui/button.js";
4
+ import { TreeContextProvider } from "../../contexts/tree.js";
5
+ import { useSearchContext } from "../../contexts/search.js";
6
+ import { LinkItem, baseSlots } from "../shared/client.js";
7
+ import { getLayoutTabs, useLinkItems } from "../shared/index.js";
8
+ import { TabDropdown } from "./slots/tab-dropdown.js";
9
+ import { Sidebar as Sidebar$1, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
10
+ import { Container } from "./slots/container.js";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ import { Languages } from "lucide-react";
13
+ import { createContext, use, useMemo } from "react";
14
+ import { motion } from "motion/react";
15
+ import { RemoveScroll } from "react-remove-scroll";
16
+ //#region src/layouts/flux/index.tsx
17
+ const LayoutContext = createContext(null);
18
+ function useFluxLayout() {
19
+ const context = use(LayoutContext);
20
+ if (!context) throw new Error("Please use Flux layout components under <DocsLayout /> (`@vx-oss/docs-react/layouts/flux`).");
21
+ return context;
22
+ }
23
+ const { useBaseSlots } = baseSlots({ useProps() {
24
+ return useFluxLayout().props;
25
+ } });
26
+ function DocsLayout(props) {
27
+ const { tree, nav = {}, sidebar: { enabled: sidebarEnabled = true, tabs: _tabs, defaultOpenLevel, prefetch, ...sidebarProps } = {}, tabs: defaultTabs = _tabs, children, containerProps, renderNavigationPanel = (props) => /* @__PURE__ */ jsx(NavigationPanel, { ...props }), slots: defaultSlots = {} } = props;
28
+ const linkItems = useLinkItems(props);
29
+ const { baseSlots, baseProps } = useBaseSlots(props);
30
+ const tabs = useMemo(() => {
31
+ if (Array.isArray(defaultTabs)) return defaultTabs;
32
+ if (typeof defaultTabs === "object") return getLayoutTabs(tree, defaultTabs);
33
+ if (defaultTabs !== false) return getLayoutTabs(tree);
34
+ return [];
35
+ }, [tree, defaultTabs]);
36
+ const slots = {
37
+ ...baseSlots,
38
+ container: defaultSlots.container ?? Container,
39
+ tabDropdown: defaultSlots.tabDropdown ?? TabDropdown,
40
+ sidebar: defaultSlots.sidebar ?? {
41
+ root: Sidebar$1,
42
+ provider: SidebarProvider,
43
+ trigger: SidebarTrigger,
44
+ useSidebar
45
+ }
46
+ };
47
+ return /* @__PURE__ */ jsx(LayoutContext, {
48
+ value: {
49
+ props: baseProps,
50
+ slots,
51
+ ...linkItems
52
+ },
53
+ children: /* @__PURE__ */ jsxs(TreeContextProvider, {
54
+ tree,
55
+ children: [/* @__PURE__ */ jsx(slots.sidebar.provider, {
56
+ defaultOpenLevel,
57
+ prefetch,
58
+ children: /* @__PURE__ */ jsxs(slots.container, {
59
+ ...containerProps,
60
+ children: [sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }), children]
61
+ })
62
+ }), renderNavigationPanel({
63
+ head: /* @__PURE__ */ jsxs(Fragment, { children: [slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 text-sm font-semibold" }), nav.children] }),
64
+ tabDropdown: slots.tabDropdown && tabs.length > 0 && /* @__PURE__ */ jsx(slots.tabDropdown, {
65
+ className: "flex-1",
66
+ tabs
67
+ }),
68
+ tool: /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5" }) }),
70
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
71
+ hideIfDisabled: true,
72
+ className: "rounded-lg"
73
+ }),
74
+ slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, { className: cn(buttonVariants({
75
+ variant: "ghost",
76
+ size: "icon-sm",
77
+ className: "overflow-hidden"
78
+ })) }),
79
+ slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-1 h-full ms-1 rounded-xl bg-fd-muted *:rounded-lg" })
80
+ ] }),
81
+ link: linkItems.menuItems.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
82
+ item,
83
+ className: cn(buttonVariants({
84
+ size: "icon-sm",
85
+ color: "ghost"
86
+ })),
87
+ "aria-label": item.label,
88
+ children: item.icon
89
+ }, i))
90
+ })]
91
+ })
92
+ });
93
+ }
94
+ function NavigationPanel({ head, tabDropdown, tool, link, children = (v) => v, ...props }) {
95
+ const { open } = useSearchContext();
96
+ return /* @__PURE__ */ jsx(motion.div, {
97
+ ...props,
98
+ className: cn("fixed left-1/2 w-[calc(100%-var(--removed-body-scroll-bar-size,0px))] translate-x-[calc(-50%-var(--removed-body-scroll-bar-size,0px)/2)] bottom-0 z-40 bg-fd-popover text-fd-popover-foreground border-t shadow-lg sm:bottom-6 sm:rounded-2xl sm:border sm:max-w-[380px]", props.className),
99
+ animate: props.animate ?? {
100
+ scale: open ? .9 : 1,
101
+ translateY: open ? 20 : 0,
102
+ opacity: open ? .8 : 1
103
+ },
104
+ children: children(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
105
+ className: "flex flex-row items-center ps-2.5 p-1 gap-2 min-h-11",
106
+ children: [head, /* @__PURE__ */ jsx("div", {
107
+ id: "flux-layout-slot",
108
+ className: "flex-1"
109
+ })]
110
+ }), /* @__PURE__ */ jsxs("div", {
111
+ className: "flex flex-row gap-1.5 overflow-x-auto overflow-y-hidden p-2 sm:p-1",
112
+ children: [
113
+ /* @__PURE__ */ jsx("div", {
114
+ className: "flex flex-row items-center gap-2 min-w-0 flex-1",
115
+ children: tabDropdown
116
+ }),
117
+ /* @__PURE__ */ jsx("div", {
118
+ className: "flex flex-row items-center text-fd-muted-foreground border-x px-0.5 empty:hidden",
119
+ children: link
120
+ }),
121
+ /* @__PURE__ */ jsx("div", {
122
+ className: "flex flex-row items-center text-fd-muted-foreground empty:hidden",
123
+ children: tool
124
+ })
125
+ ]
126
+ })] }))
127
+ });
128
+ }
129
+ function NavigationPanelOverlay({ enabled = false, className, ...props }) {
130
+ return /* @__PURE__ */ jsx(RemoveScroll, {
131
+ enabled,
132
+ children: /* @__PURE__ */ jsx(motion.div, {
133
+ className: cn("fixed inset-0 z-30 pr-(--removed-body-scroll-bar-size,0) backdrop-blur-md bg-fd-background/60", !enabled && "pointer-events-none", className),
134
+ initial: "hide",
135
+ variants: {
136
+ show: { opacity: 1 },
137
+ hide: { opacity: 0 }
138
+ },
139
+ animate: enabled ? "show" : "hide",
140
+ exit: "hide",
141
+ ...props
142
+ })
143
+ });
144
+ }
145
+ //#endregion
146
+ export { DocsLayout, NavigationPanel, NavigationPanelOverlay, useFluxLayout };
@@ -0,0 +1,67 @@
1
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
+ import { TOCProps, TOCProviderProps } from "./slots/toc.js";
3
+ import { Footer, FooterProps } from "./slots/footer.js";
4
+ import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
5
+ import { ComponentProps, FC, ReactNode } from "react";
6
+ import { TOCItemType } from "@vx-oss/docs-core/toc";
7
+ //#region src/layouts/flux/page/index.d.ts
8
+ interface DocsPageProps extends ComponentProps<'article'> {
9
+ toc?: TOCItemType[];
10
+ /**
11
+ * Extend the page to fill all available space
12
+ *
13
+ * @defaultValue false
14
+ */
15
+ full?: boolean | undefined;
16
+ slots?: Partial<DocsPageSlots>;
17
+ footer?: FooterOptions;
18
+ breadcrumb?: BreadcrumbOptions;
19
+ tableOfContent?: TableOfContentOptions;
20
+ }
21
+ type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
22
+ enabled?: boolean;
23
+ /**
24
+ * @deprecated use `slots.toc` instead.
25
+ */
26
+ component?: ReactNode;
27
+ };
28
+ interface BreadcrumbOptions extends BreadcrumbProps {
29
+ enabled?: boolean;
30
+ /**
31
+ * @deprecated use `slots.breadcrumb` instead.
32
+ */
33
+ component?: ReactNode;
34
+ }
35
+ interface FooterOptions extends FooterProps {
36
+ enabled?: boolean;
37
+ /**
38
+ * @deprecated use `slots.footer` instead.
39
+ */
40
+ component?: ReactNode;
41
+ }
42
+ interface DocsPageSlots {
43
+ toc: {
44
+ provider: FC<TOCProviderProps>;
45
+ main: FC<TOCProps>;
46
+ };
47
+ container: FC<ComponentProps<'article'>>;
48
+ footer: FC<FooterProps>;
49
+ breadcrumb: FC<BreadcrumbProps>;
50
+ }
51
+ declare function useDocsPage(): {
52
+ full: NonNullable<DocsPageProps["full"]>;
53
+ slots: DocsPageSlots;
54
+ };
55
+ declare function DocsPage({ full, tableOfContent: { enabled: tocEnabled, single, ...tocProps }, breadcrumb: { enabled: breadcrumbEnabled, ...breadcrumb }, footer: { enabled: footerEnabled, ...footer }, toc, slots: defaultSlots, children, ...containerProps }: DocsPageProps): import("react").JSX.Element;
56
+ declare function EditOnGitHub(props: ComponentProps<'a'>): import("react").JSX.Element;
57
+ /**
58
+ * Add typography styles
59
+ */
60
+ declare function DocsBody({ children, className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
61
+ declare function DocsDescription({ children, className, ...props }: ComponentProps<'p'>): import("react").JSX.Element | null;
62
+ declare function DocsTitle({ children, className, ...props }: ComponentProps<'h1'>): import("react").JSX.Element;
63
+ declare function PageLastUpdate({ date: value, ...props }: Omit<ComponentProps<'p'>, 'children'> & {
64
+ date: Date;
65
+ }): import("react").JSX.Element;
66
+ //#endregion
67
+ export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
@@ -0,0 +1,104 @@
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 { TOC, TOCProvider } from "./slots/toc.js";
6
+ import { Footer } from "./slots/footer.js";
7
+ import { Breadcrumb } from "./slots/breadcrumb.js";
8
+ import { Container } from "./slots/container.js";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Edit } from "lucide-react";
11
+ import { createContext, use, useEffect, useState } from "react";
12
+ import { useTranslations } from "@fuma-translate/react";
13
+ //#region src/layouts/flux/page/index.tsx
14
+ const PageContext = createContext(null);
15
+ function useDocsPage() {
16
+ const context = use(PageContext);
17
+ if (!context) throw new Error("Please use page components under <DocsPage /> (`@vx-oss/docs-react/layouts/flux/page`).");
18
+ return context;
19
+ }
20
+ function DocsPage({ full = false, tableOfContent: { enabled: tocEnabled = !full, single, ...tocProps } = {}, breadcrumb: { enabled: breadcrumbEnabled = true, ...breadcrumb } = {}, footer: { enabled: footerEnabled = true, ...footer } = {}, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
21
+ const slots = {
22
+ breadcrumb: defaultSlots.breadcrumb ?? Breadcrumb,
23
+ footer: defaultSlots.footer ?? Footer,
24
+ container: defaultSlots.container ?? Container,
25
+ toc: defaultSlots.toc ?? {
26
+ provider: TOCProvider,
27
+ main: TOC
28
+ }
29
+ };
30
+ return /* @__PURE__ */ jsx(PageContext, {
31
+ value: {
32
+ full,
33
+ slots
34
+ },
35
+ children: /* @__PURE__ */ jsxs(slots.toc.provider, {
36
+ single,
37
+ toc: tocEnabled ? toc : [],
38
+ children: [tocEnabled && (tocProps.component ?? /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps })), /* @__PURE__ */ jsxs(slots.container, {
39
+ ...containerProps,
40
+ children: [
41
+ breadcrumbEnabled && (breadcrumb.component ?? /* @__PURE__ */ jsx(slots.breadcrumb, { ...breadcrumb })),
42
+ children,
43
+ footerEnabled && (footer.component ?? /* @__PURE__ */ jsx(slots.footer, { ...footer }))
44
+ ]
45
+ })]
46
+ })
47
+ });
48
+ }
49
+ function EditOnGitHub(props) {
50
+ const t = useTranslations({ note: "edit page" });
51
+ return /* @__PURE__ */ jsx("a", {
52
+ target: "_blank",
53
+ rel: "noreferrer noopener",
54
+ ...props,
55
+ className: cn(buttonVariants({
56
+ color: "secondary",
57
+ size: "sm"
58
+ }), "gap-1.5 not-prose", props.className),
59
+ children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), t("Edit on GitHub")] })
60
+ });
61
+ }
62
+ /**
63
+ * Add typography styles
64
+ */
65
+ function DocsBody({ children, className, ...props }) {
66
+ return /* @__PURE__ */ jsx("div", {
67
+ ...props,
68
+ className: cn("prose flex-1", className),
69
+ children
70
+ });
71
+ }
72
+ function DocsDescription({ children, className, ...props }) {
73
+ if (children === void 0) return null;
74
+ return /* @__PURE__ */ jsx("p", {
75
+ ...props,
76
+ className: cn("mb-8 text-lg text-fd-muted-foreground", className),
77
+ children
78
+ });
79
+ }
80
+ function DocsTitle({ children, className, ...props }) {
81
+ return /* @__PURE__ */ jsx("h1", {
82
+ ...props,
83
+ className: cn("text-[1.75em] font-semibold", className),
84
+ children
85
+ });
86
+ }
87
+ function PageLastUpdate({ date: value, ...props }) {
88
+ const t = useTranslations({ note: "page footer" });
89
+ const [date, setDate] = useState("");
90
+ useEffect(() => {
91
+ setDate(value.toLocaleDateString());
92
+ }, [value]);
93
+ return /* @__PURE__ */ jsxs("p", {
94
+ ...props,
95
+ className: cn("text-sm text-fd-muted-foreground", props.className),
96
+ children: [
97
+ t("Last updated on"),
98
+ " ",
99
+ date
100
+ ]
101
+ });
102
+ }
103
+ //#endregion
104
+ export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, 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/flux/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 };