@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,22 @@
1
+ "use client";
2
+ import { cn } from "../../../../utils/cn.js";
3
+ import { useDocsPage } from "../index.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/layouts/notebook/page/slots/container.tsx
6
+ function Container(props) {
7
+ const { full } = useDocsPage();
8
+ return /* @__PURE__ */ jsx("main", {
9
+ className: "grid [grid-area:main]",
10
+ "data-layout-main": "",
11
+ children: /* @__PURE__ */ jsx("article", {
12
+ id: "nd-page",
13
+ "data-layout-content": "",
14
+ "data-full": full,
15
+ ...props,
16
+ className: cn("flex flex-col min-w-0 px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14 *:max-w-[900px]", full && "*:max-w-[1285px]", props.className),
17
+ children: props.children
18
+ })
19
+ });
20
+ }
21
+ //#endregion
22
+ export { Container };
@@ -0,0 +1,16 @@
1
+ import { ComponentProps } from "react";
2
+ import * as PageTree from "@vx-oss/docs-core/page-tree";
3
+ //#region src/layouts/notebook/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/notebook/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,47 @@
1
+ import { TOCItemsProps } from "../../../../components/toc/clerk.js";
2
+ import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
3
+ import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
4
+ import { ComponentProps, ReactNode } from "react";
5
+ //#region src/layouts/notebook/page/slots/toc.d.ts
6
+ type TOCProviderProps = TOCProviderProps$1;
7
+ declare function TOCProvider(props: TOCProviderProps): import("react").JSX.Element;
8
+ type TOCProps = {
9
+ container?: ComponentProps<'div'>;
10
+ /**
11
+ * Custom content in TOC container, before the main TOC
12
+ */
13
+ header?: ReactNode;
14
+ /**
15
+ * Custom content in TOC container, after the main TOC
16
+ */
17
+ footer?: ReactNode;
18
+ } & ({
19
+ style?: 'normal';
20
+ list?: TOCItemsProps$1;
21
+ } | {
22
+ style: 'clerk';
23
+ list?: TOCItemsProps;
24
+ });
25
+ declare function TOC({ container, header, footer, style, list }: TOCProps): import("react").JSX.Element;
26
+ type TOCPopoverProps = {
27
+ container?: ComponentProps<'div'>;
28
+ trigger?: ComponentProps<'button'>;
29
+ content?: ComponentProps<'div'>;
30
+ /**
31
+ * Custom content in TOC container, before the main TOC
32
+ */
33
+ header?: ReactNode;
34
+ /**
35
+ * Custom content in TOC container, after the main TOC
36
+ */
37
+ footer?: ReactNode;
38
+ } & ({
39
+ style?: 'normal';
40
+ list?: TOCItemsProps$1;
41
+ } | {
42
+ style: 'clerk';
43
+ list?: TOCItemsProps;
44
+ });
45
+ declare function TOCPopover({ container, trigger, content, header, footer, style, list }: TOCPopoverProps): import("react").JSX.Element;
46
+ //#endregion
47
+ export { TOC, TOCPopover, TOCPopoverProps, TOCProps, TOCProvider, TOCProviderProps };
@@ -0,0 +1,181 @@
1
+ "use client";
2
+ import { cn } from "../../../../utils/cn.js";
3
+ import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
4
+ import { default_exports } from "../../../../components/toc/default.js";
5
+ import { clerk_exports } from "../../../../components/toc/clerk.js";
6
+ import { useTreePath } from "../../../../contexts/tree.js";
7
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
8
+ import { useNotebookLayout } from "../../client.js";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { ChevronDown, Text } from "lucide-react";
11
+ import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
12
+ import { useTranslations } from "@fuma-translate/react";
13
+ //#region src/layouts/notebook/page/slots/toc.tsx
14
+ function TOCProvider(props) {
15
+ return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
16
+ }
17
+ function TOC({ container, header, footer, style = "normal", list }) {
18
+ const items = useTOCItems();
19
+ const t = useTranslations({ note: "table of contents" });
20
+ const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
21
+ if (items.length === 0 && !footer && !header) return /* @__PURE__ */ jsx("div", {
22
+ id: "nd-toc-placeholder",
23
+ className: "hidden xl:layout:[--fd-toc-width:268px]"
24
+ });
25
+ return /* @__PURE__ */ jsxs("div", {
26
+ id: "nd-toc",
27
+ ...container,
28
+ className: cn("sticky top-(--fd-docs-row-3) [grid-area:toc] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] flex flex-col w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", container?.className),
29
+ children: [
30
+ header,
31
+ /* @__PURE__ */ jsxs("h3", {
32
+ id: "toc-title",
33
+ className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
34
+ children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), t("On this page")]
35
+ }),
36
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
37
+ ...list,
38
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
39
+ }) }),
40
+ footer
41
+ ]
42
+ });
43
+ }
44
+ const TocPopoverContext = createContext(null);
45
+ function TOCPopover({ container, trigger, content, header, footer, style = "normal", list }) {
46
+ const items = useTOCItems();
47
+ const ref = useRef(null);
48
+ const [open, setOpen] = useState(false);
49
+ const { isNavTransparent } = useNotebookLayout();
50
+ const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
51
+ const onClickOutside = useEffectEvent((e) => {
52
+ if (!open || !(e.target instanceof HTMLElement)) return;
53
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
54
+ });
55
+ const onClickItem = () => {
56
+ setOpen(false);
57
+ };
58
+ useEffect(() => {
59
+ window.addEventListener("click", onClickOutside);
60
+ return () => {
61
+ window.removeEventListener("click", onClickOutside);
62
+ };
63
+ }, []);
64
+ return /* @__PURE__ */ jsx(TocPopoverContext, {
65
+ value: useMemo(() => ({
66
+ open,
67
+ setOpen
68
+ }), [setOpen, open]),
69
+ children: /* @__PURE__ */ jsx(Collapsible, {
70
+ open,
71
+ onOpenChange: setOpen,
72
+ "data-toc-popover": "",
73
+ ...container,
74
+ className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
75
+ children: /* @__PURE__ */ jsxs("header", {
76
+ ref,
77
+ className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
78
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
79
+ ...content,
80
+ children: [
81
+ header,
82
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
83
+ ...list,
84
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
85
+ item,
86
+ onClick: onClickItem
87
+ }, item.url))]
88
+ }) }),
89
+ footer
90
+ ]
91
+ })]
92
+ })
93
+ })
94
+ });
95
+ }
96
+ function PageTOCPopoverTrigger({ className, ...props }) {
97
+ const t = useTranslations({ note: "table of contents" });
98
+ const { open } = use(TocPopoverContext);
99
+ const items = useItems();
100
+ const selectedIdx = items.findIndex((item) => item.active);
101
+ const path = useTreePath().at(-1);
102
+ const showItem = selectedIdx !== -1 && !open;
103
+ return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
104
+ className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
105
+ "data-toc-popover-trigger": "",
106
+ ...props,
107
+ children: [
108
+ /* @__PURE__ */ jsx(ProgressCircle, {
109
+ value: (items.findLastIndex((item) => item.active) + 1) / Math.max(1, items.length),
110
+ max: 1,
111
+ className: cn("shrink-0", open && "text-fd-primary")
112
+ }),
113
+ /* @__PURE__ */ jsxs("span", {
114
+ className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
115
+ children: [/* @__PURE__ */ jsx("span", {
116
+ className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
117
+ children: path?.name ?? t("On this page")
118
+ }), /* @__PURE__ */ jsx("span", {
119
+ className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
120
+ children: items[selectedIdx]?.original.title
121
+ })]
122
+ }),
123
+ /* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
124
+ ]
125
+ });
126
+ }
127
+ function clamp(input, min, max) {
128
+ if (input < min) return min;
129
+ if (input > max) return max;
130
+ return input;
131
+ }
132
+ function ProgressCircle({ value, strokeWidth = 1.5, size = 18, min = 0, max = 100, style, ...restSvgProps }) {
133
+ const normalizedValue = clamp(value, min, max);
134
+ const radius = size / 2 - strokeWidth;
135
+ const circumference = 2 * Math.PI * radius;
136
+ const progress = normalizedValue / max * circumference;
137
+ const circleProps = {
138
+ cx: size / 2,
139
+ cy: size / 2,
140
+ r: radius,
141
+ fill: "none",
142
+ strokeWidth
143
+ };
144
+ return /* @__PURE__ */ jsxs("svg", {
145
+ role: "progressbar",
146
+ viewBox: `0 0 ${size} ${size}`,
147
+ "aria-valuenow": normalizedValue,
148
+ "aria-valuemin": min,
149
+ "aria-valuemax": max,
150
+ style: {
151
+ width: size,
152
+ height: size,
153
+ ...style
154
+ },
155
+ ...restSvgProps,
156
+ children: [/* @__PURE__ */ jsx("circle", {
157
+ ...circleProps,
158
+ className: "stroke-current/25"
159
+ }), /* @__PURE__ */ jsx("circle", {
160
+ ...circleProps,
161
+ stroke: "currentColor",
162
+ strokeDasharray: circumference,
163
+ strokeDashoffset: circumference - progress,
164
+ strokeLinecap: "round",
165
+ transform: `rotate(-90 ${size / 2} ${size / 2})`,
166
+ className: "transition-all"
167
+ })]
168
+ });
169
+ }
170
+ function PageTOCPopoverContent(props) {
171
+ return /* @__PURE__ */ jsx(CollapsibleContent, {
172
+ "data-toc-popover-content": "",
173
+ ...props,
174
+ children: /* @__PURE__ */ jsx("div", {
175
+ className: "flex flex-col px-4 max-h-[50vh] md:px-6",
176
+ children: props.children
177
+ })
178
+ });
179
+ }
180
+ //#endregion
181
+ export { TOC, TOCPopover, TOCProvider };
@@ -0,0 +1,5 @@
1
+ import { ComponentProps } from "react";
2
+ //#region src/layouts/notebook/slots/container.d.ts
3
+ declare function Container(props: ComponentProps<'div'>): import("react").JSX.Element;
4
+ //#endregion
5
+ export { Container };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { useNotebookLayout } from "../client.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useEffect, useState } from "react";
6
+ //#region src/layouts/notebook/slots/container.tsx
7
+ function Container(props) {
8
+ const { props: { nav }, slots } = useNotebookLayout();
9
+ const pageCol = "calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-col) - var(--fd-toc-width))";
10
+ const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
11
+ const [previousCollapsed, setPreviousCollapsed] = useState(collapsed);
12
+ const isCollapseChanged = previousCollapsed !== collapsed;
13
+ useEffect(() => {
14
+ if (isCollapseChanged) setPreviousCollapsed(collapsed);
15
+ }, [collapsed, isCollapseChanged]);
16
+ return /* @__PURE__ */ jsx("div", {
17
+ id: "nd-notebook-layout",
18
+ "data-sidebar-collapsed": collapsed,
19
+ "data-column-changed": isCollapseChanged,
20
+ ...props,
21
+ style: {
22
+ gridTemplate: nav?.mode === "top" ? `". header header header ."
23
+ "sidebar sidebar toc-popover toc-popover ."
24
+ "sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)` : `"sidebar sidebar header header ."
25
+ "sidebar sidebar toc-popover toc-popover ."
26
+ "sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)`,
27
+ "--fd-docs-row-1": "var(--fd-banner-height, 0px)",
28
+ "--fd-docs-row-2": "calc(var(--fd-docs-row-1) + var(--fd-header-height))",
29
+ "--fd-docs-row-3": "calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))",
30
+ "--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
31
+ ...props.style
32
+ },
33
+ className: cn("grid overflow-x-clip min-h-(--fd-docs-height) auto-cols-auto auto-rows-auto [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px] data-[column-changed=true]:transition-[grid-template-columns]", props.className),
34
+ children: props.children
35
+ });
36
+ }
37
+ //#endregion
38
+ export { Container };
@@ -0,0 +1,5 @@
1
+ import { ComponentProps } from "react";
2
+ //#region src/layouts/notebook/slots/header.d.ts
3
+ declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
4
+ //#endregion
5
+ export { Header };
@@ -0,0 +1,204 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { useTabsGroups } from "../../../contexts/tree.js";
5
+ import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
6
+ import { LinkItem } from "../../shared/client.js";
7
+ import { isLayoutTabActive } from "../../shared/index.js";
8
+ import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
9
+ import { useNotebookLayout } from "../client.js";
10
+ import Link from "@vx-oss/docs-core/link";
11
+ import { usePathname } from "@vx-oss/docs-core/framework";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { ChevronDown, Languages, Sidebar } from "lucide-react";
14
+ import { Fragment as Fragment$1, useMemo, useRef, useState } from "react";
15
+ //#region src/layouts/notebook/slots/header.tsx
16
+ function Header(props) {
17
+ const { slots, navItems, isNavTransparent, props: { tabMode, nav, tabs, sidebar } } = useNotebookLayout();
18
+ const { open } = slots.sidebar?.useSidebar?.() ?? {};
19
+ const navMode = nav?.mode ?? "auto";
20
+ const sidebarCollapsible = sidebar.collapsible ?? true;
21
+ const groups = useTabsGroups(tabs);
22
+ const showLayoutTabs = tabMode === "navbar" && groups.length > 0;
23
+ if (nav?.component) return nav.component;
24
+ return /* @__PURE__ */ jsxs("header", {
25
+ id: "nd-subnav",
26
+ "data-transparent": isNavTransparent && !open,
27
+ ...props,
28
+ className: cn("sticky [grid-area:header] flex flex-col top-(--fd-docs-row-1) z-10 backdrop-blur-sm transition-colors data-[transparent=false]:bg-fd-background/80 layout:[--fd-header-height:--spacing(14)]", showLayoutTabs && "lg:layout:[--fd-header-height:--spacing(24)]", props.className),
29
+ children: [/* @__PURE__ */ jsxs("div", {
30
+ "data-header-body": "",
31
+ className: cn("flex border-b px-4 gap-2 h-14", navMode === "top" && "md:px-6"),
32
+ children: [
33
+ /* @__PURE__ */ jsxs("div", {
34
+ className: cn("items-center", navMode === "top" && "flex flex-1", navMode === "auto" && "hidden has-data-[collapsed=true]:md:flex max-md:flex"),
35
+ children: [
36
+ sidebarCollapsible && slots.sidebar && navMode === "auto" && /* @__PURE__ */ jsx(slots.sidebar.collapseTrigger, {
37
+ className: cn(buttonVariants({
38
+ color: "ghost",
39
+ size: "icon-sm"
40
+ }), "-ms-1.5 text-fd-muted-foreground data-[collapsed=false]:hidden max-md:hidden"),
41
+ children: /* @__PURE__ */ jsx(Sidebar, {})
42
+ }),
43
+ slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: cn("inline-flex items-center gap-2.5 font-semibold", navMode === "auto" && "md:hidden") }),
44
+ nav?.children
45
+ ]
46
+ }),
47
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
48
+ hideIfDisabled: true,
49
+ className: cn("w-full my-auto max-md:hidden", navMode === "top" ? "ps-2.5 rounded-xl max-w-sm" : "max-w-[240px]")
50
+ }),
51
+ /* @__PURE__ */ jsxs("div", {
52
+ className: "flex flex-1 items-center justify-end md:gap-2",
53
+ children: [
54
+ /* @__PURE__ */ jsx("div", {
55
+ className: "flex items-center gap-6 empty:hidden max-lg:hidden",
56
+ children: navItems.filter((item) => item.type !== "icon").map((item, i) => /* @__PURE__ */ jsx(NavbarLinkItem, { item }, i))
57
+ }),
58
+ navItems.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
59
+ item,
60
+ className: cn(buttonVariants({
61
+ size: "icon-sm",
62
+ color: "ghost"
63
+ }), "text-fd-muted-foreground max-lg:hidden"),
64
+ "aria-label": item.label,
65
+ children: item.icon
66
+ }, i)),
67
+ /* @__PURE__ */ jsxs("div", {
68
+ className: "flex items-center md:hidden",
69
+ children: [slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
70
+ hideIfDisabled: true,
71
+ className: "p-2"
72
+ }), slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, {
73
+ className: cn(buttonVariants({
74
+ color: "ghost",
75
+ size: "icon-sm",
76
+ className: "p-2 -me-1.5"
77
+ })),
78
+ children: /* @__PURE__ */ jsx(Sidebar, {})
79
+ })]
80
+ }),
81
+ /* @__PURE__ */ jsxs("div", {
82
+ className: "flex items-center gap-2 max-md:hidden",
83
+ children: [
84
+ slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) }),
85
+ slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {}),
86
+ sidebarCollapsible && slots.sidebar && navMode === "top" && /* @__PURE__ */ jsx(slots.sidebar.collapseTrigger, {
87
+ className: cn(buttonVariants({
88
+ color: "secondary",
89
+ size: "icon-sm"
90
+ }), "text-fd-muted-foreground rounded-full -me-1.5"),
91
+ children: /* @__PURE__ */ jsx(Sidebar, {})
92
+ })
93
+ ]
94
+ })
95
+ ]
96
+ })
97
+ ]
98
+ }), showLayoutTabs && /* @__PURE__ */ jsx(LayoutHeaderTabs, {
99
+ "data-header-tabs": "",
100
+ className: "overflow-x-auto border-b px-6 h-10 max-lg:hidden",
101
+ tabs
102
+ })]
103
+ });
104
+ }
105
+ function LayoutHeaderTabs({ tabs: allTabs, className, ...props }) {
106
+ const pathname = usePathname();
107
+ const tabs = useTabsGroups(allTabs).findLast((group) => typeof group.active?.root !== "string")?.options;
108
+ const typedTabs = useMemo(() => {
109
+ return allTabs.filter((tab) => typeof tab.$folder?.root === "string");
110
+ }, [allTabs]);
111
+ const selectedIdx = useMemo(() => {
112
+ return tabs?.findLastIndex((option) => isLayoutTabActive(option, pathname)) ?? -1;
113
+ }, [tabs, pathname]);
114
+ return /* @__PURE__ */ jsxs("div", {
115
+ className: cn("flex flex-row items-end gap-6", className),
116
+ ...props,
117
+ children: [typedTabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, {
118
+ options: typedTabs,
119
+ className: "my-auto p-1"
120
+ }), tabs?.map((option, i) => {
121
+ const { title, url, unlisted, props: { className, ...rest } = {} } = option;
122
+ const isSelected = selectedIdx === i;
123
+ return /* @__PURE__ */ jsx(Link, {
124
+ href: url,
125
+ className: cn("inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground", unlisted && !isSelected && "hidden", isSelected && "border-fd-primary text-fd-primary", className),
126
+ ...rest,
127
+ children: title
128
+ }, i);
129
+ })]
130
+ });
131
+ }
132
+ function NavbarLinkItem({ item, className, ...props }) {
133
+ if (item.type === "custom") return item.children;
134
+ if (item.type === "menu") return /* @__PURE__ */ jsx(NavbarLinkItemMenu, {
135
+ item,
136
+ className,
137
+ ...props
138
+ });
139
+ return /* @__PURE__ */ jsx(LinkItem, {
140
+ item,
141
+ className: cn("text-sm text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary", className),
142
+ ...props,
143
+ children: item.text
144
+ });
145
+ }
146
+ function NavbarLinkItemMenu({ item, hoverDelay = 50, className, ...props }) {
147
+ const [open, setOpen] = useState(false);
148
+ const timeoutRef = useRef(null);
149
+ const freezeUntil = useRef(null);
150
+ const delaySetOpen = (value) => {
151
+ if (timeoutRef.current) {
152
+ clearTimeout(timeoutRef.current);
153
+ timeoutRef.current = null;
154
+ }
155
+ timeoutRef.current = window.setTimeout(() => {
156
+ setOpen(value);
157
+ freezeUntil.current = Date.now() + 300;
158
+ }, hoverDelay);
159
+ };
160
+ const onPointerEnter = (e) => {
161
+ if (e.pointerType === "touch") return;
162
+ delaySetOpen(true);
163
+ };
164
+ const onPointerLeave = (e) => {
165
+ if (e.pointerType === "touch") return;
166
+ delaySetOpen(false);
167
+ };
168
+ function isTouchDevice() {
169
+ return "ontouchstart" in window || navigator.maxTouchPoints > 0;
170
+ }
171
+ return /* @__PURE__ */ jsxs(Popover, {
172
+ open,
173
+ onOpenChange: (value) => {
174
+ if (freezeUntil.current === null || Date.now() >= freezeUntil.current) setOpen(value);
175
+ },
176
+ children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
177
+ className: cn("inline-flex items-center gap-1.5 p-1 text-sm text-fd-muted-foreground transition-colors has-data-[active=true]:text-fd-primary data-[state=open]:text-fd-accent-foreground focus-visible:outline-none", className),
178
+ onPointerEnter,
179
+ onPointerLeave,
180
+ ...props,
181
+ children: [item.url ? /* @__PURE__ */ jsx(LinkItem, {
182
+ item,
183
+ children: item.text
184
+ }) : item.text, /* @__PURE__ */ jsx(ChevronDown, { className: "size-3" })]
185
+ }), /* @__PURE__ */ jsx(PopoverContent, {
186
+ className: "flex flex-col p-1 text-fd-muted-foreground text-start",
187
+ onPointerEnter,
188
+ onPointerLeave,
189
+ children: item.items.map((child, i) => {
190
+ if (child.type === "custom") return /* @__PURE__ */ jsx(Fragment$1, { children: child.children }, i);
191
+ return /* @__PURE__ */ jsxs(LinkItem, {
192
+ item: child,
193
+ className: "inline-flex items-center gap-2 rounded-md p-2 transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4",
194
+ onClick: () => {
195
+ if (isTouchDevice()) setOpen(false);
196
+ },
197
+ children: [child.icon, child.text]
198
+ }, i);
199
+ })
200
+ })]
201
+ });
202
+ }
203
+ //#endregion
204
+ export { Header };
@@ -0,0 +1,23 @@
1
+ import { SidebarProviderProps as SidebarProviderProps$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
2
+ import { SidebarPageTreeComponents } from "../../../components/sidebar/page-tree.js";
3
+ import { ComponentProps, FC, ReactNode } from "react";
4
+ //#region src/layouts/notebook/slots/sidebar.d.ts
5
+ interface SidebarProps extends ComponentProps<'aside'> {
6
+ components?: Partial<SidebarPageTreeComponents>;
7
+ banner?: ReactNode | FC<ComponentProps<'div'>>;
8
+ footer?: ReactNode | FC<ComponentProps<'div'>>;
9
+ /**
10
+ * Support collapsing the sidebar on desktop mode
11
+ *
12
+ * @defaultValue true
13
+ */
14
+ collapsible?: boolean;
15
+ }
16
+ type SidebarProviderProps = SidebarProviderProps$1;
17
+ declare const useSidebar: typeof useSidebar$1;
18
+ declare function SidebarProvider(props: SidebarProviderProps): import("react").JSX.Element;
19
+ declare function SidebarTrigger(props: ComponentProps<'button'>): import("react").JSX.Element;
20
+ declare function SidebarCollapseTrigger(props: ComponentProps<'button'>): import("react").JSX.Element;
21
+ declare function Sidebar({ banner, footer, components, collapsible, ...rest }: SidebarProps): import("react").JSX.Element;
22
+ //#endregion
23
+ export { Sidebar, SidebarCollapseTrigger, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarTrigger, useSidebar };