intor-translator 1.4.11 → 1.4.13

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
@@ -191,7 +191,7 @@ type Value<M, K extends string> = K extends `${infer Head}.${infer Tail}` ? Head
191
191
  * LocalizedValue<{ en: { a: { b: { c: string }; z: string } } }, "a.b.c">; // => string
192
192
  * ```
193
193
  */
194
- type LocalizedValue<M, K extends string> = IfLocaleMessages<M, Value<M[keyof M], K>, MessageValue>;
194
+ type LocalizedValue<M, K extends string> = IfLocaleMessages<M, Value<M[keyof M], K>, string>;
195
195
  /**
196
196
  * Value resolved under a scoped prefix key.
197
197
  *
@@ -200,7 +200,7 @@ type LocalizedValue<M, K extends string> = IfLocaleMessages<M, Value<M[keyof M],
200
200
  * ScopedValue<{ en: { a: { b: { c: string }; z: string } } }, "a", "b.c">; // => string
201
201
  * ```
202
202
  */
203
- type ScopedValue<M, PK extends string, K extends string> = IfLocaleMessages<M, Value<AtPath<M[keyof M], PK>, K>, MessageValue>;
203
+ type ScopedValue<M, PK extends string, K extends string> = IfLocaleMessages<M, Value<AtPath<M[keyof M], PK>, K>, string>;
204
204
 
205
205
  /**
206
206
  * Generic replacement object used when no schema is available.
@@ -239,15 +239,12 @@ type LocalizedReplacement<ReplacementSchema, K extends string> = ReplacementSche
239
239
  */
240
240
  type ScopedReplacement<ReplacementSchema, PK extends string | undefined, K extends string> = LocalizedReplacement<ReplacementSchema, `${PK}.${K}`>;
241
241
 
242
- /** Semantic tag attributes map. */
243
- type Attributes = Record<string, string>;
244
-
245
242
  /**
246
243
  * Generic rich tag map used when no schema is available.
247
244
  *
248
245
  * Acts as a safe fallback for dynamic or unknown rich tag shapes.
249
246
  */
250
- type Rich = Record<string, Attributes>;
247
+ type Rich = Record<string, unknown>;
251
248
  /**
252
249
  * Rich tag map resolved from a localized rich schema.
253
250
  *
@@ -256,8 +253,8 @@ type Rich = Record<string, Attributes>;
256
253
  *
257
254
  * @example
258
255
  * ```ts
259
- * type RichSchema = { "{locale}": { link: { a: { href: string } } } }
260
- * LocalizedRich<RichSchema, "link"> // => { a: { href: string } }
256
+ * type RichSchema = { "{locale}": { link: { a: {} } } }
257
+ * LocalizedRich<RichSchema, "link"> // => { a: {} }
261
258
  * LocalizedRich<RichSchema, "missing">; // => Rich
262
259
  * ```
263
260
  */
@@ -272,8 +269,8 @@ type LocalizedRich<RichSchema, K extends string> = RichSchema extends {
272
269
  *
273
270
  * @example
274
271
  * ```ts
275
- * type RichSchema = { "{locale}": { app: { link: { a: { href: string } } } } };
276
- * ScopedRich<RichSchema, "app", "link">; // => { a: { href: string } }
272
+ * type RichSchema = { "{locale}": { app: { link: { a: {} } } } };
273
+ * ScopedRich<RichSchema, "app", "link">; // => { a: {} }
277
274
  * ScopedRich<RichSchema, "app", "missing">; // => Rich
278
275
  * ```
279
276
  */
@@ -458,6 +455,9 @@ declare class ScopeTranslator<M extends LocaleMessages | unknown = unknown, Repl
458
455
  scoped<PK extends LocalizedPreKey<M> | undefined = undefined>(preKey?: PK): PK extends string ? ScopeTranslatorMethods<M, ReplacementSchema, PK> : ScopeTranslatorMethods<M, ReplacementSchema>;
459
456
  }
460
457
 
458
+ /** Semantic tag attributes map. */
459
+ type Attributes = Record<string, string>;
460
+
461
461
  /** Semantic node produced by the AST builder. */
462
462
  type ASTNode = TextNode | TagNode | RawNode;
463
463
  /** Plain text node in the semantic AST. */
