@tolgee/core 4.5.0 → 4.6.0-rc.30a9509.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 +164 -114
- 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 +164 -114
- 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 +2 -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 +0 -0
- 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 +1 -0
- package/lib/highlighter/MouseEventHandler.d.ts +19 -13
- package/lib/highlighter/TranslationHighlighter.d.ts +1 -1
- package/lib/index.d.ts +0 -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 +1 -3
- 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 +5 -5
package/dist/tolgee.cjs.js
CHANGED
|
@@ -913,131 +913,158 @@ exports.ModifierKey = void 0;
|
|
|
913
913
|
ModifierKey[ModifierKey["Meta"] = 3] = "Meta";
|
|
914
914
|
})(exports.ModifierKey || (exports.ModifierKey = {}));
|
|
915
915
|
|
|
916
|
+
var RESTRICTED_ASCENDANT_ATTRIBUTE = 'data-tolgee-restricted';
|
|
917
|
+
var TOLGEE_ATTRIBUTE_NAME = '_tolgee';
|
|
918
|
+
var TOLGEE_TARGET_ATTRIBUTE = '_tolgee-target';
|
|
919
|
+
var TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE = 'data-tolgee-key-only';
|
|
920
|
+
var TOLGEE_HIGHLIGHTER_CLASS = '_tolgee-highlighter';
|
|
921
|
+
// needs to be same as in @tolgee/ui package
|
|
922
|
+
var DEVTOOLS_ID = '__tolgee_dev_tools';
|
|
923
|
+
|
|
924
|
+
var eCapture = {
|
|
925
|
+
capture: true,
|
|
926
|
+
};
|
|
927
|
+
var ePassive = {
|
|
928
|
+
capture: true,
|
|
929
|
+
passive: true,
|
|
930
|
+
};
|
|
916
931
|
var MouseEventHandler = /** @class */ (function () {
|
|
917
|
-
function MouseEventHandler(
|
|
932
|
+
function MouseEventHandler(dependencies) {
|
|
918
933
|
var _this = this;
|
|
919
|
-
this.
|
|
934
|
+
this.dependencies = dependencies;
|
|
920
935
|
this.keysDown = new Set();
|
|
921
|
-
this.mouseOn = new Set();
|
|
922
936
|
this.mouseOnChanged = new EventEmitterImpl();
|
|
923
937
|
this.keysChanged = new EventEmitterImpl();
|
|
924
|
-
this.
|
|
925
|
-
_this.
|
|
926
|
-
|
|
927
|
-
|
|
938
|
+
this.highlight = function (el) {
|
|
939
|
+
if (_this.highlighted !== el) {
|
|
940
|
+
_this.unhighlight();
|
|
941
|
+
if (el) {
|
|
942
|
+
el._tolgee.preventClean = true;
|
|
943
|
+
el._tolgee.highlight();
|
|
944
|
+
_this.highlighted = el;
|
|
945
|
+
_this.mouseOnChanged.emit(el);
|
|
946
|
+
}
|
|
928
947
|
}
|
|
929
948
|
};
|
|
930
|
-
this.highlight = function () {
|
|
931
|
-
_this.getMouseOn()._tolgee.highlight();
|
|
932
|
-
_this.highlighted = _this.getMouseOn();
|
|
933
|
-
};
|
|
934
949
|
this.unhighlight = function () {
|
|
935
950
|
if (_this.highlighted) {
|
|
951
|
+
_this.highlighted._tolgee.preventClean = false;
|
|
936
952
|
_this.highlighted._tolgee.unhighlight();
|
|
937
|
-
_this.highlighted =
|
|
938
|
-
|
|
939
|
-
};
|
|
940
|
-
this.onMouseOut = function (element) {
|
|
941
|
-
element._tolgee.preventClean = false;
|
|
942
|
-
_this.mouseOn.delete(element);
|
|
943
|
-
_this.mouseOnChanged.emit(_this.getMouseOn());
|
|
944
|
-
};
|
|
945
|
-
this.onMouseOver = function (element) {
|
|
946
|
-
_this.filterMouseOn();
|
|
947
|
-
element._tolgee.preventClean = true;
|
|
948
|
-
_this.mouseOn.delete(element); //to get in to last place
|
|
949
|
-
_this.mouseOn.add(element);
|
|
950
|
-
_this.mouseOnChanged.emit(_this.getMouseOn());
|
|
951
|
-
};
|
|
952
|
-
}
|
|
953
|
-
MouseEventHandler.prototype.run = function () {
|
|
954
|
-
if (typeof window !== 'undefined') {
|
|
955
|
-
this.initKeyListener();
|
|
956
|
-
return;
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
MouseEventHandler.prototype.handle = function (element, onclick) {
|
|
960
|
-
var _this = this;
|
|
961
|
-
if (element._tolgee.listeningForHighlighting) {
|
|
962
|
-
// eslint-disable-next-line no-console
|
|
963
|
-
console.error('Element is already listening mouse events! This is probably bug in tolgee');
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
element._tolgee.listeningForHighlighting = true;
|
|
967
|
-
this.initEventListeners(element, onclick);
|
|
968
|
-
this.mouseOnChanged.subscribe(function () {
|
|
969
|
-
if (_this.highlighted !== _this.getMouseOn()) {
|
|
970
|
-
_this.onConditionsChanged();
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
this.keysChanged.subscribe(function () {
|
|
974
|
-
_this.onConditionsChanged();
|
|
975
|
-
});
|
|
976
|
-
};
|
|
977
|
-
MouseEventHandler.prototype.initEventListeners = function (element, onclick) {
|
|
978
|
-
var _this = this;
|
|
979
|
-
var onMouseOver = function () { return _this.onMouseOver(element); };
|
|
980
|
-
var onMouseOut = function () { return _this.onMouseOut(element); };
|
|
981
|
-
var onClick = function (e) {
|
|
982
|
-
if (_this.areKeysDown() && _this.highlighted === e.currentTarget) {
|
|
983
|
-
e.stopPropagation();
|
|
984
|
-
e.preventDefault();
|
|
985
|
-
onclick(e);
|
|
953
|
+
_this.highlighted = undefined;
|
|
954
|
+
_this.mouseOnChanged.emit(_this.highlighted);
|
|
986
955
|
}
|
|
987
956
|
};
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
var onMouseDownOrUp = function (e) {
|
|
991
|
-
if (_this.areKeysDown()) {
|
|
957
|
+
this.blockEvents = function (e) {
|
|
958
|
+
if (_this.areKeysDown() && !_this.isInUiDialog(e.target)) {
|
|
992
959
|
e.stopPropagation();
|
|
993
960
|
e.preventDefault();
|
|
994
961
|
}
|
|
995
962
|
};
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
element.addEventListener('mouseout', onMouseOut);
|
|
999
|
-
element._tolgee.removeAllEventListeners = function () {
|
|
1000
|
-
element.removeEventListener('mousedown', onMouseDownOrUp);
|
|
1001
|
-
element.removeEventListener('mouseup', onMouseDownOrUp);
|
|
1002
|
-
element.removeEventListener('mouseover', onMouseOver);
|
|
1003
|
-
element.removeEventListener('click', onClick, { capture: true });
|
|
1004
|
-
element.removeEventListener('mouseout', onMouseOut);
|
|
963
|
+
this.onMouseMove = function (e) {
|
|
964
|
+
_this.updateCursorPosition({ x: e.clientX, y: e.clientY });
|
|
1005
965
|
};
|
|
1006
|
-
|
|
1007
|
-
MouseEventHandler.prototype.getMouseOn = function () {
|
|
1008
|
-
var mouseOnArray = Array.from(this.mouseOn);
|
|
1009
|
-
return mouseOnArray.length ? mouseOnArray[0] : undefined;
|
|
1010
|
-
};
|
|
1011
|
-
MouseEventHandler.prototype.initKeyListener = function () {
|
|
1012
|
-
var _this = this;
|
|
1013
|
-
window.addEventListener('blur', function () {
|
|
966
|
+
this.onBlur = function () {
|
|
1014
967
|
_this.keysDown = new Set();
|
|
1015
968
|
_this.keysChanged.emit(_this.areKeysDown());
|
|
1016
|
-
|
|
1017
|
-
|
|
969
|
+
_this.updateHighlight();
|
|
970
|
+
};
|
|
971
|
+
this.onKeyDown = function (e) {
|
|
1018
972
|
var modifierKey = exports.ModifierKey[e.key];
|
|
1019
973
|
if (modifierKey !== undefined) {
|
|
1020
974
|
_this.keysDown.add(modifierKey);
|
|
1021
975
|
_this.keysChanged.emit(_this.areKeysDown());
|
|
1022
976
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
977
|
+
_this.updateHighlight();
|
|
978
|
+
};
|
|
979
|
+
this.onKeyUp = function (e) {
|
|
1025
980
|
_this.keysDown.delete(exports.ModifierKey[e.key]);
|
|
1026
981
|
_this.keysChanged.emit(_this.areKeysDown());
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
982
|
+
_this.updateHighlight();
|
|
983
|
+
};
|
|
984
|
+
this.onScroll = function () {
|
|
985
|
+
var _a;
|
|
986
|
+
(_a = _this.highlighted) === null || _a === void 0 ? void 0 : _a._tolgee.highlight();
|
|
987
|
+
};
|
|
988
|
+
this.onClick = function (e) {
|
|
989
|
+
_this.blockEvents(e);
|
|
990
|
+
if (_this.areKeysDown()) {
|
|
991
|
+
var element = _this.getClosestTolgeeElement(e.target);
|
|
992
|
+
if (element && element === _this.highlighted) {
|
|
993
|
+
_this.dependencies.translationHighlighter.translationEdit(e, element);
|
|
994
|
+
_this.unhighlight();
|
|
995
|
+
}
|
|
1034
996
|
}
|
|
1035
|
-
}
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
MouseEventHandler.prototype.run = function () {
|
|
1000
|
+
if (typeof window !== 'undefined') {
|
|
1001
|
+
this.initEventListeners();
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
MouseEventHandler.prototype.stop = function () {
|
|
1005
|
+
if (typeof window !== 'undefined') {
|
|
1006
|
+
this.removeEventListeners();
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
MouseEventHandler.prototype.updateHighlight = function () {
|
|
1010
|
+
var position = this.cursorPosition;
|
|
1011
|
+
var newHighlighted;
|
|
1012
|
+
if (position && this.areKeysDown()) {
|
|
1013
|
+
newHighlighted = this.getClosestTolgeeElement(document.elementFromPoint(position.x, position.y));
|
|
1014
|
+
}
|
|
1015
|
+
this.highlight(newHighlighted);
|
|
1016
|
+
};
|
|
1017
|
+
MouseEventHandler.prototype.updateCursorPosition = function (position) {
|
|
1018
|
+
this.cursorPosition = position;
|
|
1019
|
+
this.updateHighlight();
|
|
1020
|
+
};
|
|
1021
|
+
MouseEventHandler.prototype.initEventListeners = function () {
|
|
1022
|
+
window.addEventListener('blur', this.onBlur, eCapture);
|
|
1023
|
+
window.addEventListener('keydown', this.onKeyDown, eCapture);
|
|
1024
|
+
window.addEventListener('keyup', this.onKeyUp, eCapture);
|
|
1025
|
+
window.addEventListener('mousemove', this.onMouseMove, ePassive);
|
|
1026
|
+
window.addEventListener('scroll', this.onScroll, ePassive);
|
|
1027
|
+
window.addEventListener('click', this.onClick, eCapture);
|
|
1028
|
+
window.addEventListener('mouseenter', this.blockEvents, eCapture);
|
|
1029
|
+
window.addEventListener('mouseover', this.blockEvents, eCapture);
|
|
1030
|
+
window.addEventListener('mouseout', this.blockEvents, eCapture);
|
|
1031
|
+
window.addEventListener('mouseleave', this.blockEvents, eCapture);
|
|
1032
|
+
window.addEventListener('mousedown', this.blockEvents, eCapture);
|
|
1033
|
+
window.addEventListener('mouseup', this.blockEvents, eCapture);
|
|
1034
|
+
};
|
|
1035
|
+
MouseEventHandler.prototype.removeEventListeners = function () {
|
|
1036
|
+
window.removeEventListener('blur', this.onBlur, eCapture);
|
|
1037
|
+
window.removeEventListener('keydown', this.onKeyDown, eCapture);
|
|
1038
|
+
window.removeEventListener('keyup', this.onKeyUp, eCapture);
|
|
1039
|
+
window.removeEventListener('mousemove', this.onMouseMove, ePassive);
|
|
1040
|
+
window.removeEventListener('scroll', this.onScroll, ePassive);
|
|
1041
|
+
window.removeEventListener('click', this.onClick, eCapture);
|
|
1042
|
+
window.removeEventListener('mouseenter', this.blockEvents, eCapture);
|
|
1043
|
+
window.removeEventListener('mouseover', this.blockEvents, eCapture);
|
|
1044
|
+
window.removeEventListener('mouseout', this.blockEvents, eCapture);
|
|
1045
|
+
window.removeEventListener('mouseleave', this.blockEvents, eCapture);
|
|
1046
|
+
window.removeEventListener('mousedown', this.blockEvents, eCapture);
|
|
1047
|
+
window.removeEventListener('mouseup', this.blockEvents, eCapture);
|
|
1048
|
+
};
|
|
1049
|
+
MouseEventHandler.prototype.isInUiDialog = function (element) {
|
|
1050
|
+
return Boolean(this.findAncestor(element, function (el) { return el.id === DEVTOOLS_ID; }));
|
|
1051
|
+
};
|
|
1052
|
+
MouseEventHandler.prototype.getClosestTolgeeElement = function (element) {
|
|
1053
|
+
return this.findAncestor(element, function (el) { return el === null || el === void 0 ? void 0 : el._tolgee; });
|
|
1054
|
+
};
|
|
1055
|
+
MouseEventHandler.prototype.findAncestor = function (element, func) {
|
|
1056
|
+
if (func(element)) {
|
|
1057
|
+
return element;
|
|
1058
|
+
}
|
|
1059
|
+
if (element === null || element === void 0 ? void 0 : element.parentElement) {
|
|
1060
|
+
return this.findAncestor(element.parentElement, func);
|
|
1061
|
+
}
|
|
1062
|
+
return undefined;
|
|
1036
1063
|
};
|
|
1037
1064
|
MouseEventHandler.prototype.areKeysDown = function () {
|
|
1038
1065
|
var e_1, _a;
|
|
1039
1066
|
try {
|
|
1040
|
-
for (var _b = __values(this.properties.config.highlightKeys), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1067
|
+
for (var _b = __values(this.dependencies.properties.config.highlightKeys), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1041
1068
|
var key = _c.value;
|
|
1042
1069
|
if (!this.keysDown.has(key)) {
|
|
1043
1070
|
return false;
|
|
@@ -1089,14 +1116,7 @@ var TranslationHighlighter = /** @class */ (function () {
|
|
|
1089
1116
|
}); })), false); }, []);
|
|
1090
1117
|
};
|
|
1091
1118
|
TranslationHighlighter.prototype.listen = function (element) {
|
|
1092
|
-
var _this = this;
|
|
1093
1119
|
this.dependencies.highlightFunctionInitializer.initFunctions(element);
|
|
1094
|
-
this.dependencies.mouseEventHandler.handle(element, function (e) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1095
|
-
switch (_a.label) {
|
|
1096
|
-
case 0: return [4 /*yield*/, this.translationEdit(e, element)];
|
|
1097
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
1098
|
-
}
|
|
1099
|
-
}); }); });
|
|
1100
1120
|
};
|
|
1101
1121
|
TranslationHighlighter.prototype.getRenderer = function () {
|
|
1102
1122
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1205,11 +1225,6 @@ var TranslationHighlighter = /** @class */ (function () {
|
|
|
1205
1225
|
return TranslationHighlighter;
|
|
1206
1226
|
}());
|
|
1207
1227
|
|
|
1208
|
-
var RESTRICTED_ASCENDANT_ATTRIBUTE = 'data-tolgee-restricted';
|
|
1209
|
-
var TOLGEE_ATTRIBUTE_NAME = '_tolgee';
|
|
1210
|
-
var TOLGEE_TARGET_ATTRIBUTE = '_tolgee-target';
|
|
1211
|
-
var TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE = 'data-tolgee-key-only';
|
|
1212
|
-
|
|
1213
1228
|
var NodeHelper = /** @class */ (function () {
|
|
1214
1229
|
function NodeHelper() {
|
|
1215
1230
|
}
|
|
@@ -1399,8 +1414,8 @@ var ElementRegistrar = /** @class */ (function () {
|
|
|
1399
1414
|
};
|
|
1400
1415
|
ElementRegistrar.prototype.cleanElement = function (element) {
|
|
1401
1416
|
if (!element._tolgee.preventClean) {
|
|
1402
|
-
if (
|
|
1403
|
-
element._tolgee.
|
|
1417
|
+
if (element._tolgee.highlightEl) {
|
|
1418
|
+
element._tolgee.unhighlight();
|
|
1404
1419
|
}
|
|
1405
1420
|
element.removeAttribute(TOLGEE_ATTRIBUTE_NAME);
|
|
1406
1421
|
delete element._tolgee;
|
|
@@ -1670,7 +1685,7 @@ var TolgeeConfig = /** @class */ (function () {
|
|
|
1670
1685
|
this.highlightKeys = [exports.ModifierKey.Alt];
|
|
1671
1686
|
this.passToParent = ['option', 'optgroup'];
|
|
1672
1687
|
this.restrictedElements = ['script', 'style'];
|
|
1673
|
-
this.highlightColor = 'rgb(
|
|
1688
|
+
this.highlightColor = 'rgb(255, 0, 0)';
|
|
1674
1689
|
this.wrapperMode = 'text';
|
|
1675
1690
|
/**
|
|
1676
1691
|
* When true, fallback language will be preloaded on Tolgee.run
|
|
@@ -1771,7 +1786,7 @@ var PluginManager = /** @class */ (function () {
|
|
|
1771
1786
|
this.handshake = function () {
|
|
1772
1787
|
var sharedConfiguration = __assign(__assign({}, _this.properties), { config: __assign(__assign({}, _this.properties.config), {
|
|
1773
1788
|
//remove properties, which cannot be sent by window.postMessage
|
|
1774
|
-
staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.
|
|
1789
|
+
staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.6.0-rc.30a9509.0" });
|
|
1775
1790
|
var timer = null;
|
|
1776
1791
|
var ping = function () {
|
|
1777
1792
|
_this.messages.send('TOLGEE_READY', sharedConfiguration);
|
|
@@ -1871,6 +1886,18 @@ var Messages = /** @class */ (function () {
|
|
|
1871
1886
|
return Messages;
|
|
1872
1887
|
}());
|
|
1873
1888
|
|
|
1889
|
+
var BORDER_WIDTH = 5;
|
|
1890
|
+
var HIGHLIGHTER_BASE_STYLE = {
|
|
1891
|
+
pointerEvents: 'none',
|
|
1892
|
+
position: 'fixed',
|
|
1893
|
+
boxSizing: 'content-box',
|
|
1894
|
+
zIndex: String(Number.MAX_SAFE_INTEGER),
|
|
1895
|
+
contain: 'layout',
|
|
1896
|
+
display: 'block',
|
|
1897
|
+
borderWidth: BORDER_WIDTH + 'px',
|
|
1898
|
+
borderStyle: 'solid',
|
|
1899
|
+
borderRadius: '4px',
|
|
1900
|
+
};
|
|
1874
1901
|
var HighlightFunctionsInitializer = /** @class */ (function () {
|
|
1875
1902
|
function HighlightFunctionsInitializer(properties) {
|
|
1876
1903
|
this.properties = properties;
|
|
@@ -1882,13 +1909,33 @@ var HighlightFunctionsInitializer = /** @class */ (function () {
|
|
|
1882
1909
|
HighlightFunctionsInitializer.prototype.initHighlightFunction = function (element) {
|
|
1883
1910
|
var _this = this;
|
|
1884
1911
|
element._tolgee.highlight = function () {
|
|
1885
|
-
element.
|
|
1886
|
-
|
|
1912
|
+
if (!element.isConnected) {
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
var highlightEl = element._tolgee.highlightEl;
|
|
1916
|
+
if (!highlightEl) {
|
|
1917
|
+
highlightEl = document.createElement('div');
|
|
1918
|
+
highlightEl.classList.add(TOLGEE_HIGHLIGHTER_CLASS);
|
|
1919
|
+
Object.entries(HIGHLIGHTER_BASE_STYLE).forEach(function (_a) {
|
|
1920
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
1921
|
+
highlightEl.style[key] = value;
|
|
1922
|
+
});
|
|
1923
|
+
highlightEl.style.borderColor = _this.properties.config.highlightColor;
|
|
1924
|
+
element._tolgee.highlightEl = highlightEl;
|
|
1925
|
+
document.body.appendChild(highlightEl);
|
|
1926
|
+
}
|
|
1927
|
+
var shape = element.getBoundingClientRect();
|
|
1928
|
+
highlightEl.style.top = shape.top - BORDER_WIDTH + 'px';
|
|
1929
|
+
highlightEl.style.left = shape.left - BORDER_WIDTH + 'px';
|
|
1930
|
+
highlightEl.style.width = shape.width + 'px';
|
|
1931
|
+
highlightEl.style.height = shape.height + 'px';
|
|
1887
1932
|
};
|
|
1888
1933
|
};
|
|
1889
1934
|
HighlightFunctionsInitializer.prototype.initUnhighlightFunction = function (element) {
|
|
1890
1935
|
element._tolgee.unhighlight = function () {
|
|
1891
|
-
|
|
1936
|
+
var _a;
|
|
1937
|
+
(_a = element._tolgee.highlightEl) === null || _a === void 0 ? void 0 : _a.remove();
|
|
1938
|
+
element._tolgee.highlightEl = null;
|
|
1892
1939
|
};
|
|
1893
1940
|
};
|
|
1894
1941
|
return HighlightFunctionsInitializer;
|
|
@@ -2912,7 +2959,7 @@ var DependencyService = /** @class */ (function () {
|
|
|
2912
2959
|
this.properties = new Properties();
|
|
2913
2960
|
this.eventService = new EventService();
|
|
2914
2961
|
this.apiHttpService = new ApiHttpService(this.properties);
|
|
2915
|
-
this.mouseEventHandler = new MouseEventHandler(this
|
|
2962
|
+
this.mouseEventHandler = new MouseEventHandler(this);
|
|
2916
2963
|
this.moduleService = new ModuleService();
|
|
2917
2964
|
this.coreService = new CoreService(this.properties, this.apiHttpService);
|
|
2918
2965
|
this.screenshotService = new ScreenshotService(this.coreService, this.apiHttpService);
|
|
@@ -2929,6 +2976,7 @@ var DependencyService = /** @class */ (function () {
|
|
|
2929
2976
|
this.stop = function () {
|
|
2930
2977
|
_this.observer.stopObserving();
|
|
2931
2978
|
_this.elementRegistrar.cleanAll();
|
|
2979
|
+
_this.mouseEventHandler.stop();
|
|
2932
2980
|
NodeHelper.unmarkElementAsTargetElement(_this.properties.config.targetElement);
|
|
2933
2981
|
};
|
|
2934
2982
|
this.translationHighlighter.pluginManager = this.pluginManager;
|
|
@@ -5634,10 +5682,12 @@ var IcuFormatter = (_a = /** @class */ (function () {
|
|
|
5634
5682
|
_a.type = 'formatter',
|
|
5635
5683
|
_a);
|
|
5636
5684
|
|
|
5685
|
+
exports.DEVTOOLS_ID = DEVTOOLS_ID;
|
|
5637
5686
|
exports.IcuFormatter = IcuFormatter;
|
|
5638
5687
|
exports.NodeHelper = NodeHelper;
|
|
5639
5688
|
exports.RESTRICTED_ASCENDANT_ATTRIBUTE = RESTRICTED_ASCENDANT_ATTRIBUTE;
|
|
5640
5689
|
exports.TOLGEE_ATTRIBUTE_NAME = TOLGEE_ATTRIBUTE_NAME;
|
|
5690
|
+
exports.TOLGEE_HIGHLIGHTER_CLASS = TOLGEE_HIGHLIGHTER_CLASS;
|
|
5641
5691
|
exports.TOLGEE_TARGET_ATTRIBUTE = TOLGEE_TARGET_ATTRIBUTE;
|
|
5642
5692
|
exports.TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE = TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE;
|
|
5643
5693
|
exports.TextHelper = TextHelper;
|