@generaltranslation/react-core 0.0.0 → 0.0.1-alpha.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 (179) hide show
  1. package/LICENSE.md +105 -0
  2. package/README.md +9 -0
  3. package/dist/branches/Branch.d.ts +34 -0
  4. package/dist/branches/Branch.d.ts.map +1 -0
  5. package/dist/branches/plurals/Plural.d.ts +38 -0
  6. package/dist/branches/plurals/Plural.d.ts.map +1 -0
  7. package/dist/branches/plurals/getPluralBranch.d.ts +9 -0
  8. package/dist/branches/plurals/getPluralBranch.d.ts.map +1 -0
  9. package/dist/dictionaries/collectUntranslatedEntries.d.ts +17 -0
  10. package/dist/dictionaries/collectUntranslatedEntries.d.ts.map +1 -0
  11. package/dist/dictionaries/getDictionaryEntry.d.ts +4 -0
  12. package/dist/dictionaries/getDictionaryEntry.d.ts.map +1 -0
  13. package/dist/dictionaries/getEntryAndMetadata.d.ts +6 -0
  14. package/dist/dictionaries/getEntryAndMetadata.d.ts.map +1 -0
  15. package/dist/dictionaries/getSubtree.d.ts +18 -0
  16. package/dist/dictionaries/getSubtree.d.ts.map +1 -0
  17. package/dist/dictionaries/indexDict.d.ts +15 -0
  18. package/dist/dictionaries/indexDict.d.ts.map +1 -0
  19. package/dist/dictionaries/injectAndMerge.d.ts +9 -0
  20. package/dist/dictionaries/injectAndMerge.d.ts.map +1 -0
  21. package/dist/dictionaries/injectEntry.d.ts +18 -0
  22. package/dist/dictionaries/injectEntry.d.ts.map +1 -0
  23. package/dist/dictionaries/injectFallbacks.d.ts +17 -0
  24. package/dist/dictionaries/injectFallbacks.d.ts.map +1 -0
  25. package/dist/dictionaries/injectHashes.d.ts +11 -0
  26. package/dist/dictionaries/injectHashes.d.ts.map +1 -0
  27. package/dist/dictionaries/injectTranslations.d.ts +20 -0
  28. package/dist/dictionaries/injectTranslations.d.ts.map +1 -0
  29. package/dist/dictionaries/isDictionaryEntry.d.ts +8 -0
  30. package/dist/dictionaries/isDictionaryEntry.d.ts.map +1 -0
  31. package/dist/dictionaries/loadDictionaryHelper.d.ts +3 -0
  32. package/dist/dictionaries/loadDictionaryHelper.d.ts.map +1 -0
  33. package/dist/dictionaries/mergeDictionaries.d.ts +3 -0
  34. package/dist/dictionaries/mergeDictionaries.d.ts.map +1 -0
  35. package/dist/dictionaries/stripMetadataFromEntries.d.ts +6 -0
  36. package/dist/dictionaries/stripMetadataFromEntries.d.ts.map +1 -0
  37. package/dist/errors-dir/constants.d.ts +2 -0
  38. package/dist/errors-dir/constants.d.ts.map +1 -0
  39. package/dist/errors-dir/createErrors.d.ts +32 -0
  40. package/dist/errors-dir/createErrors.d.ts.map +1 -0
  41. package/dist/errors-dir/internalErrors.d.ts +8 -0
  42. package/dist/errors-dir/internalErrors.d.ts.map +1 -0
  43. package/dist/errors.cjs.min.cjs +1 -0
  44. package/dist/errors.d.ts +3 -0
  45. package/dist/errors.d.ts.map +1 -0
  46. package/dist/errors.esm.min.mjs +1 -0
  47. package/dist/hooks/useDefaultLocale.d.ts +13 -0
  48. package/dist/hooks/useDefaultLocale.d.ts.map +1 -0
  49. package/dist/hooks/useGTClass.d.ts +23 -0
  50. package/dist/hooks/useGTClass.d.ts.map +1 -0
  51. package/dist/hooks/useLocale.d.ts +11 -0
  52. package/dist/hooks/useLocale.d.ts.map +1 -0
  53. package/dist/hooks/useLocaleDirection.d.ts +14 -0
  54. package/dist/hooks/useLocaleDirection.d.ts.map +1 -0
  55. package/dist/hooks/useLocaleSelector.d.ts +42 -0
  56. package/dist/hooks/useLocaleSelector.d.ts.map +1 -0
  57. package/dist/hooks/useLocales.d.ts +11 -0
  58. package/dist/hooks/useLocales.d.ts.map +1 -0
  59. package/dist/hooks/useRegion.d.ts +20 -0
  60. package/dist/hooks/useRegion.d.ts.map +1 -0
  61. package/dist/hooks/useRegionSelector.d.ts +82 -0
  62. package/dist/hooks/useRegionSelector.d.ts.map +1 -0
  63. package/dist/hooks/useSetLocale.d.ts +12 -0
  64. package/dist/hooks/useSetLocale.d.ts.map +1 -0
  65. package/dist/index.cjs.min.cjs +18 -0
  66. package/dist/index.d.ts +26 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.esm.min.mjs +18 -0
  69. package/dist/internal/addGTIdentifier.d.ts +4 -0
  70. package/dist/internal/addGTIdentifier.d.ts.map +1 -0
  71. package/dist/internal/flattenDictionary.d.ts +11 -0
  72. package/dist/internal/flattenDictionary.d.ts.map +1 -0
  73. package/dist/internal/writeChildrenAsObjects.d.ts +10 -0
  74. package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -0
  75. package/dist/internal.cjs.min.cjs +18 -0
  76. package/dist/internal.d.ts +32 -0
  77. package/dist/internal.d.ts.map +1 -0
  78. package/dist/internal.esm.min.mjs +18 -0
  79. package/dist/messages/messages.d.ts +43 -0
  80. package/dist/messages/messages.d.ts.map +1 -0
  81. package/dist/promises/dangerouslyUsable.d.ts +37 -0
  82. package/dist/promises/dangerouslyUsable.d.ts.map +1 -0
  83. package/dist/promises/reactHasUse.d.ts +2 -0
  84. package/dist/promises/reactHasUse.d.ts.map +1 -0
  85. package/dist/provider/GTContext.d.ts +4 -0
  86. package/dist/provider/GTContext.d.ts.map +1 -0
  87. package/dist/provider/GTProvider.d.ts +32 -0
  88. package/dist/provider/GTProvider.d.ts.map +1 -0
  89. package/dist/provider/config/defaultProps.d.ts +4 -0
  90. package/dist/provider/config/defaultProps.d.ts.map +1 -0
  91. package/dist/provider/helpers/isSSREnabled.d.ts +5 -0
  92. package/dist/provider/helpers/isSSREnabled.d.ts.map +1 -0
  93. package/dist/provider/helpers/validateString.d.ts +6 -0
  94. package/dist/provider/helpers/validateString.d.ts.map +1 -0
  95. package/dist/provider/hooks/locales/types.d.ts +11 -0
  96. package/dist/provider/hooks/locales/types.d.ts.map +1 -0
  97. package/dist/provider/hooks/locales/useDetermineLocale.d.ts +6 -0
  98. package/dist/provider/hooks/locales/useDetermineLocale.d.ts.map +1 -0
  99. package/dist/provider/hooks/locales/useLocaleState.d.ts +18 -0
  100. package/dist/provider/hooks/locales/useLocaleState.d.ts.map +1 -0
  101. package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts +18 -0
  102. package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts.map +1 -0
  103. package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts +4 -0
  104. package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts.map +1 -0
  105. package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts +4 -0
  106. package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts.map +1 -0
  107. package/dist/provider/hooks/types.d.ts +10 -0
  108. package/dist/provider/hooks/types.d.ts.map +1 -0
  109. package/dist/provider/hooks/useErrorChecks.d.ts +9 -0
  110. package/dist/provider/hooks/useErrorChecks.d.ts.map +1 -0
  111. package/dist/provider/hooks/useLoadDictionary.d.ts +15 -0
  112. package/dist/provider/hooks/useLoadDictionary.d.ts.map +1 -0
  113. package/dist/provider/hooks/useLoadTranslations.d.ts +17 -0
  114. package/dist/provider/hooks/useLoadTranslations.d.ts.map +1 -0
  115. package/dist/provider/hooks/useRegionState.d.ts +6 -0
  116. package/dist/provider/hooks/useRegionState.d.ts.map +1 -0
  117. package/dist/provider/hooks/useRuntimeTranslation.d.ts +23 -0
  118. package/dist/provider/hooks/useRuntimeTranslation.d.ts.map +1 -0
  119. package/dist/rendering/defaultRenderSettings.d.ts +6 -0
  120. package/dist/rendering/defaultRenderSettings.d.ts.map +1 -0
  121. package/dist/rendering/getGTTag.d.ts +3 -0
  122. package/dist/rendering/getGTTag.d.ts.map +1 -0
  123. package/dist/rendering/isVariableObject.d.ts +3 -0
  124. package/dist/rendering/isVariableObject.d.ts.map +1 -0
  125. package/dist/rendering/renderDefaultChildren.d.ts +8 -0
  126. package/dist/rendering/renderDefaultChildren.d.ts.map +1 -0
  127. package/dist/rendering/renderSkeleton.d.ts +8 -0
  128. package/dist/rendering/renderSkeleton.d.ts.map +1 -0
  129. package/dist/rendering/renderTranslatedChildren.d.ts +9 -0
  130. package/dist/rendering/renderTranslatedChildren.d.ts.map +1 -0
  131. package/dist/rendering/renderVariable.d.ts +4 -0
  132. package/dist/rendering/renderVariable.d.ts.map +1 -0
  133. package/dist/translation/hooks/useGT.d.ts +20 -0
  134. package/dist/translation/hooks/useGT.d.ts.map +1 -0
  135. package/dist/translation/hooks/useMessages.d.ts +19 -0
  136. package/dist/translation/hooks/useMessages.d.ts.map +1 -0
  137. package/dist/translation/hooks/useTranslations.d.ts +17 -0
  138. package/dist/translation/hooks/useTranslations.d.ts.map +1 -0
  139. package/dist/translation/inline/T.d.ts +42 -0
  140. package/dist/translation/inline/T.d.ts.map +1 -0
  141. package/dist/types-dir/config.d.ts +50 -0
  142. package/dist/types-dir/config.d.ts.map +1 -0
  143. package/dist/types-dir/context.d.ts +30 -0
  144. package/dist/types-dir/context.d.ts.map +1 -0
  145. package/dist/types-dir/runtime.d.ts +20 -0
  146. package/dist/types-dir/runtime.d.ts.map +1 -0
  147. package/dist/types-dir/types.d.ts +90 -0
  148. package/dist/types-dir/types.d.ts.map +1 -0
  149. package/dist/types.d.ts +214 -0
  150. package/dist/types.d.ts.map +1 -0
  151. package/dist/ui/LocaleSelector.d.ts +7 -0
  152. package/dist/ui/LocaleSelector.d.ts.map +1 -0
  153. package/dist/ui/RegionSelector.d.ts +7 -0
  154. package/dist/ui/RegionSelector.d.ts.map +1 -0
  155. package/dist/ui/types.d.ts +18 -0
  156. package/dist/ui/types.d.ts.map +1 -0
  157. package/dist/utils/cookies.d.ts +9 -0
  158. package/dist/utils/cookies.d.ts.map +1 -0
  159. package/dist/utils/fetchTranslations.d.ts +9 -0
  160. package/dist/utils/fetchTranslations.d.ts.map +1 -0
  161. package/dist/utils/types.d.ts +9 -0
  162. package/dist/utils/types.d.ts.map +1 -0
  163. package/dist/utils/utils.d.ts +8 -0
  164. package/dist/utils/utils.d.ts.map +1 -0
  165. package/dist/variables/Currency.d.ts +30 -0
  166. package/dist/variables/Currency.d.ts.map +1 -0
  167. package/dist/variables/DateTime.d.ts +29 -0
  168. package/dist/variables/DateTime.d.ts.map +1 -0
  169. package/dist/variables/Num.d.ts +31 -0
  170. package/dist/variables/Num.d.ts.map +1 -0
  171. package/dist/variables/Var.d.ts +32 -0
  172. package/dist/variables/Var.d.ts.map +1 -0
  173. package/dist/variables/_getVariableProps.d.ts +11 -0
  174. package/dist/variables/_getVariableProps.d.ts.map +1 -0
  175. package/dist/variables/getVariableName.d.ts +10 -0
  176. package/dist/variables/getVariableName.d.ts.map +1 -0
  177. package/package.json +109 -14
  178. package/index.d.ts +0 -4
  179. package/index.js +0 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useErrorChecks.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useErrorChecks.ts"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,OAAO,GACR,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,QAsDA"}
