@floating-ui/dom
Advanced tools
Comparing version 0.1.8 to 0.1.9
import { rectToClientRect, computePosition as computePosition$1 } from '@floating-ui/core'; | ||
export { arrow, autoPlacement, detectOverflow, flip, hide, limitShift, offset, shift, size } from '@floating-ui/core'; | ||
export { arrow, autoPlacement, detectOverflow, flip, hide, inline, limitShift, offset, shift, size } from '@floating-ui/core'; | ||
@@ -63,2 +63,6 @@ function isWindow(value) { | ||
const min = Math.min; | ||
const max = Math.max; | ||
const round = Math.round; | ||
function getBoundingClientRect(element, includeScale) { | ||
@@ -74,4 +78,4 @@ if (includeScale === void 0) { | ||
if (includeScale && isHTMLElement(element)) { | ||
scaleX = element.offsetWidth > 0 ? Math.round(clientRect.width) / element.offsetWidth || 1 : 1; | ||
scaleY = element.offsetHeight > 0 ? Math.round(clientRect.height) / element.offsetHeight || 1 : 1; | ||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; | ||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; | ||
} | ||
@@ -117,3 +121,3 @@ | ||
const rect = getBoundingClientRect(element); | ||
return Math.round(rect.width) !== element.offsetWidth || Math.round(rect.height) !== element.offsetHeight; | ||
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight; | ||
} | ||
@@ -291,5 +295,2 @@ | ||
const min = Math.min; | ||
const max = Math.max; | ||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable | ||
@@ -477,2 +478,8 @@ | ||
return getDimensions(element); | ||
}, | ||
getClientRects: _ref5 => { | ||
let { | ||
element | ||
} = _ref5; | ||
return element.getClientRects(); | ||
} | ||
@@ -479,0 +486,0 @@ }; |
@@ -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}}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}; | ||
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"[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 h(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}const d=Math.min,a=Math.max,g=Math.round;function p(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&l(t)&&(o=t.offsetWidth>0&&g(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&g(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 m(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function w(t){return n(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function y(t){return p(m(t)).left+w(t).scrollLeft}function x(t,e,n){const o=l(e),i=m(e),c=p(t,o&&function(t){const e=p(t);return g(e.width)!==t.offsetWidth||g(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=w(e)),l(e)){const t=p(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=y(i));return{x:c.left+f.scrollLeft-s.x,y:c.top+f.scrollTop-s.y,width:c.width,height:c.height}}function v(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||m(t)}function b(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function L(t){const e=o(t);let n=b(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=b(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!h(n))?e:n||function(t){let e=v(t);for(;l(e)&&!["html","body"].includes(r(e));){if(h(e))return e;e=e.parentNode}return null}(t)||e}function W(t){return{width:t.offsetWidth,height:t.offsetHeight}}function T(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:T(v(t))}function C(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(C(v(c)))}function R(e,n){return"viewport"===n?t(function(t){const e=o(t),n=m(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}}(e)):c(n)?function(t){const e=p(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):t(function(t){var e;const n=m(t),o=w(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=a(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=a(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-o.scrollLeft+y(t);const u=-o.scrollTop;return"rtl"===i(r||n).direction&&(f+=a(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(m(e)))}function H(t){const e=C(v(t)),n=["absolute","fixed"].includes(i(t).position),o=n&&l(t)?L(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 S={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:x(e,L(n),o),floating:{...W(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=l(n),c=m(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=p(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 L(e)},isElement:t=>c(t),getDocumentElement:t=>{let{element:e}=t;return m(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?H(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=R(e,n);return t.top=a(o.top,t.top),t.right=d(o.right,t.right),t.bottom=d(o.bottom,t.bottom),t.left=a(o.left,t.left),t}),R(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 W(e)},getClientRects:t=>{let{element:e}=t;return e.getClientRects()}},D=(t,n,o)=>e(t,n,{platform:S,...o});export{D as computePosition,C as getScrollParents}; |
@@ -66,2 +66,6 @@ (function (global, factory) { | ||
const min = Math.min; | ||
const max = Math.max; | ||
const round = Math.round; | ||
function getBoundingClientRect(element, includeScale) { | ||
@@ -77,4 +81,4 @@ if (includeScale === void 0) { | ||
if (includeScale && isHTMLElement(element)) { | ||
scaleX = element.offsetWidth > 0 ? Math.round(clientRect.width) / element.offsetWidth || 1 : 1; | ||
scaleY = element.offsetHeight > 0 ? Math.round(clientRect.height) / element.offsetHeight || 1 : 1; | ||
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; | ||
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; | ||
} | ||
@@ -120,3 +124,3 @@ | ||
const rect = getBoundingClientRect(element); | ||
return Math.round(rect.width) !== element.offsetWidth || Math.round(rect.height) !== element.offsetHeight; | ||
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight; | ||
} | ||
@@ -294,5 +298,2 @@ | ||
const min = Math.min; | ||
const max = Math.max; | ||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable | ||
@@ -480,2 +481,8 @@ | ||
return getDimensions(element); | ||
}, | ||
getClientRects: _ref5 => { | ||
let { | ||
element | ||
} = _ref5; | ||
return element.getClientRects(); | ||
} | ||
@@ -509,2 +516,6 @@ }; | ||
}); | ||
Object.defineProperty(exports, 'inline', { | ||
enumerable: true, | ||
get: function () { return core.inline; } | ||
}); | ||
Object.defineProperty(exports, 'limitShift', { | ||
@@ -511,0 +522,0 @@ enumerable: true, |
@@ -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}}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})})); | ||
!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}const h=Math.min,a=Math.max,g=Math.round;function p(t,e){void 0===e&&(e=!1);const n=t.getBoundingClientRect();let o=1,i=1;return e&&l(t)&&(o=t.offsetWidth>0&&g(n.width)/t.offsetWidth||1,i=t.offsetHeight>0&&g(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 m(t){return(e=t,(e instanceof o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function y(t){return n(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function b(t){return p(m(t)).left+y(t).scrollLeft}function w(t,e,n){const o=l(e),i=m(e),c=p(t,o&&function(t){const e=p(t);return g(e.width)!==t.offsetWidth||g(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=y(e)),l(e)){const t=p(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)||m(t)}function v(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function P(t){const e=o(t);let n=v(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=v(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position&&!d(n))?e:n||function(t){let e=x(t);for(;l(e)&&!["html","body"].includes(r(e));){if(d(e))return e;e=e.parentNode}return null}(t)||e}function O(t){return{width:t.offsetWidth,height:t.offsetHeight}}function T(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:T(x(t))}function C(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(C(x(c)))}function L(t,n){return"viewport"===n?e.rectToClientRect(function(t){const e=o(t),n=m(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=p(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=m(t),o=y(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=a(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=a(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+=a(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(m(t)))}function R(t){const e=C(x(t)),n=["absolute","fixed"].includes(i(t).position),o=n&&l(t)?P(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 W={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:w(e,P(n),o),floating:{...O(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:t=>function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=l(n),c=m(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=y(n)),l(n))){const t=p(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 P(e)},isElement:t=>c(t),getDocumentElement:t=>{let{element:e}=t;return m(e)},getClippingClientRect:t=>function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?R(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=L(e,n);return t.top=a(o.top,t.top),t.right=h(o.right,t.right),t.bottom=h(o.bottom,t.bottom),t.left=a(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 O(e)},getClientRects:t=>{let{element:e}=t;return e.getClientRects()}};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.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:W,...o}),t.getScrollParents=C,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/dom", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"@rollingversions": { | ||
"baseVersion": [ | ||
0, | ||
0, | ||
0 | ||
] | ||
}, | ||
"description": "Floating UI for the web", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "dist/floating-ui.dom.cjs", | ||
@@ -10,4 +20,7 @@ "module": "dist/floating-ui.dom.esm.js", | ||
"exports": { | ||
"import": "./dist/floating-ui.dom.esm.js", | ||
"require": "./dist/floating-ui.dom.cjs" | ||
".": { | ||
"import": "./dist/floating-ui.dom.esm.js", | ||
"require": "./dist/floating-ui.dom.cjs" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
@@ -44,3 +57,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@floating-ui/core": "^0.2.2" | ||
"@floating-ui/core": "^0.3.0" | ||
}, | ||
@@ -47,0 +60,0 @@ "devDependencies": { |
@@ -6,3 +6,3 @@ import { ClientRectObject, ComputePositionConfig } from '@floating-ui/core'; | ||
}, floating: HTMLElement, options?: Partial<ComputePositionConfig>) => Promise<import("@floating-ui/core").ComputePositionReturn>; | ||
export { arrow, autoPlacement, flip, hide, offset, shift, limitShift, size, detectOverflow, } from '@floating-ui/core'; | ||
export { arrow, autoPlacement, flip, hide, offset, shift, limitShift, size, inline, detectOverflow, } from '@floating-ui/core'; | ||
export { getScrollParents } from './utils/getScrollParents'; |
@@ -24,4 +24,5 @@ import type { Middleware, MiddlewareArguments, SideObject } from '@floating-ui/core'; | ||
export { autoPlacement, shift, arrow, size, flip, detectOverflow }; | ||
export { hide, offset, limitShift } from '@floating-ui/core'; | ||
export { hide, offset, limitShift, inline } from '@floating-ui/core'; | ||
export type { Platform, Placement, Strategy, Middleware, } from '@floating-ui/core'; | ||
export { computePosition } from './'; | ||
export { getScrollParents } from './utils/getScrollParents'; |
export declare const min: (...values: number[]) => number; | ||
export declare const max: (...values: number[]) => number; | ||
export declare const round: (x: number) => number; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
67963
1457
1
+ Added@floating-ui/core@0.3.1(transitive)
- Removed@floating-ui/core@0.2.2(transitive)
Updated@floating-ui/core@^0.3.0