@kong-ui-public/i18n 0.3.5-pr.231.f2b92ff.0 → 0.4.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,6 +1,6 @@
1
1
  import type { VNodeChild, App, PropType } from 'vue';
2
2
  import type { IntlShapeEx } from './types';
3
- export declare const i18nTComponent: <MessageSource = any>(i18n?: IntlShapeEx<MessageSource> | null) => import("vue").DefineComponent<{
3
+ export declare const i18nTComponent: <MessageSource extends Record<string, any>>(i18n?: IntlShapeEx<MessageSource> | null) => import("vue").DefineComponent<{
4
4
  i18n: {
5
5
  type: PropType<IntlShapeEx<MessageSource>>;
6
6
  default: null;
@@ -31,7 +31,7 @@ export declare const i18nTComponent: <MessageSource = any>(i18n?: IntlShapeEx<Me
31
31
  i18n: IntlShapeEx<MessageSource>;
32
32
  }>;
33
33
  declare const _default: {
34
- install<MessageSource = any>(app: App, options: {
34
+ install<MessageSource extends Record<string, any>>(app: App, options: {
35
35
  i18n: IntlShapeEx<MessageSource>;
36
36
  }): void;
37
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Translation.d.ts","sourceRoot":"","sources":["../../src/Translation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,cAAc;;;;;;;;;;;;;SAoCZ,UAAU;;;;;;;;;;;;;;;;EAyBvB,CAAA;;sCAIkC,GAAG;;;;AADvC,wBAKC"}
1
+ {"version":3,"file":"Translation.d.ts","sourceRoot":"","sources":["../../src/Translation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,cAAc;;;;;;;;;;;;;SAoCZ,UAAU;;;;;;;;;;;;;;;;EAyBvB,CAAA;;4DAIwD,GAAG;;;;AAD7D,wBAKC"}
@@ -1,4 +1,4 @@
1
1
  import type { IntlShapeEx, SupportedLocales } from './types';
2
- export declare const createI18n: <MessageSource = any>(locale: SupportedLocales, messages: MessageSource, isGlobal?: boolean) => IntlShapeEx<MessageSource>;
3
- export default function useI18n<MessageSource = any>(): IntlShapeEx<MessageSource>;
2
+ export declare const createI18n: <MessageSource extends Record<string, any>>(locale: SupportedLocales, messages: MessageSource, isGlobal?: boolean) => IntlShapeEx<MessageSource>;
3
+ export default function useI18n<MessageSource extends Record<string, any>>(): IntlShapeEx<MessageSource>;
4
4
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAA+B,MAAM,SAAS,CAAA;AASzF,eAAO,MAAM,UAAU,gCAAiC,gBAAgB,sCAAqC,OAAO,+BA0CnH,CAAA;AAGD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,aAAa,GAAG,GAAG,KAAK,WAAW,CAAC,aAAa,CAAC,CAEjF"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAqB,gBAAgB,EAA+B,MAAM,SAAS,CAAA;AAS5G,eAAO,MAAM,UAAU,sDAAuD,gBAAgB,sCAAqC,OAAO,+BA0CzI,CAAA;AAGD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,WAAW,CAAC,aAAa,CAAC,CAEvG"}
@@ -4,11 +4,10 @@ export type MessageFormatPrimitiveValue = string | number | boolean | null | und
4
4
  export type SupportedLocales = 'en-us';
5
5
  type Dot<T extends string, U extends string> = '' extends U ? T : `${T}.${U}`;
6
6
  export type PathToDotNotation<MessageSource, V> = MessageSource extends V ? '' : {
7
- [K in Extract<keyof MessageSource, string>]: Dot<K, PathToDotNotation<MessageSource[K], V>>;
7
+ [K in Extract<keyof MessageSource, string>]: Dot<K, PathToDotNotation<MessageSource[K], V>> | K;
8
8
  }[Extract<keyof MessageSource, string>];
9
- type TFunction<M> = (translationKey: PathToDotNotation<M, string>, values?: Record<string, MessageFormatPrimitiveValue> | undefined, opts?: IntlMessageFormatOptions) => string;
10
- export type IntlShapeEx<MessageSource = any> = Omit<IntlShape, '$t'> & {
11
- t: TFunction<MessageSource>;
9
+ export type IntlShapeEx<MessageSource extends Record<string, any>> = Omit<IntlShape, '$t'> & {
10
+ t: (translationKey: PathToDotNotation<MessageSource, string>, values?: Record<string, MessageFormatPrimitiveValue> | undefined, opts?: IntlMessageFormatOptions) => string;
12
11
  te: (translationKey: PathToDotNotation<MessageSource, string>) => boolean;
13
12
  tm: (translationKey: PathToDotNotation<MessageSource, string>) => Array<string>;
14
13
  source: MessageSource;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAE7E,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AAEtF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAA;AAEtC,KAAK,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IACzC,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA;AAEhC,MAAM,MAAM,iBAAiB,CAAC,aAAa,EAAE,CAAC,IAAI,aA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