@tolgee/core 4.7.3 → 4.8.3-rc.a861236.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 (96) hide show
  1. package/dist/Constants/Global.d.ts +6 -0
  2. package/dist/Constants/ModifierKey.d.ts +6 -0
  3. package/dist/Errors/ApiHttpError.d.ts +5 -0
  4. package/dist/Observer.d.ts +14 -0
  5. package/dist/Observer.test.d.ts +2 -0
  6. package/dist/Properties.d.ts +17 -0
  7. package/dist/Properties.test.d.ts +1 -0
  8. package/dist/Tolgee.d.ts +68 -0
  9. package/dist/Tolgee.test.d.ts +1 -0
  10. package/dist/TolgeeConfig.d.ts +69 -0
  11. package/dist/TolgeeConfig.test.d.ts +1 -0
  12. package/dist/__integration/FormatterIcu.test.d.ts +1 -0
  13. package/dist/__integration/FormatterMissing.d.ts +1 -0
  14. package/dist/__integration/Tolgee.test.d.ts +1 -0
  15. package/dist/__integration/TolgeeInvisible.test.d.ts +1 -0
  16. package/dist/__integration/mockTranslations.d.ts +7 -0
  17. package/dist/__integration/testConfig.d.ts +9 -0
  18. package/dist/__testFixtures/classMock.d.ts +3 -0
  19. package/dist/__testFixtures/createElement.d.ts +2 -0
  20. package/dist/__testFixtures/createTestDom.d.ts +9 -0
  21. package/dist/__testFixtures/mocked.d.ts +20 -0
  22. package/dist/__testFixtures/setupAfterEnv.d.ts +8 -0
  23. package/dist/helpers/NodeHelper.d.ts +14 -0
  24. package/dist/helpers/TextHelper.d.ts +5 -0
  25. package/dist/helpers/TextHelper.test.d.ts +1 -0
  26. package/dist/helpers/commonTypes.d.ts +2 -0
  27. package/dist/helpers/encoderPolyfill.d.ts +8 -0
  28. package/dist/helpers/secret.d.ts +6 -0
  29. package/dist/helpers/secret.test.d.ts +1 -0
  30. package/dist/helpers/sleep.d.ts +1 -0
  31. package/dist/highlighter/HighlightFunctionsInitializer.d.ts +10 -0
  32. package/dist/highlighter/HighlightFunctionsInitializer.test.d.ts +1 -0
  33. package/dist/highlighter/MouseEventHandler.d.ts +29 -0
  34. package/dist/highlighter/MouseEventHandler.test.d.ts +1 -0
  35. package/dist/highlighter/TranslationHighlighter.d.ts +14 -0
  36. package/dist/highlighter/TranslationHighlighter.test.d.ts +1 -0
  37. package/dist/index.d.ts +10 -0
  38. package/dist/internal.d.ts +2 -0
  39. package/dist/modules/IcuFormatter.d.ts +2 -0
  40. package/dist/modules/index.d.ts +1 -0
  41. package/dist/services/ApiHttpService.d.ts +15 -0
  42. package/dist/services/CoreService.d.ts +18 -0
  43. package/dist/services/CoreService.test.d.ts +1 -0
  44. package/dist/services/DependencyService.d.ts +39 -0
  45. package/dist/services/DependencyService.test.d.ts +1 -0
  46. package/dist/services/ElementRegistrar.d.ts +19 -0
  47. package/dist/services/ElementRegistrar.test.d.ts +1 -0
  48. package/dist/services/EventEmitter.d.ts +13 -0
  49. package/dist/services/EventService.d.ts +9 -0
  50. package/dist/services/ModuleService.d.ts +5 -0
  51. package/dist/services/ScreenshotService.d.ts +15 -0
  52. package/dist/services/Subscription.d.ts +5 -0
  53. package/dist/services/TextService.d.ts +14 -0
  54. package/dist/services/TextService.test.d.ts +1 -0
  55. package/dist/services/TranslationService.d.ts +75 -0
  56. package/dist/services/TranslationService.test.d.ts +1 -0
  57. package/dist/services/__mocks__/CoreService.d.ts +2 -0
  58. package/dist/tolgee.cjs.js +1 -1
  59. package/dist/tolgee.cjs.js.map +1 -1
  60. package/dist/tolgee.cjs.min.js +1 -1
  61. package/dist/tolgee.cjs.min.js.map +1 -1
  62. package/dist/tolgee.esm.min.mjs +1 -1
  63. package/dist/tolgee.esm.min.mjs.map +1 -1
  64. package/dist/tolgee.esm.mjs +1 -1
  65. package/dist/tolgee.esm.mjs.map +1 -1
  66. package/dist/tolgee.umd.js +1 -1
  67. package/dist/tolgee.umd.js.map +1 -1
  68. package/dist/tolgee.umd.min.js +1 -1
  69. package/dist/tolgee.umd.min.js.map +1 -1
  70. package/dist/toolsManager/Messages.d.ts +8 -0
  71. package/dist/toolsManager/Messages.test.d.ts +1 -0
  72. package/dist/toolsManager/PluginManager.d.ts +21 -0
  73. package/dist/toolsManager/PluginManager.test.d.ts +1 -0
  74. package/dist/types/DTOs.d.ts +20 -0
  75. package/dist/types/apiSchema.generated.d.ts +6185 -0
  76. package/dist/types.d.ts +123 -0
  77. package/dist/wrappers/AbstractWrapper.d.ts +8 -0
  78. package/dist/wrappers/NodeHandler.d.ts +18 -0
  79. package/dist/wrappers/WrappedHandler.d.ts +8 -0
  80. package/dist/wrappers/invisible/AttributeHandler.d.ts +8 -0
  81. package/dist/wrappers/invisible/Coder.d.ts +7 -0
  82. package/dist/wrappers/invisible/ContentHandler.d.ts +6 -0
  83. package/dist/wrappers/invisible/CoreHandler.d.ts +10 -0
  84. package/dist/wrappers/invisible/InvisibleWrapper.d.ts +18 -0
  85. package/dist/wrappers/invisible/ValueMemory.d.ts +5 -0
  86. package/dist/wrappers/invisible/ValueMemory.test.d.ts +1 -0
  87. package/dist/wrappers/text/AttributeHandler.d.ts +8 -0
  88. package/dist/wrappers/text/AttributeHandler.test.d.ts +1 -0
  89. package/dist/wrappers/text/Coder.d.ts +15 -0
  90. package/dist/wrappers/text/Coder.test.d.ts +1 -0
  91. package/dist/wrappers/text/ContentHandler.d.ts +8 -0
  92. package/dist/wrappers/text/ContentHandler.test.d.ts +1 -0
  93. package/dist/wrappers/text/CoreHandler.d.ts +17 -0
  94. package/dist/wrappers/text/CoreHandler.test.d.ts +1 -0
  95. package/dist/wrappers/text/TextWrapper.d.ts +20 -0
  96. package/package.json +5 -5
