@fumadocs/base-ui 16.6.8 → 16.6.10
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/css/generated/home.css +36 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +1 -1
- package/dist/components/codeblock.rsc.d.ts +22 -0
- package/dist/components/codeblock.rsc.d.ts.map +1 -0
- package/dist/components/codeblock.rsc.js +24 -0
- package/dist/components/codeblock.rsc.js.map +1 -0
- package/dist/components/dialog/search-algolia.d.ts +0 -1
- package/dist/components/dialog/search-algolia.d.ts.map +1 -1
- package/dist/components/dialog/search-default.d.ts +0 -1
- package/dist/components/dialog/search-default.d.ts.map +1 -1
- package/dist/components/dialog/search-orama.d.ts +0 -1
- package/dist/components/dialog/search-orama.d.ts.map +1 -1
- package/dist/components/dynamic-codeblock.js +1 -1
- package/dist/components/sidebar/base.js +2 -2
- package/dist/components/sidebar/base.js.map +1 -1
- package/dist/layouts/docs/sidebar.d.ts +0 -1
- package/dist/layouts/docs/sidebar.d.ts.map +1 -1
- package/dist/layouts/flux/sidebar.d.ts +0 -1
- package/dist/layouts/flux/sidebar.d.ts.map +1 -1
- package/dist/layouts/home/client.d.ts +1 -1
- package/dist/layouts/home/not-found.d.ts +10 -0
- package/dist/layouts/home/not-found.d.ts.map +1 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/not-found.js.map +1 -0
- package/dist/layouts/notebook/sidebar.d.ts +0 -1
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -1
- package/dist/style.css +37 -6
- package/package.json +10 -6
package/css/generated/home.css
CHANGED
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
@source inline("[&_svg]:size-5.5");
|
|
16
16
|
@source inline("[--fd-layout-width:1400px]");
|
|
17
17
|
@source inline("always");
|
|
18
|
+
@source inline("are");
|
|
18
19
|
@source inline("aria-label");
|
|
19
20
|
@source inline("as");
|
|
20
21
|
@source inline("backdrop-blur-lg");
|
|
21
22
|
@source inline("banner");
|
|
23
|
+
@source inline("been");
|
|
22
24
|
@source inline("bg-fd-background/80");
|
|
23
25
|
@source inline("bg-fd-card");
|
|
24
26
|
@source inline("bg-fd-muted");
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
@source inline("const");
|
|
39
41
|
@source inline("createContext");
|
|
40
42
|
@source inline("custom");
|
|
43
|
+
@source inline("customise");
|
|
41
44
|
@source inline("cva");
|
|
42
45
|
@source inline("data-[active=true]:font-medium");
|
|
43
46
|
@source inline("data-[active=true]:text-fd-primary");
|
|
@@ -48,6 +51,7 @@
|
|
|
48
51
|
@source inline("data-popup-open:text-fd-primary");
|
|
49
52
|
@source inline("data-starting-style:opacity-0");
|
|
50
53
|
@source inline("data-starting-style:scale-90");
|
|
54
|
+
@source inline("default");
|
|
51
55
|
@source inline("defaultVariants");
|
|
52
56
|
@source inline("div");
|
|
53
57
|
@source inline("duration-(--duration)");
|
|
@@ -65,8 +69,11 @@
|
|
|
65
69
|
@source inline("flex-1");
|
|
66
70
|
@source inline("flex-col");
|
|
67
71
|
@source inline("flex-row");
|
|
72
|
+
@source inline("font-bold");
|
|
68
73
|
@source inline("font-medium");
|
|
69
74
|
@source inline("font-semibold");
|
|
75
|
+
@source inline("for");
|
|
76
|
+
@source inline("found");
|
|
70
77
|
@source inline("from");
|
|
71
78
|
@source inline("fumadocs-core/link");
|
|
72
79
|
@source inline("function");
|
|
@@ -74,6 +81,7 @@
|
|
|
74
81
|
@source inline("gap-1.5");
|
|
75
82
|
@source inline("gap-2");
|
|
76
83
|
@source inline("gap-2.5");
|
|
84
|
+
@source inline("gap-4");
|
|
77
85
|
@source inline("ghost");
|
|
78
86
|
@source inline("githubUrl");
|
|
79
87
|
@source inline("grid");
|
|
@@ -83,6 +91,8 @@
|
|
|
83
91
|
@source inline("h-(--popup-height)");
|
|
84
92
|
@source inline("h-(--positioner-height)");
|
|
85
93
|
@source inline("h-14");
|
|
94
|
+
@source inline("had");
|
|
95
|
+
@source inline("have");
|
|
86
96
|
@source inline("header");
|
|
87
97
|
@source inline("hideIfDisabled");
|
|
88
98
|
@source inline("hover:bg-fd-accent/80");
|
|
@@ -97,10 +107,13 @@
|
|
|
97
107
|
@source inline("in");
|
|
98
108
|
@source inline("inline-flex");
|
|
99
109
|
@source inline("interface");
|
|
110
|
+
@source inline("is");
|
|
100
111
|
@source inline("isTop");
|
|
101
112
|
@source inline("isTransparent");
|
|
102
113
|
@source inline("item");
|
|
103
114
|
@source inline("items-center");
|
|
115
|
+
@source inline("its");
|
|
116
|
+
@source inline("justify-center");
|
|
104
117
|
@source inline("justify-end");
|
|
105
118
|
@source inline("key");
|
|
106
119
|
@source inline("label");
|
|
@@ -109,42 +122,55 @@
|
|
|
109
122
|
@source inline("lg:grid-cols-3");
|
|
110
123
|
@source inline("lg:hidden");
|
|
111
124
|
@source inline("links");
|
|
125
|
+
@source inline("looking");
|
|
112
126
|
@source inline("lucide-react");
|
|
113
127
|
@source inline("main");
|
|
128
|
+
@source inline("make");
|
|
114
129
|
@source inline("max-lg:hidden");
|
|
115
130
|
@source inline("max-sm:hidden");
|
|
116
131
|
@source inline("max-w-(--available-width)");
|
|
117
132
|
@source inline("max-w-(--fd-layout-width)");
|
|
118
133
|
@source inline("max-w-(--fd-layout-width,1400px)");
|
|
119
134
|
@source inline("max-w-[240px]");
|
|
135
|
+
@source inline("max-w-md");
|
|
120
136
|
@source inline("mb-1");
|
|
121
137
|
@source inline("mb-4");
|
|
122
138
|
@source inline("md:grid-cols-2");
|
|
123
139
|
@source inline("menu");
|
|
140
|
+
@source inline("might");
|
|
124
141
|
@source inline("mode");
|
|
125
142
|
@source inline("ms-auto");
|
|
143
|
+
@source inline("mt-4");
|
|
126
144
|
@source inline("mx-auto");
|
|
145
|
+
@source inline("name");
|
|
127
146
|
@source inline("nav");
|
|
128
147
|
@source inline("navItemVariants");
|
|
129
148
|
@source inline("navItems");
|
|
130
149
|
@source inline("nd-home-layout");
|
|
131
150
|
@source inline("nd-nav");
|
|
132
151
|
@source inline("none");
|
|
152
|
+
@source inline("not");
|
|
133
153
|
@source inline("onClick");
|
|
134
154
|
@source inline("onOpenChange");
|
|
135
155
|
@source inline("open");
|
|
156
|
+
@source inline("or");
|
|
136
157
|
@source inline("origin-(--transform-origin)");
|
|
137
158
|
@source inline("overflow-hidden");
|
|
159
|
+
@source inline("own");
|
|
138
160
|
@source inline("p-1");
|
|
139
161
|
@source inline("p-2");
|
|
140
162
|
@source inline("p-3");
|
|
141
163
|
@source inline("p-4");
|
|
164
|
+
@source inline("page");
|
|
142
165
|
@source inline("pb-4");
|
|
166
|
+
@source inline("please");
|
|
167
|
+
@source inline("primary");
|
|
143
168
|
@source inline("props");
|
|
144
169
|
@source inline("ps-2.5");
|
|
145
170
|
@source inline("pt-2");
|
|
146
171
|
@source inline("px-4");
|
|
147
172
|
@source inline("px-6");
|
|
173
|
+
@source inline("px-8");
|
|
148
174
|
@source inline("py-1.5");
|
|
149
175
|
@source inline("react");
|
|
150
176
|
@source inline("relative");
|
|
@@ -165,6 +191,7 @@
|
|
|
165
191
|
@source inline("sideOffset");
|
|
166
192
|
@source inline("size");
|
|
167
193
|
@source inline("size-3");
|
|
194
|
+
@source inline("size-4");
|
|
168
195
|
@source inline("size-5");
|
|
169
196
|
@source inline("size-full");
|
|
170
197
|
@source inline("sm");
|
|
@@ -173,11 +200,17 @@
|
|
|
173
200
|
@source inline("string");
|
|
174
201
|
@source inline("style");
|
|
175
202
|
@source inline("target");
|
|
203
|
+
@source inline("temporarily");
|
|
176
204
|
@source inline("text");
|
|
205
|
+
@source inline("text-2xl");
|
|
206
|
+
@source inline("text-6xl");
|
|
177
207
|
@source inline("text-base");
|
|
208
|
+
@source inline("text-center");
|
|
178
209
|
@source inline("text-fd-muted-foreground");
|
|
179
210
|
@source inline("text-sm");
|
|
211
|
+
@source inline("the");
|
|
180
212
|
@source inline("themeSwitch");
|
|
213
|
+
@source inline("to");
|
|
181
214
|
@source inline("top");
|
|
182
215
|
@source inline("top-0");
|
|
183
216
|
@source inline("transition-[left,right]");
|
|
@@ -198,5 +231,8 @@
|
|
|
198
231
|
@source inline("w-(--positioner-width)");
|
|
199
232
|
@source inline("w-fit");
|
|
200
233
|
@source inline("w-full");
|
|
234
|
+
@source inline("want");
|
|
235
|
+
@source inline("you");
|
|
236
|
+
@source inline("your");
|
|
201
237
|
@source inline("z-20");
|
|
202
238
|
@source inline("z-40");
|
package/css/generated/shared.css
CHANGED
package/css/lib/base.css
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CodeBlockProps } from "./codeblock.js";
|
|
2
|
+
import * as react from "react";
|
|
3
|
+
import { HighlightOptions } from "fumadocs-core/highlight";
|
|
4
|
+
|
|
5
|
+
//#region src/components/codeblock.rsc.d.ts
|
|
6
|
+
type ServerCodeBlockProps = HighlightOptions & {
|
|
7
|
+
code: string;
|
|
8
|
+
/**
|
|
9
|
+
* Extra props for the underlying `<CodeBlock />` component.
|
|
10
|
+
*
|
|
11
|
+
* Ignored if you defined your own `pre` component in `components`.
|
|
12
|
+
*/
|
|
13
|
+
codeblock?: CodeBlockProps;
|
|
14
|
+
};
|
|
15
|
+
declare function ServerCodeBlock({
|
|
16
|
+
code,
|
|
17
|
+
codeblock,
|
|
18
|
+
...options
|
|
19
|
+
}: ServerCodeBlockProps): Promise<react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | (string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined)>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ServerCodeBlock, ServerCodeBlockProps };
|
|
22
|
+
//# sourceMappingURL=codeblock.rsc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeblock.rsc.d.ts","names":[],"sources":["../../src/components/codeblock.rsc.tsx"],"mappings":";;;;;KAIY,oBAAA,GAAuB,gBAAA;EACjC,IAAA;;AADF;;;;EAQE,SAAA,GAAY,cAAA;AAAA;AAAA,iBAGQ,eAAA,CAAA;EAAkB,IAAA;EAAM,SAAA;EAAA,GAAc;AAAA,GAAW,oBAAA,GAAoB,OAAA,CAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,KAAA,CAAA,SAAA,0CAAA,KAAA,CAAA,WAAA,GAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,KAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import { CodeBlock, Pre } from "./codeblock.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { highlight } from "fumadocs-core/highlight";
|
|
5
|
+
|
|
6
|
+
//#region src/components/codeblock.rsc.tsx
|
|
7
|
+
async function ServerCodeBlock({ code, codeblock, ...options }) {
|
|
8
|
+
return await highlight(code, {
|
|
9
|
+
...options,
|
|
10
|
+
components: {
|
|
11
|
+
pre: (props) => {
|
|
12
|
+
CodeBlock, {
|
|
13
|
+
...props,
|
|
14
|
+
...codeblock
|
|
15
|
+
}, cn("my-0", props.className, codeblock?.className), Pre, props.children;
|
|
16
|
+
},
|
|
17
|
+
...options.components
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ServerCodeBlock };
|
|
24
|
+
//# sourceMappingURL=codeblock.rsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeblock.rsc.js","names":["Base.CodeBlock","Base.Pre"],"sources":["../../src/components/codeblock.rsc.tsx"],"sourcesContent":["import * as Base from './codeblock';\nimport { highlight, type HighlightOptions } from 'fumadocs-core/highlight';\nimport { cn } from '@/utils/cn';\n\nexport type ServerCodeBlockProps = HighlightOptions & {\n code: string;\n\n /**\n * Extra props for the underlying `<CodeBlock />` component.\n *\n * Ignored if you defined your own `pre` component in `components`.\n */\n codeblock?: Base.CodeBlockProps;\n};\n\nexport async function ServerCodeBlock({ code, codeblock, ...options }: ServerCodeBlockProps) {\n return await highlight(code, {\n ...options,\n components: {\n pre: (props) => {\n <Base.CodeBlock\n {...props}\n {...codeblock}\n className={cn('my-0', props.className, codeblock?.className)}\n >\n <Base.Pre>{props.children}</Base.Pre>\n </Base.CodeBlock>;\n },\n ...options.components,\n },\n });\n}\n"],"mappings":";;;;;;AAeA,eAAsB,gBAAgB,EAAE,MAAM,WAAW,GAAG,WAAiC;AAC3F,QAAO,MAAM,UAAU,MAAM;EAC3B,GAAG;EACH,YAAY;GACV,MAAM,UAAU;AACd,IAACA,WAGC;KAFA,GAAI;KACJ,GAAI;KACyD,EAAlD,GAAG,QAAQ,MAAM,WAAW,WAAW,UAAU,EAE3DC,KAAU,MAAM;;GAGrB,GAAG,QAAQ;GACZ;EACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-algolia.d.ts","names":[],"sources":["../../../src/components/dialog/search-algolia.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-algolia.d.ts","names":[],"sources":["../../../src/components/dialog/search-algolia.tsx"],"mappings":";;;;;;UAuBiB,wBAAA,SAAiC,WAAA;EAChD,aAAA,EAAe,cAAA;EACf,KAAA,GAAQ,UAAA;EAER,MAAA,GAAS,SAAA;EAET,UAAA;EACA,IAAA,GAAO,OAAA;EANQ;;;;;EAaf,WAAA;EAd2D;;;;;EAqB3D,UAAA;AAAA;AAAA,iBAGsB,mBAAA,CAAA;EACtB,aAAA;EACA,IAAA;EACA,UAAA;EACA,WAAA;EACA,UAAA;EACA,KAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,wBAAA,GAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-default.d.ts","names":[],"sources":["../../../src/components/dialog/search-default.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-default.d.ts","names":[],"sources":["../../../src/components/dialog/search-default.tsx"],"mappings":";;;;;UAuBiB,wBAAA,SAAiC,WAAA;EAChD,KAAA,GAAQ,UAAA;;AADV;;EAME,IAAA;EAEA,UAAA;EACA,IAAA,GAAO,OAAA;EAYE;;;EAPT,GAAA;EAdgD;;;EAmBhD,OAAA;EAEA,MAAA,GAAS,SAAA;EAZT;;;;;EAmBA,UAAA;AAAA;AAAA,iBAGsB,mBAAA,CAAA;EACtB,UAAA;EACA,IAAA;EACA,GAAA;EACA,OAAA;EACA,IAAA;EACA,UAAA;EACA,KAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,wBAAA,GAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-orama.d.ts","names":[],"sources":["../../../src/components/dialog/search-orama.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-orama.d.ts","names":[],"sources":["../../../src/components/dialog/search-orama.tsx"],"mappings":";;;;;;UAuBiB,sBAAA,SAA+B,WAAA;EAC9C,KAAA,GAAQ,UAAA;EACR,MAAA,EAAQ,iBAAA;EACR,aAAA,GAAgB,iBAAA;EAChB,KAAA,GAAQ,iBAAA;EAER,MAAA,GAAS,SAAA;EAET,UAAA;EACA,IAAA,GAAO,OAAA;EANS;;;;;EAahB,SAAA;EAhByD;;;;;EAuBzD,UAAA;AAAA;;;;iBAMsB,iBAAA,CAAA;EACtB,MAAA;EACA,aAAA;EACA,IAAA;EACA,UAAA;EACA,SAAA;EACA,UAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,sBAAA,GAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { DynamicCodeBlock as DynamicCodeBlock$1 } from "./dynamic-codeblock.core.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { useShikiConfigOptional } from "fumadocs-core/highlight/core/client";
|
|
6
5
|
import { configDefault } from "fumadocs-core/highlight";
|
|
6
|
+
import { useShikiConfigOptional } from "fumadocs-core/highlight/core/client";
|
|
7
7
|
|
|
8
8
|
//#region src/components/dynamic-codeblock.tsx
|
|
9
9
|
function DynamicCodeBlock(props) {
|
|
@@ -202,7 +202,7 @@ function SidebarFolderTrigger({ children, ...props }) {
|
|
|
202
202
|
...props,
|
|
203
203
|
children: [children, /* @__PURE__ */ jsx(ChevronDown, {
|
|
204
204
|
"data-icon": true,
|
|
205
|
-
className: cn("ms-auto transition-transform", !open && "-rotate-90")
|
|
205
|
+
className: cn("ms-auto transition-transform", !open && "-rotate-90 rtl:rotate-90")
|
|
206
206
|
})]
|
|
207
207
|
});
|
|
208
208
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -229,7 +229,7 @@ function SidebarFolderLink({ children, active = false, ...props }) {
|
|
|
229
229
|
...props,
|
|
230
230
|
children: [children, collapsible && /* @__PURE__ */ jsx(ChevronDown, {
|
|
231
231
|
"data-icon": true,
|
|
232
|
-
className: cn("ms-auto transition-transform", !open && "-rotate-90")
|
|
232
|
+
className: cn("ms-auto transition-transform", !open && "-rotate-90 rtl:rotate-90")
|
|
233
233
|
})]
|
|
234
234
|
});
|
|
235
235
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":[],"sources":["../../../src/components/sidebar/base.tsx"],"sourcesContent":["'use client';\nimport { ChevronDown, ExternalLink } from 'lucide-react';\nimport {\n type ComponentProps,\n createContext,\n type PointerEvent,\n type ReactNode,\n type RefObject,\n use,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport Link, { type LinkProps } from 'fumadocs-core/link';\nimport { useOnChange } from 'fumadocs-core/utils/use-on-change';\nimport { cn } from '@/utils/cn';\nimport { ScrollArea, type ScrollAreaProps, ScrollViewport } from '@/components/ui/scroll-area';\nimport {\n Collapsible,\n CollapsibleContent,\n type CollapsibleContentProps,\n CollapsibleTrigger,\n type CollapsibleTriggerProps,\n} from '@/components/ui/collapsible';\nimport { useMediaQuery } from 'fumadocs-core/utils/use-media-query';\nimport scrollIntoView from 'scroll-into-view-if-needed';\nimport { usePathname } from 'fumadocs-core/framework';\nimport ReactDOM from 'react-dom';\n\ninterface SidebarContext {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n collapsed: boolean;\n setCollapsed: React.Dispatch<React.SetStateAction<boolean>>;\n\n /**\n * When set to false, don't close the sidebar when navigate to another page\n */\n closeOnRedirect: RefObject<boolean>;\n defaultOpenLevel: number;\n prefetch?: boolean;\n mode: Mode;\n}\n\nexport interface SidebarProviderProps {\n /**\n * Open folders by default if their level is lower or equal to a specific level\n * (Starting from 1)\n *\n * @defaultValue 0\n */\n defaultOpenLevel?: number;\n\n /**\n * Prefetch links, default behaviour depends on your React.js framework.\n */\n prefetch?: boolean;\n\n children?: ReactNode;\n}\n\ntype Mode = 'drawer' | 'full';\n\nconst SidebarContext = createContext<SidebarContext | null>(null);\n\nconst FolderContext = createContext<{\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n depth: number;\n collapsible: boolean;\n} | null>(null);\n\nexport function SidebarProvider({\n defaultOpenLevel = 0,\n prefetch,\n children,\n}: SidebarProviderProps) {\n const closeOnRedirect = useRef(true);\n const [open, setOpen] = useState(false);\n const [collapsed, setCollapsed] = useState(false);\n const pathname = usePathname();\n const mode: Mode = useMediaQuery('(width < 768px)') ? 'drawer' : 'full';\n\n useOnChange(pathname, () => {\n if (closeOnRedirect.current) {\n setOpen(false);\n }\n closeOnRedirect.current = true;\n });\n\n return (\n <SidebarContext\n value={useMemo(\n () => ({\n open,\n setOpen,\n collapsed,\n setCollapsed,\n closeOnRedirect,\n defaultOpenLevel,\n prefetch,\n mode,\n }),\n [open, collapsed, defaultOpenLevel, prefetch, mode],\n )}\n >\n {children}\n </SidebarContext>\n );\n}\n\nexport function useSidebar(): SidebarContext {\n const ctx = use(SidebarContext);\n if (!ctx)\n throw new Error(\n 'Missing SidebarContext, make sure you have wrapped the component in <DocsLayout /> and the context is available.',\n );\n\n return ctx;\n}\n\nexport function useFolder() {\n return use(FolderContext);\n}\n\nexport function useFolderDepth() {\n return use(FolderContext)?.depth ?? 0;\n}\n\nexport function SidebarContent({\n children,\n}: {\n children: (state: {\n ref: RefObject<HTMLElement | null>;\n collapsed: boolean;\n hovered: boolean;\n onPointerEnter: (event: PointerEvent) => void;\n onPointerLeave: (event: PointerEvent) => void;\n }) => ReactNode;\n}) {\n const { collapsed, mode } = useSidebar();\n const [hover, setHover] = useState(false);\n const ref = useRef<HTMLElement>(null);\n const timerRef = useRef(0);\n\n useOnChange(collapsed, () => {\n if (collapsed) setHover(false);\n });\n\n if (mode !== 'full') return;\n\n function shouldIgnoreHover(e: PointerEvent): boolean {\n const element = ref.current;\n if (!element) return true;\n\n return !collapsed || e.pointerType === 'touch' || element.getAnimations().length > 0;\n }\n\n return children({\n ref,\n collapsed,\n hovered: hover,\n onPointerEnter(e) {\n if (shouldIgnoreHover(e)) return;\n window.clearTimeout(timerRef.current);\n setHover(true);\n },\n onPointerLeave(e) {\n if (shouldIgnoreHover(e)) return;\n window.clearTimeout(timerRef.current);\n\n timerRef.current = window.setTimeout(\n () => setHover(false),\n // if mouse is leaving the viewport, add a close delay\n Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500,\n );\n },\n });\n}\n\nexport function SidebarDrawerOverlay(props: ComponentProps<'div'>) {\n const { open, setOpen, mode } = useSidebar();\n const [hidden, setHidden] = useState(!open);\n\n if (open && hidden) setHidden(false);\n if (mode !== 'drawer' || hidden) return;\n return (\n <div\n data-state={open ? 'open' : 'closed'}\n onClick={() => setOpen(false)}\n onAnimationEnd={() => {\n if (!open) ReactDOM.flushSync(() => setHidden(true));\n }}\n {...props}\n />\n );\n}\n\nexport function SidebarDrawerContent({ className, children, ...props }: ComponentProps<'aside'>) {\n const { open, mode } = useSidebar();\n const [hidden, setHidden] = useState(!open);\n\n if (open && hidden) setHidden(false);\n if (mode !== 'drawer') return;\n return (\n <aside\n id=\"nd-sidebar-mobile\"\n data-state={open ? 'open' : 'closed'}\n className={cn(hidden && 'invisible', className)}\n onAnimationEnd={() => {\n if (!open) ReactDOM.flushSync(() => setHidden(true));\n }}\n {...props}\n >\n {children}\n </aside>\n );\n}\n\nexport function SidebarViewport({ className, ...props }: ScrollAreaProps) {\n return (\n <ScrollArea\n className={(s) =>\n cn('min-h-0 flex-1', typeof className === 'function' ? className(s) : className)\n }\n {...props}\n >\n <ScrollViewport\n className=\"p-4 overscroll-contain\"\n style={\n {\n maskImage:\n 'linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)',\n } as object\n }\n >\n {props.children}\n </ScrollViewport>\n </ScrollArea>\n );\n}\n\nexport function SidebarSeparator(props: ComponentProps<'p'>) {\n const depth = useFolderDepth();\n return (\n <p\n {...props}\n className={cn(\n 'inline-flex items-center gap-2 mb-1.5 px-2 mt-6 empty:mb-0',\n depth === 0 && 'first:mt-0',\n props.className,\n )}\n >\n {props.children}\n </p>\n );\n}\n\nexport function SidebarItem({\n icon,\n active = false,\n children,\n ...props\n}: LinkProps & {\n active?: boolean;\n icon?: ReactNode;\n}) {\n const ref = useRef<HTMLAnchorElement>(null);\n const { prefetch } = useSidebar();\n\n useAutoScroll(active, ref);\n\n return (\n <Link ref={ref} data-active={active} prefetch={prefetch} {...props}>\n {icon ?? (props.external ? <ExternalLink /> : null)}\n {children}\n </Link>\n );\n}\n\nexport function SidebarFolder({\n defaultOpen: defaultOpenProp,\n collapsible = true,\n active = false,\n children,\n ...props\n}: ComponentProps<'div'> & {\n active?: boolean;\n defaultOpen?: boolean;\n collapsible?: boolean;\n}) {\n const { defaultOpenLevel } = useSidebar();\n const depth = useFolderDepth() + 1;\n const defaultOpen =\n collapsible === false || active || (defaultOpenProp ?? defaultOpenLevel >= depth);\n const [open, setOpen] = useState(defaultOpen);\n\n useOnChange(defaultOpen, (v) => {\n if (v) setOpen(v);\n });\n\n return (\n <Collapsible open={open} onOpenChange={setOpen} disabled={!collapsible} {...props}>\n <FolderContext\n value={useMemo(() => ({ open, setOpen, depth, collapsible }), [collapsible, depth, open])}\n >\n {children}\n </FolderContext>\n </Collapsible>\n );\n}\n\nexport function SidebarFolderTrigger({ children, ...props }: CollapsibleTriggerProps) {\n const { open, collapsible } = use(FolderContext)!;\n\n if (collapsible) {\n return (\n <CollapsibleTrigger {...props}>\n {children}\n <ChevronDown\n data-icon\n className={cn('ms-auto transition-transform', !open && '-rotate-90')}\n />\n </CollapsibleTrigger>\n );\n }\n\n return <div {...(props as ComponentProps<'div'>)}>{children}</div>;\n}\n\nexport function SidebarFolderLink({\n children,\n active = false,\n ...props\n}: LinkProps & {\n active?: boolean;\n}) {\n const ref = useRef<HTMLAnchorElement>(null);\n const { open, setOpen, collapsible } = use(FolderContext)!;\n const { prefetch } = useSidebar();\n\n useAutoScroll(active, ref);\n\n return (\n <Link\n ref={ref}\n data-active={active}\n onClick={(e) => {\n if (!collapsible) return;\n\n if (e.target instanceof Element && e.target.matches('[data-icon], [data-icon] *')) {\n setOpen(!open);\n e.preventDefault();\n } else {\n setOpen(active ? !open : true);\n }\n }}\n prefetch={prefetch}\n {...props}\n >\n {children}\n {collapsible && (\n <ChevronDown\n data-icon\n className={cn('ms-auto transition-transform', !open && '-rotate-90')}\n />\n )}\n </Link>\n );\n}\n\nexport function SidebarFolderContent(props: CollapsibleContentProps) {\n return <CollapsibleContent {...props}>{props.children}</CollapsibleContent>;\n}\n\nexport function SidebarTrigger({ children, ...props }: ComponentProps<'button'>) {\n const { setOpen } = useSidebar();\n\n return (\n <button aria-label=\"Open Sidebar\" onClick={() => setOpen((prev) => !prev)} {...props}>\n {children}\n </button>\n );\n}\n\nexport function SidebarCollapseTrigger(props: ComponentProps<'button'>) {\n const { collapsed, setCollapsed } = useSidebar();\n\n return (\n <button\n type=\"button\"\n aria-label=\"Collapse Sidebar\"\n data-collapsed={collapsed}\n onClick={() => {\n setCollapsed((prev) => !prev);\n }}\n {...props}\n >\n {props.children}\n </button>\n );\n}\n\n/**\n * scroll to the element if `active` is true\n */\nexport function useAutoScroll(active: boolean, ref: RefObject<HTMLElement | null>) {\n const { mode } = useSidebar();\n\n useEffect(() => {\n if (active && ref.current) {\n scrollIntoView(ref.current, {\n boundary: document.getElementById(mode === 'drawer' ? 'nd-sidebar-mobile' : 'nd-sidebar'),\n scrollMode: 'if-needed',\n });\n }\n }, [active, mode, ref]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,iBAAiB,cAAqC,KAAK;AAEjE,MAAM,gBAAgB,cAKZ,KAAK;AAEf,SAAgB,gBAAgB,EAC9B,mBAAmB,GACnB,UACA,YACuB;CACvB,MAAM,kBAAkB,OAAO,KAAK;CACpC,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CACvC,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,WAAW,aAAa;CAC9B,MAAM,OAAa,cAAc,kBAAkB,GAAG,WAAW;AAEjE,aAAY,gBAAgB;AAC1B,MAAI,gBAAgB,QAClB,SAAQ,MAAM;AAEhB,kBAAgB,UAAU;GAC1B;AAEF,QACE,oBAAC;EACC,OAAO,eACE;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,GACD;GAAC;GAAM;GAAW;GAAkB;GAAU;GAAK,CACpD;EAEA;GACc;;AAIrB,SAAgB,aAA6B;CAC3C,MAAM,MAAM,IAAI,eAAe;AAC/B,KAAI,CAAC,IACH,OAAM,IAAI,MACR,mHACD;AAEH,QAAO;;AAGT,SAAgB,YAAY;AAC1B,QAAO,IAAI,cAAc;;AAG3B,SAAgB,iBAAiB;AAC/B,QAAO,IAAI,cAAc,EAAE,SAAS;;AAGtC,SAAgB,eAAe,EAC7B,YASC;CACD,MAAM,EAAE,WAAW,SA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,YAAY;AAEhD,QACE,oBAAC;EACC,MAAK;EACL,cAAW;EACX,kBAAgB;EAChB,eAAe;AACb,iBAAc,SAAS,CAAC,KAAK;;EAE/B,GAAI;YAEH,MAAM;GACA;;;;;AAOb,SAAgB,cAAc,QAAiB,KAAoC;CACjF,MAAM,EAAE,SAAS,YAAY;AAE7B,iBAAgB;AACd,MAAI,UAAU,IAAI,QAChB,gBAAe,IAAI,SAAS;GAC1B,UAAU,SAAS,eAAe,SAAS,WAAW,sBAAsB,aAAa;GACzF,YAAY;GACb,CAAC;IAEH;EAAC;EAAQ;EAAM;EAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../../../src/components/sidebar/base.tsx"],"sourcesContent":["'use client';\nimport { ChevronDown, ExternalLink } from 'lucide-react';\nimport {\n type ComponentProps,\n createContext,\n type PointerEvent,\n type ReactNode,\n type RefObject,\n use,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport Link, { type LinkProps } from 'fumadocs-core/link';\nimport { useOnChange } from 'fumadocs-core/utils/use-on-change';\nimport { cn } from '@/utils/cn';\nimport { ScrollArea, type ScrollAreaProps, ScrollViewport } from '@/components/ui/scroll-area';\nimport {\n Collapsible,\n CollapsibleContent,\n type CollapsibleContentProps,\n CollapsibleTrigger,\n type CollapsibleTriggerProps,\n} from '@/components/ui/collapsible';\nimport { useMediaQuery } from 'fumadocs-core/utils/use-media-query';\nimport scrollIntoView from 'scroll-into-view-if-needed';\nimport { usePathname } from 'fumadocs-core/framework';\nimport ReactDOM from 'react-dom';\n\ninterface SidebarContext {\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n collapsed: boolean;\n setCollapsed: React.Dispatch<React.SetStateAction<boolean>>;\n\n /**\n * When set to false, don't close the sidebar when navigate to another page\n */\n closeOnRedirect: RefObject<boolean>;\n defaultOpenLevel: number;\n prefetch?: boolean;\n mode: Mode;\n}\n\nexport interface SidebarProviderProps {\n /**\n * Open folders by default if their level is lower or equal to a specific level\n * (Starting from 1)\n *\n * @defaultValue 0\n */\n defaultOpenLevel?: number;\n\n /**\n * Prefetch links, default behaviour depends on your React.js framework.\n */\n prefetch?: boolean;\n\n children?: ReactNode;\n}\n\ntype Mode = 'drawer' | 'full';\n\nconst SidebarContext = createContext<SidebarContext | null>(null);\n\nconst FolderContext = createContext<{\n open: boolean;\n setOpen: React.Dispatch<React.SetStateAction<boolean>>;\n depth: number;\n collapsible: boolean;\n} | null>(null);\n\nexport function SidebarProvider({\n defaultOpenLevel = 0,\n prefetch,\n children,\n}: SidebarProviderProps) {\n const closeOnRedirect = useRef(true);\n const [open, setOpen] = useState(false);\n const [collapsed, setCollapsed] = useState(false);\n const pathname = usePathname();\n const mode: Mode = useMediaQuery('(width < 768px)') ? 'drawer' : 'full';\n\n useOnChange(pathname, () => {\n if (closeOnRedirect.current) {\n setOpen(false);\n }\n closeOnRedirect.current = true;\n });\n\n return (\n <SidebarContext\n value={useMemo(\n () => ({\n open,\n setOpen,\n collapsed,\n setCollapsed,\n closeOnRedirect,\n defaultOpenLevel,\n prefetch,\n mode,\n }),\n [open, collapsed, defaultOpenLevel, prefetch, mode],\n )}\n >\n {children}\n </SidebarContext>\n );\n}\n\nexport function useSidebar(): SidebarContext {\n const ctx = use(SidebarContext);\n if (!ctx)\n throw new Error(\n 'Missing SidebarContext, make sure you have wrapped the component in <DocsLayout /> and the context is available.',\n );\n\n return ctx;\n}\n\nexport function useFolder() {\n return use(FolderContext);\n}\n\nexport function useFolderDepth() {\n return use(FolderContext)?.depth ?? 0;\n}\n\nexport function SidebarContent({\n children,\n}: {\n children: (state: {\n ref: RefObject<HTMLElement | null>;\n collapsed: boolean;\n hovered: boolean;\n onPointerEnter: (event: PointerEvent) => void;\n onPointerLeave: (event: PointerEvent) => void;\n }) => ReactNode;\n}) {\n const { collapsed, mode } = useSidebar();\n const [hover, setHover] = useState(false);\n const ref = useRef<HTMLElement>(null);\n const timerRef = useRef(0);\n\n useOnChange(collapsed, () => {\n if (collapsed) setHover(false);\n });\n\n if (mode !== 'full') return;\n\n function shouldIgnoreHover(e: PointerEvent): boolean {\n const element = ref.current;\n if (!element) return true;\n\n return !collapsed || e.pointerType === 'touch' || element.getAnimations().length > 0;\n }\n\n return children({\n ref,\n collapsed,\n hovered: hover,\n onPointerEnter(e) {\n if (shouldIgnoreHover(e)) return;\n window.clearTimeout(timerRef.current);\n setHover(true);\n },\n onPointerLeave(e) {\n if (shouldIgnoreHover(e)) return;\n window.clearTimeout(timerRef.current);\n\n timerRef.current = window.setTimeout(\n () => setHover(false),\n // if mouse is leaving the viewport, add a close delay\n Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500,\n );\n },\n });\n}\n\nexport function SidebarDrawerOverlay(props: ComponentProps<'div'>) {\n const { open, setOpen, mode } = useSidebar();\n const [hidden, setHidden] = useState(!open);\n\n if (open && hidden) setHidden(false);\n if (mode !== 'drawer' || hidden) return;\n return (\n <div\n data-state={open ? 'open' : 'closed'}\n onClick={() => setOpen(false)}\n onAnimationEnd={() => {\n if (!open) ReactDOM.flushSync(() => setHidden(true));\n }}\n {...props}\n />\n );\n}\n\nexport function SidebarDrawerContent({ className, children, ...props }: ComponentProps<'aside'>) {\n const { open, mode } = useSidebar();\n const [hidden, setHidden] = useState(!open);\n\n if (open && hidden) setHidden(false);\n if (mode !== 'drawer') return;\n return (\n <aside\n id=\"nd-sidebar-mobile\"\n data-state={open ? 'open' : 'closed'}\n className={cn(hidden && 'invisible', className)}\n onAnimationEnd={() => {\n if (!open) ReactDOM.flushSync(() => setHidden(true));\n }}\n {...props}\n >\n {children}\n </aside>\n );\n}\n\nexport function SidebarViewport({ className, ...props }: ScrollAreaProps) {\n return (\n <ScrollArea\n className={(s) =>\n cn('min-h-0 flex-1', typeof className === 'function' ? className(s) : className)\n }\n {...props}\n >\n <ScrollViewport\n className=\"p-4 overscroll-contain\"\n style={\n {\n maskImage:\n 'linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)',\n } as object\n }\n >\n {props.children}\n </ScrollViewport>\n </ScrollArea>\n );\n}\n\nexport function SidebarSeparator(props: ComponentProps<'p'>) {\n const depth = useFolderDepth();\n return (\n <p\n {...props}\n className={cn(\n 'inline-flex items-center gap-2 mb-1.5 px-2 mt-6 empty:mb-0',\n depth === 0 && 'first:mt-0',\n props.className,\n )}\n >\n {props.children}\n </p>\n );\n}\n\nexport function SidebarItem({\n icon,\n active = false,\n children,\n ...props\n}: LinkProps & {\n active?: boolean;\n icon?: ReactNode;\n}) {\n const ref = useRef<HTMLAnchorElement>(null);\n const { prefetch } = useSidebar();\n\n useAutoScroll(active, ref);\n\n return (\n <Link ref={ref} data-active={active} prefetch={prefetch} {...props}>\n {icon ?? (props.external ? <ExternalLink /> : null)}\n {children}\n </Link>\n );\n}\n\nexport function SidebarFolder({\n defaultOpen: defaultOpenProp,\n collapsible = true,\n active = false,\n children,\n ...props\n}: ComponentProps<'div'> & {\n active?: boolean;\n defaultOpen?: boolean;\n collapsible?: boolean;\n}) {\n const { defaultOpenLevel } = useSidebar();\n const depth = useFolderDepth() + 1;\n const defaultOpen =\n collapsible === false || active || (defaultOpenProp ?? defaultOpenLevel >= depth);\n const [open, setOpen] = useState(defaultOpen);\n\n useOnChange(defaultOpen, (v) => {\n if (v) setOpen(v);\n });\n\n return (\n <Collapsible open={open} onOpenChange={setOpen} disabled={!collapsible} {...props}>\n <FolderContext\n value={useMemo(() => ({ open, setOpen, depth, collapsible }), [collapsible, depth, open])}\n >\n {children}\n </FolderContext>\n </Collapsible>\n );\n}\n\nexport function SidebarFolderTrigger({ children, ...props }: CollapsibleTriggerProps) {\n const { open, collapsible } = use(FolderContext)!;\n\n if (collapsible) {\n return (\n <CollapsibleTrigger {...props}>\n {children}\n <ChevronDown\n data-icon\n className={cn('ms-auto transition-transform', !open && '-rotate-90 rtl:rotate-90')}\n />\n </CollapsibleTrigger>\n );\n }\n\n return <div {...(props as ComponentProps<'div'>)}>{children}</div>;\n}\n\nexport function SidebarFolderLink({\n children,\n active = false,\n ...props\n}: LinkProps & {\n active?: boolean;\n}) {\n const ref = useRef<HTMLAnchorElement>(null);\n const { open, setOpen, collapsible } = use(FolderContext)!;\n const { prefetch } = useSidebar();\n\n useAutoScroll(active, ref);\n\n return (\n <Link\n ref={ref}\n data-active={active}\n onClick={(e) => {\n if (!collapsible) return;\n\n if (e.target instanceof Element && e.target.matches('[data-icon], [data-icon] *')) {\n setOpen(!open);\n e.preventDefault();\n } else {\n setOpen(active ? !open : true);\n }\n }}\n prefetch={prefetch}\n {...props}\n >\n {children}\n {collapsible && (\n <ChevronDown\n data-icon\n className={cn('ms-auto transition-transform', !open && '-rotate-90 rtl:rotate-90')}\n />\n )}\n </Link>\n );\n}\n\nexport function SidebarFolderContent(props: CollapsibleContentProps) {\n return <CollapsibleContent {...props}>{props.children}</CollapsibleContent>;\n}\n\nexport function SidebarTrigger({ children, ...props }: ComponentProps<'button'>) {\n const { setOpen } = useSidebar();\n\n return (\n <button aria-label=\"Open Sidebar\" onClick={() => setOpen((prev) => !prev)} {...props}>\n {children}\n </button>\n );\n}\n\nexport function SidebarCollapseTrigger(props: ComponentProps<'button'>) {\n const { collapsed, setCollapsed } = useSidebar();\n\n return (\n <button\n type=\"button\"\n aria-label=\"Collapse Sidebar\"\n data-collapsed={collapsed}\n onClick={() => {\n setCollapsed((prev) => !prev);\n }}\n {...props}\n >\n {props.children}\n </button>\n );\n}\n\n/**\n * scroll to the element if `active` is true\n */\nexport function useAutoScroll(active: boolean, ref: RefObject<HTMLElement | null>) {\n const { mode } = useSidebar();\n\n useEffect(() => {\n if (active && ref.current) {\n scrollIntoView(ref.current, {\n boundary: document.getElementById(mode === 'drawer' ? 'nd-sidebar-mobile' : 'nd-sidebar'),\n scrollMode: 'if-needed',\n });\n }\n }, [active, mode, ref]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,iBAAiB,cAAqC,KAAK;AAEjE,MA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$1, SidebarDrawerContent, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider, SidebarTrigger as SidebarTrigger$1, SidebarViewport as SidebarViewport$1 } from "../../components/sidebar/base.js";
|
|
2
2
|
import { LinkItemType } from "../../utils/link-item.js";
|
|
3
3
|
import { SidebarPageTreeComponents } from "../../components/sidebar/page-tree.js";
|
|
4
|
-
import "../shared/index.js";
|
|
5
4
|
import * as react from "react";
|
|
6
5
|
import { ComponentProps } from "react";
|
|
7
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","names":[],"sources":["../../../src/layouts/docs/sidebar.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","names":[],"sources":["../../../src/layouts/docs/sidebar.tsx"],"mappings":";;;;;;;;iBAgCgB,OAAA,CAAQ,KAAA,EAAO,cAAA,QAAsB,eAAA,IAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI1D,aAAA,CAAc,KAAA,EAAO,cAAA,QAAsB,eAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI9D,sBAAA,CAAuB,KAAA,EAAO,cAAA,QAAsB,wBAAA,IAA4B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAIhF,eAAA,CAAgB,KAAA,EAAO,cAAA,QAAsB,iBAAA,IAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAIlE,cAAA,CAAe,KAAA,EAAO,cAAA,QAAsB,gBAAA,IAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAIhE,cAAA,CAAA;EACd,GAAA,EAAK,OAAA;EACL,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,YAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA8DV,aAAA,CAAA;EACd,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,oBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiBnC,gBAAA,CAAA;EAAmB,SAAA;EAAW,KAAA;EAAO,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiB9E,WAAA,CAAA;EACd,SAAA;EACA,KAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,aAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiB1B,oBAAA,CAAA;EACd,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,sBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAuBnC,iBAAA,CAAA;EACd,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,mBAAA,IAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiBhC,oBAAA,CAAA;EACd,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,sBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAoBtC,eAAA,GAAe,UAAA,EAAA,OAAA,CAO1B,yBAAA,MAP0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cASf,eAAA;EAAe,IAAA;EAAA,GAAA;AAAA,GAAA,KAAA,CAAA,cAAA,CAAA,WAAA;gBAAA,YAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider, SidebarTrigger as SidebarTrigger$1, SidebarViewport as SidebarViewport$1 } from "../../components/sidebar/base.js";
|
|
2
2
|
import { LinkItemType } from "../../utils/link-item.js";
|
|
3
3
|
import { SidebarPageTreeComponents } from "../../components/sidebar/page-tree.js";
|
|
4
|
-
import "../shared/index.js";
|
|
5
4
|
import * as react from "react";
|
|
6
5
|
import { ComponentProps } from "react";
|
|
7
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","names":[],"sources":["../../../src/layouts/flux/sidebar.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","names":[],"sources":["../../../src/layouts/flux/sidebar.tsx"],"mappings":";;;;;;;;iBAoCgB,OAAA,CAAQ,KAAA,EAAO,cAAA,QAAsB,eAAA,IAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI1D,aAAA,CAAc,KAAA,EAAO,cAAA,QAAsB,eAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI9D,sBAAA,CAAuB,KAAA,EAAO,cAAA,QAAsB,wBAAA,IAA4B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAIhF,eAAA,CAAgB,KAAA,EAAO,cAAA,QAAsB,iBAAA,IAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAIlE,cAAA,CAAe,KAAA,EAAO,cAAA,QAAsB,gBAAA,IAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAIhE,cAAA,CAAA;EACd,GAAA,EAAK,OAAA;EACL,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,YAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA6EV,gBAAA,CAAA;EAAmB,SAAA;EAAW,KAAA;EAAO,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiB9E,WAAA,CAAA;EACd,SAAA;EACA,KAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,aAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiB1B,oBAAA,CAAA;EACd,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,sBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAuBnC,iBAAA,CAAA;EACd,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,mBAAA,IAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiBhC,oBAAA,CAAA;EACd,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,sBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAoCtC,eAAA,GAAe,UAAA,EAAA,OAAA,CAO1B,yBAAA,MAP0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cASf,eAAA;EAAe,IAAA;EAAA,GAAA;AAAA,GAAA,KAAA,CAAA,cAAA,CAAA,WAAA;gBAAA,YAAA"}
|
|
@@ -4,7 +4,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
4
4
|
|
|
5
5
|
//#region src/layouts/home/client.d.ts
|
|
6
6
|
declare const navItemVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "icon" | "main" | "button" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
9
9
|
declare function Header({
|
|
10
10
|
nav,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/layouts/home/not-found.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* the default not found page content, please make your own if you want to customise it.
|
|
6
|
+
*/
|
|
7
|
+
declare function DefaultNotFound(): react_jsx_runtime0.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DefaultNotFound };
|
|
10
|
+
//# sourceMappingURL=not-found.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.d.ts","names":[],"sources":["../../../src/layouts/home/not-found.tsx"],"mappings":";;;;;;iBAQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { buttonVariants } from "../../components/ui/button.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import Link from "fumadocs-core/link";
|
|
5
|
+
import { HomeIcon } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
//#region src/layouts/home/not-found.tsx
|
|
8
|
+
/**
|
|
9
|
+
* the default not found page content, please make your own if you want to customise it.
|
|
10
|
+
*/
|
|
11
|
+
function DefaultNotFound() {
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: "flex flex-col px-8 justify-center flex-1 text-center items-center gap-4",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx("h1", {
|
|
16
|
+
className: "text-6xl font-bold text-fd-muted-foreground",
|
|
17
|
+
children: "404"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("h2", {
|
|
20
|
+
className: "text-2xl font-semibold",
|
|
21
|
+
children: "Page Not Found"
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsx("p", {
|
|
24
|
+
className: "text-fd-muted-foreground max-w-md",
|
|
25
|
+
children: "The page you are looking for might have been removed, had its name changed, or is temporarily unavailable."
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsxs(Link, {
|
|
28
|
+
href: "/",
|
|
29
|
+
className: cn(buttonVariants({
|
|
30
|
+
className: "mt-4 gap-1.5",
|
|
31
|
+
variant: "primary"
|
|
32
|
+
})),
|
|
33
|
+
children: [/* @__PURE__ */ jsx(HomeIcon, { className: "size-4" }), "Back to Home"]
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { DefaultNotFound };
|
|
41
|
+
//# sourceMappingURL=not-found.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found.js","names":[],"sources":["../../../src/layouts/home/not-found.tsx"],"sourcesContent":["import { buttonVariants } from '@/components/ui/button';\nimport { cn } from '@/utils/cn';\nimport Link from 'fumadocs-core/link';\nimport { HomeIcon } from 'lucide-react';\n\n/**\n * the default not found page content, please make your own if you want to customise it.\n */\nexport function DefaultNotFound() {\n return (\n <div className=\"flex flex-col px-8 justify-center flex-1 text-center items-center gap-4\">\n <h1 className=\"text-6xl font-bold text-fd-muted-foreground\">404</h1>\n <h2 className=\"text-2xl font-semibold\">Page Not Found</h2>\n <p className=\"text-fd-muted-foreground max-w-md\">\n The page you are looking for might have been removed, had its name changed, or is\n temporarily unavailable.\n </p>\n <Link\n href=\"/\"\n className={cn(\n buttonVariants({\n className: 'mt-4 gap-1.5',\n variant: 'primary',\n }),\n )}\n >\n <HomeIcon className=\"size-4\" />\n Back to Home\n </Link>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,kBAAkB;AAChC,QACE,qBAAC;EAAI,WAAU;;GACb,oBAAC;IAAG,WAAU;cAA8C;KAAQ;GACpE,oBAAC;IAAG,WAAU;cAAyB;KAAmB;GAC1D,oBAAC;IAAE,WAAU;cAAoC;KAG7C;GACJ,qBAAC;IACC,MAAK;IACL,WAAW,GACT,eAAe;KACb,WAAW;KACX,SAAS;KACV,CAAC,CACH;eAED,oBAAC,YAAS,WAAU,WAAW;KAE1B;;GACH"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarDrawerContent, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider, SidebarTrigger as SidebarTrigger$1, SidebarViewport as SidebarViewport$1 } from "../../components/sidebar/base.js";
|
|
2
2
|
import { LinkItemType } from "../../utils/link-item.js";
|
|
3
3
|
import { SidebarPageTreeComponents } from "../../components/sidebar/page-tree.js";
|
|
4
|
-
import "../shared/index.js";
|
|
5
4
|
import * as react from "react";
|
|
6
5
|
import { ComponentProps } from "react";
|
|
7
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","names":[],"sources":["../../../src/layouts/notebook/sidebar.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","names":[],"sources":["../../../src/layouts/notebook/sidebar.tsx"],"mappings":";;;;;;;;cA+BmB,OAAA,SAAO,eAAA,EAAA,aAAA,SACX,eAAA,EAAA,sBAAA,SACS,wBAAA,EAAA,eAAA,SACP,iBAAA,EAAA,cAAA,SACD,gBAAA;AAAA,iBAGA,cAAA,CAAA;EACd,GAAA,EAAK,OAAA;EACL,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,YAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA+CV,aAAA,CAAA;EACd,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,oBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiBnC,gBAAA,CAAA;EAAmB,SAAA;EAAW,KAAA;EAAO,QAAA;EAAA,GAAa;AAAA,GAAS,cAAA,QAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiB9E,WAAA,CAAA;EACd,SAAA;EACA,KAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,aAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiB1B,oBAAA,CAAA;EACd,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,sBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAuBnC,iBAAA,CAAA;EACd,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,mBAAA,IAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiBhC,oBAAA,CAAA;EACd,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,QAAsB,sBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAmBtC,eAAA,GAAe,UAAA,EAAA,OAAA,CAO1B,yBAAA,MAP0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cASf,eAAA;EAAe,IAAA;EAAA,GAAA;AAAA,GAAA,KAAA,CAAA,cAAA,CAAA,WAAA;gBAAA,YAAA"}
|
package/dist/style.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
--spacing: 0.25rem;
|
|
11
11
|
--breakpoint-sm: 40rem;
|
|
12
12
|
--container-sm: 24rem;
|
|
13
|
+
--container-md: 28rem;
|
|
13
14
|
--text-xs: 0.75rem;
|
|
14
15
|
--text-xs--line-height: calc(1 / 0.75);
|
|
15
16
|
--text-sm: 0.875rem;
|
|
@@ -19,9 +20,13 @@
|
|
|
19
20
|
--text-lg: 1.125rem;
|
|
20
21
|
--text-lg--line-height: calc(1.75 / 1.125);
|
|
21
22
|
--text-2xl: 1.5rem;
|
|
23
|
+
--text-2xl--line-height: calc(2 / 1.5);
|
|
22
24
|
--text-3xl: 1.875rem;
|
|
25
|
+
--text-6xl: 3.75rem;
|
|
26
|
+
--text-6xl--line-height: 1;
|
|
23
27
|
--font-weight-medium: 500;
|
|
24
28
|
--font-weight-semibold: 600;
|
|
29
|
+
--font-weight-bold: 700;
|
|
25
30
|
--radius-sm: 0.25rem;
|
|
26
31
|
--radius-md: 0.375rem;
|
|
27
32
|
--radius-lg: 0.5rem;
|
|
@@ -252,15 +257,15 @@
|
|
|
252
257
|
.fd-steps {
|
|
253
258
|
counter-reset: step;
|
|
254
259
|
position: relative;
|
|
255
|
-
margin-
|
|
256
|
-
border-
|
|
257
|
-
border-
|
|
258
|
-
padding-
|
|
260
|
+
margin-inline-start: calc(var(--spacing) * 2);
|
|
261
|
+
border-inline-start-style: var(--tw-border-style);
|
|
262
|
+
border-inline-start-width: 1px;
|
|
263
|
+
padding-inline-start: calc(var(--spacing) * 6);
|
|
259
264
|
@media (width >= 40rem) {
|
|
260
|
-
margin-
|
|
265
|
+
margin-inline-start: calc(var(--spacing) * 4);
|
|
261
266
|
}
|
|
262
267
|
@media (width >= 40rem) {
|
|
263
|
-
padding-
|
|
268
|
+
padding-inline-start: calc(var(--spacing) * 7);
|
|
264
269
|
}
|
|
265
270
|
}
|
|
266
271
|
.absolute {
|
|
@@ -845,6 +850,9 @@
|
|
|
845
850
|
.mt-1 {
|
|
846
851
|
margin-top: calc(var(--spacing) * 1);
|
|
847
852
|
}
|
|
853
|
+
.mt-4 {
|
|
854
|
+
margin-top: calc(var(--spacing) * 4);
|
|
855
|
+
}
|
|
848
856
|
.mt-6 {
|
|
849
857
|
margin-top: calc(var(--spacing) * 6);
|
|
850
858
|
}
|
|
@@ -1103,6 +1111,9 @@
|
|
|
1103
1111
|
.max-w-full {
|
|
1104
1112
|
max-width: 100%;
|
|
1105
1113
|
}
|
|
1114
|
+
.max-w-md {
|
|
1115
|
+
max-width: var(--container-md);
|
|
1116
|
+
}
|
|
1106
1117
|
.max-w-screen-sm {
|
|
1107
1118
|
max-width: var(--breakpoint-sm);
|
|
1108
1119
|
}
|
|
@@ -1538,6 +1549,9 @@
|
|
|
1538
1549
|
.px-6 {
|
|
1539
1550
|
padding-inline: calc(var(--spacing) * 6);
|
|
1540
1551
|
}
|
|
1552
|
+
.px-8 {
|
|
1553
|
+
padding-inline: calc(var(--spacing) * 8);
|
|
1554
|
+
}
|
|
1541
1555
|
.px-px {
|
|
1542
1556
|
padding-inline: 1px;
|
|
1543
1557
|
}
|
|
@@ -1646,6 +1660,14 @@
|
|
|
1646
1660
|
.font-mono {
|
|
1647
1661
|
font-family: var(--font-mono);
|
|
1648
1662
|
}
|
|
1663
|
+
.text-2xl {
|
|
1664
|
+
font-size: var(--text-2xl);
|
|
1665
|
+
line-height: var(--tw-leading, var(--text-2xl--line-height));
|
|
1666
|
+
}
|
|
1667
|
+
.text-6xl {
|
|
1668
|
+
font-size: var(--text-6xl);
|
|
1669
|
+
line-height: var(--tw-leading, var(--text-6xl--line-height));
|
|
1670
|
+
}
|
|
1649
1671
|
.text-base {
|
|
1650
1672
|
font-size: var(--text-base);
|
|
1651
1673
|
line-height: var(--tw-leading, var(--text-base--line-height));
|
|
@@ -1675,6 +1697,10 @@
|
|
|
1675
1697
|
--tw-leading: 1;
|
|
1676
1698
|
line-height: 1;
|
|
1677
1699
|
}
|
|
1700
|
+
.font-bold {
|
|
1701
|
+
--tw-font-weight: var(--font-weight-bold);
|
|
1702
|
+
font-weight: var(--font-weight-bold);
|
|
1703
|
+
}
|
|
1678
1704
|
.font-medium {
|
|
1679
1705
|
--tw-font-weight: var(--font-weight-medium);
|
|
1680
1706
|
font-weight: var(--font-weight-medium);
|
|
@@ -2726,6 +2752,11 @@
|
|
|
2726
2752
|
scale: var(--tw-scale-x) var(--tw-scale-y);
|
|
2727
2753
|
}
|
|
2728
2754
|
}
|
|
2755
|
+
.rtl\:rotate-90 {
|
|
2756
|
+
&:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) {
|
|
2757
|
+
rotate: 90deg;
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2729
2760
|
.rtl\:rotate-180 {
|
|
2730
2761
|
&:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) {
|
|
2731
2762
|
rotate: 180deg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fumadocs/base-ui",
|
|
3
|
-
"version": "16.6.
|
|
3
|
+
"version": "16.6.10",
|
|
4
4
|
"description": "The Base UI version of Fumadocs UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"types": "./dist/layouts/home/index.d.ts",
|
|
33
33
|
"import": "./dist/layouts/home/index.js"
|
|
34
34
|
},
|
|
35
|
+
"./layouts/home/not-found": {
|
|
36
|
+
"types": "./dist/layouts/home/not-found.d.ts",
|
|
37
|
+
"import": "./dist/layouts/home/not-found.js"
|
|
38
|
+
},
|
|
35
39
|
"./layouts/home/navbar": {
|
|
36
40
|
"types": "./dist/layouts/home/navbar.d.ts",
|
|
37
41
|
"import": "./dist/layouts/home/navbar.js"
|
|
@@ -100,8 +104,8 @@
|
|
|
100
104
|
"dependencies": {
|
|
101
105
|
"@base-ui/react": "^1.2.0",
|
|
102
106
|
"class-variance-authority": "^0.7.1",
|
|
103
|
-
"lucide-react": "^0.
|
|
104
|
-
"motion": "^12.
|
|
107
|
+
"lucide-react": "^0.577.0",
|
|
108
|
+
"motion": "^12.35.0",
|
|
105
109
|
"next-themes": "^0.4.6",
|
|
106
110
|
"react-medium-image-zoom": "^5.4.1",
|
|
107
111
|
"react-remove-scroll": "^2.7.2",
|
|
@@ -122,17 +126,17 @@
|
|
|
122
126
|
"unified": "^11.0.5",
|
|
123
127
|
"@fumadocs/cli": "1.2.5",
|
|
124
128
|
"eslint-config-custom": "0.0.0",
|
|
125
|
-
"fumadocs-core": "16.6.
|
|
129
|
+
"fumadocs-core": "16.6.10",
|
|
126
130
|
"tsconfig": "0.0.0"
|
|
127
131
|
},
|
|
128
132
|
"peerDependencies": {
|
|
129
|
-
"@takumi-rs/image-response": "
|
|
133
|
+
"@takumi-rs/image-response": "*",
|
|
130
134
|
"@types/react": "*",
|
|
131
135
|
"next": "16.x.x",
|
|
132
136
|
"react": "^19.2.0",
|
|
133
137
|
"react-dom": "^19.2.0",
|
|
134
138
|
"tailwindcss": "^4.0.0",
|
|
135
|
-
"fumadocs-core": "16.6.
|
|
139
|
+
"fumadocs-core": "16.6.10"
|
|
136
140
|
},
|
|
137
141
|
"peerDependenciesMeta": {
|
|
138
142
|
"next": {
|