@tolgee/core 4.2.1 → 4.3.0-rc.5103942.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.
- package/dist/tolgee.cjs.js +28 -21
- package/dist/tolgee.cjs.js.map +1 -1
- package/dist/tolgee.cjs.min.js +1 -1
- package/dist/tolgee.cjs.min.js.map +1 -1
- package/dist/tolgee.esm.js +1 -1
- package/dist/tolgee.esm.js.map +1 -1
- package/dist/tolgee.umd.js +28 -21
- package/dist/tolgee.umd.js.map +1 -1
- package/dist/tolgee.umd.min.js +1 -1
- package/dist/tolgee.umd.min.js.map +1 -1
- package/lib/Constants/Global.d.ts +0 -0
- package/lib/Constants/ModifierKey.d.ts +0 -0
- package/lib/Errors/ApiHttpError.d.ts +0 -0
- package/lib/Observer.d.ts +0 -0
- package/lib/Properties.d.ts +0 -0
- package/lib/Tolgee.d.ts +0 -0
- package/lib/TolgeeConfig.d.ts +7 -1
- package/lib/helpers/NodeHelper.d.ts +0 -0
- package/lib/helpers/TextHelper.d.ts +0 -0
- package/lib/helpers/commonTypes.d.ts +0 -0
- package/lib/helpers/encoderPolyfill.d.ts +0 -0
- package/lib/helpers/secret.d.ts +0 -0
- package/lib/helpers/sleep.d.ts +0 -0
- package/lib/highlighter/HighlightFunctionsInitializer.d.ts +0 -0
- package/lib/highlighter/MouseEventHandler.d.ts +0 -0
- package/lib/highlighter/TranslationHighlighter.d.ts +0 -0
- package/lib/index.d.ts +3 -0
- package/lib/modules/IcuFormatter.d.ts +0 -0
- package/lib/modules/index.d.ts +0 -0
- package/lib/services/ApiHttpService.d.ts +0 -0
- package/lib/services/CoreService.d.ts +0 -0
- package/lib/services/DependencyService.d.ts +0 -0
- package/lib/services/ElementRegistrar.d.ts +0 -0
- package/lib/services/EventEmitter.d.ts +0 -0
- package/lib/services/EventService.d.ts +0 -0
- package/lib/services/ModuleService.d.ts +0 -0
- package/lib/services/ScreenshotService.d.ts +0 -0
- package/lib/services/Subscription.d.ts +0 -0
- package/lib/services/TextService.d.ts +0 -0
- package/lib/services/TranslationService.d.ts +0 -0
- package/lib/toolsManager/Messages.d.ts +0 -0
- package/lib/toolsManager/PluginManager.d.ts +0 -0
- package/lib/types/DTOs.d.ts +0 -0
- package/lib/types/apiSchema.generated.d.ts +0 -0
- package/lib/types.d.ts +0 -0
- package/lib/wrappers/AbstractWrapper.d.ts +0 -0
- package/lib/wrappers/NodeHandler.d.ts +0 -0
- package/lib/wrappers/WrappedHandler.d.ts +0 -0
- package/lib/wrappers/invisible/AttributeHandler.d.ts +0 -0
- package/lib/wrappers/invisible/Coder.d.ts +0 -0
- package/lib/wrappers/invisible/ContentHandler.d.ts +0 -0
- package/lib/wrappers/invisible/CoreHandler.d.ts +0 -0
- package/lib/wrappers/invisible/InvisibleWrapper.d.ts +0 -0
- package/lib/wrappers/invisible/ValueMemory.d.ts +0 -0
- package/lib/wrappers/text/AttributeHandler.d.ts +0 -0
- package/lib/wrappers/text/Coder.d.ts +0 -0
- package/lib/wrappers/text/ContentHandler.d.ts +0 -0
- package/lib/wrappers/text/CoreHandler.d.ts +0 -0
- package/lib/wrappers/text/TextWrapper.d.ts +0 -0
- package/package.json +6 -2
- package/lib/Constants/Global.js +0 -5
- package/lib/Constants/Global.js.map +0 -1
- package/lib/Constants/ModifierKey.js +0 -8
- package/lib/Constants/ModifierKey.js.map +0 -1
- package/lib/Errors/ApiHttpError.js +0 -29
- package/lib/Errors/ApiHttpError.js.map +0 -1
- package/lib/Observer.js +0 -144
- package/lib/Observer.js.map +0 -1
- package/lib/Properties.js +0 -86
- package/lib/Properties.js.map +0 -1
- package/lib/Tolgee.js +0 -308
- package/lib/Tolgee.js.map +0 -1
- package/lib/TolgeeConfig.js +0 -85
- package/lib/TolgeeConfig.js.map +0 -1
- package/lib/helpers/NodeHelper.js +0 -140
- package/lib/helpers/NodeHelper.js.map +0 -1
- package/lib/helpers/TextHelper.js +0 -58
- package/lib/helpers/TextHelper.js.map +0 -1
- package/lib/helpers/commonTypes.js +0 -2
- package/lib/helpers/commonTypes.js.map +0 -1
- package/lib/helpers/encoderPolyfill.js +0 -96
- package/lib/helpers/encoderPolyfill.js.map +0 -1
- package/lib/helpers/secret.js +0 -73
- package/lib/helpers/secret.js.map +0 -1
- package/lib/helpers/sleep.js +0 -4
- package/lib/helpers/sleep.js.map +0 -1
- package/lib/highlighter/HighlightFunctionsInitializer.js +0 -24
- package/lib/highlighter/HighlightFunctionsInitializer.js.map +0 -1
- package/lib/highlighter/MouseEventHandler.js +0 -157
- package/lib/highlighter/MouseEventHandler.js.map +0 -1
- package/lib/highlighter/TranslationHighlighter.js +0 -220
- package/lib/highlighter/TranslationHighlighter.js.map +0 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/modules/IcuFormatter.js +0 -18
- package/lib/modules/IcuFormatter.js.map +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/modules/index.js.map +0 -1
- package/lib/services/ApiHttpService.js +0 -171
- package/lib/services/ApiHttpService.js.map +0 -1
- package/lib/services/CoreService.js +0 -129
- package/lib/services/CoreService.js.map +0 -1
- package/lib/services/DependencyService.js +0 -64
- package/lib/services/DependencyService.js.map +0 -1
- package/lib/services/ElementRegistrar.js +0 -193
- package/lib/services/ElementRegistrar.js.map +0 -1
- package/lib/services/EventEmitter.js +0 -68
- package/lib/services/EventEmitter.js.map +0 -1
- package/lib/services/EventService.js +0 -12
- package/lib/services/EventService.js.map +0 -1
- package/lib/services/ModuleService.js +0 -18
- package/lib/services/ModuleService.js.map +0 -1
- package/lib/services/ScreenshotService.js +0 -67
- package/lib/services/ScreenshotService.js.map +0 -1
- package/lib/services/Subscription.js +0 -11
- package/lib/services/Subscription.js.map +0 -1
- package/lib/services/TextService.js +0 -94
- package/lib/services/TextService.js.map +0 -1
- package/lib/services/TranslationService.js +0 -523
- package/lib/services/TranslationService.js.map +0 -1
- package/lib/toolsManager/Messages.js +0 -46
- package/lib/toolsManager/Messages.js.map +0 -1
- package/lib/toolsManager/PluginManager.js +0 -153
- package/lib/toolsManager/PluginManager.js.map +0 -1
- package/lib/types/DTOs.js +0 -10
- package/lib/types/DTOs.js.map +0 -1
- package/lib/types/apiSchema.generated.js +0 -6
- package/lib/types/apiSchema.generated.js.map +0 -1
- package/lib/types.js +0 -2
- package/lib/types.js.map +0 -1
- package/lib/wrappers/AbstractWrapper.js +0 -2
- package/lib/wrappers/AbstractWrapper.js.map +0 -1
- package/lib/wrappers/NodeHandler.js +0 -178
- package/lib/wrappers/NodeHandler.js.map +0 -1
- package/lib/wrappers/WrappedHandler.js +0 -67
- package/lib/wrappers/WrappedHandler.js.map +0 -1
- package/lib/wrappers/invisible/AttributeHandler.js +0 -134
- package/lib/wrappers/invisible/AttributeHandler.js.map +0 -1
- package/lib/wrappers/invisible/Coder.js +0 -73
- package/lib/wrappers/invisible/Coder.js.map +0 -1
- package/lib/wrappers/invisible/ContentHandler.js +0 -63
- package/lib/wrappers/invisible/ContentHandler.js.map +0 -1
- package/lib/wrappers/invisible/CoreHandler.js +0 -64
- package/lib/wrappers/invisible/CoreHandler.js.map +0 -1
- package/lib/wrappers/invisible/InvisibleWrapper.js +0 -37
- package/lib/wrappers/invisible/InvisibleWrapper.js.map +0 -1
- package/lib/wrappers/invisible/ValueMemory.js +0 -19
- package/lib/wrappers/invisible/ValueMemory.js.map +0 -1
- package/lib/wrappers/text/AttributeHandler.js +0 -137
- package/lib/wrappers/text/AttributeHandler.js.map +0 -1
- package/lib/wrappers/text/Coder.js +0 -188
- package/lib/wrappers/text/Coder.js.map +0 -1
- package/lib/wrappers/text/ContentHandler.js +0 -65
- package/lib/wrappers/text/ContentHandler.js.map +0 -1
- package/lib/wrappers/text/CoreHandler.js +0 -147
- package/lib/wrappers/text/CoreHandler.js.map +0 -1
- package/lib/wrappers/text/TextWrapper.js +0 -36
- package/lib/wrappers/text/TextWrapper.js.map +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Observer.d.ts
CHANGED
|
File without changes
|
package/lib/Properties.d.ts
CHANGED
|
File without changes
|
package/lib/Tolgee.d.ts
CHANGED
|
File without changes
|
package/lib/TolgeeConfig.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Mode, TreeTranslationsData } from './types';
|
|
2
2
|
import { ModifierKey } from './Constants/ModifierKey';
|
|
3
|
+
declare type UiConstructor = new (...args: any[]) => any;
|
|
4
|
+
interface UiLibInterface {
|
|
5
|
+
UI: UiConstructor;
|
|
6
|
+
}
|
|
7
|
+
declare type UiType = UiConstructor | UiLibInterface | Promise<UiConstructor> | Promise<UiLibInterface>;
|
|
3
8
|
export declare class TolgeeConfig {
|
|
4
9
|
mode?: Mode;
|
|
5
10
|
apiUrl?: string;
|
|
@@ -33,7 +38,7 @@ export declare class TolgeeConfig {
|
|
|
33
38
|
enableLanguageDetection?: boolean;
|
|
34
39
|
filesUrlPrefix?: string;
|
|
35
40
|
watch?: boolean;
|
|
36
|
-
ui?:
|
|
41
|
+
ui?: UiType;
|
|
37
42
|
targetElement?: Element;
|
|
38
43
|
tagAttributes?: {
|
|
39
44
|
[key: string]: string[];
|
|
@@ -54,3 +59,4 @@ export declare class TolgeeConfig {
|
|
|
54
59
|
private _targetElement?;
|
|
55
60
|
constructor(config?: TolgeeConfig);
|
|
56
61
|
}
|
|
62
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/helpers/secret.d.ts
CHANGED
|
File without changes
|
package/lib/helpers/sleep.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
@@ -5,3 +5,6 @@ export { TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE } from './Constants/Global';
|
|
|
5
5
|
export * from './modules';
|
|
6
6
|
export * from './types/DTOs';
|
|
7
7
|
export * from './types';
|
|
8
|
+
export * from './Constants/Global';
|
|
9
|
+
export * from './helpers/NodeHelper';
|
|
10
|
+
export * from './helpers/TextHelper';
|
|
File without changes
|
package/lib/modules/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/types/DTOs.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/types.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolgee/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-rc.5103942.0",
|
|
4
4
|
"description": "Library providing ability to translate messages directly in context of developed application.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./dist/tolgee.esm.js",
|
|
@@ -61,7 +61,11 @@
|
|
|
61
61
|
"typedoc-plugin-markdown": "3.11.14",
|
|
62
62
|
"typescript": "4.6.2"
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"exports": {
|
|
65
|
+
"require": "./dist/tolgee.cjs.js",
|
|
66
|
+
"import": "./dist/tolgee.esm.js"
|
|
67
|
+
},
|
|
68
|
+
"gitHead": "5fa1c8b520298d679fe6686eab24a1b80174c2ee",
|
|
65
69
|
"publishConfig": {
|
|
66
70
|
"access": "public"
|
|
67
71
|
}
|
package/lib/Constants/Global.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export var RESTRICTED_ASCENDANT_ATTRIBUTE = 'data-tolgee-restricted';
|
|
2
|
-
export var TOLGEE_ATTRIBUTE_NAME = '_tolgee';
|
|
3
|
-
export var TOLGEE_TARGET_ATTRIBUTE = '_tolgee-target';
|
|
4
|
-
export var TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE = 'data-tolgee-key-only';
|
|
5
|
-
//# sourceMappingURL=Global.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Global.js","sourceRoot":"","sources":["../../src/Constants/Global.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,8BAA8B,GAAG,wBAAwB,CAAC;AAEvE,MAAM,CAAC,IAAM,qBAAqB,GAAG,SAAS,CAAC;AAC/C,MAAM,CAAC,IAAM,uBAAuB,GAAG,gBAAgB,CAAC;AACxD,MAAM,CAAC,IAAM,kCAAkC,GAAG,sBAAsB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var ModifierKey;
|
|
2
|
-
(function (ModifierKey) {
|
|
3
|
-
ModifierKey[ModifierKey["Alt"] = 0] = "Alt";
|
|
4
|
-
ModifierKey[ModifierKey["Control"] = 1] = "Control";
|
|
5
|
-
ModifierKey[ModifierKey["Shift"] = 2] = "Shift";
|
|
6
|
-
ModifierKey[ModifierKey["Meta"] = 3] = "Meta";
|
|
7
|
-
})(ModifierKey || (ModifierKey = {}));
|
|
8
|
-
//# sourceMappingURL=ModifierKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModifierKey.js","sourceRoot":"","sources":["../../src/Constants/ModifierKey.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,2CAAG,CAAA;IACH,mDAAO,CAAA;IACP,+CAAK,CAAA;IACL,6CAAI,CAAA;AACN,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var ApiHttpError = /** @class */ (function (_super) {
|
|
17
|
-
__extends(ApiHttpError, _super);
|
|
18
|
-
function ApiHttpError(response, code) {
|
|
19
|
-
var _this = _super.call(this, 'Api http error') || this;
|
|
20
|
-
_this.response = response;
|
|
21
|
-
_this.code = code;
|
|
22
|
-
// Set the prototype explicitly.
|
|
23
|
-
Object.setPrototypeOf(_this, ApiHttpError.prototype);
|
|
24
|
-
return _this;
|
|
25
|
-
}
|
|
26
|
-
return ApiHttpError;
|
|
27
|
-
}(Error));
|
|
28
|
-
export { ApiHttpError };
|
|
29
|
-
//# sourceMappingURL=ApiHttpError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiHttpError.js","sourceRoot":"","sources":["../../src/Errors/ApiHttpError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;IAAkC,gCAAK;IACrC,sBAAmB,QAAkB,EAAS,IAAa;QAA3D,YACE,kBAAM,gBAAgB,CAAC,SAIxB;QALkB,cAAQ,GAAR,QAAQ,CAAU;QAAS,UAAI,GAAJ,IAAI,CAAS;QAGzD,gCAAgC;QAChC,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;;IACtD,CAAC;IACH,mBAAC;AAAD,CAAC,AAPD,CAAkC,KAAK,GAOtC"}
|
package/lib/Observer.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var __values = (this && this.__values) || function(o) {
|
|
38
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
39
|
-
if (m) return m.call(o);
|
|
40
|
-
if (o && typeof o.length === "number") return {
|
|
41
|
-
next: function () {
|
|
42
|
-
if (o && i >= o.length) o = void 0;
|
|
43
|
-
return { value: o && o[i++], done: !o };
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
47
|
-
};
|
|
48
|
-
var Observer = /** @class */ (function () {
|
|
49
|
-
function Observer(properties, textWrapper, nodeRegistrar) {
|
|
50
|
-
this.properties = properties;
|
|
51
|
-
this.textWrapper = textWrapper;
|
|
52
|
-
this.nodeRegistrar = nodeRegistrar;
|
|
53
|
-
this._observer = undefined;
|
|
54
|
-
this._observing = false;
|
|
55
|
-
}
|
|
56
|
-
Object.defineProperty(Observer.prototype, "observer", {
|
|
57
|
-
get: function () {
|
|
58
|
-
var _this = this;
|
|
59
|
-
if (!this._observer && typeof window !== 'undefined') {
|
|
60
|
-
this._observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
-
var mutationsList_1, mutationsList_1_1, mutation, e_1_1;
|
|
62
|
-
var e_1, _a;
|
|
63
|
-
return __generator(this, function (_b) {
|
|
64
|
-
switch (_b.label) {
|
|
65
|
-
case 0:
|
|
66
|
-
_b.trys.push([0, 9, 10, 11]);
|
|
67
|
-
mutationsList_1 = __values(mutationsList), mutationsList_1_1 = mutationsList_1.next();
|
|
68
|
-
_b.label = 1;
|
|
69
|
-
case 1:
|
|
70
|
-
if (!!mutationsList_1_1.done) return [3 /*break*/, 8];
|
|
71
|
-
mutation = mutationsList_1_1.value;
|
|
72
|
-
if (!this._observing) {
|
|
73
|
-
// make sure we don't touch the DOM after disconnect is called
|
|
74
|
-
return [2 /*return*/];
|
|
75
|
-
}
|
|
76
|
-
if (!(mutation.type === 'characterData')) return [3 /*break*/, 3];
|
|
77
|
-
return [4 /*yield*/, this.textWrapper.handleText(mutation.target)];
|
|
78
|
-
case 2:
|
|
79
|
-
_b.sent();
|
|
80
|
-
return [3 /*break*/, 7];
|
|
81
|
-
case 3:
|
|
82
|
-
if (!(mutation.type === 'childList')) return [3 /*break*/, 5];
|
|
83
|
-
return [4 /*yield*/, this.textWrapper.handleSubtree(mutation.target)];
|
|
84
|
-
case 4:
|
|
85
|
-
_b.sent();
|
|
86
|
-
return [3 /*break*/, 7];
|
|
87
|
-
case 5:
|
|
88
|
-
if (!(mutation.type === 'attributes')) return [3 /*break*/, 7];
|
|
89
|
-
return [4 /*yield*/, this.textWrapper.handleAttribute(mutation.target)];
|
|
90
|
-
case 6:
|
|
91
|
-
_b.sent();
|
|
92
|
-
_b.label = 7;
|
|
93
|
-
case 7:
|
|
94
|
-
mutationsList_1_1 = mutationsList_1.next();
|
|
95
|
-
return [3 /*break*/, 1];
|
|
96
|
-
case 8: return [3 /*break*/, 11];
|
|
97
|
-
case 9:
|
|
98
|
-
e_1_1 = _b.sent();
|
|
99
|
-
e_1 = { error: e_1_1 };
|
|
100
|
-
return [3 /*break*/, 11];
|
|
101
|
-
case 10:
|
|
102
|
-
try {
|
|
103
|
-
if (mutationsList_1_1 && !mutationsList_1_1.done && (_a = mutationsList_1.return)) _a.call(mutationsList_1);
|
|
104
|
-
}
|
|
105
|
-
finally { if (e_1) throw e_1.error; }
|
|
106
|
-
return [7 /*endfinally*/];
|
|
107
|
-
case 11:
|
|
108
|
-
this.nodeRegistrar.refreshAll();
|
|
109
|
-
return [2 /*return*/];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}); });
|
|
113
|
-
}
|
|
114
|
-
return this._observer;
|
|
115
|
-
},
|
|
116
|
-
enumerable: false,
|
|
117
|
-
configurable: true
|
|
118
|
-
});
|
|
119
|
-
Observer.prototype.observe = function () {
|
|
120
|
-
if (!this.observer) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (this._observing) {
|
|
124
|
-
throw new Error('Tolgee: Observer is already running');
|
|
125
|
-
}
|
|
126
|
-
this._observing = true;
|
|
127
|
-
this.observer.observe(this.properties.config.targetElement, {
|
|
128
|
-
attributes: true,
|
|
129
|
-
childList: true,
|
|
130
|
-
subtree: true,
|
|
131
|
-
characterData: true,
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
Observer.prototype.stopObserving = function () {
|
|
135
|
-
if (!this.observer) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
this._observing = false;
|
|
139
|
-
this.observer.disconnect();
|
|
140
|
-
};
|
|
141
|
-
return Observer;
|
|
142
|
-
}());
|
|
143
|
-
export { Observer };
|
|
144
|
-
//# sourceMappingURL=Observer.js.map
|
package/lib/Observer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Observer.js","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;IACE,kBACU,UAAsB,EACtB,WAA4B,EAC5B,aAA+B;QAF/B,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAiB;QAC5B,kBAAa,GAAb,aAAa,CAAkB;QAGjC,cAAS,GAAG,SAAS,CAAC;QAC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,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,EAAE;YAC1D,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;IACL,CAAC;IAEM,gCAAa,GAApB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QACD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IACH,eAAC;AAAD,CAAC,AA/DD,IA+DC"}
|
package/lib/Properties.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
var PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY = '__tolgee_preferredLanguages';
|
|
2
|
-
var CURRENT_LANGUAGE_LOCAL_STORAGE_KEY = '__tolgee_currentLanguage';
|
|
3
|
-
var Properties = /** @class */ (function () {
|
|
4
|
-
function Properties() {
|
|
5
|
-
}
|
|
6
|
-
Object.defineProperty(Properties.prototype, "currentLanguage", {
|
|
7
|
-
get: function () {
|
|
8
|
-
var _a;
|
|
9
|
-
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.forceLanguage) {
|
|
10
|
-
return this.config.forceLanguage;
|
|
11
|
-
}
|
|
12
|
-
if (!this._currentLanguage) {
|
|
13
|
-
this._currentLanguage = this.getInitialLanguage();
|
|
14
|
-
}
|
|
15
|
-
return this._currentLanguage;
|
|
16
|
-
},
|
|
17
|
-
set: function (language) {
|
|
18
|
-
var _a;
|
|
19
|
-
if (!language) {
|
|
20
|
-
throw new Error("Setting invalid language value ".concat(language));
|
|
21
|
-
}
|
|
22
|
-
this._currentLanguage = language;
|
|
23
|
-
if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.enableLanguageStore) &&
|
|
24
|
-
typeof localStorage !== 'undefined') {
|
|
25
|
-
localStorage.setItem(CURRENT_LANGUAGE_LOCAL_STORAGE_KEY, language);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
enumerable: false,
|
|
29
|
-
configurable: true
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(Properties.prototype, "preferredLanguages", {
|
|
32
|
-
get: function () {
|
|
33
|
-
return new Set(JSON.parse(localStorage.getItem(PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY)));
|
|
34
|
-
},
|
|
35
|
-
set: function (languages) {
|
|
36
|
-
localStorage.setItem(PREFERRED_LANGUAGES_LOCAL_STORAGE_KEY, JSON.stringify(Array.from(languages)));
|
|
37
|
-
},
|
|
38
|
-
enumerable: false,
|
|
39
|
-
configurable: true
|
|
40
|
-
});
|
|
41
|
-
Properties.prototype.getInitialLanguage = function () {
|
|
42
|
-
if (this.config.enableLanguageStore) {
|
|
43
|
-
var storedLanguage = this.getStoredLanguage();
|
|
44
|
-
if (storedLanguage) {
|
|
45
|
-
return storedLanguage;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (this.config.enableLanguageDetection) {
|
|
49
|
-
var detectedLanguage = this.getLanguageByNavigator();
|
|
50
|
-
if (detectedLanguage) {
|
|
51
|
-
return detectedLanguage;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return this.config.defaultLanguage;
|
|
55
|
-
};
|
|
56
|
-
Properties.prototype.getStoredLanguage = function () {
|
|
57
|
-
if (typeof localStorage !== 'undefined') {
|
|
58
|
-
var storedLanguage = localStorage.getItem(CURRENT_LANGUAGE_LOCAL_STORAGE_KEY);
|
|
59
|
-
if (!this.config.availableLanguages) {
|
|
60
|
-
return storedLanguage;
|
|
61
|
-
}
|
|
62
|
-
var isSavedLanguageAvailable = this.config.availableLanguages.indexOf(storedLanguage) > -1;
|
|
63
|
-
if (isSavedLanguageAvailable) {
|
|
64
|
-
return storedLanguage;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
Properties.prototype.getLanguageByNavigator = function () {
|
|
69
|
-
if (typeof window !== 'undefined' && this.config.availableLanguages) {
|
|
70
|
-
var preferred_1 = window.navigator.language;
|
|
71
|
-
var exactMatch = this.config.availableLanguages.find(function (l) { return l === preferred_1; });
|
|
72
|
-
if (exactMatch) {
|
|
73
|
-
return exactMatch;
|
|
74
|
-
}
|
|
75
|
-
var getTwoLetters_1 = function (fullTag) { return fullTag.replace(/^(.+?)(-.*)?$/, '$1'); };
|
|
76
|
-
var preferredTwoLetter_1 = getTwoLetters_1(window.navigator.language);
|
|
77
|
-
var twoLetterMatch = this.config.availableLanguages.find(function (l) { return getTwoLetters_1(l) === preferredTwoLetter_1; });
|
|
78
|
-
if (twoLetterMatch) {
|
|
79
|
-
return twoLetterMatch;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
return Properties;
|
|
84
|
-
}());
|
|
85
|
-
export { Properties };
|
|
86
|
-
//# sourceMappingURL=Properties.js.map
|
package/lib/Properties.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Properties.js","sourceRoot":"","sources":["../src/Properties.ts"],"names":[],"mappings":"AAGA,IAAM,qCAAqC,GAAG,6BAA6B,CAAC;AAC5E,IAAM,kCAAkC,GAAG,0BAA0B,CAAC;AAEtE;IAAA;IAuGA,CAAC;IAjGC,sBAAI,uCAAe;aAAnB;;YACE,IAAI,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,EAAE;gBAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;aAClC;YAED,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;aACnD;YAED,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC/B,CAAC;aAED,UAAoB,QAAgB;;YAClC,IAAI,CAAC,QAAQ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