intor 2.4.16 → 2.4.17

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,5 +1,5 @@
1
1
  import type { ReactTagRenderers } from "../render";
2
- import { type Replacement, type TranslatorMethods } from "intor-translator";
2
+ import { type LocaleMessages, type Replacement, type TranslatorMethods } from "intor-translator";
3
3
  /**
4
4
  * Create a React-specific rich translation function.
5
5
  *
@@ -12,4 +12,4 @@ import { type Replacement, type TranslatorMethods } from "intor-translator";
12
12
  *
13
13
  * Intended for React client usage only.
14
14
  */
15
- export declare const createTRich: (t: TranslatorMethods["t"]) => (key: string, tagRenderers?: ReactTagRenderers, replacements?: Replacement) => import("react/jsx-runtime").JSX.Element[];
15
+ export declare const createTRich: (t: TranslatorMethods<LocaleMessages>["t"]) => (key: string, tagRenderers?: ReactTagRenderers, replacements?: Replacement) => import("react/jsx-runtime").JSX.Element[];
@@ -1,12 +1,12 @@
1
1
  import type { ReactTagRenderers } from "../render";
2
2
  import type { TranslatorInstance } from "../../../core";
3
3
  import type { JSX } from "react/jsx-runtime";
4
- import { type Locale, type LocaleMessages, type LocalizedKey, type LocalizedReplacement, type LocalizedRich, type Replacement, type Rich, type ScopedKey } from "intor-translator";
4
+ import { type Locale, type LocaleMessages, type LocalizedKey, type LocalizedReplacement, type LocalizedRich, type Replacement, type Rich, type ScopedKey, type ScopedReplacement, type ScopedRich } from "intor-translator";
5
5
  export type TranslatorInstanceReact<M extends LocaleMessages, ReplacementSchema = Replacement, RichSchema = Rich, PK extends string | undefined = undefined> = Omit<TranslatorInstance<M, ReplacementSchema, RichSchema, PK>, "tRich"> & {
6
6
  /** Indicates whether translations are currently loading. */
7
7
  isLoading: boolean;
8
8
  /** Update the active locale. */
9
9
  setLocale: (locale: Locale<M>) => void;
10
10
  /** Translate a key into React nodes using semantic tags */
11
- tRich: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, RI = LocalizedRich<RichSchema, K>, RE = LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), tagRenderers?: ReactTagRenderers<RI> | ReactTagRenderers, replacements?: RE | Replacement) => JSX.Element[];
11
+ tRich: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, RI = PK extends string ? ScopedRich<RichSchema, PK, K> : LocalizedRich<RichSchema, K>, RE = PK extends string ? ScopedReplacement<ReplacementSchema, PK, K> : LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), tagRenderers?: ReactTagRenderers<RI> | ReactTagRenderers, replacements?: RE | Replacement) => JSX.Element[];
12
12
  };
@@ -1,5 +1,5 @@
1
1
  import type { VueTagRenderers } from "../../../client/vue/render";
2
- import { type Replacement, type TranslatorMethods } from "intor-translator";
2
+ import { type LocaleMessages, type Replacement, type TranslatorMethods } from "intor-translator";
3
3
  /**
4
4
  * Create a Vue-specific rich translation function.
5
5
  *
@@ -12,4 +12,4 @@ import { type Replacement, type TranslatorMethods } from "intor-translator";
12
12
  *
13
13
  * Intended for Vue client usage only.
14
14
  */
15
- export declare const createTRich: (t: TranslatorMethods["t"]) => (key: string, tagRenderers?: VueTagRenderers, replacements?: Replacement) => import("vue").VNodeChild[];
15
+ export declare const createTRich: (t: TranslatorMethods<LocaleMessages>["t"]) => (key: string, tagRenderers?: VueTagRenderers, replacements?: Replacement) => import("vue").VNodeChild[];
@@ -1,7 +1,7 @@
1
1
  import type { VueTagRenderers } from "../../../client/vue/render";
2
2
  import type { TranslatorInstance } from "../../../core";
3
3
  import type { ComputedRef, VNodeChild } from "vue";
