next-intl 3.21.1 → 3.21.2-canary.0
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/middleware/middleware.js +19 -17
- package/dist/development/middleware/resolveLocale.js +20 -34
- package/dist/development/middleware/syncCookie.js +8 -7
- package/dist/development/navigation/react-client/ClientLink.js +2 -2
- package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +6 -1
- package/dist/development/navigation/react-client/createNavigation.js +83 -0
- package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +6 -1
- package/dist/development/navigation/react-client/useBasePathname.js +0 -14
- package/dist/development/navigation/react-client/useBaseRouter.js +3 -3
- package/dist/development/navigation/react-server/ServerLink.js +4 -2
- package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +5 -4
- package/dist/development/navigation/react-server/createNavigation.js +30 -0
- package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +2 -0
- package/dist/development/navigation/react-server/redirects.js +2 -2
- package/dist/development/navigation/shared/BaseLink.js +30 -26
- package/dist/development/navigation/shared/LegacyBaseLink.js +57 -0
- package/dist/development/navigation/shared/createSharedNavigationFns.js +148 -0
- package/dist/development/navigation/shared/redirects.js +3 -0
- package/dist/development/navigation/shared/syncLocaleCookie.js +26 -5
- package/dist/development/navigation/shared/utils.js +40 -1
- package/dist/development/navigation.react-client.js +2 -0
- package/dist/development/navigation.react-server.js +2 -0
- package/dist/development/react-client/index.js +0 -2
- package/dist/development/routing/config.js +18 -1
- package/dist/development/server/react-server/RequestLocale.js +15 -25
- package/dist/development/server/react-server/RequestLocaleCache.js +23 -0
- package/dist/development/server/react-server/RequestLocaleLegacy.js +43 -0
- package/dist/development/server/react-server/getConfig.js +15 -17
- package/dist/development/server/react-server/getRequestConfig.js +1 -1
- package/dist/development/server.react-server.js +2 -2
- package/dist/development/shared/constants.js +0 -9
- package/dist/esm/middleware/middleware.js +1 -1
- package/dist/esm/middleware/resolveLocale.js +1 -1
- package/dist/esm/middleware/syncCookie.js +1 -1
- package/dist/esm/navigation/react-client/ClientLink.js +1 -1
- package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-client/createNavigation.js +1 -0
- package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-client/useBasePathname.js +0 -1
- package/dist/esm/navigation/react-client/useBaseRouter.js +1 -1
- package/dist/esm/navigation/react-server/ServerLink.js +1 -1
- package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-server/createNavigation.js +1 -0
- package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-server/redirects.js +1 -1
- package/dist/esm/navigation/shared/BaseLink.js +1 -1
- package/dist/esm/navigation/shared/LegacyBaseLink.js +2 -0
- package/dist/esm/navigation/shared/createSharedNavigationFns.js +1 -0
- package/dist/esm/navigation/shared/syncLocaleCookie.js +1 -1
- package/dist/esm/navigation/shared/utils.js +1 -1
- package/dist/esm/navigation.react-client.js +1 -1
- package/dist/esm/navigation.react-server.js +1 -1
- package/dist/esm/routing/config.js +1 -1
- package/dist/esm/server/react-server/RequestLocale.js +1 -1
- package/dist/esm/server/react-server/RequestLocaleCache.js +1 -0
- package/dist/esm/server/react-server/RequestLocaleLegacy.js +1 -0
- package/dist/esm/server/react-server/getConfig.js +1 -1
- package/dist/esm/server.react-server.js +1 -1
- package/dist/esm/shared/constants.js +1 -1
- package/dist/production/middleware/middleware.js +1 -1
- package/dist/production/middleware/resolveLocale.js +1 -1
- package/dist/production/middleware/syncCookie.js +1 -1
- package/dist/production/navigation/react-client/ClientLink.js +1 -1
- package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-client/createNavigation.js +1 -0
- package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-client/useBasePathname.js +0 -1
- package/dist/production/navigation/react-client/useBaseRouter.js +1 -1
- package/dist/production/navigation/react-server/ServerLink.js +1 -1
- package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-server/createNavigation.js +1 -0
- package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-server/redirects.js +1 -1
- package/dist/production/navigation/shared/BaseLink.js +1 -1
- package/dist/production/navigation/shared/LegacyBaseLink.js +2 -0
- package/dist/production/navigation/shared/createSharedNavigationFns.js +1 -0
- package/dist/production/navigation/shared/syncLocaleCookie.js +1 -1
- package/dist/production/navigation/shared/utils.js +1 -1
- package/dist/production/navigation.react-client.js +1 -1
- package/dist/production/navigation.react-server.js +1 -1
- package/dist/production/routing/config.js +1 -1
- package/dist/production/server/react-server/RequestLocale.js +1 -1
- package/dist/production/server/react-server/RequestLocaleCache.js +1 -0
- package/dist/production/server/react-server/RequestLocaleLegacy.js +1 -0
- package/dist/production/server/react-server/getConfig.js +1 -1
- package/dist/production/server.react-server.js +1 -1
- package/dist/production/shared/constants.js +1 -1
- package/dist/types/src/middleware/getAlternateLinksHeaderValue.d.ts +3 -3
- package/dist/types/src/middleware/middleware.d.ts +11 -3
- package/dist/types/src/middleware/resolveLocale.d.ts +2 -3
- package/dist/types/src/middleware/syncCookie.d.ts +2 -1
- package/dist/types/src/middleware/utils.d.ts +4 -4
- package/dist/types/src/navigation/createNavigation.test.d.ts +1 -0
- package/dist/types/src/navigation/react-client/ClientLink.d.ts +6 -6
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +17 -5
- package/dist/types/src/navigation/react-client/createNavigation.d.ts +467 -0
- package/dist/types/src/navigation/react-client/createNavigation.test.d.ts +1 -0
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +9 -5
- package/dist/types/src/navigation/react-client/index.d.ts +1 -0
- package/dist/types/src/navigation/react-client/redirects.d.ts +4 -4
- package/dist/types/src/navigation/react-client/useBasePathname.d.ts +2 -15
- package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +3 -2
- package/dist/types/src/navigation/react-server/ServerLink.d.ts +5 -5
- package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +14 -5
- package/dist/types/src/navigation/react-server/createNavigation.d.ts +385 -0
- package/dist/types/src/navigation/react-server/createNavigation.test.d.ts +1 -0
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +3 -3
- package/dist/types/src/navigation/react-server/index.d.ts +1 -0
- package/dist/types/src/navigation/react-server/redirects.d.ts +4 -4
- package/dist/types/src/navigation/shared/BaseLink.d.ts +13 -6
- package/dist/types/src/navigation/shared/LegacyBaseLink.d.ts +12 -0
- package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +385 -0
- package/dist/types/src/navigation/shared/redirects.d.ts +5 -5
- package/dist/types/src/navigation/shared/syncLocaleCookie.d.ts +2 -1
- package/dist/types/src/navigation/shared/utils.d.ts +10 -3
- package/dist/types/src/routing/config.d.ts +46 -11
- package/dist/types/src/routing/defineRouting.d.ts +2 -2
- package/dist/types/src/routing/types.d.ts +4 -4
- package/dist/types/src/server/react-server/RequestLocale.d.ts +1 -2
- package/dist/types/src/server/react-server/RequestLocaleCache.d.ts +2 -0
- package/dist/types/src/server/react-server/RequestLocaleLegacy.d.ts +1 -0
- package/dist/types/src/server/react-server/createRequestConfig.d.ts +2 -3
- package/dist/types/src/server/react-server/getRequestConfig.d.ts +32 -6
- package/dist/types/src/server/react-server/index.d.ts +1 -1
- package/dist/types/src/shared/constants.d.ts +0 -3
- package/dist/types/src/shared/types.d.ts +3 -0
- package/dist/types/src/shared/utils.d.ts +2 -2
- package/package.json +3 -3
- package/dist/types/src/middleware/config.d.ts +0 -7
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RoutingConfigLocalizedNavigation, RoutingConfigSharedNavigation } from '../../routing/config';
|
|
3
|
+
import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routing/types';
|
|
4
|
+
import { HrefOrHrefWithParams, QueryParams } from './utils';
|
|
5
|
+
type PromiseOrValue<Type> = Type | Promise<Type>;
|
|
6
|
+
/**
|
|
7
|
+
* Shared implementations for `react-server` and `react-client`
|
|
8
|
+
*/
|
|
9
|
+
export default function createSharedNavigationFns<const AppLocales extends Locales, const AppPathnames extends Pathnames<AppLocales> = never, const AppLocalePrefixMode extends LocalePrefixMode = 'always', const AppDomains extends DomainsConfig<AppLocales> = never>(getLocale: () => PromiseOrValue<AppLocales extends never ? string : AppLocales[number]>, routing?: [AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
|
|
10
|
+
config: Omit<{}, "localePrefix" | "localeCookie" | "alternateLinks" | "localeDetection"> & {
|
|
11
|
+
localePrefix: {
|
|
12
|
+
mode: "never";
|
|
13
|
+
} | {
|
|
14
|
+
mode: "always";
|
|
15
|
+
prefixes?: Partial<Record<string, string>> | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
mode: "as-needed";
|
|
18
|
+
prefixes?: Partial<Record<string, string>> | undefined;
|
|
19
|
+
};
|
|
20
|
+
localeCookie: import("../../routing/config").InitializedLocaleCookieConfig;
|
|
21
|
+
localeDetection: NonNullable<boolean | undefined>;
|
|
22
|
+
alternateLinks: NonNullable<boolean | undefined>;
|
|
23
|
+
};
|
|
24
|
+
Link: React.ForwardRefExoticComponent<Omit<{
|
|
25
|
+
locale?: string;
|
|
26
|
+
slot?: string | undefined;
|
|
27
|
+
style?: React.CSSProperties | undefined;
|
|
28
|
+
title?: string | undefined;
|
|
29
|
+
onError?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
30
|
+
children?: React.ReactNode | undefined;
|
|
31
|
+
ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
|
|
32
|
+
replace?: boolean;
|
|
33
|
+
as?: string | import("url").UrlObject;
|
|
34
|
+
scroll?: boolean;
|
|
35
|
+
shallow?: boolean;
|
|
36
|
+
passHref?: boolean;
|
|
37
|
+
prefetch?: boolean;
|
|
38
|
+
legacyBehavior?: boolean;
|
|
39
|
+
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
40
|
+
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
|
|
41
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
42
|
+
download?: any;
|
|
43
|
+
hrefLang?: string | undefined;
|
|
44
|
+
media?: string | undefined;
|
|
45
|
+
ping?: string | undefined;
|
|
46
|
+
target?: React.HTMLAttributeAnchorTarget | undefined;
|
|
47
|
+
type?: string | undefined;
|
|
48
|
+
referrerPolicy?: React.HTMLAttributeReferrerPolicy | undefined;
|
|
49
|
+
defaultChecked?: boolean | undefined;
|
|
50
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
51
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
52
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
53
|
+
accessKey?: string | undefined;
|
|
54
|
+
autoFocus?: boolean | undefined;
|
|
55
|
+
className?: string | undefined;
|
|
56
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
57
|
+
contextMenu?: string | undefined;
|
|
58
|
+
dir?: string | undefined;
|
|
59
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
60
|
+
hidden?: boolean | undefined;
|
|
61
|
+
id?: string | undefined;
|
|
62
|
+
lang?: string | undefined;
|
|
63
|
+
nonce?: string | undefined;
|
|
64
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
65
|
+
tabIndex?: number | undefined;
|
|
66
|
+
translate?: "yes" | "no" | undefined;
|
|
67
|
+
radioGroup?: string | undefined;
|
|
68
|
+
role?: React.AriaRole | undefined;
|
|
69
|
+
about?: string | undefined;
|
|
70
|
+
content?: string | undefined;
|
|
71
|
+
datatype?: string | undefined;
|
|
72
|
+
inlist?: any;
|
|
73
|
+
prefix?: string | undefined;
|
|
74
|
+
property?: string | undefined;
|
|
75
|
+
rel?: string | undefined;
|
|
76
|
+
resource?: string | undefined;
|
|
77
|
+
rev?: string | undefined;
|
|
78
|
+
typeof?: string | undefined;
|
|
79
|
+
vocab?: string | undefined;
|
|
80
|
+
autoCapitalize?: string | undefined;
|
|
81
|
+
autoCorrect?: string | undefined;
|
|
82
|
+
autoSave?: string | undefined;
|
|
83
|
+
color?: string | undefined;
|
|
84
|
+
itemProp?: string | undefined;
|
|
85
|
+
itemScope?: boolean | undefined;
|
|
86
|
+
itemType?: string | undefined;
|
|
87
|
+
itemID?: string | undefined;
|
|
88
|
+
itemRef?: string | undefined;
|
|
89
|
+
results?: number | undefined;
|
|
90
|
+
security?: string | undefined;
|
|
91
|
+
unselectable?: "on" | "off" | undefined;
|
|
92
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
93
|
+
is?: string | undefined;
|
|
94
|
+
popover?: "" | "auto" | "manual" | undefined;
|
|
95
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
96
|
+
popoverTarget?: string | undefined;
|
|
97
|
+
onToggle?: React.ToggleEventHandler<HTMLAnchorElement> | undefined;
|
|
98
|
+
onBeforeToggle?: React.ToggleEventHandler<HTMLAnchorElement> | undefined;
|
|
99
|
+
inert?: boolean | undefined;
|
|
100
|
+
tw?: string;
|
|
101
|
+
"aria-activedescendant"?: string | undefined;
|
|
102
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
103
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
104
|
+
"aria-braillelabel"?: string | undefined;
|
|
105
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
106
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
107
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
108
|
+
"aria-colcount"?: number | undefined;
|
|
109
|
+
"aria-colindex"?: number | undefined;
|
|
110
|
+
"aria-colindextext"?: string | undefined;
|
|
111
|
+
"aria-colspan"?: number | undefined;
|
|
112
|
+
"aria-controls"?: string | undefined;
|
|
113
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
114
|
+
"aria-describedby"?: string | undefined;
|
|
115
|
+
"aria-description"?: string | undefined;
|
|
116
|
+
"aria-details"?: string | undefined;
|
|
117
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
118
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
119
|
+
"aria-errormessage"?: string | undefined;
|
|
120
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
121
|
+
"aria-flowto"?: string | undefined;
|
|
122
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
123
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
124
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
125
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
126
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
127
|
+
"aria-label"?: string | undefined;
|
|
128
|
+
"aria-labelledby"?: string | undefined;
|
|
129
|
+
"aria-level"?: number | undefined;
|
|
130
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
131
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
132
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
133
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
134
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
135
|
+
"aria-owns"?: string | undefined;
|
|
136
|
+
"aria-placeholder"?: string | undefined;
|
|
137
|
+
"aria-posinset"?: number | undefined;
|
|
138
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
139
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
140
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
141
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
142
|
+
"aria-roledescription"?: string | undefined;
|
|
143
|
+
"aria-rowcount"?: number | undefined;
|
|
144
|
+
"aria-rowindex"?: number | undefined;
|
|
145
|
+
"aria-rowindextext"?: string | undefined;
|
|
146
|
+
"aria-rowspan"?: number | undefined;
|
|
147
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
148
|
+
"aria-setsize"?: number | undefined;
|
|
149
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
150
|
+
"aria-valuemax"?: number | undefined;
|
|
151
|
+
"aria-valuemin"?: number | undefined;
|
|
152
|
+
"aria-valuenow"?: number | undefined;
|
|
153
|
+
"aria-valuetext"?: string | undefined;
|
|
154
|
+
dangerouslySetInnerHTML?: {
|
|
155
|
+
__html: string | TrustedHTML;
|
|
156
|
+
} | undefined;
|
|
157
|
+
onCopy?: React.ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
158
|
+
onCopyCapture?: React.ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
159
|
+
onCut?: React.ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
160
|
+
onCutCapture?: React.ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
161
|
+
onPaste?: React.ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
162
|
+
onPasteCapture?: React.ClipboardEventHandler<HTMLAnchorElement> | undefined;
|
|
163
|
+
onCompositionEnd?: React.CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
164
|
+
onCompositionEndCapture?: React.CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
165
|
+
onCompositionStart?: React.CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
166
|
+
onCompositionStartCapture?: React.CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
167
|
+
onCompositionUpdate?: React.CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
168
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLAnchorElement> | undefined;
|
|
169
|
+
onFocus?: React.FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
170
|
+
onFocusCapture?: React.FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
171
|
+
onBlur?: React.FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
172
|
+
onBlurCapture?: React.FocusEventHandler<HTMLAnchorElement> | undefined;
|
|
173
|
+
onChange?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
174
|
+
onChangeCapture?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
175
|
+
onBeforeInput?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
176
|
+
onBeforeInputCapture?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
177
|
+
onInput?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
178
|
+
onInputCapture?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
179
|
+
onReset?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
180
|
+
onResetCapture?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
181
|
+
onSubmit?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
182
|
+
onSubmitCapture?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
183
|
+
onInvalid?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
184
|
+
onInvalidCapture?: React.FormEventHandler<HTMLAnchorElement> | undefined;
|
|
185
|
+
onLoad?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
186
|
+
onLoadCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
187
|
+
onErrorCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
188
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
189
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
190
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
191
|
+
onKeyPressCapture?: React.KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
192
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
193
|
+
onKeyUpCapture?: React.KeyboardEventHandler<HTMLAnchorElement> | undefined;
|
|
194
|
+
onAbort?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
195
|
+
onAbortCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
196
|
+
onCanPlay?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
197
|
+
onCanPlayCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
198
|
+
onCanPlayThrough?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
199
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
200
|
+
onDurationChange?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
201
|
+
onDurationChangeCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
202
|
+
onEmptied?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
203
|
+
onEmptiedCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
204
|
+
onEncrypted?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
205
|
+
onEncryptedCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
206
|
+
onEnded?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
207
|
+
onEndedCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
208
|
+
onLoadedData?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
209
|
+
onLoadedDataCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
210
|
+
onLoadedMetadata?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
211
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
212
|
+
onLoadStart?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
213
|
+
onLoadStartCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
214
|
+
onPause?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
215
|
+
onPauseCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
216
|
+
onPlay?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
217
|
+
onPlayCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
218
|
+
onPlaying?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
219
|
+
onPlayingCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
220
|
+
onProgress?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
221
|
+
onProgressCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
222
|
+
onRateChange?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
223
|
+
onRateChangeCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
224
|
+
onResize?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
225
|
+
onResizeCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
226
|
+
onSeeked?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
227
|
+
onSeekedCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
228
|
+
onSeeking?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
229
|
+
onSeekingCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
230
|
+
onStalled?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
231
|
+
onStalledCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
232
|
+
onSuspend?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
233
|
+
onSuspendCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
234
|
+
onTimeUpdate?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
235
|
+
onTimeUpdateCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
236
|
+
onVolumeChange?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
237
|
+
onVolumeChangeCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
238
|
+
onWaiting?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
239
|
+
onWaitingCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
240
|
+
onAuxClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
241
|
+
onAuxClickCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
242
|
+
onClickCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
243
|
+
onContextMenu?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
244
|
+
onContextMenuCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
245
|
+
onDoubleClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
246
|
+
onDoubleClickCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
247
|
+
onDrag?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
248
|
+
onDragCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
249
|
+
onDragEnd?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
250
|
+
onDragEndCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
251
|
+
onDragEnter?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
252
|
+
onDragEnterCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
253
|
+
onDragExit?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
254
|
+
onDragExitCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
255
|
+
onDragLeave?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
256
|
+
onDragLeaveCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
257
|
+
onDragOver?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
258
|
+
onDragOverCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
259
|
+
onDragStart?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
260
|
+
onDragStartCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
261
|
+
onDrop?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
262
|
+
onDropCapture?: React.DragEventHandler<HTMLAnchorElement> | undefined;
|
|
263
|
+
onMouseDown?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
264
|
+
onMouseDownCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
265
|
+
onMouseLeave?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
266
|
+
onMouseMove?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
267
|
+
onMouseMoveCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
268
|
+
onMouseOut?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
269
|
+
onMouseOutCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
270
|
+
onMouseOver?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
271
|
+
onMouseOverCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
272
|
+
onMouseUp?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
273
|
+
onMouseUpCapture?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
274
|
+
onSelect?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
275
|
+
onSelectCapture?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
276
|
+
onTouchCancel?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
277
|
+
onTouchCancelCapture?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
278
|
+
onTouchEnd?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
279
|
+
onTouchEndCapture?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
280
|
+
onTouchMove?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
281
|
+
onTouchMoveCapture?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
282
|
+
onTouchStartCapture?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
283
|
+
onPointerDown?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
284
|
+
onPointerDownCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
285
|
+
onPointerMove?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
286
|
+
onPointerMoveCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
287
|
+
onPointerUp?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
288
|
+
onPointerUpCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
289
|
+
onPointerCancel?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
290
|
+
onPointerCancelCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
291
|
+
onPointerEnter?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
292
|
+
onPointerLeave?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
293
|
+
onPointerOver?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
294
|
+
onPointerOverCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
295
|
+
onPointerOut?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
296
|
+
onPointerOutCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
297
|
+
onGotPointerCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
298
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
299
|
+
onLostPointerCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
300
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLAnchorElement> | undefined;
|
|
301
|
+
onScroll?: React.UIEventHandler<HTMLAnchorElement> | undefined;
|
|
302
|
+
onScrollCapture?: React.UIEventHandler<HTMLAnchorElement> | undefined;
|
|
303
|
+
onWheel?: React.WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
304
|
+
onWheelCapture?: React.WheelEventHandler<HTMLAnchorElement> | undefined;
|
|
305
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
306
|
+
onAnimationStartCapture?: React.AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
307
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
308
|
+
onAnimationEndCapture?: React.AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
309
|
+
onAnimationIteration?: React.AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
310
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLAnchorElement> | undefined;
|
|
311
|
+
onTransitionEnd?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
312
|
+
onTransitionEndCapture?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
313
|
+
onTransitionCancel?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
314
|
+
onTransitionCancelCapture?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
315
|
+
onTransitionRun?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
316
|
+
onTransitionRunCapture?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
317
|
+
onTransitionStart?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
318
|
+
onTransitionStartCapture?: React.TransitionEventHandler<HTMLAnchorElement> | undefined;
|
|
319
|
+
key?: React.Key | null | undefined;
|
|
320
|
+
href: [AppPathnames] extends [never] ? string | import("url").UrlObject : keyof AppPathnames extends infer T ? T extends keyof AppPathnames ? T extends `${string}[[...${string}` ? T | ({
|
|
321
|
+
pathname: T;
|
|
322
|
+
params?: import("./StrictParams").default<T> | undefined;
|
|
323
|
+
} & Omit<import("url").UrlObject, "pathname">) : T extends `${string}[${string}` ? {
|
|
324
|
+
pathname: T;
|
|
325
|
+
params: import("./StrictParams").default<T>;
|
|
326
|
+
} & Omit<import("url").UrlObject, "pathname"> : T | ({
|
|
327
|
+
pathname: T;
|
|
328
|
+
} & Omit<import("url").UrlObject, "pathname">) : never : never;
|
|
329
|
+
}, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
330
|
+
redirect: (args: Omit<Parameters<(args: {
|
|
331
|
+
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname */
|
|
332
|
+
href: [AppPathnames] extends [never] ? string | {
|
|
333
|
+
pathname: string;
|
|
334
|
+
query?: QueryParams;
|
|
335
|
+
} : HrefOrHrefWithParams<keyof AppPathnames>;
|
|
336
|
+
locale: string;
|
|
337
|
+
} & (([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
338
|
+
/**
|
|
339
|
+
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
340
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname
|
|
341
|
+
*/
|
|
342
|
+
domain: AppDomains[number]["domain"];
|
|
343
|
+
} : {}), _forcePrefix?: boolean) => string>[0], "domain"> & Partial<([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
344
|
+
/**
|
|
345
|
+
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
346
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname
|
|
347
|
+
*/
|
|
348
|
+
domain: AppDomains[number]["domain"];
|
|
349
|
+
} : {}>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
350
|
+
permanentRedirect: (args: Omit<Parameters<(args: {
|
|
351
|
+
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname */
|
|
352
|
+
href: [AppPathnames] extends [never] ? string | {
|
|
353
|
+
pathname: string;
|
|
354
|
+
query?: QueryParams;
|
|
355
|
+
} : HrefOrHrefWithParams<keyof AppPathnames>;
|
|
356
|
+
locale: string;
|
|
357
|
+
} & (([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
358
|
+
/**
|
|
359
|
+
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
360
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname
|
|
361
|
+
*/
|
|
362
|
+
domain: AppDomains[number]["domain"];
|
|
363
|
+
} : {}), _forcePrefix?: boolean) => string>[0], "domain"> & Partial<([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
364
|
+
/**
|
|
365
|
+
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
366
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname
|
|
367
|
+
*/
|
|
368
|
+
domain: AppDomains[number]["domain"];
|
|
369
|
+
} : {}>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
370
|
+
getPathname: (args: Parameters<(args: {
|
|
371
|
+
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname */
|
|
372
|
+
href: [AppPathnames] extends [never] ? string | {
|
|
373
|
+
pathname: string;
|
|
374
|
+
query?: QueryParams;
|
|
375
|
+
} : HrefOrHrefWithParams<keyof AppPathnames>;
|
|
376
|
+
locale: string;
|
|
377
|
+
} & (([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
378
|
+
/**
|
|
379
|
+
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
380
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname
|
|
381
|
+
*/
|
|
382
|
+
domain: AppDomains[number]["domain"];
|
|
383
|
+
} : {}), _forcePrefix?: boolean) => string>[0]) => string;
|
|
384
|
+
};
|
|
385
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Locales, LocalePrefixConfigVerbose } from '../../routing/types';
|
|
2
|
-
export declare const baseRedirect: <AppLocales extends Locales>(params: {
|
|
1
|
+
import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
|
|
2
|
+
export declare const baseRedirect: <AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(params: {
|
|
3
3
|
pathname: string;
|
|
4
4
|
locale: Locales[number];
|
|
5
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
5
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
|
|
6
6
|
}, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
7
|
-
export declare const basePermanentRedirect: <AppLocales extends Locales>(params: {
|
|
7
|
+
export declare const basePermanentRedirect: <AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(params: {
|
|
8
8
|
pathname: string;
|
|
9
9
|
locale: Locales[number];
|
|
10
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
10
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
|
|
11
11
|
}, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { InitializedLocaleCookieConfig } from '../../routing/config';
|
|
1
2
|
/**
|
|
2
3
|
* We have to keep the cookie value in sync as Next.js might
|
|
3
4
|
* skip a request to the server due to its router cache.
|
|
4
5
|
* See https://github.com/amannn/next-intl/issues/786.
|
|
5
6
|
*/
|
|
6
|
-
export default function syncLocaleCookie(pathname: string | null, locale: string, nextLocale?: string): void;
|
|
7
|
+
export default function syncLocaleCookie(localeCookie: InitializedLocaleCookieConfig, pathname: string | null, locale: string, nextLocale?: string): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ParsedUrlQueryInput } from 'node:querystring';
|
|
2
2
|
import type { UrlObject } from 'url';
|
|
3
|
-
import {
|
|
3
|
+
import { ResolvedRoutingConfig } from '../../routing/config';
|
|
4
|
+
import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routing/types';
|
|
4
5
|
import StrictParams from './StrictParams';
|
|
5
6
|
type SearchParamValue = ParsedUrlQueryInput[keyof ParsedUrlQueryInput];
|
|
6
7
|
type HrefOrHrefWithParamsImpl<Pathname, Other> = Pathname extends `${string}[[...${string}` ? // Optional catch-all
|
|
@@ -16,10 +17,14 @@ Pathname | ({
|
|
|
16
17
|
pathname: Pathname;
|
|
17
18
|
} & Other);
|
|
18
19
|
export type HrefOrUrlObjectWithParams<Pathname> = HrefOrHrefWithParamsImpl<Pathname, Omit<UrlObject, 'pathname'>>;
|
|
20
|
+
export type QueryParams = Record<string, SearchParamValue>;
|
|
19
21
|
export type HrefOrHrefWithParams<Pathname> = HrefOrHrefWithParamsImpl<Pathname, {
|
|
20
|
-
query?:
|
|
22
|
+
query?: QueryParams;
|
|
21
23
|
}>;
|
|
22
|
-
export declare function normalizeNameOrNameWithParams<Pathname>(href: HrefOrHrefWithParams<Pathname>
|
|
24
|
+
export declare function normalizeNameOrNameWithParams<Pathname>(href: HrefOrHrefWithParams<Pathname> | {
|
|
25
|
+
locale: string;
|
|
26
|
+
href: HrefOrHrefWithParams<Pathname>;
|
|
27
|
+
}): {
|
|
23
28
|
pathname: Pathname;
|
|
24
29
|
params?: StrictParams<Pathname>;
|
|
25
30
|
};
|
|
@@ -43,4 +48,6 @@ export declare function compileLocalizedPathname<AppLocales extends Locales, Pat
|
|
|
43
48
|
}): UrlObject;
|
|
44
49
|
export declare function getRoute<AppLocales extends Locales>(locale: AppLocales[number], pathname: string, pathnames: Pathnames<AppLocales>): keyof Pathnames<AppLocales>;
|
|
45
50
|
export declare function getBasePath(pathname: string, windowPathname?: string): string;
|
|
51
|
+
export declare function applyPathnamePrefix<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined>(pathname: string, locale: Locales[number], routing: Pick<ResolvedRoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'localePrefix' | 'domains'> & Partial<Pick<ResolvedRoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'defaultLocale'>>, domain?: string, force?: boolean): string;
|
|
52
|
+
export declare function validateReceivedConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined>(config: Partial<Pick<ResolvedRoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'defaultLocale' | 'localePrefix'>>): void;
|
|
46
53
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { NextResponse } from 'next/server';
|
|
2
|
+
import { Locales, LocalePrefix, LocalePrefixConfigVerbose, DomainsConfig, Pathnames, LocalePrefixMode } from './types';
|
|
3
|
+
type CookieAttributes = Pick<NonNullable<Parameters<typeof NextResponse.prototype.cookies.set>['2']>, 'maxAge' | 'domain' | 'partitioned' | 'path' | 'priority' | 'sameSite' | 'secure' | 'name'>;
|
|
4
|
+
export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = {
|
|
3
5
|
/**
|
|
4
6
|
* All available locales.
|
|
5
7
|
* @see https://next-intl-docs.vercel.app/docs/routing
|
|
@@ -14,12 +16,27 @@ export type RoutingConfig<AppLocales extends Locales, AppPathnames extends Pathn
|
|
|
14
16
|
* Configures whether and which prefix is shown for a given locale.
|
|
15
17
|
* @see https://next-intl-docs.vercel.app/docs/routing#locale-prefix
|
|
16
18
|
**/
|
|
17
|
-
localePrefix?: LocalePrefix<AppLocales>;
|
|
19
|
+
localePrefix?: LocalePrefix<AppLocales, AppLocalePrefixMode>;
|
|
18
20
|
/**
|
|
19
21
|
* Can be used to change the locale handling per domain.
|
|
20
22
|
* @see https://next-intl-docs.vercel.app/docs/routing#domains
|
|
21
23
|
**/
|
|
22
|
-
domains?:
|
|
24
|
+
domains?: AppDomains;
|
|
25
|
+
/**
|
|
26
|
+
* Can be used to disable the locale cookie or to customize it.
|
|
27
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-cookie
|
|
28
|
+
*/
|
|
29
|
+
localeCookie?: boolean | CookieAttributes;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http
|
|
32
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#alternate-links
|
|
33
|
+
**/
|
|
34
|
+
alternateLinks?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* By setting this to `false`, the cookie as well as the `accept-language` header will no longer be used for locale detection.
|
|
37
|
+
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-detection
|
|
38
|
+
**/
|
|
39
|
+
localeDetection?: boolean;
|
|
23
40
|
} & ([AppPathnames] extends [never] ? {} : {
|
|
24
41
|
/**
|
|
25
42
|
* A map of localized pathnames per locale.
|
|
@@ -27,14 +44,32 @@ export type RoutingConfig<AppLocales extends Locales, AppPathnames extends Pathn
|
|
|
27
44
|
**/
|
|
28
45
|
pathnames: AppPathnames;
|
|
29
46
|
});
|
|
30
|
-
export type RoutingConfigSharedNavigation<AppLocales extends Locales,
|
|
31
|
-
export type RoutingConfigLocalizedNavigation<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales
|
|
47
|
+
export type RoutingConfigSharedNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppDomains extends DomainsConfig<AppLocales> = never> = Omit<RoutingConfig<AppLocales, AppLocalePrefixMode, never, AppDomains>, 'defaultLocale' | 'locales' | 'pathnames'> & Partial<Pick<RoutingConfig<AppLocales, never, never, AppDomains>, 'defaultLocale' | 'locales'>>;
|
|
48
|
+
export type RoutingConfigLocalizedNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales>, AppDomains extends DomainsConfig<AppLocales> = never> = Omit<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'defaultLocale' | 'pathnames'> & Partial<Pick<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'defaultLocale'>> & {
|
|
32
49
|
pathnames: AppPathnames;
|
|
33
50
|
};
|
|
34
|
-
export type ResolvedRoutingConfig<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>
|
|
35
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
51
|
+
export type ResolvedRoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = Omit<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'localePrefix' | 'localeCookie' | 'alternateLinks' | 'localeDetection'> & {
|
|
52
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
|
|
53
|
+
localeCookie: InitializedLocaleCookieConfig;
|
|
54
|
+
alternateLinks: boolean;
|
|
55
|
+
localeDetection: boolean;
|
|
36
56
|
};
|
|
37
|
-
export declare function receiveRoutingConfig<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales
|
|
38
|
-
localePrefix:
|
|
57
|
+
export declare function receiveRoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined, Config extends Partial<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>>>(input: Config): Omit<Config, "localePrefix" | "localeCookie" | "alternateLinks" | "localeDetection"> & {
|
|
58
|
+
localePrefix: {
|
|
59
|
+
mode: "never";
|
|
60
|
+
} | {
|
|
61
|
+
mode: "always";
|
|
62
|
+
prefixes?: Partial<Record<AppLocales[number], string>> | undefined;
|
|
63
|
+
} | {
|
|
64
|
+
mode: "as-needed";
|
|
65
|
+
prefixes?: Partial<Record<AppLocales[number], string>> | undefined;
|
|
66
|
+
};
|
|
67
|
+
localeCookie: InitializedLocaleCookieConfig;
|
|
68
|
+
localeDetection: boolean | NonNullable<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>["localeDetection"]>;
|
|
69
|
+
alternateLinks: boolean | NonNullable<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>["alternateLinks"]>;
|
|
39
70
|
};
|
|
40
|
-
export declare function
|
|
71
|
+
export declare function receiveLocaleCookie(localeCookie?: boolean | CookieAttributes): InitializedLocaleCookieConfig;
|
|
72
|
+
export type InitializedLocaleCookieConfig = false | LocaleCookieConfig;
|
|
73
|
+
export type LocaleCookieConfig = Omit<CookieAttributes, 'name' | 'maxAge' | 'sameSite'> & Required<Pick<CookieAttributes, 'name' | 'maxAge' | 'sameSite'>>;
|
|
74
|
+
export declare function receiveLocalePrefixConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix?: LocalePrefix<AppLocales, AppLocalePrefixMode>): LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
|
|
75
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RoutingConfig } from './config';
|
|
2
|
-
import { Locales, Pathnames } from './types';
|
|
3
|
-
export default function defineRouting<const AppLocales extends Locales, const AppPathnames extends Pathnames<AppLocales> = never>(config: RoutingConfig<AppLocales, AppPathnames>): RoutingConfig<AppLocales, AppPathnames>;
|
|
2
|
+
import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from './types';
|
|
3
|
+
export default function defineRouting<const AppLocales extends Locales, const AppLocalePrefixMode extends LocalePrefixMode = 'always', const AppPathnames extends Pathnames<AppLocales> = never, const AppDomains extends DomainsConfig<AppLocales> = never>(config: RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>;
|
|
@@ -2,16 +2,16 @@ export type Locales = ReadonlyArray<string>;
|
|
|
2
2
|
export type LocalePrefixMode = 'always' | 'as-needed' | 'never';
|
|
3
3
|
type Pathname = string;
|
|
4
4
|
export type LocalePrefixes<AppLocales extends Locales> = Partial<Record<AppLocales[number], Pathname>>;
|
|
5
|
-
export type LocalePrefixConfigVerbose<AppLocales extends Locales> = {
|
|
5
|
+
export type LocalePrefixConfigVerbose<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode> = AppLocalePrefixMode extends 'always' ? {
|
|
6
6
|
mode: 'always';
|
|
7
7
|
prefixes?: LocalePrefixes<AppLocales>;
|
|
8
|
-
}
|
|
8
|
+
} : AppLocalePrefixMode extends 'as-needed' ? {
|
|
9
9
|
mode: 'as-needed';
|
|
10
10
|
prefixes?: LocalePrefixes<AppLocales>;
|
|
11
|
-
}
|
|
11
|
+
} : {
|
|
12
12
|
mode: 'never';
|
|
13
13
|
};
|
|
14
|
-
export type LocalePrefix<AppLocales extends Locales =
|
|
14
|
+
export type LocalePrefix<AppLocales extends Locales = [], AppLocalePrefixMode extends LocalePrefixMode = 'always'> = AppLocalePrefixMode | LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
|
|
15
15
|
export type Pathnames<AppLocales extends Locales> = Record<Pathname, Record<AppLocales[number], Pathname> | Pathname>;
|
|
16
16
|
export type DomainConfig<AppLocales extends Locales> = {
|
|
17
17
|
defaultLocale: AppLocales[number];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function getRequestLocale(): string;
|
|
1
|
+
export declare function getRequestLocale(): Promise<string | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRequestLocale(): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
declare const _default: (params: GetRequestConfigParams) => IntlConfig | Promise<IntlConfig>;
|
|
1
|
+
import type { GetRequestConfigParams, RequestConfig } from './getRequestConfig';
|
|
2
|
+
declare const _default: (params: GetRequestConfigParams) => RequestConfig | Promise<RequestConfig>;
|
|
4
3
|
export default _default;
|