fumadocs-ui 13.4.10 → 14.0.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.
- 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-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-HOIRMHZT.js → chunk-UQIRU7MP.js} +8 -2
- 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.d.ts +1 -1
- 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 +26 -0
- package/dist/layouts/docs.client.js +200 -0
- package/dist/layouts/docs.d.ts +29 -0
- package/dist/layouts/docs.js +187 -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 +55 -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 +0 -1
- 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 +6 -5
- package/dist/page.js +63 -51
- package/dist/provider.d.ts +1 -2
- package/dist/provider.js +3 -4
- package/dist/shared-ElIzX-sQ.d.ts +152 -0
- package/dist/{sidebar-DwBSl7jC.d.ts → sidebar-HwpSmOKR.d.ts} +7 -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 +31 -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
package/dist/chunk-P4HLRHHV.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// src/utils/use-toc-thumb.ts
|
|
2
|
-
import { useLayoutEffect, useState } from "react";
|
|
3
|
-
import * as Primitive from "fumadocs-core/toc";
|
|
4
|
-
function useTocThumb(containerRef) {
|
|
5
|
-
const active = Primitive.useActiveAnchors();
|
|
6
|
-
const [pos, setPos] = useState([0, 0]);
|
|
7
|
-
useLayoutEffect(() => {
|
|
8
|
-
const container = containerRef.current;
|
|
9
|
-
if (active.length === 0 || !container || container.clientHeight === 0) {
|
|
10
|
-
setPos([0, 0]);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
let upper = Number.MAX_VALUE, lower = 0;
|
|
14
|
-
for (const item of active) {
|
|
15
|
-
const element = container.querySelector(
|
|
16
|
-
`a[href="#${item}"]`
|
|
17
|
-
);
|
|
18
|
-
if (!element) continue;
|
|
19
|
-
const styles = getComputedStyle(element);
|
|
20
|
-
upper = Math.min(
|
|
21
|
-
upper,
|
|
22
|
-
element.offsetTop + parseFloat(styles.paddingTop)
|
|
23
|
-
);
|
|
24
|
-
lower = Math.max(
|
|
25
|
-
lower,
|
|
26
|
-
element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom)
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
setPos([upper, lower - upper]);
|
|
30
|
-
}, [active, containerRef]);
|
|
31
|
-
return pos;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
useTocThumb
|
|
36
|
-
};
|
package/dist/chunk-UOD2T27N.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/utils/shared.ts
|
|
2
|
-
var defaultImageSizes = "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px";
|
|
3
|
-
function isActive(url, pathname, nested = true) {
|
|
4
|
-
return url === pathname || nested && pathname.startsWith(`${url}/`);
|
|
5
|
-
}
|
|
6
|
-
function replaceOrDefault(obj, def) {
|
|
7
|
-
if (obj?.enabled === false) return;
|
|
8
|
-
if (obj?.component !== void 0) return obj.component;
|
|
9
|
-
return def;
|
|
10
|
-
}
|
|
11
|
-
function hasActive(items, url) {
|
|
12
|
-
return items.some((item) => {
|
|
13
|
-
if (item.type === "page") {
|
|
14
|
-
return item.url === url;
|
|
15
|
-
}
|
|
16
|
-
if (item.type === "folder")
|
|
17
|
-
return item.index?.url === url || hasActive(item.children, url);
|
|
18
|
-
return false;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
defaultImageSizes,
|
|
24
|
-
isActive,
|
|
25
|
-
replaceOrDefault,
|
|
26
|
-
hasActive
|
|
27
|
-
};
|
package/dist/chunk-WLTWFYQA.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
twMerge
|
|
3
|
-
} from "./chunk-TK3TM3MR.js";
|
|
4
|
-
|
|
5
|
-
// src/components/card.tsx
|
|
6
|
-
import Link from "fumadocs-core/link";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
function Cards(props) {
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
-
"div",
|
|
11
|
-
{
|
|
12
|
-
...props,
|
|
13
|
-
className: twMerge("grid grid-cols-1 gap-4 sm:grid-cols-2", props.className),
|
|
14
|
-
children: props.children
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
function Card({
|
|
19
|
-
icon,
|
|
20
|
-
title,
|
|
21
|
-
description,
|
|
22
|
-
...props
|
|
23
|
-
}) {
|
|
24
|
-
return /* @__PURE__ */ jsxs(
|
|
25
|
-
Link,
|
|
26
|
-
{
|
|
27
|
-
...props,
|
|
28
|
-
className: twMerge(
|
|
29
|
-
"not-prose block rounded-lg border bg-fd-card p-4 text-sm text-fd-card-foreground shadow-md transition-colors hover:bg-fd-accent/80",
|
|
30
|
-
props.className
|
|
31
|
-
),
|
|
32
|
-
children: [
|
|
33
|
-
icon ? /* @__PURE__ */ jsx("div", { className: "mb-2 w-fit rounded-md border bg-fd-muted p-2 text-fd-muted-foreground [&_svg]:size-4", children: icon }) : null,
|
|
34
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-1 font-medium", children: title }),
|
|
35
|
-
description ? /* @__PURE__ */ jsx("p", { className: "text-fd-muted-foreground", children: description }) : null
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
Cards,
|
|
43
|
-
Card
|
|
44
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { S as SharedNavProps } from './layout.shared-DEQFTB9M.js';
|
|
2
|
-
export { a as LinksMenu } from './layout.shared-DEQFTB9M.js';
|
|
3
|
-
import { S as SidebarProps } from './sidebar-DwBSl7jC.js';
|
|
4
|
-
export { a as Sidebar } from './sidebar-DwBSl7jC.js';
|
|
5
|
-
export { T as TreeContextProvider } from './tree-CrKzI9Nz.js';
|
|
6
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
7
|
-
export { LanguageToggle } from './components/layout/language-toggle.js';
|
|
8
|
-
import 'fumadocs-core/server';
|
|
9
|
-
import '@radix-ui/react-popover';
|
|
10
|
-
|
|
11
|
-
declare function ThemeToggle({ className, ...props }: ButtonHTMLAttributes<HTMLButtonElement>): React.ReactElement;
|
|
12
|
-
|
|
13
|
-
declare function DynamicSidebar(props: SidebarProps): React.ReactElement;
|
|
14
|
-
|
|
15
|
-
declare function SubNav({ title, url, transparentMode, children, enableSearch, }: SharedNavProps): React.ReactElement;
|
|
16
|
-
declare function SidebarCollapseTrigger(): React.ReactElement;
|
|
17
|
-
|
|
18
|
-
export { DynamicSidebar, SidebarCollapseTrigger, SubNav, ThemeToggle };
|
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
LargeSearchToggle,
|
|
4
|
-
LinkItem,
|
|
5
|
-
LinksMenu,
|
|
6
|
-
NavBox,
|
|
7
|
-
SearchToggle,
|
|
8
|
-
ThemeToggle,
|
|
9
|
-
Title
|
|
10
|
-
} from "./chunk-KCZRDPB4.js";
|
|
11
|
-
import {
|
|
12
|
-
LanguageToggle
|
|
13
|
-
} from "./chunk-NSEJBI4V.js";
|
|
14
|
-
import {
|
|
15
|
-
TreeContextProvider,
|
|
16
|
-
useTreeContext
|
|
17
|
-
} from "./chunk-LSTPTAZ5.js";
|
|
18
|
-
import {
|
|
19
|
-
ScrollArea,
|
|
20
|
-
ScrollViewport
|
|
21
|
-
} from "./chunk-2FLZOPQN.js";
|
|
22
|
-
import "./chunk-CP67AHDD.js";
|
|
23
|
-
import {
|
|
24
|
-
hasActive,
|
|
25
|
-
isActive
|
|
26
|
-
} from "./chunk-UOD2T27N.js";
|
|
27
|
-
import {
|
|
28
|
-
useSearchContext
|
|
29
|
-
} from "./chunk-ET4TW6M5.js";
|
|
30
|
-
import {
|
|
31
|
-
useSidebar
|
|
32
|
-
} from "./chunk-27HFSL7N.js";
|
|
33
|
-
import "./chunk-EFMHXXHW.js";
|
|
34
|
-
import {
|
|
35
|
-
Collapsible,
|
|
36
|
-
CollapsibleContent,
|
|
37
|
-
CollapsibleTrigger
|
|
38
|
-
} from "./chunk-TQJ6YPJ3.js";
|
|
39
|
-
import {
|
|
40
|
-
buttonVariants,
|
|
41
|
-
itemVariants
|
|
42
|
-
} from "./chunk-EDNTYBXS.js";
|
|
43
|
-
import {
|
|
44
|
-
twMerge
|
|
45
|
-
} from "./chunk-TK3TM3MR.js";
|
|
46
|
-
import "./chunk-MLKGABMK.js";
|
|
47
|
-
|
|
48
|
-
// src/docs-layout.client.tsx
|
|
49
|
-
import { SidebarTrigger } from "fumadocs-core/sidebar";
|
|
50
|
-
import { Menu, SidebarIcon as SidebarIcon2, X } from "lucide-react";
|
|
51
|
-
import { useCallback as useCallback3 } from "react";
|
|
52
|
-
|
|
53
|
-
// src/components/layout/sidebar.tsx
|
|
54
|
-
import { ChevronDown, ExternalLinkIcon } from "lucide-react";
|
|
55
|
-
import * as Base from "fumadocs-core/sidebar";
|
|
56
|
-
import { usePathname } from "next/navigation";
|
|
57
|
-
import {
|
|
58
|
-
createContext,
|
|
59
|
-
useCallback,
|
|
60
|
-
useContext,
|
|
61
|
-
useMemo,
|
|
62
|
-
useState
|
|
63
|
-
} from "react";
|
|
64
|
-
import Link from "fumadocs-core/link";
|
|
65
|
-
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
66
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
67
|
-
var defaultComponents = {
|
|
68
|
-
Folder: FolderNode,
|
|
69
|
-
Separator: SeparatorNode,
|
|
70
|
-
Item: PageNode
|
|
71
|
-
};
|
|
72
|
-
var Context = createContext({
|
|
73
|
-
defaultOpenLevel: 0,
|
|
74
|
-
components: defaultComponents,
|
|
75
|
-
prefetch: true
|
|
76
|
-
});
|
|
77
|
-
function Sidebar({
|
|
78
|
-
components,
|
|
79
|
-
defaultOpenLevel = 0,
|
|
80
|
-
items,
|
|
81
|
-
prefetch = true,
|
|
82
|
-
...props
|
|
83
|
-
}) {
|
|
84
|
-
const search = useSearchContext();
|
|
85
|
-
const hasSearch = search.enabled && !props.hideSearch;
|
|
86
|
-
const context = useMemo(
|
|
87
|
-
() => ({
|
|
88
|
-
defaultOpenLevel,
|
|
89
|
-
components: { ...defaultComponents, ...components },
|
|
90
|
-
prefetch
|
|
91
|
-
}),
|
|
92
|
-
[components, defaultOpenLevel, prefetch]
|
|
93
|
-
);
|
|
94
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value: context, children: /* @__PURE__ */ jsxs(
|
|
95
|
-
Base.SidebarList,
|
|
96
|
-
{
|
|
97
|
-
id: "nd-sidebar",
|
|
98
|
-
blockScrollingWidth: 768,
|
|
99
|
-
...props.aside,
|
|
100
|
-
className: twMerge(
|
|
101
|
-
"fixed z-30 flex flex-col bg-fd-card text-sm md:sticky md:top-0 md:h-dvh md:w-[var(--fd-c-sidebar)] md:min-w-[var(--fd-sidebar-width)] md:border-e md:ps-[calc(var(--fd-c-sidebar)-var(--fd-sidebar-width))]",
|
|
102
|
-
"max-md:inset-0 max-md:bg-fd-background/80 max-md:pt-14 max-md:text-[15px] max-md:backdrop-blur-md max-md:data-[open=false]:hidden",
|
|
103
|
-
props.aside?.className
|
|
104
|
-
),
|
|
105
|
-
children: [
|
|
106
|
-
hasSearch || props.banner ? /* @__PURE__ */ jsxs(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
...props.bannerProps,
|
|
110
|
-
className: twMerge(
|
|
111
|
-
"flex flex-col gap-1 px-4 pt-2 md:px-3 md:pt-4",
|
|
112
|
-
props.bannerProps?.className
|
|
113
|
-
),
|
|
114
|
-
children: [
|
|
115
|
-
props.banner,
|
|
116
|
-
hasSearch ? /* @__PURE__ */ jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) : null
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
) : null,
|
|
120
|
-
/* @__PURE__ */ jsx(ViewportContent, { items }),
|
|
121
|
-
props.footer ? /* @__PURE__ */ jsx(
|
|
122
|
-
"div",
|
|
123
|
-
{
|
|
124
|
-
...props.footerProps,
|
|
125
|
-
className: twMerge(
|
|
126
|
-
"flex flex-row items-center border-t py-1 max-md:px-4 md:mx-3",
|
|
127
|
-
props.footerProps?.className
|
|
128
|
-
),
|
|
129
|
-
children: props.footer
|
|
130
|
-
}
|
|
131
|
-
) : null
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
) });
|
|
135
|
-
}
|
|
136
|
-
function ViewportContent({
|
|
137
|
-
items
|
|
138
|
-
}) {
|
|
139
|
-
const { root } = useTreeContext();
|
|
140
|
-
return /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs(
|
|
141
|
-
ScrollViewport,
|
|
142
|
-
{
|
|
143
|
-
style: {
|
|
144
|
-
maskImage: "linear-gradient(to bottom, transparent 2px, white 24px)"
|
|
145
|
-
},
|
|
146
|
-
children: [
|
|
147
|
-
items.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-col px-4 pt-6 md:hidden", children: items.map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, on: "menu" }, i)) }) : null,
|
|
148
|
-
/* @__PURE__ */ jsx(NodeList, { items: root.children, className: "px-4 py-6 md:px-3" })
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
) });
|
|
152
|
-
}
|
|
153
|
-
function NodeList({
|
|
154
|
-
items,
|
|
155
|
-
level = 0,
|
|
156
|
-
...props
|
|
157
|
-
}) {
|
|
158
|
-
const { components } = useContext(Context);
|
|
159
|
-
return /* @__PURE__ */ jsx("div", { ...props, children: items.map((item, i) => {
|
|
160
|
-
const id = `${item.type}_${i.toString()}`;
|
|
161
|
-
switch (item.type) {
|
|
162
|
-
case "separator":
|
|
163
|
-
return /* @__PURE__ */ jsx(components.Separator, { item }, id);
|
|
164
|
-
case "folder":
|
|
165
|
-
return /* @__PURE__ */ jsx(components.Folder, { item, level: level + 1 }, id);
|
|
166
|
-
default:
|
|
167
|
-
return /* @__PURE__ */ jsx(components.Item, { item }, item.url);
|
|
168
|
-
}
|
|
169
|
-
}) });
|
|
170
|
-
}
|
|
171
|
-
function PageNode({
|
|
172
|
-
item: { icon, external = false, url, name }
|
|
173
|
-
}) {
|
|
174
|
-
const pathname = usePathname();
|
|
175
|
-
const active = isActive(url, pathname, false);
|
|
176
|
-
const { prefetch } = useContext(Context);
|
|
177
|
-
return /* @__PURE__ */ jsxs(
|
|
178
|
-
Link,
|
|
179
|
-
{
|
|
180
|
-
href: url,
|
|
181
|
-
external,
|
|
182
|
-
className: twMerge(itemVariants({ active })),
|
|
183
|
-
prefetch,
|
|
184
|
-
children: [
|
|
185
|
-
icon ?? (external ? /* @__PURE__ */ jsx(ExternalLinkIcon, {}) : null),
|
|
186
|
-
name
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
function FolderNode({
|
|
192
|
-
item,
|
|
193
|
-
level
|
|
194
|
-
}) {
|
|
195
|
-
const { defaultOpenLevel, prefetch } = useContext(Context);
|
|
196
|
-
const pathname = usePathname();
|
|
197
|
-
const active = item.index !== void 0 && isActive(item.index.url, pathname, false);
|
|
198
|
-
const childActive = useMemo(
|
|
199
|
-
() => hasActive(item.children, pathname),
|
|
200
|
-
[item.children, pathname]
|
|
201
|
-
);
|
|
202
|
-
const shouldExtend = active || childActive || (item.defaultOpen ?? defaultOpenLevel >= level);
|
|
203
|
-
const [open, setOpen] = useState(shouldExtend);
|
|
204
|
-
useOnChange(shouldExtend, (v) => {
|
|
205
|
-
if (v) setOpen(v);
|
|
206
|
-
});
|
|
207
|
-
const onClick = useCallback(
|
|
208
|
-
(e) => {
|
|
209
|
-
if (
|
|
210
|
-
// clicking on icon
|
|
211
|
-
e.target.hasAttribute("data-icon") || active
|
|
212
|
-
) {
|
|
213
|
-
setOpen((prev) => !prev);
|
|
214
|
-
e.preventDefault();
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
[active]
|
|
218
|
-
);
|
|
219
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
220
|
-
item.icon,
|
|
221
|
-
item.name,
|
|
222
|
-
/* @__PURE__ */ jsx(
|
|
223
|
-
ChevronDown,
|
|
224
|
-
{
|
|
225
|
-
"data-icon": true,
|
|
226
|
-
className: twMerge("ms-auto transition-transform", !open && "-rotate-90")
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
] });
|
|
230
|
-
return /* @__PURE__ */ jsxs(Collapsible, { open, onOpenChange: setOpen, children: [
|
|
231
|
-
item.index ? /* @__PURE__ */ jsx(
|
|
232
|
-
Link,
|
|
233
|
-
{
|
|
234
|
-
className: twMerge(itemVariants({ active })),
|
|
235
|
-
href: item.index.url,
|
|
236
|
-
onClick,
|
|
237
|
-
prefetch,
|
|
238
|
-
children: content
|
|
239
|
-
}
|
|
240
|
-
) : /* @__PURE__ */ jsx(CollapsibleTrigger, { className: twMerge(itemVariants({ active })), children: content }),
|
|
241
|
-
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(
|
|
242
|
-
NodeList,
|
|
243
|
-
{
|
|
244
|
-
className: "ms-2 flex flex-col border-s py-2 ps-2",
|
|
245
|
-
items: item.children,
|
|
246
|
-
level
|
|
247
|
-
}
|
|
248
|
-
) })
|
|
249
|
-
] });
|
|
250
|
-
}
|
|
251
|
-
function SeparatorNode({
|
|
252
|
-
item
|
|
253
|
-
}) {
|
|
254
|
-
return /* @__PURE__ */ jsx("p", { className: "mb-2 mt-8 px-2 font-medium first:mt-0", children: item.name });
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// src/components/layout/dynamic-sidebar.tsx
|
|
258
|
-
import { useCallback as useCallback2, useRef, useState as useState2 } from "react";
|
|
259
|
-
import { SidebarIcon } from "lucide-react";
|
|
260
|
-
import { useOnChange as useOnChange2 } from "fumadocs-core/utils/use-on-change";
|
|
261
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
262
|
-
function DynamicSidebar(props) {
|
|
263
|
-
const { collapsed, setCollapsed } = useSidebar();
|
|
264
|
-
const [hover, setHover] = useState2(false);
|
|
265
|
-
const timerRef = useRef(0);
|
|
266
|
-
const closeTimeRef = useRef(0);
|
|
267
|
-
const onCollapse = useCallback2(() => {
|
|
268
|
-
setCollapsed((v) => !v);
|
|
269
|
-
}, [setCollapsed]);
|
|
270
|
-
useOnChange2(collapsed, () => {
|
|
271
|
-
setHover(false);
|
|
272
|
-
closeTimeRef.current = Date.now() + 150;
|
|
273
|
-
});
|
|
274
|
-
const onEnter = useCallback2((e) => {
|
|
275
|
-
if (e.pointerType === "touch" || closeTimeRef.current > Date.now()) return;
|
|
276
|
-
window.clearTimeout(timerRef.current);
|
|
277
|
-
setHover(true);
|
|
278
|
-
}, []);
|
|
279
|
-
const onLeave = useCallback2((e) => {
|
|
280
|
-
if (e.pointerType === "touch") return;
|
|
281
|
-
window.clearTimeout(timerRef.current);
|
|
282
|
-
timerRef.current = window.setTimeout(
|
|
283
|
-
() => {
|
|
284
|
-
setHover(false);
|
|
285
|
-
closeTimeRef.current = Date.now() + 150;
|
|
286
|
-
},
|
|
287
|
-
Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500
|
|
288
|
-
);
|
|
289
|
-
}, []);
|
|
290
|
-
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
291
|
-
collapsed ? /* @__PURE__ */ jsx2(
|
|
292
|
-
"div",
|
|
293
|
-
{
|
|
294
|
-
className: "fixed inset-y-0 start-0 w-6 max-md:hidden xl:w-[50px]",
|
|
295
|
-
onPointerEnter: onEnter,
|
|
296
|
-
onPointerLeave: onLeave
|
|
297
|
-
}
|
|
298
|
-
) : null,
|
|
299
|
-
collapsed ? /* @__PURE__ */ jsx2(
|
|
300
|
-
"button",
|
|
301
|
-
{
|
|
302
|
-
type: "button",
|
|
303
|
-
"aria-label": "Collapse Sidebar",
|
|
304
|
-
className: twMerge(
|
|
305
|
-
buttonVariants({
|
|
306
|
-
color: "secondary",
|
|
307
|
-
size: "icon",
|
|
308
|
-
className: "fixed start-4 bottom-2 z-10 max-md:hidden"
|
|
309
|
-
})
|
|
310
|
-
),
|
|
311
|
-
onClick: onCollapse,
|
|
312
|
-
children: /* @__PURE__ */ jsx2(SidebarIcon, {})
|
|
313
|
-
}
|
|
314
|
-
) : null,
|
|
315
|
-
/* @__PURE__ */ jsx2(
|
|
316
|
-
Sidebar,
|
|
317
|
-
{
|
|
318
|
-
...props,
|
|
319
|
-
aside: {
|
|
320
|
-
"data-collapse": collapsed,
|
|
321
|
-
"data-hover": hover,
|
|
322
|
-
onPointerEnter: onEnter,
|
|
323
|
-
onPointerLeave: onLeave,
|
|
324
|
-
"aria-hidden": Boolean(collapsed && !hover),
|
|
325
|
-
className: twMerge(
|
|
326
|
-
"md:transition-[transform,padding,width,margin]",
|
|
327
|
-
collapsed && [
|
|
328
|
-
"md:top-1 md:me-fd-sidebar-offset md:h-[calc(100dvh-4px)] md:w-[var(--fd-sidebar-width)] md:animate-fd-sidebar-collapse md:rounded-xl md:border md:ps-0 md:shadow-md",
|
|
329
|
-
hover ? "md:translate-x-1 rtl:md:-translate-x-1" : "md:translate-x-[calc(var(--fd-sidebar-width)*-1)] rtl:md:translate-x-[var(--fd-sidebar-width)]"
|
|
330
|
-
]
|
|
331
|
-
)
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
] });
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// src/docs-layout.client.tsx
|
|
339
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
340
|
-
function SubNav({
|
|
341
|
-
title,
|
|
342
|
-
url,
|
|
343
|
-
transparentMode,
|
|
344
|
-
children,
|
|
345
|
-
enableSearch = true
|
|
346
|
-
}) {
|
|
347
|
-
const { open } = useSidebar();
|
|
348
|
-
const { enabled } = useSearchContext();
|
|
349
|
-
return /* @__PURE__ */ jsxs3(
|
|
350
|
-
NavBox,
|
|
351
|
-
{
|
|
352
|
-
id: "nd-subnav",
|
|
353
|
-
className: "flex h-14 flex-row items-center px-4 md:hidden",
|
|
354
|
-
transparentMode,
|
|
355
|
-
children: [
|
|
356
|
-
/* @__PURE__ */ jsx3(Title, { url, title }),
|
|
357
|
-
/* @__PURE__ */ jsx3("div", { className: "flex flex-1 flex-row items-center", children }),
|
|
358
|
-
enabled && enableSearch ? /* @__PURE__ */ jsx3(SearchToggle, {}) : null,
|
|
359
|
-
/* @__PURE__ */ jsx3(
|
|
360
|
-
SidebarTrigger,
|
|
361
|
-
{
|
|
362
|
-
className: twMerge(
|
|
363
|
-
buttonVariants({
|
|
364
|
-
color: "ghost",
|
|
365
|
-
size: "icon",
|
|
366
|
-
className: "-me-2"
|
|
367
|
-
})
|
|
368
|
-
),
|
|
369
|
-
children: open ? /* @__PURE__ */ jsx3(X, {}) : /* @__PURE__ */ jsx3(Menu, {})
|
|
370
|
-
}
|
|
371
|
-
)
|
|
372
|
-
]
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
function SidebarCollapseTrigger() {
|
|
377
|
-
const { setCollapsed } = useSidebar();
|
|
378
|
-
return /* @__PURE__ */ jsx3(
|
|
379
|
-
"button",
|
|
380
|
-
{
|
|
381
|
-
type: "button",
|
|
382
|
-
"aria-label": "Collapse Sidebar",
|
|
383
|
-
className: twMerge(
|
|
384
|
-
buttonVariants({
|
|
385
|
-
color: "ghost",
|
|
386
|
-
size: "icon",
|
|
387
|
-
className: "ms-auto max-md:hidden"
|
|
388
|
-
})
|
|
389
|
-
),
|
|
390
|
-
onClick: useCallback3(() => {
|
|
391
|
-
setCollapsed((prev) => !prev);
|
|
392
|
-
}, [setCollapsed]),
|
|
393
|
-
children: /* @__PURE__ */ jsx3(SidebarIcon2, {})
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
export {
|
|
398
|
-
DynamicSidebar,
|
|
399
|
-
LanguageToggle,
|
|
400
|
-
LinksMenu,
|
|
401
|
-
Sidebar,
|
|
402
|
-
SidebarCollapseTrigger,
|
|
403
|
-
SubNav,
|
|
404
|
-
ThemeToggle,
|
|
405
|
-
TreeContextProvider
|
|
406
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { S as SharedNavProps, L as LinkItemType } from './layout.shared-DEQFTB9M.js';
|
|
2
|
-
import 'react';
|
|
3
|
-
|
|
4
|
-
declare function Nav({ title, url, items, transparentMode, enableSearch, i18n, children, }: SharedNavProps & {
|
|
5
|
-
i18n?: boolean;
|
|
6
|
-
items: LinkItemType[];
|
|
7
|
-
}): React.ReactElement;
|
|
8
|
-
|
|
9
|
-
export { Nav };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
LargeSearchToggle,
|
|
4
|
-
LinkItem,
|
|
5
|
-
LinksMenu,
|
|
6
|
-
NavBox,
|
|
7
|
-
SearchToggle,
|
|
8
|
-
ThemeToggle,
|
|
9
|
-
Title
|
|
10
|
-
} from "./chunk-KCZRDPB4.js";
|
|
11
|
-
import {
|
|
12
|
-
LanguageToggle
|
|
13
|
-
} from "./chunk-NSEJBI4V.js";
|
|
14
|
-
import "./chunk-CP67AHDD.js";
|
|
15
|
-
import "./chunk-UOD2T27N.js";
|
|
16
|
-
import {
|
|
17
|
-
useSearchContext
|
|
18
|
-
} from "./chunk-ET4TW6M5.js";
|
|
19
|
-
import {
|
|
20
|
-
useI18n
|
|
21
|
-
} from "./chunk-EFMHXXHW.js";
|
|
22
|
-
import "./chunk-TQJ6YPJ3.js";
|
|
23
|
-
import {
|
|
24
|
-
buttonVariants
|
|
25
|
-
} from "./chunk-EDNTYBXS.js";
|
|
26
|
-
import {
|
|
27
|
-
twMerge
|
|
28
|
-
} from "./chunk-TK3TM3MR.js";
|
|
29
|
-
import "./chunk-MLKGABMK.js";
|
|
30
|
-
|
|
31
|
-
// src/home-layout.client.tsx
|
|
32
|
-
import { MoreVertical } from "lucide-react";
|
|
33
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
34
|
-
function Nav({
|
|
35
|
-
title,
|
|
36
|
-
url,
|
|
37
|
-
items,
|
|
38
|
-
transparentMode,
|
|
39
|
-
enableSearch = true,
|
|
40
|
-
i18n,
|
|
41
|
-
children
|
|
42
|
-
}) {
|
|
43
|
-
const search = useSearchContext();
|
|
44
|
-
const { text } = useI18n();
|
|
45
|
-
return /* @__PURE__ */ jsx(NavBox, { id: "nd-nav", className: "h-14", transparentMode, children: /* @__PURE__ */ jsxs("nav", { className: "mx-auto flex size-full max-w-container flex-row items-center gap-6 px-4", children: [
|
|
46
|
-
/* @__PURE__ */ jsx(Title, { title, url }),
|
|
47
|
-
children,
|
|
48
|
-
items.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, className: "text-sm max-lg:hidden" }, i)),
|
|
49
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-row items-center justify-end md:gap-2", children: [
|
|
50
|
-
enableSearch && search.enabled ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
-
/* @__PURE__ */ jsx(SearchToggle, { className: "md:hidden" }),
|
|
52
|
-
/* @__PURE__ */ jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-md:hidden" })
|
|
53
|
-
] }) : null,
|
|
54
|
-
/* @__PURE__ */ jsx(ThemeToggle, { className: "max-lg:hidden" }),
|
|
55
|
-
items.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, className: "max-lg:hidden" }, i)),
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
LinksMenu,
|
|
58
|
-
{
|
|
59
|
-
items,
|
|
60
|
-
className: twMerge(
|
|
61
|
-
buttonVariants({
|
|
62
|
-
size: "icon",
|
|
63
|
-
color: "ghost",
|
|
64
|
-
className: "-me-2 lg:hidden"
|
|
65
|
-
})
|
|
66
|
-
),
|
|
67
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between px-2 pt-2", children: [
|
|
69
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium text-fd-muted-foreground", children: text.chooseTheme }),
|
|
70
|
-
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
71
|
-
] }),
|
|
72
|
-
i18n ? /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between px-2 pt-2", children: [
|
|
73
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium text-fd-muted-foreground", children: text.chooseLanguage }),
|
|
74
|
-
/* @__PURE__ */ jsx(LanguageToggle, {})
|
|
75
|
-
] }) : null
|
|
76
|
-
] }),
|
|
77
|
-
children: /* @__PURE__ */ jsx(MoreVertical, {})
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
] })
|
|
81
|
-
] }) });
|
|
82
|
-
}
|
|
83
|
-
function isSecondary(item) {
|
|
84
|
-
return "secondary" in item && item.secondary === true || item.type === "icon";
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
Nav
|
|
88
|
-
};
|
package/dist/home-layout.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { B as BaseLayoutProps } from './layout.shared-DEQFTB9M.js';
|
|
2
|
-
import 'react';
|
|
3
|
-
|
|
4
|
-
type HomeLayoutProps = BaseLayoutProps;
|
|
5
|
-
declare function HomeLayout({ nav, links, githubUrl, i18n, children, }: BaseLayoutProps): React.ReactElement;
|
|
6
|
-
|
|
7
|
-
export { HomeLayout, type HomeLayoutProps };
|
package/dist/home-layout.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Nav } from "./home-layout.client"
|
|
2
|
-
import {
|
|
3
|
-
getLinks
|
|
4
|
-
} from "./chunk-HOIRMHZT.js";
|
|
5
|
-
import {
|
|
6
|
-
replaceOrDefault
|
|
7
|
-
} from "./chunk-UOD2T27N.js";
|
|
8
|
-
import "./chunk-MLKGABMK.js";
|
|
9
|
-
|
|
10
|
-
// src/home-layout.tsx
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
function HomeLayout({
|
|
13
|
-
nav = {},
|
|
14
|
-
links = [],
|
|
15
|
-
githubUrl,
|
|
16
|
-
i18n,
|
|
17
|
-
children
|
|
18
|
-
}) {
|
|
19
|
-
const finalLinks = getLinks(links, githubUrl);
|
|
20
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
-
replaceOrDefault(
|
|
22
|
-
nav,
|
|
23
|
-
/* @__PURE__ */ jsx(Nav, { items: finalLinks, i18n, ...nav, children: nav.children })
|
|
24
|
-
),
|
|
25
|
-
children
|
|
26
|
-
] });
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
HomeLayout
|
|
30
|
-
};
|
package/dist/layout.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { PageTree } from 'fumadocs-core/server';
|
|
2
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { S as SidebarProps } from './sidebar-DwBSl7jC.js';
|
|
4
|
-
import { B as BaseLayoutProps } from './layout.shared-DEQFTB9M.js';
|
|
5
|
-
export { L as LinkItemType } from './layout.shared-DEQFTB9M.js';
|
|
6
|
-
|
|
7
|
-
interface SidebarOptions extends Omit<SidebarProps, 'items'> {
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
component: ReactNode;
|
|
10
|
-
collapsible: boolean;
|
|
11
|
-
}
|
|
12
|
-
interface DocsLayoutProps extends BaseLayoutProps {
|
|
13
|
-
tree: PageTree.Root;
|
|
14
|
-
sidebar?: Partial<SidebarOptions>;
|
|
15
|
-
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
16
|
-
}
|
|
17
|
-
declare function DocsLayout({ nav, githubUrl, sidebar: { enabled: sidebarEnabled, collapsible, component: sidebarReplace, ...sidebar }, containerProps, i18n, ...props }: DocsLayoutProps): React.ReactNode;
|
|
18
|
-
|
|
19
|
-
export { DocsLayout, type DocsLayoutProps };
|