next-intl 3.17.0 → 3.17.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/development/navigation/react-client/createLocalizedPathnamesNavigation.js +3 -3
- package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/types/src/navigation/react-client/ClientLink.d.ts +1 -1
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +31 -32
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +22 -23
- package/dist/types/src/navigation/react-client/redirects.d.ts +8 -8
- package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +25 -26
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +1 -1
- package/dist/types/src/navigation/react-server/redirects.d.ts +8 -8
- package/dist/types/src/navigation/shared/utils.d.ts +0 -2
- package/dist/types/src/server/react-client/index.d.ts +2 -2
- package/dist/types/src/shared/utils.d.ts +0 -1
- package/package.json +4 -4
|
@@ -83,7 +83,7 @@ function createLocalizedPathnamesNavigation(input) {
|
|
|
83
83
|
function useRouter() {
|
|
84
84
|
const baseRouter = useBaseRouter.default(config$1.localePrefix);
|
|
85
85
|
const defaultLocale = useTypedLocale();
|
|
86
|
-
return {
|
|
86
|
+
return React.useMemo(() => ({
|
|
87
87
|
...baseRouter,
|
|
88
88
|
push(href) {
|
|
89
89
|
var _args$;
|
|
@@ -118,14 +118,14 @@ function createLocalizedPathnamesNavigation(input) {
|
|
|
118
118
|
});
|
|
119
119
|
return baseRouter.prefetch(resolvedHref, ...args);
|
|
120
120
|
}
|
|
121
|
-
};
|
|
121
|
+
}), [baseRouter, defaultLocale]);
|
|
122
122
|
}
|
|
123
123
|
function usePathname() {
|
|
124
124
|
const pathname = useBasePathname.default(config$1.localePrefix);
|
|
125
125
|
const locale = useTypedLocale();
|
|
126
126
|
|
|
127
127
|
// @ts-expect-error -- Mirror the behavior from Next.js, where `null` is returned when `usePathname` is used outside of Next, but the types indicate that a string is always returned.
|
|
128
|
-
return pathname ? utils.getRoute(locale, pathname, config$1.pathnames) : pathname;
|
|
128
|
+
return React.useMemo(() => pathname ? utils.getRoute(locale, pathname, config$1.pathnames) : pathname, [locale, pathname]);
|
|
129
129
|
}
|
|
130
130
|
function getPathname(_ref2) {
|
|
131
131
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as o}from"react";import
|
|
1
|
+
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as o,useMemo as t}from"react";import n from"../../react-client/useLocale.js";import{receiveLocalizedNavigationRoutingConfig as a}from"../shared/config.js";import{getRoute as l,compileLocalizedPathname as c,normalizeNameOrNameWithParams as i}from"../shared/utils.js";import s from"./ClientLink.js";import{clientRedirect as f,clientPermanentRedirect as u}from"./redirects.js";import m from"./useBasePathname.js";import h from"./useBaseRouter.js";function p(p){const d=a(p);function v(){const e=n();if(!d.locales.includes(e))throw new Error('Unknown locale encountered: "'.concat(e,'". Make sure to validate the locale in `i18n.ts`.'));return e}function P(o,t){let{href:n,locale:a,...l}=o;const i=v(),f=a||i;return r.createElement(s,e({ref:t,href:c({locale:f,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:d.pathnames}),locale:a,localePrefix:d.localePrefix},l))}const x=o(P);function j(e){let{href:r,locale:o}=e;return c({...i(r),locale:o,pathnames:d.pathnames})}return x.displayName="Link",{Link:x,redirect:function(e){const r=j({href:e,locale:v()});for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return f({pathname:r,localePrefix:d.localePrefix},...t)},permanentRedirect:function(e){const r=j({href:e,locale:v()});for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return u({pathname:r,localePrefix:d.localePrefix},...t)},usePathname:function(){const e=m(d.localePrefix),r=v();return t((()=>e?l(r,e,d.pathnames):e),[r,e])},useRouter:function(){const e=h(d.localePrefix),r=v();return t((()=>({...e,push(o){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];const c=j({href:o,locale:(null===(t=a[0])||void 0===t?void 0:t.locale)||r});return e.push(c,...a)},replace(o){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];const c=j({href:o,locale:(null===(t=a[0])||void 0===t?void 0:t.locale)||r});return e.replace(c,...a)},prefetch(o){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];const c=j({href:o,locale:(null===(t=a[0])||void 0===t?void 0:t.locale)||r});return e.prefetch(c,...a)}})),[e,r])},getPathname:j}}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../../react-client/useLocale.js"),t=require("../shared/config.js"),l=require("../shared/utils.js"),n=require("./ClientLink.js"),o=require("./redirects.js"),c=require("./useBasePathname.js"),i=require("./useBaseRouter.js");function u(e){return e&&e.__esModule?e:{default:e}}var s=u(r);exports.default=function(u){const f=t.receiveLocalizedNavigationRoutingConfig(u);function h(){const e=a.default();if(!f.locales.includes(e))throw new Error(void 0);return e}function d(r,a){let{href:t,locale:o,...c}=r;const i=h(),u=o||i;return s.default.createElement(n.default,e.extends({ref:a,href:l.compileLocalizedPathname({locale:u,pathname:t,params:"object"==typeof t?t.params:void 0,pathnames:f.pathnames}),locale:o,localePrefix:f.localePrefix},c))}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../../react-client/useLocale.js"),t=require("../shared/config.js"),l=require("../shared/utils.js"),n=require("./ClientLink.js"),o=require("./redirects.js"),c=require("./useBasePathname.js"),i=require("./useBaseRouter.js");function u(e){return e&&e.__esModule?e:{default:e}}var s=u(r);exports.default=function(u){const f=t.receiveLocalizedNavigationRoutingConfig(u);function h(){const e=a.default();if(!f.locales.includes(e))throw new Error(void 0);return e}function d(r,a){let{href:t,locale:o,...c}=r;const i=h(),u=o||i;return s.default.createElement(n.default,e.extends({ref:a,href:l.compileLocalizedPathname({locale:u,pathname:t,params:"object"==typeof t?t.params:void 0,pathnames:f.pathnames}),locale:o,localePrefix:f.localePrefix},c))}const m=r.forwardRef(d);function p(e){let{href:r,locale:a}=e;return l.compileLocalizedPathname({...l.normalizeNameOrNameWithParams(r),locale:a,pathnames:f.pathnames})}return m.displayName="Link",{Link:m,redirect:function(e){const r=p({href:e,locale:h()});for(var a=arguments.length,t=new Array(a>1?a-1:0),l=1;l<a;l++)t[l-1]=arguments[l];return o.clientRedirect({pathname:r,localePrefix:f.localePrefix},...t)},permanentRedirect:function(e){const r=p({href:e,locale:h()});for(var a=arguments.length,t=new Array(a>1?a-1:0),l=1;l<a;l++)t[l-1]=arguments[l];return o.clientPermanentRedirect({pathname:r,localePrefix:f.localePrefix},...t)},usePathname:function(){const e=c.default(f.localePrefix),a=h();return r.useMemo((()=>e?l.getRoute(a,e,f.pathnames):e),[a,e])},useRouter:function(){const e=i.default(f.localePrefix),a=h();return r.useMemo((()=>({...e,push(r){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const c=p({href:r,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||a});return e.push(c,...n)},replace(r){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const c=p({href:r,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||a});return e.replace(c,...n)},prefetch(r){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const c=p({href:r,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||a});return e.prefetch(c,...n)}})),[e,a])},getPathname:p}};
|
|
@@ -26,6 +26,6 @@ type Props<AppLocales extends Locales> = Omit<ComponentProps<typeof BaseLink>, '
|
|
|
26
26
|
* page to be overwritten before the user even decides to change the locale.
|
|
27
27
|
*/
|
|
28
28
|
declare const ClientLinkWithRef: <AppLocales extends Locales>(props: Props<AppLocales> & {
|
|
29
|
-
ref?: Props<AppLocales>[
|
|
29
|
+
ref?: Props<AppLocales>["ref"];
|
|
30
30
|
}) => ReactElement;
|
|
31
31
|
export default ClientLinkWithRef;
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React, { ComponentProps, ReactElement } from 'react';
|
|
3
2
|
import { Locales, Pathnames } from '../../routing/types';
|
|
4
3
|
import { LocalizedNavigationRoutingConfigInput } from '../shared/config';
|
|
5
4
|
import { HrefOrHrefWithParams } from '../shared/utils';
|
|
6
5
|
import ClientLink from './ClientLink';
|
|
7
6
|
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(input: LocalizedNavigationRoutingConfigInput<AppLocales, AppPathnames>): {
|
|
8
|
-
Link: <Pathname extends keyof AppPathnames>(props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
7
|
+
Link: <Pathname extends keyof AppPathnames>(props: (Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
9
8
|
href: string | import("url").UrlObject;
|
|
10
|
-
as?:
|
|
11
|
-
replace?: boolean
|
|
12
|
-
scroll?: boolean
|
|
13
|
-
shallow?: boolean
|
|
14
|
-
passHref?: boolean
|
|
15
|
-
prefetch?: boolean
|
|
16
|
-
locale?: string | false
|
|
17
|
-
legacyBehavior?: boolean
|
|
18
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement
|
|
19
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement
|
|
20
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement
|
|
9
|
+
as?: string | import("url").UrlObject;
|
|
10
|
+
replace?: boolean;
|
|
11
|
+
scroll?: boolean;
|
|
12
|
+
shallow?: boolean;
|
|
13
|
+
passHref?: boolean;
|
|
14
|
+
prefetch?: boolean;
|
|
15
|
+
locale?: string | false;
|
|
16
|
+
legacyBehavior?: boolean;
|
|
17
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
18
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
19
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
21
20
|
}> & {
|
|
22
21
|
href: string | import("url").UrlObject;
|
|
23
|
-
as?:
|
|
24
|
-
replace?: boolean
|
|
25
|
-
scroll?: boolean
|
|
26
|
-
shallow?: boolean
|
|
27
|
-
passHref?: boolean
|
|
28
|
-
prefetch?: boolean
|
|
29
|
-
locale?: string | false
|
|
30
|
-
legacyBehavior?: boolean
|
|
31
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement
|
|
32
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement
|
|
33
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement
|
|
22
|
+
as?: string | import("url").UrlObject;
|
|
23
|
+
replace?: boolean;
|
|
24
|
+
scroll?: boolean;
|
|
25
|
+
shallow?: boolean;
|
|
26
|
+
passHref?: boolean;
|
|
27
|
+
prefetch?: boolean;
|
|
28
|
+
locale?: string | false;
|
|
29
|
+
legacyBehavior?: boolean;
|
|
30
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
31
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
32
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
34
33
|
} & {
|
|
35
34
|
children?: React.ReactNode;
|
|
36
35
|
} & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
@@ -52,21 +51,21 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
|
|
|
52
51
|
} & Omit<import("url").UrlObject, "pathname"> : Pathname | ({
|
|
53
52
|
pathname: Pathname;
|
|
54
53
|
} & Omit<import("url").UrlObject, "pathname">);
|
|
55
|
-
locale?: AppLocales[number]
|
|
56
|
-
} & {
|
|
57
|
-
ref?: ComponentProps<typeof ClientLink>[
|
|
54
|
+
locale?: AppLocales[number];
|
|
55
|
+
}) & {
|
|
56
|
+
ref?: ComponentProps<typeof ClientLink>["ref"];
|
|
58
57
|
}) => ReactElement;
|
|
59
|
-
redirect: <
|
|
60
|
-
permanentRedirect: <
|
|
58
|
+
redirect: <Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
59
|
+
permanentRedirect: <Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
61
60
|
usePathname: () => keyof AppPathnames;
|
|
62
61
|
useRouter: () => {
|
|
63
|
-
push<
|
|
62
|
+
push<Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & {
|
|
64
63
|
locale?: AppLocales[number] | undefined;
|
|
65
64
|
}) | undefined): void;
|
|
66
|
-
replace<
|
|
65
|
+
replace<Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & {
|
|
67
66
|
locale?: AppLocales[number] | undefined;
|
|
68
67
|
}) | undefined): void;
|
|
69
|
-
prefetch<
|
|
68
|
+
prefetch<Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions & {
|
|
70
69
|
locale?: AppLocales[number] | undefined;
|
|
71
70
|
}) | undefined): void;
|
|
72
71
|
back(): void;
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React, { ReactElement } from 'react';
|
|
3
2
|
import { Locales } from '../../routing/types';
|
|
4
3
|
import { SharedNavigationRoutingConfigInput } from '../shared/config';
|
|
5
4
|
export default function createSharedPathnamesNavigation<const AppLocales extends Locales>(input?: SharedNavigationRoutingConfigInput<AppLocales>): {
|
|
6
5
|
Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
7
6
|
href: string | import("url").UrlObject;
|
|
8
|
-
as?:
|
|
9
|
-
replace?: boolean
|
|
10
|
-
scroll?: boolean
|
|
11
|
-
shallow?: boolean
|
|
12
|
-
passHref?: boolean
|
|
13
|
-
prefetch?: boolean
|
|
14
|
-
locale?: string | false
|
|
15
|
-
legacyBehavior?: boolean
|
|
16
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement
|
|
17
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement
|
|
18
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement
|
|
7
|
+
as?: string | import("url").UrlObject;
|
|
8
|
+
replace?: boolean;
|
|
9
|
+
scroll?: boolean;
|
|
10
|
+
shallow?: boolean;
|
|
11
|
+
passHref?: boolean;
|
|
12
|
+
prefetch?: boolean;
|
|
13
|
+
locale?: string | false;
|
|
14
|
+
legacyBehavior?: boolean;
|
|
15
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
16
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
17
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
19
18
|
}> & {
|
|
20
19
|
href: string | import("url").UrlObject;
|
|
21
|
-
as?:
|
|
22
|
-
replace?: boolean
|
|
23
|
-
scroll?: boolean
|
|
24
|
-
shallow?: boolean
|
|
25
|
-
passHref?: boolean
|
|
26
|
-
prefetch?: boolean
|
|
27
|
-
locale?: string | false
|
|
28
|
-
legacyBehavior?: boolean
|
|
29
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement
|
|
30
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement
|
|
31
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement
|
|
20
|
+
as?: string | import("url").UrlObject;
|
|
21
|
+
replace?: boolean;
|
|
22
|
+
scroll?: boolean;
|
|
23
|
+
shallow?: boolean;
|
|
24
|
+
passHref?: boolean;
|
|
25
|
+
prefetch?: boolean;
|
|
26
|
+
locale?: string | false;
|
|
27
|
+
legacyBehavior?: boolean;
|
|
28
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
29
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
30
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
32
31
|
} & {
|
|
33
32
|
children?: React.ReactNode;
|
|
34
33
|
} & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const clientRedirect: (params: Omit<{
|
|
1
|
+
export declare const clientRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
2
2
|
pathname: string;
|
|
3
|
-
locale:
|
|
4
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<
|
|
5
|
-
}, "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
6
|
-
export declare const clientPermanentRedirect: (params: Omit<{
|
|
3
|
+
locale: import("../../routing/types").Locales[number];
|
|
4
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
5
|
+
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
6
|
+
export declare const clientPermanentRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
7
7
|
pathname: string;
|
|
8
|
-
locale:
|
|
9
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<
|
|
10
|
-
}, "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
8
|
+
locale: import("../../routing/types").Locales[number];
|
|
9
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
10
|
+
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Locales, Pathnames } from '../../routing/types';
|
|
4
3
|
import { LocalizedNavigationRoutingConfigInput } from '../shared/config';
|
|
@@ -6,30 +5,30 @@ import { HrefOrHrefWithParams } from '../shared/utils';
|
|
|
6
5
|
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(input: LocalizedNavigationRoutingConfigInput<AppLocales, AppPathnames>): {
|
|
7
6
|
Link: <Pathname extends keyof AppPathnames>({ href, locale, ...rest }: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
8
7
|
href: string | import("url").UrlObject;
|
|
9
|
-
as?:
|
|
10
|
-
replace?: boolean
|
|
11
|
-
scroll?: boolean
|
|
12
|
-
shallow?: boolean
|
|
13
|
-
passHref?: boolean
|
|
14
|
-
prefetch?: boolean
|
|
15
|
-
locale?: string | false
|
|
16
|
-
legacyBehavior?: boolean
|
|
17
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement
|
|
18
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement
|
|
19
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement
|
|
8
|
+
as?: string | import("url").UrlObject;
|
|
9
|
+
replace?: boolean;
|
|
10
|
+
scroll?: boolean;
|
|
11
|
+
shallow?: boolean;
|
|
12
|
+
passHref?: boolean;
|
|
13
|
+
prefetch?: boolean;
|
|
14
|
+
locale?: string | false;
|
|
15
|
+
legacyBehavior?: boolean;
|
|
16
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
17
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
18
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
20
19
|
}> & {
|
|
21
20
|
href: string | import("url").UrlObject;
|
|
22
|
-
as?:
|
|
23
|
-
replace?: boolean
|
|
24
|
-
scroll?: boolean
|
|
25
|
-
shallow?: boolean
|
|
26
|
-
passHref?: boolean
|
|
27
|
-
prefetch?: boolean
|
|
28
|
-
locale?: string | false
|
|
29
|
-
legacyBehavior?: boolean
|
|
30
|
-
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement
|
|
31
|
-
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement
|
|
32
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement
|
|
21
|
+
as?: string | import("url").UrlObject;
|
|
22
|
+
replace?: boolean;
|
|
23
|
+
scroll?: boolean;
|
|
24
|
+
shallow?: boolean;
|
|
25
|
+
passHref?: boolean;
|
|
26
|
+
prefetch?: boolean;
|
|
27
|
+
locale?: string | false;
|
|
28
|
+
legacyBehavior?: boolean;
|
|
29
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
30
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
31
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
33
32
|
} & {
|
|
34
33
|
children?: React.ReactNode;
|
|
35
34
|
} & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
@@ -49,10 +48,10 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
|
|
|
49
48
|
} & Omit<import("url").UrlObject, "pathname"> : Pathname | ({
|
|
50
49
|
pathname: Pathname;
|
|
51
50
|
} & Omit<import("url").UrlObject, "pathname">);
|
|
52
|
-
locale?: AppLocales[number]
|
|
51
|
+
locale?: AppLocales[number];
|
|
53
52
|
}) => React.JSX.Element;
|
|
54
|
-
redirect: <
|
|
55
|
-
permanentRedirect: <
|
|
53
|
+
redirect: <Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
54
|
+
permanentRedirect: <Pathname extends keyof AppPathnames>(href: HrefOrHrefWithParams<Pathname>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
56
55
|
getPathname: ({ href, locale }: {
|
|
57
56
|
locale: AppLocales[number];
|
|
58
57
|
href: HrefOrHrefWithParams<keyof AppPathnames>;
|
|
@@ -3,7 +3,7 @@ import { Locales } from '../../routing/types';
|
|
|
3
3
|
import { SharedNavigationRoutingConfigInput } from '../shared/config';
|
|
4
4
|
import ServerLink from './ServerLink';
|
|
5
5
|
export default function createSharedPathnamesNavigation<AppLocales extends Locales>(input?: SharedNavigationRoutingConfigInput<AppLocales>): {
|
|
6
|
-
Link: (props: Omit<ComponentProps<typeof ServerLink<AppLocales>>,
|
|
6
|
+
Link: (props: Omit<ComponentProps<typeof ServerLink<AppLocales>>, "localePrefix" | "locales">) => React.JSX.Element;
|
|
7
7
|
redirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
8
8
|
permanentRedirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
9
9
|
usePathname: () => never;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const serverRedirect: (params: Omit<{
|
|
1
|
+
export declare const serverRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
2
2
|
pathname: string;
|
|
3
|
-
locale:
|
|
4
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<
|
|
5
|
-
}, "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
6
|
-
export declare const serverPermanentRedirect: (params: Omit<{
|
|
3
|
+
locale: import("../../routing/types").Locales[number];
|
|
4
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
5
|
+
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
6
|
+
export declare const serverPermanentRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
7
7
|
pathname: string;
|
|
8
|
-
locale:
|
|
9
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<
|
|
10
|
-
}, "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
8
|
+
locale: import("../../routing/types").Locales[number];
|
|
9
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
10
|
+
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
|
|
1
|
+
import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type, getLocale as getLocale_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
|
|
2
2
|
export declare function getRequestConfig(...args: Parameters<typeof getRequestConfig_type>): ReturnType<typeof getRequestConfig_type>;
|
|
3
3
|
export declare const getFormatter: typeof getFormatter_type;
|
|
4
4
|
export declare const getNow: typeof getNow_type;
|
|
5
5
|
export declare const getTimeZone: typeof getTimeZone_type;
|
|
6
6
|
export declare const getMessages: typeof getMessages_type;
|
|
7
|
-
export declare const getLocale:
|
|
7
|
+
export declare const getLocale: typeof getLocale_type;
|
|
8
8
|
export declare const getTranslations: () => never;
|
|
9
9
|
export declare const unstable_setRequestLocale: typeof unstable_setRequestLocale_type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@formatjs/intl-localematcher": "^0.2.32",
|
|
89
89
|
"negotiator": "^0.6.3",
|
|
90
|
-
"use-intl": "^3.17.
|
|
90
|
+
"use-intl": "^3.17.1"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"path": "dist/production/navigation.react-client.js",
|
|
107
|
-
"limit": "3.
|
|
107
|
+
"limit": "3.475 KB"
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
"path": "dist/production/navigation.react-server.js",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"limit": "0 KB"
|
|
128
128
|
}
|
|
129
129
|
],
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "1635c438061d18f89c0b6818213892051e19fa65"
|
|
131
131
|
}
|