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
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SearchDialog,
|
|
4
4
|
TagsList
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-TYZZJ335.js";
|
|
6
|
+
import "../../chunk-QKOA6KEZ.js";
|
|
7
|
+
import "../../chunk-5QPVK7QM.js";
|
|
8
|
+
import "../../chunk-TK3TM3MR.js";
|
|
6
9
|
import "../../chunk-ET4TW6M5.js";
|
|
7
10
|
import "../../chunk-27HFSL7N.js";
|
|
8
11
|
import {
|
|
9
12
|
useI18n
|
|
10
13
|
} from "../../chunk-EFMHXXHW.js";
|
|
11
|
-
import "../../chunk-EDNTYBXS.js";
|
|
12
|
-
import "../../chunk-TK3TM3MR.js";
|
|
13
14
|
import "../../chunk-MLKGABMK.js";
|
|
14
15
|
|
|
15
16
|
// src/components/dialog/search-default.tsx
|
|
@@ -22,11 +23,24 @@ function DefaultSearchDialog({
|
|
|
22
23
|
tags,
|
|
23
24
|
api,
|
|
24
25
|
delayMs,
|
|
26
|
+
type = "fetch",
|
|
27
|
+
allowClear = false,
|
|
25
28
|
...props
|
|
26
29
|
}) {
|
|
27
30
|
const { locale } = useI18n();
|
|
28
31
|
const [tag, setTag] = useState(defaultTag);
|
|
29
|
-
const { search, setSearch, query } = useDocsSearch(
|
|
32
|
+
const { search, setSearch, query } = useDocsSearch(
|
|
33
|
+
type === "fetch" ? {
|
|
34
|
+
type: "fetch",
|
|
35
|
+
api
|
|
36
|
+
} : {
|
|
37
|
+
type: "static",
|
|
38
|
+
from: api
|
|
39
|
+
},
|
|
40
|
+
locale,
|
|
41
|
+
tag,
|
|
42
|
+
delayMs
|
|
43
|
+
);
|
|
30
44
|
useOnChange(defaultTag, (v) => {
|
|
31
45
|
setTag(v);
|
|
32
46
|
});
|
|
@@ -39,7 +53,15 @@ function DefaultSearchDialog({
|
|
|
39
53
|
results: query.data ?? [],
|
|
40
54
|
...props,
|
|
41
55
|
footer: tags ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42
|
-
/* @__PURE__ */ jsx(
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
TagsList,
|
|
58
|
+
{
|
|
59
|
+
tag,
|
|
60
|
+
onTagChange: setTag,
|
|
61
|
+
items: tags,
|
|
62
|
+
allowClear
|
|
63
|
+
}
|
|
64
|
+
),
|
|
43
65
|
props.footer
|
|
44
66
|
] }) : props.footer
|
|
45
67
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SortedResult } from 'fumadocs-core/
|
|
2
|
-
import
|
|
3
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
1
|
+
import { SortedResult } from 'fumadocs-core/server';
|
|
2
|
+
import { ReactElement, HTMLAttributes, ReactNode } from 'react';
|
|
4
3
|
|
|
5
4
|
type SearchLink = [name: string, href: string];
|
|
6
5
|
interface SharedProps {
|
|
@@ -22,16 +21,17 @@ interface SearchContentProps {
|
|
|
22
21
|
items: SortedResult[];
|
|
23
22
|
hideResults?: boolean;
|
|
24
23
|
}
|
|
25
|
-
declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps):
|
|
24
|
+
declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps): ReactElement;
|
|
26
25
|
interface TagItem {
|
|
27
26
|
name: string;
|
|
28
|
-
value: string;
|
|
27
|
+
value: string | undefined;
|
|
29
28
|
}
|
|
30
29
|
interface TagsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
31
30
|
tag?: string;
|
|
32
|
-
onTagChange: (tag: string) => void;
|
|
31
|
+
onTagChange: (tag: string | undefined) => void;
|
|
32
|
+
allowClear?: boolean;
|
|
33
33
|
items: TagItem[];
|
|
34
34
|
}
|
|
35
|
-
declare function TagsList({ tag, onTagChange, items, ...props }: TagsListProps): ReactNode;
|
|
35
|
+
declare function TagsList({ tag, onTagChange, items, allowClear, ...props }: TagsListProps): ReactNode;
|
|
36
36
|
|
|
37
37
|
export { SearchDialog, type SearchLink, type SharedProps, type TagItem, TagsList, type TagsListProps };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SearchDialog,
|
|
3
3
|
TagsList
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-TYZZJ335.js";
|
|
5
|
+
import "../../chunk-QKOA6KEZ.js";
|
|
6
|
+
import "../../chunk-5QPVK7QM.js";
|
|
7
|
+
import "../../chunk-TK3TM3MR.js";
|
|
5
8
|
import "../../chunk-ET4TW6M5.js";
|
|
6
9
|
import "../../chunk-27HFSL7N.js";
|
|
7
10
|
import "../../chunk-EFMHXXHW.js";
|
|
8
|
-
import "../../chunk-EDNTYBXS.js";
|
|
9
|
-
import "../../chunk-TK3TM3MR.js";
|
|
10
11
|
import "../../chunk-MLKGABMK.js";
|
|
11
12
|
export {
|
|
12
13
|
SearchDialog,
|
package/dist/components/files.js
CHANGED
|
@@ -4,6 +4,11 @@ import {
|
|
|
4
4
|
CollapsibleContent,
|
|
5
5
|
CollapsibleTrigger
|
|
6
6
|
} from "../chunk-TQJ6YPJ3.js";
|
|
7
|
+
import {
|
|
8
|
+
File,
|
|
9
|
+
Folder,
|
|
10
|
+
FolderOpen
|
|
11
|
+
} from "../chunk-5QPVK7QM.js";
|
|
7
12
|
import {
|
|
8
13
|
twMerge
|
|
9
14
|
} from "../chunk-TK3TM3MR.js";
|
|
@@ -11,10 +16,9 @@ import "../chunk-MLKGABMK.js";
|
|
|
11
16
|
|
|
12
17
|
// src/components/files.tsx
|
|
13
18
|
import { cva } from "class-variance-authority";
|
|
14
|
-
import { FileIcon, FolderIcon, FolderOpen } from "lucide-react";
|
|
15
19
|
import { useState } from "react";
|
|
16
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
var
|
|
21
|
+
var itemVariants = cva(
|
|
18
22
|
"flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4"
|
|
19
23
|
);
|
|
20
24
|
function Files({
|
|
@@ -30,33 +34,33 @@ function Files({
|
|
|
30
34
|
}
|
|
31
35
|
);
|
|
32
36
|
}
|
|
33
|
-
function
|
|
37
|
+
function File2({
|
|
34
38
|
name,
|
|
35
|
-
icon = /* @__PURE__ */ jsx(
|
|
39
|
+
icon = /* @__PURE__ */ jsx(File, {}),
|
|
36
40
|
className,
|
|
37
41
|
...rest
|
|
38
42
|
}) {
|
|
39
|
-
return /* @__PURE__ */ jsxs("div", { className: twMerge(
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(itemVariants({ className })), ...rest, children: [
|
|
40
44
|
icon,
|
|
41
45
|
name
|
|
42
46
|
] });
|
|
43
47
|
}
|
|
44
|
-
function
|
|
48
|
+
function Folder2({
|
|
45
49
|
name,
|
|
46
50
|
defaultOpen = false,
|
|
47
51
|
...props
|
|
48
52
|
}) {
|
|
49
53
|
const [open, setOpen] = useState(defaultOpen);
|
|
50
54
|
return /* @__PURE__ */ jsxs(Collapsible, { open, onOpenChange: setOpen, ...props, children: [
|
|
51
|
-
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: twMerge(
|
|
52
|
-
open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(
|
|
55
|
+
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: twMerge(itemVariants({ className: "w-full" })), children: [
|
|
56
|
+
open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(Folder, {}),
|
|
53
57
|
name
|
|
54
58
|
] }),
|
|
55
|
-
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "ms-2 flex flex-col border-l
|
|
59
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "ms-2 flex flex-col border-l ps-2", children: props.children }) })
|
|
56
60
|
] });
|
|
57
61
|
}
|
|
58
62
|
export {
|
|
59
|
-
File,
|
|
63
|
+
File2 as File,
|
|
60
64
|
Files,
|
|
61
|
-
Folder
|
|
65
|
+
Folder2 as Folder
|
|
62
66
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
defaultImageSizes
|
|
4
|
-
} from "../chunk-UOD2T27N.js";
|
|
5
2
|
import "../chunk-MLKGABMK.js";
|
|
6
3
|
|
|
7
4
|
// src/components/image-zoom.tsx
|
|
8
5
|
import Image from "next/image";
|
|
6
|
+
import "./image-zoom.css";
|
|
9
7
|
import Zoom from "react-medium-image-zoom";
|
|
10
|
-
import "../../dist/image-zoom.css";
|
|
11
8
|
import { jsx } from "react/jsx-runtime";
|
|
12
9
|
function getImageSrc(src) {
|
|
13
10
|
if (typeof src === "string") return src;
|
|
@@ -31,7 +28,13 @@ function ImageZoom({
|
|
|
31
28
|
sizes: void 0,
|
|
32
29
|
...zoomInProps
|
|
33
30
|
},
|
|
34
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
31
|
+
children: children ?? /* @__PURE__ */ jsx(
|
|
32
|
+
Image,
|
|
33
|
+
{
|
|
34
|
+
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px",
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
)
|
|
35
38
|
}
|
|
36
39
|
);
|
|
37
40
|
}
|
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
CollapsibleContent,
|
|
5
5
|
CollapsibleTrigger
|
|
6
6
|
} from "../chunk-TQJ6YPJ3.js";
|
|
7
|
+
import {
|
|
8
|
+
ChevronDown
|
|
9
|
+
} from "../chunk-5QPVK7QM.js";
|
|
7
10
|
import "../chunk-TK3TM3MR.js";
|
|
8
11
|
import "../chunk-MLKGABMK.js";
|
|
9
12
|
|
|
10
13
|
// src/components/inline-toc.tsx
|
|
11
|
-
import { ChevronDown } from "lucide-react";
|
|
12
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
15
|
function InlineTOC({
|
|
14
16
|
items,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
type LanguageSelectProps =
|
|
3
|
+
type LanguageSelectProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
4
4
|
declare function LanguageToggle(props: LanguageSelectProps): React.ReactElement;
|
|
5
|
+
declare function LanguageToggleText(props: HTMLAttributes<HTMLSpanElement>): React.ReactElement;
|
|
5
6
|
|
|
6
|
-
export { type LanguageSelectProps, LanguageToggle };
|
|
7
|
+
export { type LanguageSelectProps, LanguageToggle, LanguageToggleText };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
LanguageToggle
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
LanguageToggle,
|
|
4
|
+
LanguageToggleText
|
|
5
|
+
} from "../../chunk-KZTWSBYY.js";
|
|
6
|
+
import "../../chunk-QKOA6KEZ.js";
|
|
7
|
+
import "../../chunk-IVBHRX3O.js";
|
|
8
8
|
import "../../chunk-TK3TM3MR.js";
|
|
9
|
+
import "../../chunk-EFMHXXHW.js";
|
|
9
10
|
import "../../chunk-MLKGABMK.js";
|
|
10
11
|
export {
|
|
11
|
-
LanguageToggle
|
|
12
|
+
LanguageToggle,
|
|
13
|
+
LanguageToggleText
|
|
12
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
interface Option {
|
|
4
4
|
/**
|
|
@@ -7,11 +7,11 @@ interface Option {
|
|
|
7
7
|
url: string;
|
|
8
8
|
icon?: ReactNode;
|
|
9
9
|
title: ReactNode;
|
|
10
|
-
description
|
|
10
|
+
description?: ReactNode;
|
|
11
11
|
props?: HTMLAttributes<HTMLElement>;
|
|
12
12
|
}
|
|
13
13
|
declare function RootToggle({ options, ...props }: {
|
|
14
14
|
options: Option[];
|
|
15
15
|
} & HTMLAttributes<HTMLButtonElement>): React.ReactElement;
|
|
16
16
|
|
|
17
|
-
export { RootToggle };
|
|
17
|
+
export { type Option, RootToggle };
|
|
@@ -1,79 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
useSidebar
|
|
12
|
-
} from "../../chunk-27HFSL7N.js";
|
|
13
|
-
import {
|
|
14
|
-
twMerge
|
|
15
|
-
} from "../../chunk-TK3TM3MR.js";
|
|
3
|
+
RootToggle
|
|
4
|
+
} from "../../chunk-WRBUXI2A.js";
|
|
5
|
+
import "../../chunk-CDPVENXR.js";
|
|
6
|
+
import "../../chunk-IVBHRX3O.js";
|
|
7
|
+
import "../../chunk-5QPVK7QM.js";
|
|
8
|
+
import "../../chunk-TK3TM3MR.js";
|
|
9
|
+
import "../../chunk-27HFSL7N.js";
|
|
16
10
|
import "../../chunk-MLKGABMK.js";
|
|
17
|
-
|
|
18
|
-
// src/components/layout/root-toggle.tsx
|
|
19
|
-
import { ChevronDown } from "lucide-react";
|
|
20
|
-
import { useCallback, useState } from "react";
|
|
21
|
-
import Link from "next/link";
|
|
22
|
-
import { usePathname } from "next/navigation";
|
|
23
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
function RootToggle({
|
|
25
|
-
options,
|
|
26
|
-
...props
|
|
27
|
-
}) {
|
|
28
|
-
const [open, setOpen] = useState(false);
|
|
29
|
-
const { closeOnRedirect } = useSidebar();
|
|
30
|
-
const pathname = usePathname();
|
|
31
|
-
const selected = options.find((item) => isActive(item.url, pathname, true)) ?? options[0];
|
|
32
|
-
const onClick = useCallback(() => {
|
|
33
|
-
closeOnRedirect.current = false;
|
|
34
|
-
setOpen(false);
|
|
35
|
-
}, [closeOnRedirect]);
|
|
36
|
-
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
37
|
-
/* @__PURE__ */ jsxs(
|
|
38
|
-
PopoverTrigger,
|
|
39
|
-
{
|
|
40
|
-
...props,
|
|
41
|
-
className: twMerge(
|
|
42
|
-
"-mx-2 flex flex-row items-center gap-2.5 rounded-lg p-2 hover:bg-fd-accent/50 hover:text-fd-accent-foreground",
|
|
43
|
-
props.className
|
|
44
|
-
),
|
|
45
|
-
children: [
|
|
46
|
-
/* @__PURE__ */ jsx(Item, { ...selected }),
|
|
47
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-fd-muted-foreground md:me-1.5" })
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
),
|
|
51
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] overflow-hidden p-0", children: options.map((item) => /* @__PURE__ */ jsx(
|
|
52
|
-
Link,
|
|
53
|
-
{
|
|
54
|
-
href: item.url,
|
|
55
|
-
onClick,
|
|
56
|
-
...item.props,
|
|
57
|
-
className: twMerge(
|
|
58
|
-
"flex w-full flex-row items-center gap-2.5 p-2",
|
|
59
|
-
selected === item ? "bg-fd-accent text-fd-accent-foreground" : "hover:bg-fd-accent/50",
|
|
60
|
-
item.props?.className
|
|
61
|
-
),
|
|
62
|
-
children: /* @__PURE__ */ jsx(Item, { ...item })
|
|
63
|
-
},
|
|
64
|
-
item.url
|
|
65
|
-
)) })
|
|
66
|
-
] });
|
|
67
|
-
}
|
|
68
|
-
function Item({ title, icon, description }) {
|
|
69
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
-
icon,
|
|
71
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 text-left", children: [
|
|
72
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: title }),
|
|
73
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-fd-muted-foreground", children: description })
|
|
74
|
-
] })
|
|
75
|
-
] });
|
|
76
|
-
}
|
|
77
11
|
export {
|
|
78
12
|
RootToggle
|
|
79
13
|
};
|
package/dist/components/tabs.js
CHANGED
|
@@ -7,7 +7,16 @@ import {
|
|
|
7
7
|
} from "../chunk-MLKGABMK.js";
|
|
8
8
|
|
|
9
9
|
// src/components/tabs.tsx
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
useMemo,
|
|
12
|
+
useState,
|
|
13
|
+
useCallback,
|
|
14
|
+
createContext,
|
|
15
|
+
useContext,
|
|
16
|
+
useRef,
|
|
17
|
+
useLayoutEffect,
|
|
18
|
+
useEffect
|
|
19
|
+
} from "react";
|
|
11
20
|
|
|
12
21
|
// src/components/ui/tabs.tsx
|
|
13
22
|
var tabs_exports = {};
|
|
@@ -83,13 +92,7 @@ function removeChangeListener(id, listener) {
|
|
|
83
92
|
list.filter((item) => item !== listener)
|
|
84
93
|
);
|
|
85
94
|
}
|
|
86
|
-
|
|
87
|
-
listeners.get(id)?.forEach((item) => {
|
|
88
|
-
item(v);
|
|
89
|
-
});
|
|
90
|
-
if (persist) localStorage.setItem(id, v);
|
|
91
|
-
else sessionStorage.setItem(id, v);
|
|
92
|
-
}
|
|
95
|
+
var ValueChangeContext = createContext(() => void 0);
|
|
93
96
|
function Tabs2({
|
|
94
97
|
groupId,
|
|
95
98
|
items = [],
|
|
@@ -99,10 +102,12 @@ function Tabs2({
|
|
|
99
102
|
}) {
|
|
100
103
|
const values = useMemo(() => items.map((item) => toValue(item)), [items]);
|
|
101
104
|
const [value, setValue] = useState(values[defaultIndex]);
|
|
105
|
+
const valuesRef = useRef(values);
|
|
106
|
+
valuesRef.current = values;
|
|
102
107
|
useLayoutEffect(() => {
|
|
103
108
|
if (!groupId) return;
|
|
104
109
|
const onUpdate = (v) => {
|
|
105
|
-
if (
|
|
110
|
+
if (valuesRef.current.includes(v)) setValue(v);
|
|
106
111
|
};
|
|
107
112
|
const previous = persist ? localStorage.getItem(groupId) : sessionStorage.getItem(groupId);
|
|
108
113
|
if (previous) onUpdate(previous);
|
|
@@ -110,11 +115,15 @@ function Tabs2({
|
|
|
110
115
|
return () => {
|
|
111
116
|
removeChangeListener(groupId, onUpdate);
|
|
112
117
|
};
|
|
113
|
-
}, [groupId, persist
|
|
118
|
+
}, [groupId, persist]);
|
|
114
119
|
const onValueChange = useCallback(
|
|
115
120
|
(v) => {
|
|
116
121
|
if (groupId) {
|
|
117
|
-
|
|
122
|
+
listeners.get(groupId)?.forEach((item) => {
|
|
123
|
+
item(v);
|
|
124
|
+
});
|
|
125
|
+
if (persist) localStorage.setItem(groupId, v);
|
|
126
|
+
else sessionStorage.setItem(groupId, v);
|
|
118
127
|
} else {
|
|
119
128
|
setValue(v);
|
|
120
129
|
}
|
|
@@ -130,7 +139,7 @@ function Tabs2({
|
|
|
130
139
|
className: twMerge("my-4", props.className),
|
|
131
140
|
children: [
|
|
132
141
|
/* @__PURE__ */ jsx2(TabsList, { children: values.map((v, i) => /* @__PURE__ */ jsx2(TabsTrigger, { value: v, children: items[i] }, v)) }),
|
|
133
|
-
props.children
|
|
142
|
+
/* @__PURE__ */ jsx2(ValueChangeContext.Provider, { value: onValueChange, children: props.children })
|
|
134
143
|
]
|
|
135
144
|
}
|
|
136
145
|
);
|
|
@@ -143,10 +152,18 @@ function Tab({
|
|
|
143
152
|
className,
|
|
144
153
|
...props
|
|
145
154
|
}) {
|
|
155
|
+
const v = toValue(value);
|
|
156
|
+
const onValueChange = useContext(ValueChangeContext);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const hash = window.location.hash.slice(1);
|
|
159
|
+
if (hash === props.id) {
|
|
160
|
+
onValueChange(v);
|
|
161
|
+
}
|
|
162
|
+
}, [onValueChange, props.id, v]);
|
|
146
163
|
return /* @__PURE__ */ jsx2(
|
|
147
164
|
TabsContent,
|
|
148
165
|
{
|
|
149
|
-
value:
|
|
166
|
+
value: v,
|
|
150
167
|
className: twMerge(
|
|
151
168
|
"prose-no-margin [&>figure:only-child]:-m-4 [&>figure:only-child]:rounded-none [&>figure:only-child]:border-none",
|
|
152
169
|
className
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare function Info({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): ReactNode;
|
|
4
6
|
interface ObjectType {
|
|
5
7
|
/**
|
|
6
8
|
* Additional description of the field
|
|
7
9
|
*/
|
|
8
|
-
description?:
|
|
10
|
+
description?: ReactNode;
|
|
9
11
|
type: string;
|
|
10
|
-
typeDescription?:
|
|
12
|
+
typeDescription?: ReactNode;
|
|
11
13
|
/**
|
|
12
14
|
* Optional link to the type
|
|
13
15
|
*/
|
|
@@ -3,23 +3,23 @@ import {
|
|
|
3
3
|
Popover,
|
|
4
4
|
PopoverContent,
|
|
5
5
|
PopoverTrigger
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-IVBHRX3O.js";
|
|
7
|
+
import {
|
|
8
|
+
Info
|
|
9
|
+
} from "../chunk-5QPVK7QM.js";
|
|
7
10
|
import {
|
|
8
11
|
twMerge
|
|
9
12
|
} from "../chunk-TK3TM3MR.js";
|
|
10
13
|
import "../chunk-MLKGABMK.js";
|
|
11
14
|
|
|
12
15
|
// src/components/type-table.tsx
|
|
13
|
-
import { InfoIcon } from "lucide-react";
|
|
14
16
|
import Link from "next/link";
|
|
15
17
|
import { cva } from "class-variance-authority";
|
|
16
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
function
|
|
18
|
-
children
|
|
19
|
-
}) {
|
|
19
|
+
function Info2({ children }) {
|
|
20
20
|
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
21
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
|
|
22
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "prose text-sm", children })
|
|
21
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(Info, { className: "size-4" }) }),
|
|
22
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "prose max-h-[400px] min-w-[220px] max-w-[400px] overflow-auto text-sm prose-no-margin", children })
|
|
23
23
|
] });
|
|
24
24
|
}
|
|
25
25
|
var th = cva("p-2 font-medium first:pl-0 last:pr-0");
|
|
@@ -45,18 +45,18 @@ function TypeTable({
|
|
|
45
45
|
/* @__PURE__ */ jsx("tbody", { className: "border-collapse divide-y divide-fd-border", children: Object.entries(type).map(([key, value]) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
46
46
|
/* @__PURE__ */ jsx("td", { className: td(), children: /* @__PURE__ */ jsxs("div", { className: field(), children: [
|
|
47
47
|
/* @__PURE__ */ jsx("code", { className: twMerge(code({ color: "primary" })), children: key }),
|
|
48
|
-
value.description ? /* @__PURE__ */ jsx(
|
|
48
|
+
value.description ? /* @__PURE__ */ jsx(Info2, { children: value.description }) : null
|
|
49
49
|
] }) }),
|
|
50
50
|
/* @__PURE__ */ jsx("td", { className: td(), children: /* @__PURE__ */ jsxs("div", { className: field(), children: [
|
|
51
51
|
/* @__PURE__ */ jsx("code", { className: code(), children: value.type }),
|
|
52
|
-
value.typeDescription ? /* @__PURE__ */ jsx(
|
|
53
|
-
value.typeDescriptionLink ? /* @__PURE__ */ jsx(Link, { href: value.typeDescriptionLink, children: /* @__PURE__ */ jsx(
|
|
52
|
+
value.typeDescription ? /* @__PURE__ */ jsx(Info2, { children: value.typeDescription }) : null,
|
|
53
|
+
value.typeDescriptionLink ? /* @__PURE__ */ jsx(Link, { href: value.typeDescriptionLink, children: /* @__PURE__ */ jsx(Info, { className: "size-4" }) }) : null
|
|
54
54
|
] }) }),
|
|
55
55
|
/* @__PURE__ */ jsx("td", { className: td(), children: value.default ? /* @__PURE__ */ jsx("code", { className: code(), children: value.default }) : /* @__PURE__ */ jsx("span", { children: "-" }) })
|
|
56
56
|
] }, key)) })
|
|
57
57
|
] }) });
|
|
58
58
|
}
|
|
59
59
|
export {
|
|
60
|
-
Info,
|
|
60
|
+
Info2 as Info,
|
|
61
61
|
TypeTable
|
|
62
62
|
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Sidebar
|
|
4
|
+
} from "./chunk-BN7HGCQ4.js";
|
|
5
|
+
import "./chunk-V6RONFCQ.js";
|
|
6
|
+
import "./chunk-CDPVENXR.js";
|
|
7
|
+
import "./chunk-TQJ6YPJ3.js";
|
|
8
|
+
import {
|
|
9
|
+
buttonVariants
|
|
10
|
+
} from "./chunk-QKOA6KEZ.js";
|
|
11
|
+
import "./chunk-2FLZOPQN.js";
|
|
12
|
+
import {
|
|
13
|
+
PanelLeft
|
|
14
|
+
} from "./chunk-5QPVK7QM.js";
|
|
15
|
+
import {
|
|
16
|
+
twMerge
|
|
17
|
+
} from "./chunk-TK3TM3MR.js";
|
|
18
|
+
import "./chunk-ET4TW6M5.js";
|
|
19
|
+
import "./chunk-YL3MZH7N.js";
|
|
20
|
+
import {
|
|
21
|
+
useSidebar
|
|
22
|
+
} from "./chunk-27HFSL7N.js";
|
|
23
|
+
import "./chunk-EFMHXXHW.js";
|
|
24
|
+
import "./chunk-MLKGABMK.js";
|
|
25
|
+
|
|
26
|
+
// src/components/layout/dynamic-sidebar.tsx
|
|
27
|
+
import {
|
|
28
|
+
useCallback,
|
|
29
|
+
useMemo,
|
|
30
|
+
useRef,
|
|
31
|
+
useState
|
|
32
|
+
} from "react";
|
|
33
|
+
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
34
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
+
function DynamicSidebar(props) {
|
|
36
|
+
const { collapsed, setCollapsed } = useSidebar();
|
|
37
|
+
const [hover, setHover] = useState(false);
|
|
38
|
+
const timerRef = useRef(0);
|
|
39
|
+
const closeTimeRef = useRef(0);
|
|
40
|
+
useOnChange(collapsed, () => {
|
|
41
|
+
setHover(false);
|
|
42
|
+
closeTimeRef.current = Date.now() + 150;
|
|
43
|
+
});
|
|
44
|
+
const onEnter = useCallback((e) => {
|
|
45
|
+
if (e.pointerType === "touch" || closeTimeRef.current > Date.now()) return;
|
|
46
|
+
window.clearTimeout(timerRef.current);
|
|
47
|
+
setHover(true);
|
|
48
|
+
}, []);
|
|
49
|
+
const onLeave = useCallback((e) => {
|
|
50
|
+
if (e.pointerType === "touch") return;
|
|
51
|
+
window.clearTimeout(timerRef.current);
|
|
52
|
+
timerRef.current = window.setTimeout(
|
|
53
|
+
() => {
|
|
54
|
+
setHover(false);
|
|
55
|
+
closeTimeRef.current = Date.now() + 150;
|
|
56
|
+
},
|
|
57
|
+
Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500
|
|
58
|
+
);
|
|
59
|
+
}, []);
|
|
60
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
+
collapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: "fixed inset-y-0 start-0 w-6 max-md:hidden",
|
|
66
|
+
onPointerEnter: onEnter,
|
|
67
|
+
onPointerLeave: onLeave
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
"aria-label": "Collapse Sidebar",
|
|
75
|
+
className: twMerge(
|
|
76
|
+
buttonVariants({
|
|
77
|
+
color: "secondary",
|
|
78
|
+
size: "icon",
|
|
79
|
+
className: "fixed start-4 bottom-2 z-10 max-md:hidden"
|
|
80
|
+
})
|
|
81
|
+
),
|
|
82
|
+
onClick: () => {
|
|
83
|
+
setCollapsed((v) => !v);
|
|
84
|
+
},
|
|
85
|
+
children: /* @__PURE__ */ jsx(PanelLeft, {})
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx("style", { children: `#nd-page { --fd-sidebar-width: 0px; }` })
|
|
89
|
+
] }) : null,
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
Sidebar,
|
|
92
|
+
{
|
|
93
|
+
...props,
|
|
94
|
+
aside: useMemo(
|
|
95
|
+
() => ({
|
|
96
|
+
"data-collapse": collapsed,
|
|
97
|
+
"data-hover": hover,
|
|
98
|
+
onPointerEnter: collapsed ? onEnter : void 0,
|
|
99
|
+
onPointerLeave: collapsed ? onLeave : void 0,
|
|
100
|
+
"aria-hidden": Boolean(collapsed && !hover),
|
|
101
|
+
style: {
|
|
102
|
+
// the offset given to docs content when the sidebar is collapsed
|
|
103
|
+
"--fd-content-offset": "calc(var(--fd-sidebar-width) * -1)"
|
|
104
|
+
},
|
|
105
|
+
className: twMerge(
|
|
106
|
+
"md:transition-[transform,margin,flex]",
|
|
107
|
+
collapsed && [
|
|
108
|
+
"md:me-[var(--fd-content-offset)] md:grow-0 md:shadow-md",
|
|
109
|
+
hover ? "md:translate-x-0" : "md:translate-x-[calc(var(--fd-sidebar-width)*-1)] rtl:md:translate-x-[var(--fd-sidebar-width)]"
|
|
110
|
+
],
|
|
111
|
+
``
|
|
112
|
+
)
|
|
113
|
+
}),
|
|
114
|
+
[collapsed, hover, onEnter, onLeave]
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
role: "none",
|
|
122
|
+
className: twMerge("transition-all max-md:hidden", collapsed && "flex-1")
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
DynamicSidebar as default
|
|
129
|
+
};
|