Socket
Socket
Sign inDemoInstall

@lrnwebcomponents/absolute-position-behavior

Package Overview
Dependencies
2
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.7.7 to 2.7.10

26

absolute-position-behavior.js

@@ -28,3 +28,3 @@ /**

}
`
`,
];

@@ -35,5 +35,3 @@ }

render() {
return html`
<slot></slot>
`;
return html` <slot></slot>`;
}

@@ -52,3 +50,3 @@

type: Boolean,
attribute: "auto"
attribute: "auto",
},

@@ -60,3 +58,3 @@ /**

type: Boolean,
attribute: "fit-to-visible-bounds"
attribute: "fit-to-visible-bounds",
},

@@ -68,3 +66,3 @@ /**

type: Boolean,
attribute: "hidden"
attribute: "hidden",
},

@@ -79,3 +77,3 @@ /**

attribute: "for",
reflect: true
reflect: true,
},

@@ -88,3 +86,3 @@ /**

type: Number,
attribute: "offset"
attribute: "offset",
},

@@ -97,3 +95,3 @@ /**

attribute: "position",
reflect: true
reflect: true,
},

@@ -106,3 +104,3 @@ /**

attribute: "position-align",
reflect: true
reflect: true,
},

@@ -113,3 +111,3 @@ /**

target: {
type: Object
type: Object,
},

@@ -120,4 +118,4 @@ /**

__positions: {
type: Object
}
type: Object,
},
};

@@ -124,0 +122,0 @@ }

@@ -58,8 +58,8 @@ import { AbsolutePositionBehavior } from "./absolute-position-behavior.js";

type: "String",
value: `I'm absolutely positioned!`
}
value: `I'm absolutely positioned!`,
},
},
attr: ``,
slotted: ``
slotted: ``,
};
window.StorybookUtilities.instance.addLiveDemo(AbsolutePositionBehaviorStory);

@@ -1,2 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lit-element/lit-element.js")):"function"==typeof define&&define.amd?define(["exports","lit-element/lit-element.js"],e):e((t=t||self).AbsolutePositionBehavior={},t.litElement_js)}(this,function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function i(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t,e,n){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function p(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}window.AbsolutePositionStateManager=window.AbsolutePositionStateManager||{},window.AbsolutePositionStateManager.requestAvailability=function(){if(!window.AbsolutePositionStateManager.instance){window.AbsolutePositionStateManager.instance=document.createElement("absolute-position-state-manager");var t=window.AbsolutePositionStateManager.instance;document.body.appendChild(t)}return window.AbsolutePositionStateManager.instance};var d=function(t){function o(){var t;return n(this,o),(t=c(this,a(o).call(this))).elements=[],t.__timeout=!1,t.__observer=new MutationObserver(function(e){return t.checkMutations(e)}),t}return u(o,e.LitElement),i(o,null,[{key:"tag",get:function(){return"absolute-position-state-manager"}},{key:"properties",get:function(){return{elements:{type:Array},__observer:{type:Object},__timeout:{type:Object}}}}]),i(o,[{key:"loadElement",value:function(t){this.elements.length<1&&(this.__observer.observe(document,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.updateElements(),document.addEventListener("load",this.updateElements),window.addEventListener("resize",this._handleResize)),this.elements.push(t),t.style.top=0,t.style.left=0,this.positionElement(t)}},{key:"unloadElement",value:function(t){this.elements.filter(function(e){return e===t}),this.elements.length<1&&this.removeEventListeners()}},{key:"_handleResize",value:function(){this.__timeout&&clearTimeout(this.__timeout),this.__timeout=setTimeout(window.AbsolutePositionStateManager.instance.updateElements(),250)}},{key:"checkMutations",value:function(t){var e=this,n=!1;t.forEach(function(t){n||(n=n||!("attributes"===t.type&&"style"===t.attributeName&&e.elements.includes(t.target)))}),n&&this.updateElements()}},{key:"findTarget",value:function(t){for(var e="#"+t.for,n=t.target,o=t;void 0!==t.for&&null===n&&null!==o&&null!==o.parentNode&&o!==document;)11===(o=o.parentNode).nodeType&&(o=o.host),n=o?o.querySelector(e):null;return n}},{key:"removeEventListeners",value:function(){this.__observer&&this.__observer.disconnect&&this.__observer.disconnect(),document.removeEventListener("load",this.updateElements),window.removeEventListener("resize",this._handleResize)}},{key:"updateElements",value:function(){var t=this;this.elements.forEach(function(e){return t.positionElement(e)})}},{key:"_getParentNode",value:function(t){var e=t.parentNode;return null!=e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(e=e.host),e}},{key:"positionElement",value:function(t){var e=this.findTarget(t),n=t.offsetParent;if(e&&n){var o=parseFloat(t.offset),i=document.body.getBoundingClientRect(),r=n.getBoundingClientRect(),s=e.getBoundingClientRect(),u=t.getBoundingClientRect(),a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position;return"left"!==e&&"right"!==e},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a(t.position),n=function(t){return parseFloat(t.replace("px",""))},o=e?n(t.style.left)-u.left:n(t.style.top)-u.top,r=e?"left":"top",l=function(t){return e?t.width:t.height},c=o+l(i)-l(u),f=o;return"end"===t.positionAlign?f+=s[r]-l(u)+l(s):"start"===t.positionAlign?f+=s[r]:f+=s[r]-l(u)/2+l(s)/2,t.fitToVisibleBounds?Math.max(o,Math.min(c,f))+"px":f+"px"},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position,n=function(t){return parseFloat(t.replace("px",""))},i=a(e)?n(t.style.top)-u.top:n(t.style.left)-u.left;return"top"===e?s.top+i-u.height-o+"px":"left"===e?s.left+i-u.width-o+"px":s[e]+i+o+"px"},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position,n=function(t){return a(e)?u.height+o:u.width+o};return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position;return"left"===e||"top"===e}(e)?s[e]-i[e]>n:i[e]-s[e]>n},p=!1!==t.fitToVisibleBounds&&!f(t.position),d={top:["bottom","left","right"],left:["right","top","bottom"],bottom:["top","right","left"],right:["left","bottom","top"]};t.style.position="absolute",p&&f(d[t.position][0])?t.position=d[t.position][0]:p&&f(d[t.position][1])?t.position=d[t.position][1]:p&&f(d[t.position][2])?t.position=d[t.position][2]:(t.style.top=a(t.position)?c():l(),t.style.left=a(t.position)?l():c(),t.__positions={self:u,parent:r,target:s})}}},{key:"disconnectedCallback",value:function(){this.removeEventListeners(),f(a(o.prototype),"disconnectedCallback",this).call(this)}}]),o}();function b(){var t=p(["\n:host {\n display: inline-block;\n z-index: 99999999;\n position: absolute;\n}\n\n:host([hidden]) {\n display: none;\n}\n "]);return b=function(){return t},t}function h(){var t=p(["\n\n<slot></slot>"]);return h=function(){return t},t}window.customElements.define(d.tag,d);var y=function(t){function o(){var t;return n(this,o),(t=c(this,a(o).call(this))).auto=!1,t.fitToVisibleBounds=!1,t.for=null,t.offset=0,t.position="bottom",t.target=null,t.__positions={},t.__observe=!1,t.__manager=window.AbsolutePositionStateManager.requestAvailability(),t}return u(o,e.LitElement),i(o,[{key:"render",value:function(){return e.html(h())}}],[{key:"styles",get:function(){return[e.css(b())]}},{key:"properties",get:function(){return function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach(function(e){r(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},f(a(o),"properties",this),{auto:{type:Boolean,attribute:"auto"},fitToVisibleBounds:{type:Boolean,attribute:"fit-to-visible-bounds"},hidden:{type:Boolean,attribute:"hidden"},for:{type:String,attribute:"for",reflect:!0},offset:{type:Number,attribute:"offset"},position:{type:String,attribute:"position",reflect:!0},positionAlign:{type:String,attribute:"position-align",reflect:!0},target:{type:Object},__positions:{type:Object}})}},{key:"tag",get:function(){return"absolute-position-behavior"}}]),i(o,[{key:"updated",value:function(t){var e=this;t.forEach(function(t,n){"auto"===n&&e.auto&&e.setPosition(),"auto"!==n||e.auto||e.unsetPosition(),"fitToVisibleBounds"===n&&e.updatePosition(),"for"===n&&e.updatePosition(),"offset"===n&&e.updatePosition(),"position"===n&&e.updatePosition(),"positionAlign"===n&&e.updatePosition(),"target"===n&&e.updatePosition(),"hidden"===n&&e.updatePosition()})}},{key:"setPosition",value:function(){this.__observe=!0,this.__manager.loadElement(this)}},{key:"unsetPosition",value:function(){this.__observe=!1,this.__manager.unloadElement(this)}},{key:"updatePosition",value:function(){!0===this.__observe&&this.__manager.positionElement(this)}},{key:"disconnectedCallback",value:function(){this.unsetPosition(),f(a(o.prototype),"disconnectedCallback",this).call(this)}}]),o}();window.customElements.define(y.tag,y),t.AbsolutePositionBehavior=y,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=absolute-position-behavior.umd.js.map
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lit-element/lit-element.js")):"function"==typeof define&&define.amd?define(["exports","lit-element/lit-element.js"],e):e((t=t||self).AbsolutePositionBehavior={},t.litElement_js)}(this,function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function i(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach(function(e){r(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,o=l(t);if(e){var i=l(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return f(this,n)}}function d(t,e,n){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function h(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}window.AbsolutePositionStateManager=window.AbsolutePositionStateManager||{},window.AbsolutePositionStateManager.requestAvailability=function(){if(!window.AbsolutePositionStateManager.instance){window.AbsolutePositionStateManager.instance=document.createElement("absolute-position-state-manager");var t=window.AbsolutePositionStateManager.instance;document.body.appendChild(t)}return window.AbsolutePositionStateManager.instance};var b=function(t){a(r,e.LitElement);var o=p(r);function r(){var t;return n(this,r),(t=o.call(this)).elements=[],t.__timeout=!1,t.__observer=new MutationObserver(function(e){return t.checkMutations(e)}),t}return i(r,null,[{key:"tag",get:function(){return"absolute-position-state-manager"}},{key:"properties",get:function(){return{elements:{type:Array},__observer:{type:Object},__timeout:{type:Object}}}}]),i(r,[{key:"loadElement",value:function(t){this.elements.length<1&&(this.__observer.observe(document,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.updateElements(),document.addEventListener("load",this.updateElements),window.addEventListener("resize",this._handleResize)),this.elements.push(t),t.style.top=0,t.style.left=0,this.positionElement(t)}},{key:"unloadElement",value:function(t){this.elements.filter(function(e){return e===t}),this.elements.length<1&&this.removeEventListeners()}},{key:"_handleResize",value:function(){this.__timeout&&clearTimeout(this.__timeout),this.__timeout=setTimeout(window.AbsolutePositionStateManager.instance.updateElements(),250)}},{key:"checkMutations",value:function(t){var e=this,n=!1;t.forEach(function(t){n||(n=n||!("attributes"===t.type&&"style"===t.attributeName&&e.elements.includes(t.target)))}),n&&this.updateElements()}},{key:"findTarget",value:function(t){for(var e="#"+t.for,n=t.target,o=t;void 0!==t.for&&null===n&&null!==o&&null!==o.parentNode&&o!==document;)11===(o=o.parentNode).nodeType&&(o=o.host),n=o?o.querySelector(e):null;return n}},{key:"removeEventListeners",value:function(){this.__observer&&this.__observer.disconnect&&this.__observer.disconnect(),document.removeEventListener("load",this.updateElements),window.removeEventListener("resize",this._handleResize)}},{key:"updateElements",value:function(){var t=this;this.elements.forEach(function(e){return t.positionElement(e)})}},{key:"_getParentNode",value:function(t){var e=t.parentNode;return null!=e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(e=e.host),e}},{key:"positionElement",value:function(t){var e=this.findTarget(t),n=t.offsetParent;if(e&&n){var o=parseFloat(t.offset),i=document.body.getBoundingClientRect(),r=n.getBoundingClientRect(),s=e.getBoundingClientRect(),u=t.getBoundingClientRect(),a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position;return"left"!==e&&"right"!==e},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a(t.position),n=function(t){return parseFloat(t.replace("px",""))},o=e?n(t.style.left)-u.left:n(t.style.top)-u.top,r=e?"left":"top",l=function(t){return e?t.width:t.height},c=o+l(i)-l(u),f=o;return"end"===t.positionAlign?f+=s[r]-l(u)+l(s):"start"===t.positionAlign?f+=s[r]:f+=s[r]-l(u)/2+l(s)/2,t.fitToVisibleBounds?Math.max(o,Math.min(c,f))+"px":f+"px"},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position,n=function(t){return parseFloat(t.replace("px",""))},i=a(e)?n(t.style.top)-u.top:n(t.style.left)-u.left;return"top"===e?s.top+i-u.height-o+"px":"left"===e?s.left+i-u.width-o+"px":s[e]+i+o+"px"},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position,n=function(t){return a(e)?u.height+o:u.width+o};return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.position;return"left"===e||"top"===e}(e)?s[e]-i[e]>n:i[e]-s[e]>n},p=!1!==t.fitToVisibleBounds&&!f(t.position),d={top:["bottom","left","right"],left:["right","top","bottom"],bottom:["top","right","left"],right:["left","bottom","top"]};t.style.position="absolute",p&&f(d[t.position][0])?t.position=d[t.position][0]:p&&f(d[t.position][1])?t.position=d[t.position][1]:p&&f(d[t.position][2])?t.position=d[t.position][2]:(t.style.top=a(t.position)?c():l(),t.style.left=a(t.position)?l():c(),t.__positions={self:u,parent:r,target:s})}}},{key:"disconnectedCallback",value:function(){this.removeEventListeners(),d(l(r.prototype),"disconnectedCallback",this).call(this)}}]),r}();function y(){var t=h(["\n:host {\n display: inline-block;\n z-index: 99999999;\n position: absolute;\n}\n\n:host([hidden]) {\n display: none;\n}\n "]);return y=function(){return t},t}function v(){var t=h(["\n\n<slot></slot>"]);return v=function(){return t},t}window.customElements.define(b.tag,b);var g=function(t){a(r,e.LitElement);var o=p(r);function r(){var t;return n(this,r),(t=o.call(this)).auto=!1,t.fitToVisibleBounds=!1,t.for=null,t.offset=0,t.position="bottom",t.target=null,t.__positions={},t.__observe=!1,t.__manager=window.AbsolutePositionStateManager.requestAvailability(),t}return i(r,[{key:"render",value:function(){return e.html(v())}}],[{key:"styles",get:function(){return[e.css(y())]}},{key:"properties",get:function(){return u(u({},d(l(r),"properties",this)),{},{auto:{type:Boolean,attribute:"auto"},fitToVisibleBounds:{type:Boolean,attribute:"fit-to-visible-bounds"},hidden:{type:Boolean,attribute:"hidden"},for:{type:String,attribute:"for",reflect:!0},offset:{type:Number,attribute:"offset"},position:{type:String,attribute:"position",reflect:!0},positionAlign:{type:String,attribute:"position-align",reflect:!0},target:{type:Object},__positions:{type:Object}})}},{key:"tag",get:function(){return"absolute-position-behavior"}}]),i(r,[{key:"updated",value:function(t){var e=this;t.forEach(function(t,n){"auto"===n&&e.auto&&e.setPosition(),"auto"!==n||e.auto||e.unsetPosition(),"fitToVisibleBounds"===n&&e.updatePosition(),"for"===n&&e.updatePosition(),"offset"===n&&e.updatePosition(),"position"===n&&e.updatePosition(),"positionAlign"===n&&e.updatePosition(),"target"===n&&e.updatePosition(),"hidden"===n&&e.updatePosition()})}},{key:"setPosition",value:function(){this.__observe=!0,this.__manager.loadElement(this)}},{key:"unsetPosition",value:function(){this.__observe=!1,this.__manager.unloadElement(this)}},{key:"updatePosition",value:function(){!0===this.__observe&&this.__manager.positionElement(this)}},{key:"disconnectedCallback",value:function(){this.unsetPosition(),d(l(r.prototype),"disconnectedCallback",this).call(this)}}]),r}();window.customElements.define(g.tag,g),t.AbsolutePositionBehavior=g,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -45,3 +45,3 @@ /**

elements: {
type: Array
type: Array,
},

@@ -52,3 +52,3 @@ /**

__observer: {
type: Object
type: Object,
},

@@ -59,4 +59,4 @@ /**

__timeout: {
type: Object
}
type: Object,
},
};

@@ -72,3 +72,3 @@ }

this.__timeout = false;
this.__observer = new MutationObserver(mutations =>
this.__observer = new MutationObserver((mutations) =>
this.checkMutations(mutations)

@@ -89,3 +89,3 @@ );

subtree: true,
characterData: true
characterData: true,
});

@@ -107,3 +107,3 @@ this.updateElements();

unloadElement(el) {
this.elements.filter(element => element === el);
this.elements.filter((element) => element === el);
if (this.elements.length < 1) this.removeEventListeners();

@@ -135,3 +135,3 @@ }

mutations.forEach(mutation => {
mutations.forEach((mutation) => {
if (update) return;

@@ -196,3 +196,3 @@ update =

updateElements() {
this.elements.forEach(element => this.positionElement(element));
this.elements.forEach((element) => this.positionElement(element));
}

@@ -236,3 +236,3 @@

//fits element within parent's boundaries
let pxToNum = px => parseFloat(px.replace("px", "")),
let pxToNum = (px) => parseFloat(px.replace("px", "")),
min = v

@@ -242,3 +242,3 @@ ? pxToNum(el.style.left) - e.left

startAt = v ? "left" : "top",
distance = rect => (v ? rect.width : rect.height),
distance = (rect) => (v ? rect.width : rect.height),
max = min + distance(w) - distance(e),

@@ -258,3 +258,3 @@ align = min;

getCoord = (pos = el.position) => {
let pxToNum = px => parseFloat(px.replace("px", "")),
let pxToNum = (px) => parseFloat(px.replace("px", "")),
adjust = vertical(pos)

@@ -271,3 +271,3 @@ ? pxToNum(el.style.top) - e.top

//determines if room for element between parent and target
let distance = rect =>
let distance = (rect) =>
vertical(pos) ? e.height + offset : e.width + offset;

@@ -283,3 +283,3 @@ return before(pos)

bottom: ["top", "right", "left"],
right: ["left", "bottom", "top"]
right: ["left", "bottom", "top"],
};

@@ -304,3 +304,3 @@ el.style.position = "absolute";

parent: p,
target: t
target: t,
};

@@ -307,0 +307,0 @@ }

@@ -20,3 +20,3 @@ {

},
"version": "2.7.7",
"version": "2.7.10",
"description": "Abstracting the positioning behavior from paper-tooltip to be resusable in other elements",

@@ -32,9 +32,9 @@ "repository": {

"scripts": {
"test": "../../node_modules/.bin/wct --configFile ../../wct.conf.json node_modules/@lrnwebcomponents/absolute-position-behavior/test/",
"test": "wct --configFile ../../wct.conf.json node_modules/@lrnwebcomponents/absolute-position-behavior/test/",
"start": "yarn run dev",
"build": "../../node_modules/.bin/gulp --gulpfile=gulpfile.cjs && ../../node_modules/.bin/rollup -c && ../../node_modules/.bin/prettier --ignore-path ../../.prettierignore --write '**/*.{js,json}' && wca analyze \"**/*.js\" --format vscode --outFile vscode-html-custom-data.json",
"dev": "../../node_modules/.bin/concurrently --kill-others \"yarn run watch\" \"yarn run serve\"",
"watch": "../../node_modules/.bin/gulp dev --gulpfile=gulpfile.cjs",
"serve": "../../node_modules/.bin/es-dev-server -c ../../es-dev-server.config.js",
"lighthouse": "../../node_modules/.bin/gulp lighthouse --gulpfile=gulpfile.cjs"
"build": "gulp --gulpfile=gulpfile.cjs && rollup -c && prettier --ignore-path ../../.prettierignore --write \"**/*.{js,json}\" && wca analyze \"**/*.js\" --format vscode --outFile vscode-html-custom-data.json",
"dev": "concurrently --kill-others \"yarn run watch\" \"yarn run serve\"",
"watch": "gulp dev --gulpfile=gulpfile.cjs",
"serve": "es-dev-server -c ../../es-dev-server.config.js",
"lighthouse": "gulp lighthouse --gulpfile=gulpfile.cjs"
},

