@floating-ui/dom
Advanced tools
@@ -1,1 +0,1 @@ | ||
| import{rectToClientRect as t,computePosition as e}from"@floating-ui/core";export{arrow,autoPlacement,detectOverflow,flip,hide,inline,limitShift,offset,shift,size}from"@floating-ui/core";function n(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function o(t){if(null==t)return window;if(!n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return o(t).getComputedStyle(t)}function r(t){return n(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function c(t){return t instanceof o(t).HTMLElement}function s(t){return t instanceof o(t).Element}function f(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)&&!["inline","contents"].includes(r)}function d(t){return["table","td","th"].includes(r(t))}function h(t){const e=/firefox/i.test(l()),n=i(t);return"none"!==n.transform||"none"!==n.perspective||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((t=>n.willChange.includes(t)))||["paint","layout","strict","content"].some((t=>{const e=n.contain;return null!=e&&e.includes(t)}))}function a(){return!/^((?!chrome|android).)*safari/i.test(l())}function g(t){return["html","body","#document"].includes(r(t))}const m=Math.min,p=Math.max,w=Math.round;function v(t,e,n){var i,r,l,f;void 0===e&&(e=!1),void 0===n&&(n=!1);const u=t.getBoundingClientRect();let d=1,h=1;e&&c(t)&&(d=t.offsetWidth>0&&w(u.width)/t.offsetWidth||1,h=t.offsetHeight>0&&w(u.height)/t.offsetHeight||1);const g=s(t)?o(t):window,m=!a()&&n,p=(u.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,v=(u.top+(m&&null!=(l=null==(f=g.visualViewport)?void 0:f.offsetTop)?l:0))/h,y=u.width/d,x=u.height/h;return{width:y,height:x,top:v,right:p+y,bottom:v+x,left:p,x:p,y:v}}function y(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function x(t){return s(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function b(t){return v(y(t)).left+x(t).scrollLeft}function L(t,e,n){const o=c(e),i=y(e),l=v(t,o&&function(t){const e=v(t);return w(e.width)!==t.offsetWidth||w(e.height)!==t.offsetHeight}(e),"fixed"===n);let s={scrollLeft:0,scrollTop:0};const f={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(s=x(e)),c(e)){const t=v(e,!0);f.x=t.x+e.clientLeft,f.y=t.y+e.clientTop}else i&&(f.x=b(i));return{x:l.left+s.scrollLeft-f.x,y:l.top+s.scrollTop-f.y,width:l.width,height:l.height}}function R(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||y(t)}function E(t){return c(t)&&"fixed"!==i(t).position?t.offsetParent:null}function T(t){const e=o(t);let n=E(t);for(;n&&d(n)&&"static"===i(n).position;)n=E(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===i(n).position&&!h(n))?e:n||function(t){let e=R(t);for(f(e)&&(e=e.host);c(e)&&!g(e);){if(h(e))return e;{const t=e.parentNode;e=f(t)?t.host:t}}return null}(t)||e}function W(t){if(c(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=v(t);return{width:e.width,height:e.height}}function H(t){const e=R(t);return g(e)?t.ownerDocument.body:c(e)&&u(e)?e:H(e)}function C(t,e){var n;void 0===e&&(e=[]);const i=H(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,s=e.concat(c);return r?s:s.concat(C(c))}function D(e,n,r){return"viewport"===n?t(function(t,e){const n=o(t),i=y(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,s=0,f=0;if(r){l=r.width,c=r.height;const t=a();(t||!t&&"fixed"===e)&&(s=r.offsetLeft,f=r.offsetTop)}return{width:l,height:c,x:s,y:f}}(e,r)):s(n)?function(t,e){const n=v(t,!1,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n,r):t(function(t){var e;const n=y(t),o=x(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=p(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=p(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let s=-o.scrollLeft+b(t);const f=-o.scrollTop;return"rtl"===i(r||n).direction&&(s+=p(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:s,y:f}}(y(e)))}function N(t){const e=C(t),n=function(t,e){let n=t;for(;n&&!g(n)&&!e.includes(n)&&(!s(n)||!["absolute","fixed"].includes(i(n).position));){const t=R(n);n=f(t)?t.host:t}return n}(t,e);let o=null;if(n&&c(n)){const t=T(n);u(n)?o=n:c(t)&&(o=t)}return s(o)?e.filter((t=>o&&s(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&f(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,o)&&"body"!==r(t))):[]}const S={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?N(e):[].concat(n),o],l=r[0],c=r.reduce(((t,n)=>{const o=D(e,n,i);return t.top=p(o.top,t.top),t.right=m(o.right,t.right),t.bottom=m(o.bottom,t.bottom),t.left=p(o.left,t.left),t}),D(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=c(n),l=y(n);if(n===l)return e;let s={scrollLeft:0,scrollTop:0};const f={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||u(l))&&(s=x(n)),c(n))){const t=v(n,!0);f.x=t.x+n.clientLeft,f.y=t.y+n.clientTop}return{...e,x:e.x-s.scrollLeft+f.x,y:e.y-s.scrollTop+f.y}},isElement:s,getDimensions:W,getOffsetParent:T,getDocumentElement:y,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:L(e,T(n),o),floating:{...W(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};function z(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:c=!1}=o,f=i&&!c,u=f||r?[...s(t)?C(t):t.contextElement?C(t.contextElement):[],...C(e)]:[];u.forEach((t=>{f&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let d,h=null;if(l){let o=!0;h=new ResizeObserver((()=>{o||n(),o=!1})),s(t)&&!c&&h.observe(t),s(t)||!t.contextElement||c||h.observe(t.contextElement),h.observe(e)}let a=c?v(t):null;return c&&function e(){const o=v(t);!a||o.x===a.x&&o.y===a.y&&o.width===a.width&&o.height===a.height||n();a=o,d=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{f&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=h)||t.disconnect(),h=null,c&&cancelAnimationFrame(d)}}const A=(t,n,o)=>e(t,n,{platform:S,...o});export{z as autoUpdate,A as computePosition,C as getOverflowAncestors,S as platform}; | ||
| import{rectToClientRect as t,computePosition as e}from"@floating-ui/core";export{arrow,autoPlacement,detectOverflow,flip,hide,inline,limitShift,offset,shift,size}from"@floating-ui/core";function n(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function o(t){if(null==t)return window;if(!n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return o(t).getComputedStyle(t)}function r(t){return n(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function c(t){return t instanceof o(t).HTMLElement}function s(t){return t instanceof o(t).Element}function f(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)&&!["inline","contents"].includes(r)}function d(t){return["table","td","th"].includes(r(t))}function a(t){const e=/firefox/i.test(l()),n=i(t),o=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!o&&"none"!==o||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((t=>n.willChange.includes(t)))||["paint","layout","strict","content"].some((t=>{const e=n.contain;return null!=e&&e.includes(t)}))}function h(){return!/^((?!chrome|android).)*safari/i.test(l())}function g(t){return["html","body","#document"].includes(r(t))}const m=Math.min,p=Math.max,w=Math.round;function v(t,e,n){var i,r,l,f;void 0===e&&(e=!1),void 0===n&&(n=!1);const u=t.getBoundingClientRect();let d=1,a=1;e&&c(t)&&(d=t.offsetWidth>0&&w(u.width)/t.offsetWidth||1,a=t.offsetHeight>0&&w(u.height)/t.offsetHeight||1);const g=s(t)?o(t):window,m=!h()&&n,p=(u.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,v=(u.top+(m&&null!=(l=null==(f=g.visualViewport)?void 0:f.offsetTop)?l:0))/a,y=u.width/d,x=u.height/a;return{width:y,height:x,top:v,right:p+y,bottom:v+x,left:p,x:p,y:v}}function y(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function x(t){return s(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function b(t){return v(y(t)).left+x(t).scrollLeft}function L(t,e,n){const o=c(e),i=y(e),l=v(t,o&&function(t){const e=v(t);return w(e.width)!==t.offsetWidth||w(e.height)!==t.offsetHeight}(e),"fixed"===n);let s={scrollLeft:0,scrollTop:0};const f={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(s=x(e)),c(e)){const t=v(e,!0);f.x=t.x+e.clientLeft,f.y=t.y+e.clientTop}else i&&(f.x=b(i));return{x:l.left+s.scrollLeft-f.x,y:l.top+s.scrollTop-f.y,width:l.width,height:l.height}}function E(t){if("html"===r(t))return t;const e=t.assignedSlot||t.parentNode||(f(t)?t.host:null)||y(t);return f(e)?e.host:e}function R(t){return c(t)&&"fixed"!==i(t).position?t.offsetParent:null}function T(t){const e=o(t);let n=R(t);for(;n&&d(n)&&"static"===i(n).position;)n=R(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===i(n).position&&!a(n))?e:n||function(t){let e=E(t);for(;c(e)&&!g(e);){if(a(e))return e;e=E(e)}return null}(t)||e}function W(t){if(c(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=v(t);return{width:e.width,height:e.height}}function H(t){const e=E(t);return g(e)?t.ownerDocument.body:c(e)&&u(e)?e:H(e)}function C(t,e){var n;void 0===e&&(e=[]);const i=H(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,s=e.concat(c);return r?s:s.concat(C(c))}function D(e,n,r){return"viewport"===n?t(function(t,e){const n=o(t),i=y(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,s=0,f=0;if(r){l=r.width,c=r.height;const t=h();(t||!t&&"fixed"===e)&&(s=r.offsetLeft,f=r.offsetTop)}return{width:l,height:c,x:s,y:f}}(e,r)):s(n)?function(t,e){const n=v(t,!1,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n,r):t(function(t){var e;const n=y(t),o=x(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=p(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=p(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let s=-o.scrollLeft+b(t);const f=-o.scrollTop;return"rtl"===i(r||n).direction&&(s+=p(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:s,y:f}}(y(e)))}const S={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const l="clippingAncestors"===n?function(t){let e=C(t).filter((t=>s(t))),n=t,o=null;for(;s(n)&&!g(n);){const t=i(n);"static"===t.position&&o&&["absolute","fixed"].includes(o.position)&&!a(n)?e=e.filter((t=>t!==n)):o=t,n=E(n)}return e}(e):[].concat(n),c=[...l,o],f=c[0],u=c.reduce(((t,n)=>{const o=D(e,n,r);return t.top=p(o.top,t.top),t.right=m(o.right,t.right),t.bottom=m(o.bottom,t.bottom),t.left=p(o.left,t.left),t}),D(e,f,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=c(n),l=y(n);if(n===l)return e;let s={scrollLeft:0,scrollTop:0};const f={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||u(l))&&(s=x(n)),c(n))){const t=v(n,!0);f.x=t.x+n.clientLeft,f.y=t.y+n.clientTop}return{...e,x:e.x-s.scrollLeft+f.x,y:e.y-s.scrollTop+f.y}},isElement:s,getDimensions:W,getOffsetParent:T,getDocumentElement:y,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:L(e,T(n),o),floating:{...W(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};function z(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:c=!1}=o,f=i&&!c,u=f||r?[...s(t)?C(t):t.contextElement?C(t.contextElement):[],...C(e)]:[];u.forEach((t=>{f&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let d,a=null;if(l){let o=!0;a=new ResizeObserver((()=>{o||n(),o=!1})),s(t)&&!c&&a.observe(t),s(t)||!t.contextElement||c||a.observe(t.contextElement),a.observe(e)}let h=c?v(t):null;return c&&function e(){const o=v(t);!h||o.x===h.x&&o.y===h.y&&o.width===h.width&&o.height===h.height||n();h=o,d=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{f&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=a)||t.disconnect(),a=null,c&&cancelAnimationFrame(d)}}const A=(t,n,o)=>e(t,n,{platform:S,...o});export{z as autoUpdate,A as computePosition,C as getOverflowAncestors,S as platform}; |
@@ -72,7 +72,8 @@ import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core'; | ||
| const isFirefox = /firefox/i.test(getUAString()); | ||
| const css = getComputedStyle(element); // This is non-exhaustive but covers the most common CSS properties that | ||
| const css = getComputedStyle(element); | ||
| const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that | ||
| // create a containing block. | ||
| // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| value => { | ||
@@ -207,10 +208,8 @@ const contain = css.contain; | ||
| return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle | ||
| // @ts-ignore | ||
| node.assignedSlot || // step into the shadow DOM of the parent of a slotted node | ||
| node.parentNode || ( // DOM Element detected | ||
| isShadowRoot(node) ? node.host : null) || // ShadowRoot detected | ||
| getDocumentElement(node) // fallback | ||
| ); | ||
| const result = // Step into the shadow DOM of the parent of a slotted node | ||
| node.assignedSlot || // DOM Element detected | ||
| node.parentNode || ( // ShadowRoot detected | ||
| isShadowRoot(node) ? node.host : null) || // Fallback | ||
| getDocumentElement(node); | ||
| return isShadowRoot(result) ? result.host : result; | ||
| } | ||
@@ -229,6 +228,2 @@ | ||
| if (isShadowRoot(currentNode)) { | ||
| currentNode = currentNode.host; | ||
| } | ||
| while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
@@ -238,4 +233,3 @@ if (isContainingBlock(currentNode)) { | ||
| } else { | ||
| const parent = currentNode.parentNode; | ||
| currentNode = isShadowRoot(parent) ? parent.host : parent; | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
@@ -407,41 +401,2 @@ } | ||
| function contains(parent, child) { | ||
| const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method | ||
| if (parent.contains(child)) { | ||
| return true; | ||
| } // then fallback to custom implementation with Shadow DOM support | ||
| else if (rootNode && isShadowRoot(rootNode)) { | ||
| let next = child; | ||
| do { | ||
| // use `===` replace node.isSameNode() | ||
| if (next && parent === next) { | ||
| return true; | ||
| } // @ts-ignore: need a better way to handle this... | ||
| next = next.parentNode || next.host; | ||
| } while (next); | ||
| } | ||
| return false; | ||
| } | ||
| function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) { | ||
| let currentNode = element; | ||
| while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error | ||
| !clippingAncestors.includes(currentNode)) { | ||
| if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle(currentNode).position)) { | ||
| break; | ||
| } | ||
| const parentNode = getParentNode(currentNode); | ||
| currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode; | ||
| } | ||
| return currentNode; | ||
| } | ||
| function getInnerBoundingClientRect(element, strategy) { | ||
@@ -463,9 +418,9 @@ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed'); | ||
| function getClientRectFromClippingAncestor(element, clippingParent, strategy) { | ||
| if (clippingParent === 'viewport') { | ||
| function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | ||
| if (clippingAncestor === 'viewport') { | ||
| return rectToClientRect(getViewportRect(element, strategy)); | ||
| } | ||
| if (isElement(clippingParent)) { | ||
| return getInnerBoundingClientRect(clippingParent, strategy); | ||
| if (isElement(clippingAncestor)) { | ||
| return getInnerBoundingClientRect(clippingAncestor, strategy); | ||
| } | ||
@@ -479,23 +434,22 @@ | ||
| function getClippingAncestors(element) { | ||
| const clippingAncestors = getOverflowAncestors(element); | ||
| const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors); | ||
| let clipperElement = null; | ||
| function getClippingElementAncestors(element) { | ||
| let result = getOverflowAncestors(element).filter(el => isElement(el)); | ||
| let currentNode = element; | ||
| let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) { | ||
| const offsetParent = getOffsetParent(nearestEscapableParent); | ||
| while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
| const computedStyle = getComputedStyle(currentNode); | ||
| if (isOverflowElement(nearestEscapableParent)) { | ||
| clipperElement = nearestEscapableParent; | ||
| } else if (isHTMLElement(offsetParent)) { | ||
| clipperElement = offsetParent; | ||
| if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) { | ||
| // Drop non-containing blocks | ||
| result = result.filter(ancestor => ancestor !== currentNode); | ||
| } else { | ||
| // Record last containing block for next iteration | ||
| currentContainingBlockComputedStyle = computedStyle; | ||
| } | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
| if (!isElement(clipperElement)) { | ||
| return []; | ||
| } // @ts-ignore isElement check ensures we return Array<Element> | ||
| return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body'); | ||
| return result; | ||
| } // Gets the maximum area that the element is visible in due to any number of | ||
@@ -512,4 +466,4 @@ // clipping ancestors | ||
| } = _ref; | ||
| const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...mainClippingAncestors, rootBoundary]; | ||
| const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | ||
| const firstClippingAncestor = clippingAncestors[0]; | ||
@@ -516,0 +470,0 @@ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { |
@@ -72,7 +72,8 @@ import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core'; | ||
| const isFirefox = /firefox/i.test(getUAString()); | ||
| const css = getComputedStyle(element); // This is non-exhaustive but covers the most common CSS properties that | ||
| const css = getComputedStyle(element); | ||
| const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that | ||
| // create a containing block. | ||
| // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| value => { | ||
@@ -207,10 +208,8 @@ const contain = css.contain; | ||
| return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle | ||
| // @ts-ignore | ||
| node.assignedSlot || // step into the shadow DOM of the parent of a slotted node | ||
| node.parentNode || ( // DOM Element detected | ||
| isShadowRoot(node) ? node.host : null) || // ShadowRoot detected | ||
| getDocumentElement(node) // fallback | ||
| ); | ||
| const result = // Step into the shadow DOM of the parent of a slotted node | ||
| node.assignedSlot || // DOM Element detected | ||
| node.parentNode || ( // ShadowRoot detected | ||
| isShadowRoot(node) ? node.host : null) || // Fallback | ||
| getDocumentElement(node); | ||
| return isShadowRoot(result) ? result.host : result; | ||
| } | ||
@@ -229,6 +228,2 @@ | ||
| if (isShadowRoot(currentNode)) { | ||
| currentNode = currentNode.host; | ||
| } | ||
| while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
@@ -238,4 +233,3 @@ if (isContainingBlock(currentNode)) { | ||
| } else { | ||
| const parent = currentNode.parentNode; | ||
| currentNode = isShadowRoot(parent) ? parent.host : parent; | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
@@ -407,41 +401,2 @@ } | ||
| function contains(parent, child) { | ||
| const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method | ||
| if (parent.contains(child)) { | ||
| return true; | ||
| } // then fallback to custom implementation with Shadow DOM support | ||
| else if (rootNode && isShadowRoot(rootNode)) { | ||
| let next = child; | ||
| do { | ||
| // use `===` replace node.isSameNode() | ||
| if (next && parent === next) { | ||
| return true; | ||
| } // @ts-ignore: need a better way to handle this... | ||
| next = next.parentNode || next.host; | ||
| } while (next); | ||
| } | ||
| return false; | ||
| } | ||
| function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) { | ||
| let currentNode = element; | ||
| while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error | ||
| !clippingAncestors.includes(currentNode)) { | ||
| if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle(currentNode).position)) { | ||
| break; | ||
| } | ||
| const parentNode = getParentNode(currentNode); | ||
| currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode; | ||
| } | ||
| return currentNode; | ||
| } | ||
| function getInnerBoundingClientRect(element, strategy) { | ||
@@ -463,9 +418,9 @@ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed'); | ||
| function getClientRectFromClippingAncestor(element, clippingParent, strategy) { | ||
| if (clippingParent === 'viewport') { | ||
| function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | ||
| if (clippingAncestor === 'viewport') { | ||
| return rectToClientRect(getViewportRect(element, strategy)); | ||
| } | ||
| if (isElement(clippingParent)) { | ||
| return getInnerBoundingClientRect(clippingParent, strategy); | ||
| if (isElement(clippingAncestor)) { | ||
| return getInnerBoundingClientRect(clippingAncestor, strategy); | ||
| } | ||
@@ -479,23 +434,22 @@ | ||
| function getClippingAncestors(element) { | ||
| const clippingAncestors = getOverflowAncestors(element); | ||
| const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors); | ||
| let clipperElement = null; | ||
| function getClippingElementAncestors(element) { | ||
| let result = getOverflowAncestors(element).filter(el => isElement(el)); | ||
| let currentNode = element; | ||
| let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) { | ||
| const offsetParent = getOffsetParent(nearestEscapableParent); | ||
| while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
| const computedStyle = getComputedStyle(currentNode); | ||
| if (isOverflowElement(nearestEscapableParent)) { | ||
| clipperElement = nearestEscapableParent; | ||
| } else if (isHTMLElement(offsetParent)) { | ||
| clipperElement = offsetParent; | ||
| if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) { | ||
| // Drop non-containing blocks | ||
| result = result.filter(ancestor => ancestor !== currentNode); | ||
| } else { | ||
| // Record last containing block for next iteration | ||
| currentContainingBlockComputedStyle = computedStyle; | ||
| } | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
| if (!isElement(clipperElement)) { | ||
| return []; | ||
| } // @ts-ignore isElement check ensures we return Array<Element> | ||
| return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body'); | ||
| return result; | ||
| } // Gets the maximum area that the element is visible in due to any number of | ||
@@ -512,4 +466,4 @@ // clipping ancestors | ||
| } = _ref; | ||
| const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...mainClippingAncestors, rootBoundary]; | ||
| const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | ||
| const firstClippingAncestor = clippingAncestors[0]; | ||
@@ -516,0 +470,0 @@ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { |
+31
-77
@@ -72,7 +72,8 @@ import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core'; | ||
| const isFirefox = /firefox/i.test(getUAString()); | ||
| const css = getComputedStyle(element); // This is non-exhaustive but covers the most common CSS properties that | ||
| const css = getComputedStyle(element); | ||
| const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that | ||
| // create a containing block. | ||
| // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| value => { | ||
@@ -207,10 +208,8 @@ const contain = css.contain; | ||
| return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle | ||
| // @ts-ignore | ||
| node.assignedSlot || // step into the shadow DOM of the parent of a slotted node | ||
| node.parentNode || ( // DOM Element detected | ||
| isShadowRoot(node) ? node.host : null) || // ShadowRoot detected | ||
| getDocumentElement(node) // fallback | ||
| ); | ||
| const result = // Step into the shadow DOM of the parent of a slotted node | ||
| node.assignedSlot || // DOM Element detected | ||
| node.parentNode || ( // ShadowRoot detected | ||
| isShadowRoot(node) ? node.host : null) || // Fallback | ||
| getDocumentElement(node); | ||
| return isShadowRoot(result) ? result.host : result; | ||
| } | ||
@@ -229,6 +228,2 @@ | ||
| if (isShadowRoot(currentNode)) { | ||
| currentNode = currentNode.host; | ||
| } | ||
| while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
@@ -238,4 +233,3 @@ if (isContainingBlock(currentNode)) { | ||
| } else { | ||
| const parent = currentNode.parentNode; | ||
| currentNode = isShadowRoot(parent) ? parent.host : parent; | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
@@ -407,41 +401,2 @@ } | ||
| function contains(parent, child) { | ||
| const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method | ||
| if (parent.contains(child)) { | ||
| return true; | ||
| } // then fallback to custom implementation with Shadow DOM support | ||
| else if (rootNode && isShadowRoot(rootNode)) { | ||
| let next = child; | ||
| do { | ||
| // use `===` replace node.isSameNode() | ||
| if (next && parent === next) { | ||
| return true; | ||
| } // @ts-ignore: need a better way to handle this... | ||
| next = next.parentNode || next.host; | ||
| } while (next); | ||
| } | ||
| return false; | ||
| } | ||
| function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) { | ||
| let currentNode = element; | ||
| while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error | ||
| !clippingAncestors.includes(currentNode)) { | ||
| if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle(currentNode).position)) { | ||
| break; | ||
| } | ||
| const parentNode = getParentNode(currentNode); | ||
| currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode; | ||
| } | ||
| return currentNode; | ||
| } | ||
| function getInnerBoundingClientRect(element, strategy) { | ||
@@ -463,9 +418,9 @@ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed'); | ||
| function getClientRectFromClippingAncestor(element, clippingParent, strategy) { | ||
| if (clippingParent === 'viewport') { | ||
| function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | ||
| if (clippingAncestor === 'viewport') { | ||
| return rectToClientRect(getViewportRect(element, strategy)); | ||
| } | ||
| if (isElement(clippingParent)) { | ||
| return getInnerBoundingClientRect(clippingParent, strategy); | ||
| if (isElement(clippingAncestor)) { | ||
| return getInnerBoundingClientRect(clippingAncestor, strategy); | ||
| } | ||
@@ -479,23 +434,22 @@ | ||
| function getClippingAncestors(element) { | ||
| const clippingAncestors = getOverflowAncestors(element); | ||
| const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors); | ||
| let clipperElement = null; | ||
| function getClippingElementAncestors(element) { | ||
| let result = getOverflowAncestors(element).filter(el => isElement(el)); | ||
| let currentNode = element; | ||
| let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) { | ||
| const offsetParent = getOffsetParent(nearestEscapableParent); | ||
| while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
| const computedStyle = getComputedStyle(currentNode); | ||
| if (isOverflowElement(nearestEscapableParent)) { | ||
| clipperElement = nearestEscapableParent; | ||
| } else if (isHTMLElement(offsetParent)) { | ||
| clipperElement = offsetParent; | ||
| if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) { | ||
| // Drop non-containing blocks | ||
| result = result.filter(ancestor => ancestor !== currentNode); | ||
| } else { | ||
| // Record last containing block for next iteration | ||
| currentContainingBlockComputedStyle = computedStyle; | ||
| } | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
| if (!isElement(clipperElement)) { | ||
| return []; | ||
| } // @ts-ignore isElement check ensures we return Array<Element> | ||
| return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body'); | ||
| return result; | ||
| } // Gets the maximum area that the element is visible in due to any number of | ||
@@ -512,4 +466,4 @@ // clipping ancestors | ||
| } = _ref; | ||
| const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...mainClippingAncestors, rootBoundary]; | ||
| const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | ||
| const firstClippingAncestor = clippingAncestors[0]; | ||
@@ -516,0 +470,0 @@ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { |
@@ -75,7 +75,8 @@ (function (global, factory) { | ||
| const isFirefox = /firefox/i.test(getUAString()); | ||
| const css = getComputedStyle(element); // This is non-exhaustive but covers the most common CSS properties that | ||
| const css = getComputedStyle(element); | ||
| const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that | ||
| // create a containing block. | ||
| // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat | ||
| value => { | ||
@@ -210,10 +211,8 @@ const contain = css.contain; | ||
| return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle | ||
| // @ts-ignore | ||
| node.assignedSlot || // step into the shadow DOM of the parent of a slotted node | ||
| node.parentNode || ( // DOM Element detected | ||
| isShadowRoot(node) ? node.host : null) || // ShadowRoot detected | ||
| getDocumentElement(node) // fallback | ||
| ); | ||
| const result = // Step into the shadow DOM of the parent of a slotted node | ||
| node.assignedSlot || // DOM Element detected | ||
| node.parentNode || ( // ShadowRoot detected | ||
| isShadowRoot(node) ? node.host : null) || // Fallback | ||
| getDocumentElement(node); | ||
| return isShadowRoot(result) ? result.host : result; | ||
| } | ||
@@ -232,6 +231,2 @@ | ||
| if (isShadowRoot(currentNode)) { | ||
| currentNode = currentNode.host; | ||
| } | ||
| while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
@@ -241,4 +236,3 @@ if (isContainingBlock(currentNode)) { | ||
| } else { | ||
| const parent = currentNode.parentNode; | ||
| currentNode = isShadowRoot(parent) ? parent.host : parent; | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
@@ -410,41 +404,2 @@ } | ||
| function contains(parent, child) { | ||
| const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method | ||
| if (parent.contains(child)) { | ||
| return true; | ||
| } // then fallback to custom implementation with Shadow DOM support | ||
| else if (rootNode && isShadowRoot(rootNode)) { | ||
| let next = child; | ||
| do { | ||
| // use `===` replace node.isSameNode() | ||
| if (next && parent === next) { | ||
| return true; | ||
| } // @ts-ignore: need a better way to handle this... | ||
| next = next.parentNode || next.host; | ||
| } while (next); | ||
| } | ||
| return false; | ||
| } | ||
| function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) { | ||
| let currentNode = element; | ||
| while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error | ||
| !clippingAncestors.includes(currentNode)) { | ||
| if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle(currentNode).position)) { | ||
| break; | ||
| } | ||
| const parentNode = getParentNode(currentNode); | ||
| currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode; | ||
| } | ||
| return currentNode; | ||
| } | ||
| function getInnerBoundingClientRect(element, strategy) { | ||
@@ -466,9 +421,9 @@ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed'); | ||
| function getClientRectFromClippingAncestor(element, clippingParent, strategy) { | ||
| if (clippingParent === 'viewport') { | ||
| function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { | ||
| if (clippingAncestor === 'viewport') { | ||
| return core.rectToClientRect(getViewportRect(element, strategy)); | ||
| } | ||
| if (isElement(clippingParent)) { | ||
| return getInnerBoundingClientRect(clippingParent, strategy); | ||
| if (isElement(clippingAncestor)) { | ||
| return getInnerBoundingClientRect(clippingAncestor, strategy); | ||
| } | ||
@@ -482,23 +437,22 @@ | ||
| function getClippingAncestors(element) { | ||
| const clippingAncestors = getOverflowAncestors(element); | ||
| const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors); | ||
| let clipperElement = null; | ||
| function getClippingElementAncestors(element) { | ||
| let result = getOverflowAncestors(element).filter(el => isElement(el)); | ||
| let currentNode = element; | ||
| let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
| if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) { | ||
| const offsetParent = getOffsetParent(nearestEscapableParent); | ||
| while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
| const computedStyle = getComputedStyle(currentNode); | ||
| if (isOverflowElement(nearestEscapableParent)) { | ||
| clipperElement = nearestEscapableParent; | ||
| } else if (isHTMLElement(offsetParent)) { | ||
| clipperElement = offsetParent; | ||
| if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) { | ||
| // Drop non-containing blocks | ||
| result = result.filter(ancestor => ancestor !== currentNode); | ||
| } else { | ||
| // Record last containing block for next iteration | ||
| currentContainingBlockComputedStyle = computedStyle; | ||
| } | ||
| currentNode = getParentNode(currentNode); | ||
| } | ||
| if (!isElement(clipperElement)) { | ||
| return []; | ||
| } // @ts-ignore isElement check ensures we return Array<Element> | ||
| return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body'); | ||
| return result; | ||
| } // Gets the maximum area that the element is visible in due to any number of | ||
@@ -515,4 +469,4 @@ // clipping ancestors | ||
| } = _ref; | ||
| const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...mainClippingAncestors, rootBoundary]; | ||
| const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary); | ||
| const clippingAncestors = [...elementClippingAncestors, rootBoundary]; | ||
| const firstClippingAncestor = clippingAncestors[0]; | ||
@@ -519,0 +473,0 @@ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { |
@@ -1,1 +0,1 @@ | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@floating-ui/core")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIDOM={},t.FloatingUICore)}(this,(function(t,e){"use strict";function n(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function o(t){if(null==t)return window;if(!n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return o(t).getComputedStyle(t)}function r(t){return n(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function c(t){return t instanceof o(t).HTMLElement}function f(t){return t instanceof o(t).Element}function u(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function s(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)&&!["inline","contents"].includes(r)}function d(t){return["table","td","th"].includes(r(t))}function a(t){const e=/firefox/i.test(l()),n=i(t);return"none"!==n.transform||"none"!==n.perspective||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((t=>n.willChange.includes(t)))||["paint","layout","strict","content"].some((t=>{const e=n.contain;return null!=e&&e.includes(t)}))}function h(){return!/^((?!chrome|android).)*safari/i.test(l())}function g(t){return["html","body","#document"].includes(r(t))}const p=Math.min,m=Math.max,y=Math.round;function w(t,e,n){var i,r,l,u;void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect();let d=1,a=1;e&&c(t)&&(d=t.offsetWidth>0&&y(s.width)/t.offsetWidth||1,a=t.offsetHeight>0&&y(s.height)/t.offsetHeight||1);const g=f(t)?o(t):window,p=!h()&&n,m=(s.left+(p&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,w=(s.top+(p&&null!=(l=null==(u=g.visualViewport)?void 0:u.offsetTop)?l:0))/a,b=s.width/d,v=s.height/a;return{width:b,height:v,top:w,right:m+b,bottom:w+v,left:m,x:m,y:w}}function b(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function v(t){return f(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function x(t){return w(b(t)).left+v(t).scrollLeft}function L(t,e,n){const o=c(e),i=b(e),l=w(t,o&&function(t){const e=w(t);return y(e.width)!==t.offsetWidth||y(e.height)!==t.offsetHeight}(e),"fixed"===n);let f={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||s(i))&&(f=v(e)),c(e)){const t=w(e,!0);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else i&&(u.x=x(i));return{x:l.left+f.scrollLeft-u.x,y:l.top+f.scrollTop-u.y,width:l.width,height:l.height}}function O(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(u(t)?t.host:null)||b(t)}function R(t){return c(t)&&"fixed"!==i(t).position?t.offsetParent:null}function T(t){const e=o(t);let n=R(t);for(;n&&d(n)&&"static"===i(n).position;)n=R(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===i(n).position&&!a(n))?e:n||function(t){let e=O(t);for(u(e)&&(e=e.host);c(e)&&!g(e);){if(a(e))return e;{const t=e.parentNode;e=u(t)?t.host:t}}return null}(t)||e}function P(t){if(c(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=w(t);return{width:e.width,height:e.height}}function E(t){const e=O(t);return g(e)?t.ownerDocument.body:c(e)&&s(e)?e:E(e)}function j(t,e){var n;void 0===e&&(e=[]);const i=E(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],s(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(j(c))}function W(t,n,r){return"viewport"===n?e.rectToClientRect(function(t,e){const n=o(t),i=b(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,f=0,u=0;if(r){l=r.width,c=r.height;const t=h();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,u=r.offsetTop)}return{width:l,height:c,x:f,y:u}}(t,r)):f(n)?function(t,e){const n=w(t,!1,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n,r):e.rectToClientRect(function(t){var e;const n=b(t),o=v(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=m(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=m(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+x(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=m(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(b(t)))}function H(t){const e=j(t),n=function(t,e){let n=t;for(;n&&!g(n)&&!e.includes(n)&&(!f(n)||!["absolute","fixed"].includes(i(n).position));){const t=O(n);n=u(t)?t.host:t}return n}(t,e);let o=null;if(n&&c(n)){const t=T(n);s(n)?o=n:c(t)&&(o=t)}return f(o)?e.filter((t=>o&&f(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&u(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,o)&&"body"!==r(t))):[]}const C={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?H(e):[].concat(n),o],l=r[0],c=r.reduce(((t,n)=>{const o=W(e,n,i);return t.top=m(o.top,t.top),t.right=p(o.right,t.right),t.bottom=p(o.bottom,t.bottom),t.left=m(o.left,t.left),t}),W(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=c(n),l=b(n);if(n===l)return e;let f={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||s(l))&&(f=v(n)),c(n))){const t=w(n,!0);u.x=t.x+n.clientLeft,u.y=t.y+n.clientTop}return{...e,x:e.x-f.scrollLeft+u.x,y:e.y-f.scrollTop+u.y}},isElement:f,getDimensions:P,getOffsetParent:T,getDocumentElement:b,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:L(e,T(n),o),floating:{...P(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};Object.defineProperty(t,"arrow",{enumerable:!0,get:function(){return e.arrow}}),Object.defineProperty(t,"autoPlacement",{enumerable:!0,get:function(){return e.autoPlacement}}),Object.defineProperty(t,"detectOverflow",{enumerable:!0,get:function(){return e.detectOverflow}}),Object.defineProperty(t,"flip",{enumerable:!0,get:function(){return e.flip}}),Object.defineProperty(t,"hide",{enumerable:!0,get:function(){return e.hide}}),Object.defineProperty(t,"inline",{enumerable:!0,get:function(){return e.inline}}),Object.defineProperty(t,"limitShift",{enumerable:!0,get:function(){return e.limitShift}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}}),Object.defineProperty(t,"shift",{enumerable:!0,get:function(){return e.shift}}),Object.defineProperty(t,"size",{enumerable:!0,get:function(){return e.size}}),t.autoUpdate=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:c=!1}=o,u=i&&!c,s=u||r?[...f(t)?j(t):t.contextElement?j(t.contextElement):[],...j(e)]:[];s.forEach((t=>{u&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let d,a=null;if(l){let o=!0;a=new ResizeObserver((()=>{o||n(),o=!1})),f(t)&&!c&&a.observe(t),f(t)||!t.contextElement||c||a.observe(t.contextElement),a.observe(e)}let h=c?w(t):null;return c&&function e(){const o=w(t);!h||o.x===h.x&&o.y===h.y&&o.width===h.width&&o.height===h.height||n();h=o,d=requestAnimationFrame(e)}(),n(),()=>{var t;s.forEach((t=>{u&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=a)||t.disconnect(),a=null,c&&cancelAnimationFrame(d)}},t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:C,...o}),t.getOverflowAncestors=j,t.platform=C,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@floating-ui/core")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIDOM={},t.FloatingUICore)}(this,(function(t,e){"use strict";function n(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function o(t){if(null==t)return window;if(!n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return o(t).getComputedStyle(t)}function r(t){return n(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function c(t){return t instanceof o(t).HTMLElement}function f(t){return t instanceof o(t).Element}function u(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function s(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)&&!["inline","contents"].includes(r)}function d(t){return["table","td","th"].includes(r(t))}function a(t){const e=/firefox/i.test(l()),n=i(t),o=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!o&&"none"!==o||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((t=>n.willChange.includes(t)))||["paint","layout","strict","content"].some((t=>{const e=n.contain;return null!=e&&e.includes(t)}))}function h(){return!/^((?!chrome|android).)*safari/i.test(l())}function p(t){return["html","body","#document"].includes(r(t))}const g=Math.min,m=Math.max,y=Math.round;function w(t,e,n){var i,r,l,u;void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect();let d=1,a=1;e&&c(t)&&(d=t.offsetWidth>0&&y(s.width)/t.offsetWidth||1,a=t.offsetHeight>0&&y(s.height)/t.offsetHeight||1);const p=f(t)?o(t):window,g=!h()&&n,m=(s.left+(g&&null!=(i=null==(r=p.visualViewport)?void 0:r.offsetLeft)?i:0))/d,w=(s.top+(g&&null!=(l=null==(u=p.visualViewport)?void 0:u.offsetTop)?l:0))/a,b=s.width/d,v=s.height/a;return{width:b,height:v,top:w,right:m+b,bottom:w+v,left:m,x:m,y:w}}function b(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function v(t){return f(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function x(t){return w(b(t)).left+v(t).scrollLeft}function L(t,e,n){const o=c(e),i=b(e),l=w(t,o&&function(t){const e=w(t);return y(e.width)!==t.offsetWidth||y(e.height)!==t.offsetHeight}(e),"fixed"===n);let f={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||s(i))&&(f=v(e)),c(e)){const t=w(e,!0);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else i&&(u.x=x(i));return{x:l.left+f.scrollLeft-u.x,y:l.top+f.scrollTop-u.y,width:l.width,height:l.height}}function O(t){if("html"===r(t))return t;const e=t.assignedSlot||t.parentNode||(u(t)?t.host:null)||b(t);return u(e)?e.host:e}function T(t){return c(t)&&"fixed"!==i(t).position?t.offsetParent:null}function P(t){const e=o(t);let n=T(t);for(;n&&d(n)&&"static"===i(n).position;)n=T(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===i(n).position&&!a(n))?e:n||function(t){let e=O(t);for(;c(e)&&!p(e);){if(a(e))return e;e=O(e)}return null}(t)||e}function R(t){if(c(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=w(t);return{width:e.width,height:e.height}}function E(t){const e=O(t);return p(e)?t.ownerDocument.body:c(e)&&s(e)?e:E(e)}function W(t,e){var n;void 0===e&&(e=[]);const i=E(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],s(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(W(c))}function j(t,n,r){return"viewport"===n?e.rectToClientRect(function(t,e){const n=o(t),i=b(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,f=0,u=0;if(r){l=r.width,c=r.height;const t=h();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,u=r.offsetTop)}return{width:l,height:c,x:f,y:u}}(t,r)):f(n)?function(t,e){const n=w(t,!1,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n,r):e.rectToClientRect(function(t){var e;const n=b(t),o=v(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=m(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=m(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+x(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=m(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(b(t)))}const H={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const l="clippingAncestors"===n?function(t){let e=W(t).filter((t=>f(t))),n=t,o=null;for(;f(n)&&!p(n);){const t=i(n);"static"===t.position&&o&&["absolute","fixed"].includes(o.position)&&!a(n)?e=e.filter((t=>t!==n)):o=t,n=O(n)}return e}(e):[].concat(n),c=[...l,o],u=c[0],s=c.reduce(((t,n)=>{const o=j(e,n,r);return t.top=m(o.top,t.top),t.right=g(o.right,t.right),t.bottom=g(o.bottom,t.bottom),t.left=m(o.left,t.left),t}),j(e,u,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=c(n),l=b(n);if(n===l)return e;let f={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||s(l))&&(f=v(n)),c(n))){const t=w(n,!0);u.x=t.x+n.clientLeft,u.y=t.y+n.clientTop}return{...e,x:e.x-f.scrollLeft+u.x,y:e.y-f.scrollTop+u.y}},isElement:f,getDimensions:R,getOffsetParent:P,getDocumentElement:b,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:L(e,P(n),o),floating:{...R(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};Object.defineProperty(t,"arrow",{enumerable:!0,get:function(){return e.arrow}}),Object.defineProperty(t,"autoPlacement",{enumerable:!0,get:function(){return e.autoPlacement}}),Object.defineProperty(t,"detectOverflow",{enumerable:!0,get:function(){return e.detectOverflow}}),Object.defineProperty(t,"flip",{enumerable:!0,get:function(){return e.flip}}),Object.defineProperty(t,"hide",{enumerable:!0,get:function(){return e.hide}}),Object.defineProperty(t,"inline",{enumerable:!0,get:function(){return e.inline}}),Object.defineProperty(t,"limitShift",{enumerable:!0,get:function(){return e.limitShift}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}}),Object.defineProperty(t,"shift",{enumerable:!0,get:function(){return e.shift}}),Object.defineProperty(t,"size",{enumerable:!0,get:function(){return e.size}}),t.autoUpdate=function(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:c=!1}=o,u=i&&!c,s=u||r?[...f(t)?W(t):t.contextElement?W(t.contextElement):[],...W(e)]:[];s.forEach((t=>{u&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let d,a=null;if(l){let o=!0;a=new ResizeObserver((()=>{o||n(),o=!1})),f(t)&&!c&&a.observe(t),f(t)||!t.contextElement||c||a.observe(t.contextElement),a.observe(e)}let h=c?w(t):null;return c&&function e(){const o=w(t);!h||o.x===h.x&&o.y===h.y&&o.width===h.width&&o.height===h.height||n();h=o,d=requestAnimationFrame(e)}(),n(),()=>{var t;s.forEach((t=>{u&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=a)||t.disconnect(),a=null,c&&cancelAnimationFrame(d)}},t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:H,...o}),t.getOverflowAncestors=W,t.platform=H,Object.defineProperty(t,"__esModule",{value:!0})})); |
+2
-2
| { | ||
| "name": "@floating-ui/dom", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "@rollingversions": { | ||
@@ -64,3 +64,3 @@ "baseVersion": [ | ||
| "dependencies": { | ||
| "@floating-ui/core": "^1.0.1" | ||
| "@floating-ui/core": "^1.0.2" | ||
| }, | ||
@@ -67,0 +67,0 @@ "devDependencies": { |
+1
-1
@@ -47,3 +47,3 @@ import type { AutoPlacementOptions, ClientRectObject, DetectOverflowOptions as CoreDetectOverflowOptions, Dimensions, ElementRects, FlipOptions, HideOptions, Middleware as CoreMiddleware, MiddlewareArguments as CoreMiddlewareArguments, MiddlewareReturn, Padding, Rect, RootBoundary, ShiftOptions, SideObject, SizeOptions as CoreSizeOptions, Strategy, ComputePositionConfig as CoreComputePositionConfig } from '@floating-ui/core'; | ||
| export declare type ComputePositionConfig = Omit<CoreComputePositionConfig, 'middleware' | 'platform'> & { | ||
| middleware?: Middleware[]; | ||
| middleware?: Array<Middleware | null | undefined | false>; | ||
| platform?: Platform; | ||
@@ -50,0 +50,0 @@ }; |
@@ -13,3 +13,3 @@ declare global { | ||
| export declare function isShadowRoot(node: Node): node is ShadowRoot; | ||
| export declare function isOverflowElement(element: HTMLElement): boolean; | ||
| export declare function isOverflowElement(element: Element): boolean; | ||
| export declare function isTableElement(element: Element): boolean; | ||
@@ -16,0 +16,0 @@ export declare function isContainingBlock(element: Element): boolean; |
| export declare function contains(parent: Element, child: Element): boolean; |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
13
-23.53%106132
-4.52%34
-2.86%2326
-5.49%Updated