Socket
Socket
Sign inDemoInstall

@floating-ui/dom

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/dom - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

LICENSE

5

dist/floating-ui.dom.esm.development.js

@@ -38,2 +38,7 @@ import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core';

function isShadowRoot(node) {
// Browsers without `ShadowRoot` support
if (typeof ShadowRoot === 'undefined') {
return false;
}
const OwnElement = getWindow(node).ShadowRoot;

@@ -40,0 +45,0 @@ return node instanceof OwnElement || node instanceof ShadowRoot;

@@ -38,2 +38,7 @@ import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core';

function isShadowRoot(node) {
// Browsers without `ShadowRoot` support
if (typeof ShadowRoot === 'undefined') {
return false;
}
const OwnElement = getWindow(node).ShadowRoot;

@@ -40,0 +45,0 @@ return node instanceof OwnElement || node instanceof ShadowRoot;

2

dist/floating-ui.dom.esm.min.js

@@ -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(t){return t instanceof o(t).HTMLElement}function c(t){return t instanceof o(t).Element}function f(t){return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function s(t){const{overflow:e,overflowX:n,overflowY:o}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function u(t){return["table","td","th"].includes(r(t))}function d(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=i(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}function h(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const a=Math.min,g=Math.max,p=Math.round;function m(t,e,n){var i,r,f,s;void 0===e&&(e=!1),void 0===n&&(n=!1);const u=t.getBoundingClientRect();let d=1,a=1;e&&l(t)&&(d=t.offsetWidth>0&&p(u.width)/t.offsetWidth||1,a=t.offsetHeight>0&&p(u.height)/t.offsetHeight||1);const g=c(t)?o(t):window,m=!h()&&n,w=(u.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,v=(u.top+(m&&null!=(f=null==(s=g.visualViewport)?void 0:s.offsetTop)?f:0))/a,y=u.width/d,x=u.height/a;return{width:y,height:x,top:v,right:w+y,bottom:v+x,left:w,x:w,y:v}}function w(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function v(t){return c(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function y(t){return m(w(t)).left+v(t).scrollLeft}function x(t,e,n){const o=l(e),i=w(e),c=m(t,o&&function(t){const e=m(t);return p(e.width)!==t.offsetWidth||p(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)),l(e)){const t=m(e,!0);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else i&&(u.x=y(i));return{x:c.left+f.scrollLeft-u.x,y:c.top+f.scrollTop-u.y,width:c.width,height:c.height}}function L(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||w(t)}function b(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function R(t){const e=o(t);let n=b(t);for(;n&&u(n)&&"static"===getComputedStyle(n).position;)n=b(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=L(t);for(f(e)&&(e=e.host);l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function T(t){if(l(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=m(t);return{width:e.width,height:e.height}}function W(t){const e=L(t);return["html","body","#document"].includes(r(e))?t.ownerDocument.body:l(e)&&s(e)?e:W(e)}function C(t,e){var n;void 0===e&&(e=[]);const i=W(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(C(c))}function E(e,n,r){return"viewport"===n?t(function(t,e){const n=o(t),i=w(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,f=0,s=0;if(r){l=r.width,c=r.height;const t=h();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,s=r.offsetTop)}return{width:l,height:c,x:f,y:s}}(e,r)):c(n)?function(t,e){const n=m(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=w(t),o=v(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=g(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=g(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+y(t);const s=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=g(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:s}}(w(e)))}function H(t){const e=C(t),n=["absolute","fixed"].includes(i(t).position)&&l(t)?R(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const n=null==e||null==e.getRootNode?void 0:e.getRootNode();if(null!=t&&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,n)&&"body"!==r(t))):[]}const S={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=E(e,n,i);return t.top=g(o.top,t.top),t.right=a(o.right,t.right),t.bottom=a(o.bottom,t.bottom),t.left=g(o.left,t.left),t}),E(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=l(n),c=w(n);if(n===c)return e;let f={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||s(c))&&(f=v(n)),l(n))){const t=m(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:c,getDimensions:T,getOffsetParent:R,getDocumentElement:w,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:x(e,R(n),o),floating:{...T(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};function D(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:f=!1}=o;let s=!1;const u=i&&!f,d=r&&!f,h=l&&!f,a=u||d?[...c(t)?C(t):[],...C(e)]:[];a.forEach((t=>{u&&t.addEventListener("scroll",n,{passive:!0}),d&&t.addEventListener("resize",n)}));let g,p=null;h&&(p=new ResizeObserver(n),c(t)&&p.observe(t),p.observe(e));let w=f?m(t):null;return f&&function e(){if(s)return;const o=m(t);!w||o.x===w.x&&o.y===w.y&&o.width===w.width&&o.height===w.height||n();w=o,g=requestAnimationFrame(e)}(),()=>{var t;s=!0,a.forEach((t=>{u&&t.removeEventListener("scroll",n),d&&t.removeEventListener("resize",n)})),null==(t=p)||t.disconnect(),p=null,f&&cancelAnimationFrame(g)}}const N=(t,n,o)=>e(t,n,{platform:S,...o});export{D as autoUpdate,N as computePosition,C as getOverflowAncestors};
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(t){return t instanceof o(t).HTMLElement}function c(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 s(t){const{overflow:e,overflowX:n,overflowY:o}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function u(t){return["table","td","th"].includes(r(t))}function d(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=i(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}function h(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const a=Math.min,g=Math.max,p=Math.round;function m(t,e,n){var i,r,f,s;void 0===e&&(e=!1),void 0===n&&(n=!1);const u=t.getBoundingClientRect();let d=1,a=1;e&&l(t)&&(d=t.offsetWidth>0&&p(u.width)/t.offsetWidth||1,a=t.offsetHeight>0&&p(u.height)/t.offsetHeight||1);const g=c(t)?o(t):window,m=!h()&&n,w=(u.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,v=(u.top+(m&&null!=(f=null==(s=g.visualViewport)?void 0:s.offsetTop)?f:0))/a,y=u.width/d,x=u.height/a;return{width:y,height:x,top:v,right:w+y,bottom:v+x,left:w,x:w,y:v}}function w(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function v(t){return c(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function y(t){return m(w(t)).left+v(t).scrollLeft}function x(t,e,n){const o=l(e),i=w(e),c=m(t,o&&function(t){const e=m(t);return p(e.width)!==t.offsetWidth||p(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)),l(e)){const t=m(e,!0);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else i&&(u.x=y(i));return{x:c.left+f.scrollLeft-u.x,y:c.top+f.scrollTop-u.y,width:c.width,height:c.height}}function L(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||w(t)}function b(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function R(t){const e=o(t);let n=b(t);for(;n&&u(n)&&"static"===getComputedStyle(n).position;)n=b(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=L(t);for(f(e)&&(e=e.host);l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function T(t){if(l(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=m(t);return{width:e.width,height:e.height}}function W(t){const e=L(t);return["html","body","#document"].includes(r(e))?t.ownerDocument.body:l(e)&&s(e)?e:W(e)}function C(t,e){var n;void 0===e&&(e=[]);const i=W(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(C(c))}function E(e,n,r){return"viewport"===n?t(function(t,e){const n=o(t),i=w(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,f=0,s=0;if(r){l=r.width,c=r.height;const t=h();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,s=r.offsetTop)}return{width:l,height:c,x:f,y:s}}(e,r)):c(n)?function(t,e){const n=m(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=w(t),o=v(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=g(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=g(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+y(t);const s=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=g(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:s}}(w(e)))}function H(t){const e=C(t),n=["absolute","fixed"].includes(i(t).position)&&l(t)?R(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const n=null==e||null==e.getRootNode?void 0:e.getRootNode();if(null!=t&&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,n)&&"body"!==r(t))):[]}const S={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=E(e,n,i);return t.top=g(o.top,t.top),t.right=a(o.right,t.right),t.bottom=a(o.bottom,t.bottom),t.left=g(o.left,t.left),t}),E(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=l(n),c=w(n);if(n===c)return e;let f={scrollLeft:0,scrollTop:0};const u={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||s(c))&&(f=v(n)),l(n))){const t=m(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:c,getDimensions:T,getOffsetParent:R,getDocumentElement:w,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:x(e,R(n),o),floating:{...T(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===i(t).direction};function D(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:f=!1}=o;let s=!1;const u=i&&!f,d=r&&!f,h=l&&!f,a=u||d?[...c(t)?C(t):[],...C(e)]:[];a.forEach((t=>{u&&t.addEventListener("scroll",n,{passive:!0}),d&&t.addEventListener("resize",n)}));let g,p=null;h&&(p=new ResizeObserver(n),c(t)&&p.observe(t),p.observe(e));let w=f?m(t):null;return f&&function e(){if(s)return;const o=m(t);!w||o.x===w.x&&o.y===w.y&&o.width===w.width&&o.height===w.height||n();w=o,g=requestAnimationFrame(e)}(),()=>{var t;s=!0,a.forEach((t=>{u&&t.removeEventListener("scroll",n),d&&t.removeEventListener("resize",n)})),null==(t=p)||t.disconnect(),p=null,f&&cancelAnimationFrame(g)}}const N=(t,n,o)=>e(t,n,{platform:S,...o});export{D as autoUpdate,N as computePosition,C as getOverflowAncestors};

@@ -41,2 +41,7 @@ (function (global, factory) {

function isShadowRoot(node) {
// Browsers without `ShadowRoot` support
if (typeof ShadowRoot === 'undefined') {
return false;
}
const OwnElement = getWindow(node).ShadowRoot;

@@ -43,0 +48,0 @@ return node instanceof OwnElement || node instanceof ShadowRoot;

@@ -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(t){return t instanceof o(t).HTMLElement}function c(t){return t instanceof o(t).Element}function f(t){return t instanceof o(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function s(t){return["table","td","th"].includes(r(t))}function d(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=i(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}function a(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const h=Math.min,g=Math.max,p=Math.round;function m(t,e,n){var i,r,f,u;void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect();let d=1,h=1;e&&l(t)&&(d=t.offsetWidth>0&&p(s.width)/t.offsetWidth||1,h=t.offsetHeight>0&&p(s.height)/t.offsetHeight||1);const g=c(t)?o(t):window,m=!a()&&n,y=(s.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,w=(s.top+(m&&null!=(f=null==(u=g.visualViewport)?void 0:u.offsetTop)?f:0))/h,b=s.width/d,v=s.height/h;return{width:b,height:v,top:w,right:y+b,bottom:w+v,left:y,x:y,y:w}}function y(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function w(t){return c(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function b(t){return m(y(t)).left+w(t).scrollLeft}function v(t,e,n){const o=l(e),i=y(e),c=m(t,o&&function(t){const e=m(t);return p(e.width)!==t.offsetWidth||p(e.height)!==t.offsetHeight}(e),"fixed"===n);let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(f=w(e)),l(e)){const t=m(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=b(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function x(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||y(t)}function L(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function O(t){const e=o(t);let n=L(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=L(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=x(t);for(f(e)&&(e=e.host);l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function T(t){if(l(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=m(t);return{width:e.width,height:e.height}}function P(t){const e=x(t);return["html","body","#document"].includes(r(e))?t.ownerDocument.body:l(e)&&u(e)?e:P(e)}function R(t,e){var n;void 0===e&&(e=[]);const i=P(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(R(c))}function C(t,n,r){return"viewport"===n?e.rectToClientRect(function(t,e){const n=o(t),i=y(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=a();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,u=r.offsetTop)}return{width:l,height:c,x:f,y:u}}(t,r)):c(n)?function(t,e){const n=m(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=y(t),o=w(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=g(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=g(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+b(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=g(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(y(t)))}function W(t){const e=R(t),n=["absolute","fixed"].includes(i(t).position)&&l(t)?O(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const n=null==e||null==e.getRootNode?void 0:e.getRootNode();if(null!=t&&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,n)&&"body"!==r(t))):[]}const j={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?W(e):[].concat(n),o],l=r[0],c=r.reduce(((t,n)=>{const o=C(e,n,i);return t.top=g(o.top,t.top),t.right=h(o.right,t.right),t.bottom=h(o.bottom,t.bottom),t.left=g(o.left,t.left),t}),C(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=l(n),c=y(n);if(n===c)return e;let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||u(c))&&(f=w(n)),l(n))){const t=m(n,!0);s.x=t.x+n.clientLeft,s.y=t.y+n.clientTop}return{...e,x:e.x-f.scrollLeft+s.x,y:e.y-f.scrollTop+s.y}},isElement:c,getDimensions:T,getOffsetParent:O,getDocumentElement:y,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:v(e,O(n),o),floating:{...T(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:f=!1}=o;let u=!1;const s=i&&!f,d=r&&!f,a=l&&!f,h=s||d?[...c(t)?R(t):[],...R(e)]:[];h.forEach((t=>{s&&t.addEventListener("scroll",n,{passive:!0}),d&&t.addEventListener("resize",n)}));let g,p=null;a&&(p=new ResizeObserver(n),c(t)&&p.observe(t),p.observe(e));let y=f?m(t):null;return f&&function e(){if(u)return;const o=m(t);!y||o.x===y.x&&o.y===y.y&&o.width===y.width&&o.height===y.height||n();y=o,g=requestAnimationFrame(e)}(),()=>{var t;u=!0,h.forEach((t=>{s&&t.removeEventListener("scroll",n),d&&t.removeEventListener("resize",n)})),null==(t=p)||t.disconnect(),p=null,f&&cancelAnimationFrame(g)}},t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:j,...o}),t.getOverflowAncestors=R,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(t){return t instanceof o(t).HTMLElement}function c(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}=i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function s(t){return["table","td","th"].includes(r(t))}function d(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),n=i(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}function a(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const h=Math.min,g=Math.max,p=Math.round;function m(t,e,n){var i,r,f,u;void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect();let d=1,h=1;e&&l(t)&&(d=t.offsetWidth>0&&p(s.width)/t.offsetWidth||1,h=t.offsetHeight>0&&p(s.height)/t.offsetHeight||1);const g=c(t)?o(t):window,m=!a()&&n,y=(s.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,w=(s.top+(m&&null!=(f=null==(u=g.visualViewport)?void 0:u.offsetTop)?f:0))/h,b=s.width/d,v=s.height/h;return{width:b,height:v,top:w,right:y+b,bottom:w+v,left:y,x:y,y:w}}function y(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function w(t){return c(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function b(t){return m(y(t)).left+w(t).scrollLeft}function v(t,e,n){const o=l(e),i=y(e),c=m(t,o&&function(t){const e=m(t);return p(e.width)!==t.offsetWidth||p(e.height)!==t.offsetHeight}(e),"fixed"===n);let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(f=w(e)),l(e)){const t=m(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=b(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function x(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||y(t)}function L(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function O(t){const e=o(t);let n=L(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=L(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=x(t);for(f(e)&&(e=e.host);l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function R(t){if(l(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=m(t);return{width:e.width,height:e.height}}function T(t){const e=x(t);return["html","body","#document"].includes(r(e))?t.ownerDocument.body:l(e)&&u(e)?e:T(e)}function P(t,e){var n;void 0===e&&(e=[]);const i=T(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=o(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(P(c))}function C(t,n,r){return"viewport"===n?e.rectToClientRect(function(t,e){const n=o(t),i=y(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=a();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,u=r.offsetTop)}return{width:l,height:c,x:f,y:u}}(t,r)):c(n)?function(t,e){const n=m(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=y(t),o=w(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=g(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=g(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+b(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=g(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(y(t)))}function W(t){const e=P(t),n=["absolute","fixed"].includes(i(t).position)&&l(t)?O(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const n=null==e||null==e.getRootNode?void 0:e.getRootNode();if(null!=t&&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,n)&&"body"!==r(t))):[]}const j={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?W(e):[].concat(n),o],l=r[0],c=r.reduce(((t,n)=>{const o=C(e,n,i);return t.top=g(o.top,t.top),t.right=h(o.right,t.right),t.bottom=h(o.bottom,t.bottom),t.left=g(o.left,t.left),t}),C(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=l(n),c=y(n);if(n===c)return e;let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==r(n)||u(c))&&(f=w(n)),l(n))){const t=m(n,!0);s.x=t.x+n.clientLeft,s.y=t.y+n.clientTop}return{...e,x:e.x-f.scrollLeft+s.x,y:e.y-f.scrollTop+s.y}},isElement:c,getDimensions:R,getOffsetParent:O,getDocumentElement:y,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:v(e,O(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:f=!1}=o;let u=!1;const s=i&&!f,d=r&&!f,a=l&&!f,h=s||d?[...c(t)?P(t):[],...P(e)]:[];h.forEach((t=>{s&&t.addEventListener("scroll",n,{passive:!0}),d&&t.addEventListener("resize",n)}));let g,p=null;a&&(p=new ResizeObserver(n),c(t)&&p.observe(t),p.observe(e));let y=f?m(t):null;return f&&function e(){if(u)return;const o=m(t);!y||o.x===y.x&&o.y===y.y&&o.width===y.width&&o.height===y.height||n();y=o,g=requestAnimationFrame(e)}(),()=>{var t;u=!0,h.forEach((t=>{s&&t.removeEventListener("scroll",n),d&&t.removeEventListener("resize",n)})),null==(t=p)||t.disconnect(),p=null,f&&cancelAnimationFrame(g)}},t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:j,...o}),t.getOverflowAncestors=P,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@floating-ui/dom",
"version": "0.4.4",
"version": "0.4.5",
"@rollingversions": {

@@ -61,3 +61,3 @@ "baseVersion": [

"dependencies": {
"@floating-ui/core": "^0.6.1"
"@floating-ui/core": "^0.6.2"
},

@@ -70,7 +70,8 @@ "devDependencies": {

"@types/jest": "^27.0.3",
"@types/react": "^18.0.1",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"concurrently": "^6.4.0",
"jest": "^27.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.1.1",

@@ -77,0 +78,0 @@ "rollup-plugin-terser": "^7.0.2",

@@ -113,3 +113,3 @@ import type { Middleware as CoreMiddleware, SideObject, ClientRectObject, Padding, ElementRects, Strategy, RootBoundary, Rect, Dimensions, MiddlewareArguments as CoreMiddlewareArguments, MiddlewareReturn } from '@floating-ui/core';

export { computePosition } from './';
export { autoUpdate } from './autoUpdate';
export { autoUpdate, Options as AutoUpdateOptions } from './autoUpdate';
export { getOverflowAncestors } from './utils/getOverflowAncestors';

Sorry, the diff of this file is not supported yet

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