fumadocs-ui 13.4.10 → 14.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.
- package/dist/{chunk-774JT2B6.js → chunk-5KVEK5A7.js} +11 -8
- package/dist/chunk-5QPVK7QM.js +542 -0
- package/dist/chunk-BN7HGCQ4.js +212 -0
- package/dist/chunk-CDPVENXR.js +8 -0
- package/dist/{chunk-KWZZNVSY.js → chunk-CPGKWLLV.js} +7 -3
- package/dist/chunk-DN6Z5VW6.js +61 -0
- package/dist/{chunk-HOIRMHZT.js → chunk-E3VO2QQT.js} +10 -2
- package/dist/chunk-GHOAONNQ.js +48 -0
- package/dist/{chunk-ERUVE5R6.js → chunk-IHIFNFRB.js} +4 -2
- package/dist/{chunk-CP67AHDD.js → chunk-IVBHRX3O.js} +1 -1
- package/dist/{chunk-NSEJBI4V.js → chunk-KZTWSBYY.js} +28 -16
- package/dist/chunk-MCX7E6ZW.js +57 -0
- package/dist/chunk-PZTQPB4U.js +125 -0
- package/dist/{chunk-EDNTYBXS.js → chunk-QKOA6KEZ.js} +2 -17
- package/dist/{chunk-YIOV4KEY.js → chunk-TYZZJ335.js} +26 -16
- package/dist/chunk-V6RONFCQ.js +69 -0
- package/dist/chunk-WRBUXI2A.js +82 -0
- package/dist/chunk-YL3MZH7N.js +66 -0
- package/dist/components/accordion.js +7 -3
- package/dist/components/api.d.ts +2 -5
- package/dist/components/api.js +2 -4
- package/dist/components/banner.js +5 -6
- package/dist/components/callout.js +2 -1
- package/dist/components/card.d.ts +6 -5
- package/dist/components/card.js +1 -1
- package/dist/components/codeblock.js +4 -3
- package/dist/components/dialog/search-algolia.d.ts +10 -4
- package/dist/components/dialog/search-algolia.js +25 -15
- package/dist/components/dialog/search-default.d.ts +10 -6
- package/dist/components/dialog/search-default.js +27 -5
- package/dist/components/dialog/search.d.ts +7 -7
- package/dist/components/dialog/search.js +4 -3
- package/dist/components/files.js +15 -11
- package/dist/components/heading.js +2 -1
- package/dist/components/image-zoom.js +8 -5
- package/dist/components/inline-toc.js +3 -1
- package/dist/components/layout/language-toggle.d.ts +4 -3
- package/dist/components/layout/language-toggle.js +8 -6
- package/dist/components/layout/root-toggle.d.ts +3 -3
- package/dist/components/layout/root-toggle.js +7 -73
- package/dist/components/tabs.js +30 -13
- package/dist/components/type-table.d.ts +7 -5
- package/dist/components/type-table.js +11 -11
- package/dist/dynamic-sidebar-QWGMOUMS.js +129 -0
- package/dist/{edit-on-github-YFVYCMB7.js → edit-on-github-PCTRDRD6.js} +10 -8
- package/dist/layouts/docs.client.d.ts +27 -0
- package/dist/layouts/docs.client.js +200 -0
- package/dist/layouts/docs.d.ts +30 -0
- package/dist/layouts/docs.js +207 -0
- package/dist/layouts/home.client.d.ts +11 -0
- package/dist/layouts/home.client.js +274 -0
- package/dist/layouts/home.d.ts +7 -0
- package/dist/layouts/home.js +61 -0
- package/dist/layouts/shared.d.ts +2 -0
- package/dist/layouts/shared.js +9 -0
- package/dist/mdx.client.js +4 -3
- package/dist/mdx.d.ts +1 -2
- package/dist/mdx.js +8 -10
- package/dist/og.d.ts +1 -7
- package/dist/og.js +5 -15
- package/dist/page.client.d.ts +2 -1
- package/dist/page.client.js +91 -63
- package/dist/page.d.ts +7 -6
- package/dist/page.js +78 -62
- package/dist/provider.d.ts +1 -2
- package/dist/provider.js +3 -4
- package/dist/shared-SScCiV7b.d.ts +152 -0
- package/dist/{sidebar-DwBSl7jC.d.ts → sidebar-CQ4HmzQl.d.ts} +8 -9
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.js +86 -39
- package/dist/{toc-clerk-CAID2WGC.js → toc-clerk-SKE4LBT7.js} +40 -50
- package/dist/{tree-CrKzI9Nz.d.ts → tree-06ley65N.d.ts} +9 -3
- package/package.json +32 -68
- package/dist/chunk-KCZRDPB4.js +0 -308
- package/dist/chunk-LSTPTAZ5.js +0 -58
- package/dist/chunk-P4HLRHHV.js +0 -36
- package/dist/chunk-UOD2T27N.js +0 -27
- package/dist/chunk-WLTWFYQA.js +0 -44
- package/dist/docs-layout.client.d.ts +0 -18
- package/dist/docs-layout.client.js +0 -406
- package/dist/home-layout.client.d.ts +0 -9
- package/dist/home-layout.client.js +0 -88
- package/dist/home-layout.d.ts +0 -7
- package/dist/home-layout.js +0 -30
- package/dist/layout.d.ts +0 -19
- package/dist/layout.js +0 -127
- package/dist/layout.shared-DEQFTB9M.d.ts +0 -117
- package/dist/twoslash/popup.d.ts +0 -11
- package/dist/twoslash/popup.js +0 -97
- package/dist/twoslash.css +0 -1
- /package/dist/{image-zoom.css → components/image-zoom.css} +0 -0
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
TocThumb
|
|
4
|
+
} from "./chunk-DN6Z5VW6.js";
|
|
5
5
|
import {
|
|
6
6
|
ScrollArea,
|
|
7
7
|
ScrollViewport
|
|
8
8
|
} from "./chunk-2FLZOPQN.js";
|
|
9
|
-
import {
|
|
10
|
-
useI18n
|
|
11
|
-
} from "./chunk-EFMHXXHW.js";
|
|
12
9
|
import {
|
|
13
10
|
twMerge
|
|
14
11
|
} from "./chunk-TK3TM3MR.js";
|
|
12
|
+
import {
|
|
13
|
+
useI18n
|
|
14
|
+
} from "./chunk-EFMHXXHW.js";
|
|
15
15
|
import "./chunk-MLKGABMK.js";
|
|
16
16
|
|
|
17
17
|
// src/components/layout/toc-clerk.tsx
|
|
18
18
|
import * as Primitive from "fumadocs-core/toc";
|
|
19
|
-
import {
|
|
19
|
+
import { useEffect, useRef, useState } from "react";
|
|
20
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
21
|
function ClerkTOCItems({
|
|
22
22
|
items,
|
|
23
23
|
isMenu = false
|
|
24
24
|
}) {
|
|
25
25
|
const { text } = useI18n();
|
|
26
|
+
const viewRef = useRef(null);
|
|
26
27
|
const containerRef = useRef(null);
|
|
27
|
-
const pos = useTocThumb(containerRef);
|
|
28
28
|
const [svg, setSvg] = useState();
|
|
29
|
-
|
|
29
|
+
useEffect(() => {
|
|
30
30
|
if (!containerRef.current) return;
|
|
31
31
|
const container = containerRef.current;
|
|
32
32
|
function onResize() {
|
|
@@ -60,48 +60,38 @@ function ClerkTOCItems({
|
|
|
60
60
|
}, [items]);
|
|
61
61
|
if (items.length === 0)
|
|
62
62
|
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings });
|
|
63
|
-
return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", isMenu && "-ms-3"), children: /* @__PURE__ */ jsxs(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", isMenu && "-ms-3"), children: /* @__PURE__ */ jsxs(ScrollViewport, { className: "relative min-h-0", ref: viewRef, children: [
|
|
64
|
+
svg ? /* @__PURE__ */ jsx(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: "absolute start-0 top-0 rtl:-scale-x-100",
|
|
68
|
+
style: {
|
|
69
|
+
width: svg.width,
|
|
70
|
+
height: svg.height,
|
|
71
|
+
maskImage: `url("data:image/svg+xml,${// Inline SVG
|
|
72
|
+
encodeURIComponent(
|
|
73
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`
|
|
74
|
+
)}")`
|
|
75
|
+
},
|
|
76
|
+
children: /* @__PURE__ */ jsx(
|
|
77
|
+
TocThumb,
|
|
71
78
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
width: svg.width,
|
|
75
|
-
height: svg.height,
|
|
76
|
-
maskImage: `url("data:image/svg+xml,${// Inline SVG
|
|
77
|
-
encodeURIComponent(
|
|
78
|
-
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`
|
|
79
|
-
)}")`
|
|
80
|
-
},
|
|
81
|
-
children: /* @__PURE__ */ jsx(
|
|
82
|
-
"div",
|
|
83
|
-
{
|
|
84
|
-
className: "bg-fd-primary transition-all",
|
|
85
|
-
style: {
|
|
86
|
-
marginTop: pos[0],
|
|
87
|
-
height: pos[1]
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
)
|
|
79
|
+
containerRef,
|
|
80
|
+
className: "mt-[var(--fd-top)] h-[var(--fd-height)] bg-fd-primary transition-all"
|
|
91
81
|
}
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
) });
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
) : null,
|
|
85
|
+
/* @__PURE__ */ jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", ref: containerRef, children: items.map((item, i) => /* @__PURE__ */ jsx(
|
|
86
|
+
TOCItem2,
|
|
87
|
+
{
|
|
88
|
+
item,
|
|
89
|
+
upper: items[i - 1]?.depth,
|
|
90
|
+
lower: items[i + 1]?.depth
|
|
91
|
+
},
|
|
92
|
+
item.url
|
|
93
|
+
)) }) })
|
|
94
|
+
] }) });
|
|
105
95
|
}
|
|
106
96
|
function getItemOffset(depth) {
|
|
107
97
|
if (depth <= 2) return 16;
|
|
@@ -122,9 +112,9 @@ function TOCItem2({
|
|
|
122
112
|
{
|
|
123
113
|
href: item.url,
|
|
124
114
|
style: {
|
|
125
|
-
paddingInlineStart:
|
|
115
|
+
paddingInlineStart: getItemOffset(item.depth)
|
|
126
116
|
},
|
|
127
|
-
className: "relative py-2 transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
117
|
+
className: "prose relative py-2 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
128
118
|
children: [
|
|
129
119
|
offset !== upperOffset ? /* @__PURE__ */ jsx(
|
|
130
120
|
"svg",
|
|
@@ -2,14 +2,20 @@ import { PageTree } from 'fumadocs-core/server';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface TreeContextType {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The path to the current node
|
|
7
|
+
*/
|
|
8
|
+
path: PageTree.Node[];
|
|
9
|
+
/**
|
|
10
|
+
* Get neighbours of current `pathname`
|
|
11
|
+
*/
|
|
12
|
+
getNeighbours: () => [PageTree.Item | undefined, PageTree.Item | undefined];
|
|
7
13
|
root: PageTree.Root | PageTree.Folder;
|
|
8
14
|
}
|
|
9
15
|
declare function TreeContextProvider({ children, tree, }: {
|
|
10
16
|
tree: PageTree.Root;
|
|
11
17
|
children: ReactNode;
|
|
12
|
-
}):
|
|
18
|
+
}): ReactNode;
|
|
13
19
|
declare function useTreeContext(): TreeContextType;
|
|
14
20
|
|
|
15
21
|
export { TreeContextProvider as T, useTreeContext as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"exports": {
|
|
15
15
|
"./style.css": "./dist/style.css",
|
|
16
|
-
"./twoslash.css": "./dist/twoslash.css",
|
|
17
16
|
"./image-zoom.css": "./dist/image-zoom.css",
|
|
18
17
|
"./tailwind-plugin": {
|
|
19
18
|
"import": "./dist/tailwind-plugin.js",
|
|
@@ -24,21 +23,13 @@
|
|
|
24
23
|
"import": "./dist/components/*.js",
|
|
25
24
|
"types": "./dist/components/*.d.ts"
|
|
26
25
|
},
|
|
27
|
-
"./twoslash/*": {
|
|
28
|
-
"import": "./dist/twoslash/*.js",
|
|
29
|
-
"types": "./dist/twoslash/*.d.ts"
|
|
30
|
-
},
|
|
31
26
|
"./i18n": {
|
|
32
27
|
"import": "./dist/i18n.js",
|
|
33
28
|
"types": "./dist/i18n.d.ts"
|
|
34
29
|
},
|
|
35
|
-
"./
|
|
36
|
-
"import": "./dist/
|
|
37
|
-
"types": "./dist/
|
|
38
|
-
},
|
|
39
|
-
"./home-layout": {
|
|
40
|
-
"import": "./dist/home-layout.js",
|
|
41
|
-
"types": "./dist/home-layout.d.ts"
|
|
30
|
+
"./layouts/*": {
|
|
31
|
+
"import": "./dist/layouts/*.js",
|
|
32
|
+
"types": "./dist/layouts/*.d.ts"
|
|
42
33
|
},
|
|
43
34
|
"./page": {
|
|
44
35
|
"import": "./dist/page.js",
|
|
@@ -57,87 +48,60 @@
|
|
|
57
48
|
"types": "./dist/og.d.ts"
|
|
58
49
|
}
|
|
59
50
|
},
|
|
60
|
-
"typesVersions": {
|
|
61
|
-
"*": {
|
|
62
|
-
"tailwind-plugin": [
|
|
63
|
-
"./dist/tailwind-plugin.d.ts"
|
|
64
|
-
],
|
|
65
|
-
"components/*": [
|
|
66
|
-
"./dist/components/*.d.ts"
|
|
67
|
-
],
|
|
68
|
-
"twoslash/*": [
|
|
69
|
-
"./dist/twoslash/*.d.ts"
|
|
70
|
-
],
|
|
71
|
-
"i18n": [
|
|
72
|
-
"./dist/i18n.d.ts"
|
|
73
|
-
],
|
|
74
|
-
"layout": [
|
|
75
|
-
"./dist/layout.d.ts"
|
|
76
|
-
],
|
|
77
|
-
"home-layout": [
|
|
78
|
-
"./dist/home-layout.d.ts"
|
|
79
|
-
],
|
|
80
|
-
"page": [
|
|
81
|
-
"./dist/page.d.ts"
|
|
82
|
-
],
|
|
83
|
-
"provider": [
|
|
84
|
-
"./dist/provider.d.ts"
|
|
85
|
-
],
|
|
86
|
-
"mdx": [
|
|
87
|
-
"./dist/mdx.d.ts"
|
|
88
|
-
],
|
|
89
|
-
"og": [
|
|
90
|
-
"./dist/og.d.ts"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
51
|
"files": [
|
|
95
52
|
"dist/*"
|
|
96
53
|
],
|
|
97
54
|
"dependencies": {
|
|
98
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
99
|
-
"@radix-ui/react-collapsible": "^1.1.
|
|
100
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
55
|
+
"@radix-ui/react-accordion": "^1.2.1",
|
|
56
|
+
"@radix-ui/react-collapsible": "^1.1.1",
|
|
57
|
+
"@radix-ui/react-dialog": "^1.1.2",
|
|
101
58
|
"@radix-ui/react-direction": "^1.1.0",
|
|
102
|
-
"@radix-ui/react-
|
|
103
|
-
"@radix-ui/react-
|
|
104
|
-
"@radix-ui/react-
|
|
59
|
+
"@radix-ui/react-navigation-menu": "^1.2.1",
|
|
60
|
+
"@radix-ui/react-popover": "^1.1.2",
|
|
61
|
+
"@radix-ui/react-scroll-area": "^1.2.0",
|
|
62
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
63
|
+
"@radix-ui/react-tabs": "^1.1.1",
|
|
105
64
|
"@tailwindcss/typography": "^0.5.15",
|
|
106
65
|
"class-variance-authority": "^0.7.0",
|
|
107
66
|
"cmdk": "^1.0.0",
|
|
108
|
-
"lucide-react": "^0.438.0",
|
|
109
67
|
"next-themes": "^0.3.0",
|
|
110
|
-
"react-medium-image-zoom": "^5.2.
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"fumadocs-core": "13.4.10"
|
|
68
|
+
"react-medium-image-zoom": "^5.2.10",
|
|
69
|
+
"tailwind-merge": "^2.5.4",
|
|
70
|
+
"fumadocs-core": "14.0.1"
|
|
114
71
|
},
|
|
115
72
|
"devDependencies": {
|
|
116
|
-
"@algolia/client-search": "
|
|
117
|
-
"@next/eslint-plugin-next": "^
|
|
118
|
-
"@types/react": "^18.3.
|
|
119
|
-
"@types/react-dom": "^18.3.
|
|
120
|
-
"algoliasearch": "
|
|
121
|
-
"
|
|
122
|
-
"
|
|
73
|
+
"@algolia/client-search": "4.24.0",
|
|
74
|
+
"@next/eslint-plugin-next": "^15.0.0",
|
|
75
|
+
"@types/react": "^18.3.11",
|
|
76
|
+
"@types/react-dom": "^18.3.1",
|
|
77
|
+
"algoliasearch": "4.24.0",
|
|
78
|
+
"lucide-react": "^0.453.0",
|
|
79
|
+
"next": "15.0.0",
|
|
80
|
+
"postcss": "^8.4.47",
|
|
123
81
|
"postcss-cli": "^11.0.0",
|
|
124
82
|
"postcss-lightningcss": "^1.0.1",
|
|
125
|
-
"tailwindcss": "^3.4.
|
|
83
|
+
"tailwindcss": "^3.4.13",
|
|
126
84
|
"eslint-config-custom": "0.0.0",
|
|
85
|
+
"fumadocs": "^0.0.0",
|
|
127
86
|
"tsconfig": "0.0.0"
|
|
128
87
|
},
|
|
129
88
|
"peerDependencies": {
|
|
130
|
-
"next": "
|
|
89
|
+
"next": "14.x.x || 15.x.x",
|
|
131
90
|
"react": ">= 18",
|
|
132
91
|
"react-dom": ">= 18"
|
|
133
92
|
},
|
|
93
|
+
"optionalDependencies": {
|
|
94
|
+
"@algolia/client-search": "^4.0.0",
|
|
95
|
+
"algoliasearch": "^4.24.0",
|
|
96
|
+
"tailwindcss": "^3.4.14"
|
|
97
|
+
},
|
|
134
98
|
"publishConfig": {
|
|
135
99
|
"access": "public"
|
|
136
100
|
},
|
|
137
101
|
"scripts": {
|
|
138
102
|
"build": "pnpm build:layout && pnpm build:tailwind",
|
|
139
103
|
"build:layout": "tsup",
|
|
140
|
-
"build:tailwind": "postcss css/*.css --dir dist",
|
|
104
|
+
"build:tailwind": "postcss css/*.css --dir dist && postcss src/components/*.css --dir dist/components",
|
|
141
105
|
"clean": "rimraf dist",
|
|
142
106
|
"dev": "concurrently \"pnpm dev:layout\" \"pnpm dev:tailwind\"",
|
|
143
107
|
"dev:layout": "tsup --watch",
|
package/dist/chunk-KCZRDPB4.js
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Popover,
|
|
3
|
-
PopoverContent,
|
|
4
|
-
PopoverTrigger
|
|
5
|
-
} from "./chunk-CP67AHDD.js";
|
|
6
|
-
import {
|
|
7
|
-
isActive
|
|
8
|
-
} from "./chunk-UOD2T27N.js";
|
|
9
|
-
import {
|
|
10
|
-
useSearchContext
|
|
11
|
-
} from "./chunk-ET4TW6M5.js";
|
|
12
|
-
import {
|
|
13
|
-
useI18n
|
|
14
|
-
} from "./chunk-EFMHXXHW.js";
|
|
15
|
-
import {
|
|
16
|
-
Collapsible,
|
|
17
|
-
CollapsibleContent,
|
|
18
|
-
CollapsibleTrigger
|
|
19
|
-
} from "./chunk-TQJ6YPJ3.js";
|
|
20
|
-
import {
|
|
21
|
-
buttonVariants,
|
|
22
|
-
itemVariants
|
|
23
|
-
} from "./chunk-EDNTYBXS.js";
|
|
24
|
-
import {
|
|
25
|
-
twMerge
|
|
26
|
-
} from "./chunk-TK3TM3MR.js";
|
|
27
|
-
|
|
28
|
-
// src/components/layout/search-toggle.tsx
|
|
29
|
-
import { useCallback } from "react";
|
|
30
|
-
import { SearchIcon } from "lucide-react";
|
|
31
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
|
-
function SearchToggle(props) {
|
|
33
|
-
const { setOpenSearch } = useSearchContext();
|
|
34
|
-
return /* @__PURE__ */ jsx(
|
|
35
|
-
"button",
|
|
36
|
-
{
|
|
37
|
-
type: "button",
|
|
38
|
-
className: twMerge(
|
|
39
|
-
buttonVariants({
|
|
40
|
-
size: "icon",
|
|
41
|
-
color: "ghost",
|
|
42
|
-
className: props.className
|
|
43
|
-
})
|
|
44
|
-
),
|
|
45
|
-
"data-search": "",
|
|
46
|
-
"aria-label": "Open Search",
|
|
47
|
-
onClick: useCallback(() => {
|
|
48
|
-
setOpenSearch(true);
|
|
49
|
-
}, [setOpenSearch]),
|
|
50
|
-
children: /* @__PURE__ */ jsx(SearchIcon, {})
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
function LargeSearchToggle(props) {
|
|
55
|
-
const { hotKey, setOpenSearch } = useSearchContext();
|
|
56
|
-
const { text } = useI18n();
|
|
57
|
-
return /* @__PURE__ */ jsxs(
|
|
58
|
-
"button",
|
|
59
|
-
{
|
|
60
|
-
type: "button",
|
|
61
|
-
"data-search-full": "",
|
|
62
|
-
...props,
|
|
63
|
-
className: twMerge(
|
|
64
|
-
"inline-flex items-center gap-2 rounded-full border bg-fd-secondary/50 p-1.5 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground",
|
|
65
|
-
props.className
|
|
66
|
-
),
|
|
67
|
-
onClick: useCallback(() => {
|
|
68
|
-
setOpenSearch(true);
|
|
69
|
-
}, [setOpenSearch]),
|
|
70
|
-
children: [
|
|
71
|
-
/* @__PURE__ */ jsx(SearchIcon, { className: "ms-1 size-4" }),
|
|
72
|
-
text.search,
|
|
73
|
-
/* @__PURE__ */ jsx("div", { className: "ms-auto inline-flex gap-0.5", children: hotKey.map((k, i) => /* @__PURE__ */ jsx("kbd", { className: "rounded-md border bg-fd-background px-1.5", children: k.display }, i)) })
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// src/components/layout/nav.tsx
|
|
80
|
-
import Link from "fumadocs-core/link";
|
|
81
|
-
import {
|
|
82
|
-
useEffect,
|
|
83
|
-
useState
|
|
84
|
-
} from "react";
|
|
85
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
86
|
-
function NavBox({
|
|
87
|
-
transparentMode = "none",
|
|
88
|
-
...props
|
|
89
|
-
}) {
|
|
90
|
-
const [transparent, setTransparent] = useState(transparentMode !== "none");
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (transparentMode !== "top") return;
|
|
93
|
-
const listener = () => {
|
|
94
|
-
setTransparent(window.scrollY < 10);
|
|
95
|
-
};
|
|
96
|
-
listener();
|
|
97
|
-
window.addEventListener("scroll", listener);
|
|
98
|
-
return () => {
|
|
99
|
-
window.removeEventListener("scroll", listener);
|
|
100
|
-
};
|
|
101
|
-
}, [transparentMode]);
|
|
102
|
-
return /* @__PURE__ */ jsx2(
|
|
103
|
-
"header",
|
|
104
|
-
{
|
|
105
|
-
...props,
|
|
106
|
-
className: twMerge(
|
|
107
|
-
"sticky top-0 z-40 border-b transition-colors",
|
|
108
|
-
transparent ? "border-transparent" : "border-fd-foreground/10 bg-fd-background/60 backdrop-blur-md",
|
|
109
|
-
props.className
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
function Title({ title, url = "/" }) {
|
|
115
|
-
return /* @__PURE__ */ jsx2(Link, { href: url, className: "inline-flex items-center gap-2 font-semibold", children: title });
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/components/layout/link-item.tsx
|
|
119
|
-
import Link2 from "fumadocs-core/link";
|
|
120
|
-
import { ChevronDown } from "lucide-react";
|
|
121
|
-
import { usePathname } from "next/navigation";
|
|
122
|
-
import { cva } from "class-variance-authority";
|
|
123
|
-
import { useState as useState2 } from "react";
|
|
124
|
-
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
125
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
126
|
-
var linkItemVariants = cva(
|
|
127
|
-
"-m-2 inline-flex items-center gap-1 p-2 text-fd-muted-foreground transition-colors [&_svg]:size-4",
|
|
128
|
-
{
|
|
129
|
-
variants: {
|
|
130
|
-
active: {
|
|
131
|
-
true: "text-fd-primary",
|
|
132
|
-
false: "hover:text-fd-accent-foreground"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
defaultVariants: {
|
|
136
|
-
active: false
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
);
|
|
140
|
-
function LinkItem({
|
|
141
|
-
item,
|
|
142
|
-
on = "nav",
|
|
143
|
-
className,
|
|
144
|
-
...props
|
|
145
|
-
}) {
|
|
146
|
-
const pathname = usePathname();
|
|
147
|
-
if (item.on && item.on !== "all" && item.on !== on) return null;
|
|
148
|
-
if (item.type === "custom") return item.children;
|
|
149
|
-
if (item.type === "menu" && on === "nav") {
|
|
150
|
-
return /* @__PURE__ */ jsxs2(
|
|
151
|
-
LinksMenu,
|
|
152
|
-
{
|
|
153
|
-
items: item.items,
|
|
154
|
-
className: twMerge(linkItemVariants({ className })),
|
|
155
|
-
...props,
|
|
156
|
-
children: [
|
|
157
|
-
item.icon,
|
|
158
|
-
item.text,
|
|
159
|
-
/* @__PURE__ */ jsx3(ChevronDown, { className: "ms-auto !size-3.5" })
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
if (item.type === "menu") {
|
|
165
|
-
return /* @__PURE__ */ jsxs2(Collapsible, { className: "flex flex-col", children: [
|
|
166
|
-
/* @__PURE__ */ jsxs2(
|
|
167
|
-
CollapsibleTrigger,
|
|
168
|
-
{
|
|
169
|
-
className: twMerge(itemVariants({ className }), "group/link"),
|
|
170
|
-
...props,
|
|
171
|
-
children: [
|
|
172
|
-
item.icon,
|
|
173
|
-
item.text,
|
|
174
|
-
/* @__PURE__ */ jsx3(ChevronDown, { className: "ms-auto transition-transform group-data-[state=closed]/link:-rotate-90" })
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
/* @__PURE__ */ jsx3(CollapsibleContent, { children: /* @__PURE__ */ jsx3("div", { className: "ms-2 flex flex-col border-s py-2 ps-2", children: item.items.map((child, i) => /* @__PURE__ */ jsx3(LinkItem, { item: child, on: "menu" }, i)) }) })
|
|
179
|
-
] });
|
|
180
|
-
}
|
|
181
|
-
if (item.type === "button") {
|
|
182
|
-
return /* @__PURE__ */ jsxs2(
|
|
183
|
-
Link2,
|
|
184
|
-
{
|
|
185
|
-
href: item.url,
|
|
186
|
-
external: item.external,
|
|
187
|
-
className: twMerge(
|
|
188
|
-
buttonVariants({ color: "secondary" }),
|
|
189
|
-
"gap-1.5 [&_svg]:size-4",
|
|
190
|
-
className
|
|
191
|
-
),
|
|
192
|
-
children: [
|
|
193
|
-
item.icon,
|
|
194
|
-
item.text
|
|
195
|
-
]
|
|
196
|
-
}
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
const activeType = item.active ?? "url";
|
|
200
|
-
const active = activeType !== "none" && isActive(item.url, pathname, activeType === "nested-url");
|
|
201
|
-
if (item.type === "icon" && on === "nav") {
|
|
202
|
-
return /* @__PURE__ */ jsx3(
|
|
203
|
-
Link2,
|
|
204
|
-
{
|
|
205
|
-
"aria-label": item.label,
|
|
206
|
-
href: item.url,
|
|
207
|
-
external: item.external,
|
|
208
|
-
className: twMerge(
|
|
209
|
-
buttonVariants({
|
|
210
|
-
size: "icon",
|
|
211
|
-
color: "ghost",
|
|
212
|
-
className
|
|
213
|
-
})
|
|
214
|
-
),
|
|
215
|
-
...props,
|
|
216
|
-
children: item.icon
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
return /* @__PURE__ */ jsxs2(
|
|
221
|
-
Link2,
|
|
222
|
-
{
|
|
223
|
-
href: item.url,
|
|
224
|
-
external: item.external,
|
|
225
|
-
className: twMerge(
|
|
226
|
-
on === "nav" ? linkItemVariants({
|
|
227
|
-
active
|
|
228
|
-
}) : itemVariants({ active }),
|
|
229
|
-
className
|
|
230
|
-
),
|
|
231
|
-
...props,
|
|
232
|
-
children: [
|
|
233
|
-
on === "menu" ? item.icon : null,
|
|
234
|
-
item.text
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
function LinksMenu({
|
|
240
|
-
items,
|
|
241
|
-
footer,
|
|
242
|
-
...props
|
|
243
|
-
}) {
|
|
244
|
-
const [open, setOpen] = useState2(false);
|
|
245
|
-
const pathname = usePathname();
|
|
246
|
-
useOnChange(pathname, () => {
|
|
247
|
-
setOpen(false);
|
|
248
|
-
});
|
|
249
|
-
return /* @__PURE__ */ jsxs2(Popover, { open, onOpenChange: setOpen, children: [
|
|
250
|
-
/* @__PURE__ */ jsx3(PopoverTrigger, { ...props }),
|
|
251
|
-
/* @__PURE__ */ jsxs2(PopoverContent, { className: "flex flex-col", children: [
|
|
252
|
-
items.map((item, i) => /* @__PURE__ */ jsx3(LinkItem, { item, on: "menu" }, i)),
|
|
253
|
-
footer
|
|
254
|
-
] })
|
|
255
|
-
] });
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// src/components/layout/theme-toggle.tsx
|
|
259
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
260
|
-
import { Moon, Sun } from "lucide-react";
|
|
261
|
-
import { useTheme } from "next-themes";
|
|
262
|
-
import { useCallback as useCallback2 } from "react";
|
|
263
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
264
|
-
var buttonVariants2 = cva2("size-6 rounded-full p-1 text-fd-muted-foreground", {
|
|
265
|
-
variants: {
|
|
266
|
-
dark: {
|
|
267
|
-
true: "dark:bg-fd-accent dark:text-fd-accent-foreground",
|
|
268
|
-
false: "bg-fd-accent text-fd-accent-foreground dark:bg-transparent dark:text-fd-muted-foreground"
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
function ThemeToggle({
|
|
273
|
-
className,
|
|
274
|
-
...props
|
|
275
|
-
}) {
|
|
276
|
-
const { setTheme, resolvedTheme } = useTheme();
|
|
277
|
-
const onToggle = useCallback2(() => {
|
|
278
|
-
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
279
|
-
}, [setTheme, resolvedTheme]);
|
|
280
|
-
return /* @__PURE__ */ jsxs3(
|
|
281
|
-
"button",
|
|
282
|
-
{
|
|
283
|
-
type: "button",
|
|
284
|
-
className: twMerge(
|
|
285
|
-
"inline-flex items-center rounded-full border p-0.5",
|
|
286
|
-
className
|
|
287
|
-
),
|
|
288
|
-
"data-theme-toggle": "",
|
|
289
|
-
"aria-label": "Toggle Theme",
|
|
290
|
-
onClick: onToggle,
|
|
291
|
-
...props,
|
|
292
|
-
children: [
|
|
293
|
-
/* @__PURE__ */ jsx4(Sun, { className: twMerge(buttonVariants2({ dark: false })) }),
|
|
294
|
-
/* @__PURE__ */ jsx4(Moon, { className: twMerge(buttonVariants2({ dark: true })) })
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export {
|
|
301
|
-
SearchToggle,
|
|
302
|
-
LargeSearchToggle,
|
|
303
|
-
NavBox,
|
|
304
|
-
Title,
|
|
305
|
-
LinkItem,
|
|
306
|
-
LinksMenu,
|
|
307
|
-
ThemeToggle
|
|
308
|
-
};
|
package/dist/chunk-LSTPTAZ5.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
hasActive
|
|
3
|
-
} from "./chunk-UOD2T27N.js";
|
|
4
|
-
|
|
5
|
-
// src/contexts/tree.tsx
|
|
6
|
-
import { usePathname } from "next/navigation";
|
|
7
|
-
import { createContext, useContext, useMemo } from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var TreeContext = createContext(void 0);
|
|
10
|
-
function findRoot(items, pathname) {
|
|
11
|
-
for (const item of items) {
|
|
12
|
-
if (item.type === "folder") {
|
|
13
|
-
const root = findRoot(item.children, pathname);
|
|
14
|
-
if (root) return root;
|
|
15
|
-
if (item.root === true && hasActive(item.children, pathname)) {
|
|
16
|
-
return item;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function getNavigationList(tree) {
|
|
22
|
-
return tree.flatMap((node) => {
|
|
23
|
-
if (node.type === "separator") return [];
|
|
24
|
-
if (node.type === "folder") {
|
|
25
|
-
const children = getNavigationList(node.children);
|
|
26
|
-
if (!node.root && node.index) children.unshift(node.index);
|
|
27
|
-
return children;
|
|
28
|
-
}
|
|
29
|
-
return !node.external ? [node] : [];
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function TreeContextProvider({
|
|
33
|
-
children,
|
|
34
|
-
tree
|
|
35
|
-
}) {
|
|
36
|
-
const pathname = usePathname();
|
|
37
|
-
const value = useMemo(() => {
|
|
38
|
-
const root = findRoot(tree.children, pathname) ?? tree;
|
|
39
|
-
const navigation = getNavigationList(root.children);
|
|
40
|
-
return {
|
|
41
|
-
root,
|
|
42
|
-
navigation,
|
|
43
|
-
tree
|
|
44
|
-
};
|
|
45
|
-
}, [pathname, tree]);
|
|
46
|
-
return /* @__PURE__ */ jsx(TreeContext.Provider, { value, children });
|
|
47
|
-
}
|
|
48
|
-
function useTreeContext() {
|
|
49
|
-
const ctx = useContext(TreeContext);
|
|
50
|
-
if (!ctx)
|
|
51
|
-
throw new Error("You must wrap this component under <DocsLayout />");
|
|
52
|
-
return ctx;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
TreeContextProvider,
|
|
57
|
-
useTreeContext
|
|
58
|
-
};
|