opin-ui 0.0.1

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 (243) hide show
  1. package/README.md +5 -0
  2. package/css/aspen.css +39 -0
  3. package/css/black.css +39 -0
  4. package/css/catppuccin.css +49 -0
  5. package/css/dusk.css +47 -0
  6. package/css/emerald.css +39 -0
  7. package/css/generated/docs.css +1 -0
  8. package/css/generated/flux.css +1 -0
  9. package/css/generated/home.css +1 -0
  10. package/css/generated/notebook.css +1 -0
  11. package/css/generated/shared.css +1 -0
  12. package/css/lib/base.css +314 -0
  13. package/css/lib/default-colors.css +51 -0
  14. package/css/lib/shiki.css +108 -0
  15. package/css/neutral.css +7 -0
  16. package/css/ocean.css +44 -0
  17. package/css/preset-legacy.css +43 -0
  18. package/css/preset.css +11 -0
  19. package/css/purple.css +39 -0
  20. package/css/ruby.css +39 -0
  21. package/css/shadcn.css +36 -0
  22. package/css/solar.css +75 -0
  23. package/css/style.css +9 -0
  24. package/css/vitepress.css +65 -0
  25. package/dist/.translations/index.d.ts +49 -0
  26. package/dist/.translations/keys.js +49 -0
  27. package/dist/_virtual/_rolldown/runtime.js +13 -0
  28. package/dist/components/accordion.d.ts +23 -0
  29. package/dist/components/accordion.js +68 -0
  30. package/dist/components/banner.d.ts +33 -0
  31. package/dist/components/banner.js +85 -0
  32. package/dist/components/callout.d.ts +41 -0
  33. package/dist/components/callout.js +53 -0
  34. package/dist/components/card.d.ts +19 -0
  35. package/dist/components/card.js +38 -0
  36. package/dist/components/codeblock.d.ts +61 -0
  37. package/dist/components/codeblock.js +173 -0
  38. package/dist/components/codeblock.rsc.d.ts +20 -0
  39. package/dist/components/codeblock.rsc.js +22 -0
  40. package/dist/components/dialog/search-algolia.d.ts +36 -0
  41. package/dist/components/dialog/search-algolia.js +64 -0
  42. package/dist/components/dialog/search-default.d.ts +36 -0
  43. package/dist/components/dialog/search-default.js +58 -0
  44. package/dist/components/dialog/search-orama.d.ts +43 -0
  45. package/dist/components/dialog/search-orama.js +69 -0
  46. package/dist/components/dialog/search.d.ts +112 -0
  47. package/dist/components/dialog/search.js +350 -0
  48. package/dist/components/dynamic-codeblock.core.d.ts +34 -0
  49. package/dist/components/dynamic-codeblock.core.js +51 -0
  50. package/dist/components/dynamic-codeblock.d.ts +9 -0
  51. package/dist/components/dynamic-codeblock.js +17 -0
  52. package/dist/components/files.d.ts +34 -0
  53. package/dist/components/files.js +40 -0
  54. package/dist/components/github-info.d.ts +35 -0
  55. package/dist/components/github-info.js +75 -0
  56. package/dist/components/heading.d.ts +13 -0
  57. package/dist/components/heading.js +38 -0
  58. package/dist/components/image-zoom.d.ts +23 -0
  59. package/dist/components/image-zoom.js +32 -0
  60. package/dist/components/image-zoom2.css +71 -0
  61. package/dist/components/inline-toc.d.ts +14 -0
  62. package/dist/components/inline-toc.js +28 -0
  63. package/dist/components/sidebar/base.d.ts +131 -0
  64. package/dist/components/sidebar/base.js +274 -0
  65. package/dist/components/sidebar/link-item.d.ts +22 -0
  66. package/dist/components/sidebar/link-item.js +38 -0
  67. package/dist/components/sidebar/page-tree.d.ts +28 -0
  68. package/dist/components/sidebar/page-tree.js +71 -0
  69. package/dist/components/sidebar/tabs/dropdown.d.ts +16 -0
  70. package/dist/components/sidebar/tabs/dropdown.js +71 -0
  71. package/dist/components/sidebar/tabs/index.d.ts +11 -0
  72. package/dist/components/sidebar/tabs/index.js +46 -0
  73. package/dist/components/steps.d.ts +15 -0
  74. package/dist/components/steps.js +16 -0
  75. package/dist/components/tabs.d.ts +49 -0
  76. package/dist/components/tabs.js +88 -0
  77. package/dist/components/toc/clerk.d.ts +20 -0
  78. package/dist/components/toc/clerk.js +226 -0
  79. package/dist/components/toc/default.d.ts +23 -0
  80. package/dist/components/toc/default.js +259 -0
  81. package/dist/components/toc/index.d.ts +19 -0
  82. package/dist/components/toc/index.js +45 -0
  83. package/dist/components/type-table.d.ts +43 -0
  84. package/dist/components/type-table.js +117 -0
  85. package/dist/components/ui/accordion.d.ts +30 -0
  86. package/dist/components/ui/accordion.js +42 -0
  87. package/dist/components/ui/button.d.ts +11 -0
  88. package/dist/components/ui/button.js +20 -0
  89. package/dist/components/ui/collapsible.d.ts +15 -0
  90. package/dist/components/ui/collapsible.js +21 -0
  91. package/dist/components/ui/navigation-menu.d.ts +30 -0
  92. package/dist/components/ui/navigation-menu.js +41 -0
  93. package/dist/components/ui/popover.d.ts +15 -0
  94. package/dist/components/ui/popover.js +20 -0
  95. package/dist/components/ui/scroll-area.d.ts +22 -0
  96. package/dist/components/ui/scroll-area.js +34 -0
  97. package/dist/components/ui/tabs.d.ts +36 -0
  98. package/dist/components/ui/tabs.js +77 -0
  99. package/dist/contexts/i18n.d.ts +41 -0
  100. package/dist/contexts/i18n.js +37 -0
  101. package/dist/contexts/search.d.ts +73 -0
  102. package/dist/contexts/search.js +68 -0
  103. package/dist/contexts/tree.d.ts +20 -0
  104. package/dist/contexts/tree.js +38 -0
  105. package/dist/i18n.d.ts +16 -0
  106. package/dist/i18n.js +38 -0
  107. package/dist/layouts/docs/client.d.ts +34 -0
  108. package/dist/layouts/docs/client.js +92 -0
  109. package/dist/layouts/docs/index.d.ts +44 -0
  110. package/dist/layouts/docs/index.js +22 -0
  111. package/dist/layouts/docs/page/index.d.ts +115 -0
  112. package/dist/layouts/docs/page/index.js +124 -0
  113. package/dist/layouts/docs/page/slots/breadcrumb.d.ts +13 -0
  114. package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
  115. package/dist/layouts/docs/page/slots/container.d.ts +6 -0
  116. package/dist/layouts/docs/page/slots/container.js +17 -0
  117. package/dist/layouts/docs/page/slots/footer.d.ts +22 -0
  118. package/dist/layouts/docs/page/slots/footer.js +56 -0
  119. package/dist/layouts/docs/page/slots/toc.d.ts +62 -0
  120. package/dist/layouts/docs/page/slots/toc.js +182 -0
  121. package/dist/layouts/docs/slots/container.d.ts +6 -0
  122. package/dist/layouts/docs/slots/container.js +36 -0
  123. package/dist/layouts/docs/slots/header.d.ts +6 -0
  124. package/dist/layouts/docs/slots/header.js +38 -0
  125. package/dist/layouts/docs/slots/sidebar.d.ts +29 -0
  126. package/dist/layouts/docs/slots/sidebar.js +326 -0
  127. package/dist/layouts/flux/index.d.ts +73 -0
  128. package/dist/layouts/flux/index.js +146 -0
  129. package/dist/layouts/flux/page/index.d.ts +102 -0
  130. package/dist/layouts/flux/page/index.js +104 -0
  131. package/dist/layouts/flux/page/slots/breadcrumb.d.ts +13 -0
  132. package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
  133. package/dist/layouts/flux/page/slots/container.d.ts +6 -0
  134. package/dist/layouts/flux/page/slots/container.js +17 -0
  135. package/dist/layouts/flux/page/slots/footer.d.ts +22 -0
  136. package/dist/layouts/flux/page/slots/footer.js +56 -0
  137. package/dist/layouts/flux/page/slots/toc.d.ts +38 -0
  138. package/dist/layouts/flux/page/slots/toc.js +181 -0
  139. package/dist/layouts/flux/slots/container.d.ts +6 -0
  140. package/dist/layouts/flux/slots/container.js +13 -0
  141. package/dist/layouts/flux/slots/sidebar.d.ts +22 -0
  142. package/dist/layouts/flux/slots/sidebar.js +237 -0
  143. package/dist/layouts/flux/slots/tab-dropdown.d.ts +16 -0
  144. package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
  145. package/dist/layouts/home/index.d.ts +28 -0
  146. package/dist/layouts/home/index.js +40 -0
  147. package/dist/layouts/home/navbar.d.ts +10 -0
  148. package/dist/layouts/home/navbar.js +34 -0
  149. package/dist/layouts/home/not-found.d.ts +7 -0
  150. package/dist/layouts/home/not-found.js +41 -0
  151. package/dist/layouts/home/slots/container.d.ts +6 -0
  152. package/dist/layouts/home/slots/container.js +13 -0
  153. package/dist/layouts/home/slots/header.d.ts +9 -0
  154. package/dist/layouts/home/slots/header.js +239 -0
  155. package/dist/layouts/notebook/client.d.ts +36 -0
  156. package/dist/layouts/notebook/client.js +69 -0
  157. package/dist/layouts/notebook/index.d.ts +37 -0
  158. package/dist/layouts/notebook/index.js +22 -0
  159. package/dist/layouts/notebook/page/index.d.ts +115 -0
  160. package/dist/layouts/notebook/page/index.js +124 -0
  161. package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +13 -0
  162. package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
  163. package/dist/layouts/notebook/page/slots/container.d.ts +6 -0
  164. package/dist/layouts/notebook/page/slots/container.js +17 -0
  165. package/dist/layouts/notebook/page/slots/footer.d.ts +22 -0
  166. package/dist/layouts/notebook/page/slots/footer.js +56 -0
  167. package/dist/layouts/notebook/page/slots/toc.d.ts +62 -0
  168. package/dist/layouts/notebook/page/slots/toc.js +181 -0
  169. package/dist/layouts/notebook/slots/container.d.ts +6 -0
  170. package/dist/layouts/notebook/slots/container.js +38 -0
  171. package/dist/layouts/notebook/slots/header.d.ts +6 -0
  172. package/dist/layouts/notebook/slots/header.js +194 -0
  173. package/dist/layouts/notebook/slots/sidebar.d.ts +30 -0
  174. package/dist/layouts/notebook/slots/sidebar.js +298 -0
  175. package/dist/layouts/shared/client.d.ts +44 -0
  176. package/dist/layouts/shared/client.js +84 -0
  177. package/dist/layouts/shared/index.d.ts +178 -0
  178. package/dist/layouts/shared/index.js +98 -0
  179. package/dist/layouts/shared/page-actions.d.ts +35 -0
  180. package/dist/layouts/shared/page-actions.js +195 -0
  181. package/dist/layouts/shared/slots/language-select.d.ts +18 -0
  182. package/dist/layouts/shared/slots/language-select.js +43 -0
  183. package/dist/layouts/shared/slots/search-trigger.d.ts +22 -0
  184. package/dist/layouts/shared/slots/search-trigger.js +53 -0
  185. package/dist/layouts/shared/slots/theme-switch.d.ts +13 -0
  186. package/dist/layouts/shared/slots/theme-switch.js +65 -0
  187. package/dist/legacy/layout.d.ts +36 -0
  188. package/dist/legacy/layout.js +44 -0
  189. package/dist/legacy/sidebar.d.ts +17 -0
  190. package/dist/legacy/sidebar.js +33 -0
  191. package/dist/mdx.d.ts +45 -0
  192. package/dist/mdx.js +70 -0
  193. package/dist/mdx.server.d.ts +15 -0
  194. package/dist/mdx.server.js +20 -0
  195. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts +31 -0
  196. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
  197. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/index.d.ts +2 -0
  198. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +7 -0
  199. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
  200. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
  201. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
  202. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
  203. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
  204. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +8 -0
  205. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +55 -0
  206. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
  207. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
  208. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
  209. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
  210. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
  211. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
  212. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
  213. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
  214. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
  215. package/dist/og/takumi.d.ts +21 -0
  216. package/dist/og/takumi.js +91 -0
  217. package/dist/og.d.ts +22 -0
  218. package/dist/og.js +91 -0
  219. package/dist/page.d.ts +35 -0
  220. package/dist/page.js +33 -0
  221. package/dist/provider/base.d.ts +49 -0
  222. package/dist/provider/base.js +32 -0
  223. package/dist/provider/next.d.ts +20 -0
  224. package/dist/provider/next.js +17 -0
  225. package/dist/provider/react-router.d.ts +20 -0
  226. package/dist/provider/react-router.js +17 -0
  227. package/dist/provider/tanstack.d.ts +20 -0
  228. package/dist/provider/tanstack.js +17 -0
  229. package/dist/provider/waku.d.ts +20 -0
  230. package/dist/provider/waku.js +17 -0
  231. package/dist/style.css +3534 -0
  232. package/dist/tailwind/typography.d.ts +2 -0
  233. package/dist/tailwind/typography.js +2 -0
  234. package/dist/utils/cn.js +2 -0
  235. package/dist/utils/merge-refs.js +11 -0
  236. package/dist/utils/urls.js +15 -0
  237. package/dist/utils/use-copy-button.d.ts +6 -0
  238. package/dist/utils/use-copy-button.js +26 -0
  239. package/dist/utils/use-footer-items.d.ts +9 -0
  240. package/dist/utils/use-footer-items.js +24 -0
  241. package/dist/utils/use-is-scroll-top.d.ts +8 -0
  242. package/dist/utils/use-is-scroll-top.js +20 -0
  243. package/package.json +200 -0
