@i18n-micro/vue 1.3.12 → 1.4.4

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/index.d.cts CHANGED
@@ -21,7 +21,6 @@ import { PublicProps } from 'vue';
21
21
  import { Ref } from 'vue';
22
22
  import { RendererElement } from 'vue';
23
23
  import { RendererNode } from 'vue';
24
- import { Router } from 'vue-router';
25
24
  import { TranslationKey } from '@i18n-micro/types';
26
25
  import { Translations } from '@i18n-micro/types';
27
26
  import { TranslationStorage } from '@i18n-micro/core';
@@ -46,13 +45,6 @@ declare interface CreateI18nOptions extends VueI18nOptions {
46
45
  defaultLocale?: string;
47
46
  }
48
47
 
49
- /**
50
- * Factory for Vue Router adapter
51
- * Implements routing utilities for Vue Router
52
- * Uses vue-router APIs for navigation and path resolution
53
- */
54
- export declare function createVueRouterAdapter(router: Router, locales: Locale[], defaultLocale: string): I18nRoutingStrategy;
55
-
56
48
  export { defaultPlural }
57
49
 
58
50
  export { FormatService }
@@ -70,53 +62,53 @@ declare interface I18nGroupProps {
70
62
 
71
63
  export declare const I18nInjectionKey: InjectionKey<VueI18n>;
72
64
 
73
- export declare const I18nLink: DefineComponent<ExtractPropTypes< {
74
- to: {
75
- type: PropType<string | {
76
- path?: string;
77
- }>;
78
- required: true;
79
- };
80
- activeStyle: {
81
- type: PropType<CSSProperties>;
82
- default: () => {};
83
- };
84
- localeRoute: {
85
- type: PropType<(to: string | {
86
- path?: string;
87
- }, locale?: string) => string | {
88
- path?: string;
89
- }>;
90
- default: undefined;
91
- };
65
+ export declare const I18nLink: DefineComponent<ExtractPropTypes<{
66
+ to: {
67
+ type: PropType<string | {
68
+ path?: string;
69
+ }>;
70
+ required: true;
71
+ };
72
+ activeStyle: {
73
+ type: PropType<CSSProperties>;
74
+ default: () => {};
75
+ };
76
+ localeRoute: {
77
+ type: PropType<(to: string | {
78
+ path?: string;
79
+ }, locale?: string) => string | {
80
+ path?: string;
81
+ }>;
82
+ default: undefined;
83
+ };
92
84
  }>, () => VNode<RendererNode, RendererElement, {
93
- [key: string]: any;
94
- }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
95
- to: {
96
- type: PropType<string | {
97
- path?: string;
98
- }>;
99
- required: true;
100
- };
101
- activeStyle: {
102
- type: PropType<CSSProperties>;
103
- default: () => {};
104
- };
105
- localeRoute: {
106
- type: PropType<(to: string | {
107
- path?: string;
108
- }, locale?: string) => string | {
109
- path?: string;
110
- }>;
111
- default: undefined;
112
- };
85
+ [key: string]: any;
86
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
87
+ to: {
88
+ type: PropType<string | {
89
+ path?: string;
90
+ }>;
91
+ required: true;
92
+ };
93
+ activeStyle: {
94
+ type: PropType<CSSProperties>;
95
+ default: () => {};
96
+ };
97
+ localeRoute: {
98
+ type: PropType<(to: string | {
99
+ path?: string;
100
+ }, locale?: string) => string | {
101
+ path?: string;
102
+ }>;
103
+ default: undefined;
104
+ };
113
105
  }>> & Readonly<{}>, {
114
- activeStyle: CSSProperties;
115
- localeRoute: (to: string | {
116
- path?: string;
117
- }, locale?: string) => string | {
118
- path?: string;
119
- };
106
+ activeStyle: CSSProperties;
107
+ localeRoute: (to: string | {
108
+ path?: string;
109
+ }, locale?: string) => string | {
110
+ path?: string;
111
+ };
120
112
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
121
113
 
122
114
  export declare const I18nLocalesKey: InjectionKey<Locale[]>;
@@ -169,256 +161,256 @@ export declare interface I18nRoutingStrategy {
169
161
  };
170
162
  }
171
163
 
172
- export declare const I18nSwitcher: DefineComponent<ExtractPropTypes< {
173
- customLabels: {
174
- type: PropType<Record<string, string>>;
175
- default: () => {};
176
- };
177
- customWrapperStyle: {
178
- type: PropType<CSSProperties>;
179
- default: () => {};
180
- };
181
- customButtonStyle: {
182
- type: PropType<CSSProperties>;
183
- default: () => {};
184
- };
185
- customDropdownStyle: {
186
- type: PropType<CSSProperties>;
187
- default: () => {};
188
- };
189
- customItemStyle: {
190
- type: PropType<CSSProperties>;
191
- default: () => {};
192
- };
193
- customLinkStyle: {
194
- type: PropType<CSSProperties>;
195
- default: () => {};
196
- };
197
- customActiveLinkStyle: {
198
- type: PropType<CSSProperties>;
199
- default: () => {};
200
- };
201
- /**
202
- * Inline style applied to the switcher button when the *current* locale is
203
- * marked as `disabled: true` in the locale config.
204
- *
205
- * Note: disabled locales are omitted from the dropdown list, but the current
206
- * locale label is still shown on the button.
207
- */
208
- customDisabledLinkStyle: {
209
- type: PropType<CSSProperties>;
210
- default: () => {};
211
- };
212
- customIconStyle: {
213
- type: PropType<CSSProperties>;
214
- default: () => {};
215
- };
216
- locales: {
217
- type: PropType<Locale[]>;
218
- default: undefined;
219
- };
220
- currentLocale: {
221
- type: PropType<string | (() => string)>;
222
- default: undefined;
223
- };
224
- getLocaleName: {
225
- type: PropType<() => string | null>;
226
- default: undefined;
227
- };
228
- switchLocale: {
229
- type: PropType<(locale: string) => void>;
230
- default: undefined;
231
- };
232
- localeRoute: {
233
- type: PropType<(to: string | {
234
- path?: string;
235
- }, locale?: string) => string | {
236
- path?: string;
237
- }>;
238
- default: undefined;
239
- };
240
- }>, () => VNode<RendererNode, RendererElement, {
241
- [key: string]: any;
242
- }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
243
- customLabels: {
244
- type: PropType<Record<string, string>>;
245
- default: () => {};
246
- };
247
- customWrapperStyle: {
248
- type: PropType<CSSProperties>;
249
- default: () => {};
250
- };
251
- customButtonStyle: {
252
- type: PropType<CSSProperties>;
253
- default: () => {};
254
- };
255
- customDropdownStyle: {
256
- type: PropType<CSSProperties>;
257
- default: () => {};
258
- };
259
- customItemStyle: {
260
- type: PropType<CSSProperties>;
261
- default: () => {};
262
- };
263
- customLinkStyle: {
264
- type: PropType<CSSProperties>;
265
- default: () => {};
266
- };
267
- customActiveLinkStyle: {
268
- type: PropType<CSSProperties>;
269
- default: () => {};
270
- };
271
- /**
272
- * Inline style applied to the switcher button when the *current* locale is
273
- * marked as `disabled: true` in the locale config.
274
- *
275
- * Note: disabled locales are omitted from the dropdown list, but the current
276
- * locale label is still shown on the button.
277
- */
278
- customDisabledLinkStyle: {
279
- type: PropType<CSSProperties>;
280
- default: () => {};
281
- };
282
- customIconStyle: {
283
- type: PropType<CSSProperties>;
284
- default: () => {};
285
- };
286
- locales: {
287
- type: PropType<Locale[]>;
288
- default: undefined;
289
- };
290
- currentLocale: {
291
- type: PropType<string | (() => string)>;
292
- default: undefined;
293
- };
294
- getLocaleName: {
295
- type: PropType<() => string | null>;
296
- default: undefined;
297
- };
298
- switchLocale: {
299
- type: PropType<(locale: string) => void>;
300
- default: undefined;
301
- };
302
- localeRoute: {
303
- type: PropType<(to: string | {
304
- path?: string;
305
- }, locale?: string) => string | {
306
- path?: string;
307
- }>;
308
- default: undefined;
309
- };
164
+ export declare const I18nSwitcher: DefineComponent<ExtractPropTypes<{
165
+ customLabels: {
166
+ type: PropType<Record<string, string>>;
167
+ default: () => {};
168
+ };
169
+ customWrapperStyle: {
170
+ type: PropType<CSSProperties>;
171
+ default: () => {};
172
+ };
173
+ customButtonStyle: {
174
+ type: PropType<CSSProperties>;
175
+ default: () => {};
176
+ };
177
+ customDropdownStyle: {
178
+ type: PropType<CSSProperties>;
179
+ default: () => {};
180
+ };
181
+ customItemStyle: {
182
+ type: PropType<CSSProperties>;
183
+ default: () => {};
184
+ };
185
+ customLinkStyle: {
186
+ type: PropType<CSSProperties>;
187
+ default: () => {};
188
+ };
189
+ customActiveLinkStyle: {
190
+ type: PropType<CSSProperties>;
191
+ default: () => {};
192
+ };
193
+ /**
194
+ * Inline style applied to the switcher button when the *current* locale is
195
+ * marked as `disabled: true` in the locale config.
196
+ *
197
+ * Note: disabled locales are omitted from the dropdown list, but the current
198
+ * locale label is still shown on the button.
199
+ */
200
+ customDisabledLinkStyle: {
201
+ type: PropType<CSSProperties>;
202
+ default: () => {};
203
+ };
204
+ customIconStyle: {
205
+ type: PropType<CSSProperties>;
206
+ default: () => {};
207
+ };
208
+ locales: {
209
+ type: PropType<Locale[]>;
210
+ default: undefined;
211
+ };
212
+ currentLocale: {
213
+ type: PropType<string | (() => string)>;
214
+ default: undefined;
215
+ };
216
+ getLocaleName: {
217
+ type: PropType<() => string | null>;
218
+ default: undefined;
219
+ };
220
+ switchLocale: {
221
+ type: PropType<(locale: string) => void>;
222
+ default: undefined;
223
+ };
224
+ localeRoute: {
225
+ type: PropType<(to: string | {
226
+ path?: string;
227
+ }, locale?: string) => string | {
228
+ path?: string;
229
+ }>;
230
+ default: undefined;
231
+ };
232
+ }>, () => VNode< RendererNode, RendererElement, {
233
+ [key: string]: any;
234
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
235
+ customLabels: {
236
+ type: PropType<Record<string, string>>;
237
+ default: () => {};
238
+ };
239
+ customWrapperStyle: {
240
+ type: PropType<CSSProperties>;
241
+ default: () => {};
242
+ };
243
+ customButtonStyle: {
244
+ type: PropType<CSSProperties>;
245
+ default: () => {};
246
+ };
247
+ customDropdownStyle: {
248
+ type: PropType<CSSProperties>;
249
+ default: () => {};
250
+ };
251
+ customItemStyle: {
252
+ type: PropType<CSSProperties>;
253
+ default: () => {};
254
+ };
255
+ customLinkStyle: {
256
+ type: PropType<CSSProperties>;
257
+ default: () => {};
258
+ };
259
+ customActiveLinkStyle: {
260
+ type: PropType<CSSProperties>;
261
+ default: () => {};
262
+ };
263
+ /**
264
+ * Inline style applied to the switcher button when the *current* locale is
265
+ * marked as `disabled: true` in the locale config.
266
+ *
267
+ * Note: disabled locales are omitted from the dropdown list, but the current
268
+ * locale label is still shown on the button.
269
+ */
270
+ customDisabledLinkStyle: {
271
+ type: PropType<CSSProperties>;
272
+ default: () => {};
273
+ };
274
+ customIconStyle: {
275
+ type: PropType<CSSProperties>;
276
+ default: () => {};
277
+ };
278
+ locales: {
279
+ type: PropType<Locale[]>;
280
+ default: undefined;
281
+ };
282
+ currentLocale: {
283
+ type: PropType<string | (() => string)>;
284
+ default: undefined;
285
+ };
286
+ getLocaleName: {
287
+ type: PropType<() => string | null>;
288
+ default: undefined;
289
+ };
290
+ switchLocale: {
291
+ type: PropType<(locale: string) => void>;
292
+ default: undefined;
293
+ };
294
+ localeRoute: {
295
+ type: PropType<(to: string | {
296
+ path?: string;
297
+ }, locale?: string) => string | {
298
+ path?: string;
299
+ }>;
300
+ default: undefined;
301
+ };
310
302
  }>> & Readonly<{}>, {
311
- localeRoute: (to: string | {
312
- path?: string;
313
- }, locale?: string) => string | {
314
- path?: string;
315
- };
316
- customLabels: Record<string, string>;
317
- customWrapperStyle: CSSProperties;
318
- customButtonStyle: CSSProperties;
319
- customDropdownStyle: CSSProperties;
320
- customItemStyle: CSSProperties;
321
- customLinkStyle: CSSProperties;
322
- customActiveLinkStyle: CSSProperties;
323
- customDisabledLinkStyle: CSSProperties;
324
- customIconStyle: CSSProperties;
325
- locales: Locale[];
326
- currentLocale: string | (() => string);
327
- getLocaleName: () => string | null;
328
- switchLocale: (locale: string) => void;
303
+ localeRoute: (to: string | {
304
+ path?: string;
305
+ }, locale?: string) => string | {
306
+ path?: string;
307
+ };
308
+ customLabels: Record<string, string>;
309
+ customWrapperStyle: CSSProperties;
310
+ customButtonStyle: CSSProperties;
311
+ customDropdownStyle: CSSProperties;
312
+ customItemStyle: CSSProperties;
313
+ customLinkStyle: CSSProperties;
314
+ customActiveLinkStyle: CSSProperties;
315
+ customDisabledLinkStyle: CSSProperties;
316
+ customIconStyle: CSSProperties;
317
+ locales: Locale[];
318
+ currentLocale: string | (() => string);
319
+ getLocaleName: () => string | null;
320
+ switchLocale: (locale: string) => void;
329
321
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
330
322
 
331
- export declare const I18nT: DefineComponent<ExtractPropTypes< {
332
- keypath: {
333
- type: PropType<TranslationKey>;
334
- required: true;
335
- };
336
- plural: {
337
- type: PropType<number | string>;
338
- };
339
- tag: {
340
- type: PropType<string>;
341
- default: string;
342
- };
343
- params: {
344
- type: PropType<Record<string, string | number | boolean>>;
345
- default: () => {};
346
- };
347
- defaultValue: {
348
- type: PropType<string>;
349
- default: string;
350
- };
351
- html: {
352
- type: PropType<boolean>;
353
- default: boolean;
354
- };
355
- hideIfEmpty: {
356
- type: PropType<boolean>;
357
- default: boolean;
358
- };
359
- customPluralRule: {
360
- type: PropType<PluralFunc>;
361
- default: null;
362
- };
363
- number: {
364
- type: PropType<number | string>;
365
- };
366
- date: {
367
- type: PropType<Date | string | number>;
368
- };
369
- relativeDate: {
370
- type: PropType<Date | string | number>;
371
- };
372
- }>, () => string | VNode<RendererNode, RendererElement, {
373
- [key: string]: any;
374
- }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
375
- keypath: {
376
- type: PropType<TranslationKey>;
377
- required: true;
378
- };
379
- plural: {
380
- type: PropType<number | string>;
381
- };
382
- tag: {
383
- type: PropType<string>;
384
- default: string;
385
- };
386
- params: {
387
- type: PropType<Record<string, string | number | boolean>>;
388
- default: () => {};
389
- };
390
- defaultValue: {
391
- type: PropType<string>;
392
- default: string;
393
- };
394
- html: {
395
- type: PropType<boolean>;
396
- default: boolean;
397
- };
398
- hideIfEmpty: {
399
- type: PropType<boolean>;
400
- default: boolean;
401
- };
402
- customPluralRule: {
403
- type: PropType<PluralFunc>;
404
- default: null;
405
- };
406
- number: {
407
- type: PropType<number | string>;
408
- };
409
- date: {
410
- type: PropType<Date | string | number>;
411
- };
412
- relativeDate: {
413
- type: PropType<Date | string | number>;
414
- };
323
+ export declare const I18nT: DefineComponent<ExtractPropTypes<{
324
+ keypath: {
325
+ type: PropType<TranslationKey>;
326
+ required: true;
327
+ };
328
+ plural: {
329
+ type: PropType<number | string>;
330
+ };
331
+ tag: {
332
+ type: PropType<string>;
333
+ default: string;
334
+ };
335
+ params: {
336
+ type: PropType<Record<string, string | number | boolean>>;
337
+ default: () => {};
338
+ };
339
+ defaultValue: {
340
+ type: PropType<string>;
341
+ default: string;
342
+ };
343
+ html: {
344
+ type: PropType<boolean>;
345
+ default: boolean;
346
+ };
347
+ hideIfEmpty: {
348
+ type: PropType<boolean>;
349
+ default: boolean;
350
+ };
351
+ customPluralRule: {
352
+ type: PropType<PluralFunc>;
353
+ default: null;
354
+ };
355
+ number: {
356
+ type: PropType<number | string>;
357
+ };
358
+ date: {
359
+ type: PropType<Date | string | number>;
360
+ };
361
+ relativeDate: {
362
+ type: PropType<Date | string | number>;
363
+ };
364
+ }>, () => string | VNode< RendererNode, RendererElement, {
365
+ [key: string]: any;
366
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
367
+ keypath: {
368
+ type: PropType<TranslationKey>;
369
+ required: true;
370
+ };
371
+ plural: {
372
+ type: PropType<number | string>;
373
+ };
374
+ tag: {
375
+ type: PropType<string>;
376
+ default: string;
377
+ };
378
+ params: {
379
+ type: PropType<Record<string, string | number | boolean>>;
380
+ default: () => {};
381
+ };
382
+ defaultValue: {
383
+ type: PropType<string>;
384
+ default: string;
385
+ };
386
+ html: {
387
+ type: PropType<boolean>;
388
+ default: boolean;
389
+ };
390
+ hideIfEmpty: {
391
+ type: PropType<boolean>;
392
+ default: boolean;
393
+ };
394
+ customPluralRule: {
395
+ type: PropType<PluralFunc>;
396
+ default: null;
397
+ };
398
+ number: {
399
+ type: PropType<number | string>;
400
+ };
401
+ date: {
402
+ type: PropType<Date | string | number>;
403
+ };
404
+ relativeDate: {
405
+ type: PropType<Date | string | number>;
406
+ };
415
407
  }>> & Readonly<{}>, {
416
- html: boolean;
417
- tag: string;
418
- params: Record<string, string | number | boolean>;
419
- defaultValue: string;
420
- hideIfEmpty: boolean;
421
- customPluralRule: PluralFunc;
408
+ html: boolean;
409
+ tag: string;
410
+ params: Record<string, string | number | boolean>;
411
+ defaultValue: string;
412
+ hideIfEmpty: boolean;
413
+ customPluralRule: PluralFunc;
422
414
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
423
415
 
424
416
  export { interpolate }
@@ -506,38 +498,38 @@ export declare interface UseI18nOptions {
506
498
  }
507
499
 
508
500
  export declare function useLocaleHead(options?: UseLocaleHeadOptions): {
509
- metaObject: Ref< {
510
- htmlAttrs: {
511
- lang?: string | undefined;
512
- dir?: "ltr" | "rtl" | "auto" | undefined;
513
- };
514
- link: {
515
- [x: string]: string | undefined;
516
- rel: string;
517
- href: string;
518
- hreflang?: string | undefined;
519
- }[];
520
- meta: {
521
- [x: string]: string;
522
- property: string;
523
- content: string;
524
- }[];
501
+ metaObject: Ref<{
502
+ htmlAttrs: {
503
+ lang?: string | undefined;
504
+ dir?: "ltr" | "rtl" | "auto" | undefined;
505
+ };
506
+ link: {
507
+ [x: string]: string | undefined;
508
+ rel: string;
509
+ href: string;
510
+ hreflang?: string | undefined;
511
+ }[];
512
+ meta: {
513
+ [x: string]: string;
514
+ property: string;
515
+ content: string;
516
+ }[];
525
517
  }, MetaObject | {
526
- htmlAttrs: {
527
- lang?: string | undefined;
528
- dir?: "ltr" | "rtl" | "auto" | undefined;
529
- };
530
- link: {
531
- [x: string]: string | undefined;
532
- rel: string;
533
- href: string;
534
- hreflang?: string | undefined;
535
- }[];
536
- meta: {
537
- [x: string]: string;
538
- property: string;
539
- content: string;
540
- }[];
518
+ htmlAttrs: {
519
+ lang?: string | undefined;
520
+ dir?: "ltr" | "rtl" | "auto" | undefined;
521
+ };
522
+ link: {
523
+ [x: string]: string | undefined;
524
+ rel: string;
525
+ href: string;
526
+ hreflang?: string | undefined;
527
+ }[];
528
+ meta: {
529
+ [x: string]: string;
530
+ property: string;
531
+ content: string;
532
+ }[];
541
533
  }>;
542
534
  updateMeta: (canonicalQueryWhitelist?: string[]) => void;
543
535
  };
@@ -592,3 +584,27 @@ export declare interface VueI18nOptions {
592
584
  }
593
585
 
594
586
  export { }
587
+
588
+
589
+
590
+ // Extend '@vue/runtime-core' module so types work correctly in all environments
591
+ declare module '@vue/runtime-core' {
592
+ interface ComponentCustomProperties {
593
+ $t: (key: TranslationKey, params?: Params, defaultValue?: string | null, routeName?: string) => CleanTranslation
594
+ $ts: (key: TranslationKey, params?: Params, defaultValue?: string, routeName?: string) => string
595
+ $tc: (key: TranslationKey, count: number | Params, defaultValue?: string) => string
596
+ $tn: {
597
+ (value: number, options?: Intl.NumberFormatOptions): string
598
+ (value: number, key: string, overrides?: Intl.NumberFormatOptions): string
599
+ (value: number, key: string, locale: string, overrides?: Intl.NumberFormatOptions): string
600
+ }
601
+ $td: {
602
+ (value: Date | number | string, options?: Intl.DateTimeFormatOptions): string
603
+ (value: Date | number | string, key: string, overrides?: Intl.DateTimeFormatOptions): string
604
+ (value: Date | number | string, key: string, locale: string, overrides?: Intl.DateTimeFormatOptions): string
605
+ }
606
+ $tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string
607
+ $has: (key: TranslationKey, routeName?: string) => boolean
608
+ $i18n: any
609
+ }
610
+ }