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