@inquirer/i18n 1.2.0 → 1.3.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.
@@ -1,10 +1,8 @@
1
1
  import { createLocalizedPrompts } from "../create.js";
2
- const ptLocale = {
2
+ export const locale = {
3
3
  confirm: {
4
4
  yesLabel: 'Sim',
5
5
  noLabel: 'Não',
6
- hintYes: 'S/n',
7
- hintNo: 's/N',
8
6
  },
9
7
  select: {
10
8
  helpNavigate: 'navegar',
@@ -27,7 +25,8 @@ const ptLocale = {
27
25
  },
28
26
  password: {
29
27
  maskedText: '[entrada mascarada]',
28
+ helpToggle: 'alternar visibilidade',
30
29
  },
31
30
  };
32
- export const { confirm, select, checkbox, search, expand, rawlist, editor, input, number, password, } = createLocalizedPrompts(ptLocale);
31
+ export const { confirm, select, checkbox, search, expand, rawlist, editor, input, number, password, } = createLocalizedPrompts(locale);
33
32
  export { Separator } from '@inquirer/prompts';
@@ -1,8 +1,31 @@
1
+ import type { Locale } from '../types.ts';
2
+ export declare const locale: Locale;
1
3
  export declare const confirm: (this: void, config: {
4
+ message: string;
5
+ default?: boolean | undefined | undefined;
6
+ transformer?: ((value: boolean) => string) | undefined;
7
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
8
+ keywords: {
9
+ yes: string;
10
+ no: string;
11
+ };
12
+ style: {
13
+ confirmDefault: (text: string) => string;
14
+ };
15
+ }>> | undefined;
16
+ } & {
2
17
  message: string;
3
18
  default?: boolean | undefined;
4
19
  transformer?: (value: boolean) => string;
5
- theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme>;
20
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
21
+ keywords: {
22
+ yes: string;
23
+ no: string;
24
+ };
25
+ style: {
26
+ confirmDefault: (text: string) => string;
27
+ };
28
+ }>>;
6
29
  }, context?: import("@inquirer/type").Context | undefined) => Promise<boolean>, select: <Value>(this: void, config: {
7
30
  message: string;
8
31
  choices: readonly (import("@inquirer/prompts").Separator | Value | {
@@ -30,6 +53,33 @@ export declare const confirm: (this: void, config: {
30
53
  };
31
54
  indexMode: "hidden" | "number";
32
55
  }>> | undefined;
56
+ } & {
57
+ message: string;
58
+ choices: readonly (import("@inquirer/prompts").Separator | Value | {
59
+ value: Value;
60
+ name?: string;
61
+ description?: string;
62
+ short?: string;
63
+ disabled?: boolean | string;
64
+ type?: never;
65
+ })[];
66
+ pageSize?: number;
67
+ loop?: boolean;
68
+ default?: NoInfer<Value> | undefined;
69
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
70
+ icon: {
71
+ cursor: string;
72
+ };
73
+ style: {
74
+ disabled: (text: string) => string;
75
+ description: (text: string) => string;
76
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
77
+ };
78
+ i18n: {
79
+ disabledError: string;
80
+ };
81
+ indexMode: "hidden" | "number";
82
+ }>>;
33
83
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, checkbox: <Value>(this: void, config: {
34
84
  message: string;
35
85
  prefix?: string | undefined;
@@ -93,6 +143,69 @@ export declare const confirm: (this: void, config: {
93
143
  all?: string | null;
94
144
  invert?: string | null;
95
145
  } | undefined;
146
+ } & {
147
+ message: string;
148
+ prefix?: string;
149
+ pageSize?: number;
150
+ choices: readonly (import("@inquirer/prompts").Separator | Value | {
151
+ value: Value;
152
+ name?: string;
153
+ checkedName?: string;
154
+ description?: string;
155
+ short?: string;
156
+ disabled?: boolean | string;
157
+ checked?: boolean;
158
+ type?: never;
159
+ })[];
160
+ loop?: boolean;
161
+ required?: boolean;
162
+ validate?: ((choices: readonly {
163
+ value: Value;
164
+ name: string;
165
+ checkedName: string;
166
+ description?: string;
167
+ short: string;
168
+ disabled: boolean | string;
169
+ checked: boolean;
170
+ }[]) => boolean | string | Promise<string | boolean>) | undefined;
171
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
172
+ icon: {
173
+ checked: string;
174
+ unchecked: string;
175
+ cursor: string;
176
+ disabledChecked: string;
177
+ disabledUnchecked: string;
178
+ };
179
+ style: {
180
+ disabled: (text: string) => string;
181
+ renderSelectedChoices: <T>(selectedChoices: ReadonlyArray<{
182
+ value: T;
183
+ name: string;
184
+ checkedName: string;
185
+ description?: string;
186
+ short: string;
187
+ disabled: boolean | string;
188
+ checked: boolean;
189
+ }>, allChoices: ReadonlyArray<{
190
+ value: T;
191
+ name: string;
192
+ checkedName: string;
193
+ description?: string;
194
+ short: string;
195
+ disabled: boolean | string;
196
+ checked: boolean;
197
+ } | import("@inquirer/prompts").Separator>) => string;
198
+ description: (text: string) => string;
199
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
200
+ };
201
+ i18n: {
202
+ disabledError: string;
203
+ };
204
+ }>>;
205
+ shortcuts?: {
206
+ all?: string | null;
207
+ invert?: string | null;
208
+ };
96
209
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value[]>, search: <Value>(this: void, config: {
97
210
  message: string;
98
211
  source: (term: string | undefined, opt: {
@@ -127,23 +240,74 @@ export declare const confirm: (this: void, config: {
127
240
  keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
128
241
  };
129
242
  }>> | undefined;
243
+ } & {
244
+ message: string;
245
+ source: (term: string | undefined, opt: {
246
+ signal: AbortSignal;
247
+ }) => readonly (import("@inquirer/prompts").Separator | Value | {
248
+ value: Value;
249
+ name?: string;
250
+ description?: string;
251
+ short?: string;
252
+ disabled?: boolean | string;
253
+ type?: never;
254
+ })[] | Promise<readonly (import("@inquirer/prompts").Separator | Value | {
255
+ value: Value;
256
+ name?: string;
257
+ description?: string;
258
+ short?: string;
259
+ disabled?: boolean | string;
260
+ type?: never;
261
+ })[]>;
262
+ validate?: ((value: Value) => boolean | string | Promise<string | boolean>) | undefined;
263
+ pageSize?: number;
264
+ default?: NoInfer<Value> | undefined;
265
+ initialValue?: string;
266
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
267
+ icon: {
268
+ cursor: string;
269
+ };
270
+ style: {
271
+ disabled: (text: string) => string;
272
+ searchTerm: (text: string) => string;
273
+ description: (text: string) => string;
274
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
275
+ };
276
+ }>>;
130
277
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, expand: <Value>(this: void, config: {
131
278
  message: string;
132
279
  choices: readonly (import("@inquirer/prompts").Separator | {
133
- key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "f" | "s" | "a" | "b" | "c" | "d" | "e" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
280
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
134
281
  name: Value & string;
135
282
  value?: never;
136
283
  } | ({
137
- key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "f" | "s" | "a" | "b" | "c" | "d" | "e" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
284
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
138
285
  value: Value;
139
286
  } | {
140
- key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "f" | "s" | "a" | "b" | "c" | "d" | "e" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
287
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
141
288
  name: string;
142
289
  value: Value;
143
290
  }))[];
144
- default?: (("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "f" | "s" | "a" | "b" | "c" | "d" | "e" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z") | "h") | undefined;
291
+ default?: (("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z") | "h") | undefined;
145
292
  expanded?: boolean | undefined;
146
293
  theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme> | undefined;
294
+ } & {
295
+ message: string;
296
+ choices: readonly (import("@inquirer/prompts").Separator | ({
297
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
298
+ value: Value;
299
+ } | {
300
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
301
+ name: string;
302
+ value: Value;
303
+ }) | {
304
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
305
+ name: Value & string;
306
+ value?: never;
307
+ })[];
308
+ default?: ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z") | "h";
309
+ expanded?: boolean;
310
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme>;
147
311
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, rawlist: <Value>(this: void, config: {
148
312
  message: string;
149
313
  choices: readonly (import("@inquirer/prompts").Separator | Value | {
@@ -160,7 +324,37 @@ export declare const confirm: (this: void, config: {
160
324
  };
161
325
  }>> | undefined;
162
326
  default?: NoInfer<Value> | undefined;
327
+ } & {
328
+ message: string;
329
+ choices: readonly (import("@inquirer/prompts").Separator | Value | {
330
+ value: Value;
331
+ name?: string;
332
+ short?: string;
333
+ key?: string;
334
+ description?: string;
335
+ })[];
336
+ loop?: boolean;
337
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
338
+ style: {
339
+ description: (text: string) => string;
340
+ };
341
+ }>>;
342
+ default?: NoInfer<Value> | undefined;
163
343
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, editor: (this: void, config: {
344
+ message: string;
345
+ default?: string | undefined | undefined;
346
+ postfix?: string | undefined;
347
+ waitForUserInput?: boolean | undefined;
348
+ validate?: ((value: string) => boolean | string | Promise<string | boolean>) | undefined;
349
+ file?: import("@inquirer/external-editor").FileOptions | undefined;
350
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
351
+ validationFailureMode: "keep" | "clear";
352
+ style: {
353
+ loadingMessage: () => string;
354
+ waitingMessage: (enterKey: string) => string;
355
+ };
356
+ }>> | undefined;
357
+ } & {
164
358
  message: string;
165
359
  default?: string | undefined;
166
360
  postfix?: string;
@@ -175,6 +369,20 @@ export declare const confirm: (this: void, config: {
175
369
  };
176
370
  }>>;
177
371
  }, context?: import("@inquirer/type").Context | undefined) => Promise<string>, input: (this: void, config: {
372
+ message: string;
373
+ default?: string | undefined | undefined;
374
+ prefill?: "tab" | "editable" | undefined;
375
+ required?: boolean | undefined;
376
+ transformer?: ((value: string, { isFinal }: {
377
+ isFinal: boolean;
378
+ }) => string) | undefined;
379
+ validate?: ((value: string) => boolean | string | Promise<string | boolean>) | undefined;
380
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
381
+ validationFailureMode: "keep" | "clear";
382
+ }>> | undefined;
383
+ pattern?: RegExp | undefined;
384
+ patternError?: string | undefined;
385
+ } & {
178
386
  message: string;
179
387
  default?: string | undefined;
180
388
  prefill?: "tab" | "editable";
@@ -197,13 +405,35 @@ export declare const confirm: (this: void, config: {
197
405
  required?: Required | undefined;
198
406
  validate?: ((value: Required extends true ? number : number | undefined) => boolean | string | Promise<string | boolean>) | undefined;
199
407
  theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme> | undefined;
408
+ } & {
409
+ message: string;
410
+ default?: number | undefined;
411
+ min?: number;
412
+ max?: number;
413
+ step?: number | "any";
414
+ required?: Required | undefined;
415
+ validate?: ((value: Required extends true ? number : number | undefined) => boolean | string | Promise<string | boolean>) | undefined;
416
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme>;
200
417
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Required extends true ? number : number | undefined>, password: (this: void, config: {
418
+ message: string;
419
+ mask?: boolean | string | undefined;
420
+ toggleMask?: boolean | undefined;
421
+ validate?: ((value: string) => boolean | string | Promise<string | boolean>) | undefined;
422
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
423
+ style: {
424
+ maskedText: string;
425
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
426
+ };
427
+ }>> | undefined;
428
+ } & {
201
429
  message: string;
202
430
  mask?: boolean | string;
431
+ toggleMask?: boolean;
203
432
  validate?: (value: string) => boolean | string | Promise<string | boolean>;
204
433
  theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
205
434
  style: {
206
435
  maskedText: string;
436
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
207
437
  };
208
438
  }>>;
209
439
  }, context?: import("@inquirer/type").Context | undefined) => Promise<string>;
@@ -1,10 +1,8 @@
1
1
  import { createLocalizedPrompts } from "../create.js";
2
- const zhLocale = {
2
+ export const locale = {
3
3
  confirm: {
4
4
  yesLabel: '是',
5
5
  noLabel: '否',
6
- hintYes: '是/否',
7
- hintNo: '是/否',
8
6
  },
9
7
  select: {
10
8
  helpNavigate: '导航',
@@ -27,7 +25,8 @@ const zhLocale = {
27
25
  },
28
26
  password: {
29
27
  maskedText: '[输入已隐藏]',
28
+ helpToggle: '切换可见性',
30
29
  },
31
30
  };
32
- export const { confirm, select, checkbox, search, expand, rawlist, editor, input, number, password, } = createLocalizedPrompts(zhLocale);
31
+ export const { confirm, select, checkbox, search, expand, rawlist, editor, input, number, password, } = createLocalizedPrompts(locale);
33
32
  export { Separator } from '@inquirer/prompts';
package/dist/types.d.ts CHANGED
@@ -2,14 +2,10 @@
2
2
  * Localized strings for the confirm prompt
3
3
  */
4
4
  export interface ConfirmStrings {
5
- /** Default label for "Yes" option */
5
+ /** Label for "Yes" — also the keyword accepted as "yes" (prefix-matched) */
6
6
  yesLabel: string;
7
- /** Default label for "No" option */
7
+ /** Label for "No" — also the keyword accepted as "no" (prefix-matched) */
8
8
  noLabel: string;
9
- /** Hint text when default is true (e.g., "Y/n") */
10
- hintYes: string;
11
- /** Hint text when default is false (e.g., "y/N") */
12
- hintNo: string;
13
9
  }
14
10
  /**
15
11
  * Localized strings for the select prompt
@@ -59,6 +55,8 @@ export interface EditorStrings {
59
55
  export interface PasswordStrings {
60
56
  /** Text shown instead of typed input to indicate it is hidden */
61
57
  maskedText: string;
58
+ /** Help text for the key that toggles mask visibility */
59
+ helpToggle: string;
62
60
  }
63
61
  /**
64
62
  * Complete locale definition containing all prompt strings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/i18n",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Internationalized Inquirer prompts - drop-in package with i18n support",
5
5
  "keywords": [
6
6
  "answer",
@@ -97,8 +97,8 @@
97
97
  "tsc": "tsc"
98
98
  },
99
99
  "dependencies": {
100
- "@inquirer/core": "^12.0.0",
101
- "@inquirer/prompts": "^8.6.0"
100
+ "@inquirer/core": "^12.0.1",
101
+ "@inquirer/prompts": "^8.7.0"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@repo/tsconfig": "0.0.0",
@@ -117,5 +117,5 @@
117
117
  },
118
118
  "main": "./dist/index.js",
119
119
  "types": "./dist/index.d.ts",
120
- "gitHead": "999706755afbdcae271f62decbd9bcd05560905b"
120
+ "gitHead": "51ac389603405e8f9f315ce49416153d95c5fefe"
121
121
  }