fumadocs-ui 14.2.0 → 14.3.0

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 (229) hide show
  1. package/dist/components/accordion.d.ts +4 -7
  2. package/dist/components/accordion.d.ts.map +1 -0
  3. package/dist/components/accordion.js +32 -104
  4. package/dist/components/api.d.ts +4 -13
  5. package/dist/components/api.d.ts.map +1 -0
  6. package/dist/components/api.js +3 -16
  7. package/dist/components/banner.d.ts +3 -5
  8. package/dist/components/banner.d.ts.map +1 -0
  9. package/dist/components/banner.js +53 -120
  10. package/dist/components/callout.d.ts +4 -7
  11. package/dist/components/callout.d.ts.map +1 -0
  12. package/dist/components/callout.js +13 -9
  13. package/dist/components/card.d.ts +5 -7
  14. package/dist/components/card.d.ts.map +1 -0
  15. package/dist/components/card.js +10 -10
  16. package/dist/components/codeblock.d.ts +6 -9
  17. package/dist/components/codeblock.d.ts.map +1 -0
  18. package/dist/components/codeblock.js +41 -15
  19. package/dist/components/dialog/search-algolia.d.ts +7 -11
  20. package/dist/components/dialog/search-algolia.d.ts.map +1 -0
  21. package/dist/components/dialog/search-algolia.js +19 -79
  22. package/dist/components/dialog/search-default.d.ts +6 -10
  23. package/dist/components/dialog/search-default.d.ts.map +1 -0
  24. package/dist/components/dialog/search-default.js +24 -73
  25. package/dist/components/dialog/search-orama.d.ts +7 -11
  26. package/dist/components/dialog/search-orama.d.ts.map +1 -0
  27. package/dist/components/dialog/search-orama.js +22 -79
  28. package/dist/components/dialog/search.d.ts +7 -9
  29. package/dist/components/dialog/search.d.ts.map +1 -0
  30. package/dist/components/dialog/search.js +98 -13
  31. package/dist/components/dialog/tag-list.d.ts +13 -0
  32. package/dist/components/dialog/tag-list.d.ts.map +1 -0
  33. package/dist/components/dialog/tag-list.js +20 -0
  34. package/dist/components/files.d.ts +7 -9
  35. package/dist/components/files.d.ts.map +1 -0
  36. package/dist/components/files.js +15 -63
  37. package/dist/components/heading.d.ts +4 -5
  38. package/dist/components/heading.d.ts.map +1 -0
  39. package/dist/components/heading.js +9 -9
  40. package/dist/components/image-zoom.d.ts +7 -8
  41. package/dist/components/image-zoom.d.ts.map +1 -0
  42. package/dist/components/image-zoom.js +16 -40
  43. package/dist/components/inline-toc.d.ts +4 -6
  44. package/dist/components/inline-toc.d.ts.map +1 -0
  45. package/dist/components/inline-toc.js +8 -46
  46. package/dist/components/layout/breadcrumb.d.ts +11 -0
  47. package/dist/components/layout/breadcrumb.d.ts.map +1 -0
  48. package/dist/components/layout/breadcrumb.js +20 -0
  49. package/dist/components/layout/language-toggle.d.ts +5 -7
  50. package/dist/components/layout/language-toggle.d.ts.map +1 -0
  51. package/dist/components/layout/language-toggle.js +24 -14
  52. package/dist/components/layout/nav.d.ts +28 -0
  53. package/dist/components/layout/nav.d.ts.map +1 -0
  54. package/dist/components/layout/nav.js +29 -0
  55. package/dist/components/layout/root-toggle.d.ts +5 -7
  56. package/dist/components/layout/root-toggle.d.ts.map +1 -0
  57. package/dist/components/layout/root-toggle.js +28 -13
  58. package/dist/components/layout/search-toggle.d.ts +4 -0
  59. package/dist/components/layout/search-toggle.d.ts.map +1 -0
  60. package/dist/components/layout/search-toggle.js +24 -0
  61. package/dist/components/layout/theme-toggle.d.ts +3 -0
  62. package/dist/components/layout/theme-toggle.d.ts.map +1 -0
  63. package/dist/components/layout/theme-toggle.js +21 -0
  64. package/dist/components/layout/toc-clerk.d.ts +6 -0
  65. package/dist/components/layout/toc-clerk.d.ts.map +1 -0
  66. package/dist/components/layout/toc-clerk.js +76 -0
  67. package/dist/components/layout/toc-popover.d.ts +8 -0
  68. package/dist/components/layout/toc-popover.d.ts.map +1 -0
  69. package/dist/components/layout/toc-popover.js +20 -0
  70. package/dist/components/layout/toc-thumb.d.ts +6 -0
  71. package/dist/components/layout/toc-thumb.d.ts.map +1 -0
  72. package/dist/components/layout/toc-thumb.js +53 -0
  73. package/dist/components/layout/toc.d.ts +19 -0
  74. package/dist/components/layout/toc.d.ts.map +1 -0
  75. package/dist/components/layout/toc.js +25 -0
  76. package/dist/components/registry.d.ts +3 -0
  77. package/dist/components/registry.d.ts.map +1 -0
  78. package/dist/components/registry.js +70 -0
  79. package/dist/components/steps.d.ts +4 -6
  80. package/dist/components/steps.d.ts.map +1 -0
  81. package/dist/components/steps.js +5 -16
  82. package/dist/components/tabs.d.ts +7 -21
  83. package/dist/components/tabs.d.ts.map +1 -0
  84. package/dist/components/tabs.js +61 -171
  85. package/dist/components/type-table.d.ts +5 -6
  86. package/dist/components/type-table.d.ts.map +1 -0
  87. package/dist/components/type-table.js +18 -59
  88. package/dist/components/ui/button.d.ts +5 -0
  89. package/dist/components/ui/button.d.ts.map +1 -0
  90. package/dist/components/ui/button.js +14 -0
  91. package/dist/components/ui/collapsible.d.ts +6 -0
  92. package/dist/components/ui/collapsible.d.ts.map +1 -0
  93. package/dist/components/ui/collapsible.js +12 -0
  94. package/dist/components/ui/navigation-menu.d.ts +11 -0
  95. package/dist/components/ui/navigation-menu.d.ts.map +1 -0
  96. package/dist/components/ui/navigation-menu.js +15 -0
  97. package/dist/components/ui/popover.d.ts +8 -0
  98. package/dist/components/ui/popover.d.ts.map +1 -0
  99. package/dist/components/ui/popover.js +11 -0
  100. package/dist/components/ui/scroll-area.d.ts +7 -0
  101. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  102. package/dist/components/ui/scroll-area.js +11 -0
  103. package/dist/components/ui/tabs.d.ts +8 -0
  104. package/dist/components/ui/tabs.d.ts.map +1 -0
  105. package/dist/components/ui/tabs.js +16 -0
  106. package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
  107. package/dist/contexts/i18n.d.ts.map +1 -0
  108. package/dist/contexts/i18n.js +23 -0
  109. package/dist/contexts/search.d.ts +50 -0
  110. package/dist/contexts/search.d.ts.map +1 -0
  111. package/dist/contexts/search.js +50 -0
  112. package/dist/contexts/sidebar.d.ts +18 -0
  113. package/dist/contexts/sidebar.d.ts.map +1 -0
  114. package/dist/contexts/sidebar.js +31 -0
  115. package/dist/contexts/tree.d.ts +13 -0
  116. package/dist/contexts/tree.d.ts.map +1 -0
  117. package/dist/contexts/tree.js +25 -0
  118. package/dist/i18n.d.ts +5 -6
  119. package/dist/i18n.d.ts.map +1 -0
  120. package/dist/i18n.js +31 -49
  121. package/dist/layouts/docs/navbar.d.ts +4 -0
  122. package/dist/layouts/docs/navbar.d.ts.map +1 -0
  123. package/dist/layouts/docs/navbar.js +22 -0
  124. package/dist/layouts/docs/sidebar.d.ts +40 -0
  125. package/dist/layouts/docs/sidebar.d.ts.map +1 -0
  126. package/dist/layouts/docs/sidebar.js +146 -0
  127. package/dist/layouts/docs.client.d.ts +14 -25
  128. package/dist/layouts/docs.client.d.ts.map +1 -0
  129. package/dist/layouts/docs.client.js +53 -195
  130. package/dist/layouts/docs.d.ts +34 -19
  131. package/dist/layouts/docs.d.ts.map +1 -0
  132. package/dist/layouts/docs.js +67 -202
  133. package/dist/layouts/home/menu.d.ts +6 -0
  134. package/dist/layouts/home/menu.d.ts.map +1 -0
  135. package/dist/layouts/home/menu.js +33 -0
  136. package/dist/layouts/home/navbar.d.ts +16 -0
  137. package/dist/layouts/home/navbar.d.ts.map +1 -0
  138. package/dist/layouts/home/navbar.js +48 -0
  139. package/dist/layouts/home.d.ts +5 -7
  140. package/dist/layouts/home.d.ts.map +1 -0
  141. package/dist/layouts/home.js +51 -59
  142. package/dist/layouts/links.d.ts +80 -0
  143. package/dist/layouts/links.d.ts.map +1 -0
  144. package/dist/layouts/links.js +14 -0
  145. package/dist/layouts/shared.d.ts +48 -2
  146. package/dist/layouts/shared.d.ts.map +1 -0
  147. package/dist/layouts/shared.js +27 -9
  148. package/dist/mdx.client.d.ts +3 -6
  149. package/dist/mdx.client.d.ts.map +1 -0
  150. package/dist/mdx.client.js +12 -19
  151. package/dist/mdx.d.ts +18 -20
  152. package/dist/mdx.d.ts.map +1 -0
  153. package/dist/mdx.js +47 -56
  154. package/dist/og.d.ts +6 -7
  155. package/dist/og.d.ts.map +1 -0
  156. package/dist/og.js +43 -102
  157. package/dist/page.client.d.ts +8 -41
  158. package/dist/page.client.d.ts.map +1 -0
  159. package/dist/page.client.js +71 -261
  160. package/dist/page.d.ts +28 -30
  161. package/dist/page.d.ts.map +1 -0
  162. package/dist/page.js +80 -168
  163. package/dist/provider.d.ts +12 -72
  164. package/dist/provider.d.ts.map +1 -0
  165. package/dist/provider.js +19 -55
  166. package/dist/style.css +1 -1
  167. package/dist/tailwind-plugin.d.ts +9 -20
  168. package/dist/tailwind-plugin.d.ts.map +1 -0
  169. package/dist/tailwind-plugin.js +191 -699
  170. package/dist/theme/animations.d.ts +170 -0
  171. package/dist/theme/animations.d.ts.map +1 -0
  172. package/dist/theme/animations.js +95 -0
  173. package/dist/theme/colors.d.ts +11 -0
  174. package/dist/theme/colors.d.ts.map +1 -0
  175. package/dist/theme/colors.js +327 -0
  176. package/dist/theme/typography.d.ts +70 -0
  177. package/dist/theme/typography.d.ts.map +1 -0
  178. package/dist/theme/typography.js +71 -0
  179. package/dist/utils/cn.d.ts +2 -0
  180. package/dist/utils/cn.d.ts.map +1 -0
  181. package/dist/utils/cn.js +1 -0
  182. package/dist/utils/get-sidebar-tabs.d.ts +7 -0
  183. package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
  184. package/dist/utils/get-sidebar-tabs.js +20 -0
  185. package/dist/utils/is-active.d.ts +2 -0
  186. package/dist/utils/is-active.d.ts.map +1 -0
  187. package/dist/utils/is-active.js +3 -0
  188. package/dist/utils/use-copy-button.d.ts +3 -0
  189. package/dist/utils/use-copy-button.d.ts.map +1 -0
  190. package/dist/utils/use-copy-button.js +25 -0
  191. package/package.json +9 -9
  192. package/dist/chunk-27HFSL7N.js +0 -53
  193. package/dist/chunk-2FLZOPQN.js +0 -54
  194. package/dist/chunk-2KMKNVSN.js +0 -29
  195. package/dist/chunk-45REPLUI.js +0 -259
  196. package/dist/chunk-5KVEK5A7.js +0 -139
  197. package/dist/chunk-5QPVK7QM.js +0 -542
  198. package/dist/chunk-CDPVENXR.js +0 -8
  199. package/dist/chunk-CPGKWLLV.js +0 -43
  200. package/dist/chunk-DGKCMOIC.js +0 -56
  201. package/dist/chunk-DN6Z5VW6.js +0 -61
  202. package/dist/chunk-E3VO2QQT.js +0 -29
  203. package/dist/chunk-EFMHXXHW.js +0 -24
  204. package/dist/chunk-ET4TW6M5.js +0 -70
  205. package/dist/chunk-GHOAONNQ.js +0 -48
  206. package/dist/chunk-IHIFNFRB.js +0 -38
  207. package/dist/chunk-IVBHRX3O.js +0 -31
  208. package/dist/chunk-JUOW3DZK.js +0 -212
  209. package/dist/chunk-KZTWSBYY.js +0 -68
  210. package/dist/chunk-MCX7E6ZW.js +0 -57
  211. package/dist/chunk-MLKGABMK.js +0 -9
  212. package/dist/chunk-PZTQPB4U.js +0 -125
  213. package/dist/chunk-QKOA6KEZ.js +0 -22
  214. package/dist/chunk-TK3TM3MR.js +0 -6
  215. package/dist/chunk-TQJ6YPJ3.js +0 -31
  216. package/dist/chunk-V6RONFCQ.js +0 -69
  217. package/dist/chunk-WRBUXI2A.js +0 -82
  218. package/dist/chunk-YL3MZH7N.js +0 -66
  219. package/dist/components/api.client.d.ts +0 -5
  220. package/dist/components/api.client.js +0 -8
  221. package/dist/dynamic-sidebar-MEINO4E2.js +0 -129
  222. package/dist/edit-on-github-PCTRDRD6.js +0 -49
  223. package/dist/layouts/home.client.d.ts +0 -11
  224. package/dist/layouts/home.client.js +0 -274
  225. package/dist/shared-SScCiV7b.d.ts +0 -152
  226. package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
  227. package/dist/tag-list-BsEgfE3x.d.ts +0 -6
  228. package/dist/toc-clerk-SKE4LBT7.js +0 -158
  229. package/dist/tree-06ley65N.d.ts +0 -21
