fumadocs-ui 15.2.8 → 16.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +1 -1
  2. package/css/black.css +4 -2
  3. package/css/catppuccin.css +2 -0
  4. package/css/default.css +33 -0
  5. package/css/dusk.css +2 -0
  6. package/css/neutral.css +11 -8
  7. package/css/ocean.css +5 -3
  8. package/css/preset.css +237 -16
  9. package/css/purple.css +12 -10
  10. package/css/shadcn.css +31 -0
  11. package/css/shiki.css +78 -51
  12. package/css/solar.css +48 -0
  13. package/css/vitepress.css +3 -4
  14. package/dist/components/accordion.d.ts +6 -3
  15. package/dist/components/accordion.d.ts.map +1 -1
  16. package/dist/components/accordion.js +19 -11
  17. package/dist/components/banner.d.ts +8 -2
  18. package/dist/components/banner.d.ts.map +1 -1
  19. package/dist/components/banner.js +25 -30
  20. package/dist/components/callout.d.ts +2 -2
  21. package/dist/components/callout.d.ts.map +1 -1
  22. package/dist/components/callout.js +15 -18
  23. package/dist/components/card.d.ts.map +1 -1
  24. package/dist/components/card.js +2 -2
  25. package/dist/components/codeblock.d.ts +19 -23
  26. package/dist/components/codeblock.d.ts.map +1 -1
  27. package/dist/components/codeblock.js +55 -24
  28. package/dist/components/dialog/search-algolia.d.ts +5 -4
  29. package/dist/components/dialog/search-algolia.d.ts.map +1 -1
  30. package/dist/components/dialog/search-algolia.js +21 -7
  31. package/dist/components/dialog/search-default.d.ts +4 -2
  32. package/dist/components/dialog/search-default.d.ts.map +1 -1
  33. package/dist/components/dialog/search-default.js +22 -6
  34. package/dist/components/dialog/search-orama.d.ts +5 -3
  35. package/dist/components/dialog/search-orama.d.ts.map +1 -1
  36. package/dist/components/dialog/search-orama.js +21 -6
  37. package/dist/components/dialog/search.d.ts +61 -27
  38. package/dist/components/dialog/search.d.ts.map +1 -1
  39. package/dist/components/dialog/search.js +155 -67
  40. package/dist/components/dynamic-codeblock.d.ts +16 -2
  41. package/dist/components/dynamic-codeblock.d.ts.map +1 -1
  42. package/dist/components/dynamic-codeblock.js +22 -10
  43. package/dist/components/files.d.ts.map +1 -1
  44. package/dist/components/files.js +1 -1
  45. package/dist/components/github-info.js +1 -1
  46. package/dist/components/heading.js +1 -1
  47. package/dist/components/image-zoom.css +4 -0
  48. package/dist/components/inline-toc.d.ts +2 -2
  49. package/dist/components/inline-toc.d.ts.map +1 -1
  50. package/dist/components/inline-toc.js +1 -1
  51. package/dist/components/layout/language-toggle.js +1 -1
  52. package/dist/components/layout/root-toggle.d.ts +5 -15
  53. package/dist/components/layout/root-toggle.d.ts.map +1 -1
  54. package/dist/components/layout/root-toggle.js +10 -12
  55. package/dist/components/layout/search-toggle.d.ts +6 -4
  56. package/dist/components/layout/search-toggle.d.ts.map +1 -1
  57. package/dist/components/layout/search-toggle.js +5 -5
  58. package/dist/components/layout/sidebar.d.ts +21 -13
  59. package/dist/components/layout/sidebar.d.ts.map +1 -1
  60. package/dist/components/layout/sidebar.js +67 -65
  61. package/dist/components/layout/theme-toggle.js +1 -1
  62. package/dist/components/layout/toc-clerk.d.ts +2 -4
  63. package/dist/components/layout/toc-clerk.d.ts.map +1 -1
  64. package/dist/components/layout/toc-clerk.js +9 -5
  65. package/dist/components/layout/toc-thumb.js +1 -1
  66. package/dist/components/layout/toc.d.ts +6 -22
  67. package/dist/components/layout/toc.d.ts.map +1 -1
  68. package/dist/components/layout/toc.js +14 -18
  69. package/dist/components/tabs.d.ts +18 -18
  70. package/dist/components/tabs.d.ts.map +1 -1
  71. package/dist/components/tabs.js +44 -105
  72. package/dist/components/tabs.unstyled.d.ts +24 -0
  73. package/dist/components/tabs.unstyled.d.ts.map +1 -0
  74. package/dist/components/tabs.unstyled.js +89 -0
  75. package/dist/components/type-table.d.ts +19 -10
  76. package/dist/components/type-table.d.ts.map +1 -1
  77. package/dist/components/type-table.js +19 -10
  78. package/dist/components/ui/button.d.ts +2 -1
  79. package/dist/components/ui/button.d.ts.map +1 -1
  80. package/dist/components/ui/button.js +12 -8
  81. package/dist/components/ui/navigation-menu.js +2 -2
  82. package/dist/components/ui/popover.js +1 -1
  83. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  84. package/dist/components/ui/scroll-area.js +1 -1
  85. package/dist/contexts/search.d.ts +10 -2
  86. package/dist/contexts/search.d.ts.map +1 -1
  87. package/dist/contexts/search.js +7 -1
  88. package/dist/contexts/sidebar.d.ts.map +1 -1
  89. package/dist/contexts/sidebar.js +2 -3
  90. package/dist/contexts/tree.d.ts +2 -1
  91. package/dist/contexts/tree.d.ts.map +1 -1
  92. package/dist/contexts/tree.js +9 -2
  93. package/dist/i18n.d.ts +13 -11
  94. package/dist/i18n.d.ts.map +1 -1
  95. package/dist/i18n.js +14 -37
  96. package/dist/icons.d.ts +49 -0
  97. package/dist/icons.d.ts.map +1 -0
  98. package/dist/icons.js +282 -0
  99. package/dist/layouts/docs/client.d.ts +9 -0
  100. package/dist/layouts/docs/client.d.ts.map +1 -0
  101. package/dist/layouts/docs/client.js +46 -0
  102. package/dist/layouts/docs/index.d.ts +36 -0
  103. package/dist/layouts/docs/index.d.ts.map +1 -0
  104. package/dist/layouts/docs/index.js +77 -0
  105. package/dist/layouts/docs/page-client.d.ts +25 -0
  106. package/dist/layouts/docs/page-client.d.ts.map +1 -0
  107. package/dist/layouts/docs/page-client.js +157 -0
  108. package/dist/layouts/docs/page.d.ts +17 -0
  109. package/dist/layouts/docs/page.d.ts.map +1 -0
  110. package/dist/layouts/docs/page.js +26 -0
  111. package/dist/layouts/{home.d.ts → home/index.d.ts} +2 -3
  112. package/dist/layouts/home/index.d.ts.map +1 -0
  113. package/dist/layouts/home/index.js +56 -0
  114. package/dist/layouts/home/menu.d.ts +1 -1
  115. package/dist/layouts/home/menu.d.ts.map +1 -1
  116. package/dist/layouts/home/menu.js +3 -6
  117. package/dist/layouts/home/navbar.d.ts +4 -4
  118. package/dist/layouts/home/navbar.d.ts.map +1 -1
  119. package/dist/layouts/home/navbar.js +3 -4
  120. package/dist/layouts/notebook/client.d.ts +11 -0
  121. package/dist/layouts/notebook/client.d.ts.map +1 -0
  122. package/dist/layouts/notebook/client.js +45 -0
  123. package/dist/layouts/notebook/index.d.ts +34 -0
  124. package/dist/layouts/notebook/index.d.ts.map +1 -0
  125. package/dist/layouts/notebook/index.js +112 -0
  126. package/dist/layouts/shared/client.d.ts +6 -0
  127. package/dist/layouts/shared/client.d.ts.map +1 -0
  128. package/dist/layouts/{links.js → shared/client.js} +4 -6
  129. package/dist/layouts/shared/index.d.ts +122 -0
  130. package/dist/layouts/shared/index.d.ts.map +1 -0
  131. package/dist/layouts/{shared.js → shared/index.js} +1 -15
  132. package/dist/mdx.d.ts +7 -2
  133. package/dist/mdx.d.ts.map +1 -1
  134. package/dist/mdx.js +5 -1
  135. package/dist/mdx.server.d.ts.map +1 -1
  136. package/dist/mdx.server.js +10 -3
  137. package/dist/page.d.ts +33 -35
  138. package/dist/page.d.ts.map +1 -1
  139. package/dist/page.js +28 -32
  140. package/dist/provider/base.d.ts +1 -1
  141. package/dist/provider/base.d.ts.map +1 -1
  142. package/dist/provider/base.js +9 -9
  143. package/dist/provider/index.d.ts +5 -3
  144. package/dist/provider/index.d.ts.map +1 -1
  145. package/dist/provider/index.js +6 -6
  146. package/dist/provider/next.d.ts +4 -0
  147. package/dist/provider/next.d.ts.map +1 -0
  148. package/dist/provider/next.js +7 -0
  149. package/dist/provider/react-router.d.ts +4 -0
  150. package/dist/provider/react-router.d.ts.map +1 -0
  151. package/dist/provider/react-router.js +7 -0
  152. package/dist/provider/tanstack.d.ts +4 -0
  153. package/dist/provider/tanstack.d.ts.map +1 -0
  154. package/dist/provider/tanstack.js +7 -0
  155. package/dist/provider/waku.d.ts +4 -0
  156. package/dist/provider/waku.d.ts.map +1 -0
  157. package/dist/provider/waku.js +7 -0
  158. package/dist/style.css +944 -470
  159. package/dist/utils/get-sidebar-tabs.d.ts +18 -4
  160. package/dist/utils/get-sidebar-tabs.d.ts.map +1 -1
  161. package/dist/utils/get-sidebar-tabs.js +11 -8
  162. package/dist/utils/is-active.d.ts +2 -0
  163. package/dist/utils/is-active.d.ts.map +1 -1
  164. package/dist/utils/is-active.js +12 -4
  165. package/dist/utils/merge-refs.d.ts +3 -0
  166. package/dist/utils/merge-refs.d.ts.map +1 -0
  167. package/dist/utils/merge-refs.js +12 -0
  168. package/dist/utils/use-copy-button.d.ts +1 -1
  169. package/dist/utils/use-copy-button.d.ts.map +1 -1
  170. package/dist/utils/use-copy-button.js +9 -7
  171. package/package.json +76 -32
  172. package/css/animations.css +0 -199
  173. package/dist/components/ui/tabs.d.ts +0 -8
  174. package/dist/components/ui/tabs.d.ts.map +0 -1
  175. package/dist/components/ui/tabs.js +0 -16
  176. package/dist/layouts/docs/shared.d.ts +0 -25
  177. package/dist/layouts/docs/shared.d.ts.map +0 -1
  178. package/dist/layouts/docs/shared.js +0 -24
  179. package/dist/layouts/docs-client.d.ts +0 -5
  180. package/dist/layouts/docs-client.d.ts.map +0 -1
  181. package/dist/layouts/docs-client.js +0 -33
  182. package/dist/layouts/docs.d.ts +0 -30
  183. package/dist/layouts/docs.d.ts.map +0 -1
  184. package/dist/layouts/docs.js +0 -50
  185. package/dist/layouts/home.d.ts.map +0 -1
  186. package/dist/layouts/home.js +0 -44
  187. package/dist/layouts/links.d.ts +0 -79
  188. package/dist/layouts/links.d.ts.map +0 -1
  189. package/dist/layouts/notebook-client.d.ts +0 -12
  190. package/dist/layouts/notebook-client.d.ts.map +0 -1
  191. package/dist/layouts/notebook-client.js +0 -47
  192. package/dist/layouts/notebook.d.ts +0 -17
  193. package/dist/layouts/notebook.d.ts.map +0 -1
  194. package/dist/layouts/notebook.js +0 -68
  195. package/dist/layouts/shared.d.ts +0 -65
  196. package/dist/layouts/shared.d.ts.map +0 -1
  197. package/dist/page-client.d.ts +0 -28
  198. package/dist/page-client.d.ts.map +0 -1
  199. package/dist/page-client.js +0 -150
  200. package/dist/page.server.d.ts +0 -13
  201. package/dist/page.server.d.ts.map +0 -1
  202. package/dist/page.server.js +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/contexts/search.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG1E,UAAU,MAAM;IACd,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IAErB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAQD,wBAAgB,gBAAgB,IAAI,iBAAiB,CAEpD;AAcD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,QAAQ,EACR,OAAc,EACd,OAAO,EACP,MASC,EACD,KAAK,GACN,EAAE,mBAAmB,2CAuCrB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,aAI/D"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","s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MASC,EACD,KAAK,GACN,EAAE,mBAAmB,2CA4CrB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,aAI/D"}