@@ -0,0 +1,28 @@
1
+ import { base_d_exports } from "./base.js";
2
+ import { FC, ReactNode } from "react";
3
+ import * as PageTree from "fumadocs-core/page-tree";
4
+
5
+ //#region src/components/sidebar/page-tree.d.ts
6
+ interface SidebarPageTreeComponents {
7
+ Item: FC<{
8
+ item: PageTree.Item;
9
+ }>;
10
+ Folder: FC<{
11
+ item: PageTree.Folder;
12
+ children: ReactNode;
13
+ }>;
14
+ Separator: FC<{
15
+ item: PageTree.Separator;
16
+ }>;
17
+ }
18
+ type InternalComponents = Pick<typeof base_d_exports, 'SidebarSeparator' | 'SidebarFolder' | 'SidebarFolderLink' | 'SidebarFolderContent' | 'SidebarFolderTrigger' | 'SidebarItem'>;
19
+ declare function createPageTreeRenderer({
20
+ SidebarFolder,
21
+ SidebarFolderContent,
22
+ SidebarFolderLink,
23
+ SidebarFolderTrigger,
24
+ SidebarSeparator,
25
+ SidebarItem
26
+ }: InternalComponents): (components: Partial<SidebarPageTreeComponents>) => import("react").JSX.Element;
27
+ //#endregion
28
+ export { SidebarPageTreeComponents, createPageTreeRenderer };
@@ -0,0 +1,71 @@
1
+ import { useTreeContext, useTreePath } from "../../contexts/tree.js";
2
+ import { isActive } from "../../utils/urls.js";
3
+ import { useSidebar } from "./base.js";
4
+ import { usePathname } from "fumadocs-core/framework";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Fragment as Fragment$1, createContext, use, useMemo } from "react";
7
+ //#region src/components/sidebar/page-tree.tsx
8
+ const RendererContext = createContext(null);
9
+ function createPageTreeRenderer({ SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarSeparator, SidebarItem }) {
10
+ function renderList(nodes) {
11
+ return nodes.map((node, i) => /* @__PURE__ */ jsx(PageTreeNode, { node }, i));
12
+ }
13
+ function PageTreeNode({ node }) {
14
+ const { Separator, Item, Folder, pathname } = use(RendererContext);
15
+ const { showIcons } = useSidebar();
16
+ if (node.type === "separator") {
17
+ if (Separator) return /* @__PURE__ */ jsx(Separator, { item: node });
18
+ return /* @__PURE__ */ jsxs(SidebarSeparator, { children: [showIcons && node.icon, node.name] });
19
+ }
20
+ if (node.type === "folder") {
21
+ const path = useTreePath();
22
+ if (Folder) return /* @__PURE__ */ jsx(Folder, {
23
+ item: node,
24
+ children: renderList(node.children)
25
+ });
26
+ return /* @__PURE__ */ jsxs(SidebarFolder, {
27
+ collapsible: node.collapsible,
28
+ active: path.includes(node),
29
+ defaultOpen: node.defaultOpen,
30
+ children: [node.index ? /* @__PURE__ */ jsxs(SidebarFolderLink, {
31
+ href: node.index.url,
32
+ active: isActive(node.index.url, pathname),
33
+ external: node.index.external,
34
+ children: [showIcons && node.icon, node.name]
35
+ }) : /* @__PURE__ */ jsxs(SidebarFolderTrigger, { children: [showIcons && node.icon, node.name] }), /* @__PURE__ */ jsx(SidebarFolderContent, { children: renderList(node.children) })]
36
+ });
37
+ }
38
+ if (Item) return /* @__PURE__ */ jsx(Item, { item: node });
39
+ return /* @__PURE__ */ jsx(SidebarItem, {
40
+ href: node.url,
41
+ external: node.external,
42
+ active: isActive(node.url, pathname),
43
+ icon: node.icon,
44
+ children: node.name
45
+ });
46
+ }
47
+ /**
48
+ * Render sidebar items from page tree
49
+ */
50
+ return function SidebarPageTree(components) {
51
+ const { Folder, Item, Separator } = components;
52
+ const { root } = useTreeContext();
53
+ const pathname = usePathname();
54
+ return /* @__PURE__ */ jsx(RendererContext, {
55
+ value: useMemo(() => ({
56
+ Folder,
57
+ Item,
58
+ Separator,
59
+ pathname
60
+ }), [
61
+ Folder,
62
+ Item,
63
+ Separator,
64
+ pathname
65
+ ]),
66
+ children: /* @__PURE__ */ jsx(Fragment$1, { children: renderList(root.children) }, root.$id)
67
+ });
68
+ };
69
+ }
70
+ //#endregion
71
+ export { createPageTreeRenderer };
@@ -0,0 +1,16 @@
1
+ import { LayoutTab, isLayoutTabActive } from "../../../layouts/shared/index.js";
2
+ import { ComponentProps, ReactNode } from "react";
3
+
4
+ //#region src/components/sidebar/tabs/dropdown.d.ts
5
+ type SidebarTabWithProps = LayoutTab;
6
+ declare function SidebarTabsDropdown({
7
+ options,
8
+ placeholder,
9
+ ...props
10
+ }: {
11
+ placeholder?: ReactNode;
12
+ options: LayoutTab[];
13
+ } & ComponentProps<'button'>): import("react").JSX.Element;
14
+ declare const isTabActive: typeof isLayoutTabActive;
15
+ //#endregion
16
+ export { SidebarTabWithProps, SidebarTabsDropdown, isTabActive };
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
4
+ import { isLayoutTabActive } from "../../../layouts/shared/index.js";
5
+ import { useSidebar } from "../base.js";
6
+ import Link from "fumadocs-core/link";
7
+ import { usePathname } from "fumadocs-core/framework";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Check, ChevronsUpDown } from "lucide-react";
10
+ import { useMemo, useState } from "react";
11
+ //#region src/components/sidebar/tabs/dropdown.tsx
12
+ function SidebarTabsDropdown({ options, placeholder, ...props }) {
13
+ const [open, setOpen] = useState(false);
14
+ const { closeOnRedirect } = useSidebar();
15
+ const pathname = usePathname();
16
+ const selected = useMemo(() => {
17
+ return options.findLast((item) => isLayoutTabActive(item, pathname));
18
+ }, [options, pathname]);
19
+ const onClick = () => {
20
+ closeOnRedirect.current = false;
21
+ setOpen(false);
22
+ };
23
+ const item = selected ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
24
+ className: "size-9 shrink-0 empty:hidden md:size-5",
25
+ children: selected.icon
26
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
27
+ className: "text-sm font-medium",
28
+ children: selected.title
29
+ }), /* @__PURE__ */ jsx("p", {
30
+ className: "text-sm text-fd-muted-foreground empty:hidden md:hidden",
31
+ children: selected.description
32
+ })] })] }) : placeholder;
33
+ return /* @__PURE__ */ jsxs(Popover, {
34
+ open,
35
+ onOpenChange: setOpen,
36
+ children: [item && /* @__PURE__ */ jsxs(PopoverTrigger, {
37
+ ...props,
38
+ className: cn("flex items-center gap-2 rounded-lg p-2 bg-fd-secondary/50 text-start text-fd-secondary-foreground transition-colors hover:bg-fd-accent data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground", props.className),
39
+ children: [item, /* @__PURE__ */ jsx(ChevronsUpDown, { className: "shrink-0 ms-auto size-4 text-fd-muted-foreground" })]
40
+ }), /* @__PURE__ */ jsx(PopoverContent, {
41
+ className: "flex flex-col gap-1 w-(--radix-popover-trigger-width) p-1 fd-scroll-container",
42
+ children: options.map((item) => {
43
+ const isActive = selected && item.url === selected.url;
44
+ if (!isActive && item.unlisted) return;
45
+ return /* @__PURE__ */ jsxs(Link, {
46
+ href: item.url,
47
+ onClick,
48
+ ...item.props,
49
+ className: cn("flex items-center gap-2 rounded-2xl p-1.5 hover:bg-fd-accent hover:text-fd-accent-foreground", item.props?.className),
50
+ children: [
51
+ /* @__PURE__ */ jsx("div", {
52
+ className: "shrink-0 size-9 md:mb-auto md:size-5 empty:hidden",
53
+ children: item.icon
54
+ }),
55
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
56
+ className: "text-sm font-medium leading-none",
57
+ children: item.title
58
+ }), /* @__PURE__ */ jsx("p", {
59
+ className: "text-[0.8125rem] text-fd-muted-foreground mt-1 empty:hidden",
60
+ children: item.description
61
+ })] }),
62
+ /* @__PURE__ */ jsx(Check, { className: cn("shrink-0 ms-auto size-3.5 text-fd-primary", !isActive && "invisible") })
63
+ ]
64
+ }, item.url);
65
+ })
66
+ })]
67
+ });
68
+ }
69
+ const isTabActive = isLayoutTabActive;
70
+ //#endregion
71
+ export { SidebarTabsDropdown, isTabActive };
@@ -0,0 +1,11 @@
1
+ import { GetLayoutTabsOptions, LayoutTab } from "../../../layouts/shared/index.js";
2
+ import * as PageTree from "fumadocs-core/page-tree";
3
+
4
+ //#region src/components/sidebar/tabs/index.d.ts
5
+ type SidebarTab = LayoutTab;
6
+ type GetSidebarTabsOptions = GetLayoutTabsOptions;
7
+ declare function getSidebarTabs(tree: PageTree.Root, {
8
+ transform
9
+ }?: GetSidebarTabsOptions): SidebarTab[];
10
+ //#endregion
11
+ export { GetSidebarTabsOptions, SidebarTab, getSidebarTabs };
@@ -0,0 +1,46 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ //#region src/components/sidebar/tabs/index.tsx
3
+ const defaultTransform = (option, node) => {
4
+ if (!node.icon) return option;
5
+ return {
6
+ ...option,
7
+ icon: /* @__PURE__ */ jsx("div", {
8
+ className: "size-full [&_svg]:size-full max-md:p-1.5 max-md:rounded-md max-md:bg-fd-secondary",
9
+ children: node.icon
10
+ })
11
+ };
12
+ };
13
+ function getSidebarTabs(tree, { transform = defaultTransform } = {}) {
14
+ const results = [];
15
+ function scanOptions(node, unlisted) {
16
+ if ("root" in node && node.root) {
17
+ const urls = getFolderUrls(node);
18
+ if (urls.size > 0) {
19
+ const option = {
20
+ url: urls.values().next().value ?? "",
21
+ title: node.name,
22
+ icon: node.icon,
23
+ unlisted,
24
+ description: node.description,
25
+ urls
26
+ };
27
+ const mapped = transform ? transform(option, node) : option;
28
+ if (mapped) results.push(mapped);
29
+ }
30
+ }
31
+ for (const child of node.children) if (child.type === "folder") scanOptions(child, unlisted);
32
+ }
33
+ scanOptions(tree);
34
+ if (tree.fallback) scanOptions(tree.fallback, true);
35
+ return results;
36
+ }
37
+ function getFolderUrls(folder, output = /* @__PURE__ */ new Set()) {
38
+ if (folder.index) output.add(folder.index.url);
39
+ for (const child of folder.children) {
40
+ if (child.type === "page" && !child.external) output.add(child.url);
41
+ if (child.type === "folder") getFolderUrls(child, output);
42
+ }
43
+ return output;
44
+ }
45
+ //#endregion
46
+ export { getSidebarTabs };
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/components/steps.d.ts
4
+ declare function Steps({
5
+ children
6
+ }: {
7
+ children: ReactNode;
8
+ }): import("react").JSX.Element;
9
+ declare function Step({
10
+ children
11
+ }: {
12
+ children: ReactNode;
13
+ }): import("react").JSX.Element;
14
+ //#endregion
15
+ export { Step, Steps };
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ //#region src/components/steps.tsx
3
+ function Steps({ children }) {
4
+ return /* @__PURE__ */ jsx("div", {
5
+ className: "fd-steps",
6
+ children
7
+ });
8
+ }
9
+ function Step({ children }) {
10
+ return /* @__PURE__ */ jsx("div", {
11
+ className: "fd-step",
12
+ children
13
+ });
14
+ }
15
+ //#endregion
16
+ export { Step, Steps };
@@ -0,0 +1,49 @@
1
+ import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
2
+ import * as React$1 from "react";
3
+ import { ComponentProps, ReactNode } from "react";
4
+
5
+ //#region src/components/tabs.d.ts
6
+ interface TabsProps extends Omit<ComponentProps<typeof Tabs$1>, 'value' | 'onValueChange'> {
7
+ /**
8
+ * Use simple mode instead of advanced usage as documented in https://radix-ui.com/primitives/docs/components/tabs.
9
+ */
10
+ items?: string[];
11
+ /**
12
+ * Shortcut for `defaultValue` when `items` is provided.
13
+ *
14
+ * @defaultValue 0
15
+ */
16
+ defaultIndex?: number;
17
+ /**
18
+ * Additional label in tabs list when `items` is provided.
19
+ */
20
+ label?: ReactNode;
21
+ }
22
+ declare function TabsList(props: React$1.ComponentPropsWithRef<typeof TabsList$1>): React$1.JSX.Element;
23
+ declare function TabsTrigger(props: React$1.ComponentPropsWithRef<typeof TabsTrigger$1>): React$1.JSX.Element;
24
+ declare function Tabs({
25
+ ref,
26
+ className,
27
+ items,
28
+ label,
29
+ defaultIndex,
30
+ defaultValue,
31
+ ...props
32
+ }: TabsProps): React$1.JSX.Element;
33
+ interface TabProps extends Omit<ComponentProps<typeof TabsContent$1>, 'value'> {
34
+ /**
35
+ * Value of tab, detect from index if unspecified.
36
+ */
37
+ value?: string;
38
+ }
39
+ declare function Tab({
40
+ value,
41
+ ...props
42
+ }: TabProps): React$1.JSX.Element;
43
+ declare function TabsContent({
44
+ value,
45
+ className,
46
+ ...props
47
+ }: ComponentProps<typeof TabsContent$1>): React$1.JSX.Element;
48
+ //#endregion
49
+ export { Tab, TabProps, Tabs, TabsContent, TabsList, TabsProps, TabsTrigger };
@@ -0,0 +1,88 @@
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__ */ jsxs(TabsTrigger$1, {
21
+ ...props,
22
+ className: cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground relative 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]:text-fd-primary focus-visible:outline-none focus-visible:bg-fd-accent/30 rounded-sm", props.className),
23
+ children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 bottom-0 h-px bg-transparent data-[state=active]:bg-fd-primary" }), props.children]
24
+ });
25
+ }
26
+ function Tabs({ ref, className, items, label, defaultIndex = 0, defaultValue = items ? escapeValue(items[defaultIndex]) : void 0, ...props }) {
27
+ const [value, setValue] = useState(defaultValue);
28
+ const collection = useMemo(() => [], []);
29
+ return /* @__PURE__ */ jsxs(Tabs$1, {
30
+ ref,
31
+ className: cn("flex flex-col overflow-hidden rounded-3xl bg-fd-secondary my-4", className),
32
+ value,
33
+ onValueChange: (v) => {
34
+ if (items && !items.some((item) => escapeValue(item) === v)) return;
35
+ setValue(v);
36
+ },
37
+ ...props,
38
+ children: [items && /* @__PURE__ */ jsxs(TabsList, { children: [label && /* @__PURE__ */ jsx("span", {
39
+ className: "text-sm font-medium my-auto me-auto",
40
+ children: label
41
+ }), items.map((item) => /* @__PURE__ */ jsx(TabsTrigger, {
42
+ value: escapeValue(item),
43
+ children: item
44
+ }, item))] }), /* @__PURE__ */ jsx(TabsContext.Provider, {
45
+ value: useMemo(() => ({
46
+ items,
47
+ collection
48
+ }), [collection, items]),
49
+ children: props.children
50
+ })]
51
+ });
52
+ }
53
+ function Tab({ value, ...props }) {
54
+ const { items } = useTabContext();
55
+ const resolved = value ?? items?.at(useCollectionIndex());
56
+ if (!resolved) throw new Error("Failed to resolve tab `value`, please pass a `value` prop to the Tab component.");
57
+ return /* @__PURE__ */ jsx(TabsContent, {
58
+ value: escapeValue(resolved),
59
+ ...props,
60
+ children: props.children
61
+ });
62
+ }
63
+ function TabsContent({ value, className, ...props }) {
64
+ return /* @__PURE__ */ jsx(TabsContent$1, {
65
+ value,
66
+ forceMount: true,
67
+ className: cn("p-4 text-[0.9375rem] bg-fd-background outline-none prose-no-margin data-[state=inactive]:hidden [&>figure:only-child]:-m-4", className),
68
+ ...props,
69
+ children: props.children
70
+ });
71
+ }
72
+ function useCollectionIndex() {
73
+ const key = useId();
74
+ const { collection } = useTabContext();
75
+ useEffect(() => {
76
+ return () => {
77
+ const idx = collection.indexOf(key);
78
+ if (idx !== -1) collection.splice(idx, 1);
79
+ };
80
+ }, [key, collection]);
81
+ if (!collection.includes(key)) collection.push(key);
82
+ return collection.indexOf(key);
83
+ }
84
+ function escapeValue(v) {
85
+ return v.toLowerCase().replace(/\s/, "-");
86
+ }
87
+ //#endregion
88
+ export { Tab, Tabs, TabsContent, TabsList, TabsTrigger };
@@ -0,0 +1,20 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "fumadocs-core/toc";
3
+
4
+ //#region src/components/toc/clerk.d.ts
5
+ type TOCItemsProps = ComponentProps<'div'>;
6
+ declare function TOCItems({
7
+ ref,
8
+ className,
9
+ children,
10
+ ...props
11
+ }: TOCItemsProps): import("react").JSX.Element;
12
+ declare function TOCEmpty(): import("react").JSX.Element;
13
+ declare function TOCItem({
14
+ item,
15
+ ...props
16
+ }: Primitive.TOCItemProps & {
17
+ item: Primitive.TOCItemType;
18
+ }): import("react").JSX.Element;
19
+ //#endregion
20
+ export { TOCEmpty, TOCItem, TOCItems, TOCItemsProps };
@@ -0,0 +1,226 @@
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 "fumadocs-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
+ return /* @__PURE__ */ jsx("div", {
108
+ className: "rounded-3xl bg-fd-card p-3 text-xs text-fd-muted-foreground",
109
+ children: useTranslations({ note: "table of contents" })("No Headings")
110
+ });
111
+ }
112
+ function ThumbTrack({ computed }) {
113
+ const ref = useRef(null);
114
+ const tocInfo = Primitive.useTOC();
115
+ function calculate(items) {
116
+ const out = {};
117
+ const startIdx = items.findIndex((item) => item.active);
118
+ if (startIdx === -1) return out;
119
+ const endIdx = items.findLastIndex((item) => item.active);
120
+ out["--track-top"] = `${computed.positions[startIdx][0]}px`;
121
+ out["--track-bottom"] = `${computed.positions[endIdx][1]}px`;
122
+ return out;
123
+ }
124
+ Primitive.useTOCListener((items) => {
125
+ const element = ref.current;
126
+ if (!element) return;
127
+ for (const [k, v] of Object.entries(calculate(items))) element.style.setProperty(k, v);
128
+ });
129
+ return /* @__PURE__ */ jsx("div", {
130
+ ref,
131
+ className: "absolute top-0 inset-s-0 origin-center rtl:-scale-x-100",
132
+ style: {
133
+ width: computed.width,
134
+ height: computed.height,
135
+ ...calculate(tocInfo.get())
136
+ },
137
+ children: /* @__PURE__ */ jsx("svg", {
138
+ xmlns: "http://www.w3.org/2000/svg",
139
+ viewBox: `0 0 ${computed.width} ${computed.height}`,
140
+ className: "absolute transition-[clip-path]",
141
+ style: {
142
+ width: computed.width,
143
+ height: computed.height,
144
+ clipPath: `polygon(0 var(--track-top,0), 100% var(--track-top,0), 100% var(--track-bottom,0), 0 var(--track-bottom,0))`
145
+ },
146
+ children: computed.content
147
+ })
148
+ });
149
+ }
150
+ const BASE = 8;
151
+ function getItemOffset(depth) {
152
+ if (depth <= 2) return 20;
153
+ if (depth === 3) return 32;
154
+ return 44;
155
+ }
156
+ function getLineOffset(depth) {
157
+ if (depth <= 2) return BASE;
158
+ if (depth === 3) return 20;
159
+ return 32;
160
+ }
161
+ function TOCItem({ item, ...props }) {
162
+ const items = useTOCItems();
163
+ const { isFirst, isLast, svg } = useMemo(() => {
164
+ const index = items.indexOf(item);
165
+ const isFirst = index === 0;
166
+ const isLast = index === items.length - 1;
167
+ const l1 = getLineOffset(item.depth);
168
+ const l0 = isFirst ? l1 : getLineOffset(items[index - 1].depth);
169
+ const l2 = isLast ? l1 : getLineOffset(items[index + 1].depth);
170
+ return {
171
+ isFirst,
172
+ isLast,
173
+ svg: /* @__PURE__ */ jsxs("svg", {
174
+ xmlns: "http://www.w3.org/2000/svg",
175
+ 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"),
176
+ style: { width: Math.max(l0, l1) + 9 },
177
+ children: [
178
+ l0 !== l1 && /* @__PURE__ */ jsx("path", {
179
+ d: `M ${l0 + .5} 0 L ${l0 + .5} 0 ${l1 + .5} 12`,
180
+ stroke: "black",
181
+ strokeWidth: "1",
182
+ fill: "none",
183
+ className: "stroke-fd-foreground/10"
184
+ }),
185
+ /* @__PURE__ */ jsx("line", {
186
+ x1: l1 + .5,
187
+ y1: l0 === l1 ? "6" : "12",
188
+ x2: l1 + .5,
189
+ y2: "100%",
190
+ strokeWidth: "1",
191
+ className: "stroke-fd-foreground/10"
192
+ }),
193
+ item._step !== void 0 && /* @__PURE__ */ jsxs("g", {
194
+ transform: `translate(${l1 + .5}, ${l1 === l2 ? "3" : "6"})`,
195
+ children: [/* @__PURE__ */ jsx("circle", {
196
+ cx: "0",
197
+ cy: "50%",
198
+ r: "8",
199
+ className: "fill-fd-muted"
200
+ }), /* @__PURE__ */ jsx("text", {
201
+ x: "0",
202
+ y: "50%",
203
+ textAnchor: "middle",
204
+ alignmentBaseline: "central",
205
+ dominantBaseline: "middle",
206
+ className: "fill-fd-muted-foreground font-medium text-xs leading-none font-mono rtl:-scale-x-100",
207
+ children: item._step
208
+ })]
209
+ })
210
+ ]
211
+ })
212
+ };
213
+ }, [items, item]);
214
+ return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
215
+ href: item.url,
216
+ ...props,
217
+ 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),
218
+ style: {
219
+ paddingInlineStart: getItemOffset(item.depth),
220
+ ...props.style
221
+ },
222
+ children: [svg, item.title]
223
+ });
224
+ }
225
+ //#endregion
226
+ export { TOCEmpty, TOCItem, TOCItems, clerk_exports };