fumadocs-ui 8.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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/chunk-24NYFO7H.js +31 -0
- package/dist/chunk-2ZR5Z6B2.js +105 -0
- package/dist/chunk-36MVEJ25.js +39 -0
- package/dist/chunk-5EZE3X7G.js +31 -0
- package/dist/chunk-5KW7ATCP.js +23 -0
- package/dist/chunk-6C3VEZWH.js +9 -0
- package/dist/chunk-CBOHU2VN.js +28 -0
- package/dist/chunk-EDUYFB4P.js +43 -0
- package/dist/chunk-F62NYOL5.js +44 -0
- package/dist/chunk-GZQICERS.js +31 -0
- package/dist/chunk-IXYX64FW.js +243 -0
- package/dist/chunk-KCGRUOMD.js +13 -0
- package/dist/chunk-OG3QOLYP.js +43 -0
- package/dist/chunk-PLXR6QNH.js +21 -0
- package/dist/chunk-UIZNMCLD.js +49 -0
- package/dist/chunk-YAHHY62W.js +20 -0
- package/dist/components/accordion.d.mts +11 -0
- package/dist/components/accordion.js +128 -0
- package/dist/components/api.d.mts +20 -0
- package/dist/components/api.js +136 -0
- package/dist/components/callout.d.mts +13 -0
- package/dist/components/callout.js +39 -0
- package/dist/components/card.d.mts +12 -0
- package/dist/components/card.js +10 -0
- package/dist/components/codeblock.d.mts +12 -0
- package/dist/components/codeblock.js +14 -0
- package/dist/components/dialog/search-algolia.d.mts +15 -0
- package/dist/components/dialog/search-algolia.js +39 -0
- package/dist/components/dialog/search-default.d.mts +15 -0
- package/dist/components/dialog/search-default.js +39 -0
- package/dist/components/dialog/search.d.mts +25 -0
- package/dist/components/dialog/search.js +13 -0
- package/dist/components/files.d.mts +20 -0
- package/dist/components/files.js +56 -0
- package/dist/components/heading.d.mts +9 -0
- package/dist/components/heading.js +8 -0
- package/dist/components/image-zoom.d.mts +12 -0
- package/dist/components/image-zoom.js +39 -0
- package/dist/components/inline-toc.d.mts +11 -0
- package/dist/components/inline-toc.js +53 -0
- package/dist/components/roll-button.d.mts +14 -0
- package/dist/components/roll-button.js +54 -0
- package/dist/components/steps.d.mts +10 -0
- package/dist/components/steps.js +14 -0
- package/dist/components/tabs.d.mts +37 -0
- package/dist/components/tabs.js +141 -0
- package/dist/components/type-table.d.mts +23 -0
- package/dist/components/type-table.js +52 -0
- package/dist/i18n-dw7ODAws.d.mts +22 -0
- package/dist/i18n.d.mts +21 -0
- package/dist/i18n.js +146 -0
- package/dist/layout-YB7EFpgW.d.mts +79 -0
- package/dist/layout.client.d.mts +4 -0
- package/dist/layout.client.js +458 -0
- package/dist/layout.d.mts +3 -0
- package/dist/layout.js +97 -0
- package/dist/mdx.client.d.mts +7 -0
- package/dist/mdx.client.js +23 -0
- package/dist/mdx.d.mts +36 -0
- package/dist/mdx.js +51 -0
- package/dist/page.client.d.mts +29 -0
- package/dist/page.client.js +168 -0
- package/dist/page.d.mts +49 -0
- package/dist/page.js +56 -0
- package/dist/provider.d.mts +50 -0
- package/dist/provider.js +51 -0
- package/dist/style.css +1 -0
- package/dist/tailwind-plugin.d.ts +36 -0
- package/dist/tailwind-plugin.js +481 -0
- package/dist/tree-Zwtp9xPv.d.mts +15 -0
- package/package.json +97 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-KCGRUOMD.js";
|
|
4
|
+
|
|
5
|
+
// src/components/ui/scroll-area.tsx
|
|
6
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
10
|
+
ScrollAreaPrimitive.Root,
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
className: cn("overflow-hidden", className),
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
17
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {}),
|
|
18
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
|
|
19
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
));
|
|
23
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
24
|
+
var ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
25
|
+
ScrollAreaPrimitive.Scrollbar,
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
orientation,
|
|
29
|
+
className: cn(
|
|
30
|
+
"flex select-none data-[state=hidden]:animate-fade-out",
|
|
31
|
+
orientation === "vertical" && "h-full w-1.5",
|
|
32
|
+
orientation === "horizontal" && "h-1.5 flex-col",
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
...props,
|
|
36
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
ScrollBar.displayName = ScrollAreaPrimitive.Scrollbar.displayName;
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
ScrollArea
|
|
43
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/contexts/sidebar.tsx
|
|
2
|
+
import { createContext, useContext, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var SidebarCollapseContext = createContext(void 0);
|
|
5
|
+
function useSidebarCollapse() {
|
|
6
|
+
const ctx = useContext(SidebarCollapseContext);
|
|
7
|
+
if (!ctx)
|
|
8
|
+
throw new Error("Missing root provider");
|
|
9
|
+
return ctx;
|
|
10
|
+
}
|
|
11
|
+
function SidebarCollapseProvider({
|
|
12
|
+
children
|
|
13
|
+
}) {
|
|
14
|
+
const [open, setOpen] = useState(true);
|
|
15
|
+
return /* @__PURE__ */ jsx(SidebarCollapseContext.Provider, { value: [open, setOpen], children });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
useSidebarCollapse,
|
|
20
|
+
SidebarCollapseProvider
|
|
21
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
flattenTree,
|
|
3
|
+
hasActive
|
|
4
|
+
} from "./chunk-EDUYFB4P.js";
|
|
5
|
+
|
|
6
|
+
// src/contexts/tree.tsx
|
|
7
|
+
import { usePathname } from "next/navigation";
|
|
8
|
+
import { createContext, useContext, useMemo } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var TreeContext = createContext(void 0);
|
|
11
|
+
function findRoot(items, pathname) {
|
|
12
|
+
for (const item of items) {
|
|
13
|
+
if (item.type === "folder") {
|
|
14
|
+
const root = findRoot(item.children, pathname);
|
|
15
|
+
if (root)
|
|
16
|
+
return root;
|
|
17
|
+
if (item.root === true && hasActive(item.children, pathname)) {
|
|
18
|
+
return item;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function TreeContextProvider({
|
|
24
|
+
children,
|
|
25
|
+
tree
|
|
26
|
+
}) {
|
|
27
|
+
const pathname = usePathname();
|
|
28
|
+
const value = useMemo(() => {
|
|
29
|
+
const root = findRoot(tree.children, pathname) ?? tree;
|
|
30
|
+
const list = flattenTree(root.children);
|
|
31
|
+
return {
|
|
32
|
+
root,
|
|
33
|
+
list,
|
|
34
|
+
tree
|
|
35
|
+
};
|
|
36
|
+
}, [pathname, tree]);
|
|
37
|
+
return /* @__PURE__ */ jsx(TreeContext.Provider, { value, children });
|
|
38
|
+
}
|
|
39
|
+
function useTreeContext() {
|
|
40
|
+
const ctx = useContext(TreeContext);
|
|
41
|
+
if (!ctx)
|
|
42
|
+
throw new Error("You must wrap this component under <DocsLayout />");
|
|
43
|
+
return ctx;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
TreeContextProvider,
|
|
48
|
+
useTreeContext
|
|
49
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/contexts/i18n.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
var defaultTranslations = {
|
|
4
|
+
search: "Search",
|
|
5
|
+
searchNoResult: "No results found",
|
|
6
|
+
toc: "On this page",
|
|
7
|
+
lastUpdate: "Last updated on",
|
|
8
|
+
chooseLanguage: "Choose a language"
|
|
9
|
+
};
|
|
10
|
+
var I18nContext = createContext({
|
|
11
|
+
text: defaultTranslations
|
|
12
|
+
});
|
|
13
|
+
function useI18n() {
|
|
14
|
+
return useContext(I18nContext);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
I18nContext,
|
|
19
|
+
useI18n
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
3
|
+
|
|
4
|
+
declare const Accordions: react.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & react.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const MultipleAccordions: react.ForwardRefExoticComponent<AccordionPrimitive.AccordionMultipleProps & react.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const SingleAccordions: react.ForwardRefExoticComponent<AccordionPrimitive.AccordionSingleProps & react.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const Accordion: react.ForwardRefExoticComponent<Omit<Omit<AccordionPrimitive.AccordionItemProps & react.RefAttributes<HTMLDivElement>, "ref">, "value"> & {
|
|
8
|
+
title: string;
|
|
9
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
|
|
11
|
+
export { Accordion, Accordions, MultipleAccordions, SingleAccordions };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useCopyButton
|
|
4
|
+
} from "../chunk-24NYFO7H.js";
|
|
5
|
+
import {
|
|
6
|
+
buttonVariants
|
|
7
|
+
} from "../chunk-5KW7ATCP.js";
|
|
8
|
+
import {
|
|
9
|
+
cn
|
|
10
|
+
} from "../chunk-KCGRUOMD.js";
|
|
11
|
+
import "../chunk-6C3VEZWH.js";
|
|
12
|
+
|
|
13
|
+
// src/components/accordion.tsx
|
|
14
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
15
|
+
import { CheckIcon, ChevronRightIcon, LinkIcon } from "lucide-react";
|
|
16
|
+
import {
|
|
17
|
+
forwardRef,
|
|
18
|
+
useState,
|
|
19
|
+
useEffect
|
|
20
|
+
} from "react";
|
|
21
|
+
import { cva } from "class-variance-authority";
|
|
22
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
var variants = cva("divide-y divide-border");
|
|
24
|
+
var Accordions = forwardRef((props, ref) => {
|
|
25
|
+
if (props.type === "multiple") {
|
|
26
|
+
return /* @__PURE__ */ jsx(MultipleAccordions, { ref, ...props });
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
SingleAccordions,
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
...props,
|
|
33
|
+
type: "single"
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
Accordions.displayName = "Accordions";
|
|
38
|
+
var MultipleAccordions = forwardRef(({ className, defaultValue, ...props }, ref) => {
|
|
39
|
+
const [defValue, setDefValue] = useState(defaultValue);
|
|
40
|
+
const value = props.value ?? defValue;
|
|
41
|
+
const setValue = props.onValueChange?.bind(props) ?? setDefValue;
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (window.location.hash.length > 0)
|
|
44
|
+
setValue([window.location.hash.substring(1)]);
|
|
45
|
+
}, [setValue]);
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
AccordionPrimitive.Root,
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
value,
|
|
51
|
+
onValueChange: setValue,
|
|
52
|
+
className: cn(variants(), className),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
MultipleAccordions.displayName = "MultipleAccordions";
|
|
58
|
+
var SingleAccordions = forwardRef(({ className, defaultValue, ...props }, ref) => {
|
|
59
|
+
const [defValue, setDefValue] = useState(defaultValue);
|
|
60
|
+
const value = props.value ?? defValue;
|
|
61
|
+
const setValue = props.onValueChange?.bind(props) ?? setDefValue;
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (window.location.hash.length > 0)
|
|
64
|
+
setValue(window.location.hash.substring(1));
|
|
65
|
+
}, [setValue]);
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
AccordionPrimitive.Root,
|
|
68
|
+
{
|
|
69
|
+
ref,
|
|
70
|
+
value,
|
|
71
|
+
onValueChange: setValue,
|
|
72
|
+
collapsible: true,
|
|
73
|
+
className: cn(variants(), className),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
SingleAccordions.displayName = "SingleAccordions";
|
|
79
|
+
var Accordion = forwardRef(({ title, className, children, ...props }, ref) => {
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
AccordionPrimitive.Item,
|
|
82
|
+
{
|
|
83
|
+
ref,
|
|
84
|
+
value: props.id ?? title,
|
|
85
|
+
className: cn("group/accordion scroll-m-20", className),
|
|
86
|
+
...props,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs(AccordionPrimitive.Header, { className: "not-prose flex items-center text-medium text-muted-foreground", children: [
|
|
89
|
+
/* @__PURE__ */ jsxs(AccordionPrimitive.Trigger, { className: "flex w-full items-center gap-1 py-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
|
|
90
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-5 transition-transform duration-200 group-data-[state=open]/accordion:rotate-90" }),
|
|
91
|
+
/* @__PURE__ */ jsx("span", { className: "text-medium font-medium text-foreground", children: title })
|
|
92
|
+
] }),
|
|
93
|
+
props.id ? /* @__PURE__ */ jsx(CopyButton, { id: props.id }) : null
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsx(AccordionPrimitive.Content, { className: "overflow-hidden data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", children: /* @__PURE__ */ jsx("div", { className: "pb-4 pl-6 text-sm prose-no-margin", children }) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
function CopyButton({ id }) {
|
|
101
|
+
const [checked, onClick] = useCopyButton(() => {
|
|
102
|
+
const url = new URL(window.location.href);
|
|
103
|
+
url.hash = id;
|
|
104
|
+
void navigator.clipboard.writeText(url.toString());
|
|
105
|
+
});
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
"aria-label": "Copy Link",
|
|
111
|
+
className: cn(
|
|
112
|
+
buttonVariants({
|
|
113
|
+
color: "ghost",
|
|
114
|
+
className: "opacity-0 transition-all group-data-[state=open]/accordion:opacity-100"
|
|
115
|
+
})
|
|
116
|
+
),
|
|
117
|
+
onClick,
|
|
118
|
+
children: checked ? /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx(LinkIcon, { className: "size-3.5" })
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
Accordion.displayName = "Accordion";
|
|
123
|
+
export {
|
|
124
|
+
Accordion,
|
|
125
|
+
Accordions,
|
|
126
|
+
MultipleAccordions,
|
|
127
|
+
SingleAccordions
|
|
128
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare function Root({ children, className, ...props }: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
4
|
+
declare function API({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
5
|
+
interface APIInfoProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
method?: string;
|
|
7
|
+
route: string;
|
|
8
|
+
}
|
|
9
|
+
declare function APIInfo({ children, className, method, route, ...props }: APIInfoProps): JSX.Element;
|
|
10
|
+
interface PropertyProps {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
deprecated: boolean;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare function Property({ name, type, required, deprecated, children, }: PropertyProps): JSX.Element;
|
|
18
|
+
declare function APIExample({ children, className, ...props }: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { API, APIExample, APIInfo, type APIInfoProps, Property, Root };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
buttonVariants
|
|
4
|
+
} from "../chunk-5KW7ATCP.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "../chunk-KCGRUOMD.js";
|
|
8
|
+
import "../chunk-6C3VEZWH.js";
|
|
9
|
+
|
|
10
|
+
// src/components/api.tsx
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { cva } from "class-variance-authority";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
function Root({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: cn("space-y-24 text-sm text-muted-foreground", className),
|
|
23
|
+
...props,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function API({
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: cn("flex flex-col gap-x-6 gap-y-2 xl:flex-row", className),
|
|
37
|
+
...props,
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
var badgeVariants = cva("rounded-lg border px-1 py-0.5 text-xs font-medium", {
|
|
43
|
+
variants: {
|
|
44
|
+
color: {
|
|
45
|
+
green: "border-green-400/50 bg-green-400/20 text-green-600 dark:text-green-400",
|
|
46
|
+
yellow: "border-yellow-400/50 bg-yellow-400/20 text-yellow-600 dark:text-yellow-400",
|
|
47
|
+
red: "border-red-400/50 bg-red-400/20 text-red-600 dark:text-red-400"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
function APIInfo({
|
|
52
|
+
children,
|
|
53
|
+
className,
|
|
54
|
+
method = "GET",
|
|
55
|
+
route,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
let color = "green";
|
|
59
|
+
if (["GET", "HEAD"].includes(method))
|
|
60
|
+
color = "green";
|
|
61
|
+
if (["POST", "PATCH", "PUT"].includes(method))
|
|
62
|
+
color = "yellow";
|
|
63
|
+
if (["DELETE"].includes(method))
|
|
64
|
+
color = "red";
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex-1", className), ...props, children: [
|
|
66
|
+
/* @__PURE__ */ jsxs("h2", { className: "not-prose mb-2 inline-flex items-center gap-3 font-mono", children: [
|
|
67
|
+
/* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ color })), children: method }),
|
|
68
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs", children: route })
|
|
69
|
+
] }),
|
|
70
|
+
children
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
function Property({
|
|
74
|
+
name,
|
|
75
|
+
type,
|
|
76
|
+
required,
|
|
77
|
+
deprecated,
|
|
78
|
+
children
|
|
79
|
+
}) {
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-col rounded-lg border bg-card p-3 prose-no-margin", children: [
|
|
81
|
+
/* @__PURE__ */ jsxs("h4", { className: "inline-flex items-center gap-4", children: [
|
|
82
|
+
/* @__PURE__ */ jsx("code", { children: name }),
|
|
83
|
+
required ? /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ color: "red" })), children: "Required" }) : null,
|
|
84
|
+
deprecated ? /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ color: "yellow" })), children: "Deprecated" }) : null,
|
|
85
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto font-mono text-[13px] text-muted-foreground", children: type })
|
|
86
|
+
] }),
|
|
87
|
+
children
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
function APIExample({
|
|
91
|
+
children,
|
|
92
|
+
className,
|
|
93
|
+
...props
|
|
94
|
+
}) {
|
|
95
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
96
|
+
return /* @__PURE__ */ jsxs(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: cn(
|
|
100
|
+
"sticky top-14 h-fit xl:w-[40%] xl:min-w-[400px]",
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
...props,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-4 xl:hidden", children: [
|
|
106
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" }),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
className: cn(
|
|
112
|
+
buttonVariants({
|
|
113
|
+
color: "muted",
|
|
114
|
+
size: "lg"
|
|
115
|
+
})
|
|
116
|
+
),
|
|
117
|
+
onClick: () => {
|
|
118
|
+
setIsOpen((v) => !v);
|
|
119
|
+
},
|
|
120
|
+
children: "More Details"
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ jsx("div", { className: cn(!isOpen && "max-xl:hidden"), children })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
API,
|
|
132
|
+
APIExample,
|
|
133
|
+
APIInfo,
|
|
134
|
+
Property,
|
|
135
|
+
Root
|
|
136
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* @defaultValue info
|
|
8
|
+
*/
|
|
9
|
+
type?: "info" | "warn" | "error" | undefined;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
|
|
13
|
+
export { Callout };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "../chunk-KCGRUOMD.js";
|
|
4
|
+
import "../chunk-6C3VEZWH.js";
|
|
5
|
+
|
|
6
|
+
// src/components/callout.tsx
|
|
7
|
+
import { AlertOctagonIcon, AlertTriangleIcon, InfoIcon } from "lucide-react";
|
|
8
|
+
import { forwardRef } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var Callout = forwardRef(
|
|
11
|
+
({ className, children, title, type = "info", icon, ...props }, ref) => {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
className: cn(
|
|
17
|
+
"my-6 flex flex-row gap-2 rounded-lg border bg-card p-3 text-sm text-muted-foreground shadow-md",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
...props,
|
|
21
|
+
children: [
|
|
22
|
+
icon ?? {
|
|
23
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-5 fill-blue-500 text-card" }),
|
|
24
|
+
warn: /* @__PURE__ */ jsx(AlertTriangleIcon, { className: "size-5 fill-orange-500 text-card" }),
|
|
25
|
+
error: /* @__PURE__ */ jsx(AlertOctagonIcon, { className: "size-5 fill-red-500 text-card" })
|
|
26
|
+
}[type],
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { className: "w-0 flex-1", children: [
|
|
28
|
+
title ? /* @__PURE__ */ jsx("div", { className: "mb-0.5 font-medium text-card-foreground", children: title }) : null,
|
|
29
|
+
/* @__PURE__ */ jsx("div", { className: "prose-no-margin", children })
|
|
30
|
+
] })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
Callout.displayName = "Callout";
|
|
37
|
+
export {
|
|
38
|
+
Callout
|
|
39
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LinkProps } from 'fumadocs-core/link';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
declare function Cards(props: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
5
|
+
type CardProps = {
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
} & Omit<LinkProps, 'title'>;
|
|
10
|
+
declare function Card({ icon, title, description, ...props }: CardProps): JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Card, type CardProps, Cards };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type CodeBlockProps = HTMLAttributes<HTMLElement> & {
|
|
5
|
+
allowCopy?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const Pre: react.ForwardRefExoticComponent<HTMLAttributes<HTMLPreElement> & react.RefAttributes<HTMLPreElement>>;
|
|
8
|
+
declare const CodeBlock: react.ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
9
|
+
allowCopy?: boolean | undefined;
|
|
10
|
+
} & react.RefAttributes<HTMLElement>>;
|
|
11
|
+
|
|
12
|
+
export { CodeBlock, type CodeBlockProps, Pre };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CodeBlock,
|
|
4
|
+
Pre
|
|
5
|
+
} from "../chunk-2ZR5Z6B2.js";
|
|
6
|
+
import "../chunk-OG3QOLYP.js";
|
|
7
|
+
import "../chunk-24NYFO7H.js";
|
|
8
|
+
import "../chunk-5KW7ATCP.js";
|
|
9
|
+
import "../chunk-KCGRUOMD.js";
|
|
10
|
+
import "../chunk-6C3VEZWH.js";
|
|
11
|
+
export {
|
|
12
|
+
CodeBlock,
|
|
13
|
+
Pre
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SearchIndex } from 'algoliasearch/lite';
|
|
2
|
+
import { Options } from 'fumadocs-core/search-algolia/client';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { SharedProps } from './search.mjs';
|
|
5
|
+
import 'fumadocs-core/search/shared';
|
|
6
|
+
|
|
7
|
+
type AlgoliaSearchDialogProps = ContentProps & SharedProps;
|
|
8
|
+
declare function AlgoliaSearchDialog({ searchOptions, index, footer, ...props }: AlgoliaSearchDialogProps): JSX.Element;
|
|
9
|
+
interface ContentProps {
|
|
10
|
+
index: SearchIndex;
|
|
11
|
+
searchOptions?: Options;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { type AlgoliaSearchDialogProps, AlgoliaSearchDialog as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
SearchDialog,
|
|
4
|
+
SearchDialogContent
|
|
5
|
+
} from "../../chunk-IXYX64FW.js";
|
|
6
|
+
import "../../chunk-36MVEJ25.js";
|
|
7
|
+
import "../../chunk-YAHHY62W.js";
|
|
8
|
+
import "../../chunk-5KW7ATCP.js";
|
|
9
|
+
import "../../chunk-KCGRUOMD.js";
|
|
10
|
+
import "../../chunk-6C3VEZWH.js";
|
|
11
|
+
|
|
12
|
+
// src/components/dialog/search-algolia.tsx
|
|
13
|
+
import {
|
|
14
|
+
useAlgoliaSearch
|
|
15
|
+
} from "fumadocs-core/search-algolia/client";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
function AlgoliaSearchDialog({
|
|
18
|
+
searchOptions,
|
|
19
|
+
index,
|
|
20
|
+
footer,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(SearchDialog, { ...props, children: /* @__PURE__ */ jsx(Content, { index, searchOptions, footer }) });
|
|
24
|
+
}
|
|
25
|
+
function Content({ index, searchOptions, footer }) {
|
|
26
|
+
const { search, setSearch, query } = useAlgoliaSearch(index, searchOptions);
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
SearchDialogContent,
|
|
29
|
+
{
|
|
30
|
+
search,
|
|
31
|
+
onSearchChange: setSearch,
|
|
32
|
+
results: query.data ?? [],
|
|
33
|
+
footer
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
AlgoliaSearchDialog as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SharedProps } from './search.mjs';
|
|
3
|
+
import 'fumadocs-core/search/shared';
|
|
4
|
+
|
|
5
|
+
type DefaultSearchDialogProps = SharedProps & ContentProps;
|
|
6
|
+
declare function DefaultSearchDialog({ tag, footer, ...props }: DefaultSearchDialogProps): JSX.Element;
|
|
7
|
+
interface ContentProps {
|
|
8
|
+
/**
|
|
9
|
+
* Search tag
|
|
10
|
+
*/
|
|
11
|
+
tag?: string;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { type DefaultSearchDialogProps, DefaultSearchDialog as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
SearchDialog,
|
|
4
|
+
SearchDialogContent
|
|
5
|
+
} from "../../chunk-IXYX64FW.js";
|
|
6
|
+
import "../../chunk-36MVEJ25.js";
|
|
7
|
+
import {
|
|
8
|
+
useI18n
|
|
9
|
+
} from "../../chunk-YAHHY62W.js";
|
|
10
|
+
import "../../chunk-5KW7ATCP.js";
|
|
11
|
+
import "../../chunk-KCGRUOMD.js";
|
|
12
|
+
import "../../chunk-6C3VEZWH.js";
|
|
13
|
+
|
|
14
|
+
// src/components/dialog/search-default.tsx
|
|
15
|
+
import { useDocsSearch } from "fumadocs-core/search/client";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
function DefaultSearchDialog({
|
|
18
|
+
tag,
|
|
19
|
+
footer,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsx(SearchDialog, { ...props, children: /* @__PURE__ */ jsx(Content, { tag, footer }) });
|
|
23
|
+
}
|
|
24
|
+
function Content({ tag, footer }) {
|
|
25
|
+
const { locale } = useI18n();
|
|
26
|
+
const { search, setSearch, query } = useDocsSearch(locale, tag);
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
SearchDialogContent,
|
|
29
|
+
{
|
|
30
|
+
search,
|
|
31
|
+
onSearchChange: setSearch,
|
|
32
|
+
results: query.data ?? [],
|
|
33
|
+
footer
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
DefaultSearchDialog as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SortedResult } from 'fumadocs-core/search/shared';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SharedProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
interface SearchDialogProps extends SharedProps {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function SearchDialog(props: SearchDialogProps): JSX.Element;
|
|
12
|
+
interface SearchContentProps extends SearchProps {
|
|
13
|
+
/**
|
|
14
|
+
* displayed at bottom
|
|
15
|
+
*/
|
|
16
|
+
footer?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare function SearchDialogContent({ footer, ...props }: SearchContentProps): JSX.Element;
|
|
19
|
+
interface SearchProps {
|
|
20
|
+
search: string;
|
|
21
|
+
onSearchChange: (v: string) => void;
|
|
22
|
+
results: SortedResult[] | 'empty';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { SearchDialog, SearchDialogContent, type SharedProps };
|