@@ -0,0 +1,15 @@
1
+ import { CustomLoader } from '../../types-dir/types';
2
+ import { Dictionary } from '../../types-dir/types';
3
+ export declare function useLoadDictionary({ _dictionary, _dictionaryTranslations, loadDictionary, locale, defaultLocale, }: {
4
+ _dictionary: Dictionary | undefined;
5
+ _dictionaryTranslations: Dictionary | undefined;
6
+ loadDictionary: CustomLoader | undefined;
7
+ locale: string;
8
+ defaultLocale: string;
9
+ }): {
10
+ dictionary: Dictionary | undefined;
11
+ setDictionary: import("react").Dispatch<import("react").SetStateAction<Dictionary | undefined>>;
12
+ dictionaryTranslations: Dictionary | undefined;
13
+ setDictionaryTranslations: import("react").Dispatch<import("react").SetStateAction<Dictionary | undefined>>;
14
+ };
15
+ //# sourceMappingURL=useLoadDictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoadDictionary.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useLoadDictionary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,uBAA4B,EAC5B,cAAc,EACd,MAAM,EACN,aAAa,GACd,EAAE;IACD,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,uBAAuB,EAAE,UAAU,GAAG,SAAS,CAAC;IAChD,cAAc,EAAE,YAAY,GAAG,SAAS,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;;;;;EAoDA"}
@@ -0,0 +1,17 @@
1
+ import { CustomLoader, Translations } from '../../types-dir/types';
2
+ import { GT } from 'generaltranslation';
3
+ export declare function useLoadTranslations({ _translations, translationRequired, loadTranslationsType, loadTranslations, locale, cacheUrl, projectId, _versionId, gt, }: {
4
+ _translations: Translations | null;
5
+ translationRequired: boolean;
6
+ loadTranslationsType: string;
7
+ loadTranslations?: CustomLoader;
8
+ locale: string;
9
+ cacheUrl: string;
10
+ projectId: string;
11
+ _versionId?: string;
12
+ gt: GT;
13
+ }): {
14
+ translations: Translations | null;
15
+ setTranslations: import("react").Dispatch<import("react").SetStateAction<Translations | null>>;
16
+ };
17
+ //# sourceMappingURL=useLoadTranslations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoadTranslations.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useLoadTranslations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,SAAS,EACT,UAAU,EACV,EAAE,GACH,EAAE;IACD,aAAa,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,EAAE,CAAC;CACR;;;EA4FA"}
@@ -0,0 +1,6 @@
1
+ import { UseRegionStateParams, UseRegionStateReturn } from './types';
2
+ /**
3
+ * @deprecated - this function is to always be overridden by a wrapper react package
4
+ */
5
+ export declare function useRegionState({}: UseRegionStateParams): UseRegionStateReturn;
6
+ //# sourceMappingURL=useRegionState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRegionState.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useRegionState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAErE;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,oBAAoB,GAAG,oBAAoB,CAE7E"}
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { RenderMethod, Translations } from '../../types-dir/types';
3
+ import { TranslateIcuCallback, TranslateChildrenCallback } from '../../types-dir/runtime';
4
+ import { GT } from 'generaltranslation';
5
+ export default function useRuntimeTranslation({ gt, locale, versionId, // kept for API compatibility (not used)
6
+ defaultLocale, runtimeUrl, renderSettings, setTranslations, ...additionalMetadata }: {
7
+ gt: GT;
8
+ locale: string;
9
+ versionId?: string;
10
+ defaultLocale?: string;
11
+ runtimeUrl?: string | null;
12
+ renderSettings: {
13
+ method: RenderMethod;
14
+ timeout?: number;
15
+ };
16
+ setTranslations: React.Dispatch<React.SetStateAction<Translations | null>>;
17
+ [key: string]: any;
18
+ }): {
19
+ registerIcuForTranslation: TranslateIcuCallback;
20
+ registerJsxForTranslation: TranslateChildrenCallback;
21
+ developmentApiEnabled: boolean;
22
+ };
23
+ //# sourceMappingURL=useRuntimeTranslation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRuntimeTranslation.d.ts","sourceRoot":"","sources":["../../../src/provider/hooks/useRuntimeTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,YAAY,EAEZ,YAAY,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAwBxC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,EAAE,EACF,MAAM,EACN,SAAS,EAAE,wCAAwC;AACnD,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,GAAG,kBAAkB,EACtB,EAAE;IACD,EAAE,EAAE,EAAE,CAAC;IACP,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE;QACd,MAAM,EAAE,YAAY,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG;IACF,yBAAyB,EAAE,oBAAoB,CAAC;IAChD,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,qBAAqB,EAAE,OAAO,CAAC;CAChC,CA+TA"}
@@ -0,0 +1,6 @@
1
+ import { RenderMethod } from '../types-dir/types';
2
+ export declare const defaultRenderSettings: {
3
+ method: RenderMethod;
4
+ timeout: number;
5
+ };
6
+ //# sourceMappingURL=defaultRenderSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultRenderSettings.d.ts","sourceRoot":"","sources":["../../src/rendering/defaultRenderSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD,eAAO,MAAM,qBAAqB,EAAE;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CAIR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TaggedElement, GTTag } from '../types-dir/types';
2
+ export default function getGTTag(child: TaggedElement): GTTag | null;
3
+ //# sourceMappingURL=getGTTag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGTTag.d.ts","sourceRoot":"","sources":["../../src/rendering/getGTTag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,GAAG,IAAI,CAKnE"}
@@ -0,0 +1,3 @@
1
+ import { Variable } from 'generaltranslation/types';
2
+ export default function isVariableObject(obj: unknown): obj is Variable;
3
+ //# sourceMappingURL=isVariableObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isVariableObject.d.ts","sourceRoot":"","sources":["../../src/rendering/isVariableObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ,CAsBtE"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { RenderVariable, TaggedChildren } from '../types-dir/types';
3
+ export default function renderDefaultChildren({ children, defaultLocale, renderVariable, }: {
4
+ children: TaggedChildren;
5
+ defaultLocale: string;
6
+ renderVariable: RenderVariable;
7
+ }): React.ReactNode;
8
+ //# sourceMappingURL=renderDefaultChildren.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderDefaultChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderDefaultChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,EACL,cAAc,EAEd,cAAc,EAEf,MAAM,oBAAoB,CAAC;AAG5B,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,QAAQ,EACR,aAAoC,EACpC,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,KAAK,CAAC,SAAS,CAqElB"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /**
3
+ * renderSkeleton is a function that handles the rendering behavior for the skeleton loading method.
4
+ * It replaces all content with empty strings
5
+ * @returns an empty string
6
+ */
7
+ export default function renderSkeleton(): React.ReactNode;
8
+ //# sourceMappingURL=renderSkeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderSkeleton.d.ts","sourceRoot":"","sources":["../../src/rendering/renderSkeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,KAAK,CAAC,SAAS,CAExD"}
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { TaggedChildren, TranslatedChildren, RenderVariable } from '../types-dir/types';
3
+ export default function renderTranslatedChildren({ source, target, locales, renderVariable, }: {
4
+ source: TaggedChildren;
5
+ target: TranslatedChildren;
6
+ locales: string[];
7
+ renderVariable: RenderVariable;
8
+ }): ReactNode;
9
+ //# sourceMappingURL=renderTranslatedChildren.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderTranslatedChildren.d.ts","sourceRoot":"","sources":["../../src/rendering/renderTranslatedChildren.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EACL,cAAc,EAEd,kBAAkB,EAClB,cAAc,EAEf,MAAM,oBAAoB,CAAC;AA+G5B,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,MAAM,EACN,MAAM,EACN,OAAgC,EAChC,cAAc,GACf,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,SAAS,CAgIZ"}
@@ -0,0 +1,4 @@
1
+ import { RenderVariable } from '../types-dir/types';
2
+ declare const renderVariable: RenderVariable;
3
+ export default renderVariable;
4
+ //# sourceMappingURL=renderVariable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderVariable.d.ts","sourceRoot":"","sources":["../../src/rendering/renderVariable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,QAAA,MAAM,cAAc,EAAE,cAarB,CAAC;AACF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { _Messages } from '../../types-dir/types';
2
+ /**
3
+ * Gets the translation function `gt` provided by `<GTProvider>`.
4
+ *
5
+ * @returns {Function} A translation function that accepts an ICU message format string and returns the translation of that string.
6
+ *
7
+ * @example
8
+ * const gt = useGT();
9
+ * console.log(gt('To be or not to be...'));
10
+ *
11
+ * @example
12
+ * const gt = useGT();
13
+ * gt('My name is {customName}', { customName: "Brian", id: 'my-name', context: 'a proper noun' } )
14
+ */
15
+ export default function useGT(_messages?: _Messages): (string: string, options?: Record<string, any> & {
16
+ $id?: string;
17
+ $context?: string;
18
+ $_hash?: string;
19
+ }) => string;
20
+ //# sourceMappingURL=useGT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGT.d.ts","sourceRoot":"","sources":["../../../src/translation/hooks/useGT.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAgB,MAAM,uBAAuB,CAAC;AAKhE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,YAmCvC,MAAM,YACL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KACA,MAAM,CAmBV"}
@@ -0,0 +1,19 @@
1
+ import { _Messages } from '../../types-dir/types';
2
+ import { MFunctionType } from '../../types-dir/types';
3
+ /**
4
+ * Gets the message decoding and translation function `m` provided by `<GTProvider>`.
5
+ *
6
+ * @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
7
+ *
8
+ * @example
9
+ * const encodedMessage = msg("Hello, world")
10
+ * const m = useMessages();
11
+ * m(encodedMessage) // returns "Hello, world" translated
12
+ *
13
+ * @example
14
+ * const encodedMessage = msg("My name is {name}", { name: "Brian" });
15
+ * const m = useMessages();
16
+ * m(encodedMessage) // returns "My name is Brian" translated
17
+ */
18
+ export default function useMessages(_messages?: _Messages): MFunctionType;
19
+ //# sourceMappingURL=useMessages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMessages.d.ts","sourceRoot":"","sources":["../../../src/translation/hooks/useMessages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAgB,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,aAAa,CA4DxE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Gets the dictionary access function `t` provided by `<GTProvider>`.
3
+ *
4
+ * @param {string} [id] - Optional prefix to prepend to the translation keys.
5
+ * @returns {Function} A translation function that accepts a key string and returns the translated value.
6
+ *
7
+ * @example
8
+ * const t = useTranslations('user');
9
+ * console.log(t('name')); // Translates item 'user.name'
10
+ *
11
+ * const t = useTranslations();
12
+ * console.log(t('hello')); // Translates item 'hello'
13
+ */
14
+ export default function useTranslations(id?: string): ((id: string, options?: Record<string, any>) => string) & {
15
+ obj: (id: string, options?: Record<string, any>) => any | undefined;
16
+ };
17
+ //# sourceMappingURL=useTranslations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTranslations.d.ts","sourceRoot":"","sources":["../../../src/translation/hooks/useTranslations.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,CACrD,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAAM,CAAC,GAAG;IACb,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,GAAG,SAAS,CAAC;CACrE,CAgDA"}
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ /**
3
+ * Build-time translation component that renders its children in the user's given locale.
4
+ *
5
+ * @example
6
+ * ```jsx
7
+ * // Basic usage:
8
+ * <T id="welcome_message">
9
+ * Hello, <Var>{name}</Var>!
10
+ * </T>
11
+ * ```
12
+ *
13
+ * @example
14
+ * ```jsx
15
+ * // Translating a plural
16
+ * <T id="item_count">
17
+ * <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>
18
+ * You have <Num children={n}/> items.
19
+ * </Plural>
20
+ * </T>
21
+ * ```
22
+ *
23
+ * @param {React.ReactNode} children - The content to be translated or displayed.
24
+ * @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.
25
+ * @param {any} [context] - Additional context for translation key generation.
26
+ *
27
+ * @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.
28
+ *
29
+ * @throws {Error} If a plural translation is requested but the `n` option is not provided.
30
+ */
31
+ declare function T({ children, id, context, _hash, ...options }: {
32
+ children: any;
33
+ id?: string;
34
+ context?: string;
35
+ _hash?: string;
36
+ [key: string]: any;
37
+ }): React.JSX.Element | undefined;
38
+ declare namespace T {
39
+ var _gtt: string;
40
+ }
41
+ export default T;
42
+ //# sourceMappingURL=T.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"T.d.ts","sourceRoot":"","sources":["../../../src/translation/inline/T.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAgBnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,CAAC,CAAC,EACT,QAAQ,EACR,EAAE,EACF,OAAO,EACP,KAAK,EACL,GAAG,OAAO,EACX,EAAE;IACD,QAAQ,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,SAAS,CAiKhC;kBA7KQ,CAAC;;;AAiLV,eAAe,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { RenderMethod } from './types';
3
+ import { Translations, CustomLoader } from './types';
4
+ import { CustomMapping } from 'generaltranslation/types';
5
+ export type GTConfig = {
6
+ projectId?: string;
7
+ devApiKey?: string;
8
+ locales?: string[];
9
+ defaultLocale?: string;
10
+ dictionary?: string;
11
+ runtimeUrl?: string;
12
+ cacheUrl?: string;
13
+ renderSettings?: {
14
+ method: RenderMethod;
15
+ timeout?: number;
16
+ };
17
+ _versionId?: string;
18
+ ssr?: boolean;
19
+ localeCookieName?: string;
20
+ customMapping?: CustomMapping;
21
+ modelProvider?: string;
22
+ };
23
+ export type GTProviderProps = {
24
+ children?: React.ReactNode;
25
+ projectId?: string;
26
+ devApiKey?: string;
27
+ dictionary?: any;
28
+ locales?: string[];
29
+ defaultLocale?: string;
30
+ locale?: string;
31
+ region?: string;
32
+ cacheUrl?: string;
33
+ runtimeUrl?: string;
34
+ renderSettings?: {
35
+ method: RenderMethod;
36
+ timeout?: number;
37
+ };
38
+ _versionId?: string;
39
+ ssr?: boolean;
40
+ localeCookieName?: string;
41
+ translations?: Translations | null;
42
+ loadDictionary?: CustomLoader;
43
+ loadTranslations?: CustomLoader;
44
+ config?: GTConfig;
45
+ fallback?: React.ReactNode;
46
+ customMapping?: CustomMapping;
47
+ modelProvider?: string;
48
+ [key: string]: any;
49
+ };
50
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types-dir/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,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YAAY,CAAC;IAChC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Translations, RenderMethod, InlineTranslationOptions, DictionaryTranslationOptions, _Messages, Dictionary, DictionaryEntry } from './types';
2
+ import { TranslateIcuCallback, TranslateChildrenCallback } from './runtime';
3
+ import { GT } from 'generaltranslation';
4
+ export type GTContextType = {
5
+ gt: GT;
6
+ registerIcuForTranslation: TranslateIcuCallback;
7
+ registerJsxForTranslation: TranslateChildrenCallback;
8
+ _tFunction: (message: string, options?: InlineTranslationOptions, preloadedTranslations?: Translations) => string;
9
+ _mFunction: <T extends string | null | undefined>(encodedMsg: T, options?: Record<string, any>, preloadedTranslations?: Translations) => T extends string ? string : T;
10
+ _filterMessagesForPreload: (_messages: _Messages) => _Messages;
11
+ _preloadMessages: (_messages: _Messages) => Promise<Translations>;
12
+ _dictionaryFunction: (id: string, options?: DictionaryTranslationOptions) => string;
13
+ _dictionaryObjFunction: (id: string, idWithParent: string, options?: DictionaryTranslationOptions) => Dictionary | DictionaryEntry | string | undefined;
14
+ developmentApiEnabled: boolean;
15
+ locale: string;
16
+ locales: string[];
17
+ setLocale: (locale: string) => void;
18
+ defaultLocale: string;
19
+ region: string | undefined;
20
+ setRegion: (region: string | undefined) => void;
21
+ translations: Translations | null;
22
+ translationRequired: boolean;
23
+ dialectTranslationRequired: boolean;
24
+ renderSettings: {
25
+ method: RenderMethod;
26
+ timeout?: number;
27
+ };
28
+ projectId?: string;
29
+ };
30
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types-dir/context.ts"],"names":[],"mappings":"AAAA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AE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,0BAA0B,EAAE,OAAO,CAAC;IACpC,cAAc,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { JsxChildren } from 'generaltranslation/types';
2
+ import { TranslatedChildren } from './types';
3
+ export type TranslateIcuCallback = (params: {
4
+ source: string;
5
+ targetLocale: string;
6
+ metadata: {
7
+ hash: string;
8
+ context?: string;
9
+ } & Record<string, any>;
10
+ }) => Promise<TranslatedChildren>;
11
+ export type TranslateI18nextCallback = TranslateIcuCallback;
12
+ export type TranslateChildrenCallback = (params: {
13
+ source: JsxChildren | undefined;
14
+ targetLocale: string;
15
+ metadata: {
16
+ hash: string;
17
+ context?: string;
18
+ } & Record<string, any>;
19
+ }) => Promise<TranslatedChildren>;
20
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/types-dir/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpE,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAElC,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE5D,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE;IAC/C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpE,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { Variable, VariableTransformationSuffix, TransformationPrefix, GTProp, VariableType } from 'generaltranslation/types';
2
+ import React from 'react';
3
+ /**
4
+ * TaggedElement is a React element with a GTProp property.
5
+ */
6
+ export type GTTag = {
7
+ id: number;
8
+ transformation?: TransformationPrefix;
9
+ branches?: Record<string, TaggedChildren>;
10
+ variableType?: VariableTransformationSuffix;
11
+ };
12
+ export type TaggedElementProps = Record<string, any> & {
13
+ 'data-_gt': GTTag;
14
+ };
15
+ export type TaggedElement = React.ReactElement<TaggedElementProps>;
16
+ export type TaggedChild = Exclude<React.ReactNode, React.ReactElement> | TaggedElement;
17
+ export type TaggedChildren = TaggedChild[] | TaggedChild;
18
+ /**
19
+ * For dictionaries, we have Entry and MetaEntry
20
+ */
21
+ export type Entry = string;
22
+ export type MetaEntry = {
23
+ $context?: string;
24
+ $_hash?: string;
25
+ [key: string]: unknown;
26
+ };
27
+ export type DictionaryEntry = Entry | [Entry] | [Entry, MetaEntry];
28
+ export type Dictionary = {
29
+ [key: string]: Dictionary | DictionaryEntry;
30
+ } | (Dictionary | DictionaryEntry)[];
31
+ export type FlattenedDictionary = {
32
+ [key: string]: DictionaryEntry;
33
+ };
34
+ /**
35
+ * Translated content types
36
+ */
37
+ export type TranslatedElement = {
38
+ i?: number;
39
+ d?: GTProp;
40
+ c?: TranslatedChildren;
41
+ };
42
+ export type TranslatedChild = TranslatedElement | string | Variable;
43
+ export type TranslatedChildren = TranslatedChild | TranslatedChild[];
44
+ export type Translations = {
45
+ [hash: string]: TranslatedChildren | null;
46
+ };
47
+ /**
48
+ * @deprecated use {@link Dictionary}
49
+ */
50
+ export type DictionaryContent = string;
51
+ /**
52
+ * @deprecated use {@link Dictionary}
53
+ */
54
+ export type DictionaryObject = {
55
+ [id: string]: DictionaryContent;
56
+ };
57
+ export type LocalesDictionary = {
58
+ [locale: string]: DictionaryObject;
59
+ };
60
+ export type CustomLoader = (locale: string) => Promise<any>;
61
+ export type RenderMethod = 'skeleton' | 'replace' | 'default';
62
+ export type DictionaryTranslationOptions = Record<string, any>;
63
+ export type InlineTranslationOptions = DictionaryTranslationOptions & {
64
+ $context?: string;
65
+ $id?: string;
66
+ $_hash?: string;
67
+ $_source?: string;
68
+ };
69
+ export type RuntimeTranslationOptions = {
70
+ locale?: string;
71
+ } & Omit<InlineTranslationOptions, 'id'>;
72
+ export type VariableProps = {
73
+ variableType: VariableType;
74
+ variableValue: any;
75
+ variableOptions: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions;
76
+ variableName: string;
77
+ };
78
+ export type RenderVariable = ({ variableType, variableValue, variableOptions, locales, }: Omit<VariableProps, 'variableName'> & {
79
+ locales: string[];
80
+ }) => React.JSX.Element;
81
+ export type _Message = {
82
+ message: string;
83
+ $id?: string;
84
+ $context?: string;
85
+ $_hash?: string;
86
+ };
87
+ export type _Messages = _Message[];
88
+ export type MFunctionType = <T extends string | null | undefined>(encodedMsg: T, options?: Record<string, any>) => T extends string ? string : T;
89
+ export type TFunctionType = (message: string, options?: InlineTranslationOptions) => string;
90
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../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