@@ -0,0 +1,71 @@
1
+ export const typography = {
2
+ css: {
3
+ '--tw-prose-body': `theme('colors.fd-foreground / 90%')`,
4
+ '--tw-prose-headings': `theme('colors.fd-foreground')`,
5
+ '--tw-prose-lead': `theme('colors.fd-foreground')`,
6
+ '--tw-prose-links': `theme('colors.fd-foreground')`,
7
+ '--tw-prose-bold': `theme('colors.fd-foreground')`,
8
+ '--tw-prose-counters': `theme('colors.fd-muted.foreground')`,
9
+ '--tw-prose-bullets': `theme('colors.fd-muted.foreground')`,
10
+ '--tw-prose-hr': `theme('colors.fd-border')`,
11
+ '--tw-prose-quotes': `theme('colors.fd-foreground')`,
12
+ '--tw-prose-quote-borders': `theme('colors.fd-border')`,
13
+ '--tw-prose-captions': `theme('colors.fd-foreground')`,
14
+ '--tw-prose-code': `theme('colors.fd-foreground')`,
15
+ '--tw-prose-th-borders': `theme('colors.fd-border')`,
16
+ '--tw-prose-td-borders': `theme('colors.fd-border')`,
17
+ '--tw-prose-kbd': `theme('colors.fd-foreground')`,
18
+ '--tw-prose-kbd-shadows': `theme('colors.fd-primary.DEFAULT / 50%')`,
19
+ // not used
20
+ '--tw-prose-pre-bg': false,
21
+ '--tw-prose-pre-code': false,
22
+ fontSize: '16px',
23
+ maxWidth: 'none',
24
+ a: false,
25
+ 'a:hover': false,
26
+ 'a:not([data-card])': {
27
+ color: 'var(--tw-prose-links)',
28
+ transition: 'opacity 0.3s',
29
+ fontWeight: '400',
30
+ textDecoration: 'underline',
31
+ textUnderlineOffset: '2px',
32
+ textDecorationColor: `theme('colors.fd-primary.DEFAULT')`,
33
+ },
34
+ 'a:not([data-card]):hover': {
35
+ opacity: '80%',
36
+ },
37
+ table: {
38
+ fontSize: '14px',
39
+ },
40
+ 'thead th': {
41
+ textAlign: 'start',
42
+ },
43
+ h2: {
44
+ fontWeight: '600',
45
+ },
46
+ code: {
47
+ padding: '3px',
48
+ border: 'solid 1px',
49
+ fontSize: '13px',
50
+ borderColor: `theme('colors.fd-border')`,
51
+ borderRadius: '5px',
52
+ fontWeight: '400',
53
+ background: `theme('colors.fd-muted.DEFAULT')`,
54
+ },
55
+ kbd: {
56
+ boxShadow: '0 0 0 1px var(--tw-prose-kbd-shadows),0 3px 0 var(--tw-prose-kbd-shadows)',
57
+ },
58
+ ul: {
59
+ paddingInlineStart: '1rem',
60
+ },
61
+ 'ul > li': {
62
+ paddingInlineStart: '0',
63
+ },
64
+ // Disabled styles, handled by Fumadocs UI
65
+ 'pre code': false,
66
+ 'pre code::after': false,
67
+ 'pre code::before': false,
68
+ 'code::after': false,
69
+ 'code::before': false,
70
+ },
71
+ };
@@ -0,0 +1,2 @@
1
+ export { twMerge as cn } from 'tailwind-merge';
2
+ //# sourceMappingURL=cn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ export { twMerge as cn } from 'tailwind-merge';
@@ -0,0 +1,7 @@
1
+ import type { PageTree } from 'fumadocs-core/server';
2
+ import type { Option } from '../components/layout/root-toggle';
3
+ export interface TabOptions {
4
+ transform?: (option: Option, node: PageTree.Folder) => Option | null;
5
+ }
6
+ export declare function getSidebarTabs(pageTree: PageTree.Root, { transform }?: TabOptions): Option[];
7
+ //# sourceMappingURL=get-sidebar-tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-sidebar-tabs.d.ts","sourceRoot":"","sources":["../../src/utils/get-sidebar-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACtE;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,EACvB,EAAE,SAAS,EAAE,GAAE,UAAe,GAC7B,MAAM,EAAE,CAqBV"}
@@ -0,0 +1,20 @@
1
+ export function getSidebarTabs(pageTree, { transform } = {}) {
2
+ const options = [];
3
+ function traverse(node) {
4
+ if (node.type === 'folder' && node.root && node.index) {
5
+ const option = {
6
+ url: node.index.url,
7
+ title: node.name,
8
+ icon: node.icon,
9
+ description: node.description,
10
+ };
11
+ const mapped = transform ? transform(option, node) : option;
12
+ if (mapped)
13
+ options.push(mapped);
14
+ }
15
+ if (node.type === 'folder')
16
+ node.children.forEach(traverse);
17
+ }
18
+ pageTree.children.forEach(traverse);
19
+ return options;
20
+ }
@@ -0,0 +1,2 @@
1
+ export declare function isActive(url: string, pathname: string, nested?: boolean): boolean;
2
+ //# sourceMappingURL=is-active.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAET"}
@@ -0,0 +1,3 @@
1
+ export function isActive(url, pathname, nested = true) {
2
+ return url === pathname || (nested && pathname.startsWith(`${url}/`));
3
+ }
@@ -0,0 +1,3 @@
1
+ import { type MouseEventHandler } from 'react';
2
+ export declare function useCopyButton(onCopy: () => void): [checked: boolean, onClick: MouseEventHandler];
3
+ //# sourceMappingURL=use-copy-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-copy-button.d.ts","sourceRoot":"","sources":["../../src/utils/use-copy-button.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,IAAI,GACjB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAuBhD"}
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { useState, useRef, useEffect, useCallback, } from 'react';
3
+ export function useCopyButton(onCopy) {
4
+ const [checked, setChecked] = useState(false);
5
+ const timeoutRef = useRef(null);
6
+ const callbackRef = useRef(onCopy);
7
+ callbackRef.current = onCopy;
8
+ const onClick = useCallback(() => {
9
+ if (timeoutRef.current)
10
+ window.clearTimeout(timeoutRef.current);
11
+ timeoutRef.current = window.setTimeout(() => {
12
+ setChecked(false);
13
+ }, 1500);
14
+ callbackRef.current();
15
+ setChecked(true);
16
+ }, []);
17
+ // Avoid updates after being unmounted
18
+ useEffect(() => {
19
+ return () => {
20
+ if (timeoutRef.current)
21
+ window.clearTimeout(timeoutRef.current);
22
+ };
23
+ }, []);
24
+ return [checked, onClick];
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -63,21 +63,22 @@
63
63
  "@radix-ui/react-tabs": "^1.1.1",
64
64
  "@tailwindcss/typography": "^0.5.15",
65
65
  "class-variance-authority": "^0.7.0",
66
- "next-themes": "^0.3.0",
66
+ "lucide-react": "^0.455.0",
67
+ "next-themes": "^0.4.3",
67
68
  "react-medium-image-zoom": "^5.2.10",
68
69
  "tailwind-merge": "^2.5.4",
69
- "fumadocs-core": "14.2.0"
70
+ "fumadocs-core": "14.3.0"
70
71
  },
