@floating-ui/dom
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -288,2 +288,5 @@ import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core'; | ||
const min = Math.min; | ||
const max = Math.max; | ||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable | ||
@@ -297,4 +300,4 @@ | ||
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; | ||
const width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); | ||
const height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); | ||
const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); | ||
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); | ||
let x = -scroll.scrollLeft + getWindowScrollBarX(element); | ||
@@ -304,3 +307,3 @@ const y = -scroll.scrollTop; | ||
if (getComputedStyle$1(body || html).direction === 'rtl') { | ||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width; | ||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width; | ||
} | ||
@@ -355,3 +358,4 @@ | ||
do { | ||
if (next && parent.isSameNode(next)) { | ||
// use `===` replace node.isSameNode() | ||
if (next && parent === next) { | ||
return true; | ||
@@ -425,6 +429,6 @@ } // @ts-ignore: need a better way to handle this... | ||
const rect = getClientRectFromClippingParent(element, clippingParent); | ||
accRect.top = Math.max(rect.top, accRect.top); | ||
accRect.right = Math.min(rect.right, accRect.right); | ||
accRect.bottom = Math.min(rect.bottom, accRect.bottom); | ||
accRect.left = Math.max(rect.left, accRect.left); | ||
accRect.top = max(rect.top, accRect.top); | ||
accRect.right = min(rect.right, accRect.right); | ||
accRect.bottom = min(rect.bottom, accRect.bottom); | ||
accRect.left = max(rect.left, accRect.left); | ||
return accRect; | ||
@@ -431,0 +435,0 @@ }, getClientRectFromClippingParent(element, firstClippingParent)); |
@@ -1,1 +0,1 @@ | ||
import{rectToClientRect as t,computePosition as e}from"@floating-ui/core";export{arrow,autoPlacement,detectOverflow,flip,hide,limitShift,offset,shift,size}from"@floating-ui/core";function o(t){return"[object Window]"===(null==t?void 0:t.toString())}function n(t){if(null==t)return window;if(!o(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return n(t).getComputedStyle(t)}function r(t){return o(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(t){return t instanceof n(t).HTMLElement}function c(t){return t instanceof n(t).Element}function f(t){return t instanceof n(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:o,overflowY:n}=i(t);return/auto|scroll|overlay|hidden/.test(e+n+o)}function s(t){return["table","td","th"].includes(r(t))}function h(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),o=i(t);return"none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||["transform","perspective"].includes(o.willChange)||e&&"filter"===o.willChange||e&&!!o.filter&&"none"!==o.filter}function d(t,e){void 0===e&&(e=!1);const o=t.getBoundingClientRect();let n=1,i=1;return e&&l(t)&&(n=t.offsetWidth>0&&Math.round(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&Math.round(o.height)/t.offsetHeight||1),{width:o.width/n,height:o.height/i,top:o.top/i,right:o.right/n,bottom:o.bottom/i,left:o.left/n,x:o.left/n,y:o.top/i}}function a(t){return(e=t,(e instanceof n(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function g(t){return o(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function p(t){return d(a(t)).left+g(t).scrollLeft}function m(t,e,o){const n=l(e),i=a(e),c=d(t,n&&function(t){const e=d(t);return Math.round(e.width)!==t.offsetWidth||Math.round(e.height)!==t.offsetHeight}(e));let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(n||!n&&"fixed"!==o)if(("body"!==r(e)||u(i))&&(f=g(e)),l(e)){const t=d(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=p(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function w(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||a(t)}function y(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function x(t){const e=n(t);let o=y(t);for(;o&&s(o)&&"static"===getComputedStyle(o).position;)o=y(o);return o&&("html"===r(o)||"body"===r(o)&&"static"===getComputedStyle(o).position&&!h(o))?e:o||function(t){let e=w(t);for(;l(e)&&!["html","body"].includes(r(e));){if(h(e))return e;e=e.parentNode}return null}(t)||e}function v(t){return{width:t.offsetWidth,height:t.offsetHeight}}function b(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:b(w(t))}function L(t,e){var o;void 0===e&&(e=[]);const i=b(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=n(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(L(w(c)))}function W(e,o){return"viewport"===o?t(function(t){const e=n(t),o=a(t),i=e.visualViewport;let r=o.clientWidth,l=o.clientHeight,c=0,f=0;return i&&(r=i.width,l=i.height,Math.abs(e.innerWidth/i.scale-i.width)<.001&&(c=i.offsetLeft,f=i.offsetTop)),{width:r,height:l,x:c,y:f}}(e)):c(o)?function(t){const e=d(t),o=e.top+t.clientTop,n=e.left+t.clientLeft;return{top:o,left:n,x:n,y:o,right:n+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(o):t(function(t){var e;const o=a(t),n=g(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=Math.max(o.scrollWidth,o.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=Math.max(o.scrollHeight,o.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-n.scrollLeft+p(t);const u=-n.scrollTop;return"rtl"===i(r||o).direction&&(f+=Math.max(o.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(a(e)))}function T(t){const e=L(w(t)),o=["absolute","fixed"].includes(i(t).position),n=o&&l(t)?x(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const o=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(o&&f(o)){let o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}(t,n)&&"body"!==r(t)&&(!o||"static"!==i(t).position))):[]}const M={getElementRects:t=>{let{reference:e,floating:o,strategy:n}=t;return{reference:m(e,x(o),n),floating:{...v(o),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:o,strategy:n}=t;const i=l(o),c=a(o);if(o===c)return e;let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==n)&&(("body"!==r(o)||u(c))&&(f=g(o)),l(o))){const t=d(o,!0);s.x=t.x+o.clientLeft,s.y=t.y+o.clientTop}return{...e,x:e.x-f.scrollLeft+s.x,y:e.y-f.scrollTop+s.y}}(t),getOffsetParent:t=>{let{element:e}=t;return x(e)},isElement:t=>c(t),getDocumentElement:t=>{let{element:e}=t;return a(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:o,rootBoundary:n}=t;const i=[..."clippingParents"===o?T(e):[].concat(o),n],r=i[0],l=i.reduce(((t,o)=>{const n=W(e,o);return t.top=Math.max(n.top,t.top),t.right=Math.min(n.right,t.right),t.bottom=Math.min(n.bottom,t.bottom),t.left=Math.max(n.left,t.left),t}),W(e,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}(t),getDimensions:t=>{let{element:e}=t;return v(e)}},H=(t,o,n)=>e(t,o,{platform:M,...n});export{H as computePosition,L as getScrollParents}; | ||
import{rectToClientRect as t,computePosition as e}from"@floating-ui/core";export{arrow,autoPlacement,detectOverflow,flip,hide,limitShift,offset,shift,size}from"@floating-ui/core";function o(t){return"[object Window]"===(null==t?void 0:t.toString())}function n(t){if(null==t)return window;if(!o(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function i(t){return n(t).getComputedStyle(t)}function r(t){return o(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(t){return t instanceof n(t).HTMLElement}function c(t){return t instanceof n(t).Element}function f(t){return t instanceof n(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:o,overflowY:n}=i(t);return/auto|scroll|overlay|hidden/.test(e+n+o)}function s(t){return["table","td","th"].includes(r(t))}function h(t){const e=navigator.userAgent.toLowerCase().includes("firefox"),o=i(t);return"none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||["transform","perspective"].includes(o.willChange)||e&&"filter"===o.willChange||e&&!!o.filter&&"none"!==o.filter}function d(t,e){void 0===e&&(e=!1);const o=t.getBoundingClientRect();let n=1,i=1;return e&&l(t)&&(n=t.offsetWidth>0&&Math.round(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&Math.round(o.height)/t.offsetHeight||1),{width:o.width/n,height:o.height/i,top:o.top/i,right:o.right/n,bottom:o.bottom/i,left:o.left/n,x:o.left/n,y:o.top/i}}function a(t){return(e=t,(e instanceof n(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function g(t){return o(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function p(t){return d(a(t)).left+g(t).scrollLeft}function m(t,e,o){const n=l(e),i=a(e),c=d(t,n&&function(t){const e=d(t);return Math.round(e.width)!==t.offsetWidth||Math.round(e.height)!==t.offsetHeight}(e));let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(n||!n&&"fixed"!==o)if(("body"!==r(e)||u(i))&&(f=g(e)),l(e)){const t=d(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=p(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function w(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||a(t)}function y(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function x(t){const e=n(t);let o=y(t);for(;o&&s(o)&&"static"===getComputedStyle(o).position;)o=y(o);return o&&("html"===r(o)||"body"===r(o)&&"static"===getComputedStyle(o).position&&!h(o))?e:o||function(t){let e=w(t);for(;l(e)&&!["html","body"].includes(r(e));){if(h(e))return e;e=e.parentNode}return null}(t)||e}function v(t){return{width:t.offsetWidth,height:t.offsetHeight}}const b=Math.min,L=Math.max;function W(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:W(w(t))}function T(t,e){var o;void 0===e&&(e=[]);const i=W(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=n(i),c=r?[l].concat(l.visualViewport||[],u(i)?i:[]):i,f=e.concat(c);return r?f:f.concat(T(w(c)))}function H(e,o){return"viewport"===o?t(function(t){const e=n(t),o=a(t),i=e.visualViewport;let r=o.clientWidth,l=o.clientHeight,c=0,f=0;return i&&(r=i.width,l=i.height,Math.abs(e.innerWidth/i.scale-i.width)<.001&&(c=i.offsetLeft,f=i.offsetTop)),{width:r,height:l,x:c,y:f}}(e)):c(o)?function(t){const e=d(t),o=e.top+t.clientTop,n=e.left+t.clientLeft;return{top:o,left:n,x:n,y:o,right:n+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(o):t(function(t){var e;const o=a(t),n=g(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=L(o.scrollWidth,o.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=L(o.scrollHeight,o.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-n.scrollLeft+p(t);const u=-n.scrollTop;return"rtl"===i(r||o).direction&&(f+=L(o.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(a(e)))}function C(t){const e=T(w(t)),o=["absolute","fixed"].includes(i(t).position),n=o&&l(t)?x(t):t;return c(n)?e.filter((t=>c(t)&&function(t,e){const o=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(o&&f(o)){let o=e;do{if(o&&t===o)return!0;o=o.parentNode||o.host}while(o)}return!1}(t,n)&&"body"!==r(t)&&(!o||"static"!==i(t).position))):[]}const R={getElementRects:t=>{let{reference:e,floating:o,strategy:n}=t;return{reference:m(e,x(o),n),floating:{...v(o),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:o,strategy:n}=t;const i=l(o),c=a(o);if(o===c)return e;let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==n)&&(("body"!==r(o)||u(c))&&(f=g(o)),l(o))){const t=d(o,!0);s.x=t.x+o.clientLeft,s.y=t.y+o.clientTop}return{...e,x:e.x-f.scrollLeft+s.x,y:e.y-f.scrollTop+s.y}}(t),getOffsetParent:t=>{let{element:e}=t;return x(e)},isElement:t=>c(t),getDocumentElement:t=>{let{element:e}=t;return a(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:o,rootBoundary:n}=t;const i=[..."clippingParents"===o?C(e):[].concat(o),n],r=i[0],l=i.reduce(((t,o)=>{const n=H(e,o);return t.top=L(n.top,t.top),t.right=b(n.right,t.right),t.bottom=b(n.bottom,t.bottom),t.left=L(n.left,t.left),t}),H(e,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}(t),getDimensions:t=>{let{element:e}=t;return v(e)}},S=(t,o,n)=>e(t,o,{platform:R,...n});export{S as computePosition,T as getScrollParents}; |
@@ -291,2 +291,5 @@ (function (global, factory) { | ||
const min = Math.min; | ||
const max = Math.max; | ||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable | ||
@@ -300,4 +303,4 @@ | ||
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; | ||
const width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); | ||
const height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); | ||
const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); | ||
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); | ||
let x = -scroll.scrollLeft + getWindowScrollBarX(element); | ||
@@ -307,3 +310,3 @@ const y = -scroll.scrollTop; | ||
if (getComputedStyle$1(body || html).direction === 'rtl') { | ||
x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width; | ||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width; | ||
} | ||
@@ -358,3 +361,4 @@ | ||
do { | ||
if (next && parent.isSameNode(next)) { | ||
// use `===` replace node.isSameNode() | ||
if (next && parent === next) { | ||
return true; | ||
@@ -428,6 +432,6 @@ } // @ts-ignore: need a better way to handle this... | ||
const rect = getClientRectFromClippingParent(element, clippingParent); | ||
accRect.top = Math.max(rect.top, accRect.top); | ||
accRect.right = Math.min(rect.right, accRect.right); | ||
accRect.bottom = Math.min(rect.bottom, accRect.bottom); | ||
accRect.left = Math.max(rect.left, accRect.left); | ||
accRect.top = max(rect.top, accRect.top); | ||
accRect.right = min(rect.right, accRect.right); | ||
accRect.bottom = min(rect.bottom, accRect.bottom); | ||
accRect.left = max(rect.left, accRect.left); | ||
return accRect; | ||
@@ -434,0 +438,0 @@ }, getClientRectFromClippingParent(element, firstClippingParent)); |
@@ -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"[object Window]"===(null==t?void 0:t.toString())}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 h(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&l(t)&&(o=t.offsetWidth>0&&Math.round(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&Math.round(n.height)/t.offsetHeight||1),{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function a(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function g(t){return n(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function p(t){return h(a(t)).left+g(t).scrollLeft}function m(t,e,n){const o=l(e),i=a(e),c=h(t,o&&function(t){const e=h(t);return Math.round(e.width)!==t.offsetWidth||Math.round(e.height)!==t.offsetHeight}(e));let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(f=g(e)),l(e)){const t=h(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=p(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function y(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||a(t)}function w(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function b(t){const e=o(t);let n=w(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=w(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=y(t);for(;l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function x(t){return{width:t.offsetWidth,height:t.offsetHeight}}function v(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:v(y(t))}function P(t,e){var n;void 0===e&&(e=[]);const i=v(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(y(c)))}function T(t,n){return"viewport"===n?e.rectToClientRect(function(t){const e=o(t),n=a(t),i=e.visualViewport;let r=n.clientWidth,l=n.clientHeight,c=0,f=0;return i&&(r=i.width,l=i.height,Math.abs(e.innerWidth/i.scale-i.width)<.001&&(c=i.offsetLeft,f=i.offsetTop)),{width:r,height:l,x:c,y:f}}(t)):c(n)?function(t){const e=h(t),n=e.top+t.clientTop,o=e.left+t.clientLeft;return{top:n,left:o,x:o,y:n,right:o+t.clientWidth,bottom:n+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n):e.rectToClientRect(function(t){var e;const n=a(t),o=g(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=Math.max(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=Math.max(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+p(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=Math.max(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(a(t)))}function O(t){const e=P(y(t)),n=["absolute","fixed"].includes(i(t).position),o=n&&l(t)?b(t):t;return c(o)?e.filter((t=>c(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.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}(t,o)&&"body"!==r(t)&&(!n||"static"!==i(t).position))):[]}const L={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:m(e,b(n),o),floating:{...x(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=l(n),c=a(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=g(n)),l(n))){const t=h(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}}(t),getOffsetParent:t=>{let{element:e}=t;return b(e)},isElement:t=>c(t),getDocumentElement:t=>{let{element:e}=t;return a(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?O(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=T(e,n);return t.top=Math.max(o.top,t.top),t.right=Math.min(o.right,t.right),t.bottom=Math.min(o.bottom,t.bottom),t.left=Math.max(o.left,t.left),t}),T(e,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}(t),getDimensions:t=>{let{element:e}=t;return x(e)}};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,"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.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:L,...o}),t.getScrollParents=P,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"[object Window]"===(null==t?void 0:t.toString())}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 h(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&l(t)&&(o=t.offsetWidth>0&&Math.round(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&Math.round(n.height)/t.offsetHeight||1),{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function a(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function g(t){return n(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function p(t){return h(a(t)).left+g(t).scrollLeft}function m(t,e,n){const o=l(e),i=a(e),c=h(t,o&&function(t){const e=h(t);return Math.round(e.width)!==t.offsetWidth||Math.round(e.height)!==t.offsetHeight}(e));let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==r(e)||u(i))&&(f=g(e)),l(e)){const t=h(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=p(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function y(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||a(t)}function w(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function b(t){const e=o(t);let n=w(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=w(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=y(t);for(;l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function x(t){return{width:t.offsetWidth,height:t.offsetHeight}}const v=Math.min,P=Math.max;function T(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:T(y(t))}function O(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(O(y(c)))}function L(t,n){return"viewport"===n?e.rectToClientRect(function(t){const e=o(t),n=a(t),i=e.visualViewport;let r=n.clientWidth,l=n.clientHeight,c=0,f=0;return i&&(r=i.width,l=i.height,Math.abs(e.innerWidth/i.scale-i.width)<.001&&(c=i.offsetLeft,f=i.offsetTop)),{width:r,height:l,x:c,y:f}}(t)):c(n)?function(t){const e=h(t),n=e.top+t.clientTop,o=e.left+t.clientLeft;return{top:n,left:o,x:o,y:n,right:o+t.clientWidth,bottom:n+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n):e.rectToClientRect(function(t){var e;const n=a(t),o=g(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 f=-o.scrollLeft+p(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=P(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(a(t)))}function W(t){const e=O(y(t)),n=["absolute","fixed"].includes(i(t).position),o=n&&l(t)?b(t):t;return c(o)?e.filter((t=>c(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)&&(!n||"static"!==i(t).position))):[]}const C={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:m(e,b(n),o),floating:{...x(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=l(n),c=a(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=g(n)),l(n))){const t=h(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}}(t),getOffsetParent:t=>{let{element:e}=t;return b(e)},isElement:t=>c(t),getDocumentElement:t=>{let{element:e}=t;return a(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?W(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=L(e,n);return t.top=P(o.top,t.top),t.right=v(o.right,t.right),t.bottom=v(o.bottom,t.bottom),t.left=P(o.left,t.left),t}),L(e,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}(t),getDimensions:t=>{let{element:e}=t;return x(e)}};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,"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.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:C,...o}),t.getScrollParents=O,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/dom", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Floating UI for the web", | ||
@@ -21,7 +21,5 @@ "main": "dist/floating-ui.dom.cjs", | ||
"scripts": { | ||
"dev": "concurrently 'rollup -c -w' 'serve -l 1234 test/visual'", | ||
"dev": "rollup -c -w", | ||
"build": "NODE_ENV=build rollup -c", | ||
"test": "jest test", | ||
"test:functional": "rollup -c && npx playwright test", | ||
"test:functional:update": "rollup -c && npx playwright test -u" | ||
"test": "jest test" | ||
}, | ||
@@ -46,3 +44,3 @@ "author": "atomiks", | ||
"dependencies": { | ||
"@floating-ui/core": "^0.2.1" | ||
"@floating-ui/core": "^0.2.2" | ||
}, | ||
@@ -55,4 +53,8 @@ "devDependencies": { | ||
"@types/jest": "^27.0.3", | ||
"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-router-dom": "^6.1.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
@@ -59,0 +61,0 @@ "serve": "^13.0.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66852
31
1426
15
Updated@floating-ui/core@^0.2.2