package/dist/index.d.ts CHANGED
@@ -191,7 +191,7 @@ type Value<M, K extends string> = K extends `${infer Head}.${infer Tail}` ? Head
191
191
  * LocalizedValue<{ en: { a: { b: { c: string }; z: string } } }, "a.b.c">; // => string
192
192
  * ```
193
193
  */
194
- type LocalizedValue<M, K extends string> = IfLocaleMessages<M, Value<M[keyof M], K>, MessageValue>;
194
+ type LocalizedValue<M, K extends string> = IfLocaleMessages<M, Value<M[keyof M], K>, string>;
195
195
  /**
196
196
  * Value resolved under a scoped prefix key.
197
197
  *
@@ -200,7 +200,7 @@ type LocalizedValue<M, K extends string> = IfLocaleMessages<M, Value<M[keyof M],
200
200
  * ScopedValue<{ en: { a: { b: { c: string }; z: string } } }, "a", "b.c">; // => string
201
201
  * ```
202
202
  */
203
- type ScopedValue<M, PK extends string, K extends string> = IfLocaleMessages<M, Value<AtPath<M[keyof M], PK>, K>, MessageValue>;
203
+ type ScopedValue<M, PK extends string, K extends string> = IfLocaleMessages<M, Value<AtPath<M[keyof M], PK>, K>, string>;
204
204
 
205
205
  /**
206
206
  * Generic replacement object used when no schema is available.
@@ -239,15 +239,12 @@ type LocalizedReplacement<ReplacementSchema, K extends string> = ReplacementSche
239
239
  */
240
240
  type ScopedReplacement<ReplacementSchema, PK extends string | undefined, K extends string> = LocalizedReplacement<ReplacementSchema, `${PK}.${K}`>;
241
241
 
242
- /** Semantic tag attributes map. */
243
- type Attributes = Record<string, string>;
244
-
245
242
  /**
246
243
  * Generic rich tag map used when no schema is available.
247
244
  *
248
245
  * Acts as a safe fallback for dynamic or unknown rich tag shapes.
249
246
  */
250
- type Rich = Record<string, Attributes>;
247
+ type Rich = Record<string, unknown>;
251
248
  /**
252
249
  * Rich tag map resolved from a localized rich schema.
253
250
  *
@@ -256,8 +253,8 @@ type Rich = Record<string, Attributes>;
256
253
  *
257
254
  * @example
258
255
  * ```ts
259
- * type RichSchema = { "{locale}": { link: { a: { href: string } } } }
260
- * LocalizedRich<RichSchema, "link"> // => { a: { href: string } }
256
+ * type RichSchema = { "{locale}": { link: { a: {} } } }
257
+ * LocalizedRich<RichSchema, "link"> // => { a: {} }
261
258
  * LocalizedRich<RichSchema, "missing">; // => Rich
262
259
  * ```
263
260
  */
@@ -272,8 +269,8 @@ type LocalizedRich<RichSchema, K extends string> = RichSchema extends {
272
269
  *
273
270
  * @example
274
271
  * ```ts
275
- * type RichSchema = { "{locale}": { app: { link: { a: { href: string } } } } };
276
- * ScopedRich<RichSchema, "app", "link">; // => { a: { href: string } }
272
+ * type RichSchema = { "{locale}": { app: { link: { a: {} } } } };
273
+ * ScopedRich<RichSchema, "app", "link">; // => { a: {} }
277
274
  * ScopedRich<RichSchema, "app", "missing">; // => Rich
278
275
  * ```
279
276
  */
@@ -458,6 +455,9 @@ declare class ScopeTranslator<M extends LocaleMessages | unknown = unknown, Repl
458
455
  scoped<PK extends LocalizedPreKey<M> | undefined = undefined>(preKey?: PK): PK extends string ? ScopeTranslatorMethods<M, ReplacementSchema, PK> : ScopeTranslatorMethods<M, ReplacementSchema>;
459
456
  }
460
457
 
458
+ /** Semantic tag attributes map. */
459
+ type Attributes = Record<string, string>;
460
+
461
461
  /** Semantic node produced by the AST builder. */
462
462
  type ASTNode = TextNode | TagNode | RawNode;
463
463
  /** Plain text node in the semantic AST. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor-translator",
3
- "version": "1.4.11",
3
+ "version": "1.4.13",
4
4
  "description": "🤖 A modern, type-safe i18n engine.",
5
5
  "author": {
6
6
  "name": "Yiming Liao",