@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,95 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { createContext, useContext, useEffect, useId, useMemo, useState } from "react";
6
+ //#region src/components/tabs.tsx
7
+ const TabsContext = createContext(null);
8
+ function useTabContext() {
9
+ const ctx = useContext(TabsContext);
10
+ if (!ctx) throw new Error("You must wrap your component in <Tabs>");
11
+ return ctx;
12
+ }
13
+ function TabsList(props) {
14
+ return /* @__PURE__ */ jsx(TabsList$1, {
15
+ ...props,
16
+ className: cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", props.className)
17
+ });
18
+ }
19
+ function TabsTrigger(props) {
20
+ return /* @__PURE__ */ jsx(TabsTrigger$1, {
21
+ ...props,
22
+ className: cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-fd-primary data-[state=active]:text-fd-primary", props.className)
23
+ });
24
+ }
25
+ function Tabs({ ref, className, items, label, defaultIndex = 0, defaultValue = items ? escapeValue(items[defaultIndex]) : void 0, ...props }) {
26
+ const [value, setValue] = useState(defaultValue);
27
+ const collection = useMemo(() => [], []);
28
+ return /* @__PURE__ */ jsxs(Tabs$1, {
29
+ ref,
30
+ className: cn("flex flex-col overflow-hidden rounded-xl border bg-fd-secondary my-4", className),
31
+ value,
32
+ onValueChange: (v) => {
33
+ if (items && !items.some((item) => escapeValue(item) === v)) return;
34
+ setValue(v);
35
+ },
36
+ ...props,
37
+ children: [items && /* @__PURE__ */ jsxs(TabsList, { children: [label && /* @__PURE__ */ jsx("span", {
38
+ className: "text-sm font-medium my-auto me-auto",
39
+ children: label
40
+ }), items.map((item) => /* @__PURE__ */ jsx(TabsTrigger, {
41
+ value: escapeValue(item),
42
+ children: item
43
+ }, item))] }), /* @__PURE__ */ jsx(TabsContext.Provider, {
44
+ value: useMemo(() => ({
45
+ items,
46
+ collection
47
+ }), [collection, items]),
48
+ children: props.children
49
+ })]
50
+ });
51
+ }
52
+ function Tab({ value, ...props }) {
53
+ const { items } = useTabContext();
54
+ const resolved = value ?? items?.at(useCollectionIndex());
55
+ if (!resolved) throw new Error("Failed to resolve tab `value`, please pass a `value` prop to the Tab component.");
56
+ return /* @__PURE__ */ jsx(TabsContent, {
57
+ value: escapeValue(resolved),
58
+ ...props,
59
+ children: props.children
60
+ });
61
+ }
62
+ function TabsContent({ value, className, ...props }) {
63
+ return /* @__PURE__ */ jsx(TabsContent$1, {
64
+ value,
65
+ className: cn("p-4 text-[0.9375rem] bg-fd-background rounded-xl outline-none prose-no-margin data-[state=inactive]:hidden [&>figure:only-child]:-m-4 [&>figure:only-child]:border-none", className),
66
+ ...props,
67
+ children: props.children
68
+ });
69
+ }
70
+ /**
71
+ * Inspired by Headless UI.
72
+ *
73
+ * Return the index of children, this is made possible by registering the order of render from children using React context.
74
+ * This is supposed by work with pre-rendering & pure client-side rendering.
75
+ */
76
+ function useCollectionIndex() {
77
+ const key = useId();
78
+ const { collection } = useTabContext();
79
+ useEffect(() => {
80
+ return () => {
81
+ const idx = collection.indexOf(key);
82
+ if (idx !== -1) collection.splice(idx, 1);
83
+ };
84
+ }, [key, collection]);
85
+ if (!collection.includes(key)) collection.push(key);
86
+ return collection.indexOf(key);
87
+ }
88
+ /**
89
+ * only escape whitespaces in values in simple mode
90
+ */
91
+ function escapeValue(v) {
92
+ return v.toLowerCase().replace(/\s/, "-");
93
+ }
94
+ //#endregion
95
+ export { Tab, Tabs, TabsContent, TabsList, TabsTrigger };
@@ -0,0 +1,11 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "@vx-oss/docs-core/toc";
3
+ //#region src/components/toc/clerk.d.ts
4
+ type TOCItemsProps = ComponentProps<'div'>;
5
+ declare function TOCItems({ ref, className, children, ...props }: TOCItemsProps): import("react").JSX.Element;
6
+ declare function TOCEmpty(): import("react").JSX.Element;
7
+ declare function TOCItem({ item, ...props }: Primitive.TOCItemProps & {
8
+ item: Primitive.TOCItemType;
9
+ }): import("react").JSX.Element;
10
+ //#endregion
11
+ export { TOCEmpty, TOCItem, TOCItems, TOCItemsProps };
@@ -0,0 +1,227 @@
1
+ "use client";
2
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { mergeRefs } from "../../utils/merge-refs.js";
5
+ import { useTOCItems } from "./index.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import { useTranslations } from "@fuma-translate/react";
9
+ import * as Primitive from "@vx-oss/docs-core/toc";
10
+ //#region src/components/toc/clerk.tsx
11
+ var clerk_exports = /* @__PURE__ */ __exportAll({
12
+ TOCEmpty: () => TOCEmpty,
13
+ TOCItem: () => TOCItem,
14
+ TOCItems: () => TOCItems
15
+ });
16
+ function TOCItems({ ref, className, children, ...props }) {
17
+ const containerRef = useRef(null);
18
+ const items = useTOCItems();
19
+ const [svg, setSvg] = useState(null);
20
+ const onPrint = useCallback(() => {
21
+ const container = containerRef.current;
22
+ if (!container || container.clientHeight === 0) return;
23
+ if (items.length === 0) {
24
+ setSvg(null);
25
+ return;
26
+ }
27
+ let w = 0;
28
+ let h = 0;
29
+ let d = "";
30
+ const positions = [];
31
+ const output = [];
32
+ for (let i = 0; i < items.length; i++) {
33
+ const item = items[i];
34
+ const element = container.querySelector(`a[href="${item.url}"]`);
35
+ if (!element) continue;
36
+ const styles = getComputedStyle(element);
37
+ const x = getLineOffset(item.depth) + .5;
38
+ const top = element.offsetTop + parseFloat(styles.paddingTop);
39
+ const bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
40
+ w = Math.max(x + 8, w);
41
+ h = Math.max(h, bottom);
42
+ if (i === 0) d += ` M${x} ${top} L${x} ${bottom}`;
43
+ else {
44
+ const [, upperBottom, upperX] = i > 0 ? positions[i - 1] : [
45
+ 0,
46
+ 0,
47
+ 0
48
+ ];
49
+ d += ` L ${upperX} ${upperBottom} ${x} ${top} L${x} ${bottom}`;
50
+ }
51
+ if (item._step !== void 0) output.push(/* @__PURE__ */ jsxs("g", {
52
+ transform: `translate(${x}, ${(top + bottom) / 2})`,
53
+ children: [/* @__PURE__ */ jsx("circle", {
54
+ cx: "0",
55
+ cy: "0",
56
+ r: "8",
57
+ className: "fill-fd-primary"
58
+ }), /* @__PURE__ */ jsx("text", {
59
+ cx: "0",
60
+ cy: "0",
61
+ textAnchor: "middle",
62
+ alignmentBaseline: "central",
63
+ dominantBaseline: "middle",
64
+ className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
65
+ children: item._step
66
+ })]
67
+ }, i));
68
+ positions.push([
69
+ top,
70
+ bottom,
71
+ x
72
+ ]);
73
+ }
74
+ output.unshift(/* @__PURE__ */ jsx("path", {
75
+ d,
76
+ className: "stroke-fd-primary",
77
+ strokeWidth: "1",
78
+ fill: "none"
79
+ }, "path"));
80
+ setSvg({
81
+ content: output,
82
+ width: w,
83
+ height: h,
84
+ d,
85
+ itemLineLengths: [],
86
+ positions
87
+ });
88
+ }, [items]);
89
+ useEffect(() => {
90
+ const container = containerRef.current;
91
+ if (!container) return;
92
+ const observer = new ResizeObserver(onPrint);
93
+ observer.observe(container);
94
+ onPrint();
95
+ return () => {
96
+ observer.unobserve(container);
97
+ };
98
+ }, [onPrint]);
99
+ return /* @__PURE__ */ jsxs("div", {
100
+ ref: mergeRefs(containerRef, ref),
101
+ className: cn("relative flex flex-col", className),
102
+ ...props,
103
+ children: [svg && /* @__PURE__ */ jsx(ThumbTrack, { computed: svg }), children]
104
+ });
105
+ }
106
+ function TOCEmpty() {
107
+ const t = useTranslations({ note: "table of contents" });
108
+ return /* @__PURE__ */ jsx("div", {
109
+ className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
110
+ children: t("No Headings")
111
+ });
112
+ }
113
+ function ThumbTrack({ computed }) {
114
+ const ref = useRef(null);
115
+ const tocInfo = Primitive.useTOC();
116
+ function calculate(items) {
117
+ const out = {};
118
+ const startIdx = items.findIndex((item) => item.active);
119
+ if (startIdx === -1) return out;
120
+ const endIdx = items.findLastIndex((item) => item.active);
121
+ out["--track-top"] = `${computed.positions[startIdx][0]}px`;
122
+ out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
123
+ return out;
124
+ }
125
+ Primitive.useTOCListener((items) => {
126
+ const element = ref.current;
127
+ if (!element) return;
128
+ for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
129
+ });
130
+ return /* @__PURE__ */ jsx("div", {
131
+ ref,
132
+ className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
133
+ style: {
134
+ width: computed.width,
135
+ height: computed.height,
136
+ ...calculate(tocInfo.get())
137
+ },
138
+ children: /* @__PURE__ */ jsx("svg", {
139
+ xmlns: "http://www.w3.org/2000/svg",
140
+ viewBox: `0 0 ${computed.width} ${computed.height}`,
141
+ className: "absolute transition-[clip-path]",
142
+ style: {
143
+ width: computed.width,
144
+ height: computed.height,
145
+ clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))`
146
+ },
147
+ children: computed.content
148
+ })
149
+ });
150
+ }
151
+ const BASE = 8;
152
+ function getItemOffset(depth) {
153
+ if (depth <= 2) return 20;
154
+ if (depth === 3) return 32;
155
+ return 44;
156
+ }
157
+ function getLineOffset(depth) {
158
+ if (depth <= 2) return BASE;
159
+ if (depth === 3) return 20;
160
+ return 32;
161
+ }
162
+ function TOCItem({ item, ...props }) {
163
+ const items = useTOCItems();
164
+ const { isFirst, isLast, svg } = useMemo(() => {
165
+ const index = items.indexOf(item);
166
+ const isFirst = index === 0;
167
+ const isLast = index === items.length - 1;
168
+ const l1 = getLineOffset(item.depth);
169
+ const l0 = isFirst ? l1 : getLineOffset(items[index - 1].depth);
170
+ const l2 = isLast ? l1 : getLineOffset(items[index + 1].depth);
171
+ return {
172
+ isFirst,
173
+ isLast,
174
+ svg: /* @__PURE__ */ jsxs("svg", {
175
+ xmlns: "http://www.w3.org/2000/svg",
176
+ className: cn("absolute -top-1.5 inset-s-0 bottom-0 h-[calc(100%+--spacing(1.5))] -z-1 rtl:-scale-x-100", l1 !== l2 && "h-full bottom-1.5"),
177
+ style: { width: Math.max(l0, l1) + 9 },
178
+ children: [
179
+ l0 !== l1 && /* @__PURE__ */ jsx("path", {
180
+ d: `M ${l0 + .5} 0 L ${l0 + .5} 0 ${l1 + .5} 12`,
181
+ stroke: "black",
182
+ strokeWidth: "1",
183
+ fill: "none",
184
+ className: "stroke-fd-foreground/10"
185
+ }),
186
+ /* @__PURE__ */ jsx("line", {
187
+ x1: l1 + .5,
188
+ y1: l0 === l1 ? "6" : "12",
189
+ x2: l1 + .5,
190
+ y2: "100%",
191
+ strokeWidth: "1",
192
+ className: "stroke-fd-foreground/10"
193
+ }),
194
+ item._step !== void 0 && /* @__PURE__ */ jsxs("g", {
195
+ transform: `translate(${l1 + .5}, ${l1 === l2 ? "3" : "6"})`,
196
+ children: [/* @__PURE__ */ jsx("circle", {
197
+ cx: "0",
198
+ cy: "50%",
199
+ r: "8",
200
+ className: "fill-fd-muted"
201
+ }), /* @__PURE__ */ jsx("text", {
202
+ x: "0",
203
+ y: "50%",
204
+ textAnchor: "middle",
205
+ alignmentBaseline: "central",
206
+ dominantBaseline: "middle",
207
+ className: "fill-fd-muted-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
208
+ children: item._step
209
+ })]
210
+ })
211
+ ]
212
+ })
213
+ };
214
+ }, [items, item]);
215
+ return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
216
+ href: item.url,
217
+ ...props,
218
+ className: cn("prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere data-[active=true]:text-fd-primary", isFirst && "pt-0", isLast && "pb-0", props.className),
219
+ style: {
220
+ paddingInlineStart: getItemOffset(item.depth),
221
+ ...props.style
222
+ },
223
+ children: [svg, item.title]
224
+ });
225
+ }
226
+ //#endregion
227
+ export { TOCEmpty, TOCItem, TOCItems, clerk_exports };
@@ -0,0 +1,13 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "@vx-oss/docs-core/toc";
3
+ //#region src/components/toc/default.d.ts
4
+ interface TOCItemsProps extends ComponentProps<'div'> {
5
+ thumbBox?: boolean;
6
+ }
7
+ declare function TOCItems({ ref, className, thumbBox, children, ...props }: TOCItemsProps): import("react").JSX.Element;
8
+ declare function TOCEmpty(): import("react").JSX.Element;
9
+ declare function TOCItem({ item, ...props }: Primitive.TOCItemProps & {
10
+ item: Primitive.TOCItemType;
11
+ }): import("react").JSX.Element;
12
+ //#endregion
13
+ export { TOCEmpty, TOCItem, TOCItems, TOCItemsProps };
@@ -0,0 +1,260 @@
1
+ "use client";
2
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { mergeRefs } from "../../utils/merge-refs.js";
5
+ import { useTOCItems } from "./index.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import { useTranslations } from "@fuma-translate/react";
9
+ import * as Primitive from "@vx-oss/docs-core/toc";
10
+ //#region src/components/toc/default.tsx
11
+ var default_exports = /* @__PURE__ */ __exportAll({
12
+ TOCEmpty: () => TOCEmpty,
13
+ TOCItem: () => TOCItem,
14
+ TOCItems: () => TOCItems
15
+ });
16
+ function TOCItems({ ref, className, thumbBox = true, children, ...props }) {
17
+ const containerRef = useRef(null);
18
+ const items = useTOCItems();
19
+ const [svg, setSvg] = useState(null);
20
+ const onPrint = useCallback(() => {
21
+ const container = containerRef.current;
22
+ if (!container || container.clientHeight === 0) return;
23
+ if (items.length === 0) {
24
+ setSvg(null);
25
+ return;
26
+ }
27
+ let w = 0;
28
+ let h = 0;
29
+ let d = "";
30
+ const positions = [];
31
+ const output = [];
32
+ for (let i = 0; i < items.length; i++) {
33
+ const item = items[i];
34
+ const element = container.querySelector(`a[href="${item.url}"]`);
35
+ if (!element) continue;
36
+ const styles = getComputedStyle(element);
37
+ const x = getLineOffset(item.depth) + .5;
38
+ const top = element.offsetTop + parseFloat(styles.paddingTop);
39
+ const bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
40
+ w = Math.max(x + 8, w);
41
+ h = Math.max(h, bottom);
42
+ if (i === 0) d += ` M${x} ${top} L${x} ${bottom}`;
43
+ else {
44
+ const [, upperBottom, upperX] = i > 0 ? positions[i - 1] : [
45
+ 0,
46
+ 0,
47
+ 0
48
+ ];
49
+ d += ` C ${upperX} ${top - 4} ${x} ${upperBottom + 4} ${x} ${top} L${x} ${bottom}`;
50
+ }
51
+ if (item._step !== void 0) output.push(/* @__PURE__ */ jsxs("g", {
52
+ transform: `translate(${x}, ${(top + bottom) / 2})`,
53
+ children: [/* @__PURE__ */ jsx("circle", {
54
+ cx: "0",
55
+ cy: "0",
56
+ r: "8",
57
+ className: "fill-fd-primary"
58
+ }), /* @__PURE__ */ jsx("text", {
59
+ cx: "0",
60
+ cy: "0",
61
+ textAnchor: "middle",
62
+ alignmentBaseline: "central",
63
+ dominantBaseline: "middle",
64
+ className: "fill-fd-primary-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
65
+ children: item._step
66
+ })]
67
+ }, i));
68
+ positions.push([
69
+ top,
70
+ bottom,
71
+ x
72
+ ]);
73
+ }
74
+ output.unshift(/* @__PURE__ */ jsx("path", {
75
+ d,
76
+ className: "stroke-fd-primary",
77
+ strokeWidth: "1",
78
+ fill: "none"
79
+ }, "path"));
80
+ const itemLineLengths = [];
81
+ if (thumbBox) {
82
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
83
+ path.setAttribute("d", d);
84
+ const n = path.getTotalLength();
85
+ for (let i = 0; i < positions.length; i++) {
86
+ const [top, bottom] = positions[i];
87
+ let l = i > 0 ? itemLineLengths[i - 1][1] + (top - positions[i - 1][1]) : top;
88
+ while (l < n && path.getPointAtLength(l).y < top) l++;
89
+ itemLineLengths.push([l, l + bottom - top]);
90
+ }
91
+ }
92
+ setSvg({
93
+ content: output,
94
+ width: w,
95
+ height: h,
96
+ d,
97
+ itemLineLengths,
98
+ positions
99
+ });
100
+ }, [items, thumbBox]);
101
+ useEffect(() => {
102
+ const container = containerRef.current;
103
+ if (!container) return;
104
+ const observer = new ResizeObserver(onPrint);
105
+ observer.observe(container);
106
+ onPrint();
107
+ return () => {
108
+ observer.unobserve(container);
109
+ };
110
+ }, [onPrint]);
111
+ return /* @__PURE__ */ jsxs("div", {
112
+ ref: mergeRefs(containerRef, ref),
113
+ className: cn("relative flex flex-col", className),
114
+ ...props,
115
+ children: [svg && /* @__PURE__ */ jsx(ThumbTrack, {
116
+ computed: svg,
117
+ thumbBox
118
+ }), children]
119
+ });
120
+ }
121
+ function TOCEmpty() {
122
+ const t = useTranslations({ note: "table of contents" });
123
+ return /* @__PURE__ */ jsx("div", {
124
+ className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
125
+ children: t("No Headings")
126
+ });
127
+ }
128
+ function ThumbTrack({ computed, thumbBox }) {
129
+ const ref = useRef(null);
130
+ const previousRef = useRef(null);
131
+ const tocInfo = Primitive.useTOC();
132
+ function calculate(items) {
133
+ const out = {};
134
+ const startIdx = items.findIndex((item) => item.active);
135
+ if (startIdx === -1) return out;
136
+ const endIdx = items.findLastIndex((item) => item.active);
137
+ out["--track-top"] = `${computed.positions[startIdx][0]}px`;
138
+ out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
139
+ if (thumbBox) {
140
+ let isUp = false;
141
+ if (previousRef.current) {
142
+ const prev = previousRef.current;
143
+ isUp = prev.startIdx > startIdx || prev.endIdx > endIdx || prev.startIdx === startIdx && prev.endIdx === endIdx && prev.isUp;
144
+ }
145
+ previousRef.current = {
146
+ startIdx,
147
+ endIdx,
148
+ isUp
149
+ };
150
+ out["--offset-distance"] = isUp ? `${computed.itemLineLengths[startIdx][0]}px` : `${computed.itemLineLengths[endIdx][1]}px`;
151
+ out["--opacity"] = items[isUp ? startIdx : endIdx].original._step !== void 0 ? "0" : "1";
152
+ }
153
+ return out;
154
+ }
155
+ Primitive.useTOCListener((items) => {
156
+ const element = ref.current;
157
+ if (!element) return;
158
+ for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
159
+ });
160
+ return /* @__PURE__ */ jsxs("div", {
161
+ ref,
162
+ className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
163
+ style: {
164
+ width: computed.width,
165
+ height: computed.height,
166
+ ...calculate(tocInfo.get())
167
+ },
168
+ children: [/* @__PURE__ */ jsx("svg", {
169
+ xmlns: "http://www.w3.org/2000/svg",
170
+ viewBox: `0 0 ${computed.width} ${computed.height}`,
171
+ className: "absolute transition-[clip-path]",
172
+ style: {
173
+ width: computed.width,
174
+ height: computed.height,
175
+ clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))`
176
+ },
177
+ children: computed.content
178
+ }), thumbBox && /* @__PURE__ */ jsx("div", {
179
+ className: "absolute left-0 size-1 bg-fd-primary rounded-full [offset-distance:var(--offset-distance,0)] opacity-(--opacity,0) transition-[opacity,offset-distance]",
180
+ style: { offsetPath: `path("${computed.d}")` }
181
+ })]
182
+ });
183
+ }
184
+ const BASE = 8;
185
+ function getItemOffset(depth) {
186
+ if (depth <= 2) return 20;
187
+ if (depth === 3) return 32;
188
+ return 44;
189
+ }
190
+ function getLineOffset(depth) {
191
+ if (depth <= 2) return BASE;
192
+ if (depth === 3) return 16;
193
+ return 24;
194
+ }
195
+ function TOCItem({ item, ...props }) {
196
+ const items = useTOCItems();
197
+ const { isFirst, isLast, svg } = useMemo(() => {
198
+ const index = items.indexOf(item);
199
+ const isFirst = index === 0;
200
+ const isLast = index === items.length - 1;
201
+ const l1 = getLineOffset(item.depth);
202
+ const l0 = isFirst ? l1 : getLineOffset(items[index - 1].depth);
203
+ const l2 = isLast ? l1 : getLineOffset(items[index + 1].depth);
204
+ return {
205
+ isFirst,
206
+ isLast,
207
+ svg: /* @__PURE__ */ jsxs("svg", {
208
+ xmlns: "http://www.w3.org/2000/svg",
209
+ className: cn("absolute -top-1.5 inset-s-0 bottom-0 h-[calc(100%+--spacing(1.5))] -z-1 rtl:-scale-x-100", l1 !== l2 && "h-full bottom-1.5"),
210
+ style: { width: Math.max(l0, l1) + 9 },
211
+ children: [
212
+ l0 !== l1 && /* @__PURE__ */ jsx("path", {
213
+ d: `M ${l0 + .5} 0 C ${l0 + .5} 8 ${l1 + .5} 4 ${l1 + .5} 12`,
214
+ stroke: "black",
215
+ strokeWidth: "1",
216
+ fill: "none",
217
+ className: "stroke-fd-foreground/10"
218
+ }),
219
+ /* @__PURE__ */ jsx("line", {
220
+ x1: l1 + .5,
221
+ y1: l0 === l1 ? "6" : "12",
222
+ x2: l1 + .5,
223
+ y2: "100%",
224
+ strokeWidth: "1",
225
+ className: "stroke-fd-foreground/10"
226
+ }),
227
+ item._step !== void 0 && /* @__PURE__ */ jsxs("g", {
228
+ transform: `translate(${l1 + .5}, ${l1 === l2 ? "3" : "6"})`,
229
+ children: [/* @__PURE__ */ jsx("circle", {
230
+ cx: "0",
231
+ cy: "50%",
232
+ r: "8",
233
+ className: "fill-fd-muted"
234
+ }), /* @__PURE__ */ jsx("text", {
235
+ x: "0",
236
+ y: "50%",
237
+ textAnchor: "middle",
238
+ alignmentBaseline: "central",
239
+ dominantBaseline: "middle",
240
+ className: "fill-fd-muted-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
241
+ children: item._step
242
+ })]
243
+ })
244
+ ]
245
+ })
246
+ };
247
+ }, [items, item]);
248
+ return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
249
+ href: item.url,
250
+ ...props,
251
+ className: cn("prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere data-[active=true]:text-fd-primary", isFirst && "pt-0", isLast && "pb-0", props.className),
252
+ style: {
253
+ paddingInlineStart: getItemOffset(item.depth),
254
+ ...props.style
255
+ },
256
+ children: [svg, item.title]
257
+ });
258
+ }
259
+ //#endregion
260
+ export { TOCEmpty, TOCItem, TOCItems, default_exports };
@@ -0,0 +1,10 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "@vx-oss/docs-core/toc";
3
+ //#region src/components/toc/index.d.ts
4
+ declare function useTOCItems(): Primitive.TOCItemType[];
5
+ type TOCProviderProps = Primitive.AnchorProviderProps;
6
+ declare const useActiveAnchor: typeof Primitive.useActiveAnchor, useActiveAnchors: typeof Primitive.useActiveAnchors, useItems: typeof Primitive.useItems;
7
+ declare function TOCProvider({ toc, children, ...props }: TOCProviderProps): import("react").JSX.Element;
8
+ declare function TOCScrollArea({ ref, className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
9
+ //#endregion
10
+ export { TOCProvider, TOCProviderProps, TOCScrollArea, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { mergeRefs } from "../../utils/merge-refs.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { createContext, use, useRef } from "react";
7
+ import * as Primitive from "@vx-oss/docs-core/toc";
8
+ //#region src/components/toc/index.tsx
9
+ var toc_exports = /* @__PURE__ */ __exportAll({
10
+ TOCProvider: () => TOCProvider,
11
+ TOCScrollArea: () => TOCScrollArea,
12
+ useActiveAnchor: () => useActiveAnchor,
13
+ useActiveAnchors: () => useActiveAnchors,
14
+ useItems: () => useItems,
15
+ useTOCItems: () => useTOCItems
16
+ });
17
+ const TOCContext = createContext([]);
18
+ function useTOCItems() {
19
+ return use(TOCContext);
20
+ }
21
+ const { useActiveAnchor, useActiveAnchors, useItems } = Primitive;
22
+ function TOCProvider({ toc, children, ...props }) {
23
+ return /* @__PURE__ */ jsx(TOCContext, {
24
+ value: toc,
25
+ children: /* @__PURE__ */ jsx(Primitive.AnchorProvider, {
26
+ toc,
27
+ ...props,
28
+ children
29
+ })
30
+ });
31
+ }
32
+ function TOCScrollArea({ ref, className, ...props }) {
33
+ const viewRef = useRef(null);
34
+ return /* @__PURE__ */ jsx("div", {
35
+ ref: mergeRefs(viewRef, ref),
36
+ className: cn("relative min-h-0 text-sm ms-px overflow-auto overscroll-contain [scrollbar-width:none] mask-[linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)] py-3", className),
37
+ ...props,
38
+ children: /* @__PURE__ */ jsx(Primitive.ScrollProvider, {
39
+ containerRef: viewRef,
40
+ children: props.children
41
+ })
42
+ });
43
+ }
44
+ //#endregion
45
+ export { TOCProvider, TOCScrollArea, toc_exports, useActiveAnchor, useActiveAnchors, useItems, useTOCItems };