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,30 @@
1
+ import * as React$1 from "react";
2
+ import * as Primitive from "@radix-ui/react-navigation-menu";
3
+
4
+ //#region src/components/ui/navigation-menu.d.ts
5
+ type NavigationMenuContentProps = Primitive.NavigationMenuContentProps;
6
+ type NavigationMenuTriggerProps = Primitive.NavigationMenuTriggerProps;
7
+ declare const NavigationMenu: React$1.ForwardRefExoticComponent<Primitive.NavigationMenuProps & React$1.RefAttributes<HTMLElement>>;
8
+ declare const NavigationMenuList: React$1.ForwardRefExoticComponent<Primitive.NavigationMenuListProps & React$1.RefAttributes<HTMLUListElement>>;
9
+ declare function NavigationMenuItem({
10
+ className,
11
+ children,
12
+ ...props
13
+ }: React$1.ComponentPropsWithRef<typeof Primitive.NavigationMenuItem>): React$1.JSX.Element;
14
+ declare function NavigationMenuTrigger({
15
+ className,
16
+ children,
17
+ ...props
18
+ }: React$1.ComponentPropsWithRef<typeof Primitive.Trigger>): React$1.JSX.Element;
19
+ declare function NavigationMenuContent({
20
+ className,
21
+ ...props
22
+ }: React$1.ComponentPropsWithRef<typeof Primitive.Content>): React$1.JSX.Element;
23
+ declare const NavigationMenuLink: React$1.ForwardRefExoticComponent<Primitive.NavigationMenuLinkProps & React$1.RefAttributes<HTMLAnchorElement>>;
24
+ declare function NavigationMenuViewport({
25
+ className,
26
+ ref,
27
+ ...props
28
+ }: React$1.ComponentPropsWithRef<typeof Primitive.Viewport>): React$1.JSX.Element;
29
+ //#endregion
30
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import "react";
5
+ import * as Primitive from "@radix-ui/react-navigation-menu";
6
+ //#region src/components/ui/navigation-menu.tsx
7
+ const NavigationMenu = Primitive.Root;
8
+ const NavigationMenuList = Primitive.List;
9
+ function NavigationMenuItem({ className, children, ...props }) {
10
+ return /* @__PURE__ */ jsx(Primitive.NavigationMenuItem, {
11
+ className: cn("list-none", className),
12
+ ...props,
13
+ children
14
+ });
15
+ }
16
+ function NavigationMenuTrigger({ className, children, ...props }) {
17
+ return /* @__PURE__ */ jsx(Primitive.Trigger, {
18
+ className: cn("data-[state=open]:bg-fd-accent/50", className),
19
+ ...props,
20
+ children
21
+ });
22
+ }
23
+ function NavigationMenuContent({ className, ...props }) {
24
+ return /* @__PURE__ */ jsx(Primitive.Content, {
25
+ className: cn("absolute inset-x-0 top-0 overflow-auto fd-scroll-container max-h-[80svh] data-[motion=from-end]:animate-fd-enterFromRight data-[motion=from-start]:animate-fd-enterFromLeft data-[motion=to-end]:animate-fd-exitToRight data-[motion=to-start]:animate-fd-exitToLeft", className),
26
+ ...props
27
+ });
28
+ }
29
+ const NavigationMenuLink = Primitive.Link;
30
+ function NavigationMenuViewport({ className, ref, ...props }) {
31
+ return /* @__PURE__ */ jsx("div", {
32
+ ref,
33
+ className: "flex w-full justify-center",
34
+ children: /* @__PURE__ */ jsx(Primitive.Viewport, {
35
+ ...props,
36
+ className: cn("relative h-(--radix-navigation-menu-viewport-height) w-full origin-[top_center] overflow-hidden transition-[width,height] duration-300 data-[state=closed]:animate-fd-nav-menu-out data-[state=open]:animate-fd-nav-menu-in", className)
37
+ })
38
+ });
39
+ }
40
+ //#endregion
41
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport };
@@ -0,0 +1,15 @@
1
+ import * as React$1 from "react";
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+
4
+ //#region src/components/ui/popover.d.ts
5
+ declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
6
+ declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
7
+ declare function PopoverContent({
8
+ className,
9
+ align,
10
+ sideOffset,
11
+ ...props
12
+ }: React$1.ComponentPropsWithRef<typeof PopoverPrimitive.Content>): React$1.JSX.Element;
13
+ declare const PopoverClose: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React$1.RefAttributes<HTMLButtonElement>>;
14
+ //#endregion
15
+ export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import "react";
5
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
6
+ //#region src/components/ui/popover.tsx
7
+ const Popover = PopoverPrimitive.Root;
8
+ const PopoverTrigger = PopoverPrimitive.Trigger;
9
+ function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
10
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
11
+ align,
12
+ sideOffset,
13
+ side: "bottom",
14
+ className: cn("z-50 origin-(--radix-popover-content-transform-origin) overflow-y-auto max-h-(--radix-popover-content-available-height) min-w-[240px] max-w-[98vw] rounded-3xl bg-fd-popover/90 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in", className),
15
+ ...props
16
+ }) });
17
+ }
18
+ const PopoverClose = PopoverPrimitive.PopoverClose;
19
+ //#endregion
20
+ export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -0,0 +1,22 @@
1
+ import * as React$1 from "react";
2
+ import * as Primitive from "@radix-ui/react-scroll-area";
3
+
4
+ //#region src/components/ui/scroll-area.d.ts
5
+ declare function ScrollArea({
6
+ className,
7
+ children,
8
+ ...props
9
+ }: React$1.ComponentPropsWithRef<typeof Primitive.Root>): React$1.JSX.Element;
10
+ declare function ScrollViewport({
11
+ className,
12
+ children,
13
+ ...props
14
+ }: React$1.ComponentPropsWithRef<typeof Primitive.Viewport>): React$1.JSX.Element;
15
+ declare function ScrollBar({
16
+ className,
17
+ orientation,
18
+ ...props
19
+ }: React$1.ComponentPropsWithRef<typeof Primitive.Scrollbar>): React$1.JSX.Element;
20
+ type ScrollAreaProps = Primitive.ScrollAreaProps;
21
+ //#endregion
22
+ export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollViewport };
@@ -0,0 +1,34 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import "react";
4
+ import * as Primitive from "@radix-ui/react-scroll-area";
5
+ //#region src/components/ui/scroll-area.tsx
6
+ function ScrollArea({ className, children, ...props }) {
7
+ return /* @__PURE__ */ jsxs(Primitive.Root, {
8
+ type: "scroll",
9
+ className: cn("overflow-hidden", className),
10
+ ...props,
11
+ children: [
12
+ children,
13
+ /* @__PURE__ */ jsx(Primitive.Corner, {}),
14
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
15
+ ]
16
+ });
17
+ }
18
+ function ScrollViewport({ className, children, ...props }) {
19
+ return /* @__PURE__ */ jsx(Primitive.Viewport, {
20
+ className: cn("size-full rounded-[inherit]", className),
21
+ ...props,
22
+ children
23
+ });
24
+ }
25
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
26
+ return /* @__PURE__ */ jsx(Primitive.Scrollbar, {
27
+ orientation,
28
+ className: cn("flex select-none data-[state=hidden]:animate-fd-fade-out", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", className),
29
+ ...props,
30
+ children: /* @__PURE__ */ jsx(Primitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-fd-border" })
31
+ });
32
+ }
33
+ //#endregion
34
+ export { ScrollArea, ScrollBar, ScrollViewport };
@@ -0,0 +1,36 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "@radix-ui/react-tabs";
3
+
4
+ //#region src/components/ui/tabs.d.ts
5
+ interface TabsProps extends ComponentProps<typeof Primitive.Tabs> {
6
+ /**
7
+ * Identifier for Sharing value of tabs
8
+ */
9
+ groupId?: string;
10
+ /**
11
+ * Enable persistent
12
+ */
13
+ persist?: boolean;
14
+ /**
15
+ * If true, updates the URL hash based on the tab's id
16
+ */
17
+ updateAnchor?: boolean;
18
+ }
19
+ declare const TabsList: import("react").ForwardRefExoticComponent<Primitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
20
+ declare const TabsTrigger: import("react").ForwardRefExoticComponent<Primitive.TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
21
+ declare function Tabs({
22
+ ref,
23
+ groupId,
24
+ persist,
25
+ updateAnchor,
26
+ defaultValue,
27
+ value: _value,
28
+ onValueChange: _onValueChange,
29
+ ...props
30
+ }: TabsProps): import("react").JSX.Element;
31
+ declare function TabsContent({
32
+ value,
33
+ ...props
34
+ }: ComponentProps<typeof Primitive.TabsContent>): import("react").JSX.Element;
35
+ //#endregion
36
+ export { Tabs, TabsContent, TabsList, TabsProps, TabsTrigger };
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { mergeRefs } from "../../utils/merge-refs.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createContext, use, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import * as Primitive from "@radix-ui/react-tabs";
6
+ //#region src/components/ui/tabs.tsx
7
+ const listeners = /* @__PURE__ */ new Map();
8
+ const TabsContext = createContext(null);
9
+ function useTabContext() {
10
+ const ctx = use(TabsContext);
11
+ if (!ctx) throw new Error("You must wrap your component in <Tabs>");
12
+ return ctx;
13
+ }
14
+ const TabsList = Primitive.TabsList;
15
+ const TabsTrigger = Primitive.TabsTrigger;
16
+ function Tabs({ ref, groupId, persist = false, updateAnchor = false, defaultValue, value: _value, onValueChange: _onValueChange, ...props }) {
17
+ const tabsRef = useRef(null);
18
+ const valueToIdMap = useMemo(() => /* @__PURE__ */ new Map(), []);
19
+ const [value, setValue] = _value === void 0 ? useState(defaultValue) : [_value, useEffectEvent((v) => _onValueChange?.(v))];
20
+ useLayoutEffect(() => {
21
+ if (!groupId) return;
22
+ let previous = sessionStorage.getItem(groupId);
23
+ if (persist) previous ??= localStorage.getItem(groupId);
24
+ if (previous) setValue(previous);
25
+ const groupListeners = listeners.get(groupId) ?? /* @__PURE__ */ new Set();
26
+ groupListeners.add(setValue);
27
+ listeners.set(groupId, groupListeners);
28
+ return () => {
29
+ groupListeners.delete(setValue);
30
+ };
31
+ }, [
32
+ groupId,
33
+ persist,
34
+ setValue
35
+ ]);
36
+ useLayoutEffect(() => {
37
+ const hash = window.location.hash.slice(1);
38
+ if (!hash) return;
39
+ for (const [value, id] of valueToIdMap.entries()) if (id === hash) {
40
+ setValue(value);
41
+ tabsRef.current?.scrollIntoView();
42
+ break;
43
+ }
44
+ }, [setValue, valueToIdMap]);
45
+ return /* @__PURE__ */ jsx(Primitive.Tabs, {
46
+ ref: mergeRefs(ref, tabsRef),
47
+ value,
48
+ onValueChange: (v) => {
49
+ if (updateAnchor) {
50
+ const id = valueToIdMap.get(v);
51
+ if (id) window.history.replaceState(null, "", `#${id}`);
52
+ }
53
+ if (groupId) {
54
+ const groupListeners = listeners.get(groupId);
55
+ if (groupListeners) for (const listener of groupListeners) listener(v);
56
+ sessionStorage.setItem(groupId, v);
57
+ if (persist) localStorage.setItem(groupId, v);
58
+ } else setValue(v);
59
+ },
60
+ ...props,
61
+ children: /* @__PURE__ */ jsx(TabsContext, {
62
+ value: useMemo(() => ({ valueToIdMap }), [valueToIdMap]),
63
+ children: props.children
64
+ })
65
+ });
66
+ }
67
+ function TabsContent({ value, ...props }) {
68
+ const { valueToIdMap } = useTabContext();
69
+ if (props.id) valueToIdMap.set(value, props.id);
70
+ return /* @__PURE__ */ jsx(Primitive.TabsContent, {
71
+ value,
72
+ ...props,
73
+ children: props.children
74
+ });
75
+ }
76
+ //#endregion
77
+ export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -0,0 +1,41 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/contexts/i18n.d.ts
4
+ interface LocaleItem {
5
+ name: string;
6
+ locale: string;
7
+ }
8
+ interface LocaleContextType {
9
+ locale?: string;
10
+ onChange?: (v: string) => void;
11
+ locales?: LocaleItem[];
12
+ }
13
+ declare function useI18n(): LocaleContextType;
14
+ interface I18nProviderProps {
15
+ /**
16
+ * Current locale
17
+ */
18
+ locale?: string;
19
+ /**
20
+ * Handle changes to the locale, redirect user when not specified.
21
+ */
22
+ onLocaleChange?: (v: string) => void;
23
+ /**
24
+ * Translations of current locale
25
+ */
26
+ translations?: Partial<Record<string, string>>;
27
+ /**
28
+ * Available languages
29
+ */
30
+ locales?: LocaleItem[];
31
+ children?: ReactNode;
32
+ }
33
+ declare function I18nProvider({
34
+ locales,
35
+ locale,
36
+ onLocaleChange,
37
+ children,
38
+ translations
39
+ }: I18nProviderProps): import("react").JSX.Element;
40
+ //#endregion
41
+ export { I18nProvider, I18nProviderProps, useI18n };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { usePathname, useRouter } from "fumadocs-core/framework";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createContext, use, useMemo, useRef } from "react";
5
+ import { TranslationProvider } from "@fuma-translate/react";
6
+ //#region src/contexts/i18n.tsx
7
+ const LocaleContext = createContext({});
8
+ function useI18n() {
9
+ return use(LocaleContext);
10
+ }
11
+ const Empty = {};
12
+ function I18nProvider({ locales = [], locale, onLocaleChange, children, translations = Empty }) {
13
+ const router = useRouter();
14
+ const pathname = usePathname();
15
+ const onChange = (value) => {
16
+ if (onLocaleChange) return onLocaleChange(value);
17
+ const segments = pathname.split("/").filter((v) => v.length > 0);
18
+ if (segments.length === 0 || segments[0] !== locale) segments.unshift(value);
19
+ else segments[0] = value;
20
+ router.push(`/${segments.join("/")}`);
21
+ };
22
+ const onChangeRef = useRef(onChange);
23
+ onChangeRef.current = onChange;
24
+ return /* @__PURE__ */ jsx(LocaleContext, {
25
+ value: useMemo(() => ({
26
+ locale,
27
+ locales,
28
+ onChange: (v) => onChangeRef.current(v)
29
+ }), [locale, locales]),
30
+ children: /* @__PURE__ */ jsx(TranslationProvider, {
31
+ translations,
32
+ children
33
+ })
34
+ });
35
+ }
36
+ //#endregion
37
+ export { I18nProvider, useI18n };
@@ -0,0 +1,73 @@
1
+ import { ComponentType, ReactNode } from "react";
2
+
3
+ //#region src/contexts/search.d.ts
4
+ interface HotKey {
5
+ display: ReactNode;
6
+ /**
7
+ * Key code or a function determining whether the key is pressed.
8
+ */
9
+ key: string | ((e: KeyboardEvent) => boolean);
10
+ }
11
+ interface SharedProps {
12
+ open: boolean;
13
+ onOpenChange: (open: boolean) => void;
14
+ }
15
+ type SearchLink = [name: string, href: string];
16
+ interface TagItem {
17
+ name: string;
18
+ value: string;
19
+ }
20
+ interface SearchProviderProps {
21
+ /**
22
+ * Preload search dialog before opening it
23
+ *
24
+ * @defaultValue `true`
25
+ */
26
+ preload?: boolean;
27
+ /**
28
+ * Custom links to be displayed if search is empty
29
+ */
30
+ links?: SearchLink[];
31
+ /**
32
+ * Hotkeys for triggering search dialog
33
+ *
34
+ * @defaultValue Meta/Ctrl + K
35
+ */
36
+ hotKey?: HotKey[];
37
+ /**
38
+ * Replace default search dialog, allowing you to use other solutions such as Algolia Search
39
+ *
40
+ * It receives the `open` and `onOpenChange` prop, can be lazy loaded with `React.lazy()`
41
+ */
42
+ SearchDialog?: ComponentType<SharedProps>;
43
+ /**
44
+ * Additional props to the dialog
45
+ */
46
+ options?: Partial<SharedProps & Record<string, unknown>>;
47
+ children?: ReactNode;
48
+ }
49
+ interface SearchContextType {
50
+ enabled: boolean;
51
+ open: boolean;
52
+ hotKey: HotKey[];
53
+ setOpenSearch: (value: boolean) => void;
54
+ }
55
+ declare function useSearchContext(): SearchContextType;
56
+ declare function SearchProvider({
57
+ SearchDialog,
58
+ children,
59
+ preload,
60
+ options,
61
+ hotKey,
62
+ links
63
+ }: SearchProviderProps): import("react").JSX.Element;
64
+ /**
65
+ * Show children only when search is enabled via React Context
66
+ */
67
+ declare function SearchOnly({
68
+ children
69
+ }: {
70
+ children: ReactNode;
71
+ }): ReactNode;
72
+ //#endregion
73
+ export { SearchLink, SearchOnly, SearchProvider, SearchProviderProps, SharedProps, TagItem, useSearchContext };
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Suspense, createContext, lazy, use, useEffect, useEffectEvent, useMemo, useState } from "react";
4
+ //#region src/contexts/search.tsx
5
+ const SearchContext = createContext({
6
+ enabled: false,
7
+ open: false,
8
+ hotKey: [],
9
+ setOpenSearch: () => void 0
10
+ });
11
+ function useSearchContext() {
12
+ return use(SearchContext);
13
+ }
14
+ function MetaOrControl() {
15
+ const [key, setKey] = useState("⌘");
16
+ useEffect(() => {
17
+ if (/Windows|Linux/i.test(window.navigator.userAgent)) setKey("Ctrl");
18
+ }, []);
19
+ return key;
20
+ }
21
+ const DEFAULT_HOT_KEYS = [{
22
+ key: (e) => e.metaKey || e.ctrlKey,
23
+ display: /* @__PURE__ */ jsx(MetaOrControl, {})
24
+ }, {
25
+ key: "k",
26
+ display: "K"
27
+ }];
28
+ const DefaultSearchDialog = lazy(() => import("../components/dialog/search-default.js"));
29
+ function SearchProvider({ SearchDialog = DefaultSearchDialog, children, preload = true, options, hotKey = DEFAULT_HOT_KEYS, links }) {
30
+ const [isOpen, setIsOpen] = useState(preload ? false : void 0);
31
+ const onKeyDown = useEffectEvent((e) => {
32
+ if (hotKey.every((v) => typeof v.key === "string" ? e.key === v.key : v.key(e))) {
33
+ setIsOpen((open) => !open);
34
+ e.preventDefault();
35
+ }
36
+ });
37
+ useEffect(() => {
38
+ window.addEventListener("keydown", onKeyDown);
39
+ return () => {
40
+ window.removeEventListener("keydown", onKeyDown);
41
+ };
42
+ }, []);
43
+ return /* @__PURE__ */ jsxs(SearchContext, {
44
+ value: useMemo(() => ({
45
+ enabled: true,
46
+ open: isOpen ?? false,
47
+ hotKey,
48
+ setOpenSearch: setIsOpen
49
+ }), [isOpen, hotKey]),
50
+ children: [/* @__PURE__ */ jsx(Suspense, {
51
+ fallback: null,
52
+ children: isOpen !== void 0 && /* @__PURE__ */ jsx(SearchDialog, {
53
+ open: isOpen,
54
+ onOpenChange: setIsOpen,
55
+ links,
56
+ ...options
57
+ })
58
+ }), children]
59
+ });
60
+ }
61
+ /**
62
+ * Show children only when search is enabled via React Context
63
+ */
64
+ function SearchOnly({ children }) {
65
+ if (useSearchContext().enabled) return children;
66
+ }
67
+ //#endregion
68
+ export { SearchOnly, SearchProvider, useSearchContext };
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from "react";
2
+ import * as PageTree from "fumadocs-core/page-tree";
3
+
4
+ //#region src/contexts/tree.d.ts
5
+ type MakeRequired<O, K extends keyof O> = Omit<O, K> & Pick<Required<O>, K>;
6
+ interface TreeContextType {
7
+ root: MakeRequired<PageTree.Root | PageTree.Folder, '$id'>;
8
+ full: PageTree.Root;
9
+ }
10
+ declare function TreeContextProvider({
11
+ tree: rawTree,
12
+ children
13
+ }: {
14
+ tree: PageTree.Root;
15
+ children: ReactNode;
16
+ }): import("react").JSX.Element;
17
+ declare function useTreePath(): PageTree.Node[];
18
+ declare function useTreeContext(): TreeContextType;
19
+ //#endregion
20
+ export { TreeContextProvider, useTreeContext, useTreePath };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { usePathname } from "fumadocs-core/framework";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createContext, use, useMemo, useRef } from "react";
5
+ import { searchPath } from "fumadocs-core/breadcrumb";
6
+ //#region src/contexts/tree.tsx
7
+ const TreeContext = createContext(null);
8
+ const PathContext = createContext([]);
9
+ function TreeContextProvider({ tree: rawTree, children }) {
10
+ const nextIdRef = useRef(0);
11
+ const pathname = usePathname();
12
+ const tree = useMemo(() => rawTree, [rawTree.$id]);
13
+ const path = useMemo(() => {
14
+ return searchPath(tree.children, pathname) ?? (tree.fallback ? searchPath(tree.fallback.children, pathname) : null) ?? [];
15
+ }, [tree, pathname]);
16
+ const root = path.findLast((item) => item.type === "folder" && item.root) ?? tree;
17
+ root.$id ??= String(nextIdRef.current++);
18
+ return /* @__PURE__ */ jsx(TreeContext, {
19
+ value: useMemo(() => ({
20
+ root,
21
+ full: tree
22
+ }), [root, tree]),
23
+ children: /* @__PURE__ */ jsx(PathContext, {
24
+ value: path,
25
+ children
26
+ })
27
+ });
28
+ }
29
+ function useTreePath() {
30
+ return use(PathContext);
31
+ }
32
+ function useTreeContext() {
33
+ const ctx = use(TreeContext);
34
+ if (!ctx) throw new Error("You must wrap this component under <DocsLayout />");
35
+ return ctx;
36
+ }
37
+ //#endregion
38
+ export { TreeContextProvider, useTreeContext, useTreePath };
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { I18nProviderProps } from "./contexts/i18n.js";
2
+ import { Translations } from "./.translations/index.js";
3
+ import { I18nConfig, SingularTranslationsAPI, TranslationExtension, TranslationsAPI } from "fumadocs-core/i18n";
4
+
5
+ //#region src/i18n.d.ts
6
+ declare function uiTranslations(): TranslationExtension<keyof Translations>;
7
+ declare function i18nProvider(translations: SingularTranslationsAPI): I18nProviderProps;
8
+ declare function i18nProvider<Languages extends string>(translations: TranslationsAPI<Languages>, lang?: NoInfer<Languages> | (string & {})): I18nProviderProps;
9
+ interface I18nUIConfig<Languages extends string> extends I18nConfig<Languages> {
10
+ provider: (locale?: Languages | (string & {})) => I18nProviderProps;
11
+ }
12
+ declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, localeTranslations?: Partial<Record<Languages, Record<string, string> & {
13
+ displayName?: string;
14
+ }>>): I18nUIConfig<Languages>;
15
+ //#endregion
16
+ export { I18nUIConfig, type Translations, defineI18nUI, i18nProvider, uiTranslations };
package/dist/i18n.js ADDED
@@ -0,0 +1,38 @@
1
+ import keys_default from "./.translations/keys.js";
2
+ //#region src/i18n.tsx
3
+ function uiTranslations() {
4
+ return { keys: keys_default };
5
+ }
6
+ function i18nProvider(translations, lang) {
7
+ const t = translations.extend(uiTranslations());
8
+ if ("config" in t) {
9
+ const { defaultLanguage, languages } = t.config;
10
+ const locale = lang ?? defaultLanguage;
11
+ return {
12
+ locale: lang,
13
+ translations: t.get(locale) ?? t.get(defaultLanguage),
14
+ locales: languages.map((code) => ({
15
+ locale: code,
16
+ name: t.get(code).displayName ?? "English"
17
+ }))
18
+ };
19
+ }
20
+ return { translations: t.get() };
21
+ }
22
+ function defineI18nUI(config, localeTranslations = {}) {
23
+ return {
24
+ ...config,
25
+ provider(locale = config.defaultLanguage) {
26
+ return {
27
+ locale,
28
+ translations: localeTranslations[locale],
29
+ locales: config.languages.map((code) => ({
30
+ locale: code,
31
+ name: localeTranslations[code]?.displayName ?? code
32
+ }))
33
+ };
34
+ }
35
+ };
36
+ }
37
+ //#endregion
38
+ export { defineI18nUI, i18nProvider, uiTranslations };
@@ -0,0 +1,34 @@
1
+ import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
2
+ import { LayoutTab, LinkItemType } from "../shared/index.js";
3
+ import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
4
+ import { DocsLayoutProps } from "./index.js";
5
+ import { ComponentProps, FC } from "react";
6
+
7
+ //#region src/layouts/docs/client.d.ts
8
+ interface DocsSlots extends BaseSlots {
9
+ container: FC<ComponentProps<'div'>>;
10
+ header: FC<ComponentProps<'header'>>;
11
+ sidebar: {
12
+ provider: FC<SidebarProviderProps>;
13
+ root: FC<SidebarProps>;
14
+ trigger: FC<ComponentProps<'button'>>;
15
+ useSidebar: () => {
16
+ collapsed: boolean;
17
+ open: boolean;
18
+ setOpen: (v: boolean) => void;
19
+ };
20
+ };
21
+ }
22
+ interface SlotsProps extends BaseSlotsProps<DocsLayoutProps> {
23
+ tabs: LayoutTab[];
24
+ tabMode: NonNullable<DocsLayoutProps['tabMode']>;
25
+ }
26
+ declare function useDocsLayout(): {
27
+ props: SlotsProps;
28
+ isNavTransparent: boolean;
29
+ navItems: LinkItemType[];
30
+ menuItems: LinkItemType[];
31
+ slots: DocsSlots;
32
+ };
33
+ //#endregion
34
+ export { DocsSlots, useDocsLayout };