Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

popper-plugin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

popper-plugin - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

4

dist/popper.min.js
/*!
* Popper v1.0.3
* Popper v1.0.4
* https://sa-si-dev.github.io/popper
* Licensed under MIT (https://github.com/sa-si-dev/popper/blob/master/LICENSE)
*/!function(){"use strict";function t(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,o){if(!t)return;if("string"==typeof t)return e(t,o);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return e(t,o)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,i=new Array(e);o<e;o++)i[o]=t[o];return i}function o(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var i=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e)}var i,r,n;return i=e,n=[{key:"addClass",value:function(o,i){o&&(i=i.split(" "),e.getElements(o).forEach((function(e){var o;(o=e.classList).add.apply(o,t(i))})))}},{key:"removeClass",value:function(o,i){o&&(i=i.split(" "),e.getElements(o).forEach((function(e){var o;(o=e.classList).remove.apply(o,t(i))})))}},{key:"getElements",value:function(t){if(t)return void 0===t.forEach&&(t=[t]),t}},{key:"getMoreVisibleSides",value:function(t){if(!t)return{};var e=t.getBoundingClientRect(),o=window.innerWidth,i=window.innerHeight,r=e.left,n=e.top;return{horizontal:r>o-r-e.width?"left":"right",vertical:n>i-n-e.height?"top":"bottom"}}},{key:"getAbsoluteCoords",value:function(t){if(t){var e=t.getBoundingClientRect(),o=window.pageXOffset,i=window.pageYOffset;return{width:e.width,height:e.height,top:e.top+i,right:e.right+o,bottom:e.bottom+i,left:e.left+o}}}},{key:"getCoords",value:function(t){return t?t.getBoundingClientRect():{}}},{key:"getData",value:function(t,e,o){if(t){var i=t?t.dataset[e]:"";return"number"===o?i=parseFloat(i)||0:"true"===i?i=!0:"false"===i&&(i=!1),i}}},{key:"setData",value:function(t,e,o){t&&(t.dataset[e]=o)}},{key:"setStyle",value:function(t,e,o){t&&(t.style[e]=o)}},{key:"show",value:function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"block";e.setStyle(t,"display",o)}},{key:"hide",value:function(t){e.setStyle(t,"display","none")}},{key:"getHideableParentOffset",value:function(t){var o=e.getHideableParent(t),i=window.scrollX,r=window.scrollY;if(o){var n=e.getAbsoluteCoords(o);i+=n.left,r+=n.top}return{x:i,y:r}}},{key:"getHideableParent",value:function(t){for(var e,o=t.parentElement;o;){var i=getComputedStyle(o).overflow;if(-1!==i.indexOf("scroll")||-1!==i.indexOf("auto")){e=o;break}o=o.parentElement}return e}}],(r=null)&&o(i.prototype,r),n&&o(i,n),e}();function r(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var n=["top","bottom","left","right"].map((function(t){return"position-".concat(t)})),a={top:"rotate(180deg)",left:"rotate(90deg)",right:"rotate(-90deg)"},s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);try{this.setProps(e),this.init()}catch(t){console.warn("Couldn't initiate popper"),console.error(t)}}var e,o,s;return e=t,(o=[{key:"init",value:function(){var t=this.$popperEle;t&&this.$triggerEle&&(i.setStyle(t,"zIndex",this.zIndex),this.setPosition())}},{key:"setProps",value:function(t){var e=(t=this.setDefaultProps(t)).position?t.position.toLowerCase():"auto";if(this.$popperEle=t.$popperEle,this.$triggerEle=t.$triggerEle,this.$arrowEle=t.$arrowEle,this.margin=parseFloat(t.margin),this.offset=parseFloat(t.offset),this.enterDelay=parseFloat(t.enterDelay),this.exitDelay=parseFloat(t.exitDelay),this.showDuration=parseFloat(t.showDuration),this.hideDuration=parseFloat(t.hideDuration),this.transitionDistance=parseFloat(t.transitionDistance),this.zIndex=parseFloat(t.zIndex),this.afterShowCallback=t.afterShow,this.afterHideCallback=t.afterHide,this.hasArrow=!!this.$arrowEle,-1!==e.indexOf(" ")){var o=e.split(" ");this.position=o[0],this.secondaryPosition=o[1]}else this.position=e}},{key:"setDefaultProps",value:function(t){return Object.assign({position:"auto",margin:8,offset:5,enterDelay:0,exitDelay:0,showDuration:300,hideDuration:200,transitionDistance:10,zIndex:1},t)}},{key:"setPosition",value:function(){i.show(this.$popperEle,"inline-flex");var t,e,o,r=window.innerWidth,s=window.innerHeight,l=i.getAbsoluteCoords(this.$popperEle),p=i.getAbsoluteCoords(this.$triggerEle),f=l.left,u=l.top,h=p.left,c=p.top,d=c-u,y=h-f,g=y,m=d,v=l.width,w=l.height,E=p.width,b=p.height,D=this.position,$=this.secondaryPosition,k=E/2-v/2,x=b/2-w/2,S=this.margin,C=this.transitionDistance,P=i.getHideableParentOffset(this.$popperEle),T=P.y-u,A=s+T,O=P.x-f,H=r+O,F=this.offset;F&&(T+=F,A-=F,O+=F,H-=F),"auto"===D&&(D=i.getMoreVisibleSides(this.$triggerEle).vertical);var I={top:{top:m-w-S,left:g+k},bottom:{top:m+b+S,left:g+k},right:{top:m+x,left:g+E+S},left:{top:m+x,left:g-v-S}},j=I[D];if(m=j.top,g=j.left,$&&("top"===$?m=d:"bottom"===$?m=d+b-w:"left"===$?g=y:"right"===$&&(g=y+E-v)),g+f<O?"left"===D?o="right":g=O-f:g+v>H&&("right"===D?o="left":g=H-v),m+u<T?"top"===D?o="bottom":m=T-u:m+w>A&&("bottom"===D?o="top":m=A-w),o){var z=I[o];"top"===(D=o)||"bottom"===D?m=z.top:"left"!==D&&"right"!==D||(g=z.left)}"top"===D?(t=m+C,e=g):"right"===D?(t=m,e=g-C):"left"===D?(t=m,e=g+C):(t=m-C,e=g);var L="translate3d(".concat(e,"px, ").concat(t,"px, 0)");if(i.setStyle(this.$popperEle,"transform",L),i.setData(this.$popperEle,"fromLeft",e),i.setData(this.$popperEle,"fromTop",t),i.setData(this.$popperEle,"top",m),i.setData(this.$popperEle,"left",g),i.removeClass(this.$popperEle,n.join(" ")),i.addClass(this.$popperEle,"position-".concat(D)),this.hasArrow){var B=0,M=0,R=g+f,W=m+u,V=this.$arrowEle.offsetWidth/2,X=a[D]||"";"top"===D||"bottom"===D?(B=E/2+h-R)<V?B=V:B>v-V&&(B=v-V):"left"!==D&&"right"!==D||((M=b/2+c-W)<V?M=V:M>w-V&&(M=w-V)),i.setStyle(this.$arrowEle,"transform","translate3d(".concat(B,"px, ").concat(M,"px, 0) ").concat(X))}i.hide(this.$popperEle)}},{key:"resetPosition",value:function(){i.setStyle(this.$popperEle,"transform","none"),this.setPosition()}},{key:"show",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.resetPosition,r=e.data;clearTimeout(this.exitDelayTimeout),clearTimeout(this.hideDurationTimeout),o&&this.resetPosition(),this.enterDelayTimeout=setTimeout((function(){var e=i.getData(t.$popperEle,"left"),o=i.getData(t.$popperEle,"top"),n="translate3d(".concat(e,"px, ").concat(o,"px, 0)"),a=t.showDuration;i.show(t.$popperEle,"inline-flex"),i.getCoords(t.$popperEle),i.setStyle(t.$popperEle,"transitionDuration",a+"ms"),i.setStyle(t.$popperEle,"transform",n),i.setStyle(t.$popperEle,"opacity",1),t.showDurationTimeout=setTimeout((function(){"function"==typeof t.afterShowCallback&&t.afterShowCallback(r)}),a)}),this.enterDelay)}},{key:"hide",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.data;clearTimeout(this.enterDelayTimeout),clearTimeout(this.showDurationTimeout),this.exitDelayTimeout=setTimeout((function(){if(t.$popperEle){var e=i.getData(t.$popperEle,"fromLeft"),r=i.getData(t.$popperEle,"fromTop"),n="translate3d(".concat(e,"px, ").concat(r,"px, 0)"),a=t.hideDuration;i.setStyle(t.$popperEle,"transitionDuration",a+"ms"),i.setStyle(t.$popperEle,"transform",n),i.setStyle(t.$popperEle,"opacity",0),t.hideDurationTimeout=setTimeout((function(){i.hide(t.$popperEle),"function"==typeof t.afterHideCallback&&t.afterHideCallback(o)}),a)}}),this.exitDelay)}},{key:"updatePosition",value:function(){i.setStyle(this.$popperEle,"transitionDuration","0ms"),this.resetPosition();var t=i.getData(this.$popperEle,"left"),e=i.getData(this.$popperEle,"top");i.show(this.$popperEle,"inline-flex"),i.setStyle(this.$popperEle,"transform","translate3d(".concat(t,"px, ").concat(e,"px, 0)"))}}])&&r(e.prototype,o),s&&r(e,s),t}();window.PopperComponent=s}();
*/!function(){"use strict";function t(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,o){if(!t)return;if("string"==typeof t)return e(t,o);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return e(t,o)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,i=new Array(e);o<e;o++)i[o]=t[o];return i}function o(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var i=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e)}var i,r,n;return i=e,n=[{key:"addClass",value:function(o,i){o&&(i=i.split(" "),e.getElements(o).forEach((function(e){var o;(o=e.classList).add.apply(o,t(i))})))}},{key:"removeClass",value:function(o,i){o&&(i=i.split(" "),e.getElements(o).forEach((function(e){var o;(o=e.classList).remove.apply(o,t(i))})))}},{key:"getElements",value:function(t){if(t)return void 0===t.forEach&&(t=[t]),t}},{key:"getMoreVisibleSides",value:function(t){if(!t)return{};var e=t.getBoundingClientRect(),o=window.innerWidth,i=window.innerHeight,r=e.left,n=e.top;return{horizontal:r>o-r-e.width?"left":"right",vertical:n>i-n-e.height?"top":"bottom"}}},{key:"getAbsoluteCoords",value:function(t){if(t){var e=t.getBoundingClientRect(),o=window.pageXOffset,i=window.pageYOffset;return{width:e.width,height:e.height,top:e.top+i,right:e.right+o,bottom:e.bottom+i,left:e.left+o}}}},{key:"getCoords",value:function(t){return t?t.getBoundingClientRect():{}}},{key:"getData",value:function(t,e,o){if(t){var i=t?t.dataset[e]:"";return"number"===o?i=parseFloat(i)||0:"true"===i?i=!0:"false"===i&&(i=!1),i}}},{key:"setData",value:function(t,e,o){t&&(t.dataset[e]=o)}},{key:"setStyle",value:function(t,e,o){t&&(t.style[e]=o)}},{key:"show",value:function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"block";e.setStyle(t,"display",o)}},{key:"hide",value:function(t){e.setStyle(t,"display","none")}},{key:"getHideableParent",value:function(t){for(var e,o=t.parentElement;o;){var i=getComputedStyle(o).overflow;if(-1!==i.indexOf("scroll")||-1!==i.indexOf("auto")){e=o;break}o=o.parentElement}return e}}],(r=null)&&o(i.prototype,r),n&&o(i,n),e}();function r(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var n=["top","bottom","left","right"].map((function(t){return"position-".concat(t)})),a={top:"rotate(180deg)",left:"rotate(90deg)",right:"rotate(-90deg)"},s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);try{this.setProps(e),this.init()}catch(t){console.warn("Couldn't initiate popper"),console.error(t)}}var e,o,s;return e=t,(o=[{key:"init",value:function(){var t=this.$popperEle;t&&this.$triggerEle&&(i.setStyle(t,"zIndex",this.zIndex),this.setPosition())}},{key:"setProps",value:function(t){var e=(t=this.setDefaultProps(t)).position?t.position.toLowerCase():"auto";if(this.$popperEle=t.$popperEle,this.$triggerEle=t.$triggerEle,this.$arrowEle=t.$arrowEle,this.margin=parseFloat(t.margin),this.offset=parseFloat(t.offset),this.enterDelay=parseFloat(t.enterDelay),this.exitDelay=parseFloat(t.exitDelay),this.showDuration=parseFloat(t.showDuration),this.hideDuration=parseFloat(t.hideDuration),this.transitionDistance=parseFloat(t.transitionDistance),this.zIndex=parseFloat(t.zIndex),this.afterShowCallback=t.afterShow,this.afterHideCallback=t.afterHide,this.hasArrow=!!this.$arrowEle,-1!==e.indexOf(" ")){var o=e.split(" ");this.position=o[0],this.secondaryPosition=o[1]}else this.position=e}},{key:"setDefaultProps",value:function(t){return Object.assign({position:"auto",margin:8,offset:5,enterDelay:0,exitDelay:0,showDuration:300,hideDuration:200,transitionDistance:10,zIndex:1},t)}},{key:"setPosition",value:function(){i.show(this.$popperEle,"inline-flex");var t,e,o,r=window.innerWidth,s=window.innerHeight,l=i.getAbsoluteCoords(this.$popperEle),p=i.getAbsoluteCoords(this.$triggerEle),f=l.width,u=l.height,h=l.top,c=l.right,d=l.bottom,y=l.left,g=p.width,m=p.height,v=p.top,w=p.right,E=p.bottom,b=p.left,D=v-h,$=b-y,k=$,x=D,S=this.position,C=this.secondaryPosition,T=g/2-f/2,P=m/2-u/2,A=this.margin,O=this.transitionDistance,F=window.scrollY-h,I=s+F,j=window.scrollX-y,H=r+j,z=this.offset;z&&(F+=z,I-=z,j+=z,H-=z),"auto"===S&&(S=i.getMoreVisibleSides(this.$triggerEle).vertical);var L={top:{top:x-u-A,left:k+T},bottom:{top:x+m+A,left:k+T},right:{top:x+P,left:k+g+A},left:{top:x+P,left:k-f-A}},B=L[S];if(x=B.top,k=B.left,C&&("top"===C?x=D:"bottom"===C?x=D+m-u:"left"===C?k=$:"right"===C&&(k=$+g-f)),k<j?"left"===S?o="right":k=j+y>w?w-y:j:k+f>H&&("right"===S?o="left":k=H+y<b?b-c:H-f),x<F?"top"===S?o="bottom":x=F+h>E?E-h:F:x+u>I&&("bottom"===S?o="top":x=I+h<v?v-d:I-u),o){var M=L[o];"top"===(S=o)||"bottom"===S?x=M.top:"left"!==S&&"right"!==S||(k=M.left)}"top"===S?(t=x+O,e=k):"right"===S?(t=x,e=k-O):"left"===S?(t=x,e=k+O):(t=x-O,e=k);var R="translate3d(".concat(e,"px, ").concat(t,"px, 0)");if(i.setStyle(this.$popperEle,"transform",R),i.setData(this.$popperEle,"fromLeft",e),i.setData(this.$popperEle,"fromTop",t),i.setData(this.$popperEle,"top",x),i.setData(this.$popperEle,"left",k),i.removeClass(this.$popperEle,n.join(" ")),i.addClass(this.$popperEle,"position-".concat(S)),this.hasArrow){var W=0,V=0,X=k+y,Y=x+h,U=this.$arrowEle.offsetWidth/2,q=a[S]||"";"top"===S||"bottom"===S?(W=g/2+b-X)<U?W=U:W>f-U&&(W=f-U):"left"!==S&&"right"!==S||((V=m/2+v-Y)<U?V=U:V>u-U&&(V=u-U)),i.setStyle(this.$arrowEle,"transform","translate3d(".concat(W,"px, ").concat(V,"px, 0) ").concat(q))}i.hide(this.$popperEle)}},{key:"resetPosition",value:function(){i.setStyle(this.$popperEle,"transform","none"),this.setPosition()}},{key:"show",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.resetPosition,r=e.data;clearTimeout(this.exitDelayTimeout),clearTimeout(this.hideDurationTimeout),o&&this.resetPosition(),this.enterDelayTimeout=setTimeout((function(){var e=i.getData(t.$popperEle,"left"),o=i.getData(t.$popperEle,"top"),n="translate3d(".concat(e,"px, ").concat(o,"px, 0)"),a=t.showDuration;i.show(t.$popperEle,"inline-flex"),i.getCoords(t.$popperEle),i.setStyle(t.$popperEle,"transitionDuration",a+"ms"),i.setStyle(t.$popperEle,"transform",n),i.setStyle(t.$popperEle,"opacity",1),t.showDurationTimeout=setTimeout((function(){"function"==typeof t.afterShowCallback&&t.afterShowCallback(r)}),a)}),this.enterDelay)}},{key:"hide",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.data;clearTimeout(this.enterDelayTimeout),clearTimeout(this.showDurationTimeout),this.exitDelayTimeout=setTimeout((function(){if(t.$popperEle){var e=i.getData(t.$popperEle,"fromLeft"),r=i.getData(t.$popperEle,"fromTop"),n="translate3d(".concat(e,"px, ").concat(r,"px, 0)"),a=t.hideDuration;i.setStyle(t.$popperEle,"transitionDuration",a+"ms"),i.setStyle(t.$popperEle,"transform",n),i.setStyle(t.$popperEle,"opacity",0),t.hideDurationTimeout=setTimeout((function(){i.hide(t.$popperEle),"function"==typeof t.afterHideCallback&&t.afterHideCallback(o)}),a)}}),this.exitDelay)}},{key:"updatePosition",value:function(){i.setStyle(this.$popperEle,"transitionDuration","0ms"),this.resetPosition();var t=i.getData(this.$popperEle,"left"),e=i.getData(this.$popperEle,"top");i.show(this.$popperEle,"inline-flex"),i.setStyle(this.$popperEle,"transform","translate3d(".concat(t,"px, ").concat(e,"px, 0)"))}}])&&r(e.prototype,o),s&&r(e,s),t}();window.PopperComponent=s}();
{
"name": "popper-plugin",
"version": "1.0.3",
"version": "1.0.4",
"description": "A javascript plugin for popper which could be used to positioning tooltip or popover",

@@ -5,0 +5,0 @@ "scripts": {

@@ -104,6 +104,14 @@ import { DomUtils } from './utils/dom-utils';

let triggerEleCoords = DomUtils.getAbsoluteCoords(this.$triggerEle);
let popperEleWidth = popperEleCoords.width;
let popperEleHeight = popperEleCoords.height;
let popperEleTop = popperEleCoords.top;
let popperEleRight = popperEleCoords.right;
let popperEleBotttom = popperEleCoords.bottom;
let popperEleLeft = popperEleCoords.left;
let popperEleTop = popperEleCoords.top;
let triggerEleWidth = triggerEleCoords.width;
let triggerEleHeight = triggerEleCoords.height;
let triggerEleTop = triggerEleCoords.top;
let triggerEleRight = triggerEleCoords.right;
let triggerEleBottom = triggerEleCoords.bottom;
let triggerEleLeft = triggerEleCoords.left;
let triggerEleTop = triggerEleCoords.top;
let topDiff = triggerEleTop - popperEleTop;

@@ -113,6 +121,2 @@ let leftDiff = triggerEleLeft - popperEleLeft;

let top = topDiff;
let popperEleWidth = popperEleCoords.width;
let popperEleHeight = popperEleCoords.height;
let triggerEleWidth = triggerEleCoords.width;
let triggerEleHeight = triggerEleCoords.height;
let position = this.position;

@@ -126,6 +130,5 @@ let secondaryPosition = this.secondaryPosition;

let fromLeft;
let hideableParentOffset = DomUtils.getHideableParentOffset(this.$popperEle);
let topEdge = hideableParentOffset.y - popperEleTop;
let topEdge = window.scrollY - popperEleTop;
let bottomEdge = viewportHeight + topEdge;
let leftEdge = hideableParentOffset.x - popperEleLeft;
let leftEdge = window.scrollX - popperEleLeft;
let rightEdge = viewportWidth + leftEdge;

@@ -184,13 +187,19 @@ let inversePosition;

/* if popperEle is hiding in left edge */
if (left + popperEleLeft < leftEdge) {
/* if popperEle is hiding on left edge */
if (left < leftEdge) {
if (position === 'left') {
inversePosition = 'right';
} else if (leftEdge + popperEleLeft > triggerEleRight) {
/** if triggerEle is hiding on left edge */
left = triggerEleRight - popperEleLeft;
} else {
left = leftEdge - popperEleLeft;
left = leftEdge;
}
} else if (left + popperEleWidth > rightEdge) {
/* if popperEle is hiding in right edge */
/* if popperEle is hiding on right edge */
if (position === 'right') {
inversePosition = 'left';
} else if (rightEdge + popperEleLeft < triggerEleLeft) {
/** if triggerEle is hiding on right edge */
left = triggerEleLeft - popperEleRight;
} else {

@@ -201,13 +210,19 @@ left = rightEdge - popperEleWidth;

/* if popperEle is hiding in top edge */
if (top + popperEleTop < topEdge) {
/* if popperEle is hiding on top edge */
if (top < topEdge) {
if (position === 'top') {
inversePosition = 'bottom';
} else if (topEdge + popperEleTop > triggerEleBottom) {
/** if triggerEle is hiding on top edge */
top = triggerEleBottom - popperEleTop;
} else {
top = topEdge - popperEleTop;
top = topEdge;
}
} else if (top + popperEleHeight > bottomEdge) {
/* if popperEle is hiding in bottom edge */
/* if popperEle is hiding on bottom edge */
if (position === 'bottom') {
inversePosition = 'top';
} else if (bottomEdge + popperEleTop < triggerEleTop) {
/** if triggerEle is hiding on bottom edge */
top = triggerEleTop - popperEleBotttom;
} else {

@@ -214,0 +229,0 @@ top = bottomEdge - popperEleHeight;

@@ -126,16 +126,2 @@ export class DomUtils {

static getHideableParentOffset($ele) {
let $hideableParent = DomUtils.getHideableParent($ele);
let x = window.scrollX;
let y = window.scrollY;
if ($hideableParent) {
let coords = DomUtils.getAbsoluteCoords($hideableParent);
x += coords.left;
y += coords.top;
}
return { x, y };
}
/** getting parent element which could hide absolute positioned child */

@@ -142,0 +128,0 @@ static getHideableParent($ele) {

@@ -6,3 +6,3 @@ const path = require('path');

const banner = `Popper v1.0.3
const banner = `Popper v1.0.4
https://sa-si-dev.github.io/popper

@@ -9,0 +9,0 @@ Licensed under MIT (https://github.com/sa-si-dev/popper/blob/master/LICENSE)`;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc