locizify 9.0.10 → 9.0.11

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 9.0.11
2
+
3
+ - update locize dep
4
+
1
5
  ### 9.0.10
2
6
 
3
7
  Security release — includes upstream fixes from `i18next-locize-backend`, `i18nextify`, and `locize`.
@@ -9592,11 +9592,18 @@
9592
9592
  popup.style.setProperty('left', "calc(".concat(popup.style.left, " - ").concat(_diff, ")"));
9593
9593
  popup.style.setProperty('width', containerStyle.width);
9594
9594
  }
9595
- if (storedPos && storedPos.top && containerStyle.height && storedPos.top < window.innerHeight - containerStyle.height.replace('px', '')) {
9596
- popup.style.setProperty('top', storedPos.top + 'px');
9595
+ var MIN_VISIBLE = 40;
9596
+ if (storedPos && typeof storedPos.top === 'number' && containerStyle.height) {
9597
+ var maxTop = Math.max(0, window.innerHeight - MIN_VISIBLE);
9598
+ var top = Math.max(0, Math.min(storedPos.top, maxTop));
9599
+ popup.style.setProperty('top', top + 'px');
9597
9600
  }
9598
- if (storedPos && storedPos.left && containerStyle.width && storedPos.left < window.innerWidth - containerStyle.width.replace('px', '')) {
9599
- popup.style.setProperty('left', storedPos.left + 'px');
9601
+ if (storedPos && typeof storedPos.left === 'number' && containerStyle.width) {
9602
+ var width = parseInt(containerStyle.width, 10) || 0;
9603
+ var minLeft = Math.min(0, MIN_VISIBLE - width);
9604
+ var maxLeft = Math.max(0, window.innerWidth - MIN_VISIBLE);
9605
+ var left = Math.max(minLeft, Math.min(storedPos.left, maxLeft));
9606
+ popup.style.setProperty('left', left + 'px');
9600
9607
  }
9601
9608
  }
9602
9609
  }
@@ -11708,6 +11715,17 @@
11708
11715
  };
11709
11716
  }
11710
11717
 
11718
+ var MIN_VISIBLE = 40;
11719
+ function clampTop(top) {
11720
+ var max = Math.max(0, window.innerHeight - MIN_VISIBLE);
11721
+ return Math.max(0, Math.min(top, max));
11722
+ }
11723
+ function clampLeft(left, el) {
11724
+ var width = el.offsetWidth || 0;
11725
+ var min = Math.min(0, MIN_VISIBLE - width);
11726
+ var max = Math.max(0, window.innerWidth - MIN_VISIBLE);
11727
+ return Math.max(min, Math.min(left, max));
11728
+ }
11711
11729
  function initDragElement() {
11712
11730
  var pos1 = 0;
11713
11731
  var pos2 = 0;
@@ -11751,8 +11769,8 @@
11751
11769
  pos2 = pos4 - e.clientY;
11752
11770
  pos3 = e.clientX;
11753
11771
  pos4 = e.clientY;
11754
- elmnt.style.top = elmnt.offsetTop - pos2 + 'px';
11755
- elmnt.style.left = elmnt.offsetLeft - pos1 + 'px';
11772
+ elmnt.style.top = clampTop(elmnt.offsetTop - pos2) + 'px';
11773
+ elmnt.style.left = clampLeft(elmnt.offsetLeft - pos1, elmnt) + 'px';
11756
11774
  }
11757
11775
  function closeDragElement() {
11758
11776
  startMouseTracking();