@inquirer/i18n 1.1.2 → 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,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: {
2
4
  message: string;
3
- default?: boolean;
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
+ } & {
17
+ message: string;
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: {
@@ -115,6 +228,7 @@ export declare const confirm: (this: void, config: {
115
228
  validate?: ((value: Value) => boolean | string | Promise<string | boolean>) | undefined;
116
229
  pageSize?: number | undefined;
117
230
  default?: NoInfer<Value> | undefined;
231
+ initialValue?: string | undefined;
118
232
  theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
119
233
  icon: {
120
234
  cursor: string;
@@ -126,23 +240,74 @@ export declare const confirm: (this: void, config: {
126
240
  keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
127
241
  };
128
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
+ }>>;
129
277
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, expand: <Value>(this: void, config: {
130
278
  message: string;
131
279
  choices: readonly (import("@inquirer/prompts").Separator | {
132
- key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "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";
133
281
  name: Value & string;
134
282
  value?: never;
135
283
  } | ({
136
- key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "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";
137
285
  value: Value;
138
286
  } | {
139
- key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "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";
140
288
  name: string;
141
289
  value: Value;
142
290
  }))[];
143
- default?: (("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "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;
144
292
  expanded?: boolean | undefined;
145
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>;
146
311
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, rawlist: <Value>(this: void, config: {
147
312
  message: string;
148
313
  choices: readonly (import("@inquirer/prompts").Separator | Value | {
@@ -159,9 +324,39 @@ export declare const confirm: (this: void, config: {
159
324
  };
160
325
  }>> | undefined;
161
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;
162
343
  }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, editor: (this: void, config: {
163
344
  message: string;
164
- default?: 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
+ } & {
358
+ message: string;
359
+ default?: string | undefined;
165
360
  postfix?: string;
166
361
  waitForUserInput?: boolean;
167
362
  validate?: (value: string) => boolean | string | Promise<string | boolean>;
@@ -174,6 +369,20 @@ export declare const confirm: (this: void, config: {
174
369
  };
175
370
  }>>;
176
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
+ } & {
177
386
  message: string;
178
387
  default?: string | undefined;
179
388
  prefill?: "tab" | "editable";
@@ -189,20 +398,42 @@ export declare const confirm: (this: void, config: {
189
398
  patternError?: string;
190
399
  }, context?: import("@inquirer/type").Context | undefined) => Promise<string>, number: <Required extends boolean = boolean>(this: void, config: {
191
400
  message: string;
192
- default?: number | undefined;
401
+ default?: number | undefined | undefined;
193
402
  min?: number | undefined;
194
403
  max?: number | undefined;
195
404
  step?: number | "any" | undefined;
196
405
  required?: Required | undefined;
197
406
  validate?: ((value: Required extends true ? number : number | undefined) => boolean | string | Promise<string | boolean>) | undefined;
198
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>;
199
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
+ } & {
200
429
  message: string;
201
430
  mask?: boolean | string;
431
+ toggleMask?: boolean;
202
432
  validate?: (value: string) => boolean | string | Promise<string | boolean>;
203
433
  theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
204
434
  style: {
205
435
  maskedText: string;
436
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
206
437
  };
207
438
  }>>;
208
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.1.2",
3
+ "version": "1.3.0",
4
4
  "description": "Internationalized Inquirer prompts - drop-in package with i18n support",
5
5
  "keywords": [
6
6
  "answer",
@@ -97,10 +97,11 @@
97
97
  "tsc": "tsc"
98
98
  },
99
99
  "dependencies": {
100
- "@inquirer/core": "^11.2.1",
101
- "@inquirer/prompts": "^8.5.2"
100
+ "@inquirer/core": "^12.0.1",
101
+ "@inquirer/prompts": "^8.7.0"
102
102
  },
103
103
  "devDependencies": {
104
+ "@repo/tsconfig": "0.0.0",
104
105
  "typescript": "^6.0.2"
105
106
  },
106
107
  "peerDependencies": {
@@ -116,5 +117,5 @@
116
117
  },
117
118
  "main": "./dist/index.js",
118
119
  "types": "./dist/index.d.ts",
119
- "gitHead": "bfd8710229e3d3c9784bef3bbfbd84c7bd09bb9e"
120
+ "gitHead": "51ac389603405e8f9f315ce49416153d95c5fefe"
120
121
  }