tiny-essentials 1.20.3 โ†’ 1.21.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.
Files changed (114) hide show
  1. package/README.md +13 -11
  2. package/dist/_/numbers.cjs +136 -0
  3. package/dist/_/numbers.d.mts +24 -0
  4. package/dist/_/numbers.mjs +102 -0
  5. package/dist/v1/TinyAdvancedRaffle.min.js +1 -0
  6. package/dist/v1/TinyArrayPaginator.min.js +1 -0
  7. package/dist/v1/TinyBasicsEs.min.js +1 -1
  8. package/dist/v1/TinyCookieConsent.min.js +1 -0
  9. package/dist/v1/TinyDayNightCycle.min.js +1 -0
  10. package/dist/v1/TinyEssentials.min.js +1 -1
  11. package/dist/v1/TinyGamepad.min.js +1 -0
  12. package/dist/v1/TinyI18.min.js +1 -0
  13. package/dist/v1/TinyInventory.min.js +1 -0
  14. package/dist/v1/TinyInventoryTrader.min.js +1 -0
  15. package/dist/v1/TinyLocalStorage.min.js +1 -1
  16. package/dist/v1/TinyRateLimiter.min.js +1 -1
  17. package/dist/v1/TinySmartScroller.min.js +1 -1
  18. package/dist/v1/TinyToastNotify.min.js +1 -1
  19. package/dist/v1/TinyUploadClicker.min.js +1 -1
  20. package/dist/v1/basics/array.cjs +21 -0
  21. package/dist/v1/basics/array.d.mts +8 -0
  22. package/dist/v1/basics/array.mjs +18 -0
  23. package/dist/v1/basics/index.cjs +2 -8
  24. package/dist/v1/basics/index.d.mts +3 -8
  25. package/dist/v1/basics/index.mjs +2 -3
  26. package/dist/v1/basics/simpleMath.cjs +46 -0
  27. package/dist/v1/basics/simpleMath.d.mts +27 -0
  28. package/dist/v1/basics/simpleMath.mjs +42 -0
  29. package/dist/v1/build/TinyAdvancedRaffle.cjs +7 -0
  30. package/dist/v1/build/TinyAdvancedRaffle.d.mts +3 -0
  31. package/dist/v1/build/TinyAdvancedRaffle.mjs +2 -0
  32. package/dist/v1/build/TinyArrayPaginator.cjs +7 -0
  33. package/dist/v1/build/TinyArrayPaginator.d.mts +3 -0
  34. package/dist/v1/build/TinyArrayPaginator.mjs +2 -0
  35. package/dist/v1/build/TinyCookieConsent.cjs +7 -0
  36. package/dist/v1/build/TinyCookieConsent.d.mts +3 -0
  37. package/dist/v1/build/TinyCookieConsent.mjs +2 -0
  38. package/dist/v1/build/TinyDayNightCycle.cjs +7 -0
  39. package/dist/v1/build/TinyDayNightCycle.d.mts +3 -0
  40. package/dist/v1/build/TinyDayNightCycle.mjs +2 -0
  41. package/dist/v1/build/TinyGamepad.cjs +7 -0
  42. package/dist/v1/build/TinyGamepad.d.mts +3 -0
  43. package/dist/v1/build/TinyGamepad.mjs +2 -0
  44. package/dist/v1/build/TinyI18.cjs +7 -0
  45. package/dist/v1/build/TinyI18.d.mts +3 -0
  46. package/dist/v1/build/TinyI18.mjs +2 -0
  47. package/dist/v1/build/TinyInventory.cjs +7 -0
  48. package/dist/v1/build/TinyInventory.d.mts +3 -0
  49. package/dist/v1/build/TinyInventory.mjs +2 -0
  50. package/dist/v1/build/TinyInventoryTrader.cjs +7 -0
  51. package/dist/v1/build/TinyInventoryTrader.d.mts +3 -0
  52. package/dist/v1/build/TinyInventoryTrader.mjs +2 -0
  53. package/dist/v1/css/TinyCookieConsent.min.css +1 -0
  54. package/dist/v1/index.cjs +18 -8
  55. package/dist/v1/index.d.mts +11 -8
  56. package/dist/v1/index.mjs +10 -3
  57. package/dist/v1/libs/TinyAdvancedRaffle.cjs +1654 -0
  58. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +851 -0
  59. package/dist/v1/libs/TinyAdvancedRaffle.mjs +1477 -0
  60. package/dist/v1/libs/TinyArrayPaginator.cjs +132 -0
  61. package/dist/v1/libs/TinyArrayPaginator.d.mts +78 -0
  62. package/dist/v1/libs/TinyArrayPaginator.mjs +119 -0
  63. package/dist/v1/libs/TinyCookieConsent.cjs +278 -0
  64. package/dist/v1/libs/TinyCookieConsent.d.mts +142 -0
  65. package/dist/v1/libs/TinyCookieConsent.mjs +248 -0
  66. package/dist/v1/libs/TinyDayNightCycle.cjs +1389 -0
  67. package/dist/v1/libs/TinyDayNightCycle.d.mts +673 -0
  68. package/dist/v1/libs/TinyDayNightCycle.mjs +1232 -0
  69. package/dist/v1/libs/TinyGamepad.cjs +2690 -0
  70. package/dist/v1/libs/TinyGamepad.d.mts +1286 -0
  71. package/dist/v1/libs/TinyGamepad.mjs +2386 -0
  72. package/dist/v1/libs/TinyHtml.d.mts +2 -2
  73. package/dist/v1/libs/TinyI18.cjs +946 -0
  74. package/dist/v1/libs/TinyI18.d.mts +418 -0
  75. package/dist/v1/libs/TinyI18.mjs +873 -0
  76. package/dist/v1/libs/TinyInventory.cjs +1788 -0
  77. package/dist/v1/libs/TinyInventory.d.mts +871 -0
  78. package/dist/v1/libs/TinyInventory.mjs +1650 -0
  79. package/dist/v1/libs/TinyInventoryTrader.cjs +242 -0
  80. package/dist/v1/libs/TinyInventoryTrader.d.mts +95 -0
  81. package/dist/v1/libs/TinyInventoryTrader.mjs +212 -0
  82. package/dist/v1/libs/TinyLocalStorage.cjs +14 -1
  83. package/dist/v1/libs/TinyLocalStorage.mjs +8 -1
  84. package/dist/v1/libs/TinyRateLimiter.cjs +0 -13
  85. package/dist/v1/libs/TinyRateLimiter.d.mts +0 -8
  86. package/dist/v1/libs/TinyRateLimiter.mjs +0 -12
  87. package/dist/v1/libs/TinySmartScroller.cjs +0 -51
  88. package/dist/v1/libs/TinySmartScroller.d.mts +0 -36
  89. package/dist/v1/libs/TinySmartScroller.mjs +0 -46
  90. package/dist/v1/libs/TinyToastNotify.cjs +2 -2
  91. package/dist/v1/libs/TinyToastNotify.mjs +2 -2
  92. package/dist/v1/libs/TinyUploadClicker.cjs +1 -1
  93. package/docs/v1/Ai-Tips.md +51 -0
  94. package/docs/v1/Personal-Ai-Prompts(portuguese).md +134 -0
  95. package/docs/v1/Personal-Ai-Prompts.md +113 -0
  96. package/docs/v1/README.md +23 -0
  97. package/docs/v1/basics/array.md +17 -0
  98. package/docs/v1/basics/simpleMath.md +73 -0
  99. package/docs/v1/libs/TinyAdvancedRaffle.md +674 -0
  100. package/docs/v1/libs/TinyArrayPaginator.md +150 -0
  101. package/docs/v1/libs/TinyCookieConsent.md +152 -0
  102. package/docs/v1/libs/TinyDayNightCycle.md +711 -0
  103. package/docs/v1/libs/TinyGamepad.md +980 -0
  104. package/docs/v1/libs/TinyI18.md +515 -0
  105. package/docs/v1/libs/TinyInventory.md +777 -0
  106. package/docs/v1/libs/TinyInventoryTrader.md +114 -0
  107. package/package.json +7 -5
  108. package/dist/v1/basics/html_deprecated.cjs +0 -124
  109. package/dist/v1/basics/html_deprecated.d.mts +0 -40
  110. package/dist/v1/basics/html_deprecated.mjs +0 -97
  111. package/dist/v1/css/TinyDraggerExample.css +0 -21
  112. package/dist/v1/css/TinyNotify.css +0 -350
  113. package/dist/v1/css/aiMarker.css +0 -4
  114. package/docs/v1/basics/html_deprecated.md +0 -127
