@taon-dev/i18n 0.0.1 → 21.0.7

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 (279) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/bin/start.js +1 -1
  3. package/browser/fesm2022/i18n-browser.mjs +1441 -406
  4. package/browser/fesm2022/i18n-browser.mjs.map +1 -1
  5. package/browser/package.json +1 -1
  6. package/browser/types/i18n-browser.d.ts +146 -305
  7. package/browser-prod/fesm2022/i18n-browser-prod.mjs +1429 -405
  8. package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -1
  9. package/browser-prod/package.json +1 -1
  10. package/browser-prod/types/i18n-browser-prod.d.ts +140 -305
  11. package/browser-prod.split-namespaces.json +26 -2
  12. package/html/app/main-page/main-page.container.html +4 -0
  13. package/html/assets/generated/pwa/html-pwa.html +53 -53
  14. package/lib/build-info._auto-generated_.d.ts +1 -1
  15. package/lib/build-info._auto-generated_.js +1 -1
  16. package/lib/build-info._auto-generated_.js.map +1 -1
  17. package/lib/index._auto-generated_.d.ts +9 -14
  18. package/lib/index._auto-generated_.js +9 -14
  19. package/lib/index._auto-generated_.js.map +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/start-cli.js +6 -4
  22. package/lib/start-cli.js.map +1 -1
  23. package/lib/translate.directive.d.ts +15 -0
  24. package/lib/translate.pipe.d.ts +10 -0
  25. package/lib/translate.service.d.ts +13 -0
  26. package/lib/translation-manager.d.ts +33 -0
  27. package/lib/translation-manager.js +119 -0
  28. package/lib/translation-manager.js.map +1 -0
  29. package/lib/translation.d.ts +44 -0
  30. package/lib/translation.js +253 -0
  31. package/lib/translation.js.map +1 -0
  32. package/lib/translation.models.d.ts +25 -0
  33. package/lib/{features/types.js → translation.models.js} +1 -1
  34. package/lib/translation.models.js.map +1 -0
  35. package/lib/utils-i18n-extract-gettext-translate-from-html.d.ts +4 -0
  36. package/lib/utils-i18n-extract-gettext-translate-from-html.js +465 -0
  37. package/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
  38. package/lib/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
  39. package/lib/utils-i18n-extract-gettext-translate-from-html.test.js +282 -0
  40. package/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
  41. package/lib/utils-i18n-html.d.ts +5 -0
  42. package/lib/utils-i18n-html.js +120 -0
  43. package/lib/utils-i18n-html.js.map +1 -0
  44. package/lib/utils-i18n-html.test.d.ts +1 -0
  45. package/lib/utils-i18n-html.test.js +82 -0
  46. package/lib/utils-i18n-html.test.js.map +1 -0
  47. package/lib/utils-po-file.d.ts +8 -0
  48. package/lib/utils-po-file.js +245 -0
  49. package/lib/utils-po-file.js.map +1 -0
  50. package/lib/utils-po-file.test.d.ts +1 -0
  51. package/lib/utils-po-file.test.js +239 -0
  52. package/lib/utils-po-file.test.js.map +1 -0
  53. package/lib-esm/app/main-page/main-page.active.context.d.ts +19 -0
  54. package/lib-esm/app/main-page/main-page.active.context.js +19 -0
  55. package/lib-esm/app/main-page/main-page.active.context.js.map +1 -0
  56. package/lib-esm/app.electron.d.ts +1 -1
  57. package/lib-esm/app.electron.js +1 -1
  58. package/lib-esm/app.hosts.d.ts +54 -2
  59. package/lib-esm/app.hosts.js +64 -4
  60. package/lib-esm/app.hosts.js.map +1 -1
  61. package/lib-esm/app.js +9 -9
  62. package/lib-esm/app.js.map +1 -1
  63. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  64. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  65. package/lib-esm/lib/build-info._auto-generated_.js.map +1 -1
  66. package/lib-esm/lib/index._auto-generated_.d.ts +6 -14
  67. package/lib-esm/lib/index._auto-generated_.js +9 -14
  68. package/lib-esm/lib/index._auto-generated_.js.map +1 -1
  69. package/lib-esm/lib/start-cli.js +6 -4
  70. package/lib-esm/lib/start-cli.js.map +1 -1
  71. package/lib-esm/lib/translation-manager.d.ts +33 -0
  72. package/lib-esm/lib/translation-manager.js +115 -0
  73. package/lib-esm/lib/translation-manager.js.map +1 -0
  74. package/lib-esm/lib/translation.d.ts +43 -0
  75. package/lib-esm/lib/translation.js +249 -0
  76. package/lib-esm/lib/translation.js.map +1 -0
  77. package/lib-esm/lib/translation.models.d.ts +25 -0
  78. package/lib-esm/lib/translation.models.js +2 -0
  79. package/lib-esm/lib/translation.models.js.map +1 -0
  80. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.d.ts +4 -0
  81. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js +462 -0
  82. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
  83. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
  84. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js +280 -0
  85. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
  86. package/lib-esm/lib/utils-i18n-html.d.ts +5 -0
  87. package/lib-esm/lib/utils-i18n-html.js +117 -0
  88. package/lib-esm/lib/utils-i18n-html.js.map +1 -0
  89. package/lib-esm/lib/utils-i18n-html.test.d.ts +1 -0
  90. package/lib-esm/lib/utils-i18n-html.test.js +80 -0
  91. package/lib-esm/lib/utils-i18n-html.test.js.map +1 -0
  92. package/lib-esm/lib/utils-po-file.d.ts +8 -0
  93. package/lib-esm/lib/utils-po-file.js +242 -0
  94. package/lib-esm/lib/utils-po-file.js.map +1 -0
  95. package/lib-esm/lib/utils-po-file.test.d.ts +1 -0
  96. package/lib-esm/lib/utils-po-file.test.js +237 -0
  97. package/lib-esm/lib/utils-po-file.test.js.map +1 -0
  98. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  99. package/lib-prod/build-info._auto-generated_.js +1 -1
  100. package/lib-prod/build-info._auto-generated_.js.map +1 -1
  101. package/lib-prod/index._auto-generated_.d.ts +6 -14
  102. package/lib-prod/index._auto-generated_.js +9 -14
  103. package/lib-prod/index._auto-generated_.js.map +1 -1
  104. package/lib-prod/package.json +1 -1
  105. package/lib-prod/start-cli.js +6 -4
  106. package/lib-prod/start-cli.js.map +1 -1
  107. package/lib-prod/translation-manager.d.ts +33 -0
  108. package/lib-prod/translation-manager.js +115 -0
  109. package/lib-prod/translation-manager.js.map +1 -0
  110. package/lib-prod/translation.d.ts +43 -0
  111. package/lib-prod/translation.js +249 -0
  112. package/lib-prod/translation.js.map +1 -0
  113. package/lib-prod/translation.models.d.ts +25 -0
  114. package/lib-prod/translation.models.js +2 -0
  115. package/lib-prod/translation.models.js.map +1 -0
  116. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.d.ts +2 -0
  117. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js +460 -0
  118. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
  119. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
  120. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js +280 -0
  121. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
  122. package/lib-prod/utils-i18n-html.d.ts +3 -0
  123. package/lib-prod/utils-i18n-html.js +114 -0
  124. package/lib-prod/utils-i18n-html.js.map +1 -0
  125. package/lib-prod/utils-i18n-html.test.d.ts +1 -0
  126. package/lib-prod/utils-i18n-html.test.js +80 -0
  127. package/lib-prod/utils-i18n-html.test.js.map +1 -0
  128. package/lib-prod/utils-po-file.d.ts +6 -0
  129. package/lib-prod/utils-po-file.js +236 -0
  130. package/lib-prod/utils-po-file.js.map +1 -0
  131. package/lib-prod/utils-po-file.test.d.ts +1 -0
  132. package/lib-prod/utils-po-file.test.js +237 -0
  133. package/lib-prod/utils-po-file.test.js.map +1 -0
  134. package/lib-prod.split-namespaces.json +26 -2
  135. package/package.json +4 -2
  136. package/scss/app/main-page/main-page.container.scss +3 -0
  137. package/websql/fesm2022/i18n-websql.mjs +1441 -406
  138. package/websql/fesm2022/i18n-websql.mjs.map +1 -1
  139. package/websql/package.json +1 -1
  140. package/websql/types/i18n-websql.d.ts +146 -305
  141. package/websql-prod/fesm2022/i18n-websql-prod.mjs +1429 -405
  142. package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -1
  143. package/websql-prod/package.json +1 -1
  144. package/websql-prod/types/i18n-websql-prod.d.ts +140 -305
  145. package/websql-prod.split-namespaces.json +26 -2
  146. package/lib/features/index.d.ts +0 -4
  147. package/lib/features/index.js +0 -21
  148. package/lib/features/index.js.map +0 -1
  149. package/lib/features/types.d.ts +0 -4
  150. package/lib/features/types.js.map +0 -1
  151. package/lib/features/withLanguageLocalStorageSync.d.ts +0 -9
  152. package/lib/features/withLanguageLocalStorageSync.js +0 -39
  153. package/lib/features/withLanguageLocalStorageSync.js.map +0 -1
  154. package/lib/features/withNavigatorLanguage.d.ts +0 -6
  155. package/lib/features/withNavigatorLanguage.js +0 -29
  156. package/lib/features/withNavigatorLanguage.js.map +0 -1
  157. package/lib/features/withPreloadScopes.d.ts +0 -8
  158. package/lib/features/withPreloadScopes.js +0 -25
  159. package/lib/features/withPreloadScopes.js.map +0 -1
  160. package/lib/features/withServerSideLanguage.d.ts +0 -6
  161. package/lib/features/withServerSideLanguage.js +0 -29
  162. package/lib/features/withServerSideLanguage.js.map +0 -1
  163. package/lib/features/withTranslatedTitle.d.ts +0 -34
  164. package/lib/features/withTranslatedTitle.js +0 -69
  165. package/lib/features/withTranslatedTitle.js.map +0 -1
  166. package/lib/internals.d.ts +0 -2
  167. package/lib/internals.js +0 -6
  168. package/lib/internals.js.map +0 -1
  169. package/lib/transignal-config.d.ts +0 -34
  170. package/lib/transignal-config.js +0 -42
  171. package/lib/transignal-config.js.map +0 -1
  172. package/lib/transignal-param-handlers.d.ts +0 -11
  173. package/lib/transignal-param-handlers.js +0 -31
  174. package/lib/transignal-param-handlers.js.map +0 -1
  175. package/lib/transignal-service.d.ts +0 -32
  176. package/lib/transignal-service.js +0 -206
  177. package/lib/transignal-service.js.map +0 -1
  178. package/lib/transignal-testing.d.ts +0 -8
  179. package/lib/transignal-testing.js +0 -14
  180. package/lib/transignal-testing.js.map +0 -1
  181. package/lib/types.d.ts +0 -124
  182. package/lib/types.js +0 -3
  183. package/lib/types.js.map +0 -1
  184. package/lib/utility-types.d.ts +0 -29
  185. package/lib/utility-types.js +0 -3
  186. package/lib/utility-types.js.map +0 -1
  187. package/lib/utils.d.ts +0 -15
  188. package/lib/utils.js +0 -20
  189. package/lib/utils.js.map +0 -1
  190. package/lib-esm/lib/features/index.d.ts +0 -4
  191. package/lib-esm/lib/features/index.js +0 -5
  192. package/lib-esm/lib/features/index.js.map +0 -1
  193. package/lib-esm/lib/features/types.d.ts +0 -4
  194. package/lib-esm/lib/features/types.js +0 -2
  195. package/lib-esm/lib/features/types.js.map +0 -1
  196. package/lib-esm/lib/features/withLanguageLocalStorageSync.d.ts +0 -9
  197. package/lib-esm/lib/features/withLanguageLocalStorageSync.js +0 -35
  198. package/lib-esm/lib/features/withLanguageLocalStorageSync.js.map +0 -1
  199. package/lib-esm/lib/features/withNavigatorLanguage.d.ts +0 -6
  200. package/lib-esm/lib/features/withNavigatorLanguage.js +0 -25
  201. package/lib-esm/lib/features/withNavigatorLanguage.js.map +0 -1
  202. package/lib-esm/lib/features/withPreloadScopes.d.ts +0 -8
  203. package/lib-esm/lib/features/withPreloadScopes.js +0 -21
  204. package/lib-esm/lib/features/withPreloadScopes.js.map +0 -1
  205. package/lib-esm/lib/features/withServerSideLanguage.d.ts +0 -6
  206. package/lib-esm/lib/features/withServerSideLanguage.js +0 -25
  207. package/lib-esm/lib/features/withServerSideLanguage.js.map +0 -1
  208. package/lib-esm/lib/features/withTranslatedTitle.d.ts +0 -34
  209. package/lib-esm/lib/features/withTranslatedTitle.js +0 -65
  210. package/lib-esm/lib/features/withTranslatedTitle.js.map +0 -1
  211. package/lib-esm/lib/internals.d.ts +0 -2
  212. package/lib-esm/lib/internals.js +0 -3
  213. package/lib-esm/lib/internals.js.map +0 -1
  214. package/lib-esm/lib/transignal-config.d.ts +0 -34
  215. package/lib-esm/lib/transignal-config.js +0 -36
  216. package/lib-esm/lib/transignal-config.js.map +0 -1
  217. package/lib-esm/lib/transignal-param-handlers.d.ts +0 -11
  218. package/lib-esm/lib/transignal-param-handlers.js +0 -25
  219. package/lib-esm/lib/transignal-param-handlers.js.map +0 -1
  220. package/lib-esm/lib/transignal-service.d.ts +0 -32
  221. package/lib-esm/lib/transignal-service.js +0 -197
  222. package/lib-esm/lib/transignal-service.js.map +0 -1
  223. package/lib-esm/lib/transignal-testing.d.ts +0 -8
  224. package/lib-esm/lib/transignal-testing.js +0 -10
  225. package/lib-esm/lib/transignal-testing.js.map +0 -1
  226. package/lib-esm/lib/types.d.ts +0 -124
  227. package/lib-esm/lib/types.js +0 -2
  228. package/lib-esm/lib/types.js.map +0 -1
  229. package/lib-esm/lib/utility-types.d.ts +0 -29
  230. package/lib-esm/lib/utility-types.js +0 -2
  231. package/lib-esm/lib/utility-types.js.map +0 -1
  232. package/lib-esm/lib/utils.d.ts +0 -15
  233. package/lib-esm/lib/utils.js +0 -15
  234. package/lib-esm/lib/utils.js.map +0 -1
  235. package/lib-prod/features/index.d.ts +0 -4
  236. package/lib-prod/features/index.js +0 -5
  237. package/lib-prod/features/index.js.map +0 -1
  238. package/lib-prod/features/types.d.ts +0 -4
  239. package/lib-prod/features/types.js +0 -2
  240. package/lib-prod/features/types.js.map +0 -1
  241. package/lib-prod/features/withLanguageLocalStorageSync.d.ts +0 -9
  242. package/lib-prod/features/withLanguageLocalStorageSync.js +0 -35
  243. package/lib-prod/features/withLanguageLocalStorageSync.js.map +0 -1
  244. package/lib-prod/features/withNavigatorLanguage.d.ts +0 -6
  245. package/lib-prod/features/withNavigatorLanguage.js +0 -25
  246. package/lib-prod/features/withNavigatorLanguage.js.map +0 -1
  247. package/lib-prod/features/withPreloadScopes.d.ts +0 -8
  248. package/lib-prod/features/withPreloadScopes.js +0 -21
  249. package/lib-prod/features/withPreloadScopes.js.map +0 -1
  250. package/lib-prod/features/withServerSideLanguage.d.ts +0 -6
  251. package/lib-prod/features/withServerSideLanguage.js +0 -25
  252. package/lib-prod/features/withServerSideLanguage.js.map +0 -1
  253. package/lib-prod/features/withTranslatedTitle.d.ts +0 -34
  254. package/lib-prod/features/withTranslatedTitle.js +0 -65
  255. package/lib-prod/features/withTranslatedTitle.js.map +0 -1
  256. package/lib-prod/internals.d.ts +0 -2
  257. package/lib-prod/internals.js +0 -3
  258. package/lib-prod/internals.js.map +0 -1
  259. package/lib-prod/transignal-config.d.ts +0 -34
  260. package/lib-prod/transignal-config.js +0 -36
  261. package/lib-prod/transignal-config.js.map +0 -1
  262. package/lib-prod/transignal-param-handlers.d.ts +0 -11
  263. package/lib-prod/transignal-param-handlers.js +0 -25
  264. package/lib-prod/transignal-param-handlers.js.map +0 -1
  265. package/lib-prod/transignal-service.d.ts +0 -32
  266. package/lib-prod/transignal-service.js +0 -197
  267. package/lib-prod/transignal-service.js.map +0 -1
  268. package/lib-prod/transignal-testing.d.ts +0 -8
  269. package/lib-prod/transignal-testing.js +0 -10
  270. package/lib-prod/transignal-testing.js.map +0 -1
  271. package/lib-prod/types.d.ts +0 -124
  272. package/lib-prod/types.js +0 -2
  273. package/lib-prod/types.js.map +0 -1
  274. package/lib-prod/utility-types.d.ts +0 -29
  275. package/lib-prod/utility-types.js +0 -2
  276. package/lib-prod/utility-types.js.map +0 -1
  277. package/lib-prod/utils.d.ts +0 -15
  278. package/lib-prod/utils.js +0 -15
  279. package/lib-prod/utils.js.map +0 -1
