locize 4.0.14 → 4.0.16
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/elements/ribbonBox.js +5 -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/elements/ribbonBox.js +5 -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 +104 -59
- package/dist/umd/locize.min.js +1 -1
- package/locize.js +104 -59
- 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/elements/ribbonBox.js +7 -3
- 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');
|
|
@@ -48,7 +48,11 @@ function RibbonBox() {
|
|
|
48
48
|
btnbox.style = 'display: flex; flex-direction: column; align-items: flex-start; margin-left: 2px; margin-top: 1px';
|
|
49
49
|
Object.keys(keys).forEach(function (k) {
|
|
50
50
|
var data = keys[k];
|
|
51
|
-
var btn = RibbonButton(k.replace('attr:', ''), "".concat(data.ns, ":").concat(data.key), function () {
|
|
51
|
+
var btn = RibbonButton(k.replace('attr:', ''), "".concat(data.ns, ":").concat(data.key), function (e) {
|
|
52
|
+
if (e) {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
}
|
|
52
56
|
postMessage.api.selectKey(data);
|
|
53
57
|
});
|
|
54
58
|
btn.style.marginBottom = '2px';
|
|
@@ -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');
|
|
@@ -44,7 +44,11 @@ function RibbonBox() {
|
|
|
44
44
|
btnbox.style = 'display: flex; flex-direction: column; align-items: flex-start; margin-left: 2px; margin-top: 1px';
|
|
45
45
|
Object.keys(keys).forEach(function (k) {
|
|
46
46
|
var data = keys[k];
|
|
47
|
-
var btn = RibbonButton(k.replace('attr:', ''), "".concat(data.ns, ":").concat(data.key), function () {
|
|
47
|
+
var btn = RibbonButton(k.replace('attr:', ''), "".concat(data.ns, ":").concat(data.key), function (e) {
|
|
48
|
+
if (e) {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
}
|
|
48
52
|
api.selectKey(data);
|
|
49
53
|
});
|
|
50
54
|
btn.style.marginBottom = '2px';
|
|
@@ -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');
|
|
@@ -1036,7 +1036,11 @@
|
|
|
1036
1036
|
btnbox.style = 'display: flex; flex-direction: column; align-items: flex-start; margin-left: 2px; margin-top: 1px';
|
|
1037
1037
|
Object.keys(keys).forEach(function (k) {
|
|
1038
1038
|
var data = keys[k];
|
|
1039
|
-
var btn = RibbonButton(k.replace('attr:', ''), "".concat(data.ns, ":").concat(data.key), function () {
|
|
1039
|
+
var btn = RibbonButton(k.replace('attr:', ''), "".concat(data.ns, ":").concat(data.key), function (e) {
|
|
1040
|
+
if (e) {
|
|
1041
|
+
e.stopPropagation();
|
|
1042
|
+
e.preventDefault();
|
|
1043
|
+
}
|
|
1040
1044
|
api.selectKey(data);
|
|
1041
1045
|
});
|
|
1042
1046
|
btn.style.marginBottom = '2px';
|
|
@@ -1053,7 +1057,7 @@
|
|
|
1053
1057
|
var rect = ele.getBoundingClientRect();
|
|
1054
1058
|
var box = document.createElement('div');
|
|
1055
1059
|
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 "
|
|
1060
|
+
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
1061
|
box.setAttribute('data-i18next-editor-element', 'true');
|
|
1058
1062
|
return box;
|
|
1059
1063
|
}
|
|
@@ -1101,8 +1105,9 @@
|
|
|
1101
1105
|
function getAxisLength(axis) {
|
|
1102
1106
|
return axis === 'y' ? 'height' : 'width';
|
|
1103
1107
|
}
|
|
1108
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
1104
1109
|
function getSideAxis(placement) {
|
|
1105
|
-
return
|
|
1110
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
1106
1111
|
}
|
|
1107
1112
|
function getAlignmentAxis(placement) {
|
|
1108
1113
|
return getOppositeAxis(getSideAxis(placement));
|
|
@@ -1127,19 +1132,19 @@
|
|
|
1127
1132
|
function getOppositeAlignmentPlacement(placement) {
|
|
1128
1133
|
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
1129
1134
|
}
|
|
1135
|
+
const lrPlacement = ['left', 'right'];
|
|
1136
|
+
const rlPlacement = ['right', 'left'];
|
|
1137
|
+
const tbPlacement = ['top', 'bottom'];
|
|
1138
|
+
const btPlacement = ['bottom', 'top'];
|
|
1130
1139
|
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
1140
|
switch (side) {
|
|
1136
1141
|
case 'top':
|
|
1137
1142
|
case 'bottom':
|
|
1138
|
-
if (rtl) return isStart ?
|
|
1139
|
-
return isStart ?
|
|
1143
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
1144
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
1140
1145
|
case 'left':
|
|
1141
1146
|
case 'right':
|
|
1142
|
-
return isStart ?
|
|
1147
|
+
return isStart ? tbPlacement : btPlacement;
|
|
1143
1148
|
default:
|
|
1144
1149
|
return [];
|
|
1145
1150
|
}
|
|
@@ -1662,16 +1667,22 @@
|
|
|
1662
1667
|
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
1663
1668
|
const nextPlacement = placements[nextIndex];
|
|
1664
1669
|
if (nextPlacement) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1670
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
1671
|
+
if (!ignoreCrossAxisOverflow ||
|
|
1672
|
+
// We leave the current main axis only if every placement on that axis
|
|
1673
|
+
// overflows the main axis.
|
|
1674
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
1675
|
+
// Try next placement and re-run the lifecycle.
|
|
1676
|
+
return {
|
|
1677
|
+
data: {
|
|
1678
|
+
index: nextIndex,
|
|
1679
|
+
overflows: overflowsData
|
|
1680
|
+
},
|
|
1681
|
+
reset: {
|
|
1682
|
+
placement: nextPlacement
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1675
1686
|
}
|
|
1676
1687
|
|
|
1677
1688
|
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
@@ -1917,6 +1928,8 @@
|
|
|
1917
1928
|
};
|
|
1918
1929
|
};
|
|
1919
1930
|
|
|
1931
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
1932
|
+
|
|
1920
1933
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
1921
1934
|
// Derivable.
|
|
1922
1935
|
|
|
@@ -1930,7 +1943,7 @@
|
|
|
1930
1943
|
const side = getSide(placement);
|
|
1931
1944
|
const alignment = getAlignment(placement);
|
|
1932
1945
|
const isVertical = getSideAxis(placement) === 'y';
|
|
1933
|
-
const mainAxisMulti =
|
|
1946
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
1934
1947
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1935
1948
|
const rawValue = evaluate(options, state);
|
|
1936
1949
|
|
|
@@ -2130,7 +2143,7 @@
|
|
|
2130
2143
|
if (checkCrossAxis) {
|
|
2131
2144
|
var _middlewareData$offse, _middlewareData$offse2;
|
|
2132
2145
|
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
2133
|
-
const isOriginSide =
|
|
2146
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
2134
2147
|
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
2148
|
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
2149
|
if (crossAxisCoord < limitMin) {
|
|
@@ -2275,34 +2288,40 @@
|
|
|
2275
2288
|
}
|
|
2276
2289
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2277
2290
|
}
|
|
2291
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
2278
2292
|
function isOverflowElement(element) {
|
|
2279
2293
|
const {
|
|
2280
2294
|
overflow,
|
|
2281
2295
|
overflowX,
|
|
2282
2296
|
overflowY,
|
|
2283
2297
|
display
|
|
2284
|
-
} = getComputedStyle(element);
|
|
2285
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !
|
|
2298
|
+
} = getComputedStyle$1(element);
|
|
2299
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
2286
2300
|
}
|
|
2301
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
2287
2302
|
function isTableElement(element) {
|
|
2288
|
-
return
|
|
2303
|
+
return tableElements.has(getNodeName(element));
|
|
2289
2304
|
}
|
|
2305
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
2290
2306
|
function isTopLayer(element) {
|
|
2291
|
-
return
|
|
2307
|
+
return topLayerSelectors.some(selector => {
|
|
2292
2308
|
try {
|
|
2293
2309
|
return element.matches(selector);
|
|
2294
|
-
} catch (
|
|
2310
|
+
} catch (_e) {
|
|
2295
2311
|
return false;
|
|
2296
2312
|
}
|
|
2297
2313
|
});
|
|
2298
2314
|
}
|
|
2315
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
2316
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
2317
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
2299
2318
|
function isContainingBlock(elementOrCss) {
|
|
2300
2319
|
const webkit = isWebKit();
|
|
2301
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2320
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
2302
2321
|
|
|
2303
2322
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2304
2323
|
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
2305
|
-
return
|
|
2324
|
+
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
2325
|
}
|
|
2307
2326
|
function getContainingBlock(element) {
|
|
2308
2327
|
let currentNode = getParentNode(element);
|
|
@@ -2320,10 +2339,11 @@
|
|
|
2320
2339
|
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
2321
2340
|
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
2322
2341
|
}
|
|
2342
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
2323
2343
|
function isLastTraversableNode(node) {
|
|
2324
|
-
return
|
|
2344
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
2325
2345
|
}
|
|
2326
|
-
function getComputedStyle(element) {
|
|
2346
|
+
function getComputedStyle$1(element) {
|
|
2327
2347
|
return getWindow(element).getComputedStyle(element);
|
|
2328
2348
|
}
|
|
2329
2349
|
function getNodeScroll(element) {
|
|
@@ -2385,7 +2405,7 @@
|
|
|
2385
2405
|
}
|
|
2386
2406
|
|
|
2387
2407
|
function getCssDimensions(element) {
|
|
2388
|
-
const css = getComputedStyle(element);
|
|
2408
|
+
const css = getComputedStyle$1(element);
|
|
2389
2409
|
// In testing environments, the `width` and `height` properties are empty
|
|
2390
2410
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
2391
2411
|
let width = parseFloat(css.width) || 0;
|
|
@@ -2490,7 +2510,7 @@
|
|
|
2490
2510
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2491
2511
|
const iframeScale = getScale(currentIFrame);
|
|
2492
2512
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2493
|
-
const css = getComputedStyle(currentIFrame);
|
|
2513
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2494
2514
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2495
2515
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2496
2516
|
x *= iframeScale.x;
|
|
@@ -2521,14 +2541,9 @@
|
|
|
2521
2541
|
return rect.left + leftScroll;
|
|
2522
2542
|
}
|
|
2523
2543
|
|
|
2524
|
-
function getHTMLOffset(documentElement, scroll
|
|
2525
|
-
if (ignoreScrollbarX === void 0) {
|
|
2526
|
-
ignoreScrollbarX = false;
|
|
2527
|
-
}
|
|
2544
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
2528
2545
|
const htmlRect = documentElement.getBoundingClientRect();
|
|
2529
|
-
const x = htmlRect.left + scroll.scrollLeft - (
|
|
2530
|
-
// RTL <body> scrollbar.
|
|
2531
|
-
getWindowScrollBarX(documentElement, htmlRect));
|
|
2546
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
2532
2547
|
const y = htmlRect.top + scroll.scrollTop;
|
|
2533
2548
|
return {
|
|
2534
2549
|
x,
|
|
@@ -2567,7 +2582,7 @@
|
|
|
2567
2582
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2568
2583
|
}
|
|
2569
2584
|
}
|
|
2570
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll
|
|
2585
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2571
2586
|
return {
|
|
2572
2587
|
width: rect.width * scale.x,
|
|
2573
2588
|
height: rect.height * scale.y,
|
|
@@ -2590,7 +2605,7 @@
|
|
|
2590
2605
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2591
2606
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2592
2607
|
const y = -scroll.scrollTop;
|
|
2593
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
2608
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
2594
2609
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2595
2610
|
}
|
|
2596
2611
|
return {
|
|
@@ -2601,6 +2616,10 @@
|
|
|
2601
2616
|
};
|
|
2602
2617
|
}
|
|
2603
2618
|
|
|
2619
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
2620
|
+
// calculation is affected by unusual styles.
|
|
2621
|
+
// Most scrollbars leave 15-18px of space.
|
|
2622
|
+
const SCROLLBAR_MAX = 25;
|
|
2604
2623
|
function getViewportRect(element, strategy) {
|
|
2605
2624
|
const win = getWindow(element);
|
|
2606
2625
|
const html = getDocumentElement(element);
|
|
@@ -2618,6 +2637,24 @@
|
|
|
2618
2637
|
y = visualViewport.offsetTop;
|
|
2619
2638
|
}
|
|
2620
2639
|
}
|
|
2640
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
2641
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
2642
|
+
// visual width of the <html> but this is not considered in the size
|
|
2643
|
+
// of `html.clientWidth`.
|
|
2644
|
+
if (windowScrollbarX <= 0) {
|
|
2645
|
+
const doc = html.ownerDocument;
|
|
2646
|
+
const body = doc.body;
|
|
2647
|
+
const bodyStyles = getComputedStyle(body);
|
|
2648
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
2649
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
2650
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
2651
|
+
width -= clippingStableScrollbarWidth;
|
|
2652
|
+
}
|
|
2653
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
2654
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
2655
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
2656
|
+
width += windowScrollbarX;
|
|
2657
|
+
}
|
|
2621
2658
|
return {
|
|
2622
2659
|
width,
|
|
2623
2660
|
height,
|
|
@@ -2626,6 +2663,7 @@
|
|
|
2626
2663
|
};
|
|
2627
2664
|
}
|
|
2628
2665
|
|
|
2666
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
2629
2667
|
// Returns the inner client rect, subtracting scrollbars if present.
|
|
2630
2668
|
function getInnerBoundingClientRect(element, strategy) {
|
|
2631
2669
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
@@ -2667,7 +2705,7 @@
|
|
|
2667
2705
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2668
2706
|
return false;
|
|
2669
2707
|
}
|
|
2670
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2708
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2671
2709
|
}
|
|
2672
2710
|
|
|
2673
2711
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -2680,17 +2718,17 @@
|
|
|
2680
2718
|
}
|
|
2681
2719
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2682
2720
|
let currentContainingBlockComputedStyle = null;
|
|
2683
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2721
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
2684
2722
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2685
2723
|
|
|
2686
2724
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2687
2725
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2688
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2726
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
2689
2727
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2690
2728
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2691
2729
|
currentContainingBlockComputedStyle = null;
|
|
2692
2730
|
}
|
|
2693
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle &&
|
|
2731
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2694
2732
|
if (shouldDropCurrentNode) {
|
|
2695
2733
|
// Drop non-containing blocks.
|
|
2696
2734
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -2753,6 +2791,12 @@
|
|
|
2753
2791
|
scrollTop: 0
|
|
2754
2792
|
};
|
|
2755
2793
|
const offsets = createCoords(0);
|
|
2794
|
+
|
|
2795
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
2796
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
2797
|
+
function setLeftRTLScrollbarOffset() {
|
|
2798
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2799
|
+
}
|
|
2756
2800
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2757
2801
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2758
2802
|
scroll = getNodeScroll(offsetParent);
|
|
@@ -2762,11 +2806,12 @@
|
|
|
2762
2806
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2763
2807
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2764
2808
|
} else if (documentElement) {
|
|
2765
|
-
|
|
2766
|
-
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
2767
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
2809
|
+
setLeftRTLScrollbarOffset();
|
|
2768
2810
|
}
|
|
2769
2811
|
}
|
|
2812
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
2813
|
+
setLeftRTLScrollbarOffset();
|
|
2814
|
+
}
|
|
2770
2815
|
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2771
2816
|
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
2772
2817
|
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
@@ -2779,11 +2824,11 @@
|
|
|
2779
2824
|
}
|
|
2780
2825
|
|
|
2781
2826
|
function isStaticPositioned(element) {
|
|
2782
|
-
return getComputedStyle(element).position === 'static';
|
|
2827
|
+
return getComputedStyle$1(element).position === 'static';
|
|
2783
2828
|
}
|
|
2784
2829
|
|
|
2785
2830
|
function getTrueOffsetParent(element, polyfill) {
|
|
2786
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2831
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
2787
2832
|
return null;
|
|
2788
2833
|
}
|
|
2789
2834
|
if (polyfill) {
|
|
@@ -2844,7 +2889,7 @@
|
|
|
2844
2889
|
};
|
|
2845
2890
|
|
|
2846
2891
|
function isRTL(element) {
|
|
2847
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
2892
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
2848
2893
|
}
|
|
2849
2894
|
|
|
2850
2895
|
const platform = {
|
|
@@ -2953,7 +2998,7 @@
|
|
|
2953
2998
|
function highlight(item, node, keys) {
|
|
2954
2999
|
var rectEle = getOptimizedBoundingRectEle(node);
|
|
2955
3000
|
if (!item.highlightBox) {
|
|
2956
|
-
var box = HighlightBox(rectEle,
|
|
3001
|
+
var box = HighlightBox(rectEle, 'none', 'rgba(0,0,0,0.1)');
|
|
2957
3002
|
document.body.appendChild(box);
|
|
2958
3003
|
item.highlightBox = box;
|
|
2959
3004
|
}
|
|
@@ -3020,7 +3065,7 @@
|
|
|
3020
3065
|
var id = item.id;
|
|
3021
3066
|
var rectEle = getOptimizedBoundingRectEle(node);
|
|
3022
3067
|
if (!item.highlightBox) {
|
|
3023
|
-
var box = HighlightBox(rectEle,
|
|
3068
|
+
var box = HighlightBox(rectEle, 'none', colors.gray);
|
|
3024
3069
|
document.body.appendChild(box);
|
|
3025
3070
|
item.highlightBox = box;
|
|
3026
3071
|
}
|
|
@@ -3412,7 +3457,7 @@
|
|
|
3412
3457
|
var popups = document.getElementsByClassName('i18next-editor-popup');
|
|
3413
3458
|
var elmnt = null;
|
|
3414
3459
|
var overlay = null;
|
|
3415
|
-
var currentZIndex =
|
|
3460
|
+
var currentZIndex = 100000;
|
|
3416
3461
|
for (var i = 0; i < popups.length; i++) {
|
|
3417
3462
|
var popup = popups[i];
|
|
3418
3463
|
var header = getHeader(popup);
|