fumadocs-ui 16.0.9 → 16.0.11
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/components/callout.d.ts +10 -4
- package/dist/components/callout.d.ts.map +1 -1
- package/dist/components/callout.js +21 -10
- package/dist/components/card.js +1 -1
- package/dist/contexts/layout.d.ts.map +1 -1
- package/dist/contexts/layout.js +6 -7
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +12 -13
- package/dist/contexts/sidebar.d.ts +1 -7
- package/dist/contexts/sidebar.d.ts.map +1 -1
- package/dist/contexts/sidebar.js +8 -5
- package/dist/contexts/tree.d.ts.map +1 -1
- package/dist/contexts/tree.js +13 -13
- package/dist/layouts/docs/page-client.d.ts.map +1 -1
- package/dist/layouts/docs/page-client.js +5 -5
- package/dist/mdx.d.ts +5 -5
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +4 -1
- package/dist/style.css +3 -3
- package/package.json +3 -3
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
export type CalloutType = 'info' | 'warn' | 'error' | 'success' | 'warning';
|
|
3
|
+
export declare function Callout({ children, title, ...props }: {
|
|
3
4
|
title?: ReactNode;
|
|
5
|
+
} & Omit<CalloutContainerProps, 'title'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface CalloutContainerProps extends ComponentProps<'div'> {
|
|
4
7
|
/**
|
|
5
8
|
* @defaultValue info
|
|
6
9
|
*/
|
|
7
|
-
type?:
|
|
10
|
+
type?: CalloutType;
|
|
8
11
|
/**
|
|
9
12
|
* Force an icon
|
|
10
13
|
*/
|
|
11
14
|
icon?: ReactNode;
|
|
12
|
-
}
|
|
15
|
+
}
|
|
16
|
+
export declare function CalloutContainer({ type: inputType, icon, children, className, style, ...props }: CalloutContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function CalloutTitle({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function CalloutDescription({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
13
19
|
//# sourceMappingURL=callout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAI5E,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,2CAO9D;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAClE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EAAE,SAAkB,EACxB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA4BvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAMrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAYrB"}
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CircleCheck, CircleX, Info, TriangleAlert } from '../icons.js';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
3
|
import { cn } from '../utils/cn.js';
|
|
5
4
|
const iconClass = 'size-5 -me-0.5 fill-(--callout-color) text-fd-card';
|
|
6
|
-
export
|
|
5
|
+
export function Callout({ children, title, ...props }) {
|
|
6
|
+
return (_jsxs(CalloutContainer, { ...props, children: [title && _jsx(CalloutTitle, { children: title }), _jsx(CalloutDescription, { children: children })] }));
|
|
7
|
+
}
|
|
8
|
+
function resolveAlias(type) {
|
|
7
9
|
if (type === 'warn')
|
|
8
|
-
|
|
10
|
+
return 'warning';
|
|
9
11
|
if (type === 'tip')
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
+
return 'info';
|
|
13
|
+
return type;
|
|
14
|
+
}
|
|
15
|
+
export function CalloutContainer({ type: inputType = 'info', icon, children, className, style, ...props }) {
|
|
16
|
+
const type = resolveAlias(inputType);
|
|
17
|
+
return (_jsxs("div", { className: cn('flex gap-2 my-4 rounded-xl border bg-fd-card p-3 ps-1 text-sm text-fd-card-foreground shadow-md', className), style: {
|
|
12
18
|
'--callout-color': `var(--color-fd-${type}, var(--color-fd-muted))`,
|
|
13
|
-
...
|
|
14
|
-
}, children: [_jsx("div", { role: "none", className: "w-0.5 bg-(--callout-color)/50 rounded-sm" }), icon ??
|
|
19
|
+
...style,
|
|
20
|
+
}, ...props, children: [_jsx("div", { role: "none", className: "w-0.5 bg-(--callout-color)/50 rounded-sm" }), icon ??
|
|
15
21
|
{
|
|
16
22
|
info: _jsx(Info, { className: iconClass }),
|
|
17
23
|
warning: _jsx(TriangleAlert, { className: iconClass }),
|
|
18
24
|
error: _jsx(CircleX, { className: iconClass }),
|
|
19
25
|
success: _jsx(CircleCheck, { className: iconClass }),
|
|
20
|
-
}[type],
|
|
21
|
-
}
|
|
22
|
-
|
|
26
|
+
}[type], _jsx("div", { className: "flex flex-col gap-2 min-w-0 flex-1", children: children })] }));
|
|
27
|
+
}
|
|
28
|
+
export function CalloutTitle({ children, className, ...props }) {
|
|
29
|
+
return (_jsx("p", { className: cn('font-medium my-0!', className), ...props, children: children }));
|
|
30
|
+
}
|
|
31
|
+
export function CalloutDescription({ children, className, ...props }) {
|
|
32
|
+
return (_jsx("div", { className: cn('text-fd-muted-foreground prose-no-margin empty:hidden', className), ...props, children: children }));
|
|
33
|
+
}
|
package/dist/components/card.js
CHANGED
|
@@ -6,5 +6,5 @@ export function Cards(props) {
|
|
|
6
6
|
}
|
|
7
7
|
export function Card({ icon, title, description, ...props }) {
|
|
8
8
|
const E = props.href ? Link : 'div';
|
|
9
|
-
return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "
|
|
9
|
+
return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "my-0! text-sm text-fd-muted-foreground", children: description })) : null, _jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin empty:hidden", children: props.children })] }));
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/contexts/layout.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/contexts/layout.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD,wBAAgB,aAAa,eAE5B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAItC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAC7C;AAED,UAAU,cAAc;IACtB,aAAa,EAAE,OAAO,CAAC;CACxB;AAMD,wBAAgB,WAAW,CAAC,EAC1B,eAAwB,EACxB,QAAQ,GACT,EAAE,gBAAgB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAwB5C;AAED,wBAAgB,MAAM,IAAI,cAAc,CAEvC"}
|
package/dist/contexts/layout.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { createContext } from 'fumadocs-core/framework';
|
|
3
|
+
import { useEffect, useMemo, useState, createContext, use, } from 'react';
|
|
5
4
|
/**
|
|
6
5
|
* applied styles to different layout components in `Page` from layouts
|
|
7
6
|
*/
|
|
8
|
-
const StylesContext = createContext(
|
|
7
|
+
const StylesContext = createContext({
|
|
9
8
|
tocNav: 'xl:hidden',
|
|
10
9
|
toc: 'max-xl:hidden',
|
|
11
10
|
});
|
|
12
11
|
export function usePageStyles() {
|
|
13
|
-
return
|
|
12
|
+
return use(StylesContext);
|
|
14
13
|
}
|
|
15
14
|
export function StylesProvider({ children, ...value }) {
|
|
16
15
|
return (_jsx(StylesContext.Provider, { value: value, children: children }));
|
|
17
16
|
}
|
|
18
|
-
const NavContext = createContext(
|
|
17
|
+
const NavContext = createContext({
|
|
19
18
|
isTransparent: false,
|
|
20
19
|
});
|
|
21
20
|
export function NavProvider({ transparentMode = 'none', children, }) {
|
|
@@ -32,8 +31,8 @@ export function NavProvider({ transparentMode = 'none', children, }) {
|
|
|
32
31
|
window.removeEventListener('scroll', listener);
|
|
33
32
|
};
|
|
34
33
|
}, [transparentMode]);
|
|
35
|
-
return (_jsx(NavContext
|
|
34
|
+
return (_jsx(NavContext, { value: useMemo(() => ({ isTransparent: transparent }), [transparent]), children: children }));
|
|
36
35
|
}
|
|
37
36
|
export function useNav() {
|
|
38
|
-
return
|
|
37
|
+
return use(NavContext);
|
|
39
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/contexts/search.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/contexts/search.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAEf,UAAU,MAAM;IACd,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IAErB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAQD,wBAAgB,gBAAgB,IAAI,iBAAiB,CAEpD;AAcD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,QAAQ,EACR,OAAc,EACd,OAAO,EACP,MASC,EACD,KAAK,GACN,EAAE,mBAAmB,2CA2CrB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,aAI/D"}
|
package/dist/contexts/search.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo, useState, } from 'react';
|
|
4
|
-
|
|
5
|
-
const SearchContext = createContext('SearchContext', {
|
|
3
|
+
import { useEffect, useMemo, useState, createContext, use, useEffectEvent, } from 'react';
|
|
4
|
+
const SearchContext = createContext({
|
|
6
5
|
enabled: false,
|
|
7
6
|
hotKey: [],
|
|
8
7
|
setOpenSearch: () => undefined,
|
|
9
8
|
});
|
|
10
9
|
export function useSearchContext() {
|
|
11
|
-
return
|
|
10
|
+
return use(SearchContext);
|
|
12
11
|
}
|
|
13
12
|
function MetaOrControl() {
|
|
14
13
|
const [key, setKey] = useState('⌘');
|
|
@@ -30,19 +29,19 @@ export function SearchProvider({ SearchDialog, children, preload = true, options
|
|
|
30
29
|
},
|
|
31
30
|
], links, }) {
|
|
32
31
|
const [isOpen, setIsOpen] = useState(preload ? false : undefined);
|
|
32
|
+
const onKeyDown = useEffectEvent((e) => {
|
|
33
|
+
if (hotKey.every((v) => typeof v.key === 'string' ? e.key === v.key : v.key(e))) {
|
|
34
|
+
setIsOpen(true);
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
33
38
|
useEffect(() => {
|
|
34
|
-
|
|
35
|
-
if (hotKey.every((v) => typeof v.key === 'string' ? e.key === v.key : v.key(e))) {
|
|
36
|
-
setIsOpen(true);
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
window.addEventListener('keydown', handler);
|
|
39
|
+
window.addEventListener('keydown', onKeyDown);
|
|
41
40
|
return () => {
|
|
42
|
-
window.removeEventListener('keydown',
|
|
41
|
+
window.removeEventListener('keydown', onKeyDown);
|
|
43
42
|
};
|
|
44
43
|
}, [hotKey]);
|
|
45
|
-
return (_jsxs(SearchContext
|
|
44
|
+
return (_jsxs(SearchContext, { value: useMemo(() => ({
|
|
46
45
|
enabled: true,
|
|
47
46
|
hotKey,
|
|
48
47
|
setOpenSearch: setIsOpen,
|
|
@@ -9,13 +9,7 @@ interface SidebarContext {
|
|
|
9
9
|
*/
|
|
10
10
|
closeOnRedirect: RefObject<boolean>;
|
|
11
11
|
}
|
|
12
|
-
declare const SidebarContext:
|
|
13
|
-
Provider: (props: {
|
|
14
|
-
value: SidebarContext;
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
use: (errorMessage?: string) => SidebarContext;
|
|
18
|
-
};
|
|
12
|
+
declare const SidebarContext: import("react").Context<SidebarContext | null>;
|
|
19
13
|
export declare function useSidebar(): SidebarContext;
|
|
20
14
|
export declare function SidebarProvider({ children, }: {
|
|
21
15
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/sidebar.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAIf,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5D;;OAEG;IACH,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CACrC;AAED,QAAA,MAAM,cAAc,gDAA6C,CAAC;AAElE,wBAAgB,UAAU,IAAI,cAAc,CAQ3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CA6BZ"}
|
package/dist/contexts/sidebar.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useRef, useState, } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { useMemo, useRef, useState, createContext, use, } from 'react';
|
|
4
|
+
import { usePathname } from 'fumadocs-core/framework';
|
|
5
5
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
|
-
const SidebarContext = createContext(
|
|
6
|
+
const SidebarContext = createContext(null);
|
|
7
7
|
export function useSidebar() {
|
|
8
|
-
|
|
8
|
+
const ctx = use(SidebarContext);
|
|
9
|
+
if (!ctx)
|
|
10
|
+
throw new Error('Missing SidebarContext, make sure you have wrapped the component in <RootProvider /> and the context is available.');
|
|
11
|
+
return ctx;
|
|
9
12
|
}
|
|
10
13
|
export function SidebarProvider({ children, }) {
|
|
11
14
|
const closeOnRedirect = useRef(true);
|
|
@@ -18,7 +21,7 @@ export function SidebarProvider({ children, }) {
|
|
|
18
21
|
}
|
|
19
22
|
closeOnRedirect.current = true;
|
|
20
23
|
});
|
|
21
|
-
return (_jsx(SidebarContext
|
|
24
|
+
return (_jsx(SidebarContext, { value: useMemo(() => ({
|
|
22
25
|
open,
|
|
23
26
|
setOpen,
|
|
24
27
|
collapsed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/contexts/tree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/contexts/tree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,KAAK,SAAS,EAAuC,MAAM,OAAO,CAAC;AAG5E,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5E,UAAU,eAAe;IACvB,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3D,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;CACrB;AAKD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CA8BA;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAAC,IAAI,EAAE,CAE7C;AAED,wBAAgB,cAAc,IAAI,eAAe,CAMhD"}
|
package/dist/contexts/tree.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo, useRef } from 'react';
|
|
3
|
+
import { usePathname } from 'fumadocs-core/framework';
|
|
4
|
+
import { useMemo, useRef, createContext, use } from 'react';
|
|
5
5
|
import { searchPath } from 'fumadocs-core/breadcrumb';
|
|
6
|
-
const TreeContext = createContext(
|
|
7
|
-
const PathContext = createContext(
|
|
6
|
+
const TreeContext = createContext(null);
|
|
7
|
+
const PathContext = createContext([]);
|
|
8
8
|
export function TreeContextProvider(props) {
|
|
9
9
|
const nextIdRef = useRef(0);
|
|
10
10
|
const pathname = usePathname();
|
|
@@ -13,20 +13,20 @@ export function TreeContextProvider(props) {
|
|
|
13
13
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
14
|
const tree = useMemo(() => props.tree, [props.tree.$id ?? props.tree]);
|
|
15
15
|
const path = useMemo(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (tree.fallback)
|
|
20
|
-
result = searchPath(tree.fallback.children, pathname);
|
|
21
|
-
return result ?? [];
|
|
16
|
+
return (searchPath(tree.children, pathname) ??
|
|
17
|
+
(tree.fallback ? searchPath(tree.fallback.children, pathname) : null) ??
|
|
18
|
+
[]);
|
|
22
19
|
}, [tree, pathname]);
|
|
23
20
|
const root = path.findLast((item) => item.type === 'folder' && item.root) ?? tree;
|
|
24
21
|
root.$id ?? (root.$id = String(nextIdRef.current++));
|
|
25
|
-
return (_jsx(TreeContext
|
|
22
|
+
return (_jsx(TreeContext, { value: useMemo(() => ({ root, full: tree }), [root, tree]), children: _jsx(PathContext, { value: path, children: props.children }) }));
|
|
26
23
|
}
|
|
27
24
|
export function useTreePath() {
|
|
28
|
-
return
|
|
25
|
+
return use(PathContext);
|
|
29
26
|
}
|
|
30
27
|
export function useTreeContext() {
|
|
31
|
-
|
|
28
|
+
const ctx = use(TreeContext);
|
|
29
|
+
if (!ctx)
|
|
30
|
+
throw new Error('You must wrap this component under <DocsLayout />');
|
|
31
|
+
return ctx;
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-client.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/page-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"page-client.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/page-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EASpB,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAiBlC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAoDpE;AA4DD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAUjE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAwD1D;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,2CAiBjE;AAED,KAAK,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC,CAAC;AAChE,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,KAAK,CAAC;IACxD;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,IAAI,CAAC;KACb,CAAC;CACH;AAyBD,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAiC1D;AA8BD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExE,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,GAAG,KAAK,EACT,EAAE,eAAe,kDA6CjB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAuBnD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Fragment, useEffect, useEffectEvent, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { Fragment, useEffect, useEffectEvent, createContext, useMemo, useRef, useState, use, } from 'react';
|
|
4
4
|
import { ChevronDown, ChevronLeft, ChevronRight } from '../../icons.js';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
6
|
import { cn } from '../../utils/cn.js';
|
|
7
7
|
import { useI18n } from '../../contexts/i18n.js';
|
|
8
8
|
import { useTreeContext, useTreePath } from '../../contexts/tree.js';
|
|
9
|
-
import {
|
|
9
|
+
import { usePathname } from 'fumadocs-core/framework';
|
|
10
10
|
import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
|
|
11
11
|
import { useNav } from '../../contexts/layout.js';
|
|
12
12
|
import { isActive } from '../../utils/is-active.js';
|
|
@@ -14,10 +14,10 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '../../comp
|
|
|
14
14
|
import { useSidebar } from '../../contexts/sidebar.js';
|
|
15
15
|
import { useTOCItems } from '../../components/layout/toc.js';
|
|
16
16
|
import { useActiveAnchor } from 'fumadocs-core/toc';
|
|
17
|
-
const TocPopoverContext = createContext(
|
|
17
|
+
const TocPopoverContext = createContext(null);
|
|
18
18
|
export function PageTOCPopoverTrigger(props) {
|
|
19
19
|
const { text } = useI18n();
|
|
20
|
-
const { open } =
|
|
20
|
+
const { open } = use(TocPopoverContext);
|
|
21
21
|
const items = useTOCItems();
|
|
22
22
|
const active = useActiveAnchor();
|
|
23
23
|
const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
|
|
@@ -66,7 +66,7 @@ export function PageTOCPopover(props) {
|
|
|
66
66
|
window.removeEventListener('click', onClick);
|
|
67
67
|
};
|
|
68
68
|
}, []);
|
|
69
|
-
return (_jsx(TocPopoverContext
|
|
69
|
+
return (_jsx(TocPopoverContext, { value: useMemo(() => ({
|
|
70
70
|
open,
|
|
71
71
|
setOpen,
|
|
72
72
|
}), [setOpen, open]), children: _jsx(Collapsible, { open: open, onOpenChange: setOpen, asChild: true, children: _jsx("header", { ref: ref, id: "nd-tocnav", ...props, className: cn('fixed pr-(--removed-body-scroll-bar-size,0) z-10 border-b backdrop-blur-sm transition-colors xl:hidden max-xl:on-root:[--fd-tocnav-height:40px]', (!isTransparent || open) && 'bg-fd-background/80', open && 'shadow-lg', props.className), style: {
|
package/dist/mdx.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from 'react';
|
|
2
2
|
import { Card, Cards } from './components/card.js';
|
|
3
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from './components/callout.js';
|
|
3
4
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from './components/codeblock.js';
|
|
4
5
|
declare function Image(props: ImgHTMLAttributes<HTMLImageElement> & {
|
|
5
6
|
sizes?: string;
|
|
@@ -22,11 +23,10 @@ declare const defaultMdxComponents: {
|
|
|
22
23
|
h5: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
h6: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
table: typeof Table;
|
|
25
|
-
Callout:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
Callout: typeof Callout;
|
|
27
|
+
CalloutContainer: typeof CalloutContainer;
|
|
28
|
+
CalloutTitle: typeof CalloutTitle;
|
|
29
|
+
CalloutDescription: typeof CalloutDescription;
|
|
30
30
|
};
|
|
31
31
|
export declare const createRelativeLink: typeof import('./mdx.server.js').createRelativeLink;
|
|
32
32
|
export { defaultMdxComponents as default };
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAEL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,wBAAwB,CAAC;AAEhC,iBAAS,KAAK,CACZ,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAUF;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;;;;;iBAKX,cAAc,CAAC,cAAc,CAAC;;;OAOhC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;CAQ/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,cAAc,EAAE,kBAK5D,CAAC;AAEJ,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import Link from 'fumadocs-core/link';
|
|
3
3
|
import { Image as FrameworkImage } from 'fumadocs-core/framework';
|
|
4
4
|
import { Card, Cards } from './components/card.js';
|
|
5
|
-
import { Callout } from './components/callout.js';
|
|
5
|
+
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from './components/callout.js';
|
|
6
6
|
import { Heading } from './components/heading.js';
|
|
7
7
|
import { cn } from './utils/cn.js';
|
|
8
8
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre, } from './components/codeblock.js';
|
|
@@ -30,6 +30,9 @@ const defaultMdxComponents = {
|
|
|
30
30
|
h6: (props) => (_jsx(Heading, { as: "h6", ...props })),
|
|
31
31
|
table: Table,
|
|
32
32
|
Callout,
|
|
33
|
+
CalloutContainer,
|
|
34
|
+
CalloutTitle,
|
|
35
|
+
CalloutDescription,
|
|
33
36
|
};
|
|
34
37
|
export const createRelativeLink = () => {
|
|
35
38
|
throw new Error('`createRelativeLink` is only supported in Node.js environment');
|
package/dist/style.css
CHANGED
|
@@ -447,12 +447,12 @@
|
|
|
447
447
|
.mx-auto {
|
|
448
448
|
margin-inline: auto;
|
|
449
449
|
}
|
|
450
|
-
.\!my-0 {
|
|
451
|
-
margin-block: calc(var(--spacing) * 0) !important;
|
|
452
|
-
}
|
|
453
450
|
.my-0 {
|
|
454
451
|
margin-block: calc(var(--spacing) * 0);
|
|
455
452
|
}
|
|
453
|
+
.my-0\! {
|
|
454
|
+
margin-block: calc(var(--spacing) * 0) !important;
|
|
455
|
+
}
|
|
456
456
|
.my-4 {
|
|
457
457
|
margin-block: calc(var(--spacing) * 4);
|
|
458
458
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.11",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"react-medium-image-zoom": "^5.4.0",
|
|
122
122
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
123
123
|
"tailwind-merge": "^3.3.1",
|
|
124
|
-
"fumadocs-core": "16.0.
|
|
124
|
+
"fumadocs-core": "16.0.11"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"@next/eslint-plugin-next": "16.0.1",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"tsc-alias": "^1.8.16",
|
|
136
136
|
"@fumadocs/cli": "1.0.3",
|
|
137
137
|
"eslint-config-custom": "0.0.0",
|
|
138
|
-
"fumadocs-core": "16.0.
|
|
138
|
+
"fumadocs-core": "16.0.11",
|
|
139
139
|
"tsconfig": "0.0.0"
|
|
140
140
|
},
|
|
141
141
|
"peerDependencies": {
|