@@ -1,124 +0,0 @@
1
- import { ParamHandler } from './transignal-param-handlers';
2
- import { ArrayPaths, GetNestedType, ObjectPaths, PluralPaths, SelectPaths, StringKeys, StringPaths } from './utility-types';
3
- export type TransignalError =
4
- /** Error when key is not found in translations */
5
- 'missing_key'
6
- /** Error when translation file for scope and lang has not been found */
7
- | 'missing_file'
8
- /** Error plural for a value is not defined for a language */
9
- | 'missing_plural'
10
- /** Error when plural used on a non-plural translation */
11
- | 'invalid_plural'
12
- /** Error select for a value is not defined for a language */
13
- | 'missing_select'
14
- /** Error when select used on a non-select translation */
15
- | 'invalid_select'
16
- /** Error when prefix chain is called more then {@link TransignalConfig.maxPrefixDepth} */
17
- | 'prefix_too_deep';
18
- export type TranslateParams = Record<string, unknown>;
19
- export type Marked<K, T> = K & {
20
- __marker: T;
21
- };
22
- export type BasePluralTranslation = Partial<Record<number | 'one' | 'few' | 'many' | 'other', string>>;
23
- export type PluralTranslation = Marked<BasePluralTranslation, 'plural'>;
24
- export type BaseSelectTranslation = Partial<Record<string | number | 'null', string>>;
25
- export type MarkedAsSelect<T extends BaseSelectTranslation> = Marked<T, 'select'>;
26
- export type SelectTranslation = MarkedAsSelect<BaseSelectTranslation>;
27
- export type TranslateFn<Keys extends string, Result> = (key: Keys, params?: TranslateParams) => Result;
28
- export type TranslateObj<Context extends Record<string, any>> = TranslateFn<StringPaths<Context>, string> & {
29
- /**
30
- * Returns translating function that returns an array of translations
31
- * @param key path of translation
32
- * @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
33
- */
34
- arr: <ArrKey extends ArrayPaths<Context>>(key: ArrKey, params?: TranslateParams) => GetNestedType<Context, ArrKey>;
35
- /**
36
- * Returns translating function that returns an object of translations
37
- * @param key path of translation
38
- * @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
39
- */
40
- obj: <ObjKey extends ObjectPaths<Context>>(key: ObjKey, params?: TranslateParams) => GetNestedType<Context, ObjKey>;
41
- /**
42
- * Returns translating function that returns a string translation depending on a correct plural form
43
- * @param key path of translation
44
- * @param count count to determine correct plural form
45
- * @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
46
- */
47
- plural: <ObjKey extends PluralPaths<Context>>(key: ObjKey, count: number, params?: TranslateParams) => string;
48
- /**
49
- * Returns translating function that returns a string translation depending on a selected value
50
- * @param key path of translation
51
- * @param value value to determine selected translation
52
- * @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
53
- */
54
- select: <ObjKey extends SelectPaths<Context>>(key: ObjKey, value: keyof SelectTranslation | null, params?: TranslateParams) => string;
55
- /**
56
- * Returns translating function that is encapsulated in a selected prefix
57
- * @param prefix path of new root translation
58
- */
59
- prefix: <T extends ObjectPaths<Context>>(prefix: T) => TranslateObj<GetNestedType<Context, T>>;
60
- };
61
- export type TranslationFile = Record<string, unknown>;
62
- export type TransignalConfig<Languages extends string, Translations extends Record<string, Record<string, unknown>>> = {
63
- /**
64
- * Default language code
65
- */
66
- defaultLang: NoInfer<Languages>;
67
- /**
68
- * An array of available languages that your application supports.
69
- * These should be unique string identifiers for each language (e.g., ['en', 'fr', 'es']).
70
- */
71
- availableLangs: Languages[];
72
- /**
73
- * Defines the type of translations.
74
- * Please use helper function {@link treeShakedTranslations()}
75
- * @example
76
- * ```typescript
77
- * import type translations from './i18n/translations';
78
- * ...
79
- * translations: treeShakedTranslations<typeof translations>(),
80
- * ```
81
- */
82
- translations: Translations;
83
- /**
84
- * A function responsible for dynamically loading translation files.
85
- * This function is called when a specific translation scope and language is requested
86
- * It runs in TransignalService injection context so {@link inject()} can be used to e.g. use HttpClient
87
- *
88
- * @param scope The string key representing the translation scope (e.g., 'common', 'auth').
89
- * @param lang The language identifier for which to load translations (e.g., 'en', 'fr').
90
- * @returns A Promise that resolves to a `TranslationFile` object, which is
91
- * a record of string keys to unknown values representing the translations for
92
- * the given scope and language.
93
- */
94
- loader: (scope: StringKeys<Translations>, lang: Languages) => Promise<TranslationFile>;
95
- /**
96
- * An optional function that defines how a loading message should be displayed
97
- * while translations are being loaded.
98
- *
99
- * @param key The translation key that is currently being loaded.
100
- * @returns A string representing the loading message.
101
- */
102
- loadingFn?: (key: string) => string;
103
- /**
104
- * An optional function that defines how params should be processed
105
- * Defaults to {@link simpleParamsHandler}
106
- * Use {@link noParamsHandler} if you don't want to use params
107
- * If you want to handle message format then you can install TODO
108
- */
109
- paramHandler?: ParamHandler;
110
- /**
111
- * An optional error handler function that will be called when a `TransignalError` occurs.
112
- * This allows you to implement custom error reporting or logging.
113
- *
114
- * @param errorCode Code of an error {@link TransignalError} code that occurred.
115
- * @param args Any additional arguments relevant to the error.
116
- */
117
- errorHandler?: (errorCode: TransignalError, ...args: unknown[]) => void;
118
- /**
119
- * Defines max depth of prefix functions in {@link TranslateObj}
120
- * Defaults to 3, this means that if prefix function is used more than 3 time on the same t then it will fail
121
- * Required for performance reasons
122
- */
123
- maxPrefixDepth?: number;
124
- };
package/lib-prod/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":[""],"names":[],"mappings":""}
@@ -1,29 +0,0 @@
1
- import { Signal } from '@angular/core';
2
- import { PluralTranslation, SelectTranslation } from './types';
3
- export type GetNestedType<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? GetNestedType<T[Key], Rest> : never : P extends keyof T ? NonNullable<T[P]> : never;
4
- type DotPrefix<T extends string> = T extends '' ? '' : `.${T}`;
5
- export type Paths<T> = T extends object ? T extends Array<infer U> ? `${number}${'' | DotPrefix<Paths<U>>}` : {
6
- [K in keyof T]-?: K extends string | number ? `${K}${'' | DotPrefix<Paths<T[K]>>}` : never;
7
- }[keyof T] : '';
8
- export type ArrayPaths<T> = {
9
- [P in Paths<T>]: GetNestedType<T, P> extends Array<unknown> ? P : never;
10
- }[Paths<T>];
11
- export type ObjectPaths<T> = {
12
- [P in Paths<T>]: GetNestedType<T, P> extends Record<any, unknown> ? P : never;
13
- }[Paths<T>];
14
- export type PluralPaths<T> = {
15
- [P in Paths<T>]: GetNestedType<T, P> extends PluralTranslation ? P : never;
16
- }[Paths<T>];
17
- export type SelectPaths<T> = {
18
- [P in Paths<T>]: GetNestedType<T, P> extends SelectTranslation ? P : never;
19
- }[Paths<T>];
20
- export type StringPaths<T> = {
21
- [P in Paths<T>]: GetNestedType<T, P> extends string ? P : never;
22
- }[Paths<T>];
23
- export type StringKeys<T> = Extract<keyof T, string>;
24
- export type ResourceRefLike<T> = {
25
- value: Signal<T | undefined>;
26
- isLoading: Signal<boolean>;
27
- error: Signal<Error | undefined>;
28
- };
29
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utility-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utility-types.js","sourceRoot":"","sources":[""],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- import { BasePluralTranslation, BaseSelectTranslation, MarkedAsSelect, PluralTranslation } from './types';
2
- /**
3
- * Utility to create a plural translation that can differ between languages and includes variants of translations for different plurals
4
- * Can be used with {@link TranslateObj.plural}
5
- * Translations may use automatic param: `{count}`
6
- * @param translation plural translation object
7
- */
8
- export declare const plural: (translation: BasePluralTranslation) => PluralTranslation;
9
- /**
10
- * Utility to create a select translation
11
- * Can be used with {@link TranslateObj.select}
12
- * Translations may use automatic param: `{value}`
13
- * @param translation select translation object
14
- */
15
- export declare const select: <T extends BaseSelectTranslation>(translation: T) => MarkedAsSelect<T>;
package/lib-prod/utils.js DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * Utility to create a plural translation that can differ between languages and includes variants of translations for different plurals
3
- * Can be used with {@link TranslateObj.plural}
4
- * Translations may use automatic param: `{count}`
5
- * @param translation plural translation object
6
- */
7
- export const plural = (translation) => translation;
8
- /**
9
- * Utility to create a select translation
10
- * Can be used with {@link TranslateObj.select}
11
- * Translations may use automatic param: `{value}`
12
- * @param translation select translation object
13
- */
14
- export const select = (translation) => translation;
15
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,WAAkC,EAAqB,EAAE,CAC9E,WAAgC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAkC,WAAc,EAAE,EAAE,CACxE,WAAgC,CAAC"}