@@ -0,0 +1,515 @@
1
+ # TinyI18 Documentation ๐Ÿ“šโœจ
2
+
3
+ ## Class: `TinyI18` ๐Ÿท๏ธ
4
+
5
+ Professional and flexible i18n manager with dual mode (local/file), regex-based keys, and function-based entries for advanced rendering.
6
+
7
+ * **Mode `"local"`**: in-memory resources (Node + Browser).
8
+ * **Mode `"file"`**: JSON files on disk via fs/path (Node only).
9
+ * Keeps only default + selected locale in memory.
10
+ * Selected locale overrides default; fallback resolves to default.
11
+ * Supports string entries, regex pattern entries, and function-backed entries.
12
+ * Safe: no dynamic code eval from files; functions in file mode are referenced by name (`$fn`).
13
+
14
+ ---
15
+
16
+ ### Static Methods โšก
17
+
18
+ #### `mergeLocaleFiles({ files, output, spaces = 0 })` ๐Ÿ”—
19
+
20
+ Merges multiple JSON locale files into a single file for TinyI18 usage (file mode only).
21
+
22
+ **Parameters:**
23
+
24
+ | Name | Type | Description |
25
+ | -------- | ---------- | ---------------------------------------------------------------------------- |
26
+ | `files` | `string[]` | List of JSON file paths to merge. |
27
+ | `output` | `string` | Path where the merged JSON file will be written. |
28
+ | `spaces` | `number` | Optional. Number of spaces for indentation in the output JSON (default `0`). |
29
+
30
+ **Throws:**
31
+
32
+ * `TypeError` โ†’ if arguments are invalid.
33
+ * `Error` โ†’ if file reading or writing fails.
34
+
35
+ **Example Usage:**
36
+
37
+ ```js
38
+ await TinyI18.mergeLocaleFiles({
39
+ files: ['./en.json', './pt.json'],
40
+ output: './merged.json',
41
+ spaces: 2,
42
+ });
43
+ ```
44
+
45
+ ---
46
+
47
+ ### Properties ๐Ÿ› ๏ธ
48
+
49
+ #### `currentLocale` ๐Ÿ”น
50
+
51
+ The currently selected locale, or `null` if only the default locale is active.
52
+
53
+ * **Type:** `LocaleCode | null`
54
+
55
+ ---
56
+
57
+ #### `defaultLocale` ๐Ÿ”น
58
+
59
+ The default locale code chosen at construction. Always kept in memory as a fallback.
60
+
61
+ * **Type:** `LocaleCode`
62
+
63
+ ---
64
+
65
+ #### `mode` ๐Ÿ”น
66
+
67
+ The current operating mode of this instance:
68
+
69
+ * `"local"` โ†’ all translations managed in memory.
70
+
71
+ * `"file"` โ†’ translations loaded from JSON files.
72
+
73
+ * **Type:** `ModeTypes`
74
+
75
+ ---
76
+
77
+ #### `strict` ๐Ÿ”น
78
+
79
+ Whether strict mode is enabled.
80
+
81
+ * `true` โ†’ Missing keys, invalid regex, or helper errors throw exceptions.
82
+
83
+ * `false` โ†’ Failures are ignored silently, returning fallback values.
84
+
85
+ * **Type:** `boolean`
86
+
87
+ ---
88
+
89
+ #### `basePath` ๐Ÿ”น
90
+
91
+ Base directory path used in `"file"` mode to locate locale JSON files.
92
+
93
+ * `"local"` mode โ†’ always `null`
94
+
95
+ * `"file"` mode โ†’ root folder passed to the constructor
96
+
97
+ * **Type:** `string | null`
98
+
99
+ ---
100
+
101
+ #### `stats` ๐Ÿ“Š
102
+
103
+ Returns basic stats for debugging/memory insights.
104
+
105
+ * **Type:** `StatLocale[]`
106
+ * **Example:**
107
+
108
+ ```js
109
+ console.log(i18.stats);
110
+ // [
111
+ // { locale: 'en', strings: 12, patterns: 2, isDefault: true, isCurrent: false },
112
+ // { locale: 'pt', strings: 10, patterns: 1, isDefault: false, isCurrent: true },
113
+ // ]
114
+ ```
115
+
116
+ ---
117
+
118
+ #### `stringTables` ๐Ÿ”น
119
+
120
+ Deep-cloned view of string tables (Map โ†’ Object). Preserves strings, `$fn` objects, and functions.
121
+
122
+ * **Type:** `Record<string, Dict>`
123
+
124
+ ---
125
+
126
+ #### `patternTables` ๐Ÿ”น
127
+
128
+ Deep-cloned view of regex pattern tables (Map โ†’ Object). Recreates `RegExp` objects to avoid mutation.
129
+
130
+ * **Type:** `Record<string, PatternEntry[]>`
131
+
132
+ ---
133
+
134
+ #### `helpers` ๐Ÿ”น
135
+
136
+ Deep-cloned view of registered helper functions (Map โ†’ Object). Functions are referenced (cannot deep-clone functions).
137
+
138
+ * **Type:** `Record<string, HelperCallback>`
139
+
140
+ ---
141
+
142
+ #### `regexCache` ๐Ÿ”น
143
+
144
+ Deep-cloned view of compiled regex cache (Map โ†’ Object). Recreates `RegExp` objects to avoid mutation.
145
+
146
+ * **Type:** `Record<string, RegExp>`
147
+
148
+ ---
149
+
150
+ โœ… **Note:** All private internal maps are accessible via these getters as **read-only snapshots** to safely inspect memory without affecting runtime behavior.
151
+
152
+ ---
153
+
154
+ ## Internal Utilities & Resolution ๐Ÿ”ง
155
+
156
+ ### `#deepClone(value)` ๐ŸŒ€
157
+
158
+ Deep clones a value for internal use.
159
+
160
+ * Strings, numbers, and functions โ†’ returned as-is
161
+ * Objects/arrays โ†’ recursively cloned
162
+ * `RegExp` โ†’ cloned
163
+
164
+ **Parameters:**
165
+
166
+ | Name | Type | Description |
167
+ | ------- | ----- | ------------------- |
168
+ | `value` | `any` | Value to deep clone |
169
+
170
+ **Returns:** `any` โ€“ cloned value
171
+
172
+ ---
173
+
174
+ ### `#resolveOrder(forceLocale)` ๐Ÿ”„
175
+
176
+ Determines the resolution order of locales for key lookup.
177
+
178
+ **Parameters:**
179
+
180
+ | Name | Type | Description |
181
+ | ------------- | -------- | ---------------------------------------- |
182
+ | `forceLocale` | `string` | Optional locale code to prioritize first |
183
+
184
+ **Returns:** `string[]` โ€“ Ordered list of locale codes to try
185
+
186
+ ---
187
+
188
+ ### `#resolveExact(order, key)` ๐ŸŽฏ
189
+
190
+ Resolves a key exactly in the provided locale order.
191
+
192
+ **Parameters:**
193
+
194
+ | Name | Type | Description |
195
+ | ------- | ---------- | ------------------------------ |
196
+ | `order` | `string[]` | Array of locale codes to check |
197
+ | `key` | `string` | Exact key to look up |
198
+
199
+ **Returns:** `any` โ€“ Found value, or `undefined` if not found
200
+
201
+ ---
202
+
203
+ ### `#resolveByPattern(order, key)` ๐Ÿ”
204
+
205
+ Resolves a key by matching regex patterns in locale tables.
206
+
207
+ **Parameters:**
208
+
209
+ | Name | Type | Description |
210
+ | ------- | ---------- | ----------------------------------------- |
211
+ | `order` | `string[]` | Array of locale codes in resolution order |
212
+ | `key` | `string` | Key to match against patterns |
213
+
214
+ **Returns:** `any` โ€“ Value associated with matched pattern, or `undefined`
215
+
216
+ ---
217
+
218
+ ### `#materialize(value, params)` ๐Ÿ—๏ธ
219
+
220
+ Converts a raw translation entry into a final string for display.
221
+
222
+ **Value can be:**
223
+
224
+ * String
225
+ * Function `(params, helpers) => any`
226
+ * `{ $fn: string, args?: any }` (file mode placeholder)
227
+
228
+ **Parameters:**
229
+
230
+ | Name | Type | Description | | |
231
+ | -------- | -------- | ------------------------------------- | ------------------------------ | --------------------- |
232
+ | `value` | `string` | HelperCallback | { \$fn: string; args?: any }\` | Raw translation entry |
233
+ | `params` | `Dict` | Optional parameters for interpolation | | |
234
+
235
+ **Returns:** `string` โ€“ Materialized result
236
+
237
+ ---
238
+
239
+ ### `#interpolate(template, params)` โœ๏ธ
240
+
241
+ Interpolates `{named}` placeholders in a string using given parameters.
242
+
243
+ **Parameters:**
244
+
245
+ | Name | Type | Description |
246
+ | ---------- | -------- | --------------------------------- |
247
+ | `template` | `string` | Template string with placeholders |
248
+ | `params` | `Dict` | Values to interpolate |
249
+
250
+ **Returns:** `string` โ€“ Interpolated string
251
+
252
+ ---
253
+
254
+ ### `#dotGet(obj, path)` ๐Ÿ“Œ
255
+
256
+ Safely retrieves a nested property using dot notation.
257
+
258
+ **Parameters:**
259
+
260
+ | Name | Type | Description |
261
+ | ------ | -------- | ------------------------------------ |
262
+ | `obj` | `Dict` | Object to retrieve from |
263
+ | `path` | `string` | Dot-separated path (e.g., `"a.b.c"`) |
264
+
265
+ **Returns:** `any` โ€“ Value at path or `undefined`
266
+
267
+ ---
268
+
269
+ ### `#helpersReadonly()` ๐Ÿ›ก๏ธ
270
+
271
+ Provides a read-only facade for safely accessing registered helpers.
272
+
273
+ **Returns:** `HelpersReadonly<any, any>` โ€“ Safe helper access with:
274
+
275
+ * `has(name)` โ†’ check if helper exists
276
+ * `call(name, arg, extras)` โ†’ invoke helper safely
277
+
278
+ ---
279
+
280
+ ## Internal Locale Ingestion ๐ŸŒ
281
+
282
+ ### `#ingestLocale(locale, raw)` ๐Ÿ“ฅ
283
+
284
+ Flattens and registers raw locale data into internal string & pattern tables.
285
+
286
+ **Parameters:**
287
+
288
+ | Name | Type | Description |
289
+ | -------- | -------- | --------------------------- |
290
+ | `locale` | `string` | Locale code |
291
+ | `raw` | `Dict` | Raw locale object to ingest |
292
+
293
+ ---
294
+
295
+ ### `#unloadLocale(locale)` โŒ
296
+
297
+ Removes a previously loaded locale from memory (except default).
298
+
299
+ **Parameters:**
300
+
301
+ | Name | Type | Description |
302
+ | -------- | -------- | --------------------- |
303
+ | `locale` | `string` | Locale code to unload |
304
+
305
+ ---
306
+
307
+ ## File Mode Loading ๐Ÿ“‚
308
+
309
+ ### `#loadLocaleFromFile(locale)` ๐Ÿ“„
310
+
311
+ Loads a locale JSON file and flattens it into internal maps (file mode only).
312
+
313
+ **Behavior:**
314
+
315
+ * Dot-flattens nested keys
316
+ * Compiles `$pattern` entries into RegExp
317
+ * Preserves `$fn` placeholders for helper resolution
318
+
319
+ **Parameters:**
320
+
321
+ | Name | Type | Description |
322
+ | -------- | ------------ | ------------------- |
323
+ | `locale` | `LocaleCode` | Locale code to load |
324
+
325
+ **Returns:** `Promise<void>`
326
+
327
+ ---
328
+
329
+ ### `#safeRegExp(src)` ๐Ÿงต
330
+
331
+ Returns a cached `RegExp` from source, compiling if needed.
332
+ Strict mode โ†’ throws on invalid regex; otherwise returns a never-matching regex.
333
+
334
+ **Parameters:**
335
+
336
+ | Name | Type | Description |
337
+ | ----- | -------- | ------------------------------ |
338
+ | `src` | `string` | Regex source string (no flags) |
339
+
340
+ **Returns:** `RegExp`
341
+
342
+ ---
343
+
344
+ ### `#coerceFileValue(v)` โš™๏ธ
345
+
346
+ Normalizes a JSON value from file mode into internal representation.
347
+
348
+ * `string` โ†’ returned as-is
349
+ * `{ $fn: string, args?: any }` โ†’ preserved for helper resolution
350
+
351
+ **Parameters:**
352
+
353
+ | Name | Type | Description | |
354
+ | ---- | -------- | ----------- | -------------- |
355
+ | `v` | \`string | FileValue\` | Raw JSON value |
356
+
357
+ **Returns:** `string | { $fn: string, args?: any }`
358
+
359
+ ---
360
+
361
+ ## Constructor & External API ๐Ÿ—๏ธ
362
+
363
+ ### `constructor(options)` โš™๏ธ
364
+
365
+ Creates a new TinyI18 instance for managing localized strings and patterns.
366
+
367
+ **Modes Supported:**
368
+
369
+ * `"local"` โ†’ loads translations from provided objects
370
+ * `"file"` โ†’ loads translations from JSON files on demand
371
+
372
+ **Notes:**
373
+
374
+ * Ensures default locale is always initialized
375
+ * `basePath` is required in `"file"` mode
376
+
377
+ **Parameters:**
378
+
379
+ | Name | Type | Description |
380
+ | --------- | ---------------- | -------------------- |
381
+ | `options` | `TinyI18Options` | Configuration object |
382
+
383
+ ---
384
+
385
+ ### `clearRegexCache()` ๐Ÿงน
386
+
387
+ Clears the internal regex cache.
388
+
389
+ * Avoids recompiling frequently used patterns
390
+ * Always managed via API, not direct access
391
+
392
+ **Returns:** `void`
393
+
394
+ ---
395
+
396
+ ### `registerHelper(name, fn)` ๐Ÿ› ๏ธ
397
+
398
+ Registers a helper function for function-based entries or `$fn` references.
399
+
400
+ **Parameters:**
401
+
402
+ | Name | Type | Description |
403
+ | ------ | ---------------- | -------------------- |
404
+ | `name` | `string` | Helper function name |
405
+ | `fn` | `HelperCallback` | Callback function |
406
+
407
+ ---
408
+
409
+ ### `unregisterHelper(name)` โŒ
410
+
411
+ Removes a previously registered helper function.
412
+
413
+ **Parameters:**
414
+
415
+ | Name | Type | Description |
416
+ | ------ | -------- | ------------------------ |
417
+ | `name` | `string` | Name of helper to remove |
418
+
419
+ **Returns:** `boolean` โ€“ `true` if removed, `false` if not found
420
+
421
+ ---
422
+
423
+ ### `loadLocaleLocal(locale, data)` ๐Ÿ“ฆ
424
+
425
+ Loads or updates locale data in-memory (local mode only).
426
+
427
+ **Parameters:**
428
+
429
+ | Name | Type | Description |
430
+ | -------- | ------------ | ---------------- |
431
+ | `locale` | `LocaleCode` | Locale code |
432
+ | `data` | `Dict` | Translation data |
433
+
434
+ ---
435
+
436
+ ### `setLocale(locale)` ๐ŸŒ
437
+
438
+ Sets the currently selected locale. In file mode, loads from disk.
439
+
440
+ * Keeps only default + selected locale in memory
441
+ * Unloads previous selected locale
442
+
443
+ **Parameters:**
444
+
445
+ | Name | Type | Description | |
446
+ | -------- | ------------ | ----------- | ------------------------------------------- |
447
+ | `locale` | \`LocaleCode | null\` | Locale code, or `null` to keep only default |
448
+
449
+ **Returns:** `Promise<void>`
450
+
451
+ ---
452
+
453
+ ### `t(key, params, options)` ๐ŸŽฏ
454
+
455
+ Resolves a translation by **exact key**.
456
+
457
+ **Resolution order:** Current locale โ†’ Default locale
458
+
459
+ **Parameters:**
460
+
461
+ | Name | Type | Description |
462
+ | --------- | ---------------- | ------------------------------------------------ |
463
+ | `key` | `string` | Translation key (dot.notation) |
464
+ | `params` | `Dict` | Optional parameters for interpolation or helpers |
465
+ | `options` | `ResolveOptions` | Optional resolution overrides |
466
+
467
+ **Returns:** `any` โ€“ Usually `string`, but may be HTMLElement, DocumentFragment, or helper return type
468
+
469
+ **Alias:** `get(key, params, options)`
470
+
471
+ ---
472
+
473
+ ### `p(key, options)` ๐Ÿ”
474
+
475
+ Resolves a translation by **regex pattern match**.
476
+
477
+ * Returns first matching entry if multiple patterns exist
478
+
479
+ **Parameters:**
480
+
481
+ | Name | Type | Description |
482
+ | --------- | ---------------- | -------------------------------------- |
483
+ | `key` | `string` | Input string to match against patterns |
484
+ | `options` | `ResolveOptions` | Optional resolution overrides |
485
+
486
+ **Returns:** `any` โ€“ Translation value
487
+
488
+ **Alias:** `resolveByPattern(key, options)`
489
+
490
+ ---
491
+
492
+ ### `resetToDefaultOnly()` ๐Ÿ 
493
+
494
+ Clears all loaded locales except the default.
495
+
496
+ * Selected locale becomes `null`
497
+ * In file mode, non-default locales are unloaded
498
+
499
+ **Returns:** `void`
500
+
501
+ ---
502
+
503
+ ### `getStatsForLocale(locale)` ๐Ÿ“Š
504
+
505
+ Returns statistics for a specific locale.
506
+
507
+ **Parameters:**
508
+
509
+ | Name | Type | Description |
510
+ | -------- | ------------ | ---------------------- |
511
+ | `locale` | `LocaleCode` | Locale code to inspect |
512
+
513
+ **Returns:** `StatLocale` โ€“ Locale stats including number of strings, patterns, and flags
514
+
515
+ **Throws:** Error if locale is not registered