@@ -47,3 +47,3 @@ "author": {

"@polymer/iron-resizable-behavior": "^3.0.0",
"lit-element": "^2.3.1"
"lit-element": "2.4.0"
},

@@ -54,4 +54,4 @@ "devDependencies": {

"@polymer/iron-demo-helpers": "3.1.0",
"@webcomponents/webcomponentsjs": "2.4.1",
"concurrently": "5.1.0",
"@webcomponents/webcomponentsjs": "2.4.4",
"concurrently": "5.3.0",
"gulp-babel": "8.0.0",

@@ -71,3 +71,3 @@ "lodash": "4.17.19",

],
"gitHead": "5b346a23a41445900c73e9b8748be86b6f7db550"
"gitHead": "5b8d225cec2bf64160b4f4cab0630b187fdcd2d8"
}

@@ -5,20 +5,2 @@ {

{
"name": "absolute-position-state-manager",
"description": "`absolute-position-state-manager`\nmanages state of multiple absolute-positioned elements on a page\n\nAttributes:\n\n * `elements` {`any[]`} - Stores an array of all elements using manager.\n\n * `__timeout` - resize timeout\n\n * `__observer` - mutation observer\n\nProperties:\n\n * `elements` {`any[]`} - Stores an array of all elements using manager.\n\n * `__timeout` - resize timeout\n\n * `__observer` - mutation observer",
"attributes": [
{
"name": "elements",
"description": "`elements` {`any[]`} - Stores an array of all elements using manager.\n\nProperty: elements\n\nDefault: "
},
{
"name": "__timeout",
"description": "`__timeout` - resize timeout\n\nProperty: __timeout\n\nDefault: false"
},
{
"name": "__observer",
"description": "`__observer` - mutation observer\n\nProperty: __observer"
}
]
},
{
"name": "absolute-position-behavior",

@@ -69,4 +51,18 @@ "description": "`absolute-position-behavior`\nabstracts absolute positioning behavior to be resusable in other elements\n\nAttributes:\n\n * `hidden` {`boolean`} - If true, no parts of the tooltip will ever be shown offscreen.\n\n * `position-align` {`string`} - Aligns at the start, or end fo target. Default is centered.\n\n * `auto` {`boolean`} - Element is positioned from connected to disconnected?\nOtherwise setPosition and unsetPosition must be called manually.\n\n * `fit-to-visible-bounds` {`boolean`} - If true, no parts of the tooltip will ever be shown offscreen.\n\n * `for` {`string`} - The id of the element that the tooltip is anchored to. This element\nmust be a sibling of the tooltip. If this property is not set,\nthen the tooltip will be centered to the parent node containing it.\n\n * `offset` {`number`} - The spacing between the top of the tooltip and the element it is\nanchored to.\n\n * `position` {`string`} - Positions the tooltip to the top, right, bottom, left of its content.\n\n * `target` - The actual target element\n\n * `__positions` - The element's style\n\nProperties:\n\n * `hidden` {`boolean`} - If true, no parts of the tooltip will ever be shown offscreen.\n\n * `positionAlign` {`string`} - Aligns at the start, or end fo target. Default is centered.\n\n * `auto` {`boolean`} - Element is positioned from connected to disconnected?\nOtherwise setPosition and unsetPosition must be called manually.\n\n * `fitToVisibleBounds` {`boolean`} - If true, no parts of the tooltip will ever be shown offscreen.\n\n * `for` {`string`} - The id of the element that the tooltip is anchored to. This element\nmust be a sibling of the tooltip. If this property is not set,\nthen the tooltip will be centered to the parent node containing it.\n\n * `offset` {`number`} - The spacing between the top of the tooltip and the element it is\nanchored to.\n\n * `position` {`string`} - Positions the tooltip to the top, right, bottom, left of its content.\n\n * `target` - The actual target element\n\n * `__positions` - The element's style\n\n * `__observe` {`boolean`} - \n\n * `__manager` - ",

{
"name": "tag",
"attributes": []
"name": "absolute-position-state-manager",
"description": "`absolute-position-state-manager`\nmanages state of multiple absolute-positioned elements on a page\n\nAttributes:\n\n * `elements` {`any[]`} - Stores an array of all elements using manager.\n\n * `__timeout` - resize timeout\n\n * `__observer` - mutation observer\n\nProperties:\n\n * `elements` {`any[]`} - Stores an array of all elements using manager.\n\n * `__timeout` - resize timeout\n\n * `__observer` - mutation observer",
"attributes": [
{
"name": "elements",
"description": "`elements` {`any[]`} - Stores an array of all elements using manager.\n\nProperty: elements\n\nDefault: "
},
{
"name": "__timeout",
"description": "`__timeout` - resize timeout\n\nProperty: __timeout\n\nDefault: false"
},
{
"name": "__observer",
"description": "`__observer` - mutation observer\n\nProperty: __observer"
}
]
},

@@ -73,0 +69,0 @@ {

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc