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,7 @@
1
+ //#region src/layouts/home/not-found.d.ts
2
+ /**
3
+ * the default not found page content, please make your own if you want to customize it.
4
+ */
5
+ declare function DefaultNotFound(): import("react").JSX.Element;
6
+ //#endregion
7
+ export { DefaultNotFound };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { buttonVariants } from "../../components/ui/button.js";
4
+ import Link from "fumadocs-core/link";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { HomeIcon } from "lucide-react";
7
+ import { useTranslations } from "@fuma-translate/react";
8
+ //#region src/layouts/home/not-found.tsx
9
+ /**
10
+ * the default not found page content, please make your own if you want to customize it.
11
+ */
12
+ function DefaultNotFound() {
13
+ const t = useTranslations({ note: "404 page" });
14
+ return /* @__PURE__ */ jsxs("div", {
15
+ className: "flex flex-col px-8 justify-center flex-1 text-center items-center gap-4",
16
+ children: [
17
+ /* @__PURE__ */ jsx("h1", {
18
+ className: "text-6xl font-bold text-fd-muted-foreground",
19
+ children: "404"
20
+ }),
21
+ /* @__PURE__ */ jsx("h2", {
22
+ className: "text-2xl font-semibold",
23
+ children: t("Page Not Found")
24
+ }),
25
+ /* @__PURE__ */ jsx("p", {
26
+ className: "text-fd-muted-foreground max-w-md",
27
+ children: t("The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.")
28
+ }),
29
+ /* @__PURE__ */ jsxs(Link, {
30
+ href: "/",
31
+ className: cn(buttonVariants({
32
+ className: "mt-4 gap-1.5",
33
+ variant: "primary"
34
+ })),
35
+ children: [/* @__PURE__ */ jsx(HomeIcon, { className: "size-4" }), t("Back to Home")]
36
+ })
37
+ ]
38
+ });
39
+ }
40
+ //#endregion
41
+ export { DefaultNotFound };
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from "react";
2
+
3
+ //#region src/layouts/home/slots/container.d.ts
4
+ declare function Container(props: ComponentProps<'main'>): import("react").JSX.Element;
5
+ //#endregion
6
+ export { Container };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/layouts/home/slots/container.tsx
5
+ function Container(props) {
6
+ return /* @__PURE__ */ jsx("main", {
7
+ id: "nd-home-layout",
8
+ ...props,
9
+ className: cn("flex flex-1 flex-col [--fd-layout-width:1400px]", props.className)
10
+ });
11
+ }
12
+ //#endregion
13
+ export { Container };
@@ -0,0 +1,9 @@
1
+ import { ComponentProps } from "react";
2
+
3
+ //#region src/layouts/home/slots/header.d.ts
4
+ declare const navItemVariants: (props?: ({
5
+ variant?: "button" | "main" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
8
+ //#endregion
9
+ export { Header, navItemVariants };
@@ -0,0 +1,239 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { LinkItem } from "../../shared/client.js";
5
+ import "../../shared/index.js";
6
+ import { useIsScrollTop } from "../../../utils/use-is-scroll-top.js";
7
+ import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport } from "../../../components/ui/navigation-menu.js";
8
+ import { useHomeLayout } from "../index.js";
9
+ import Link from "fumadocs-core/link";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { ChevronDown, Languages } from "lucide-react";
12
+ import { cva } from "class-variance-authority";
13
+ import { Fragment as Fragment$1, useState } from "react";
14
+ import { useTranslations } from "@fuma-translate/react";
15
+ //#region src/layouts/home/slots/header.tsx
16
+ const navItemVariants = cva("[&_svg]:size-4", {
17
+ variants: { variant: {
18
+ main: "inline-flex items-center gap-1 p-2 text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary",
19
+ button: buttonVariants({
20
+ color: "secondary",
21
+ className: "gap-1.5"
22
+ }),
23
+ icon: buttonVariants({
24
+ color: "ghost",
25
+ size: "icon"
26
+ })
27
+ } },
28
+ defaultVariants: { variant: "main" }
29
+ });
30
+ function Header(props) {
31
+ const { navItems, menuItems, slots, props: { nav } } = useHomeLayout();
32
+ const t = useTranslations({ note: "mobile menu" });
33
+ if (nav?.component) return nav.component;
34
+ return /* @__PURE__ */ jsxs(HeaderNavigationMenu, {
35
+ transparentMode: nav?.transparentMode,
36
+ ...props,
37
+ children: [
38
+ slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 font-semibold" }),
39
+ nav?.children,
40
+ /* @__PURE__ */ jsx("ul", {
41
+ className: "flex flex-row items-center gap-2 px-6 max-sm:hidden",
42
+ children: navItems.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx(NavigationMenuLinkItem, {
43
+ item,
44
+ className: "text-sm"
45
+ }, i))
46
+ }),
47
+ /* @__PURE__ */ jsxs("div", {
48
+ className: "flex flex-row items-center justify-end gap-1.5 flex-1 max-lg:hidden",
49
+ children: [
50
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
51
+ hideIfDisabled: true,
52
+ className: "w-full rounded-full ps-2.5 max-w-[240px]"
53
+ }),
54
+ slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {}),
55
+ slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-5" }) }),
56
+ /* @__PURE__ */ jsx("ul", {
57
+ className: "flex flex-row gap-2 items-center empty:hidden",
58
+ children: navItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(NavigationMenuLinkItem, {
59
+ className: cn(item.type === "icon" && "-mx-1 first:ms-0 last:me-0"),
60
+ item
61
+ }, i))
62
+ })
63
+ ]
64
+ }),
65
+ /* @__PURE__ */ jsxs("div", {
66
+ className: "flex flex-row items-center ms-auto -me-1.5 lg:hidden",
67
+ children: [slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
68
+ hideIfDisabled: true,
69
+ className: "p-2"
70
+ }), /* @__PURE__ */ jsx(NavigationMenuItem, {
71
+ asChild: true,
72
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(NavigationMenuTrigger, {
73
+ "aria-label": t("Toggle Menu", { note: "aria-label" }),
74
+ className: cn(buttonVariants({
75
+ size: "icon",
76
+ color: "ghost",
77
+ className: "group [&_svg]:size-5.5"
78
+ })),
79
+ onPointerMove: nav?.enableHoverToOpen ? void 0 : (e) => e.preventDefault(),
80
+ children: /* @__PURE__ */ jsx(ChevronDown, { className: "transition-transform duration-300 group-data-[state=open]:rotate-180" })
81
+ }), /* @__PURE__ */ jsxs(NavigationMenuContent, {
82
+ className: "flex flex-col p-4 sm:flex-row sm:items-center sm:justify-end",
83
+ children: [menuItems.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, {
84
+ item,
85
+ className: "sm:hidden"
86
+ }, i)), /* @__PURE__ */ jsxs("div", {
87
+ className: "-ms-1.5 flex flex-row items-center gap-2 max-sm:mt-2",
88
+ children: [
89
+ menuItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, {
90
+ item,
91
+ className: cn(item.type === "icon" && "-mx-1 first:ms-0")
92
+ }, i)),
93
+ /* @__PURE__ */ jsx("div", {
94
+ role: "separator",
95
+ className: "flex-1"
96
+ }),
97
+ slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, { children: [
98
+ /* @__PURE__ */ jsx(Languages, { className: "size-5" }),
99
+ slots.languageSelect.text && /* @__PURE__ */ jsx(slots.languageSelect.text, {}),
100
+ /* @__PURE__ */ jsx(ChevronDown, { className: "size-3 text-fd-muted-foreground" })
101
+ ] }),
102
+ slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {})
103
+ ]
104
+ })]
105
+ })] })
106
+ })]
107
+ })
108
+ ]
109
+ });
110
+ }
111
+ function isSecondary(item) {
112
+ if ("secondary" in item && item.secondary != null) return item.secondary;
113
+ return item.type === "icon";
114
+ }
115
+ function HeaderNavigationMenu({ transparentMode = "none", ...props }) {
116
+ const [value, setValue] = useState("");
117
+ const isTop = useIsScrollTop({ enabled: transparentMode === "top" }) ?? true;
118
+ const isTransparent = transparentMode === "top" ? isTop : transparentMode === "always";
119
+ return /* @__PURE__ */ jsx(NavigationMenu, {
120
+ value,
121
+ onValueChange: setValue,
122
+ asChild: true,
123
+ children: /* @__PURE__ */ jsx("header", {
124
+ id: "nd-nav",
125
+ ...props,
126
+ className: cn("sticky h-14 top-0 z-40", props.className),
127
+ children: /* @__PURE__ */ jsxs("div", {
128
+ className: cn("backdrop-blur-lg border-b transition-colors *:mx-auto *:max-w-(--fd-layout-width)", value.length > 0 && "max-lg:shadow-lg max-lg:rounded-b-2xl", (!isTransparent || value.length > 0) && "bg-fd-background/80"),
129
+ children: [/* @__PURE__ */ jsx(NavigationMenuList, {
130
+ className: "flex h-14 w-full items-center px-4",
131
+ asChild: true,
132
+ children: /* @__PURE__ */ jsx("nav", { children: props.children })
133
+ }), /* @__PURE__ */ jsx(NavigationMenuViewport, {})]
134
+ })
135
+ })
136
+ });
137
+ }
138
+ function NavigationMenuLinkItem({ item, ...props }) {
139
+ if (item.type === "custom") return item.children;
140
+ if (item.type === "menu") {
141
+ const children = item.items.map((child, j) => {
142
+ if (child.type === "custom") return /* @__PURE__ */ jsx(Fragment$1, { children: child.children }, j);
143
+ const { banner = child.icon ? /* @__PURE__ */ jsx("div", {
144
+ className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4",
145
+ children: child.icon
146
+ }) : null, ...rest } = child.menu ?? {};
147
+ return /* @__PURE__ */ jsx(NavigationMenuLink, {
148
+ asChild: true,
149
+ children: /* @__PURE__ */ jsx(Link, {
150
+ href: child.url,
151
+ external: child.external,
152
+ ...rest,
153
+ className: cn("flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground", rest.className),
154
+ children: rest.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
155
+ banner,
156
+ /* @__PURE__ */ jsx("p", {
157
+ className: "text-base font-medium",
158
+ children: child.text
159
+ }),
160
+ /* @__PURE__ */ jsx("p", {
161
+ className: "text-sm text-fd-muted-foreground empty:hidden",
162
+ children: child.description
163
+ })
164
+ ] })
165
+ })
166
+ }, `${j}-${child.url}`);
167
+ });
168
+ return /* @__PURE__ */ jsxs(NavigationMenuItem, {
169
+ ...props,
170
+ children: [/* @__PURE__ */ jsx(NavigationMenuTrigger, {
171
+ className: cn(navItemVariants(), "rounded-md"),
172
+ children: item.url ? /* @__PURE__ */ jsx(Link, {
173
+ href: item.url,
174
+ external: item.external,
175
+ children: item.text
176
+ }) : item.text
177
+ }), /* @__PURE__ */ jsx(NavigationMenuContent, {
178
+ className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3",
179
+ children
180
+ })]
181
+ });
182
+ }
183
+ return /* @__PURE__ */ jsx(NavigationMenuItem, {
184
+ ...props,
185
+ children: /* @__PURE__ */ jsx(NavigationMenuLink, {
186
+ asChild: true,
187
+ children: /* @__PURE__ */ jsx(LinkItem, {
188
+ item,
189
+ "aria-label": item.type === "icon" ? item.label : void 0,
190
+ className: cn(navItemVariants({ variant: item.type })),
191
+ children: item.type === "icon" ? item.icon : item.text
192
+ })
193
+ })
194
+ });
195
+ }
196
+ function MobileNavigationMenuLinkItem({ item, ...props }) {
197
+ if (item.type === "custom") return /* @__PURE__ */ jsx("div", {
198
+ className: cn("grid", props.className),
199
+ children: item.children
200
+ });
201
+ if (item.type === "menu") {
202
+ const header = /* @__PURE__ */ jsxs(Fragment, { children: [item.icon, item.text] });
203
+ return /* @__PURE__ */ jsxs("div", {
204
+ className: cn("mb-4 flex flex-col", props.className),
205
+ children: [/* @__PURE__ */ jsx("p", {
206
+ className: "mb-1 text-sm text-fd-muted-foreground",
207
+ children: item.url ? /* @__PURE__ */ jsx(NavigationMenuLink, {
208
+ asChild: true,
209
+ children: /* @__PURE__ */ jsx(Link, {
210
+ href: item.url,
211
+ external: item.external,
212
+ children: header
213
+ })
214
+ }) : header
215
+ }), item.items.map((child, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, { item: child }, i))]
216
+ });
217
+ }
218
+ return /* @__PURE__ */ jsx(NavigationMenuLink, {
219
+ asChild: true,
220
+ children: /* @__PURE__ */ jsxs(LinkItem, {
221
+ item,
222
+ className: cn({
223
+ main: "inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-popover-foreground/50 data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4",
224
+ icon: buttonVariants({
225
+ size: "icon",
226
+ color: "ghost"
227
+ }),
228
+ button: buttonVariants({
229
+ color: "secondary",
230
+ className: "gap-1.5 [&_svg]:size-4"
231
+ })
232
+ }[item.type ?? "main"], props.className),
233
+ "aria-label": item.type === "icon" ? item.label : void 0,
234
+ children: [item.icon, item.type === "icon" ? void 0 : item.text]
235
+ })
236
+ });
237
+ }
238
+ //#endregion
239
+ export { Header, navItemVariants };
@@ -0,0 +1,36 @@
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/notebook/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
+ collapseTrigger: FC<ComponentProps<'button'>>;
16
+ useSidebar: () => {
17
+ collapsed: boolean;
18
+ open: boolean;
19
+ setOpen: (V: boolean) => void;
20
+ };
21
+ };
22
+ }
23
+ interface SlotsProps extends BaseSlotsProps<DocsLayoutProps> {
24
+ sidebar: SidebarProps;
25
+ tabMode: NonNullable<DocsLayoutProps['tabMode']>;
26
+ tabs: LayoutTab[];
27
+ }
28
+ declare function useNotebookLayout(): {
29
+ props: SlotsProps;
30
+ isNavTransparent: boolean;
31
+ navItems: LinkItemType[];
32
+ menuItems: LinkItemType[];
33
+ slots: DocsSlots;
34
+ };
35
+ //#endregion
36
+ export { DocsSlots, useNotebookLayout };
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { TreeContextProvider } from "../../contexts/tree.js";
3
+ import { baseSlots } from "../shared/client.js";
4
+ import { useLinkItems } from "../shared/index.js";
5
+ import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
6
+ import { Container } from "./slots/container.js";
7
+ import { Sidebar, SidebarCollapseTrigger, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
8
+ import { Header } from "./slots/header.js";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { createContext, use } from "react";
11
+ //#region src/layouts/notebook/client.tsx
12
+ const { useProvider } = baseSlots({ useProps() {
13
+ return useNotebookLayout().props;
14
+ } });
15
+ const LayoutContext = createContext(null);
16
+ function useNotebookLayout() {
17
+ const context = use(LayoutContext);
18
+ if (!context) throw new Error("Please use <DocsPage /> (`opin-ui/layouts/notebook/page`) under <DocsLayout /> (`opin-ui/layouts/notebook`).");
19
+ return context;
20
+ }
21
+ function LayoutBody(props) {
22
+ const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabMode = "sidebar", tabs, tree, containerProps, children } = props;
23
+ const isTop = useIsScrollTop({ enabled: navTransparentMode === "top" }) ?? true;
24
+ const isNavTransparent = navTransparentMode === "top" ? isTop : navTransparentMode === "always";
25
+ const { baseSlots, baseProps } = useProvider(props);
26
+ const linkItems = useLinkItems(props);
27
+ const slots = {
28
+ ...baseSlots,
29
+ header: defaultSlots?.header ?? Header,
30
+ container: defaultSlots?.container ?? Container,
31
+ sidebar: defaultSlots?.sidebar ?? {
32
+ provider: SidebarProvider,
33
+ root: Sidebar,
34
+ trigger: SidebarTrigger,
35
+ collapseTrigger: SidebarCollapseTrigger,
36
+ useSidebar
37
+ }
38
+ };
39
+ return /* @__PURE__ */ jsx(TreeContextProvider, {
40
+ tree,
41
+ children: /* @__PURE__ */ jsx(LayoutContext, {
42
+ value: {
43
+ props: {
44
+ tabs,
45
+ tabMode,
46
+ sidebar: sidebarProps,
47
+ ...baseProps
48
+ },
49
+ isNavTransparent,
50
+ slots,
51
+ ...linkItems
52
+ },
53
+ children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
54
+ defaultOpenLevel,
55
+ prefetch,
56
+ children: /* @__PURE__ */ jsxs(slots.container, {
57
+ ...containerProps,
58
+ children: [
59
+ navEnabled && /* @__PURE__ */ jsx(slots.header, {}),
60
+ /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
61
+ children
62
+ ]
63
+ })
64
+ })
65
+ })
66
+ });
67
+ }
68
+ //#endregion
69
+ export { LayoutBody, useNotebookLayout };
@@ -0,0 +1,37 @@
1
+ import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab, NavOptions } from "../shared/index.js";
2
+ import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
3
+ import { DocsSlots, useNotebookLayout } from "./client.js";
4
+ import { HTMLAttributes } from "react";
5
+ import * as PageTree from "fumadocs-core/page-tree";
6
+
7
+ //#region src/layouts/notebook/index.d.ts
8
+ interface DocsLayoutProps extends Omit<BaseLayoutProps, 'nav'> {
9
+ tree: PageTree.Root;
10
+ tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
11
+ tabMode?: 'sidebar' | 'navbar';
12
+ sidebar?: SidebarOptions;
13
+ nav?: NavOptions & {
14
+ mode?: 'top' | 'auto';
15
+ };
16
+ containerProps?: HTMLAttributes<HTMLDivElement>;
17
+ slots?: Partial<DocsSlots>;
18
+ }
19
+ interface SidebarOptions extends SidebarProps, SidebarProviderProps {
20
+ /**
21
+ * @deprecated use layout-level `tabs` option instead.
22
+ */
23
+ tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
24
+ }
25
+ declare function DocsLayout({
26
+ tree,
27
+ tabMode,
28
+ sidebar: {
29
+ tabs: defaultTabs,
30
+ ...sidebarProps
31
+ },
32
+ children,
33
+ tabs,
34
+ ...props
35
+ }: DocsLayoutProps): import("react").JSX.Element;
36
+ //#endregion
37
+ export { DocsLayout, DocsLayoutProps, type DocsSlots, SidebarOptions, useNotebookLayout };
@@ -0,0 +1,22 @@
1
+ import { getLayoutTabs } from "../shared/index.js";
2
+ import { LayoutBody, useNotebookLayout } from "./client.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useMemo } from "react";
5
+ //#region src/layouts/notebook/index.tsx
6
+ function DocsLayout({ tree, tabMode = "sidebar", sidebar: { tabs: defaultTabs, ...sidebarProps } = {}, children, tabs = defaultTabs, ...props }) {
7
+ return /* @__PURE__ */ jsx(LayoutBody, {
8
+ tree,
9
+ tabs: useMemo(() => {
10
+ if (Array.isArray(tabs)) return tabs;
11
+ if (typeof tabs === "object") return getLayoutTabs(tree, tabs);
12
+ if (tabs !== false) return getLayoutTabs(tree);
13
+ return [];
14
+ }, [tabs, tree]),
15
+ tabMode,
16
+ sidebar: sidebarProps,
17
+ ...props,
18
+ children
19
+ });
20
+ }
21
+ //#endregion
22
+ export { DocsLayout, useNotebookLayout };
@@ -0,0 +1,115 @@
1
+ import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
+ import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
3
+ import { Footer, FooterProps } from "./slots/footer.js";
4
+ import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
5
+ import { ComponentProps, FC, ReactNode } from "react";
6
+ import { TOCItemType } from "fumadocs-core/toc";
7
+
8
+ //#region src/layouts/notebook/page/index.d.ts
9
+ interface DocsPageProps extends ComponentProps<'article'> {
10
+ toc?: TOCItemType[];
11
+ /**
12
+ * Extend the page to fill all available space
13
+ *
14
+ * @defaultValue false
15
+ */
16
+ full?: boolean | undefined;
17
+ slots?: Partial<DocsPageSlots>;
18
+ footer?: FooterOptions;
19
+ breadcrumb?: BreadcrumbOptions;
20
+ tableOfContent?: TableOfContentOptions;
21
+ tableOfContentPopover?: TableOfContentPopoverOptions;
22
+ }
23
+ interface BreadcrumbOptions extends BreadcrumbProps {
24
+ enabled?: boolean;
25
+ /**
26
+ * @deprecated use `slots.breadcrumb` instead.
27
+ */
28
+ component?: ReactNode;
29
+ }
30
+ interface FooterOptions extends FooterProps {
31
+ enabled?: boolean;
32
+ /**
33
+ * @deprecated use `slots.footer` instead.
34
+ */
35
+ component?: ReactNode;
36
+ }
37
+ type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
38
+ enabled?: boolean;
39
+ /**
40
+ * @deprecated use `slots.toc` instead.
41
+ */
42
+ component?: ReactNode;
43
+ };
44
+ type TableOfContentPopoverOptions = TOCPopoverProps & {
45
+ enabled?: boolean;
46
+ /**
47
+ * @deprecated use `slots.tocPopover` instead.
48
+ */
49
+ component?: ReactNode;
50
+ };
51
+ interface DocsPageSlots {
52
+ toc: {
53
+ provider: FC<TOCProviderProps>;
54
+ main: FC<TOCProps>;
55
+ popover: FC<TOCPopoverProps>;
56
+ };
57
+ container: FC<ComponentProps<'article'>>;
58
+ footer: FC<FooterProps>;
59
+ breadcrumb: FC<BreadcrumbProps>;
60
+ }
61
+ declare function useDocsPage(): {
62
+ full: NonNullable<DocsPageProps["full"]>;
63
+ slots: DocsPageSlots;
64
+ };
65
+ declare function DocsPage({
66
+ full,
67
+ tableOfContent: {
68
+ enabled: tocEnabled,
69
+ single,
70
+ ...tocProps
71
+ },
72
+ tableOfContentPopover: {
73
+ enabled: tocPopoverEnabled,
74
+ ...tocPopoverProps
75
+ },
76
+ breadcrumb: {
77
+ enabled: breadcrumbEnabled,
78
+ ...breadcrumb
79
+ },
80
+ footer: {
81
+ enabled: footerEnabled,
82
+ ...footer
83
+ },
84
+ toc,
85
+ slots: defaultSlots,
86
+ children,
87
+ ...containerProps
88
+ }: DocsPageProps): import("react").JSX.Element;
89
+ declare function EditOnGitHub(props: ComponentProps<'a'>): import("react").JSX.Element;
90
+ /**
91
+ * Add typography styles
92
+ */
93
+ declare function DocsBody({
94
+ children,
95
+ className,
96
+ ...props
97
+ }: ComponentProps<'div'>): import("react").JSX.Element;
98
+ declare function DocsDescription({
99
+ children,
100
+ className,
101
+ ...props
102
+ }: ComponentProps<'p'>): import("react").JSX.Element | null;
103
+ declare function DocsTitle({
104
+ children,
105
+ className,
106
+ ...props
107
+ }: ComponentProps<'h1'>): import("react").JSX.Element;
108
+ declare function PageLastUpdate({
109
+ date: value,
110
+ ...props
111
+ }: Omit<ComponentProps<'p'>, 'children'> & {
112
+ date: Date;
113
+ }): import("react").JSX.Element;
114
+ //#endregion
115
+ export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };