fumadocs-ui 14.6.4 → 14.6.6
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/dialog/search-algolia.d.ts +1 -2
- package/dist/components/dialog/search-algolia.d.ts.map +1 -1
- package/dist/components/dialog/search-algolia.js +1 -2
- package/dist/components/dialog/search-default.d.ts +1 -2
- package/dist/components/dialog/search-default.d.ts.map +1 -1
- package/dist/components/dialog/search-default.js +1 -2
- package/dist/components/dialog/search-orama.d.ts +1 -2
- package/dist/components/dialog/search-orama.d.ts.map +1 -1
- package/dist/components/dialog/search-orama.js +1 -2
- package/dist/components/dialog/search.d.ts +13 -1
- package/dist/components/dialog/search.d.ts.map +1 -1
- package/dist/components/dialog/search.js +18 -0
- package/dist/contexts/i18n.d.ts +1 -0
- package/dist/contexts/i18n.d.ts.map +1 -1
- package/dist/contexts/i18n.js +13 -12
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +12 -9
- package/dist/layouts/docs/shared.d.ts +1 -0
- package/dist/layouts/docs/shared.d.ts.map +1 -1
- package/dist/layouts/docs/shared.js +10 -0
- package/dist/layouts/docs.d.ts.map +1 -1
- package/dist/layouts/docs.js +2 -4
- package/dist/layouts/notebook.d.ts.map +1 -1
- package/dist/layouts/notebook.js +2 -4
- package/package.json +4 -4
- package/dist/components/dialog/tag-list.d.ts +0 -14
- package/dist/components/dialog/tag-list.d.ts.map +0 -1
- package/dist/components/dialog/tag-list.js +0 -20
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type AlgoliaOptions } from 'fumadocs-core/search/client';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
-
import { type SharedProps } from './search';
|
|
4
|
-
import { type TagItem } from './tag-list';
|
|
3
|
+
import { type SharedProps, type TagItem } from './search';
|
|
5
4
|
export interface AlgoliaSearchDialogProps extends SharedProps {
|
|
6
5
|
index: AlgoliaOptions['index'];
|
|
7
6
|
searchOptions?: Omit<AlgoliaOptions, 'index'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-algolia.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-algolia.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"search-algolia.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-algolia.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,OAAO,EACb,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,KAAK,EACL,aAAa,EACb,IAAI,EACJ,UAAU,EACV,WAAmB,EACnB,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,wBAAwB,GAAG,SAAS,CA0CtC"}
|
|
@@ -3,8 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useDocsSearch, } from 'fumadocs-core/search/client';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
|
-
import { SearchDialog } from './search';
|
|
7
|
-
import { TagsList } from './tag-list';
|
|
6
|
+
import { SearchDialog, TagsList, } from './search';
|
|
8
7
|
export default function AlgoliaSearchDialog({ index, searchOptions, tags, defaultTag, showAlgolia = false, allowClear = false, ...props }) {
|
|
9
8
|
const [tag, setTag] = useState(defaultTag);
|
|
10
9
|
const { search, setSearch, query } = useDocsSearch({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type SharedProps } from './search';
|
|
3
|
-
import { type TagItem } from './tag-list';
|
|
2
|
+
import { type SharedProps, type TagItem } from './search';
|
|
4
3
|
export interface DefaultSearchDialogProps extends SharedProps {
|
|
5
4
|
/**
|
|
6
5
|
* @defaultValue 'fetch'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-default.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-default.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAGjD,OAAO,
|
|
1
|
+
{"version":3,"file":"search-default.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-default.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAGjD,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,OAAO,EAEb,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,UAAU,EACV,IAAI,EACJ,GAAG,EACH,OAAO,EACP,IAAc,EACd,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,wBAAwB,GAAG,SAAS,CA8CtC"}
|
|
@@ -4,8 +4,7 @@ import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
6
|
import { useI18n } from '../../contexts/i18n';
|
|
7
|
-
import { SearchDialog } from './search';
|
|
8
|
-
import { TagsList } from './tag-list';
|
|
7
|
+
import { SearchDialog, TagsList, } from './search';
|
|
9
8
|
export default function DefaultSearchDialog({ defaultTag, tags, api, delayMs, type = 'fetch', allowClear = false, ...props }) {
|
|
10
9
|
const { locale } = useI18n();
|
|
11
10
|
const [tag, setTag] = useState(defaultTag);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type OramaCloudOptions } from 'fumadocs-core/search/client';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
-
import { type SharedProps } from './search';
|
|
4
|
-
import { type TagItem } from './tag-list';
|
|
3
|
+
import { type SharedProps, type TagItem } from './search';
|
|
5
4
|
export interface OramaSearchDialogProps extends SharedProps {
|
|
6
5
|
client: OramaCloudOptions['client'];
|
|
7
6
|
searchOptions?: OramaCloudOptions['params'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-orama.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-orama.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"search-orama.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-orama.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,OAAO,EAEb,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,MAAM,EACN,aAAa,EACb,IAAI,EACJ,UAAU,EACV,SAAiB,EACjB,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,sBAAsB,GAAG,SAAS,CA0CpC"}
|
|
@@ -3,8 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useDocsSearch, } from 'fumadocs-core/search/client';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
|
-
import { SearchDialog } from './search';
|
|
7
|
-
import { TagsList } from './tag-list';
|
|
6
|
+
import { SearchDialog, TagsList, } from './search';
|
|
8
7
|
/**
|
|
9
8
|
* Orama Cloud integration
|
|
10
9
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type ReactNode, type HTMLAttributes } from 'react';
|
|
2
2
|
import type { SortedResult } from 'fumadocs-core/server';
|
|
3
3
|
export type SearchLink = [name: string, href: string];
|
|
4
4
|
type ReactSortedResult = SortedResult & {
|
|
@@ -26,5 +26,17 @@ interface SearchResultProps {
|
|
|
26
26
|
hideResults?: boolean;
|
|
27
27
|
}
|
|
28
28
|
export declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export interface TagItem {
|
|
30
|
+
name: string;
|
|
31
|
+
value: string | undefined;
|
|
32
|
+
props?: HTMLAttributes<HTMLButtonElement>;
|
|
33
|
+
}
|
|
34
|
+
export interface TagsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
35
|
+
tag?: string;
|
|
36
|
+
onTagChange: (tag: string | undefined) => void;
|
|
37
|
+
allowClear?: boolean;
|
|
38
|
+
items: TagItem[];
|
|
39
|
+
}
|
|
40
|
+
export declare function TagsList({ tag, onTagChange, items, allowClear, ...props }: TagsListProps): import("react/jsx-runtime").JSX.Element;
|
|
29
41
|
export {};
|
|
30
42
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,SAAS,EAMd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAAG,YAAY,GAAG;IACtC,OAAO,EAAE,S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UAAU,EACV,GAAG,KAAK,EACT,EAAE,aAAa,2CA+Bf"}
|
|
@@ -9,6 +9,7 @@ import { useSearchContext } from '../../contexts/search';
|
|
|
9
9
|
import { useSidebar } from '../../contexts/sidebar';
|
|
10
10
|
import { buttonVariants } from '../../components/ui/button';
|
|
11
11
|
import { Dialog, DialogContent, DialogOverlay, DialogTitle, } from '@radix-ui/react-dialog';
|
|
12
|
+
import { cva } from 'class-variance-authority';
|
|
12
13
|
export function SearchDialog({ open, onOpenChange, footer, links = [], ...props }) {
|
|
13
14
|
const { text } = useI18n();
|
|
14
15
|
const defaultItems = useMemo(() => links.map(([name, link]) => ({
|
|
@@ -93,3 +94,20 @@ function CommandItem({ active, onActiveChange, value, ...props }) {
|
|
|
93
94
|
}
|
|
94
95
|
}, [active, value]), type: "button", "aria-selected": active === value, onPointerMove: () => onActiveChange(value), ...props, className: cn('flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm', active === value && 'bg-fd-accent text-fd-accent-foreground', props.className), children: props.children }));
|
|
95
96
|
}
|
|
97
|
+
const itemVariants = cva('rounded-md border px-2 py-0.5 text-xs font-medium text-fd-muted-foreground transition-colors', {
|
|
98
|
+
variants: {
|
|
99
|
+
active: {
|
|
100
|
+
true: 'bg-fd-accent text-fd-accent-foreground',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
export function TagsList({ tag, onTagChange, items, allowClear, ...props }) {
|
|
105
|
+
return (_jsxs("div", { ...props, className: cn('flex flex-row items-center gap-1', props.className), children: [items.map((item) => (_jsx("button", { type: "button", "data-active": tag === item.value, className: cn(itemVariants({ active: tag === item.value }), item.props?.className), onClick: () => {
|
|
106
|
+
if (tag === item.value && allowClear) {
|
|
107
|
+
onTagChange(undefined);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
onTagChange(item.value);
|
|
111
|
+
}
|
|
112
|
+
}, tabIndex: -1, ...item.props, children: item.name }, item.value))), props.children] }));
|
|
113
|
+
}
|
package/dist/contexts/i18n.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ interface I18nContextType {
|
|
|
20
20
|
text: Translations;
|
|
21
21
|
locales?: LocaleItem[];
|
|
22
22
|
}
|
|
23
|
+
export declare const defaultTranslations: Translations;
|
|
23
24
|
export declare const I18nContext: import("react").Context<I18nContextType>;
|
|
24
25
|
export declare function I18nLabel(props: {
|
|
25
26
|
label: keyof Translations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/i18n.tsx"],"names":[],"mappings":"AAGA,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,WAAW,
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/i18n.tsx"],"names":[],"mappings":"AAGA,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"}
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { createContext, useContext } from 'react';
|
|
3
|
+
export const defaultTranslations = {
|
|
4
|
+
search: 'Search',
|
|
5
|
+
searchNoResult: 'No results found',
|
|
6
|
+
toc: 'On this page',
|
|
7
|
+
tocNoHeadings: 'No Headings',
|
|
8
|
+
lastUpdate: 'Last updated on',
|
|
9
|
+
chooseLanguage: 'Choose a language',
|
|
10
|
+
nextPage: 'Next',
|
|
11
|
+
previousPage: 'Previous',
|
|
12
|
+
chooseTheme: 'Theme',
|
|
13
|
+
editOnGithub: 'Edit on GitHub',
|
|
14
|
+
};
|
|
3
15
|
export const I18nContext = createContext({
|
|
4
|
-
text:
|
|
5
|
-
search: 'Search',
|
|
6
|
-
searchNoResult: 'No results found',
|
|
7
|
-
toc: 'On this page',
|
|
8
|
-
tocNoHeadings: 'No Headings',
|
|
9
|
-
lastUpdate: 'Last updated on',
|
|
10
|
-
chooseLanguage: 'Choose a language',
|
|
11
|
-
nextPage: 'Next',
|
|
12
|
-
previousPage: 'Previous',
|
|
13
|
-
chooseTheme: 'Theme',
|
|
14
|
-
editOnGithub: 'Edit on GitHub',
|
|
15
|
-
},
|
|
16
|
+
text: defaultTranslations,
|
|
16
17
|
});
|
|
17
18
|
export function I18nLabel(props) {
|
|
18
19
|
const { text } = useI18n();
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type Translations, type LocaleItem } from './contexts/i18n';
|
|
2
|
+
import { type Translations, defaultTranslations, type LocaleItem } from './contexts/i18n';
|
|
3
3
|
interface I18nProviderProps {
|
|
4
4
|
/**
|
|
5
5
|
* Current locale
|
|
@@ -20,5 +20,5 @@ interface I18nProviderProps {
|
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
}
|
|
22
22
|
export declare function I18nProvider({ locales, locale, ...props }: I18nProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export { type Translations };
|
|
23
|
+
export { defaultTranslations, type Translations };
|
|
24
24
|
//# 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":"AAEA,OAAO,EAAe,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAE5D,OAAO,EAEL,KAAK,YAAY,EAEjB,mBAAmB,EACnB,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACzB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAE/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAY,EACZ,MAAM,EACN,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAuCnB;AAED,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
package/dist/i18n.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
4
4
|
import { useRouter, usePathname } from 'next/navigation';
|
|
5
|
-
import { useI18n, I18nContext, } from './contexts/i18n';
|
|
5
|
+
import { useI18n, I18nContext, defaultTranslations, } from './contexts/i18n';
|
|
6
6
|
export function I18nProvider({ locales = [], locale, ...props }) {
|
|
7
7
|
const context = useI18n();
|
|
8
8
|
const router = useRouter();
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
.filter((v) => v.length > 0);
|
|
12
|
-
const onChange = useCallback((v) => {
|
|
9
|
+
const pathname = usePathname();
|
|
10
|
+
const onChangeCallback = (locale) => {
|
|
11
|
+
const segments = pathname.split('/').filter((v) => v.length > 0);
|
|
13
12
|
// If locale prefix hidden
|
|
14
13
|
if (segments[0] !== locale) {
|
|
15
|
-
segments.unshift(
|
|
14
|
+
segments.unshift(locale);
|
|
16
15
|
}
|
|
17
16
|
else {
|
|
18
|
-
segments[0] =
|
|
17
|
+
segments[0] = locale;
|
|
19
18
|
}
|
|
20
19
|
router.push(`/${segments.join('/')}`);
|
|
21
20
|
router.refresh();
|
|
22
|
-
}
|
|
21
|
+
};
|
|
22
|
+
const onChangeRef = useRef(onChangeCallback);
|
|
23
|
+
onChangeRef.current = onChangeCallback;
|
|
24
|
+
const onChange = useCallback((v) => onChangeRef.current(v), []);
|
|
23
25
|
return (_jsx(I18nContext.Provider, { value: {
|
|
24
26
|
locale,
|
|
25
27
|
locales,
|
|
@@ -30,3 +32,4 @@ export function I18nProvider({ locales = [], locale, ...props }) {
|
|
|
30
32
|
onChange: props.onChange ?? onChange,
|
|
31
33
|
}, children: props.children }));
|
|
32
34
|
}
|
|
35
|
+
export { defaultTranslations };
|
|
@@ -42,5 +42,6 @@ export interface SidebarComponents {
|
|
|
42
42
|
export declare function SidebarLinkItem({ item }: {
|
|
43
43
|
item: LinkItemType;
|
|
44
44
|
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
45
|
+
export declare function checkPageTree(passed: unknown): void;
|
|
45
46
|
export declare function getSidebarTabsFromOptions(options: SidebarOptions['tabs'], tree: PageTree.Root): Option[] | undefined;
|
|
46
47
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;
|
|
1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,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2UA+C/D;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,QAY5C;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,wBASpB"}
|
|
@@ -3,6 +3,7 @@ import { BaseLinkItem } from '../../layouts/links';
|
|
|
3
3
|
import { SidebarFolder, SidebarFolderContent, SidebarFolderLink, SidebarFolderTrigger, SidebarItem, } from '../../layouts/docs/sidebar';
|
|
4
4
|
import { cn } from '../../utils/cn';
|
|
5
5
|
import { buttonVariants } from '../../components/ui/button';
|
|
6
|
+
import { notFound } from 'next/navigation';
|
|
6
7
|
export const layoutVariables = {
|
|
7
8
|
'--fd-layout-offset': 'max(calc(50vw - var(--fd-layout-width) / 2), 0px)',
|
|
8
9
|
};
|
|
@@ -19,6 +20,15 @@ export function SidebarLinkItem({ item }) {
|
|
|
19
20
|
return item.children;
|
|
20
21
|
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, children: item.text }));
|
|
21
22
|
}
|
|
23
|
+
export function checkPageTree(passed) {
|
|
24
|
+
if (!passed)
|
|
25
|
+
notFound();
|
|
26
|
+
if (typeof passed === 'object' &&
|
|
27
|
+
'children' in passed &&
|
|
28
|
+
Array.isArray(passed.children))
|
|
29
|
+
return;
|
|
30
|
+
throw new Error('You passed an invalid page tree to `<DocsLayout />`. Check your usage in layout.tsx if you have enabled i18n.');
|
|
31
|
+
}
|
|
22
32
|
export function getSidebarTabsFromOptions(options, tree) {
|
|
23
33
|
if (Array.isArray(options)) {
|
|
24
34
|
return options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/layou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eAAe,GAAG,SAAS,CA2G7B;AA0FD,OAAO,EAAE,yBAAyB,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
package/dist/layouts/docs.js
CHANGED
|
@@ -15,14 +15,12 @@ import { NavProvider, Title } from '../components/layout/nav';
|
|
|
15
15
|
import { ThemeToggle } from '../components/layout/theme-toggle';
|
|
16
16
|
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle';
|
|
17
17
|
import { SearchOnly } from '../contexts/search';
|
|
18
|
-
import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
18
|
+
import { checkPageTree, getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
19
19
|
import { StylesProvider } from '../contexts/layout';
|
|
20
|
-
import { notFound } from 'next/navigation';
|
|
21
20
|
export function DocsLayout({ nav: { enabled: navEnabled = true, component: navReplace, transparentMode, ...nav } = {}, sidebar: { enabled: sidebarEnabled = true, collapsible = true, component: sidebarReplace, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, ...props }) {
|
|
21
|
+
checkPageTree(props.tree);
|
|
22
22
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
23
23
|
const Aside = collapsible ? CollapsibleSidebar : Sidebar;
|
|
24
|
-
if (props.tree === undefined)
|
|
25
|
-
notFound();
|
|
26
24
|
const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
|
|
27
25
|
const variables = cn('[--fd-tocnav-height:36px] md:[--fd-sidebar-width:268px] xl:[--fd-toc-width:268px] xl:[--fd-tocnav-height:0px]', !navReplace && navEnabled
|
|
28
26
|
? '[--fd-nav-height:3.5rem] md:[--fd-nav-height:0px]'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AA8B1B,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIrD,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;IAEjE,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EAAE,eAAe,EAAE,GAAG,GAAG,EAAO,EACrC,OAAO,EAAE,EACP,WAAW,EAAE,kBAAyB,EACtC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,iBAAiB,EAC7B,GAAG,OAAO,EACN,EACN,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CA+E7B"}
|
package/dist/layouts/notebook.js
CHANGED
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import { getLinks, } from '../layouts/shared';
|
|
4
4
|
import { CollapsibleSidebar, Sidebar, SidebarCollapseTrigger, SidebarFooter, SidebarHeader, SidebarViewport, SidebarPageTree, } from '../layouts/docs/sidebar';
|
|
5
|
-
import { notFound } from 'next/navigation';
|
|
6
5
|
import { RootToggle } from '../components/layout/root-toggle';
|
|
7
6
|
import { TreeContextProvider } from '../contexts/tree';
|
|
8
7
|
import { NavProvider, Title } from '../components/layout/nav';
|
|
@@ -16,14 +15,13 @@ import { BaseLinkItem } from '../layouts/links';
|
|
|
16
15
|
import { LanguageToggle } from '../components/layout/language-toggle';
|
|
17
16
|
import { ThemeToggle } from '../components/layout/theme-toggle';
|
|
18
17
|
import { Popover, PopoverContent, PopoverTrigger, } from '../components/ui/popover';
|
|
19
|
-
import { getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
18
|
+
import { checkPageTree, getSidebarTabsFromOptions, layoutVariables, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
20
19
|
import { Navbar, NavbarSidebarTrigger } from './notebook.client';
|
|
21
20
|
import { StylesProvider } from '../contexts/layout';
|
|
22
21
|
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { collapsible: sidebarCollapsible = true, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, ...props }) {
|
|
22
|
+
checkPageTree(props.tree);
|
|
23
23
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
24
24
|
const Aside = sidebarCollapsible ? CollapsibleSidebar : Sidebar;
|
|
25
|
-
if (props.tree === undefined)
|
|
26
|
-
notFound();
|
|
27
25
|
const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
|
|
28
26
|
const variables = cn('[--fd-nav-height:3.5rem] [--fd-tocnav-height:36px] md:[--fd-sidebar-width:268px] xl:[--fd-toc-width:268px] xl:[--fd-tocnav-height:0px]');
|
|
29
27
|
const pageStyles = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "14.6.
|
|
3
|
+
"version": "14.6.6",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"postcss-selector-parser": "^7.0.0",
|
|
69
69
|
"react-medium-image-zoom": "^5.2.12",
|
|
70
70
|
"tailwind-merge": "^2.5.5",
|
|
71
|
-
"fumadocs-core": "14.6.
|
|
71
|
+
"fumadocs-core": "14.6.6"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@next/eslint-plugin-next": "^15.1.2",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"postcss-cli": "^11.0.0",
|
|
82
82
|
"tailwindcss": "^3.4.17",
|
|
83
83
|
"tsc-alias": "^1.8.10",
|
|
84
|
-
"
|
|
84
|
+
"@fumadocs/cli": "0.0.6",
|
|
85
85
|
"eslint-config-custom": "0.0.0",
|
|
86
|
-
"
|
|
86
|
+
"tsconfig": "0.0.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"next": "14.x.x || 15.x.x",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
|
-
export interface TagItem {
|
|
3
|
-
name: string;
|
|
4
|
-
value: string | undefined;
|
|
5
|
-
props?: HTMLAttributes<HTMLButtonElement>;
|
|
6
|
-
}
|
|
7
|
-
export interface TagsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
tag?: string;
|
|
9
|
-
onTagChange: (tag: string | undefined) => void;
|
|
10
|
-
allowClear?: boolean;
|
|
11
|
-
items: TagItem[];
|
|
12
|
-
}
|
|
13
|
-
export declare function TagsList({ tag, onTagChange, items, allowClear, ...props }: TagsListProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
//# sourceMappingURL=tag-list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag-list.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/tag-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,KAAK,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,cAAc,CAAC;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAaD,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,aAAa,2CA+Bf"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cva } from 'class-variance-authority';
|
|
3
|
-
import { cn } from '../../utils/cn';
|
|
4
|
-
const itemVariants = cva('rounded-md border px-2 py-0.5 text-xs font-medium text-fd-muted-foreground transition-colors', {
|
|
5
|
-
variants: {
|
|
6
|
-
active: {
|
|
7
|
-
true: 'bg-fd-accent text-fd-accent-foreground',
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
export function TagsList({ tag, onTagChange, items, allowClear, ...props }) {
|
|
12
|
-
return (_jsxs("div", { ...props, className: cn('flex flex-row items-center gap-1', props.className), children: [items.map((item) => (_jsx("button", { type: "button", "data-active": tag === item.value, className: cn(itemVariants({ active: tag === item.value }), item.props?.className), onClick: () => {
|
|
13
|
-
if (tag === item.value && allowClear) {
|
|
14
|
-
onTagChange(undefined);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
onTagChange(item.value);
|
|
18
|
-
}
|
|
19
|
-
}, tabIndex: -1, ...item.props, children: item.name }, item.value))), props.children] }));
|
|
20
|
-
}
|