@@ -0,0 +1,6 @@
1
+ export declare const RESTRICTED_ASCENDANT_ATTRIBUTE = "data-tolgee-restricted";
2
+ export declare const TOLGEE_ATTRIBUTE_NAME = "_tolgee";
3
+ export declare const TOLGEE_TARGET_ATTRIBUTE = "_tolgee-target";
4
+ export declare const TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE = "data-tolgee-key-only";
5
+ export declare const TOLGEE_HIGHLIGHTER_CLASS = "_tolgee-highlighter";
6
+ export declare const DEVTOOLS_ID = "__tolgee_dev_tools";
@@ -0,0 +1,6 @@
1
+ export declare enum ModifierKey {
2
+ Alt = 0,
3
+ Control = 1,
4
+ Shift = 2,
5
+ Meta = 3
6
+ }
@@ -0,0 +1,5 @@
1
+ export declare class ApiHttpError extends Error {
2
+ response: Response;
3
+ code?: string;
4
+ constructor(response: Response, code?: string);
5
+ }
@@ -0,0 +1,14 @@
1
+ import { Properties } from './Properties';
2
+ import { ElementRegistrar } from './services/ElementRegistrar';
3
+ import { AbstractWrapper } from './wrappers/AbstractWrapper';
4
+ export declare class Observer {
5
+ private properties;
6
+ private textWrapper;
7
+ private nodeRegistrar;
8
+ constructor(properties: Properties, textWrapper: AbstractWrapper, nodeRegistrar: ElementRegistrar);
9
+ private _observer;
10
+ private _observing;
11
+ private get observer();
12
+ observe(): void;
13
+ stopObserving(): void;
14
+ }
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom/extend-expect';
2
+ import 'regenerator-runtime/runtime.js';
@@ -0,0 +1,17 @@
1
+ import { TolgeeConfig } from './TolgeeConfig';
2
+ import { Mode, Scope } from './types';
3
+ export declare class Properties {
4
+ config: TolgeeConfig;
5
+ scopes?: Scope[];
6
+ projectId?: number;
7
+ permittedLanguageIds?: number[];
8
+ mode?: Mode;
9
+ _currentLanguage?: string;
10
+ get currentLanguage(): string;
11
+ set currentLanguage(language: string);
12
+ get preferredLanguages(): Set<string>;
13
+ set preferredLanguages(languages: Set<string>);
14
+ private getInitialLanguage;
15
+ private getStoredLanguage;
16
+ private getLanguageByNavigator;
17
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,68 @@
1
+ import { TolgeeConfig } from './TolgeeConfig';
2
+ import { InstantProps, InstantPropsTags, TolgeeModule, TranslateProps, TranslatePropsTags, TranslationTags, TranslationParams, TranslationParamsTags } from './types';
3
+ export declare class Tolgee {
4
+ private dependencyService;
5
+ private constructor();
6
+ get properties(): import("./Properties").Properties;
7
+ get lang(): string;
8
+ /**
9
+ * This sets a new language.
10
+ *
11
+ * Using this setter can behave buggy when you change languages
12
+ * too fast, since it changes the language property before
13
+ * translations are actually loaded.
14
+ * @deprecated use asynchronous changeLanguage method.
15
+ */
16
+ set lang(newLanguage: string);
17
+ get defaultLanguage(): string;
18
+ get onLangChange(): import("./services/EventEmitter").EventEmitter<string>;
19
+ get onTranslationChange(): import("./services/EventEmitter").EventEmitter<import(".").TranslationData>;
20
+ /**
21
+ * Is emitted when language is loaded for the first time
22
+ */
23
+ get onLangLoaded(): import("./services/EventEmitter").EventEmitter<string>;
24
+ /**
25
+ * True if loading is needed to wait for Tolgee init.
26
+ * When translation data are provided statically (using import
27
+ * as staticData config property) then there is no need for translation
28
+ * fetching so initial loading is not needed at all.
29
+ */
30
+ get initialLoading(): boolean;
31
+ private get coreService();
32
+ static use(module: TolgeeModule): Tolgee;
33
+ static init(config: TolgeeConfig): Tolgee;
34
+ /**
35
+ * Sets the new language.
36
+ *
37
+ * Emits the onLangChange and onLangChangeAndLoad events after
38
+ * the translations are loaded.
39
+ *
40
+ * @return Promise<void> Resolves when translations are loaded
41
+ */
42
+ changeLanguage(newLanguage: string): Promise<void>;
43
+ use(module: TolgeeModule): this;
44
+ init(config: TolgeeConfig): this;
45
+ run(): Promise<void>;
46
+ refresh(): Promise<void>;
47
+ translate(props: TranslateProps): Promise<string>;
48
+ translate<T>(props: TranslatePropsTags<T>): Promise<TranslationTags<T>>;
49
+ translate(key: string, params?: TranslationParams, noWrap?: boolean, defaultValue?: string): Promise<string>;
50
+ translate<T>(key: string, params?: TranslationParamsTags<T>, noWrap?: boolean, defaultValue?: string): Promise<TranslationTags<T>>;
51
+ wrap(key: string, params?: TranslationParams, defaultValue?: string | undefined, translation?: string): string;
52
+ wrap<T>(key: string, params?: TranslationTags<T>, defaultValue?: string | undefined, translation?: TranslationTags<T>): TranslationTags<T>;
53
+ instant(key: string, params?: TranslationParams, noWrap?: boolean, orEmpty?: boolean, defaultValue?: string): string;
54
+ instant<T>(key: string, params?: TranslationParamsTags<T>, noWrap?: boolean, orEmpty?: boolean, defaultValue?: string): TranslationTags<T>;
55
+ instant(props: InstantProps): string;
56
+ instant<T>(props: InstantPropsTags<T>): TranslationTags<T>;
57
+ /**
58
+ * Get currently cached translations for all languages
59
+ */
60
+ getCachedTranslations(): Map<string, import("./types").Translations>;
61
+ /**
62
+ * Loads translations for given language or returns them from cache
63
+ * @returns Loaded translations
64
+ */
65
+ loadTranslations(lang: string): Promise<import("./types").Translations>;
66
+ stop: () => void;
67
+ private emitLangChangeEvent;
68
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,69 @@
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 {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ en: {
3
+ peter_dogs: string;
4
+ hello_world: string;
5
+ };
6
+ };
7
+ export default _default;
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,3 @@
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;
@@ -0,0 +1,2 @@
1
+ import { ElementWithMeta } from '../types';
2
+ export declare const createElement: (nodesCount: number, keysCount: number, sameKeys?: boolean) => ElementWithMeta;
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,8 @@
1
+ declare global {
2
+ namespace jest {
3
+ interface Matchers<R> {
4
+ toBeFoundIn(contextNode: Node): R;
5
+ }
6
+ }
7
+ }
8
+ export {};
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,5 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
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;
@@ -0,0 +1,8 @@
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
+ };
@@ -0,0 +1,6 @@
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[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
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';
@@ -0,0 +1,2 @@
1
+ export { NodeHelper } from './helpers/NodeHelper';
2
+ export { TextHelper } from './helpers/TextHelper';
@@ -0,0 +1,2 @@
1
+ import { TolgeeModule } from '../types';
2
+ export declare const IcuFormatter: TolgeeModule;
@@ -0,0 +1 @@
1
+ export { IcuFormatter } from './IcuFormatter';
@@ -0,0 +1,15 @@
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 {};
@@ -0,0 +1,18 @@
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
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
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
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ import { Formatter, TolgeeModule } from '../types';
2
+ export declare class ModuleService {
3
+ formatter: Formatter | null;
4
+ addModule: (module: TolgeeModule) => void;
5
+ }
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ export declare class Subscription {
2
+ private onUnsubscribe;
3
+ constructor(onUnsubscribe: () => void);
4
+ unsubscribe(): void;
5
+ }
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};