fumadocs-ui 15.0.18 → 15.1.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/contexts/i18n.d.ts +26 -0
- package/dist/contexts/i18n.d.ts.map +1 -1
- package/dist/contexts/i18n.js +32 -0
- package/dist/i18n.d.ts +1 -23
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +1 -34
- package/dist/layouts/shared.d.ts +3 -2
- package/dist/layouts/shared.d.ts.map +1 -1
- package/dist/mdx.server.d.ts.map +1 -1
- package/dist/mdx.server.js +5 -9
- package/dist/page.client.d.ts +5 -8
- package/dist/page.client.d.ts.map +1 -1
- package/dist/page.client.js +10 -5
- package/dist/provider.d.ts +2 -2
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +2 -2
- package/dist/style.css +3 -6
- package/package.json +8 -8
package/dist/contexts/i18n.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
export interface Translations {
|
|
2
3
|
search: string;
|
|
3
4
|
searchNoResult: string;
|
|
@@ -26,5 +27,30 @@ export declare function I18nLabel(props: {
|
|
|
26
27
|
label: keyof Translations;
|
|
27
28
|
}): string;
|
|
28
29
|
export declare function useI18n(): I18nContextType;
|
|
30
|
+
export interface I18nProviderProps {
|
|
31
|
+
/**
|
|
32
|
+
* Current locale
|
|
33
|
+
*/
|
|
34
|
+
locale: string;
|
|
35
|
+
/**
|
|
36
|
+
* Handle changes to the locale, redirect user when not specified.
|
|
37
|
+
*/
|
|
38
|
+
onLocaleChange?: (v: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Translations of current locale
|
|
41
|
+
*/
|
|
42
|
+
translations?: Partial<Translations>;
|
|
43
|
+
/**
|
|
44
|
+
* Available languages
|
|
45
|
+
*/
|
|
46
|
+
locales?: LocaleItem[];
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export declare function I18nProvider({ locales, locale, onChange: _onChange, onLocaleChange, ...props }: I18nProviderProps & {
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated use `onLocaleChange` instead
|
|
52
|
+
*/
|
|
53
|
+
onChange?: I18nProviderProps['onLocaleChange'];
|
|
54
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
55
|
export {};
|
|
30
56
|
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/i18n.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/i18n.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IAEvB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IAEtB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,eAAe;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,YAWjC,CAAC;AAEF,eAAO,MAAM,WAAW,0CAEtB,CAAC;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,YAAY,CAAA;CAAE,GAAG,MAAM,CAItE;AAED,wBAAgB,OAAO,IAAI,eAAe,CAEzC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IAEvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAY,EACZ,MAAM,EACN,QAAQ,EAAE,SAAS,EACnB,cAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAChD,2CAsCA"}
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useContext } from 'react';
|
|
4
|
+
import { usePathname, useRouter } from 'next/navigation';
|
|
5
|
+
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
6
|
+
import { useMemo } from 'react';
|
|
3
7
|
export const defaultTranslations = {
|
|
4
8
|
search: 'Search',
|
|
5
9
|
searchNoResult: 'No results found',
|
|
@@ -22,3 +26,31 @@ export function I18nLabel(props) {
|
|
|
22
26
|
export function useI18n() {
|
|
23
27
|
return useContext(I18nContext);
|
|
24
28
|
}
|
|
29
|
+
export function I18nProvider({ locales = [], locale, onChange: _onChange, onLocaleChange = _onChange, ...props }) {
|
|
30
|
+
const router = useRouter();
|
|
31
|
+
const pathname = usePathname();
|
|
32
|
+
const onChange = useEffectEvent((value) => {
|
|
33
|
+
if (onLocaleChange) {
|
|
34
|
+
return onLocaleChange(value);
|
|
35
|
+
}
|
|
36
|
+
const segments = pathname.split('/').filter((v) => v.length > 0);
|
|
37
|
+
// If locale prefix hidden
|
|
38
|
+
if (segments[0] !== locale) {
|
|
39
|
+
segments.unshift(value);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
segments[0] = value;
|
|
43
|
+
}
|
|
44
|
+
router.push(`/${segments.join('/')}`);
|
|
45
|
+
router.refresh();
|
|
46
|
+
});
|
|
47
|
+
return (_jsx(I18nContext.Provider, { value: useMemo(() => ({
|
|
48
|
+
locale,
|
|
49
|
+
locales,
|
|
50
|
+
text: {
|
|
51
|
+
...defaultTranslations,
|
|
52
|
+
...props.translations,
|
|
53
|
+
},
|
|
54
|
+
onChange,
|
|
55
|
+
}), [locale, locales, onChange, props.translations]), children: props.children }));
|
|
56
|
+
}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Translations, defaultTranslations, type LocaleItem } from './contexts/i18n.js';
|
|
3
|
-
interface I18nProviderProps {
|
|
4
|
-
/**
|
|
5
|
-
* Current locale
|
|
6
|
-
*/
|
|
7
|
-
locale: string;
|
|
8
|
-
/**
|
|
9
|
-
* Translations of current locale
|
|
10
|
-
*/
|
|
11
|
-
translations?: Partial<Translations>;
|
|
12
|
-
/**
|
|
13
|
-
* Available languages
|
|
14
|
-
*/
|
|
15
|
-
locales?: LocaleItem[];
|
|
16
|
-
/**
|
|
17
|
-
* Handle changes to the locale, redirect user when not specified.
|
|
18
|
-
*/
|
|
19
|
-
onChange?: (v: string) => void;
|
|
20
|
-
children: ReactNode;
|
|
21
|
-
}
|
|
22
|
-
export declare function I18nProvider({ locales, locale, ...props }: I18nProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export { defaultTranslations, type Translations };
|
|
1
|
+
export { defaultTranslations, type Translations, I18nProvider, type I18nProviderProps, } from './contexts/i18n.js';
|
|
24
2
|
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,YAAY,EACjB,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC"}
|
package/dist/i18n.js
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { useRouter, usePathname } from 'next/navigation';
|
|
5
|
-
import { I18nContext, defaultTranslations, } from './contexts/i18n.js';
|
|
6
|
-
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
7
|
-
export function I18nProvider({ locales = [], locale, ...props }) {
|
|
8
|
-
const router = useRouter();
|
|
9
|
-
const pathname = usePathname();
|
|
10
|
-
const onChange = props.onChange ??
|
|
11
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- always controlled
|
|
12
|
-
useEffectEvent((value) => {
|
|
13
|
-
const segments = pathname.split('/').filter((v) => v.length > 0);
|
|
14
|
-
// If locale prefix hidden
|
|
15
|
-
if (segments[0] !== locale) {
|
|
16
|
-
segments.unshift(value);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
segments[0] = value;
|
|
20
|
-
}
|
|
21
|
-
router.push(`/${segments.join('/')}`);
|
|
22
|
-
router.refresh();
|
|
23
|
-
});
|
|
24
|
-
return (_jsx(I18nContext.Provider, { value: useMemo(() => ({
|
|
25
|
-
locale,
|
|
26
|
-
locales,
|
|
27
|
-
text: {
|
|
28
|
-
...defaultTranslations,
|
|
29
|
-
...props.translations,
|
|
30
|
-
},
|
|
31
|
-
onChange,
|
|
32
|
-
}), [locale, locales, onChange, props.translations]), children: props.children }));
|
|
33
|
-
}
|
|
34
|
-
export { defaultTranslations };
|
|
1
|
+
export { defaultTranslations, I18nProvider, } from './contexts/i18n.js';
|
package/dist/layouts/shared.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { LinkItemType } from '../layouts/links.js';
|
|
3
3
|
import type { NavProviderProps, TitleProps } from '../components/layout/nav.js';
|
|
4
|
+
import type { I18nConfig } from 'fumadocs-core/i18n';
|
|
4
5
|
export interface NavOptions extends SharedNavProps {
|
|
5
6
|
enabled: boolean;
|
|
6
7
|
component: ReactNode;
|
|
@@ -27,11 +28,11 @@ export interface BaseLayoutProps {
|
|
|
27
28
|
*/
|
|
28
29
|
disableThemeSwitch?: boolean;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* I18n options
|
|
31
32
|
*
|
|
32
33
|
* @defaultValue false
|
|
33
34
|
*/
|
|
34
|
-
i18n?: boolean;
|
|
35
|
+
i18n?: boolean | I18nConfig;
|
|
35
36
|
/**
|
|
36
37
|
* GitHub url
|
|
37
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/layouts/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/layouts/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU,EAAE,gBAAgB;IAClE;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,GAAG,mBAAmB,CAAC;KAC3C,CAAC;IAEF;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,KAAK,CAAC,EAAE,YAAY,EAAE,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,EAAE,CAqBhB;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EACC;IACE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACD,SAAS,EACb,GAAG,EAAE,SAAS,EACd,oBAAoB,CAAC,EAAE,MAAM,EAC7B,QAAQ,CAAC,EAAE,SAAS,GACnB,SAAS,CAMX"}
|
package/dist/mdx.server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx.server.d.ts","sourceRoot":"","sources":["../src/mdx.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,oBAAoB,MAAM,OAAO,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,EAClC,IAAI,EAAE,IAAI,EACV,YAAY,GAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAA0B,GAC7D,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAUzB;AAED,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/mdx.server.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import defaultMdxComponents from './mdx.js';
|
|
3
|
-
import * as path from 'node:path';
|
|
4
3
|
/**
|
|
5
4
|
* Extend the default Link component to resolve relative file paths in `href`.
|
|
6
5
|
*
|
|
@@ -10,14 +9,11 @@ import * as path from 'node:path';
|
|
|
10
9
|
*/
|
|
11
10
|
export function createRelativeLink(source, page, OverrideLink = defaultMdxComponents.a) {
|
|
12
11
|
return async function RelativeLink({ href, ...props }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(href
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const targetPage = pages.find((item) => item.file.path === hrefPath);
|
|
19
|
-
if (targetPage)
|
|
20
|
-
href = targetPage.url;
|
|
12
|
+
// resolve relative href
|
|
13
|
+
if (href && href.startsWith('.')) {
|
|
14
|
+
const target = source.getPageByHref(href, { dir: page.file.dirname });
|
|
15
|
+
if (target)
|
|
16
|
+
href = target.page.url;
|
|
21
17
|
}
|
|
22
18
|
return _jsx(OverrideLink, { href: href, ...props });
|
|
23
19
|
};
|
package/dist/page.client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import type { PageTree } from 'fumadocs-core/server';
|
|
2
3
|
import { type BreadcrumbOptions } from 'fumadocs-core/breadcrumb';
|
|
3
4
|
export declare function TocPopoverHeader(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
export declare function PageBody(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,22 +7,18 @@ export declare function PageArticle(props: HTMLAttributes<HTMLElement>): import(
|
|
|
6
7
|
export declare function LastUpdate(props: {
|
|
7
8
|
date: Date;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
type Item = Pick<PageTree.Item, 'name' | 'description' | 'url'>;
|
|
9
11
|
export interface FooterProps {
|
|
10
12
|
/**
|
|
11
13
|
* Items including information for the next and previous page
|
|
12
14
|
*/
|
|
13
15
|
items?: {
|
|
14
|
-
previous?:
|
|
15
|
-
|
|
16
|
-
url: string;
|
|
17
|
-
};
|
|
18
|
-
next?: {
|
|
19
|
-
name: string;
|
|
20
|
-
url: string;
|
|
21
|
-
};
|
|
16
|
+
previous?: Item;
|
|
17
|
+
next?: Item;
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
export declare function Footer({ items }: FooterProps): import("react/jsx-runtime").JSX.Element;
|
|
25
21
|
export type BreadcrumbProps = BreadcrumbOptions;
|
|
26
22
|
export declare function Breadcrumb(options: BreadcrumbProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export {};
|
|
27
24
|
//# sourceMappingURL=page.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAMlC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CA8CrE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAY7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAe7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAc/C;AAED,KAAK,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC,CAAC;AAChE,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,IAAI,CAAC;KACb,CAAC;CACH;AAyBD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,2CA+B5C;AAuCD,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,kDAsClD"}
|
package/dist/page.client.js
CHANGED
|
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Fragment, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
4
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
5
|
import Link from 'next/link';
|
|
6
|
-
import { cva } from 'class-variance-authority';
|
|
7
6
|
import { cn } from './utils/cn.js';
|
|
8
7
|
import { useI18n } from './contexts/i18n.js';
|
|
9
8
|
import { useTreeContext, useTreePath } from './contexts/tree.js';
|
|
@@ -54,8 +53,6 @@ export function LastUpdate(props) {
|
|
|
54
53
|
}, [props.date]);
|
|
55
54
|
return (_jsxs("p", { className: "text-sm text-fd-muted-foreground", children: [text.lastUpdate, " ", date] }));
|
|
56
55
|
}
|
|
57
|
-
const itemVariants = cva('flex w-full flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground');
|
|
58
|
-
const itemLabel = cva('inline-flex items-center gap-0.5 text-fd-muted-foreground');
|
|
59
56
|
function scanNavigationList(tree) {
|
|
60
57
|
const list = [];
|
|
61
58
|
tree.forEach((node) => {
|
|
@@ -75,7 +72,6 @@ function scanNavigationList(tree) {
|
|
|
75
72
|
const listCache = new WeakMap();
|
|
76
73
|
export function Footer({ items }) {
|
|
77
74
|
const { root } = useTreeContext();
|
|
78
|
-
const { text } = useI18n();
|
|
79
75
|
const pathname = usePathname();
|
|
80
76
|
const { previous, next } = useMemo(() => {
|
|
81
77
|
if (items)
|
|
@@ -91,7 +87,16 @@ export function Footer({ items }) {
|
|
|
91
87
|
next: list[idx + 1],
|
|
92
88
|
};
|
|
93
89
|
}, [items, pathname, root]);
|
|
94
|
-
return (_jsxs("div", { className:
|
|
90
|
+
return (_jsxs("div", { className: cn('@container grid gap-4 pb-6', previous && next ? 'grid-cols-2' : 'grid-cols-1'), children: [previous ? _jsx(FooterItem, { item: previous, index: 0 }) : null, next ? _jsx(FooterItem, { item: next, index: 1 }) : null] }));
|
|
91
|
+
}
|
|
92
|
+
function FooterItem({ item, index }) {
|
|
93
|
+
const { text } = useI18n();
|
|
94
|
+
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
95
|
+
const title = item.description ? item.name : null;
|
|
96
|
+
const description = item.description ?? item.name;
|
|
97
|
+
return (_jsxs(Link, { href: item.url, className: cn('flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full', index === 1 && 'text-end'), children: [_jsxs("div", { className: cn('inline-flex items-center gap-1.5', index === 1 && 'flex-row-reverse', title ? 'font-medium' : 'text-fd-muted-foreground'), children: [_jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), _jsx("p", { children: title ?? text.nextPage })] }), _jsx("p", { className: cn(title
|
|
98
|
+
? 'text-fd-muted-foreground truncate'
|
|
99
|
+
: 'font-medium md:text-[15px]'), children: description })] }));
|
|
95
100
|
}
|
|
96
101
|
export function Breadcrumb(options) {
|
|
97
102
|
const path = useTreePath();
|
package/dist/provider.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ export interface RootProviderProps {
|
|
|
31
31
|
*/
|
|
32
32
|
enabled?: boolean;
|
|
33
33
|
};
|
|
34
|
-
children
|
|
34
|
+
children?: ReactNode;
|
|
35
35
|
}
|
|
36
|
-
export declare function RootProvider({ children, dir, theme
|
|
36
|
+
export declare function RootProvider({ children, dir, theme, search, }: RootProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export { useI18n, I18nLabel } from './contexts/i18n.js';
|
|
38
38
|
export { SearchProvider, SearchOnly, useSearchContext, type SearchProviderProps, } from './contexts/search.js';
|
|
39
39
|
export { SidebarProvider, useSidebar } from './contexts/sidebar.js';
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,UAAU,aACR,SAAQ,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,UAAU,CAAC;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7E;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,CAAC,GAAG;QAChE;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAEF,QAAQ,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,UAAU,aACR,SAAQ,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,UAAU,CAAC;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7E;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,CAAC,GAAG;QAChE;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAEF,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAOD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,GAAW,EACX,KAAU,EACV,MAAM,GACP,EAAE,iBAAiB,2CA4BnB;AAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,aAAa,EACb,KAAK,UAAU,GAChB,MAAM,mBAAmB,CAAC"}
|
package/dist/provider.js
CHANGED
|
@@ -6,11 +6,11 @@ import { DirectionProvider } from '@radix-ui/react-direction';
|
|
|
6
6
|
import { SidebarProvider } from './contexts/sidebar.js';
|
|
7
7
|
import { SearchProvider } from './contexts/search.js';
|
|
8
8
|
const DefaultSearchDialog = dynamic(() => import('./components/dialog/search-default.js'), { ssr: false });
|
|
9
|
-
export function RootProvider({ children, dir = 'ltr', theme
|
|
9
|
+
export function RootProvider({ children, dir = 'ltr', theme = {}, search, }) {
|
|
10
10
|
let body = children;
|
|
11
11
|
if (search?.enabled !== false)
|
|
12
12
|
body = (_jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children: body }));
|
|
13
|
-
if (enabled)
|
|
13
|
+
if (theme?.enabled !== false)
|
|
14
14
|
body = (_jsx(ThemeProvider, { attribute: "class", defaultTheme: "system", enableSystem: true, disableTransitionOnChange: true, ...theme, children: body }));
|
|
15
15
|
return (_jsx(DirectionProvider, { dir: dir, children: _jsx(SidebarProvider, { children: body }) }));
|
|
16
16
|
}
|
package/dist/style.css
CHANGED
|
@@ -351,9 +351,6 @@
|
|
|
351
351
|
.z-\[2\] {
|
|
352
352
|
z-index: 2;
|
|
353
353
|
}
|
|
354
|
-
.col-start-2 {
|
|
355
|
-
grid-column-start: 2;
|
|
356
|
-
}
|
|
357
354
|
.container {
|
|
358
355
|
width: 100%;
|
|
359
356
|
@media (width >= 40rem) {
|
|
@@ -379,6 +376,9 @@
|
|
|
379
376
|
max-width: 1400px;
|
|
380
377
|
}
|
|
381
378
|
}
|
|
379
|
+
.-mx-1 {
|
|
380
|
+
margin-inline: calc(var(--spacing) * -1);
|
|
381
|
+
}
|
|
382
382
|
.-mx-2 {
|
|
383
383
|
margin-inline: calc(var(--spacing) * -2);
|
|
384
384
|
}
|
|
@@ -412,9 +412,6 @@
|
|
|
412
412
|
.ms-auto {
|
|
413
413
|
margin-inline-start: auto;
|
|
414
414
|
}
|
|
415
|
-
.-me-1 {
|
|
416
|
-
margin-inline-end: calc(var(--spacing) * -1);
|
|
417
|
-
}
|
|
418
415
|
.-me-1\.5 {
|
|
419
416
|
margin-inline-end: calc(var(--spacing) * -1.5);
|
|
420
417
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.1",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -66,32 +66,32 @@
|
|
|
66
66
|
"@radix-ui/react-tabs": "^1.1.3",
|
|
67
67
|
"class-variance-authority": "^0.7.1",
|
|
68
68
|
"lodash.merge": "^4.6.2",
|
|
69
|
-
"lucide-react": "^0.
|
|
69
|
+
"lucide-react": "^0.483.0",
|
|
70
70
|
"next-themes": "^0.4.6",
|
|
71
71
|
"postcss-selector-parser": "^7.1.0",
|
|
72
72
|
"react-medium-image-zoom": "^5.2.14",
|
|
73
73
|
"tailwind-merge": "^3.0.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@next/eslint-plugin-next": "^15.2.
|
|
76
|
+
"@next/eslint-plugin-next": "^15.2.3",
|
|
77
77
|
"@tailwindcss/cli": "^4.0.14",
|
|
78
78
|
"@types/lodash.merge": "^4.6.9",
|
|
79
|
-
"@types/react": "^19.0.
|
|
79
|
+
"@types/react": "^19.0.11",
|
|
80
80
|
"@types/react-dom": "^19.0.4",
|
|
81
|
-
"next": "15.2.
|
|
81
|
+
"next": "15.2.3",
|
|
82
82
|
"tailwindcss": "^4.0.14",
|
|
83
83
|
"tsc-alias": "^1.8.11",
|
|
84
84
|
"@fumadocs/cli": "0.0.8",
|
|
85
85
|
"eslint-config-custom": "0.0.0",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
86
|
+
"tsconfig": "0.0.0",
|
|
87
|
+
"fumadocs-core": "15.1.1"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"next": "14.x.x || 15.x.x",
|
|
91
91
|
"react": "18.x.x || 19.x.x",
|
|
92
92
|
"react-dom": "18.x.x || 19.x.x",
|
|
93
93
|
"tailwindcss": "^3.4.14 || ^4.0.0",
|
|
94
|
-
"fumadocs-core": "15.
|
|
94
|
+
"fumadocs-core": "15.1.1"
|
|
95
95
|
},
|
|
96
96
|
"peerDependenciesMeta": {
|
|
97
97
|
"tailwindcss": {
|