@@ -42,7 +42,13 @@ export function SearchProvider({ SearchDialog, children, preload = true, options
42
42
  window.removeEventListener('keydown', handler);
43
43
  };
44
44
  }, [hotKey]);
45
- return (_jsxs(SearchContext.Provider, { value: useMemo(() => ({ enabled: true, hotKey, setOpenSearch: setIsOpen }), [hotKey]), children: [isOpen !== undefined && (_jsx(SearchDialog, { open: isOpen, onOpenChange: setIsOpen, links: links, ...options })), children] }));
45
+ return (_jsxs(SearchContext.Provider, { value: useMemo(() => ({
46
+ enabled: true,
47
+ hotKey,
48
+ setOpenSearch: setIsOpen,
49
+ }), [hotKey]), children: [isOpen !== undefined && (_jsx(SearchDialog, { open: isOpen, onOpenChange: setIsOpen,
50
+ // @ts-expect-error -- insert prop for official UIs
51
+ links: links, ...options })), children] }));
46
52
  }
47
53
  /**
48
54
  * Show children only when search is enabled via React Context
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5D;;OAEG;IACH,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CACrC;AAED,QAAA,MAAM,cAAc;;;;;;CAAkD,CAAC;AAEvE,wBAAgB,UAAU,IAAI,cAAc,CAE3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CAgCZ"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAIf,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5D;;OAEG;IACH,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CACrC;AAED,QAAA,MAAM,cAAc;;;;;;CAAkD,CAAC;AAEvE,wBAAgB,UAAU,IAAI,cAAc,CAE3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CA8BZ"}
@@ -1,8 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useState, useMemo, useRef, } from 'react';
3
+ import { useMemo, useRef, useState, } from 'react';
4
4
  import { createContext, usePathname } from 'fumadocs-core/framework';
5
- import { SidebarProvider as BaseProvider } from 'fumadocs-core/sidebar';
6
5
  import { useOnChange } from 'fumadocs-core/utils/use-on-change';
7
6
  const SidebarContext = createContext('SidebarContext');
8
7
  export function useSidebar() {
@@ -25,5 +24,5 @@ export function SidebarProvider({ children, }) {
25
24
  collapsed,
26
25
  setCollapsed,
27
26
  closeOnRedirect,
28
- }), [open, collapsed]), children: _jsx(BaseProvider, { open: open, onOpenChange: setOpen, children: children }) }));
27
+ }), [open, collapsed]), children: children }));
29
28
  }
@@ -1,8 +1,9 @@
1
- import type { PageTree } from 'fumadocs-core/server';
1
+ import type * as PageTree from 'fumadocs-core/page-tree';
2
2
  import { type ReactNode } from 'react';
3
3
  type MakeRequired<O, K extends keyof O> = Omit<O, K> & Pick<Required<O>, K>;
4
4
  interface TreeContextType {
5
5
  root: MakeRequired<PageTree.Root | PageTree.Folder, '$id'>;
6
+ full: PageTree.Root;
6
7
  }
7
8
  export declare function TreeContextProvider(props: {
8
9
  tree: PageTree.Root;
@@ -1 +1 @@
1
- {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/contexts/tree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAGxD,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5E,UAAU,eAAe;IACvB,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC5D;AAKD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAwBA;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAE7C;AAED,wBAAgB,cAAc,IAAI,eAAe,CAEhD"}
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/contexts/tree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AAGxD,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5E,UAAU,eAAe;IACvB,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3D,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;CACrB;AAKD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CA8BA;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAE7C;AAED,wBAAgB,cAAc,IAAI,eAAe,CAEhD"}
@@ -12,10 +12,17 @@ export function TreeContextProvider(props) {
12
12
  // using the id here to make sure this never happens
13
13
  // eslint-disable-next-line react-hooks/exhaustive-deps
14
14
  const tree = useMemo(() => props.tree, [props.tree.$id ?? props.tree]);
15
- const path = useMemo(() => searchPath(tree.children, pathname) ?? [], [tree, pathname]);
15
+ const path = useMemo(() => {
16
+ let result = searchPath(tree.children, pathname);
17
+ if (result)
18
+ return result;
19
+ if (tree.fallback)
20
+ result = searchPath(tree.fallback.children, pathname);
21
+ return result ?? [];
22
+ }, [tree, pathname]);
16
23
  const root = path.findLast((item) => item.type === 'folder' && item.root) ?? tree;
17
24
  root.$id ?? (root.$id = String(nextIdRef.current++));
18
- return (_jsx(TreeContext.Provider, { value: useMemo(() => ({ root }), [root]), children: _jsx(PathContext.Provider, { value: path, children: props.children }) }));
25
+ return (_jsx(TreeContext.Provider, { value: useMemo(() => ({ root, full: tree }), [root, tree]), children: _jsx(PathContext.Provider, { value: path, children: props.children }) }));
19
26
  }
20
27
  export function useTreePath() {
21
28
  return PathContext.use();
package/dist/i18n.d.ts CHANGED
@@ -1,13 +1,15 @@
1
+ import type { Translations } from './contexts/i18n.js';
1
2
  import type { I18nProviderProps } from './provider/base.js';
2
- export type { I18nProviderProps };
3
- export { defaultTranslations, type Translations } from './contexts/i18n.js';
4
- /**
5
- * @deprecated legacy I18n Provider, use `<RootProvider i18n={...} />` instead
6
- */
7
- export declare function I18nProvider({ locales, locale, onChange: _onChange, onLocaleChange, ...props }: I18nProviderProps & {
8
- /**
9
- * @deprecated use `onLocaleChange` instead
10
- */
11
- onChange?: I18nProviderProps['onLocaleChange'];
12
- }): import("react/jsx-runtime").JSX.Element;
3
+ import type { I18nConfig } from 'fumadocs-core/i18n';
4
+ export type { I18nProviderProps, Translations };
5
+ export { defaultTranslations } from './contexts/i18n.js';
6
+ export declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, options: {
7
+ translations: {
8
+ [K in Languages]?: Partial<Translations> & {
9
+ displayName?: string;
10
+ };
11
+ };
12
+ }): {
13
+ provider(locale?: string): I18nProviderProps;
14
+ };
13
15
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGzE;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAY,EACZ,MAAM,EACN,QAAQ,EAAE,SAAS,EACnB,cAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAChD,2CAsCA"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,wBAAgB,YAAY,CAAC,SAAS,SAAS,MAAM,EACnD,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,EAC7B,OAAO,EAAE;IACP,YAAY,EAAE;SACX,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;YAAE,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE;KACpE,CAAC;CACH;sBAKkB,MAAM,GAA4B,iBAAiB;EAWvE"}
package/dist/i18n.js CHANGED
@@ -1,39 +1,16 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { usePathname, useRouter } from 'next/navigation';
4
- import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
5
- import { useMemo } from 'react';
6
- import { defaultTranslations, I18nContext } from './contexts/i18n.js';
7
1
  export { defaultTranslations } from './contexts/i18n.js';