71
72
  "devDependencies": {
72
- "@next/eslint-plugin-next": "^15.0.1",
73
+ "@next/eslint-plugin-next": "^15.0.3",
73
74
  "@types/react": "^18.3.12",
74
75
  "@types/react-dom": "^18.3.1",
75
- "lucide-react": "^0.453.0",
76
- "next": "15.0.2",
76
+ "next": "15.0.3",
77
77
  "postcss": "^8.4.47",
78
78
  "postcss-cli": "^11.0.0",
79
79
  "postcss-lightningcss": "^1.0.1",
80
80
  "tailwindcss": "^3.4.13",
81
+ "tsc-alias": "^1.8.10",
81
82
  "@fumadocs/cli": "0.0.3",
82
83
  "eslint-config-custom": "0.0.0",
83
84
  "tsconfig": "0.0.0"
@@ -98,11 +99,10 @@
98
99
  },
99
100
  "scripts": {
100
101
  "build": "pnpm build:layout && pnpm build:tailwind",
101
- "build:layout": "tsup",
102
+ "build:layout": "tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",
102
103
  "build:tailwind": "postcss css/*.css --dir dist && postcss src/components/*.css --dir dist/components",
103
104
  "clean": "rimraf dist",
104
- "dev": "concurrently \"pnpm dev:layout\" \"pnpm dev:tailwind\"",
105
- "dev:layout": "tsup --watch",
105
+ "dev": "concurrently \"tsc -w --project tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\" \"pnpm dev:tailwind\"",
106
106
  "dev:tailwind": "postcss css/*.css --dir dist --watch",
107
107
  "lint": "eslint .",
108
108
  "types:check": "tsc --noEmit"
@@ -1,53 +0,0 @@
1
- // src/contexts/sidebar.tsx
2
- import {
3
- createContext,
4
- useContext,
5
- useState,
6
- useMemo,
7
- useRef
8
- } from "react";
9
- import { usePathname } from "next/navigation";
10
- import { SidebarProvider as BaseProvider } from "fumadocs-core/sidebar";
11
- import { useOnChange } from "fumadocs-core/utils/use-on-change";
12
- import { jsx } from "react/jsx-runtime";
13
- var SidebarContext = createContext(void 0);
14
- function useSidebar() {
15
- const ctx = useContext(SidebarContext);
16
- if (!ctx) throw new Error("Missing root provider");
17
- return ctx;
18
- }
19
- function SidebarProvider({
20
- children
21
- }) {
22
- const closeOnRedirect = useRef(true);
23
- const [open, setOpen] = useState(false);
24
- const [collapsed, setCollapsed] = useState(false);
25
- const pathname = usePathname();
26
- useOnChange(pathname, () => {
27
- if (closeOnRedirect.current) {
28
- setOpen(false);
29
- }
30
- closeOnRedirect.current = true;
31
- });
32
- return /* @__PURE__ */ jsx(
33
- SidebarContext.Provider,
34
- {
35
- value: useMemo(
36
- () => ({
37
- open,
38
- setOpen,
39
- collapsed,
40
- setCollapsed,
41
- closeOnRedirect
42
- }),
43
- [open, collapsed]
44
- ),
45
- children: /* @__PURE__ */ jsx(BaseProvider, { open, onOpenChange: setOpen, children })
46
- }
47
- );
48
- }
49
-
50
- export {
51
- useSidebar,
52
- SidebarProvider
53
- };
@@ -1,54 +0,0 @@
1
- import {
2
- twMerge
3
- } from "./chunk-TK3TM3MR.js";
4
-
5
- // src/components/ui/scroll-area.tsx
6
- import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
7
- import * as React from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
10
- ScrollAreaPrimitive.Root,
11
- {
12
- ref,
13
- className: twMerge("overflow-hidden", className),
14
- ...props,
15
- children: [
16
- children,
17
- /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {}),
18
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
19
- ]
20
- }
21
- ));
22
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
23
- var ScrollViewport = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
24
- ScrollAreaPrimitive.Viewport,
25
- {
26
- ref,
27
- className: twMerge("size-full rounded-[inherit]", className),
28
- ...props,
29
- children
30
- }
31
- ));
32
- ScrollViewport.displayName = ScrollAreaPrimitive.Viewport.displayName;
33
- var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
34
- ScrollAreaPrimitive.Scrollbar,
35
- {
36
- ref,
37
- orientation,
38
- className: twMerge(
39
- "flex select-none data-[state=hidden]:animate-fd-fade-out",
40
- orientation === "vertical" && "h-full w-1.5",
41
- orientation === "horizontal" && "h-1.5 flex-col",
42
- className
43
- ),
44
- ...props,
45
- children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-fd-border" })
46
- }
47
- ));
48
- ScrollBar.displayName = ScrollAreaPrimitive.Scrollbar.displayName;
49
-
50
- export {
51
- ScrollArea,
52
- ScrollViewport,
53
- ScrollBar
54
- };
@@ -1,29 +0,0 @@
1
- // src/utils/use-copy-button.ts
2
- import {
3
- useState,
4
- useRef,
5
- useEffect,
6
- useCallback
7
- } from "react";
8
- function useCopyButton(onCopy) {
9
- const [checked, setChecked] = useState(false);
10
- const timeoutRef = useRef(null);
11
- const onClick = useCallback(() => {
12
- if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
13
- timeoutRef.current = window.setTimeout(() => {
14
- setChecked(false);
15
- }, 1500);
16
- onCopy();
17
- setChecked(true);
18
- }, [onCopy]);
19
- useEffect(() => {
20
- return () => {
21
- if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
22
- };
23
- }, []);
24
- return [checked, onClick];
25
- }
26
-
27
- export {
28
- useCopyButton
29
- };
@@ -1,259 +0,0 @@
1
- import {
2
- buttonVariants
3
- } from "./chunk-QKOA6KEZ.js";
4
- import {
5
- FileText,
6
- Hash,
7
- LoaderCircle,
8
- Search,
9
- Text
10
- } from "./chunk-5QPVK7QM.js";
11
- import {
12
- twMerge
13
- } from "./chunk-TK3TM3MR.js";
14
- import {
15
- useSearchContext
16
- } from "./chunk-ET4TW6M5.js";
17
- import {
18
- useSidebar
19
- } from "./chunk-27HFSL7N.js";
20
- import {
21
- useI18n
22
- } from "./chunk-EFMHXXHW.js";
23
-
24
- // src/components/dialog/search.tsx
25
- import { useRouter } from "next/navigation";
26
- import {
27
- useMemo,
28
- useEffect,
29
- useState,
30
- useRef
31
- } from "react";
32
- import {
33
- Dialog,
34
- DialogContent,
35
- DialogOverlay,
36
- DialogTitle
37
- } from "@radix-ui/react-dialog";
38
- import { jsx, jsxs } from "react/jsx-runtime";
39
- function SearchDialog({
40
- open,
41
- onOpenChange,
42
- footer,
43
- links = [],
44
- ...props
45
- }) {
46
- const { text } = useI18n();
47
- const defaultItems = useMemo(
48
- () => links.map(([name, link]) => ({
49
- type: "page",
50
- id: name,
51
- content: name,
52
- url: link
53
- })),
54
- [links]
55
- );
56
- return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange, children: [
57
- /* @__PURE__ */ jsx(DialogOverlay, { className: "fixed inset-0 z-50 bg-fd-background/50 backdrop-blur-sm data-[state=closed]:animate-fd-fade-out data-[state=open]:animate-fd-fade-in" }),
58
- /* @__PURE__ */ jsxs(
59
- DialogContent,
60
- {
61
- "aria-describedby": text.search,
62
- className: "fixed left-1/2 top-[10vh] z-50 w-[98vw] max-w-screen-sm origin-left -translate-x-1/2 rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-lg data-[state=closed]:animate-fd-dialog-out data-[state=open]:animate-fd-dialog-in",
63
- children: [
64
- /* @__PURE__ */ jsx(DialogTitle, { className: "hidden", children: text.search }),
65
- /* @__PURE__ */ jsx(
66
- SearchInput,
67
- {
68
- search: props.search,
69
- onSearchChange: props.onSearchChange,
70
- isLoading: props.isLoading
71
- }
72
- ),
73
- /* @__PURE__ */ jsx(
74
- SearchList,
75
- {
76
- items: props.results === "empty" ? defaultItems : props.results,
77
- hideResults: props.results === "empty" && defaultItems.length === 0
78
- }
79
- ),
80
- footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col border-t p-3", children: footer }) : null
81
- ]
82
- }
83
- )
84
- ] });
85
- }
86
- var icons = {
87
- text: /* @__PURE__ */ jsx(Text, { className: "size-4 text-fd-muted-foreground" }),
88
- heading: /* @__PURE__ */ jsx(Hash, { className: "size-4 text-fd-muted-foreground" }),
89
- page: /* @__PURE__ */ jsx(FileText, { className: "size-4 text-fd-muted-foreground" })
90
- };
91
- function SearchInput({ search, onSearchChange, isLoading }) {
92
- const { text } = useI18n();
93
- const { setOpenSearch } = useSearchContext();
94
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 px-3", children: [
95
- /* @__PURE__ */ jsx(LoadingIndicator, { isLoading: isLoading ?? false }),
96
- /* @__PURE__ */ jsx(
97
- "input",
98
- {
99
- value: search,
100
- onChange: (e) => {
101
- onSearchChange(e.target.value);
102
- },
103
- placeholder: text.search,
104
- className: "w-0 flex-1 bg-transparent py-3 text-base placeholder:text-fd-muted-foreground focus-visible:outline-none"
105
- }
106
- ),
107
- /* @__PURE__ */ jsx(
108
- "button",
109
- {
110
- type: "button",
111
- "aria-label": "Close Search",
112
- onClick: () => {
113
- setOpenSearch(false);
114
- },
115
- className: twMerge(
116
- buttonVariants({
117
- color: "outline",
118
- className: "text-xs p-1.5"
119
- })
120
- ),
121
- children: "Esc"
122
- }
123
- )
124
- ] });
125
- }
126
- function SearchList({ items, hideResults = false }) {
127
- const [active, setActive] = useState();
128
- const { text } = useI18n();
129
- const router = useRouter();
130
- const sidebar = useSidebar();
131
- const { setOpenSearch } = useSearchContext();
132
- if (items.length > 0 && (!active || items.every((item) => item.id !== active))) {
133
- setActive(items[0].id);
134
- }
135
- const listenerRef = useRef();
136
- listenerRef.current = (e) => {
137
- if (e.key === "ArrowDown" || e.key == "ArrowUp") {
138
- setActive((cur) => {
139
- const idx = items.findIndex((item) => item.id === cur);
140
- if (idx === -1) return items.at(0)?.id;
141
- return items.at(
142
- (e.key === "ArrowDown" ? idx + 1 : idx - 1) % items.length
143
- )?.id;
144
- });
145
- e.preventDefault();
146
- }
147
- if (e.key === "Enter") {
148
- const selected = items.find((item) => item.id === active);
149
- if (selected) onOpen(selected.url);
150
- e.preventDefault();
151
- }
152
- };
153
- useEffect(() => {
154
- const listener = (e) => {
155
- listenerRef.current?.(e);
156
- };
157
- window.addEventListener("keydown", listener);
158
- return () => {
159
- window.removeEventListener("keydown", listener);
160
- };
161
- }, []);
162
- const onOpen = (url) => {
163
- router.push(url);
164
- setOpenSearch(false);
165
- sidebar.setOpen(false);
166
- };
167
- return /* @__PURE__ */ jsxs(
168
- "div",
169
- {
170
- className: twMerge(
171
- "flex max-h-[460px] flex-col overflow-y-auto border-t p-2",
172
- hideResults && "hidden"
173
- ),
174
- children: [
175
- items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-12 text-center text-sm", children: text.searchNoResult }) : null,
176
- items.map((item) => /* @__PURE__ */ jsxs(
177
- CommandItem,
178
- {
179
- value: item.id,
180
- active,
181
- onActiveChange: setActive,
182
- onClick: () => {
183
- onOpen(item.url);
184
- },
185
- children: [
186
- item.type !== "page" ? /* @__PURE__ */ jsx(
187
- "div",
188
- {
189
- role: "none",
190
- className: "ms-2 h-full min-h-10 w-px bg-fd-border"
191
- }
192
- ) : null,
193
- icons[item.type],
194
- /* @__PURE__ */ jsx("p", { className: "w-0 flex-1 truncate", children: item.content })
195
- ]
196
- },
197
- item.id
198
- ))
199
- ]
200
- }
201
- );
202
- }
203
- function LoadingIndicator({ isLoading }) {
204
- return /* @__PURE__ */ jsxs("div", { className: "relative size-4", children: [
205
- /* @__PURE__ */ jsx(
206
- LoaderCircle,
207
- {
208
- className: twMerge(
209
- "absolute size-full animate-spin text-fd-primary transition-opacity",
210
- !isLoading && "opacity-0"
211
- )
212
- }
213
- ),
214
- /* @__PURE__ */ jsx(
215
- Search,
216
- {
217
- className: twMerge(
218
- "absolute size-full text-fd-muted-foreground transition-opacity",
219
- isLoading && "opacity-0"
220
- )
221
- }
222
- )
223
- ] });
224
- }
225
- function CommandItem({
226
- active,
227
- onActiveChange,
228
- value,
229
- ...props
230
- }) {
231
- const ref = useRef(null);
232
- useEffect(() => {
233
- const element = ref.current;
234
- if (active === value && element) {
235
- element.scrollIntoView({
236
- block: "nearest"
237
- });
238
- }
239
- }, [active, value]);
240
- return /* @__PURE__ */ jsx(
241
- "button",
242
- {
243
- ref,
244
- type: "button",
245
- "aria-selected": active === value,
246
- onPointerMove: () => onActiveChange(value),
247
- ...props,
248
- className: twMerge(
249
- "flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-fd-accent aria-selected:text-fd-accent-foreground",
250
- props.className
251
- ),
252
- children: props.children
253
- }
254
- );
255
- }
256
-
257
- export {
258
- SearchDialog
259
- };