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