fumadocs-ui 12.3.2 → 12.3.3
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 +1 -1
- package/dist/i18n.d.ts +7 -1
- package/dist/i18n.js +13 -12
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "
|
|
4
|
+
declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
|
|
5
5
|
title?: ReactNode;
|
|
6
6
|
/**
|
|
7
7
|
* @defaultValue info
|
package/dist/i18n.d.ts
CHANGED
|
@@ -5,14 +5,20 @@ export { T as Translations } from './i18n-DSnJuWoW.js';
|
|
|
5
5
|
interface I18nProviderProps {
|
|
6
6
|
/**
|
|
7
7
|
* Force a locale, by default, it is parsed from pathname
|
|
8
|
+
*
|
|
9
|
+
* **Highly recommended to specify one**
|
|
8
10
|
*/
|
|
9
11
|
locale?: string;
|
|
10
12
|
/**
|
|
11
13
|
* Translations for each language
|
|
12
14
|
*/
|
|
13
15
|
translations?: Record<string, NamedTranslation>;
|
|
16
|
+
/**
|
|
17
|
+
* Handle changes to the locale, redirect user when not specified.
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (v: string) => void;
|
|
14
20
|
children: ReactNode;
|
|
15
21
|
}
|
|
16
|
-
declare function I18nProvider({ translations,
|
|
22
|
+
declare function I18nProvider({ translations, ...props }: I18nProviderProps): React.ReactElement;
|
|
17
23
|
|
|
18
24
|
export { I18nProvider };
|
package/dist/i18n.js
CHANGED
|
@@ -11,21 +11,22 @@ import { useRouter, usePathname } from "next/navigation";
|
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
function I18nProvider({
|
|
13
13
|
translations = {},
|
|
14
|
-
|
|
15
|
-
children
|
|
14
|
+
...props
|
|
16
15
|
}) {
|
|
17
|
-
const localeIndex = 1;
|
|
18
|
-
const router = useRouter();
|
|
19
|
-
const pathname = usePathname();
|
|
20
16
|
const context = useI18n();
|
|
21
|
-
const
|
|
22
|
-
const
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const segments = usePathname().split("/").filter((v) => v.length > 0);
|
|
19
|
+
const locale = props.locale ?? segments[0];
|
|
23
20
|
const onChange = useCallback(
|
|
24
21
|
(v) => {
|
|
25
|
-
segments[
|
|
26
|
-
|
|
22
|
+
if (segments[0] !== locale) {
|
|
23
|
+
segments.unshift(v);
|
|
24
|
+
} else {
|
|
25
|
+
segments[0] = v;
|
|
26
|
+
}
|
|
27
|
+
router.push(`/${segments.join("/")}`);
|
|
27
28
|
},
|
|
28
|
-
[segments, router]
|
|
29
|
+
[locale, segments, router]
|
|
29
30
|
);
|
|
30
31
|
return /* @__PURE__ */ jsx(
|
|
31
32
|
I18nContext.Provider,
|
|
@@ -37,9 +38,9 @@ function I18nProvider({
|
|
|
37
38
|
...context.text,
|
|
38
39
|
...translations[locale]
|
|
39
40
|
},
|
|
40
|
-
onChange
|
|
41
|
+
onChange: props.onChange ?? onChange
|
|
41
42
|
},
|
|
42
|
-
children
|
|
43
|
+
children: props.children
|
|
43
44
|
}
|
|
44
45
|
);
|
|
45
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-ui",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.3",
|
|
4
4
|
"description": "The framework for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"next-themes": "^0.3.0",
|
|
96
96
|
"react-medium-image-zoom": "^5.2.5",
|
|
97
97
|
"tailwind-merge": "^2.3.0",
|
|
98
|
-
"fumadocs-core": "12.3.
|
|
98
|
+
"fumadocs-core": "12.3.3"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@algolia/client-search": "^4.24.0",
|