fumadocs-ui 15.8.2 → 15.8.4
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.js +1 -1
- package/dist/components/layout/toc-thumb.js +1 -1
- package/dist/components/tabs.unstyled.js +2 -2
- package/dist/contexts/legacy-i18n.d.ts.map +1 -1
- package/dist/contexts/legacy-i18n.js +18 -19
- package/dist/layouts/docs/page-client.js +1 -1
- package/dist/provider/base.d.ts.map +1 -1
- package/dist/provider/base.js +9 -8
- package/dist/provider/index.d.ts +1 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +2 -1
- package/dist/style.css +1 -1
- package/dist/utils/use-copy-button.d.ts.map +1 -1
- package/dist/utils/use-copy-button.js +6 -5
- package/package.json +8 -8
|
@@ -106,7 +106,7 @@ export function SearchDialogList({ items = null, Empty = () => (_jsx("div", { cl
|
|
|
106
106
|
observer.disconnect();
|
|
107
107
|
window.removeEventListener('keydown', onKey);
|
|
108
108
|
};
|
|
109
|
-
}, [
|
|
109
|
+
}, []);
|
|
110
110
|
useOnChange(items, () => {
|
|
111
111
|
if (items && items.length > 0) {
|
|
112
112
|
setActive(items[0].id);
|
|
@@ -46,7 +46,7 @@ export function Tabs({ ref, groupId, persist = false, updateAnchor = false, defa
|
|
|
46
46
|
return () => {
|
|
47
47
|
removeChangeListener(groupId, onChange);
|
|
48
48
|
};
|
|
49
|
-
}, [groupId,
|
|
49
|
+
}, [groupId, persist]);
|
|
50
50
|
useLayoutEffect(() => {
|
|
51
51
|
const hash = window.location.hash.slice(1);
|
|
52
52
|
if (!hash)
|
|
@@ -58,7 +58,7 @@ export function Tabs({ ref, groupId, persist = false, updateAnchor = false, defa
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
}, [
|
|
61
|
+
}, [valueToIdMap]);
|
|
62
62
|
return (_jsx(Primitive.Tabs, { ref: mergeRefs(ref, tabsRef), value: value, onValueChange: (v) => {
|
|
63
63
|
if (updateAnchor) {
|
|
64
64
|
const id = valueToIdMap.get(v);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/legacy-i18n.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"legacy-i18n.d.ts","sourceRoot":"","sources":["../../src/contexts/legacy-i18n.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKzD;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAY,EACZ,MAAM,EACN,QAAQ,EAAE,SAAS,EACnB,cAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAChD,2CAuCA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { usePathname, useRouter } from 'fumadocs-core/framework';
|
|
4
|
-
import {
|
|
5
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { useMemo, useRef } from 'react';
|
|
6
5
|
import { defaultTranslations, I18nContext } from '../contexts/i18n.js';
|
|
7
6
|
/**
|
|
8
7
|
* @deprecated legacy I18n Provider, use `<RootProvider i18n={...} />` instead
|
|
@@ -10,21 +9,21 @@ import { defaultTranslations, I18nContext } from '../contexts/i18n.js';
|
|
|
10
9
|
export function I18nProvider({ locales = [], locale, onChange: _onChange, onLocaleChange = _onChange, ...props }) {
|
|
11
10
|
const router = useRouter();
|
|
12
11
|
const pathname = usePathname();
|
|
13
|
-
const onChange =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
segments
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
const onChange = onLocaleChange ??
|
|
13
|
+
((value) => {
|
|
14
|
+
const segments = pathname.split('/').filter((v) => v.length > 0);
|
|
15
|
+
// If locale prefix hidden
|
|
16
|
+
if (segments[0] !== locale) {
|
|
17
|
+
segments.unshift(value);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
segments[0] = value;
|
|
21
|
+
}
|
|
22
|
+
router.push(`/${segments.join('/')}`);
|
|
23
|
+
router.refresh();
|
|
24
|
+
});
|
|
25
|
+
const onChangeRef = useRef(onChange);
|
|
26
|
+
onChangeRef.current = onChange;
|
|
28
27
|
return (_jsx(I18nContext.Provider, { value: useMemo(() => ({
|
|
29
28
|
locale,
|
|
30
29
|
locales,
|
|
@@ -32,6 +31,6 @@ export function I18nProvider({ locales = [], locale, onChange: _onChange, onLoca
|
|
|
32
31
|
...defaultTranslations,
|
|
33
32
|
...props.translations,
|
|
34
33
|
},
|
|
35
|
-
onChange,
|
|
36
|
-
}), [locale, locales,
|
|
34
|
+
onChange: (v) => onChangeRef.current(v),
|
|
35
|
+
}), [locale, locales, props.translations]), children: props.children }));
|
|
37
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/provider/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/provider/base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,wB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
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ThemeProvider } from 'next-themes';
|
|
4
|
-
import { lazy, useMemo, } from 'react';
|
|
4
|
+
import { lazy, useMemo, useRef, } from 'react';
|
|
5
5
|
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
6
6
|
import { SidebarProvider } from '../contexts/sidebar.js';
|
|
7
7
|
import { SearchProvider } from '../contexts/search.js';
|
|
8
|
-
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
9
8
|
import { defaultTranslations, I18nContext, } from '../contexts/i18n.js';
|
|
10
9
|
import { usePathname, useRouter } from 'fumadocs-core/framework';
|
|
11
10
|
const DefaultSearchDialog = lazy(() => import('../components/dialog/search-default.js'));
|
|
@@ -20,10 +19,10 @@ export function RootProvider({ children, dir = 'ltr', theme = {}, search, i18n,
|
|
|
20
19
|
}
|
|
21
20
|
return (_jsx(DirectionProvider, { dir: dir, children: _jsx(SidebarProvider, { children: body }) }));
|
|
22
21
|
}
|
|
23
|
-
function I18nProvider({ locales = [], locale, onLocaleChange,
|
|
22
|
+
function I18nProvider({ locales = [], locale, onLocaleChange, children, translations, }) {
|
|
24
23
|
const router = useRouter();
|
|
25
24
|
const pathname = usePathname();
|
|
26
|
-
const onChange =
|
|
25
|
+
const onChange = (value) => {
|
|
27
26
|
if (onLocaleChange) {
|
|
28
27
|
return onLocaleChange(value);
|
|
29
28
|
}
|
|
@@ -36,14 +35,16 @@ function I18nProvider({ locales = [], locale, onLocaleChange, ...props }) {
|
|
|
36
35
|
segments[0] = value;
|
|
37
36
|
}
|
|
38
37
|
router.push(`/${segments.join('/')}`);
|
|
39
|
-
}
|
|
38
|
+
};
|
|
39
|
+
const onChangeRef = useRef(onChange);
|
|
40
|
+
onChangeRef.current = onChange;
|
|
40
41
|
return (_jsx(I18nContext.Provider, { value: useMemo(() => ({
|
|
41
42
|
locale,
|
|
42
43
|
locales,
|
|
43
44
|
text: {
|
|
44
45
|
...defaultTranslations,
|
|
45
|
-
...
|
|
46
|
+
...translations,
|
|
46
47
|
},
|
|
47
|
-
onChange,
|
|
48
|
-
}), [locale, locales,
|
|
48
|
+
onChange: (v) => onChangeRef.current(v),
|
|
49
|
+
}), [locale, locales, translations]), children: children }));
|
|
49
50
|
}
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RootProvider } from './next.js';
|
|
2
2
|
export { useI18n, I18nLabel } from '../contexts/i18n.js';
|
|
3
3
|
export { SearchProvider, SearchOnly, useSearchContext, type SearchProviderProps, } from '../contexts/search.js';
|
|
4
4
|
export { SidebarProvider, useSidebar } from '../contexts/sidebar.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,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,MAAM,EACN,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,cAAc,EACd,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
package/dist/provider/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
2
|
+
// TODO: remove this, recommend `fumadocs-ui/provider/next` instead.
|
|
3
|
+
export { RootProvider } from './next.js';
|
|
3
4
|
export { useI18n, I18nLabel } from '../contexts/i18n.js';
|
|
4
5
|
export { SearchProvider, SearchOnly, useSearchContext, } from '../contexts/search.js';
|
|
5
6
|
export { SidebarProvider, useSidebar } from '../contexts/sidebar.js';
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-copy-button.d.ts","sourceRoot":"","sources":["../../src/utils/use-copy-button.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-copy-button.d.ts","sourceRoot":"","sources":["../../src/utils/use-copy-button.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CA2BhD"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
4
3
|
export function useCopyButton(onCopy) {
|
|
5
4
|
const [checked, setChecked] = useState(false);
|
|
5
|
+
const callbackRef = useRef(onCopy);
|
|
6
6
|
const timeoutRef = useRef(null);
|
|
7
|
-
|
|
7
|
+
callbackRef.current = onCopy;
|
|
8
|
+
const onClick = useCallback(() => {
|
|
8
9
|
if (timeoutRef.current)
|
|
9
10
|
window.clearTimeout(timeoutRef.current);
|
|
10
|
-
const res = Promise.resolve(
|
|
11
|
+
const res = Promise.resolve(callbackRef.current());
|
|
11
12
|
void res.then(() => {
|
|
12
13
|
setChecked(true);
|
|
13
14
|
timeoutRef.current = window.setTimeout(() => {
|
|
14
15
|
setChecked(false);
|
|
15
16
|
}, 1500);
|
|
16
17
|
});
|
|
17
|
-
});
|
|
18
|
+
}, []);
|
|
18
19
|
// Avoid updates after being unmounted
|
|
19
20
|
useEffect(() => {
|
|
20
21
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "15.8.
|
|
3
|
+
"version": "15.8.4",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -121,20 +121,20 @@
|
|
|
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": "15.8.
|
|
124
|
+
"fumadocs-core": "15.8.4"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"@next/eslint-plugin-next": "^15.5.4",
|
|
128
|
-
"@tailwindcss/cli": "^4.1.
|
|
128
|
+
"@tailwindcss/cli": "^4.1.14",
|
|
129
129
|
"@types/lodash.merge": "^4.6.9",
|
|
130
|
-
"@types/react": "^19.
|
|
131
|
-
"@types/react-dom": "^19.
|
|
130
|
+
"@types/react": "^19.2.0",
|
|
131
|
+
"@types/react-dom": "^19.2.0",
|
|
132
132
|
"next": "15.5.4",
|
|
133
|
-
"tailwindcss": "^4.1.
|
|
133
|
+
"tailwindcss": "^4.1.14",
|
|
134
134
|
"tsc-alias": "^1.8.16",
|
|
135
|
-
"@fumadocs/cli": "1.0.
|
|
135
|
+
"@fumadocs/cli": "1.0.2",
|
|
136
136
|
"eslint-config-custom": "0.0.0",
|
|
137
|
-
"fumadocs-core": "15.8.
|
|
137
|
+
"fumadocs-core": "15.8.4",
|
|
138
138
|
"tsconfig": "0.0.0"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|