@tolgee/core 4.9.2 → 4.9.3-rc.04b22e6.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 (288) hide show
  1. package/dist/tolgee.cjs.js +1277 -7023
  2. package/dist/tolgee.cjs.js.map +1 -1
  3. package/dist/tolgee.cjs.min.js +1 -1
  4. package/dist/tolgee.cjs.min.js.map +1 -1
  5. package/dist/tolgee.esm.js +1407 -0
  6. package/dist/tolgee.esm.js.map +1 -0
  7. package/dist/tolgee.esm.min.mjs +1 -1
  8. package/dist/tolgee.esm.min.mjs.map +1 -1
  9. package/dist/tolgee.umd.js +1277 -7023
  10. package/dist/tolgee.umd.js.map +1 -1
  11. package/dist/tolgee.umd.min.js +1 -1
  12. package/dist/tolgee.umd.min.js.map +1 -1
  13. package/lib/Controller/Cache/Cache.d.ts +22 -0
  14. package/lib/Controller/Cache/helpers.d.ts +4 -0
  15. package/lib/Controller/Controller.d.ts +110 -0
  16. package/lib/Controller/Events/EventEmitter.d.ts +6 -0
  17. package/lib/Controller/Events/EventEmitterSelective.d.ts +7 -0
  18. package/lib/Controller/Events/Events.d.ts +14 -0
  19. package/lib/Controller/Plugins/Plugins.d.ts +36 -0
  20. package/lib/Controller/State/State.d.ts +39 -0
  21. package/lib/Controller/State/helpers.d.ts +6 -0
  22. package/lib/Controller/State/initObserverOptions.d.ts +13 -0
  23. package/lib/Controller/State/initState.d.ts +47 -0
  24. package/lib/Controller/ValueObserver.d.ts +5 -0
  25. package/lib/FormatSimple/FormatError.d.ts +7 -0
  26. package/lib/FormatSimple/FormatSimple.d.ts +3 -0
  27. package/lib/FormatSimple/formatParser.d.ts +1 -0
  28. package/lib/FormatSimple/formatter.d.ts +2 -0
  29. package/lib/Tolgee.d.ts +2 -68
  30. package/lib/TranslateParams.d.ts +2 -0
  31. package/lib/{Constants/Global.d.ts → constants.d.ts} +1 -3
  32. package/lib/helpers.d.ts +3 -0
  33. package/lib/index.d.ts +4 -8
  34. package/lib/types.d.ts +244 -84
  35. package/package.json +21 -29
  36. package/src/Controller/Cache/Cache.ts +296 -0
  37. package/src/Controller/Cache/helpers.ts +37 -0
  38. package/src/Controller/Controller.ts +310 -0
  39. package/src/Controller/Events/EventEmitter.ts +30 -0
  40. package/src/Controller/Events/EventEmitterSelective.test.ts +125 -0
  41. package/src/Controller/Events/EventEmitterSelective.ts +188 -0
  42. package/src/Controller/Events/Events.ts +66 -0
  43. package/src/Controller/Plugins/Plugins.ts +315 -0
  44. package/src/Controller/State/State.ts +175 -0
  45. package/src/Controller/State/helpers.ts +41 -0
  46. package/src/Controller/State/initObserverOptions.ts +38 -0
  47. package/src/Controller/State/initState.ts +81 -0
  48. package/src/Controller/ValueObserver.ts +26 -0
  49. package/src/FormatSimple/FormatError.ts +26 -0
  50. package/src/FormatSimple/FormatSimple.ts +13 -0
  51. package/src/FormatSimple/formatParser.ts +133 -0
  52. package/src/FormatSimple/formatter.test.ts +190 -0
  53. package/src/FormatSimple/formatter.ts +19 -0
  54. package/src/Tolgee.ts +79 -330
  55. package/src/TranslateParams.test.ts +41 -0
  56. package/src/TranslateParams.ts +51 -0
  57. package/src/__test/backend.test.ts +48 -0
  58. package/src/__test/cache.test.ts +148 -0
  59. package/src/__test/client.test.ts +48 -0
  60. package/src/__test/events.test.ts +33 -0
  61. package/src/__test/format.simple.test.ts +26 -0
  62. package/src/__test/initialization.test.ts +85 -0
  63. package/src/__test/jest-setup.ts +2 -0
  64. package/src/__test/languageDetection.test.ts +129 -0
  65. package/src/__test/languageStorage.test.ts +145 -0
  66. package/src/__test/languages.test.ts +112 -0
  67. package/src/__test/loading.test.ts +39 -0
  68. package/src/__test/namespaces.test.ts +99 -0
  69. package/src/__test/namespacesFallback.test.ts +74 -0
  70. package/src/__test/plugins.test.ts +136 -0
  71. package/src/__test/testTools.ts +7 -0
  72. package/src/{Constants/Global.ts → constants.ts} +1 -6
  73. package/src/helpers.ts +17 -0
  74. package/src/index.ts +9 -8
  75. package/src/types.ts +338 -90
  76. package/README.md +0 -45
  77. package/dist/Constants/Global.d.ts +0 -6
  78. package/dist/Constants/ModifierKey.d.ts +0 -6
  79. package/dist/Errors/ApiHttpError.d.ts +0 -5
  80. package/dist/Observer.d.ts +0 -14
  81. package/dist/Observer.test.d.ts +0 -2
  82. package/dist/Properties.d.ts +0 -17
  83. package/dist/Properties.test.d.ts +0 -1
  84. package/dist/Tolgee.d.ts +0 -68
  85. package/dist/Tolgee.test.d.ts +0 -1
  86. package/dist/TolgeeConfig.d.ts +0 -69
  87. package/dist/TolgeeConfig.test.d.ts +0 -1
  88. package/dist/__integration/FormatterIcu.test.d.ts +0 -1
  89. package/dist/__integration/FormatterMissing.d.ts +0 -1
  90. package/dist/__integration/Tolgee.test.d.ts +0 -1
  91. package/dist/__integration/TolgeeInvisible.test.d.ts +0 -1
  92. package/dist/__integration/mockTranslations.d.ts +0 -7
  93. package/dist/__integration/testConfig.d.ts +0 -9
  94. package/dist/__testFixtures/classMock.d.ts +0 -3
  95. package/dist/__testFixtures/createElement.d.ts +0 -2
  96. package/dist/__testFixtures/createTestDom.d.ts +0 -9
  97. package/dist/__testFixtures/mocked.d.ts +0 -20
  98. package/dist/__testFixtures/setupAfterEnv.d.ts +0 -8
  99. package/dist/helpers/NodeHelper.d.ts +0 -14
  100. package/dist/helpers/TextHelper.d.ts +0 -5
  101. package/dist/helpers/TextHelper.test.d.ts +0 -1
  102. package/dist/helpers/commonTypes.d.ts +0 -2
  103. package/dist/helpers/encoderPolyfill.d.ts +0 -8
  104. package/dist/helpers/secret.d.ts +0 -6
  105. package/dist/helpers/secret.test.d.ts +0 -1
  106. package/dist/helpers/sleep.d.ts +0 -1
  107. package/dist/highlighter/HighlightFunctionsInitializer.d.ts +0 -10
  108. package/dist/highlighter/HighlightFunctionsInitializer.test.d.ts +0 -1
  109. package/dist/highlighter/MouseEventHandler.d.ts +0 -29
  110. package/dist/highlighter/MouseEventHandler.test.d.ts +0 -1
  111. package/dist/highlighter/TranslationHighlighter.d.ts +0 -14
  112. package/dist/highlighter/TranslationHighlighter.test.d.ts +0 -1
  113. package/dist/index.d.ts +0 -10
  114. package/dist/internal.d.ts +0 -2
  115. package/dist/modules/IcuFormatter.d.ts +0 -2
  116. package/dist/modules/IcuFormatter.test.d.ts +0 -1
  117. package/dist/modules/index.d.ts +0 -1
  118. package/dist/services/ApiHttpService.d.ts +0 -15
  119. package/dist/services/CoreService.d.ts +0 -18
  120. package/dist/services/CoreService.test.d.ts +0 -1
  121. package/dist/services/DependencyService.d.ts +0 -39
  122. package/dist/services/DependencyService.test.d.ts +0 -1
  123. package/dist/services/ElementRegistrar.d.ts +0 -19
  124. package/dist/services/ElementRegistrar.test.d.ts +0 -1
  125. package/dist/services/EventEmitter.d.ts +0 -13
  126. package/dist/services/EventService.d.ts +0 -9
  127. package/dist/services/ModuleService.d.ts +0 -5
  128. package/dist/services/ScreenshotService.d.ts +0 -15
  129. package/dist/services/Subscription.d.ts +0 -5
  130. package/dist/services/TextService.d.ts +0 -14
  131. package/dist/services/TextService.test.d.ts +0 -1
  132. package/dist/services/TranslationService.d.ts +0 -75
  133. package/dist/services/TranslationService.test.d.ts +0 -1
  134. package/dist/services/__mocks__/CoreService.d.ts +0 -2
  135. package/dist/tolgee.esm.mjs +0 -7150
  136. package/dist/tolgee.esm.mjs.map +0 -1
  137. package/dist/toolsManager/Messages.d.ts +0 -8
  138. package/dist/toolsManager/Messages.test.d.ts +0 -1
  139. package/dist/toolsManager/PluginManager.d.ts +0 -21
  140. package/dist/toolsManager/PluginManager.test.d.ts +0 -1
  141. package/dist/types/DTOs.d.ts +0 -20
  142. package/dist/types/apiSchema.generated.d.ts +0 -6185
  143. package/dist/types.d.ts +0 -123
  144. package/dist/wrappers/AbstractWrapper.d.ts +0 -8
  145. package/dist/wrappers/NodeHandler.d.ts +0 -18
  146. package/dist/wrappers/WrappedHandler.d.ts +0 -8
  147. package/dist/wrappers/invisible/AttributeHandler.d.ts +0 -8
  148. package/dist/wrappers/invisible/Coder.d.ts +0 -7
  149. package/dist/wrappers/invisible/ContentHandler.d.ts +0 -6
  150. package/dist/wrappers/invisible/CoreHandler.d.ts +0 -10
  151. package/dist/wrappers/invisible/InvisibleWrapper.d.ts +0 -18
  152. package/dist/wrappers/invisible/ValueMemory.d.ts +0 -5
  153. package/dist/wrappers/invisible/ValueMemory.test.d.ts +0 -1
  154. package/dist/wrappers/text/AttributeHandler.d.ts +0 -8
  155. package/dist/wrappers/text/AttributeHandler.test.d.ts +0 -1
  156. package/dist/wrappers/text/Coder.d.ts +0 -15
  157. package/dist/wrappers/text/Coder.test.d.ts +0 -1
  158. package/dist/wrappers/text/ContentHandler.d.ts +0 -8
  159. package/dist/wrappers/text/ContentHandler.test.d.ts +0 -1
  160. package/dist/wrappers/text/CoreHandler.d.ts +0 -17
  161. package/dist/wrappers/text/CoreHandler.test.d.ts +0 -1
  162. package/dist/wrappers/text/TextWrapper.d.ts +0 -20
  163. package/index.js +0 -7
  164. package/lib/Constants/ModifierKey.d.ts +0 -6
  165. package/lib/Errors/ApiHttpError.d.ts +0 -5
  166. package/lib/Observer.d.ts +0 -14
  167. package/lib/Properties.d.ts +0 -17
  168. package/lib/TolgeeConfig.d.ts +0 -69
  169. package/lib/helpers/NodeHelper.d.ts +0 -14
  170. package/lib/helpers/TextHelper.d.ts +0 -5
  171. package/lib/helpers/commonTypes.d.ts +0 -2
  172. package/lib/helpers/encoderPolyfill.d.ts +0 -8
  173. package/lib/helpers/secret.d.ts +0 -6
  174. package/lib/helpers/sleep.d.ts +0 -1
  175. package/lib/highlighter/HighlightFunctionsInitializer.d.ts +0 -10
  176. package/lib/highlighter/MouseEventHandler.d.ts +0 -29
  177. package/lib/highlighter/TranslationHighlighter.d.ts +0 -14
  178. package/lib/modules/IcuFormatter.d.ts +0 -2
  179. package/lib/modules/index.d.ts +0 -1
  180. package/lib/services/ApiHttpService.d.ts +0 -15
  181. package/lib/services/CoreService.d.ts +0 -18
  182. package/lib/services/DependencyService.d.ts +0 -39
  183. package/lib/services/ElementRegistrar.d.ts +0 -19
  184. package/lib/services/EventEmitter.d.ts +0 -13
  185. package/lib/services/EventService.d.ts +0 -9
  186. package/lib/services/ModuleService.d.ts +0 -5
  187. package/lib/services/ScreenshotService.d.ts +0 -15
  188. package/lib/services/Subscription.d.ts +0 -5
  189. package/lib/services/TextService.d.ts +0 -14
  190. package/lib/services/TranslationService.d.ts +0 -75
  191. package/lib/toolsManager/Messages.d.ts +0 -8
  192. package/lib/toolsManager/PluginManager.d.ts +0 -21
  193. package/lib/types/DTOs.d.ts +0 -20
  194. package/lib/types/apiSchema.generated.d.ts +0 -6185
  195. package/lib/wrappers/AbstractWrapper.d.ts +0 -8
  196. package/lib/wrappers/NodeHandler.d.ts +0 -18
  197. package/lib/wrappers/WrappedHandler.d.ts +0 -8
  198. package/lib/wrappers/invisible/AttributeHandler.d.ts +0 -8
  199. package/lib/wrappers/invisible/Coder.d.ts +0 -7
  200. package/lib/wrappers/invisible/ContentHandler.d.ts +0 -6
  201. package/lib/wrappers/invisible/CoreHandler.d.ts +0 -10
  202. package/lib/wrappers/invisible/InvisibleWrapper.d.ts +0 -18
  203. package/lib/wrappers/invisible/ValueMemory.d.ts +0 -5
  204. package/lib/wrappers/text/AttributeHandler.d.ts +0 -8
  205. package/lib/wrappers/text/Coder.d.ts +0 -15
  206. package/lib/wrappers/text/ContentHandler.d.ts +0 -8
  207. package/lib/wrappers/text/CoreHandler.d.ts +0 -17
  208. package/lib/wrappers/text/TextWrapper.d.ts +0 -20
  209. package/src/Constants/ModifierKey.ts +0 -6
  210. package/src/Errors/ApiHttpError.ts +0 -8
  211. package/src/Observer.test.ts +0 -119
  212. package/src/Observer.ts +0 -68
  213. package/src/Properties.test.ts +0 -150
  214. package/src/Properties.ts +0 -112
  215. package/src/Tolgee.test.ts +0 -473
  216. package/src/TolgeeConfig.test.ts +0 -21
  217. package/src/TolgeeConfig.ts +0 -134
  218. package/src/__integration/FormatterIcu.test.ts +0 -80
  219. package/src/__integration/FormatterMissing.ts +0 -54
  220. package/src/__integration/Tolgee.test.ts +0 -90
  221. package/src/__integration/TolgeeInvisible.test.ts +0 -145
  222. package/src/__integration/mockTranslations.ts +0 -6
  223. package/src/__integration/testConfig.ts +0 -16
  224. package/src/__testFixtures/classMock.ts +0 -11
  225. package/src/__testFixtures/createElement.ts +0 -43
  226. package/src/__testFixtures/createTestDom.ts +0 -26
  227. package/src/__testFixtures/mocked.ts +0 -25
  228. package/src/__testFixtures/setupAfterEnv.ts +0 -34
  229. package/src/helpers/NodeHelper.ts +0 -90
  230. package/src/helpers/TextHelper.test.ts +0 -62
  231. package/src/helpers/TextHelper.ts +0 -58
  232. package/src/helpers/commonTypes.ts +0 -8
  233. package/src/helpers/encoderPolyfill.ts +0 -96
  234. package/src/helpers/secret.test.ts +0 -61
  235. package/src/helpers/secret.ts +0 -68
  236. package/src/helpers/sleep.ts +0 -2
  237. package/src/highlighter/HighlightFunctionsInitializer.test.ts +0 -40
  238. package/src/highlighter/HighlightFunctionsInitializer.ts +0 -61
  239. package/src/highlighter/MouseEventHandler.test.ts +0 -151
  240. package/src/highlighter/MouseEventHandler.ts +0 -191
  241. package/src/highlighter/TranslationHighlighter.test.ts +0 -177
  242. package/src/highlighter/TranslationHighlighter.ts +0 -113
  243. package/src/internal.ts +0 -2
  244. package/src/modules/IcuFormatter.test.ts +0 -21
  245. package/src/modules/IcuFormatter.ts +0 -39
  246. package/src/modules/index.ts +0 -1
  247. package/src/services/ApiHttpService.ts +0 -85
  248. package/src/services/CoreService.test.ts +0 -141
  249. package/src/services/CoreService.ts +0 -76
  250. package/src/services/DependencyService.test.ts +0 -51
  251. package/src/services/DependencyService.ts +0 -116
  252. package/src/services/ElementRegistrar.test.ts +0 -131
  253. package/src/services/ElementRegistrar.ts +0 -108
  254. package/src/services/EventEmitter.ts +0 -52
  255. package/src/services/EventService.ts +0 -14
  256. package/src/services/ModuleService.ts +0 -14
  257. package/src/services/ScreenshotService.ts +0 -31
  258. package/src/services/Subscription.ts +0 -7
  259. package/src/services/TextService.test.ts +0 -88
  260. package/src/services/TextService.ts +0 -82
  261. package/src/services/TranslationService.test.ts +0 -358
  262. package/src/services/TranslationService.ts +0 -417
  263. package/src/services/__mocks__/CoreService.ts +0 -17
  264. package/src/toolsManager/Messages.test.ts +0 -79
  265. package/src/toolsManager/Messages.ts +0 -60
  266. package/src/toolsManager/PluginManager.test.ts +0 -108
  267. package/src/toolsManager/PluginManager.ts +0 -129
  268. package/src/types/DTOs.ts +0 -25
  269. package/src/types/apiSchema.generated.ts +0 -6208
  270. package/src/wrappers/AbstractWrapper.ts +0 -14
  271. package/src/wrappers/NodeHandler.ts +0 -143
  272. package/src/wrappers/WrappedHandler.ts +0 -28
  273. package/src/wrappers/invisible/AttributeHandler.ts +0 -23
  274. package/src/wrappers/invisible/Coder.ts +0 -65
  275. package/src/wrappers/invisible/ContentHandler.ts +0 -15
  276. package/src/wrappers/invisible/CoreHandler.ts +0 -17
  277. package/src/wrappers/invisible/InvisibleWrapper.ts +0 -59
  278. package/src/wrappers/invisible/ValueMemory.test.ts +0 -25
  279. package/src/wrappers/invisible/ValueMemory.ts +0 -16
  280. package/src/wrappers/text/AttributeHandler.test.ts +0 -118
  281. package/src/wrappers/text/AttributeHandler.ts +0 -25
  282. package/src/wrappers/text/Coder.test.ts +0 -298
  283. package/src/wrappers/text/Coder.ts +0 -202
  284. package/src/wrappers/text/ContentHandler.test.ts +0 -185
  285. package/src/wrappers/text/ContentHandler.ts +0 -21
  286. package/src/wrappers/text/CoreHandler.test.ts +0 -106
  287. package/src/wrappers/text/CoreHandler.ts +0 -45
  288. package/src/wrappers/text/TextWrapper.ts +0 -69