4
- import { type Locale, type LocaleMessages, type LocalizedKey, type LocalizedReplacement, type LocalizedRich, type Replacement, type Rich, type ScopedKey } from "intor-translator";
4
+ import { type Locale, type LocaleMessages, type LocalizedKey, type LocalizedReplacement, type LocalizedRich, type Replacement, type Rich, type ScopedKey, type ScopedReplacement, type ScopedRich } from "intor-translator";
5
5
  export type TranslatorInstanceVue<M extends LocaleMessages, ReplacementSchema = Replacement, RichSchema = Rich, PK extends string | undefined = undefined> = Omit<TranslatorInstance<M, ReplacementSchema, RichSchema, PK>, "tRich" | "messages" | "locale"> & {
6
6
  /** `messages`: The message object containing all translations. */
7
7
  messages: ComputedRef<M>;
@@ -12,5 +12,5 @@ export type TranslatorInstanceVue<M extends LocaleMessages, ReplacementSchema =
12
12
  /** Update the active locale. */
13
13
  setLocale: (locale: Locale<M>) => void;
14
14
  /** Translate a key into VNodes using semantic tags */
15
- tRich: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, RI = LocalizedRich<RichSchema, K>, RE = LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), tagRenderers?: VueTagRenderers<RI> | VueTagRenderers, replacements?: RE | Replacement) => VNodeChild[];
15
+ tRich: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, RI = PK extends string ? ScopedRich<RichSchema, PK, K> : LocalizedRich<RichSchema, K>, RE = PK extends string ? ScopedReplacement<ReplacementSchema, PK, K> : LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), tagRenderers?: VueTagRenderers<RI> | VueTagRenderers, replacements?: RE | Replacement) => VNodeChild[];
16
16
  };
@@ -1,4 +1,4 @@
1
- import { type Replacement, type TranslatorMethods } from "intor-translator";
1
+ import { type LocaleMessages, type Replacement, type TranslatorMethods } from "intor-translator";
2
2
  import { type TagRenderers } from "../render";
3
3
  /**
4
4
  * Create an HTML-string rich translation function.
@@ -9,4 +9,4 @@ import { type TagRenderers } from "../render";
9
9
  *
10
10
  * Can be used in any HTML-based environment (Astro, Svelte, SSR, etc.).
11
11
  */
12
- export declare const createTRich: (t: TranslatorMethods["t"]) => (key: string, tagRenderers?: TagRenderers, replacements?: Replacement) => string;
12
+ export declare const createTRich: (t: TranslatorMethods<LocaleMessages>["t"]) => (key: string, tagRenderers?: TagRenderers, replacements?: Replacement) => string;
@@ -1,5 +1,5 @@
1
1
  import type { HtmlTagRenderers } from "../render";
2
- import { type Locale, type LocaleMessages, type LocalizedKey, type ScopedKey, type LocalizedValue, type ScopedValue, type Replacement, type LocalizedReplacement, type LocalizedRich, type Rich } from "intor-translator";
2
+ import { type Locale, type LocaleMessages, type LocalizedKey, type ScopedKey, type LocalizedValue, type ScopedValue, type Replacement, type LocalizedReplacement, type LocalizedRich, type Rich, type ScopedRich, type ScopedReplacement } from "intor-translator";
3
3
  type FallbackIfNever<T, Fallback> = [T] extends [never] ? Fallback : T;
4
4
  /**
5
5
  * Core translator instance interface.
@@ -16,6 +16,6 @@ export type TranslatorInstance<M extends LocaleMessages, ReplacementSchema = Rep
16
16
  /** Translate a given key into its string representation. */
17
17
  t: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, R extends Replacement = LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), replacements?: R | Replacement) => FallbackIfNever<PK extends string ? ScopedValue<M, PK, K> : LocalizedValue<M, K>, string>;
18
18
  /** Translate a key into an HTML string using semantic rich tags. */
19
- tRich: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, RI = LocalizedRich<RichSchema, K>, RE = LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), tagRenderers?: HtmlTagRenderers<RI> | HtmlTagRenderers, replacements?: RE | Replacement) => string;
19
+ tRich: <K extends string = PK extends string ? ScopedKey<M, PK> : LocalizedKey<M>, RI = PK extends string ? ScopedRich<RichSchema, PK, K> : LocalizedRich<RichSchema, K>, RE = PK extends string ? ScopedReplacement<ReplacementSchema, PK, K> : LocalizedReplacement<ReplacementSchema, K>>(key?: K | (string & {}), tagRenderers?: HtmlTagRenderers<RI> | HtmlTagRenderers, replacements?: RE | Replacement) => string;
20
20
  };
21
21
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor",
3
- "version": "2.4.16",
3
+ "version": "2.4.17",
4
4
  "description": "The i18n library for modern JavaScript",
5
5
  "author": "Yiming Liao",
6
6
  "homepage": "https://intor.dev",
@@ -107,7 +107,7 @@
107
107
  "prepublishOnly": "yarn build"
108
108
  },
109
109
  "dependencies": {
110
- "intor-translator": "^1.4.14",
110
+ "intor-translator": "^1.4.15",
111
111
  "logry": "2.1.6",
112
112
  "p-limit": "7.2.0"
113
113
  },