8
- // TODO: remove next major
9
- /**
10
- * @deprecated legacy I18n Provider, use `<RootProvider i18n={...} />` instead
11
- */
12
- export function I18nProvider({ locales = [], locale, onChange: _onChange, onLocaleChange = _onChange, ...props }) {
13
- const router = useRouter();
14
- const pathname = usePathname();
15
- const onChange = useEffectEvent((value) => {
16
- if (onLocaleChange) {
17
- return onLocaleChange(value);
18
- }
19
- const segments = pathname.split('/').filter((v) => v.length > 0);
20
- // If locale prefix hidden
21
- if (segments[0] !== locale) {
22
- segments.unshift(value);
23
- }
24
- else {
25
- segments[0] = value;
26
- }
27
- router.push(`/${segments.join('/')}`);
28
- router.refresh();
29
- });
30
- return (_jsx(I18nContext.Provider, { value: useMemo(() => ({
31
- locale,
32
- locales,
33
- text: {
34
- ...defaultTranslations,
35
- ...props.translations,
36
- },
37
- onChange,
38
- }), [locale, locales, onChange, props.translations]), children: props.children }));
2
+ export function defineI18nUI(config, options) {
3
+ const { translations } = options;
4
+ return {
5
+ provider(locale = config.defaultLanguage) {
6
+ return {
7
+ locale,
8
+ translations: translations[locale],
9
+ locales: config.languages.map((locale) => ({
10
+ locale,
11
+ name: translations[locale]?.displayName ?? locale,
12
+ })),
13
+ };
14
+ },
15
+ };
39
16
  }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license lucide-react - ISC
3
+ *
4
+ * All copyright belongs to https://github.com/lucide-icons/lucide, we bundle it as part of library to avoid upstream issues.
5
+ */
6
+ import { type ComponentProps } from 'react';
7
+ type SVGElementType = 'circle' | 'ellipse' | 'g' | 'line' | 'path' | 'polygon' | 'polyline' | 'rect';
8
+ export interface LucideProps extends ComponentProps<'svg'> {
9
+ size?: string | number;
10
+ }
11
+ export type IconNode = [
12
+ elementName: SVGElementType,
13
+ attrs: Record<string, string>
14
+ ][];
15
+ export declare const ChevronDown: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
16
+ export declare const Languages: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
17
+ export declare const Sidebar: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
18
+ export declare const ChevronsUpDown: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
19
+ export declare const Search: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
20
+ export declare const ExternalLink: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
21
+ export declare const Moon: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
22
+ export declare const Sun: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
23
+ export declare const Airplay: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
24
+ export declare const Menu: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
25
+ export declare const X: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
26
+ export declare const LoaderCircle: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
27
+ export declare const CircleCheck: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
28
+ export declare const CircleX: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
29
+ export declare const Check: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
30
+ export declare const TriangleAlert: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
31
+ export declare const Info: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
32
+ export declare const Copy: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
33
+ export declare const Clipboard: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
34
+ export declare const FileText: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
35
+ export declare const Hash: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
36
+ export declare const Text: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
37
+ export declare const File: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
38
+ export declare const Folder: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
39
+ export declare const FolderOpen: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
40
+ export declare const Star: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
41
+ export declare const Link: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
42
+ export declare const Edit: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
43
+ export declare const ChevronRight: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
44
+ export declare const ChevronLeft: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
45
+ export declare const Plus: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
46
+ export declare const Trash2: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
47
+ export declare const ChevronUp: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
48
+ export {};
49
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,OAAO,CAAC;AAevE,KAAK,cAAc,GACf,QAAQ,GACR,SAAS,GACT,GAAG,GACH,MAAM,GACN,MAAM,GACN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EH,eAAO,MAAM,IAAI,oHAQf,CAAC;AAEH,eAAO,MAAM,IAAI,oHAef,CAAC;AAEH,eAAO,MAAM,IAAI,oHAef,CAAC;AAEH,eAAO,MAAM,YAAY,oHAEvB,CAAC;AAEH,eAAO,MAAM,WAAW,oHAEtB,CAAC;AAEH,eAAO,MAAM,IAAI,oHAGf,CAAC;AAEH,eAAO,MAAM,MAAM,oHAMjB,CAAC;AAEH,eAAO,MAAM,SAAS,oHAEpB,CAAC"}
package/dist/icons.js ADDED
@@ -0,0 +1,282 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @license lucide-react - ISC
4
+ *
5
+ * All copyright belongs to https://github.com/lucide-icons/lucide, we bundle it as part of library to avoid upstream issues.
6
+ */
7
+ import { createElement, forwardRef } from 'react';
8
+ import { cn } from './utils/cn.js';
9
+ const defaultAttributes = {
10
+ xmlns: 'http://www.w3.org/2000/svg',
11
+ width: 24,
12
+ height: 24,
13
+ viewBox: '0 0 24 24',
14
+ fill: 'none',
15
+ stroke: 'currentColor',
16
+ strokeWidth: 2,
17
+ strokeLinecap: 'round',
18
+ strokeLinejoin: 'round',
19
+ };
20
+ const createLucideIcon = (iconName, iconNode) => {
21
+ const Component = forwardRef(({ className, size = 24, color = 'currentColor', children, ...props }, ref) => {
22
+ return (_jsxs("svg", { ref: ref, ...defaultAttributes, width: size, height: size, stroke: color, className: cn('lucide', className), ...props, children: [iconNode.map(([tag, attr]) => createElement(tag, attr)), children] }));
23
+ });
24
+ Component.displayName = iconName;
25
+ return Component;
26
+ };
27
+ export const ChevronDown = createLucideIcon('chevron-down', [
28
+ ['path', { d: 'm6 9 6 6 6-6', key: 'qrunsl' }],
29
+ ]);
30
+ export const Languages = createLucideIcon('languages', [
31
+ ['path', { d: 'm5 8 6 6', key: '1wu5hv' }],
32
+ ['path', { d: 'm4 14 6-6 2-3', key: '1k1g8d' }],
33
+ ['path', { d: 'M2 5h12', key: 'or177f' }],
34
+ ['path', { d: 'M7 2h1', key: '1t2jsx' }],
35
+ ['path', { d: 'm22 22-5-10-5 10', key: 'don7ne' }],
36
+ ['path', { d: 'M14 18h6', key: '1m8k6r' }],
37
+ ]);
38
+ export const Sidebar = createLucideIcon('panel-left', [
39
+ [
40
+ 'rect',
41
+ { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' },
42
+ ],
43
+ ['path', { d: 'M9 3v18', key: 'fh3hqa' }],
44
+ ]);
45
+ export const ChevronsUpDown = createLucideIcon('chevrons-up-down', [
46
+ ['path', { d: 'm7 15 5 5 5-5', key: '1hf1tw' }],
47
+ ['path', { d: 'm7 9 5-5 5 5', key: 'sgt6xg' }],
48
+ ]);
49
+ export const Search = createLucideIcon('search', [
50
+ ['circle', { cx: '11', cy: '11', r: '8', key: '4ej97u' }],
51
+ ['path', { d: 'm21 21-4.3-4.3', key: '1qie3q' }],
52
+ ]);
53
+ export const ExternalLink = createLucideIcon('external-link', [
54
+ ['path', { d: 'M15 3h6v6', key: '1q9fwt' }],
55
+ ['path', { d: 'M10 14 21 3', key: 'gplh6r' }],
56
+ [
57
+ 'path',
58
+ {
59
+ d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6',
60
+ key: 'a6xqqp',
61
+ },
62
+ ],
63
+ ]);
64
+ export const Moon = createLucideIcon('moon', [
65
+ ['path', { d: 'M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z', key: 'a7tn18' }],
66
+ ]);
67
+ export const Sun = createLucideIcon('sun', [
68
+ ['circle', { cx: '12', cy: '12', r: '4', key: '4exip2' }],
69
+ ['path', { d: 'M12 2v2', key: 'tus03m' }],
70
+ ['path', { d: 'M12 20v2', key: '1lh1kg' }],
71
+ ['path', { d: 'm4.93 4.93 1.41 1.41', key: '149t6j' }],
72
+ ['path', { d: 'm17.66 17.66 1.41 1.41', key: 'ptbguv' }],
73
+ ['path', { d: 'M2 12h2', key: '1t8f8n' }],
74
+ ['path', { d: 'M20 12h2', key: '1q8mjw' }],
75
+ ['path', { d: 'm6.34 17.66-1.41 1.41', key: '1m8zz5' }],
76
+ ['path', { d: 'm19.07 4.93-1.41 1.41', key: '1shlcs' }],
77
+ ]);
78
+ export const Airplay = createLucideIcon('airplay', [
79
+ [
80
+ 'path',
81
+ {
82
+ d: 'M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1',
83
+ key: 'ns4c3b',
84
+ },
85
+ ],
86
+ ['path', { d: 'm12 15 5 6H7Z', key: '14qnn2' }],
87
+ ]);
88
+ export const Menu = createLucideIcon('menu', [
89
+ ['line', { x1: '4', x2: '20', y1: '12', y2: '12', key: '1e0a9i' }],
90
+ ['line', { x1: '4', x2: '20', y1: '6', y2: '6', key: '1owob3' }],
91
+ ['line', { x1: '4', x2: '20', y1: '18', y2: '18', key: 'yk5zj1' }],
92
+ ]);
93
+ export const X = createLucideIcon('x', [
94
+ ['path', { d: 'M18 6 6 18', key: '1bl5f8' }],
95
+ ['path', { d: 'm6 6 12 12', key: 'd8bk6v' }],
96
+ ]);
97
+ export const LoaderCircle = createLucideIcon('loader-circle', [
98
+ ['path', { d: 'M21 12a9 9 0 1 1-6.219-8.56', key: '13zald' }],
99
+ ]);
100
+ export const CircleCheck = createLucideIcon('circle-check', [
101
+ ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],
102
+ ['path', { d: 'm9 12 2 2 4-4', key: 'dzmm74' }],
103
+ ]);
104
+ export const CircleX = createLucideIcon('circle-x', [
105
+ ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],
106
+ ['path', { d: 'm15 9-6 6', key: '1uzhvr' }],
107
+ ['path', { d: 'm9 9 6 6', key: 'z0biqf' }],
108
+ ]);
109
+ export const Check = createLucideIcon('check', [
110
+ ['path', { d: 'M20 6 9 17l-5-5', key: '1gmf2c' }],
111
+ ]);
112
+ export const TriangleAlert = createLucideIcon('triangle-alert', [
113
+ [
114
+ 'path',
115
+ {
116
+ d: 'm21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3',
117
+ key: 'wmoenq',
118
+ },
119
+ ],
120
+ ['path', { d: 'M12 9v4', key: 'juzpu7' }],
121
+ ['path', { d: 'M12 17h.01', key: 'p32p05' }],
122
+ ]);
123
+ export const Info = createLucideIcon('info', [
124
+ ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],
125
+ ['path', { d: 'M12 16v-4', key: '1dtifu' }],
126
+ ['path', { d: 'M12 8h.01', key: 'e9boi3' }],
127
+ ]);
128
+ export const Copy = createLucideIcon('copy', [
129
+ [
130
+ 'rect',
131
+ {
132
+ width: '14',
133
+ height: '14',
134
+ x: '8',
135
+ y: '8',
136
+ rx: '2',
137
+ ry: '2',
138
+ key: '17jyea',
139
+ },
140
+ ],
141
+ [
142
+ 'path',
143
+ {
144
+ d: 'M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2',
145
+ key: 'zix9uf',
146
+ },
147
+ ],
148
+ ]);
149
+ export const Clipboard = createLucideIcon('clipboard', [
150
+ [
151
+ 'rect',
152
+ {
153
+ width: '8',
154
+ height: '4',
155
+ x: '8',
156
+ y: '2',
157
+ rx: '1',
158
+ ry: '1',
159
+ key: '1',
160
+ },
161
+ ],
162
+ [
163
+ 'path',
164
+ {
165
+ d: 'M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2',
166
+ key: '2',
167
+ },
168
+ ],
169
+ ]);
170
+ export const FileText = createLucideIcon('file-text', [
171
+ [
172
+ 'path',
173
+ {
174
+ d: 'M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z',
175
+ key: '1rqfz7',
176
+ },
177
+ ],
178
+ ['path', { d: 'M14 2v4a2 2 0 0 0 2 2h4', key: 'tnqrlb' }],
179
+ ['path', { d: 'M10 9H8', key: 'b1mrlr' }],
180
+ ['path', { d: 'M16 13H8', key: 't4e002' }],
181
+ ['path', { d: 'M16 17H8', key: 'z1uh3a' }],
182
+ ]);
183
+ export const Hash = createLucideIcon('hash', [
184
+ ['line', { x1: '4', x2: '20', y1: '9', y2: '9', key: '4lhtct' }],
185
+ ['line', { x1: '4', x2: '20', y1: '15', y2: '15', key: 'vyu0kd' }],
186
+ ['line', { x1: '10', x2: '8', y1: '3', y2: '21', key: '1ggp8o' }],
187
+ ['line', { x1: '16', x2: '14', y1: '3', y2: '21', key: 'weycgp' }],
188
+ ]);
189
+ export const Text = createLucideIcon('text', [
190
+ ['path', { d: 'M15 18H3', key: 'olowqp' }],
191
+ ['path', { d: 'M17 6H3', key: '16j9eg' }],
192
+ ['path', { d: 'M21 12H3', key: '2avoz0' }],
193
+ ]);
194
+ export const File = createLucideIcon('file', [
195
+ [
196
+ 'path',
197
+ {
198
+ d: 'M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z',
199
+ key: '1rqfz7',
200
+ },
201
+ ],
202
+ ['path', { d: 'M14 2v4a2 2 0 0 0 2 2h4', key: 'tnqrlb' }],
203
+ ]);
204
+ export const Folder = createLucideIcon('folder', [
205
+ [
206
+ 'path',
207
+ {
208
+ d: 'M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z',
209
+ key: '1kt360',
210
+ },
211
+ ],
212
+ ]);
213
+ export const FolderOpen = createLucideIcon('folder-open', [
214
+ [
215
+ 'path',
216
+ {
217
+ d: 'm6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2',
218
+ key: 'usdka0',
219
+ },
220
+ ],
221
+ ]);
222
+ export const Star = createLucideIcon('star', [
223
+ [
224
+ 'path',
225
+ {
226
+ d: 'M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z',
227
+ key: 'r04s7s',
228
+ },
229
+ ],
230
+ ]);
231
+ export const Link = createLucideIcon('link', [
232
+ [
233
+ 'path',
234
+ {
235
+ d: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71',
236
+ key: '1cjeqo',
237
+ },
238
+ ],
239
+ [
240
+ 'path',
241
+ {
242
+ d: 'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71',
243
+ key: '19qd67',
244
+ },
245
+ ],
246
+ ]);
247
+ export const Edit = createLucideIcon('square-pen', [
248
+ [
249
+ 'path',
250
+ {
251
+ d: 'M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7',
252
+ key: '1m0v6g',
253
+ },
254
+ ],
255
+ [
256
+ 'path',
257
+ {
258
+ d: 'M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z',
259
+ key: 'ohrbg2',
260
+ },
261
+ ],
262
+ ]);
263
+ export const ChevronRight = createLucideIcon('chevron-right', [
264
+ ['path', { d: 'm9 18 6-6-6-6', key: 'mthhwq' }],
265
+ ]);
266
+ export const ChevronLeft = createLucideIcon('chevron-left', [
267
+ ['path', { d: 'm15 18-6-6 6-6', key: '1wnfg3' }],
268
+ ]);
269
+ export const Plus = createLucideIcon('plus', [
270
+ ['path', { d: 'M5 12h14', key: '1ays0h' }],
271
+ ['path', { d: 'M12 5v14', key: 's699le' }],
272
+ ]);
273
+ export const Trash2 = createLucideIcon('trash-2', [
274
+ ['path', { d: 'M3 6h18', key: 'd0wm0j' }],
275
+ ['path', { d: 'M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6', key: '4alrt4' }],
276
+ ['path', { d: 'M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2', key: 'v07s0e' }],
277
+ ['line', { x1: '10', x2: '10', y1: '11', y2: '17', key: '1uufr5' }],
278
+ ['line', { x1: '14', x2: '14', y1: '11', y2: '17', key: 'xtxkd' }],
279
+ ]);
280
+ export const ChevronUp = createLucideIcon('chevron-up', [
281
+ ['path', { d: 'm18 15-6-6-6 6', key: '153udz' }],
282
+ ]);
@@ -0,0 +1,9 @@
1
+ import { type ComponentProps } from 'react';
2
+ import type { Option } from '../../components/layout/root-toggle.js';
3
+ export declare function Navbar(props: ComponentProps<'header'>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function LayoutBody(props: ComponentProps<'main'>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function CollapsibleControl(): import("react/jsx-runtime").JSX.Element;
6
+ export declare function LayoutTabs({ options, ...props }: ComponentProps<'div'> & {
7
+ options: Option[];
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAK9D,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgBrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,2CAsBvD;AAED,wBAAgB,kBAAkB,4CA2BjC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,2CAuBA"}
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Sidebar as SidebarIcon } from '../../icons.js';
4
+ import { useMemo } from 'react';
5
+ import { cn } from '../../utils/cn.js';
6
+ import { buttonVariants } from '../../components/ui/button.js';
7
+ import { useSidebar } from '../../contexts/sidebar.js';
8
+ import { useNav } from '../../contexts/layout.js';
9
+ import { SidebarCollapseTrigger } from '../../components/layout/sidebar.js';
10
+ import { SearchToggle } from '../../components/layout/search-toggle.js';
11
+ import { usePathname } from 'fumadocs-core/framework';
12
+ import { isTabActive } from '../../utils/is-active.js';
13
+ import Link from 'fumadocs-core/link';
14
+ export function Navbar(props) {
15
+ const { isTransparent } = useNav();
16
+ return (_jsx("header", { id: "nd-subnav", ...props, className: cn('fixed top-(--fd-banner-height) left-0 right-(--removed-body-scroll-bar-size,0) z-30 flex items-center ps-4 pe-2.5 border-b transition-colors backdrop-blur-sm', !isTransparent && 'bg-fd-background/80', props.className), children: props.children }));
17
+ }
18
+ export function LayoutBody(props) {
19
+ const { collapsed } = useSidebar();
20
+ return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex flex-1 flex-col pt-(--fd-nav-height) transition-[padding] fd-default-layout', !collapsed && 'mx-(--fd-layout-offset)', props.className), style: {
21
+ ...props.style,
22
+ paddingInlineStart: collapsed
23
+ ? 'min(calc(100vw - var(--fd-page-width)), var(--fd-sidebar-width))'
24
+ : 'var(--fd-sidebar-width)',
25
+ }, children: props.children }));
26
+ }
27
+ export function CollapsibleControl() {
28
+ const { collapsed } = useSidebar();
29
+ return (_jsxs("div", { className: cn('fixed flex shadow-lg transition-opacity rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10 max-md:hidden xl:start-4 max-xl:end-4', !collapsed && 'pointer-events-none opacity-0'), style: {
30
+ top: 'calc(var(--fd-banner-height) + var(--fd-tocnav-height) + var(--spacing) * 4)',
31
+ }, children: [_jsx(SidebarCollapseTrigger, { className: cn(buttonVariants({
32
+ color: 'ghost',
33
+ size: 'icon-sm',
34
+ className: 'rounded-lg',
35
+ })), children: _jsx(SidebarIcon, {}) }), _jsx(SearchToggle, { className: "rounded-lg", hideIfDisabled: true })] }));
36
+ }
37
+ export function LayoutTabs({ options, ...props }) {
38
+ const pathname = usePathname();
39
+ const selected = useMemo(() => {
40
+ return options.findLast((option) => isTabActive(option, pathname));
41
+ }, [options, pathname]);
42
+ return (_jsx("div", { ...props, className: cn('flex flex-row items-end gap-6 overflow-auto', props.className), children: options.map((option) => (_jsx(LayoutTab, { selected: selected === option, option: option }, option.url))) }));
43
+ }
44
+ function LayoutTab({ option: { title, url, unlisted, props }, selected = false, }) {
45
+ return (_jsx(Link, { href: url, ...props, className: cn('inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground', unlisted && !selected && 'hidden', selected && 'border-fd-primary text-fd-primary', props?.className), children: title }));
46
+ }
@@ -0,0 +1,36 @@
1
+ import type * as PageTree from 'fumadocs-core/page-tree';
2
+ import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
3
+ import { type SidebarComponents, type SidebarProps, SidebarTrigger } from '../../components/layout/sidebar.js';
4
+ import { type Option } from '../../components/layout/root-toggle.js';
5
+ import { type BaseLayoutProps, type LinkItemType } from '../../layouts/shared/index.js';
6
+ import { CollapsibleControl, Navbar } from '../../layouts/docs/client.js';
7
+ import { type GetSidebarTabsOptions } from '../../utils/get-sidebar-tabs.js';
8
+ export interface DocsLayoutProps extends BaseLayoutProps {
9
+ tree: PageTree.Root;
10
+ sidebar?: SidebarOptions;
11
+ tabMode?: 'top' | 'auto';
12
+ /**
13
+ * Props for the `div` container
14
+ */
15
+ containerProps?: HTMLAttributes<HTMLDivElement>;
16
+ }
17
+ interface SidebarOptions extends ComponentProps<'aside'>, Pick<SidebarProps, 'defaultOpenLevel' | 'prefetch'> {
18
+ enabled?: boolean;
19
+ component?: ReactNode;
20
+ components?: Partial<SidebarComponents>;
21
+ /**
22
+ * Root Toggle options
23
+ */
24
+ tabs?: Option[] | GetSidebarTabsOptions | false;
25
+ banner?: ReactNode;
26
+ footer?: ReactNode;
27
+ /**
28
+ * Support collapsing the sidebar on desktop mode
29
+ *
30
+ * @defaultValue true
31
+ */
32
+ collapsible?: boolean;
33
+ }
34
+ export declare function DocsLayout({ nav: { transparentMode, ...nav }, sidebar: { tabs: sidebarTabs, enabled: sidebarEnabled, ...sidebarProps }, searchToggle, themeSwitch, tabMode, i18n, children, tree, ...props }: DocsLayoutProps): import("react/jsx-runtime").JSX.Element;
35
+ export { CollapsibleControl, Navbar, SidebarTrigger, type LinkItemType };
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAIf,OAAO,EAGL,KAAK,iBAAiB,EAWtB,KAAK,YAAY,EACjB,cAAc,EAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,EAGpB,K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