@@ -1,69 +0,0 @@
1
- /// <reference types="node" />
2
- import { TreeTranslationsData } from './types';
3
- import { ModifierKey } from './Constants/ModifierKey';
4
- import { Mode } from 'fs';
5
- declare type UiConstructor = new (...args: any[]) => any;
6
- interface UiLibInterface {
7
- UI: UiConstructor;
8
- }
9
- declare type UiType = UiConstructor | UiLibInterface | Promise<UiConstructor> | Promise<UiLibInterface>;
10
- export declare class TolgeeConfig {
11
- /**
12
- * @deprecated This option won't have any effect,
13
- * because mode is now automatically detected when apiKey + apiUrl are set
14
- */
15
- mode?: Mode;
16
- apiUrl?: string;
17
- apiKey?: string;
18
- inputPrefix?: string;
19
- inputSuffix?: string;
20
- /**
21
- * Overrides all language settings
22
- */
23
- forceLanguage?: string;
24
- /**
25
- * Used when auto detection is not available or is turned off
26
- */
27
- defaultLanguage?: string;
28
- /**
29
- * Languages which can be used for language detection
30
- * and also limits which values can be stored
31
- */
32
- availableLanguages?: string[];
33
- /**
34
- * Language which is used when no translation is available for current one
35
- */
36
- fallbackLanguage?: string;
37
- /**
38
- * Store user language in localStorage (default: true)
39
- */
40
- enableLanguageStore?: boolean;
41
- /**
42
- * Use auto language detection by browser locale (default: true)
43
- */
44
- enableLanguageDetection?: boolean;
45
- filesUrlPrefix?: string;
46
- watch?: boolean;
47
- ui?: UiType;
48
- targetElement?: Element;
49
- tagAttributes?: {
50
- [key: string]: string[];
51
- };
52
- highlightKeys?: ModifierKey[];
53
- passToParent?: (keyof HTMLElementTagNameMap)[] | ((node: Element) => boolean);
54
- restrictedElements?: string[];
55
- highlightColor?: string;
56
- highlightWidth?: number;
57
- /** localization data to use in production mode */
58
- staticData?: {
59
- [key: string]: TreeTranslationsData | (() => Promise<TreeTranslationsData>);
60
- };
61
- wrapperMode?: 'text' | 'invisible';
62
- /**
63
- * When true, fallback language will be preloaded on Tolgee.run
64
- */
65
- preloadFallback?: boolean;
66
- private _targetElement?;
67
- constructor(config?: TolgeeConfig);
68
- }
69
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1,7 +0,0 @@
1
- declare const _default: {
2
- en: {
3
- peter_dogs: string;
4
- hello_world: string;
5
- };
6
- };
7
- export default _default;
@@ -1,9 +0,0 @@
1
- export declare const testConfig: {
2
- id: number;
3
- key: string;
4
- username: string;
5
- userFullName: string;
6
- projectId: number;
7
- projectName: string;
8
- scopes: string[];
9
- };
@@ -1,3 +0,0 @@
1
- /// <reference types="jest" />
2
- declare const _default: <T>(implementationFn: () => Partial<T>, baseConstructor?: new (...args: any[]) => any) => jest.Mock<any, any>;
3
- export default _default;
@@ -1,2 +0,0 @@
1
- import { ElementWithMeta } from '../types';
2
- export declare const createElement: (nodesCount: number, keysCount: number, sameKeys?: boolean) => ElementWithMeta;
@@ -1,9 +0,0 @@
1
- export declare const createTestDom: (document: Document) => {
2
- keyInRoot: string;
3
- keyInRootDiv: string;
4
- hereKey: string;
5
- hereTooKey: string;
6
- appendedKey: string;
7
- ariaLabelKey: string;
8
- optionKey: string;
9
- };
@@ -1,20 +0,0 @@
1
- import { TolgeeConfig } from '../TolgeeConfig';
2
- import { Properties } from '../Properties';
3
- import { CoreService } from '../services/CoreService';
4
- import { Observer } from '../Observer';
5
- import { TranslationService } from '../services/TranslationService';
6
- import { TextService } from '../services/TextService';
7
- import { EventService } from '../services/EventService';
8
- import { EventEmitterImpl } from '../services/EventEmitter';
9
- import { ContentHandler } from '../wrappers/text/ContentHandler';
10
- export declare const configMock: import("jest-mock").MockedObject<typeof TolgeeConfig>;
11
- export declare const propertiesMock: import("jest-mock").MockedObject<typeof Properties>;
12
- export declare const coreServiceMock: import("jest-mock").MockedObject<typeof CoreService>;
13
- export declare const observerMock: import("jest-mock").MockedObject<typeof Observer>;
14
- export declare const translationServiceMock: import("jest-mock").MockedObject<typeof TranslationService>;
15
- export declare const textServiceMock: import("jest-mock").MockedObject<typeof TextService>;
16
- export declare const eventServiceMock: import("jest-mock").MockedObject<typeof EventService>;
17
- export declare const eventEmitterMock: import("jest-mock").MockedObject<typeof EventEmitterImpl>;
18
- export declare const tolgeeConfigMock: import("jest-mock").MockedObject<typeof TolgeeConfig>;
19
- export declare const textHandlerMock: import("jest-mock").MockedObject<typeof ContentHandler>;
20
- export declare const getMockedInstance: <T>(constructor: new (...args: any[]) => T) => T;
@@ -1,8 +0,0 @@
1
- declare global {
2
- namespace jest {
3
- interface Matchers<R> {
4
- toBeFoundIn(contextNode: Node): R;
5
- }
6
- }
7
- }
8
- export {};
@@ -1,14 +0,0 @@
1
- import { ArgumentTypes } from './commonTypes';
2
- export declare class NodeHelper {
3
- static evaluate<T extends Node>(...args: ArgumentTypes<typeof NodeHelper.evaluateGenerator>): T[];
4
- static evaluateToSingle<T extends Node>(...args: ArgumentTypes<typeof NodeHelper.evaluateGenerator>): T;
5
- static closestElement(node: Element | Text): Element;
6
- static getParentElement(node: Node): Element | undefined;
7
- static isElementTargetElement(element: Element): boolean;
8
- static markElementAsTargetElement(element: Element): void;
9
- static unmarkElementAsTargetElement(element: Element): void;
10
- static nodeContains(descendant: Node, node: Node): boolean;
11
- private static evaluateGenerator;
12
- static getNodeText(node: Node): string;
13
- static setNodeText(node: Node, text: string): void;
14
- }
@@ -1,5 +0,0 @@
1
- export declare class TextHelper {
2
- static splitOnNonEscapedDelimiter(string: string, delimiter: string): string[];
3
- static isCharEscaped(position: number, fullString: string): boolean;
4
- static removeEscapes(string: string): string;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export declare type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;
2
- export declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
@@ -1,8 +0,0 @@
1
- export declare const Encoder: {
2
- new (): TextEncoder;
3
- prototype: TextEncoder;
4
- };
5
- export declare const Decoder: {
6
- new (label?: string, options?: TextDecoderOptions): TextDecoder;
7
- prototype: TextDecoder;
8
- };
@@ -1,6 +0,0 @@
1
- export declare const INVISIBLE_CHARACTERS: string[];
2
- export declare const INVISIBLE_REGEX: RegExp;
3
- export declare const encodeMessage: (text: string) => string;
4
- export declare const decodeFromText: (text: string) => string[];
5
- export declare const removeSecrets: (text: string) => string;
6
- export declare const stringToCodePoints: (text: string) => number[];
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const sleep: (ms: number) => Promise<unknown>;
@@ -1,10 +0,0 @@
1
- import { Properties } from '../Properties';
2
- import { ElementWithMeta } from '../types';
3
- export declare class HighlightFunctionsInitializer {
4
- private properties;
5
- constructor(properties: Properties);
6
- initFunctions(element: ElementWithMeta): void;
7
- borderElement: HTMLDivElement | null;
8
- private initHighlightFunction;
9
- private initUnhighlightFunction;
10
- }
@@ -1,29 +0,0 @@
1
- import { DependencyService } from '../services/DependencyService';
2
- export declare class MouseEventHandler {
3
- private dependencies;
4
- private keysDown;
5
- private highlighted;
6
- private mouseOnChanged;
7
- private keysChanged;
8
- private cursorPosition;
9
- constructor(dependencies: DependencyService);
10
- run(): void;
11
- stop(): void;
12
- private readonly highlight;
13
- private readonly unhighlight;
14
- private updateHighlight;
15
- private updateCursorPosition;
16
- private blockEvents;
17
- private onMouseMove;
18
- private onBlur;
19
- private onKeyDown;
20
- private onKeyUp;
21
- private onScroll;
22
- private onClick;
23
- private initEventListeners;
24
- private removeEventListeners;
25
- private isInUiDialog;
26
- private getClosestTolgeeElement;
27
- private findAncestor;
28
- private areKeysDown;
29
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import { ElementWithMeta } from '../types';
2
- import { PluginManager } from '../toolsManager/PluginManager';
3
- import { DependencyService } from '../services/DependencyService';
4
- export declare class TranslationHighlighter {
5
- private dependencies;
6
- pluginManager: PluginManager;
7
- private _renderer;
8
- constructor(dependencies: DependencyService);
9
- private static getKeyOptions;
10
- listen(element: ElementWithMeta & ElementCSSInlineStyle): void;
11
- private getRenderer;
12
- private getKeyAndDefault;
13
- translationEdit: (e: MouseEvent, element: ElementWithMeta) => Promise<void>;
14
- }
@@ -1 +0,0 @@
1
- export {};
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export { Tolgee } from './Tolgee';
2
- export { TolgeeConfig } from './TolgeeConfig';
3
- export { ModifierKey } from './Constants/ModifierKey';
4
- export { TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE } from './Constants/Global';
5
- export * from './modules';
6
- export * from './types/DTOs';
7
- export * from './types';
8
- export * from './Constants/Global';
9
- export * from './helpers/NodeHelper';
10
- export * from './helpers/TextHelper';
@@ -1,2 +0,0 @@
1
- export { NodeHelper } from './helpers/NodeHelper';
2
- export { TextHelper } from './helpers/TextHelper';
@@ -1,2 +0,0 @@
1
- import { TolgeeModule } from '../types';
2
- export declare const IcuFormatter: TolgeeModule;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { IcuFormatter } from './IcuFormatter';
@@ -1,15 +0,0 @@
1
- import { Properties } from '../Properties';
2
- import { ArgumentTypes } from '../helpers/commonTypes';
3
- declare type FetchArgumentTypes = ArgumentTypes<typeof fetch>;
4
- declare type Tail<T extends any[]> = ((...args: T) => any) extends (_: infer First, ...rest: infer Rest) => any ? T extends any[] ? Rest : ReadonlyArray<Rest[number]> : [];
5
- export declare class ApiHttpService {
6
- private properties;
7
- constructor(properties: Properties);
8
- private static handleErrors;
9
- fetch(...args: ArgumentTypes<typeof fetch>): Promise<Response>;
10
- fetchJson(...args: ArgumentTypes<typeof fetch>): Promise<any>;
11
- post(url: any, body: any, init?: FetchArgumentTypes[1], ...rest: Tail<Tail<FetchArgumentTypes>>): Promise<Response>;
12
- postJson(url: any, body: any, init?: FetchArgumentTypes[1], ...rest: Tail<Tail<FetchArgumentTypes>>): Promise<any>;
13
- private getUrl;
14
- }
15
- export {};
@@ -1,18 +0,0 @@
1
- import { Properties } from '../Properties';
2
- import { ApiHttpService } from './ApiHttpService';
3
- import { Scope } from '../types';
4
- import { LanguageModel } from '../types/DTOs';
5
- import { components } from '../types/apiSchema.generated';
6
- export declare type ApiKeyWithLanguagesModel = components['schemas']['ApiKeyWithLanguagesModel'];
7
- export declare class CoreService {
8
- private properties;
9
- private apiHttpService;
10
- private languagePromise;
11
- constructor(properties: Properties, apiHttpService: ApiHttpService);
12
- getLanguages(): Promise<Set<string>>;
13
- getLanguagesFull(): Promise<LanguageModel[]>;
14
- getApiKeyDetails(): Promise<ApiKeyWithLanguagesModel>;
15
- isAuthorizedTo(scope: Scope): boolean;
16
- checkScope(scope: Scope): void;
17
- loadApiKeyDetails(): Promise<void>;
18
- }
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1,39 +0,0 @@
1
- import { Properties } from '../Properties';
2
- import { EventService } from './EventService';
3
- import { ApiHttpService } from './ApiHttpService';
4
- import { TranslationService } from './TranslationService';
5
- import { TextService } from './TextService';
6
- import { MouseEventHandler } from '../highlighter/MouseEventHandler';
7
- import { TranslationHighlighter } from '../highlighter/TranslationHighlighter';
8
- import { ElementRegistrar } from './ElementRegistrar';
9
- import { Observer } from '../Observer';
10
- import { CoreService } from './CoreService';
11
- import { TolgeeConfig } from '../TolgeeConfig';
12
- import { PluginManager } from '../toolsManager/PluginManager';
13
- import { Messages } from '../toolsManager/Messages';
14
- import { HighlightFunctionsInitializer } from '../highlighter/HighlightFunctionsInitializer';
15
- import { ScreenshotService } from './ScreenshotService';
16
- import { ModuleService } from './ModuleService';
17
- import { AbstractWrapper } from '../wrappers/AbstractWrapper';
18
- export declare class DependencyService {
19
- properties: Properties;
20
- eventService: EventService;
21
- apiHttpService: ApiHttpService;
22
- mouseEventHandler: MouseEventHandler;
23
- moduleService: ModuleService;
24
- coreService: CoreService;
25
- screenshotService: ScreenshotService;
26
- translationService: TranslationService;
27
- textService: TextService;
28
- highlightFunctionInitializer: HighlightFunctionsInitializer;
29
- translationHighlighter: TranslationHighlighter;
30
- elementRegistrar: ElementRegistrar;
31
- messages: Messages;
32
- pluginManager: PluginManager;
33
- constructor();
34
- wrapper: AbstractWrapper;
35
- observer: Observer;
36
- init(config: TolgeeConfig): void;
37
- run: () => void;
38
- stop: () => void;
39
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- import { ElementWithMeta } from '../types';
2
- import { Properties } from '../Properties';
3
- import { TranslationHighlighter } from '../highlighter/TranslationHighlighter';
4
- import { EventService } from './EventService';
5
- export declare class ElementRegistrar {
6
- private properties;
7
- private translationHighlighter;
8
- private eventService;
9
- private registeredElements;
10
- constructor(properties: Properties, translationHighlighter: TranslationHighlighter, eventService: EventService);
11
- register(element: ElementWithMeta): void;
12
- refreshAll(): void;
13
- cleanAll(): void;
14
- findAllByKey(key: string): ElementWithMeta[];
15
- private cleanElementInactiveNodes;
16
- private cleanElement;
17
- private getActiveNodes;
18
- private isElementActive;
19
- }
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
@@ -1,13 +0,0 @@
1
- import { Subscription } from './Subscription';
2
- export declare type CallbackType<T> = (data: T) => Promise<void> | void;
3
- export interface EventEmitter<T> {
4
- subscribe(callback: CallbackType<T>): Subscription;
5
- }
6
- export declare class EventEmitterImpl<T> {
7
- private idCounter;
8
- private _subscriptions;
9
- private get subscriptions();
10
- emit(data?: T): Promise<void> | void;
11
- subscribe(callback: CallbackType<T>): Subscription;
12
- private unsubscribe;
13
- }
@@ -1,9 +0,0 @@
1
- import { EventEmitter } from './EventEmitter';
2
- import { TranslationData } from '../types/DTOs';
3
- import { ElementWithMeta } from '../types';
4
- export declare class EventService {
5
- readonly TRANSLATION_CHANGED: EventEmitter<TranslationData>;
6
- readonly LANGUAGE_CHANGED: EventEmitter<string>;
7
- readonly LANGUAGE_LOADED: EventEmitter<string>;
8
- readonly ELEMENT_REGISTERED: EventEmitter<ElementWithMeta>;
9
- }
@@ -1,5 +0,0 @@
1
- import { Formatter, TolgeeModule } from '../types';
2
- export declare class ModuleService {
3
- formatter: Formatter | null;
4
- addModule: (module: TolgeeModule) => void;
5
- }
@@ -1,15 +0,0 @@
1
- import { ApiHttpService } from './ApiHttpService';
2
- import { CoreService } from './CoreService';
3
- export declare class ScreenshotService {
4
- private coreService;
5
- private apiHttpService;
6
- constructor(coreService: CoreService, apiHttpService: ApiHttpService);
7
- uploadImage(blob: Blob): Promise<{
8
- id: number;
9
- filename: string;
10
- fileUrl: string;
11
- requestFilename: string;
12
- createdAt: string;
13
- }>;
14
- deleteImages(ids: number[]): Promise<Response>;
15
- }
@@ -1,5 +0,0 @@
1
- export declare class Subscription {
2
- private onUnsubscribe;
3
- constructor(onUnsubscribe: () => void);
4
- unsubscribe(): void;
5
- }
@@ -1,14 +0,0 @@
1
- import { TranslationTags, TranslationParamsTags } from '../types';
2
- import { TranslationService } from './TranslationService';
3
- import { Properties } from '../Properties';
4
- import { ModuleService } from './ModuleService';
5
- export declare class TextService {
6
- private properties;
7
- private translationService;
8
- private moduleService;
9
- constructor(properties: Properties, translationService: TranslationService, moduleService: ModuleService);
10
- translate(key: string, params: TranslationParamsTags<any>, lang?: string, orEmpty?: boolean, defaultValue?: string): Promise<TranslationTags<any>>;
11
- instant(key: string, params: TranslationParamsTags<any>, lang?: string, orEmpty?: boolean, defaultValue?: string): TranslationTags<any>;
12
- private formatTranslation;
13
- private readonly format;
14
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,75 +0,0 @@
1
- import { Translations } from '../types';
2
- import { Properties } from '../Properties';
3
- import { CoreService } from './CoreService';
4
- import { ApiHttpService } from './ApiHttpService';
5
- import { EventService } from './EventService';
6
- import { ComplexEditKeyDto, CreateKeyDto, KeyWithDataModel, SetTranslationsResponseModel, SetTranslationsWithKeyDto, TranslationData } from '../types/DTOs';
7
- interface TranslationInterface {
8
- text?: string;
9
- }
10
- interface Key {
11
- id?: number;
12
- name: string;
13
- translations: Record<string, TranslationInterface>;
14
- }
15
- export declare class TranslationService {
16
- private properties;
17
- private coreService;
18
- private apiHttpService;
19
- private eventService;
20
- private translationsCache;
21
- private fetchPromises;
22
- private fetchedDev;
23
- constructor(properties: Properties, coreService: CoreService, apiHttpService: ApiHttpService, eventService: EventService);
24
- private static translationByValue;
25
- initStatic(): void;
26
- getCachedTranslations(): Map<string, Translations>;
27
- updateTranslationInCache: (data: Key) => Promise<void>;
28
- loadTranslations(lang?: string): Promise<Translations>;
29
- getTranslation(key: string, lang?: string, defaultValue?: string): Promise<string>;
30
- updateKeyComplex(id: number, data: ComplexEditKeyDto): Promise<KeyWithDataModel>;
31
- createKey(data: CreateKeyDto): Promise<KeyWithDataModel>;
32
- setTranslations(translationData: SetTranslationsWithKeyDto): Promise<SetTranslationsResponseModel>;
33
- /**
34
- * Change translations of some keys to some value temporarily.
35
- * For screenshot taking with provided values, before actually saving
36
- * the values
37
- *
38
- * @return Returns callback changing affected translations back
39
- */
40
- changeTranslations({ key, translations, }: TranslationData): Promise<() => void>;
41
- getFromCacheOrFallback(key: string, lang?: string, defaultValue?: string): string;
42
- getTranslationsOfKey: (key: string, languages?: Set<string>) => Promise<readonly [{
43
- keyId: number;
44
- keyName: string;
45
- keyTags: {
46
- id: number;
47
- name: string;
48
- }[];
49
- screenshotCount: number;
50
- screenshots?: {
51
- id: number;
52
- filename: string;
53
- fileUrl: string;
54
- createdAt?: string;
55
- }[];
56
- translations: {
57
- [key: string]: {
58
- id: number;
59
- text?: string;
60
- state: "UNTRANSLATED" | "MACHINE_TRANSLATED" | "TRANSLATED" | "REVIEWED" | "NEEDS_REVIEW";
61
- commentCount: number;
62
- unresolvedCommentCount: number;
63
- };
64
- };
65
- }, string[]]>;
66
- private isFetchNeeded;
67
- private isLoaded;
68
- private fetchTranslations;
69
- private fetchTranslationsProduction;
70
- private fetchTranslationsDevelopment;
71
- private setEmptyLanguageData;
72
- private setLanguageData;
73
- private getFromCache;
74
- }
75
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- /// <reference types="jest" />
2
- export declare const CoreService: jest.Mock<any, any>;