locize 4.0.14 → 4.0.15
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/cjs/ui/elements/highlightBox.js +1 -1
- package/dist/cjs/ui/elements/popup.js +1 -1
- package/dist/cjs/ui/highlightNode.js +2 -2
- package/dist/cjs/ui/popup.js +1 -1
- package/dist/cjs/utils.js +3 -3
- package/dist/esm/ui/elements/highlightBox.js +1 -1
- package/dist/esm/ui/elements/popup.js +1 -1
- package/dist/esm/ui/highlightNode.js +2 -2
- package/dist/esm/ui/popup.js +1 -1
- package/dist/esm/utils.js +3 -3
- package/dist/umd/locize.js +99 -58
- package/dist/umd/locize.min.js +1 -1
- package/locize.js +99 -58
- package/locize.min.js +1 -1
- package/package.json +2 -2
- package/src/ui/elements/highlightBox.js +6 -10
- package/src/ui/elements/popup.js +4 -4
- package/src/ui/highlightNode.js +7 -7
- package/src/ui/popup.js +10 -10
|
@@ -6,7 +6,7 @@ function HighlightBox(ele, borderColor, shadowColor) {
|
|
|
6
6
|
var rect = ele.getBoundingClientRect();
|
|
7
7
|
var box = document.createElement('div');
|
|
8
8
|
box.classList.add('i18next-editor-highlight');
|
|
9
|
-
box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: 1px solid "
|
|
9
|
+
box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: ").concat(borderColor === 'none' ? 'none' : "1px solid ".concat(borderColor), "; border-radius: 15px; ").concat(shadowColor ? "box-shadow: inset 1px 1px 5px rgba(255, 255, 255, 0.1), inset -1px -1px 5px rgba(61, 67, 69, 0.3), 0 0 20px 0 ".concat(shadowColor, ";") : '');
|
|
10
10
|
box.setAttribute('data-i18next-editor-element', 'true');
|
|
11
11
|
return box;
|
|
12
12
|
}
|
|
@@ -46,7 +46,7 @@ function Popup(url, cb) {
|
|
|
46
46
|
var popup = document.createElement('div');
|
|
47
47
|
popup.setAttribute('id', popupId);
|
|
48
48
|
popup.classList.add('i18next-editor-popup');
|
|
49
|
-
popup.style = "\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n z-index:
|
|
49
|
+
popup.style = "\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n z-index: 100000;\n ";
|
|
50
50
|
popup.setAttribute('data-i18next-editor-element', 'true');
|
|
51
51
|
var header = document.createElement('div');
|
|
52
52
|
header.classList.add('i18next-editor-popup-header');
|
|
@@ -17,7 +17,7 @@ var selected = {};
|
|
|
17
17
|
function highlight(item, node, keys) {
|
|
18
18
|
var rectEle = utils.getOptimizedBoundingRectEle(node);
|
|
19
19
|
if (!item.highlightBox) {
|
|
20
|
-
var box = highlightBox.HighlightBox(rectEle,
|
|
20
|
+
var box = highlightBox.HighlightBox(rectEle, 'none', 'rgba(0,0,0,0.1)');
|
|
21
21
|
document.body.appendChild(box);
|
|
22
22
|
item.highlightBox = box;
|
|
23
23
|
}
|
|
@@ -84,7 +84,7 @@ function selectedHighlight(item, node, keys) {
|
|
|
84
84
|
var id = item.id;
|
|
85
85
|
var rectEle = utils.getOptimizedBoundingRectEle(node);
|
|
86
86
|
if (!item.highlightBox) {
|
|
87
|
-
var box = highlightBox.HighlightBox(rectEle,
|
|
87
|
+
var box = highlightBox.HighlightBox(rectEle, 'none', vars.colors.gray);
|
|
88
88
|
document.body.appendChild(box);
|
|
89
89
|
item.highlightBox = box;
|
|
90
90
|
}
|
package/dist/cjs/ui/popup.js
CHANGED
|
@@ -12,7 +12,7 @@ function initDragElement() {
|
|
|
12
12
|
var popups = document.getElementsByClassName('i18next-editor-popup');
|
|
13
13
|
var elmnt = null;
|
|
14
14
|
var overlay = null;
|
|
15
|
-
var currentZIndex =
|
|
15
|
+
var currentZIndex = 100000;
|
|
16
16
|
for (var i = 0; i < popups.length; i++) {
|
|
17
17
|
var popup = popups[i];
|
|
18
18
|
var header = getHeader(popup);
|
package/dist/cjs/utils.js
CHANGED
|
@@ -88,7 +88,7 @@ function getI18nMetaFromNode(el) {
|
|
|
88
88
|
}
|
|
89
89
|
function getElementNamespace(el) {
|
|
90
90
|
var found;
|
|
91
|
-
var
|
|
91
|
+
var _find = function find(ele) {
|
|
92
92
|
var opts = getAttribute(ele, 'i18next-options');
|
|
93
93
|
if (!opts) opts = getAttribute(ele, 'data-i18next-options');
|
|
94
94
|
if (!opts) opts = getAttribute(ele, 'i18n-options');
|
|
@@ -104,9 +104,9 @@ function getElementNamespace(el) {
|
|
|
104
104
|
if (!found) found = getAttribute(ele, 'data-i18next-ns');
|
|
105
105
|
if (!found) found = getAttribute(ele, 'i18n-ns');
|
|
106
106
|
if (!found) found = getAttribute(ele, 'data-i18n-ns');
|
|
107
|
-
if (!found && ele.parentElement)
|
|
107
|
+
if (!found && ele.parentElement) _find(ele.parentElement);
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
_find(el);
|
|
110
110
|
return found;
|
|
111
111
|
}
|
|
112
112
|
function getQsParameterByName(name, url) {
|
|
@@ -2,7 +2,7 @@ function HighlightBox(ele, borderColor, shadowColor) {
|
|
|
2
2
|
var rect = ele.getBoundingClientRect();
|
|
3
3
|
var box = document.createElement('div');
|
|
4
4
|
box.classList.add('i18next-editor-highlight');
|
|
5
|
-
box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: 1px solid "
|
|
5
|
+
box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: ").concat(borderColor === 'none' ? 'none' : "1px solid ".concat(borderColor), "; border-radius: 15px; ").concat(shadowColor ? "box-shadow: inset 1px 1px 5px rgba(255, 255, 255, 0.1), inset -1px -1px 5px rgba(61, 67, 69, 0.3), 0 0 20px 0 ".concat(shadowColor, ";") : '');
|
|
6
6
|
box.setAttribute('data-i18next-editor-element', 'true');
|
|
7
7
|
return box;
|
|
8
8
|
}
|
|
@@ -42,7 +42,7 @@ function Popup(url, cb) {
|
|
|
42
42
|
var popup = document.createElement('div');
|
|
43
43
|
popup.setAttribute('id', popupId);
|
|
44
44
|
popup.classList.add('i18next-editor-popup');
|
|
45
|
-
popup.style = "\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n z-index:
|
|
45
|
+
popup.style = "\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n z-index: 100000;\n ";
|
|
46
46
|
popup.setAttribute('data-i18next-editor-element', 'true');
|
|
47
47
|
var header = document.createElement('div');
|
|
48
48
|
header.classList.add('i18next-editor-popup-header');
|
|
@@ -9,7 +9,7 @@ var selected = {};
|
|
|
9
9
|
function highlight(item, node, keys) {
|
|
10
10
|
var rectEle = getOptimizedBoundingRectEle(node);
|
|
11
11
|
if (!item.highlightBox) {
|
|
12
|
-
var box = HighlightBox(rectEle,
|
|
12
|
+
var box = HighlightBox(rectEle, 'none', 'rgba(0,0,0,0.1)');
|
|
13
13
|
document.body.appendChild(box);
|
|
14
14
|
item.highlightBox = box;
|
|
15
15
|
}
|
|
@@ -76,7 +76,7 @@ function selectedHighlight(item, node, keys) {
|
|
|
76
76
|
var id = item.id;
|
|
77
77
|
var rectEle = getOptimizedBoundingRectEle(node);
|
|
78
78
|
if (!item.highlightBox) {
|
|
79
|
-
var box = HighlightBox(rectEle,
|
|
79
|
+
var box = HighlightBox(rectEle, 'none', colors.gray);
|
|
80
80
|
document.body.appendChild(box);
|
|
81
81
|
item.highlightBox = box;
|
|
82
82
|
}
|
package/dist/esm/ui/popup.js
CHANGED
|
@@ -8,7 +8,7 @@ function initDragElement() {
|
|
|
8
8
|
var popups = document.getElementsByClassName('i18next-editor-popup');
|
|
9
9
|
var elmnt = null;
|
|
10
10
|
var overlay = null;
|
|
11
|
-
var currentZIndex =
|
|
11
|
+
var currentZIndex = 100000;
|
|
12
12
|
for (var i = 0; i < popups.length; i++) {
|
|
13
13
|
var popup = popups[i];
|
|
14
14
|
var header = getHeader(popup);
|
package/dist/esm/utils.js
CHANGED
|
@@ -80,7 +80,7 @@ function getI18nMetaFromNode(el) {
|
|
|
80
80
|
}
|
|
81
81
|
function getElementNamespace(el) {
|
|
82
82
|
var found;
|
|
83
|
-
var
|
|
83
|
+
var _find = function find(ele) {
|
|
84
84
|
var opts = getAttribute(ele, 'i18next-options');
|
|
85
85
|
if (!opts) opts = getAttribute(ele, 'data-i18next-options');
|
|
86
86
|
if (!opts) opts = getAttribute(ele, 'i18n-options');
|
|
@@ -96,9 +96,9 @@ function getElementNamespace(el) {
|
|
|
96
96
|
if (!found) found = getAttribute(ele, 'data-i18next-ns');
|
|
97
97
|
if (!found) found = getAttribute(ele, 'i18n-ns');
|
|
98
98
|
if (!found) found = getAttribute(ele, 'data-i18n-ns');
|
|
99
|
-
if (!found && ele.parentElement)
|
|
99
|
+
if (!found && ele.parentElement) _find(ele.parentElement);
|
|
100
100
|
};
|
|
101
|
-
|
|
101
|
+
_find(el);
|
|
102
102
|
return found;
|
|
103
103
|
}
|
|
104
104
|
function getQsParameterByName(name, url) {
|
package/dist/umd/locize.js
CHANGED
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
}
|
|
397
397
|
function getElementNamespace(el) {
|
|
398
398
|
var found;
|
|
399
|
-
var
|
|
399
|
+
var _find = function find(ele) {
|
|
400
400
|
var opts = getAttribute(ele, 'i18next-options');
|
|
401
401
|
if (!opts) opts = getAttribute(ele, 'data-i18next-options');
|
|
402
402
|
if (!opts) opts = getAttribute(ele, 'i18n-options');
|
|
@@ -412,9 +412,9 @@
|
|
|
412
412
|
if (!found) found = getAttribute(ele, 'data-i18next-ns');
|
|
413
413
|
if (!found) found = getAttribute(ele, 'i18n-ns');
|
|
414
414
|
if (!found) found = getAttribute(ele, 'data-i18n-ns');
|
|
415
|
-
if (!found && ele.parentElement)
|
|
415
|
+
if (!found && ele.parentElement) _find(ele.parentElement);
|
|
416
416
|
};
|
|
417
|
-
|
|
417
|
+
_find(el);
|
|
418
418
|
return found;
|
|
419
419
|
}
|
|
420
420
|
function getQsParameterByName(name, url) {
|
|
@@ -853,7 +853,7 @@
|
|
|
853
853
|
var popup = document.createElement('div');
|
|
854
854
|
popup.setAttribute('id', popupId);
|
|
855
855
|
popup.classList.add('i18next-editor-popup');
|
|
856
|
-
popup.style = "\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n z-index:
|
|
856
|
+
popup.style = "\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n z-index: 100000;\n ";
|
|
857
857
|
popup.setAttribute('data-i18next-editor-element', 'true');
|
|
858
858
|
var header = document.createElement('div');
|
|
859
859
|
header.classList.add('i18next-editor-popup-header');
|
|
@@ -1053,7 +1053,7 @@
|
|
|
1053
1053
|
var rect = ele.getBoundingClientRect();
|
|
1054
1054
|
var box = document.createElement('div');
|
|
1055
1055
|
box.classList.add('i18next-editor-highlight');
|
|
1056
|
-
box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: 1px solid "
|
|
1056
|
+
box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: ").concat(borderColor === 'none' ? 'none' : "1px solid ".concat(borderColor), "; border-radius: 15px; ").concat(shadowColor ? "box-shadow: inset 1px 1px 5px rgba(255, 255, 255, 0.1), inset -1px -1px 5px rgba(61, 67, 69, 0.3), 0 0 20px 0 ".concat(shadowColor, ";") : '');
|
|
1057
1057
|
box.setAttribute('data-i18next-editor-element', 'true');
|
|
1058
1058
|
return box;
|
|
1059
1059
|
}
|
|
@@ -1101,8 +1101,9 @@
|
|
|
1101
1101
|
function getAxisLength(axis) {
|
|
1102
1102
|
return axis === 'y' ? 'height' : 'width';
|
|
1103
1103
|
}
|
|
1104
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
1104
1105
|
function getSideAxis(placement) {
|
|
1105
|
-
return
|
|
1106
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
1106
1107
|
}
|
|
1107
1108
|
function getAlignmentAxis(placement) {
|
|
1108
1109
|
return getOppositeAxis(getSideAxis(placement));
|
|
@@ -1127,19 +1128,19 @@
|
|
|
1127
1128
|
function getOppositeAlignmentPlacement(placement) {
|
|
1128
1129
|
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
1129
1130
|
}
|
|
1131
|
+
const lrPlacement = ['left', 'right'];
|
|
1132
|
+
const rlPlacement = ['right', 'left'];
|
|
1133
|
+
const tbPlacement = ['top', 'bottom'];
|
|
1134
|
+
const btPlacement = ['bottom', 'top'];
|
|
1130
1135
|
function getSideList(side, isStart, rtl) {
|
|
1131
|
-
const lr = ['left', 'right'];
|
|
1132
|
-
const rl = ['right', 'left'];
|
|
1133
|
-
const tb = ['top', 'bottom'];
|
|
1134
|
-
const bt = ['bottom', 'top'];
|
|
1135
1136
|
switch (side) {
|
|
1136
1137
|
case 'top':
|
|
1137
1138
|
case 'bottom':
|
|
1138
|
-
if (rtl) return isStart ?
|
|
1139
|
-
return isStart ?
|
|
1139
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
1140
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
1140
1141
|
case 'left':
|
|
1141
1142
|
case 'right':
|
|
1142
|
-
return isStart ?
|
|
1143
|
+
return isStart ? tbPlacement : btPlacement;
|
|
1143
1144
|
default:
|
|
1144
1145
|
return [];
|
|
1145
1146
|
}
|
|
@@ -1662,16 +1663,22 @@
|
|
|
1662
1663
|
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
1663
1664
|
const nextPlacement = placements[nextIndex];
|
|
1664
1665
|
if (nextPlacement) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1666
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
1667
|
+
if (!ignoreCrossAxisOverflow ||
|
|
1668
|
+
// We leave the current main axis only if every placement on that axis
|
|
1669
|
+
// overflows the main axis.
|
|
1670
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
1671
|
+
// Try next placement and re-run the lifecycle.
|
|
1672
|
+
return {
|
|
1673
|
+
data: {
|
|
1674
|
+
index: nextIndex,
|
|
1675
|
+
overflows: overflowsData
|
|
1676
|
+
},
|
|
1677
|
+
reset: {
|
|
1678
|
+
placement: nextPlacement
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1675
1682
|
}
|
|
1676
1683
|
|
|
1677
1684
|
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
@@ -1917,6 +1924,8 @@
|
|
|
1917
1924
|
};
|
|
1918
1925
|
};
|
|
1919
1926
|
|
|
1927
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
1928
|
+
|
|
1920
1929
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
1921
1930
|
// Derivable.
|
|
1922
1931
|
|
|
@@ -1930,7 +1939,7 @@
|
|
|
1930
1939
|
const side = getSide(placement);
|
|
1931
1940
|
const alignment = getAlignment(placement);
|
|
1932
1941
|
const isVertical = getSideAxis(placement) === 'y';
|
|
1933
|
-
const mainAxisMulti =
|
|
1942
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
1934
1943
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1935
1944
|
const rawValue = evaluate(options, state);
|
|
1936
1945
|
|
|
@@ -2130,7 +2139,7 @@
|
|
|
2130
2139
|
if (checkCrossAxis) {
|
|
2131
2140
|
var _middlewareData$offse, _middlewareData$offse2;
|
|
2132
2141
|
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
2133
|
-
const isOriginSide =
|
|
2142
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
2134
2143
|
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
2135
2144
|
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
2136
2145
|
if (crossAxisCoord < limitMin) {
|
|
@@ -2275,34 +2284,40 @@
|
|
|
2275
2284
|
}
|
|
2276
2285
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2277
2286
|
}
|
|
2287
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
2278
2288
|
function isOverflowElement(element) {
|
|
2279
2289
|
const {
|
|
2280
2290
|
overflow,
|
|
2281
2291
|
overflowX,
|
|
2282
2292
|
overflowY,
|
|
2283
2293
|
display
|
|
2284
|
-
} = getComputedStyle(element);
|
|
2285
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !
|
|
2294
|
+
} = getComputedStyle$1(element);
|
|
2295
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
2286
2296
|
}
|
|
2297
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
2287
2298
|
function isTableElement(element) {
|
|
2288
|
-
return
|
|
2299
|
+
return tableElements.has(getNodeName(element));
|
|
2289
2300
|
}
|
|
2301
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
2290
2302
|
function isTopLayer(element) {
|
|
2291
|
-
return
|
|
2303
|
+
return topLayerSelectors.some(selector => {
|
|
2292
2304
|
try {
|
|
2293
2305
|
return element.matches(selector);
|
|
2294
|
-
} catch (
|
|
2306
|
+
} catch (_e) {
|
|
2295
2307
|
return false;
|
|
2296
2308
|
}
|
|
2297
2309
|
});
|
|
2298
2310
|
}
|
|
2311
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
2312
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
2313
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
2299
2314
|
function isContainingBlock(elementOrCss) {
|
|
2300
2315
|
const webkit = isWebKit();
|
|
2301
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2316
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
2302
2317
|
|
|
2303
2318
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2304
2319
|
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
2305
|
-
return
|
|
2320
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
2306
2321
|
}
|
|
2307
2322
|
function getContainingBlock(element) {
|
|
2308
2323
|
let currentNode = getParentNode(element);
|
|
@@ -2320,10 +2335,11 @@
|
|
|
2320
2335
|
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
2321
2336
|
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
2322
2337
|
}
|
|
2338
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
2323
2339
|
function isLastTraversableNode(node) {
|
|
2324
|
-
return
|
|
2340
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
2325
2341
|
}
|
|
2326
|
-
function getComputedStyle(element) {
|
|
2342
|
+
function getComputedStyle$1(element) {
|
|
2327
2343
|
return getWindow(element).getComputedStyle(element);
|
|
2328
2344
|
}
|
|
2329
2345
|
function getNodeScroll(element) {
|
|
@@ -2385,7 +2401,7 @@
|
|
|
2385
2401
|
}
|
|
2386
2402
|
|
|
2387
2403
|
function getCssDimensions(element) {
|
|
2388
|
-
const css = getComputedStyle(element);
|
|
2404
|
+
const css = getComputedStyle$1(element);
|
|
2389
2405
|
// In testing environments, the `width` and `height` properties are empty
|
|
2390
2406
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
2391
2407
|
let width = parseFloat(css.width) || 0;
|
|
@@ -2490,7 +2506,7 @@
|
|
|
2490
2506
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2491
2507
|
const iframeScale = getScale(currentIFrame);
|
|
2492
2508
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2493
|
-
const css = getComputedStyle(currentIFrame);
|
|
2509
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2494
2510
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2495
2511
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2496
2512
|
x *= iframeScale.x;
|
|
@@ -2521,14 +2537,9 @@
|
|
|
2521
2537
|
return rect.left + leftScroll;
|
|
2522
2538
|
}
|
|
2523
2539
|
|
|
2524
|
-
function getHTMLOffset(documentElement, scroll
|
|
2525
|
-
if (ignoreScrollbarX === void 0) {
|
|
2526
|
-
ignoreScrollbarX = false;
|
|
2527
|
-
}
|
|
2540
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
2528
2541
|
const htmlRect = documentElement.getBoundingClientRect();
|
|
2529
|
-
const x = htmlRect.left + scroll.scrollLeft - (
|
|
2530
|
-
// RTL <body> scrollbar.
|
|
2531
|
-
getWindowScrollBarX(documentElement, htmlRect));
|
|
2542
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
2532
2543
|
const y = htmlRect.top + scroll.scrollTop;
|
|
2533
2544
|
return {
|
|
2534
2545
|
x,
|
|
@@ -2567,7 +2578,7 @@
|
|
|
2567
2578
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2568
2579
|
}
|
|
2569
2580
|
}
|
|
2570
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll
|
|
2581
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2571
2582
|
return {
|
|
2572
2583
|
width: rect.width * scale.x,
|
|
2573
2584
|
height: rect.height * scale.y,
|
|
@@ -2590,7 +2601,7 @@
|
|
|
2590
2601
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2591
2602
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2592
2603
|
const y = -scroll.scrollTop;
|
|
2593
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
2604
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
2594
2605
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2595
2606
|
}
|
|
2596
2607
|
return {
|
|
@@ -2601,6 +2612,10 @@
|
|
|
2601
2612
|
};
|
|
2602
2613
|
}
|
|
2603
2614
|
|
|
2615
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
2616
|
+
// calculation is affected by unusual styles.
|
|
2617
|
+
// Most scrollbars leave 15-18px of space.
|
|
2618
|
+
const SCROLLBAR_MAX = 25;
|
|
2604
2619
|
function getViewportRect(element, strategy) {
|
|
2605
2620
|
const win = getWindow(element);
|
|
2606
2621
|
const html = getDocumentElement(element);
|
|
@@ -2618,6 +2633,24 @@
|
|
|
2618
2633
|
y = visualViewport.offsetTop;
|
|
2619
2634
|
}
|
|
2620
2635
|
}
|
|
2636
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
2637
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
2638
|
+
// visual width of the <html> but this is not considered in the size
|
|
2639
|
+
// of `html.clientWidth`.
|
|
2640
|
+
if (windowScrollbarX <= 0) {
|
|
2641
|
+
const doc = html.ownerDocument;
|
|
2642
|
+
const body = doc.body;
|
|
2643
|
+
const bodyStyles = getComputedStyle(body);
|
|
2644
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
2645
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
2646
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
2647
|
+
width -= clippingStableScrollbarWidth;
|
|
2648
|
+
}
|
|
2649
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
2650
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
2651
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
2652
|
+
width += windowScrollbarX;
|
|
2653
|
+
}
|
|
2621
2654
|
return {
|
|
2622
2655
|
width,
|
|
2623
2656
|
height,
|
|
@@ -2626,6 +2659,7 @@
|
|
|
2626
2659
|
};
|
|
2627
2660
|
}
|
|
2628
2661
|
|
|
2662
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
2629
2663
|
// Returns the inner client rect, subtracting scrollbars if present.
|
|
2630
2664
|
function getInnerBoundingClientRect(element, strategy) {
|
|
2631
2665
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
@@ -2667,7 +2701,7 @@
|
|
|
2667
2701
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2668
2702
|
return false;
|
|
2669
2703
|
}
|
|
2670
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2704
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2671
2705
|
}
|
|
2672
2706
|
|
|
2673
2707
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -2680,17 +2714,17 @@
|
|
|
2680
2714
|
}
|
|
2681
2715
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2682
2716
|
let currentContainingBlockComputedStyle = null;
|
|
2683
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2717
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
2684
2718
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2685
2719
|
|
|
2686
2720
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2687
2721
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2688
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2722
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
2689
2723
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2690
2724
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2691
2725
|
currentContainingBlockComputedStyle = null;
|
|
2692
2726
|
}
|
|
2693
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle &&
|
|
2727
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2694
2728
|
if (shouldDropCurrentNode) {
|
|
2695
2729
|
// Drop non-containing blocks.
|
|
2696
2730
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -2753,6 +2787,12 @@
|
|
|
2753
2787
|
scrollTop: 0
|
|
2754
2788
|
};
|
|
2755
2789
|
const offsets = createCoords(0);
|
|
2790
|
+
|
|
2791
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
2792
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
2793
|
+
function setLeftRTLScrollbarOffset() {
|
|
2794
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2795
|
+
}
|
|
2756
2796
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2757
2797
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2758
2798
|
scroll = getNodeScroll(offsetParent);
|
|
@@ -2762,11 +2802,12 @@
|
|
|
2762
2802
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2763
2803
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2764
2804
|
} else if (documentElement) {
|
|
2765
|
-
|
|
2766
|
-
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
2767
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
2805
|
+
setLeftRTLScrollbarOffset();
|
|
2768
2806
|
}
|
|
2769
2807
|
}
|
|
2808
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
2809
|
+
setLeftRTLScrollbarOffset();
|
|
2810
|
+
}
|
|
2770
2811
|
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2771
2812
|
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
2772
2813
|
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
@@ -2779,11 +2820,11 @@
|
|
|
2779
2820
|
}
|
|
2780
2821
|
|
|
2781
2822
|
function isStaticPositioned(element) {
|
|
2782
|
-
return getComputedStyle(element).position === 'static';
|
|
2823
|
+
return getComputedStyle$1(element).position === 'static';
|
|
2783
2824
|
}
|
|
2784
2825
|
|
|
2785
2826
|
function getTrueOffsetParent(element, polyfill) {
|
|
2786
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2827
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
2787
2828
|
return null;
|
|
2788
2829
|
}
|
|
2789
2830
|
if (polyfill) {
|
|
@@ -2844,7 +2885,7 @@
|
|
|
2844
2885
|
};
|
|
2845
2886
|
|
|
2846
2887
|
function isRTL(element) {
|
|
2847
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
2888
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
2848
2889
|
}
|
|
2849
2890
|
|
|
2850
2891
|
const platform = {
|
|
@@ -2953,7 +2994,7 @@
|
|
|
2953
2994
|
function highlight(item, node, keys) {
|
|
2954
2995
|
var rectEle = getOptimizedBoundingRectEle(node);
|
|
2955
2996
|
if (!item.highlightBox) {
|
|
2956
|
-
var box = HighlightBox(rectEle,
|
|
2997
|
+
var box = HighlightBox(rectEle, 'none', 'rgba(0,0,0,0.1)');
|
|
2957
2998
|
document.body.appendChild(box);
|
|
2958
2999
|
item.highlightBox = box;
|
|
2959
3000
|
}
|
|
@@ -3020,7 +3061,7 @@
|
|
|
3020
3061
|
var id = item.id;
|
|
3021
3062
|
var rectEle = getOptimizedBoundingRectEle(node);
|
|
3022
3063
|
if (!item.highlightBox) {
|
|
3023
|
-
var box = HighlightBox(rectEle,
|
|
3064
|
+
var box = HighlightBox(rectEle, 'none', colors.gray);
|
|
3024
3065
|
document.body.appendChild(box);
|
|
3025
3066
|
item.highlightBox = box;
|
|
3026
3067
|
}
|
|
@@ -3412,7 +3453,7 @@
|
|
|
3412
3453
|
var popups = document.getElementsByClassName('i18next-editor-popup');
|
|
3413
3454
|
var elmnt = null;
|
|
3414
3455
|
var overlay = null;
|
|
3415
|
-
var currentZIndex =
|
|
3456
|
+
var currentZIndex = 100000;
|
|
3416
3457
|
for (var i = 0; i < popups.length; i++) {
|
|
3417
3458
|
var popup = popups[i];
|
|
3418
3459
|
var header = getHeader(popup);
|