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 1.0.12 to 1.1.0

src/utils/getCssDimensions.d.ts

242

dist/floating-ui.dom.esm.js

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

var _node$ownerDocument;
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getComputedStyle(element) {
function getComputedStyle$1(element) {
return getWindow(element).getComputedStyle(element);

@@ -24,5 +23,3 @@ }

}
const uaData = navigator.userAgentData;
if (uaData && Array.isArray(uaData.brands)) {

@@ -32,3 +29,2 @@ uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');

}
return navigator.userAgent;

@@ -51,3 +47,2 @@ }

}
const OwnElement = getWindow(node).ShadowRoot;

@@ -57,3 +52,2 @@ return node instanceof OwnElement || node instanceof ShadowRoot;

function isOverflowElement(element) {
// Firefox wants us to check `-x` and `-y` variations as well
const {

@@ -64,4 +58,4 @@ overflow,

display
} = getComputedStyle(element);
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
} = getComputedStyle$1(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
}

@@ -74,8 +68,10 @@ function isTableElement(element) {

const isFirefox = /firefox/i.test(getUAString());
const css = getComputedStyle(element);
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
const css = getComputedStyle$1(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' || (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
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 => {

@@ -88,3 +84,4 @@ const contain = css.contain;

// Not Safari
return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
return !/^((?!chrome|android).)*safari/i.test(getUAString());
// Feature detection for this fails in various ways
// • Always-visible scrollbar or not

@@ -95,2 +92,3 @@ // • Width of <html>, etc.

}
function isLastTraversableNode(node) {

@@ -104,2 +102,24 @@ return ['html', 'body', '#document'].includes(getNodeName(node));

function getCssDimensions(element) {
const css = getComputedStyle$1(element);
let width = parseFloat(css.width);
let height = parseFloat(css.height);
const offsetWidth = element.offsetWidth;
const offsetHeight = element.offsetHeight;
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
if (shouldFallback) {
width = offsetWidth;
height = offsetHeight;
}
return {
width,
height,
fallback: shouldFallback
};
}
function unwrapElement(element) {
return !isElement(element) ? element.contextElement : element;
}
const FALLBACK_SCALE = {

@@ -110,35 +130,23 @@ x: 1,

function getScale(element) {
const domElement = !isElement(element) && element.contextElement ? element.contextElement : isElement(element) ? element : null;
if (!domElement) {
const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) {
return FALLBACK_SCALE;
}
const rect = domElement.getBoundingClientRect();
const css = getComputedStyle(domElement); // Would need to take into account borders, padding, and potential scrollbars
// which would require a lot of code. Fallback to the old technique to
// determine scale.
const {
width,
height,
fallback
} = getCssDimensions(domElement);
let x = (fallback ? round(rect.width) : rect.width) / width;
let y = (fallback ? round(rect.height) : rect.height) / height;
if (css.boxSizing !== 'border-box') {
if (!isHTMLElement(domElement)) {
return FALLBACK_SCALE;
}
// 0, NaN, or Infinity should always fallback to 1.
return {
x: domElement.offsetWidth > 0 ? round(rect.width) / domElement.offsetWidth || 1 : 1,
y: domElement.offsetHeight > 0 ? round(rect.height) / domElement.offsetHeight || 1 : 1
};
}
let x = rect.width / parseFloat(css.width);
let y = rect.height / parseFloat(css.height); // 0, NaN, or Infinity should always fallback to 1.
if (!x || !Number.isFinite(x)) {
x = 1;
}
if (!y || !Number.isFinite(y)) {
y = 1;
}
return {

@@ -151,15 +159,12 @@ x,

function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
var _win$visualViewport, _win$visualViewport2;
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element);
let scale = FALLBACK_SCALE;
if (includeScale) {

@@ -174,9 +179,27 @@ if (offsetParent) {

}
const win = isElement(element) ? getWindow(element) : window;
const win = domElement ? getWindow(domElement) : window;
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scale.x;
const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scale.y;
const width = clientRect.width / scale.x;
const height = clientRect.height / scale.y;
let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
let width = clientRect.width / scale.x;
let height = clientRect.height / scale.y;
if (domElement) {
const win = getWindow(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
let currentIFrame = win.frameElement;
while (currentIFrame && offsetParent && offsetWin !== win) {
const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect();
const css = getComputedStyle(currentIFrame);
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
x *= iframeScale.x;
y *= iframeScale.y;
width *= iframeScale.x;
height *= iframeScale.y;
x += iframeRect.x;
y += iframeRect.y;
currentIFrame = getWindow(currentIFrame).frameElement;
}
}
return {

@@ -205,3 +228,2 @@ width,

}
return {

@@ -231,3 +253,2 @@ scrollLeft: element.pageXOffset,

};
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {

@@ -237,3 +258,2 @@ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {

}
if (isHTMLElement(offsetParent)) {

@@ -247,3 +267,2 @@ const offsetRect = getBoundingClientRect(offsetParent, true);

}
return {

@@ -261,7 +280,10 @@ x: rect.left + scroll.scrollLeft - offsets.x,

}
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
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);

@@ -272,12 +294,9 @@ return isShadowRoot(result) ? result.host : result;

function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
return null;
}
return element.offsetParent;
}
function getContainingBlock(element) {
let currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {

@@ -290,20 +309,16 @@ if (isContainingBlock(currentNode)) {

}
return null;
}
return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element) {
const window = getWindow(element);
let offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
return window;
}
return offsetParent || getContainingBlock(element) || window;

@@ -313,14 +328,3 @@ }

function getDimensions(element) {
if (isHTMLElement(element)) {
return {
width: element.offsetWidth,
height: element.offsetHeight
};
}
const rect = getBoundingClientRect(element);
return {
width: rect.width,
height: rect.height
};
return getCssDimensions(element);
}

@@ -336,7 +340,5 @@

const documentElement = getDocumentElement(offsetParent);
if (offsetParent === documentElement) {
return rect;
}
let scroll = {

@@ -354,3 +356,2 @@ scrollLeft: 0,

};
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {

@@ -360,3 +361,2 @@ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {

}
if (isHTMLElement(offsetParent)) {

@@ -367,7 +367,7 @@ const offsetRect = getBoundingClientRect(offsetParent);

offsets.y = offsetRect.y + offsetParent.clientTop;
} // This doesn't appear to need to be negated.
}
// This doesn't appear to need to be negated.
// else if (documentElement) {
// offsets.x = getWindowScrollBarX(documentElement);
// }
}

@@ -391,3 +391,2 @@

let y = 0;
if (visualViewport) {

@@ -397,3 +396,2 @@ width = visualViewport.width;

const layoutViewport = isLayoutViewport();
if (layoutViewport || !layoutViewport && strategy === 'fixed') {

@@ -404,3 +402,2 @@ x = visualViewport.offsetLeft;

}
return {

@@ -414,7 +411,6 @@ width,

// Gets the entire size of the scrollable document area, even extending outside
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
function getDocumentRect(element) {
var _element$ownerDocumen;
const html = getDocumentElement(element);

@@ -427,7 +423,5 @@ const scroll = getNodeScroll(element);

const y = -scroll.scrollTop;
if (getComputedStyle(body || html).direction === 'rtl') {
if (getComputedStyle$1(body || html).direction === 'rtl') {
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
}
return {

@@ -443,3 +437,2 @@ width,

const parentNode = getParentNode(node);
if (isLastTraversableNode(parentNode)) {

@@ -449,7 +442,5 @@ // @ts-ignore assume body is always available

}
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
return parentNode;
}
return getNearestOverflowAncestor(parentNode);

@@ -460,15 +451,11 @@ }

var _node$ownerDocument;
if (list === void 0) {
list = [];
}
const scrollableAncestor = getNearestOverflowAncestor(node);
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
const win = getWindow(scrollableAncestor);
if (isBody) {
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
}
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));

@@ -501,3 +488,2 @@ }

}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {

@@ -507,30 +493,26 @@ if (clippingAncestor === 'viewport') {

}
if (isElement(clippingAncestor)) {
return getInnerBoundingClientRect(clippingAncestor, strategy);
}
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
}
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
} // A "clipping ancestor" is an `overflow` element with the characteristic of
// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(element, cache) {
const cachedResult = cache.get(element);
if (cachedResult) {
return cachedResult;
}
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
let currentContainingBlockComputedStyle = null;
const elementIsFixed = getComputedStyle(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
const computedStyle = getComputedStyle(currentNode);
const computedStyle = getComputedStyle$1(currentNode);
const containingBlock = isContainingBlock(currentNode);
const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
if (shouldDropCurrentNode) {

@@ -543,12 +525,10 @@ // Drop non-containing blocks

}
currentNode = getParentNode(currentNode);
}
cache.set(element, result);
return result;
} // Gets the maximum area that the element is visible in due to any number of
}
// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors
function getClippingRect(_ref) {

@@ -588,3 +568,2 @@ let {

getScale,
async getElementRects(_ref) {

@@ -607,5 +586,4 @@ let {

},
getClientRects: element => Array.from(element.getClientRects()),
isRTL: element => getComputedStyle(element).direction === 'rtl'
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
};

@@ -621,3 +599,2 @@

}
const {

@@ -638,3 +615,2 @@ ancestorScroll: _ancestorScroll = true,

let observer = null;
if (elementResize) {

@@ -646,36 +622,26 @@ let initialUpdate = true;

}
initialUpdate = false;
});
isElement(reference) && !animationFrame && observer.observe(reference);
if (!isElement(reference) && reference.contextElement && !animationFrame) {
observer.observe(reference.contextElement);
}
observer.observe(floating);
}
let frameId;
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
if (animationFrame) {
frameLoop();
}
function frameLoop() {
const nextRefRect = getBoundingClientRect(reference);
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
update();
}
prevRefRect = nextRefRect;
frameId = requestAnimationFrame(frameLoop);
}
update();
return () => {
var _observer;
ancestors.forEach(ancestor => {

@@ -687,3 +653,2 @@ ancestorScroll && ancestor.removeEventListener('scroll', update);

observer = null;
if (animationFrame) {

@@ -700,3 +665,2 @@ cancelAnimationFrame(frameId);

*/
const computePosition = (reference, floating, options) => {

@@ -711,6 +675,8 @@ // This caches the expensive `getClippingElementAncestors` function so that

};
const platformWithCache = { ...mergedOptions.platform,
const platformWithCache = {
...mergedOptions.platform,
_c: cache
};
return computePosition$1(reference, floating, { ...mergedOptions,
return computePosition$1(reference, floating, {
...mergedOptions,
platform: platformWithCache

@@ -717,0 +683,0 @@ });

@@ -9,7 +9,6 @@ (function (global, factory) {

var _node$ownerDocument;
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getComputedStyle(element) {
function getComputedStyle$1(element) {
return getWindow(element).getComputedStyle(element);

@@ -27,5 +26,3 @@ }

}
const uaData = navigator.userAgentData;
if (uaData && Array.isArray(uaData.brands)) {

@@ -35,3 +32,2 @@ uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');

}
return navigator.userAgent;

@@ -54,3 +50,2 @@ }

}
const OwnElement = getWindow(node).ShadowRoot;

@@ -60,3 +55,2 @@ return node instanceof OwnElement || node instanceof ShadowRoot;

function isOverflowElement(element) {
// Firefox wants us to check `-x` and `-y` variations as well
const {

@@ -67,4 +61,4 @@ overflow,

display
} = getComputedStyle(element);
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
} = getComputedStyle$1(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
}

@@ -77,8 +71,10 @@ function isTableElement(element) {

const isFirefox = /firefox/i.test(getUAString());
const css = getComputedStyle(element);
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
const css = getComputedStyle$1(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' || (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
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 => {

@@ -91,3 +87,4 @@ const contain = css.contain;

// Not Safari
return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
return !/^((?!chrome|android).)*safari/i.test(getUAString());
// Feature detection for this fails in various ways
// • Always-visible scrollbar or not

@@ -98,2 +95,3 @@ // • Width of <html>, etc.

}
function isLastTraversableNode(node) {

@@ -107,2 +105,24 @@ return ['html', 'body', '#document'].includes(getNodeName(node));

function getCssDimensions(element) {
const css = getComputedStyle$1(element);
let width = parseFloat(css.width);
let height = parseFloat(css.height);
const offsetWidth = element.offsetWidth;
const offsetHeight = element.offsetHeight;
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
if (shouldFallback) {
width = offsetWidth;
height = offsetHeight;
}
return {
width,
height,
fallback: shouldFallback
};
}
function unwrapElement(element) {
return !isElement(element) ? element.contextElement : element;
}
const FALLBACK_SCALE = {

@@ -113,35 +133,23 @@ x: 1,

function getScale(element) {
const domElement = !isElement(element) && element.contextElement ? element.contextElement : isElement(element) ? element : null;
if (!domElement) {
const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) {
return FALLBACK_SCALE;
}
const rect = domElement.getBoundingClientRect();
const css = getComputedStyle(domElement); // Would need to take into account borders, padding, and potential scrollbars
// which would require a lot of code. Fallback to the old technique to
// determine scale.
const {
width,
height,
fallback
} = getCssDimensions(domElement);
let x = (fallback ? round(rect.width) : rect.width) / width;
let y = (fallback ? round(rect.height) : rect.height) / height;
if (css.boxSizing !== 'border-box') {
if (!isHTMLElement(domElement)) {
return FALLBACK_SCALE;
}
// 0, NaN, or Infinity should always fallback to 1.
return {
x: domElement.offsetWidth > 0 ? round(rect.width) / domElement.offsetWidth || 1 : 1,
y: domElement.offsetHeight > 0 ? round(rect.height) / domElement.offsetHeight || 1 : 1
};
}
let x = rect.width / parseFloat(css.width);
let y = rect.height / parseFloat(css.height); // 0, NaN, or Infinity should always fallback to 1.
if (!x || !Number.isFinite(x)) {
x = 1;
}
if (!y || !Number.isFinite(y)) {
y = 1;
}
return {

@@ -154,15 +162,12 @@ x,

function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
var _win$visualViewport, _win$visualViewport2;
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element);
let scale = FALLBACK_SCALE;
if (includeScale) {

@@ -177,9 +182,27 @@ if (offsetParent) {

}
const win = isElement(element) ? getWindow(element) : window;
const win = domElement ? getWindow(domElement) : window;
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scale.x;
const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scale.y;
const width = clientRect.width / scale.x;
const height = clientRect.height / scale.y;
let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
let width = clientRect.width / scale.x;
let height = clientRect.height / scale.y;
if (domElement) {
const win = getWindow(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
let currentIFrame = win.frameElement;
while (currentIFrame && offsetParent && offsetWin !== win) {
const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect();
const css = getComputedStyle(currentIFrame);
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
x *= iframeScale.x;
y *= iframeScale.y;
width *= iframeScale.x;
height *= iframeScale.y;
x += iframeRect.x;
y += iframeRect.y;
currentIFrame = getWindow(currentIFrame).frameElement;
}
}
return {

@@ -208,3 +231,2 @@ width,

}
return {

@@ -234,3 +256,2 @@ scrollLeft: element.pageXOffset,

};
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {

@@ -240,3 +261,2 @@ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {

}
if (isHTMLElement(offsetParent)) {

@@ -250,3 +270,2 @@ const offsetRect = getBoundingClientRect(offsetParent, true);

}
return {

@@ -264,7 +283,10 @@ x: rect.left + scroll.scrollLeft - offsets.x,

}
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
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);

@@ -275,12 +297,9 @@ return isShadowRoot(result) ? result.host : result;

function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
return null;
}
return element.offsetParent;
}
function getContainingBlock(element) {
let currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {

@@ -293,20 +312,16 @@ if (isContainingBlock(currentNode)) {

}
return null;
}
return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element) {
const window = getWindow(element);
let offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
return window;
}
return offsetParent || getContainingBlock(element) || window;

@@ -316,14 +331,3 @@ }

function getDimensions(element) {
if (isHTMLElement(element)) {
return {
width: element.offsetWidth,
height: element.offsetHeight
};
}
const rect = getBoundingClientRect(element);
return {
width: rect.width,
height: rect.height
};
return getCssDimensions(element);
}

@@ -339,7 +343,5 @@

const documentElement = getDocumentElement(offsetParent);
if (offsetParent === documentElement) {
return rect;
}
let scroll = {

@@ -357,3 +359,2 @@ scrollLeft: 0,

};
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {

@@ -363,3 +364,2 @@ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {

}
if (isHTMLElement(offsetParent)) {

@@ -370,7 +370,7 @@ const offsetRect = getBoundingClientRect(offsetParent);

offsets.y = offsetRect.y + offsetParent.clientTop;
} // This doesn't appear to need to be negated.
}
// This doesn't appear to need to be negated.
// else if (documentElement) {
// offsets.x = getWindowScrollBarX(documentElement);
// }
}

@@ -394,3 +394,2 @@

let y = 0;
if (visualViewport) {

@@ -400,3 +399,2 @@ width = visualViewport.width;

const layoutViewport = isLayoutViewport();
if (layoutViewport || !layoutViewport && strategy === 'fixed') {

@@ -407,3 +405,2 @@ x = visualViewport.offsetLeft;

}
return {

@@ -417,7 +414,6 @@ width,

// Gets the entire size of the scrollable document area, even extending outside
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
function getDocumentRect(element) {
var _element$ownerDocumen;
const html = getDocumentElement(element);

@@ -430,7 +426,5 @@ const scroll = getNodeScroll(element);

const y = -scroll.scrollTop;
if (getComputedStyle(body || html).direction === 'rtl') {
if (getComputedStyle$1(body || html).direction === 'rtl') {
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
}
return {

@@ -446,3 +440,2 @@ width,

const parentNode = getParentNode(node);
if (isLastTraversableNode(parentNode)) {

@@ -452,7 +445,5 @@ // @ts-ignore assume body is always available

}
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
return parentNode;
}
return getNearestOverflowAncestor(parentNode);

@@ -463,15 +454,11 @@ }

var _node$ownerDocument;
if (list === void 0) {
list = [];
}
const scrollableAncestor = getNearestOverflowAncestor(node);
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
const win = getWindow(scrollableAncestor);
if (isBody) {
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
}
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));

@@ -504,3 +491,2 @@ }

}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {

@@ -510,30 +496,26 @@ if (clippingAncestor === 'viewport') {

}
if (isElement(clippingAncestor)) {
return getInnerBoundingClientRect(clippingAncestor, strategy);
}
return core.rectToClientRect(getDocumentRect(getDocumentElement(element)));
}
return core.rectToClientRect(getDocumentRect(getDocumentElement(element)));
} // A "clipping ancestor" is an `overflow` element with the characteristic of
// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(element, cache) {
const cachedResult = cache.get(element);
if (cachedResult) {
return cachedResult;
}
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
let currentContainingBlockComputedStyle = null;
const elementIsFixed = getComputedStyle(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
const computedStyle = getComputedStyle(currentNode);
const computedStyle = getComputedStyle$1(currentNode);
const containingBlock = isContainingBlock(currentNode);
const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
if (shouldDropCurrentNode) {

@@ -546,12 +528,10 @@ // Drop non-containing blocks

}
currentNode = getParentNode(currentNode);
}
cache.set(element, result);
return result;
} // Gets the maximum area that the element is visible in due to any number of
}
// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors
function getClippingRect(_ref) {

@@ -591,3 +571,2 @@ let {

getScale,
async getElementRects(_ref) {

@@ -610,5 +589,4 @@ let {

},
getClientRects: element => Array.from(element.getClientRects()),
isRTL: element => getComputedStyle(element).direction === 'rtl'
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
};

@@ -624,3 +602,2 @@

}
const {

@@ -641,3 +618,2 @@ ancestorScroll: _ancestorScroll = true,

let observer = null;
if (elementResize) {

@@ -649,36 +625,26 @@ let initialUpdate = true;

}
initialUpdate = false;
});
isElement(reference) && !animationFrame && observer.observe(reference);
if (!isElement(reference) && reference.contextElement && !animationFrame) {
observer.observe(reference.contextElement);
}
observer.observe(floating);
}
let frameId;
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
if (animationFrame) {
frameLoop();
}
function frameLoop() {
const nextRefRect = getBoundingClientRect(reference);
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
update();
}
prevRefRect = nextRefRect;
frameId = requestAnimationFrame(frameLoop);
}
update();
return () => {
var _observer;
ancestors.forEach(ancestor => {

@@ -690,3 +656,2 @@ ancestorScroll && ancestor.removeEventListener('scroll', update);

observer = null;
if (animationFrame) {

@@ -703,3 +668,2 @@ cancelAnimationFrame(frameId);

*/
const computePosition = (reference, floating, options) => {

@@ -714,6 +678,8 @@ // This caches the expensive `getClippingElementAncestors` function so that

};
const platformWithCache = { ...mergedOptions.platform,
const platformWithCache = {
...mergedOptions.platform,
_c: cache
};
return core.computePosition(reference, floating, { ...mergedOptions,
return core.computePosition(reference, floating, {
...mergedOptions,
platform: platformWithCache

@@ -720,0 +686,0 @@ });

@@ -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){var e;return(null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function o(t){return n(t).getComputedStyle(t)}function i(t){return s(t)?(t.nodeName||"").toLowerCase():""}let r;function l(){if(r)return r;const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?(r=t.brands.map((t=>t.brand+"/"+t.version)).join(" "),r):navigator.userAgent}function c(t){return t instanceof n(t).HTMLElement}function f(t){return t instanceof n(t).Element}function s(t){return t instanceof n(t).Node}function u(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof n(t).ShadowRoot||t instanceof ShadowRoot}function a(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=o(t);return/auto|scroll|overlay|hidden/.test(e+i+n)&&!["inline","contents"].includes(r)}function d(t){return["table","td","th"].includes(i(t))}function h(t){const e=/firefox/i.test(l()),n=o(t),i=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!i&&"none"!==i||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 g(){return!/^((?!chrome|android).)*safari/i.test(l())}function p(t){return["html","body","#document"].includes(i(t))}const m=Math.min,y=Math.max,b=Math.round,w={x:1,y:1};function x(t){const e=!f(t)&&t.contextElement?t.contextElement:f(t)?t:null;if(!e)return w;const n=e.getBoundingClientRect(),i=o(e);if("border-box"!==i.boxSizing)return c(e)?{x:e.offsetWidth>0&&b(n.width)/e.offsetWidth||1,y:e.offsetHeight>0&&b(n.height)/e.offsetHeight||1}:w;let r=n.width/parseFloat(i.width),l=n.height/parseFloat(i.height);return r&&Number.isFinite(r)||(r=1),l&&Number.isFinite(l)||(l=1),{x:r,y:l}}function v(t,e,o,i){var r,l,c,s;void 0===e&&(e=!1),void 0===o&&(o=!1);const u=t.getBoundingClientRect();let a=w;e&&(i?f(i)&&(a=x(i)):a=x(t));const d=f(t)?n(t):window,h=!g()&&o,p=(u.left+(h&&null!=(r=null==(l=d.visualViewport)?void 0:l.offsetLeft)?r:0))/a.x,m=(u.top+(h&&null!=(c=null==(s=d.visualViewport)?void 0:s.offsetTop)?c:0))/a.y,y=u.width/a.x,b=u.height/a.y;return{width:y,height:b,top:m,right:p+y,bottom:m+b,left:p,x:p,y:m}}function L(t){return((s(t)?t.ownerDocument:t.document)||window.document).documentElement}function O(t){return f(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function P(t){return v(L(t)).left+O(t).scrollLeft}function T(t,e,n){const o=c(e),r=L(e),l=v(t,!0,"fixed"===n,e);let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==i(e)||a(r))&&(f=O(e)),c(e)){const t=v(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else r&&(s.x=P(r));return{x:l.left+f.scrollLeft-s.x,y:l.top+f.scrollTop-s.y,width:l.width,height:l.height}}function R(t){if("html"===i(t))return t;const e=t.assignedSlot||t.parentNode||(u(t)?t.host:null)||L(t);return u(e)?e.host:e}function E(t){return c(t)&&"fixed"!==o(t).position?t.offsetParent:null}function j(t){const e=n(t);let r=E(t);for(;r&&d(r)&&"static"===o(r).position;)r=E(r);return r&&("html"===i(r)||"body"===i(r)&&"static"===o(r).position&&!h(r))?e:r||function(t){let e=R(t);for(;c(e)&&!p(e);){if(h(e))return e;e=R(e)}return null}(t)||e}function C(t){const e=R(t);return p(e)?t.ownerDocument.body:c(e)&&a(e)?e:C(e)}function W(t,e){var o;void 0===e&&(e=[]);const i=C(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=n(i);return r?e.concat(l,l.visualViewport||[],a(i)?i:[]):e.concat(i,W(i))}function F(t,i,r){return"viewport"===i?e.rectToClientRect(function(t,e){const o=n(t),i=L(t),r=o.visualViewport;let l=i.clientWidth,c=i.clientHeight,f=0,s=0;if(r){l=r.width,c=r.height;const t=g();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,s=r.offsetTop)}return{width:l,height:c,x:f,y:s}}(t,r)):f(i)?function(t,e){const n=v(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=c(t)?x(t):{x:1,y:1},l=t.clientWidth*r.x,f=t.clientHeight*r.y,s=i*r.x,u=o*r.y;return{top:u,left:s,right:s+l,bottom:u+f,x:s,y:u,width:l,height:f}}(i,r):e.rectToClientRect(function(t){var e;const n=L(t),i=O(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=y(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=y(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-i.scrollLeft+P(t);const s=-i.scrollTop;return"rtl"===o(r||n).direction&&(f+=y(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:s}}(L(t)))}const D={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:l}=t;const c="clippingAncestors"===n?function(t,e){const n=e.get(t);if(n)return n;let r=W(t).filter((t=>f(t)&&"body"!==i(t))),l=null;const c="fixed"===o(t).position;let s=c?R(t):t;for(;f(s)&&!p(s);){const t=o(s),e=h(s);(c?e||l:e||"static"!==t.position||!l||!["absolute","fixed"].includes(l.position))?l=t:r=r.filter((t=>t!==s)),s=R(s)}return e.set(t,r),r}(e,this._c):[].concat(n),s=[...c,r],u=s[0],a=s.reduce(((t,n)=>{const o=F(e,n,l);return t.top=y(o.top,t.top),t.right=m(o.right,t.right),t.bottom=m(o.bottom,t.bottom),t.left=y(o.left,t.left),t}),F(e,u,l));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const r=c(n),l=L(n);if(n===l)return e;let f={scrollLeft:0,scrollTop:0},s={x:1,y:1};const u={x:0,y:0};if((r||!r&&"fixed"!==o)&&(("body"!==i(n)||a(l))&&(f=O(n)),c(n))){const t=v(n);s=x(n),u.x=t.x+n.clientLeft,u.y=t.y+n.clientTop}return{width:e.width*s.x,height:e.height*s.y,x:e.x*s.x-f.scrollLeft*s.x+u.x,y:e.y*s.y-f.scrollTop*s.y+u.y}},isElement:f,getDimensions:function(t){if(c(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=v(t);return{width:e.width,height:e.height}},getOffsetParent:j,getDocumentElement:L,getScale:x,async getElementRects(t){let{reference:e,floating:n,strategy:o}=t;const i=this.getOffsetParent||j,r=this.getDimensions;return{reference:T(e,await i(n),o),floating:{x:0,y:0,...await r(n)}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===o(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,s=i&&!c,u=s||r?[...f(t)?W(t):t.contextElement?W(t.contextElement):[],...W(e)]:[];u.forEach((t=>{s&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let a,d=null;if(l){let o=!0;d=new ResizeObserver((()=>{o||n(),o=!1})),f(t)&&!c&&d.observe(t),f(t)||!t.contextElement||c||d.observe(t.contextElement),d.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,a=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{s&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=d)||t.disconnect(),d=null,c&&cancelAnimationFrame(a)}},t.computePosition=(t,n,o)=>{const i=new Map,r={platform:D,...o},l={...r.platform,_c:i};return e.computePosition(t,n,{...r,platform:l})},t.getOverflowAncestors=W,t.platform=D,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){var e;return(null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function o(t){return n(t).getComputedStyle(t)}function i(t){return s(t)?(t.nodeName||"").toLowerCase():""}let r;function l(){if(r)return r;const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?(r=t.brands.map((t=>t.brand+"/"+t.version)).join(" "),r):navigator.userAgent}function c(t){return t instanceof n(t).HTMLElement}function f(t){return t instanceof n(t).Element}function s(t){return t instanceof n(t).Node}function u(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof n(t).ShadowRoot||t instanceof ShadowRoot}function a(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=o(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(r)}function d(t){return["table","td","th"].includes(i(t))}function h(t){const e=/firefox/i.test(l()),n=o(t),i=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!i&&"none"!==i||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 p(){return!/^((?!chrome|android).)*safari/i.test(l())}function g(t){return["html","body","#document"].includes(i(t))}const m=Math.min,y=Math.max,b=Math.round;function w(t){const e=o(t);let n=parseFloat(e.width),i=parseFloat(e.height);const r=t.offsetWidth,l=t.offsetHeight,c=b(n)!==r||b(i)!==l;return c&&(n=r,i=l),{width:n,height:i,fallback:c}}function x(t){return f(t)?t:t.contextElement}const v={x:1,y:1};function L(t){const e=x(t);if(!c(e))return v;const n=e.getBoundingClientRect(),{width:o,height:i,fallback:r}=w(e);let l=(r?b(n.width):n.width)/o,f=(r?b(n.height):n.height)/i;return l&&Number.isFinite(l)||(l=1),f&&Number.isFinite(f)||(f=1),{x:l,y:f}}function T(t,e,o,i){var r,l;void 0===e&&(e=!1),void 0===o&&(o=!1);const c=t.getBoundingClientRect(),s=x(t);let u=v;e&&(i?f(i)&&(u=L(i)):u=L(t));const a=s?n(s):window,d=!p()&&o;let h=(c.left+(d&&(null==(r=a.visualViewport)?void 0:r.offsetLeft)||0))/u.x,g=(c.top+(d&&(null==(l=a.visualViewport)?void 0:l.offsetTop)||0))/u.y,m=c.width/u.x,y=c.height/u.y;if(s){const t=n(s),e=i&&f(i)?n(i):i;let o=t.frameElement;for(;o&&i&&e!==t;){const t=L(o),e=o.getBoundingClientRect(),i=getComputedStyle(o);e.x+=(o.clientLeft+parseFloat(i.paddingLeft))*t.x,e.y+=(o.clientTop+parseFloat(i.paddingTop))*t.y,h*=t.x,g*=t.y,m*=t.x,y*=t.y,h+=e.x,g+=e.y,o=n(o).frameElement}}return{width:m,height:y,top:g,right:h+m,bottom:g+y,left:h,x:h,y:g}}function O(t){return((s(t)?t.ownerDocument:t.document)||window.document).documentElement}function P(t){return f(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function R(t){return T(O(t)).left+P(t).scrollLeft}function E(t,e,n){const o=c(e),r=O(e),l=T(t,!0,"fixed"===n,e);let f={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==i(e)||a(r))&&(f=P(e)),c(e)){const t=T(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else r&&(s.x=R(r));return{x:l.left+f.scrollLeft-s.x,y:l.top+f.scrollTop-s.y,width:l.width,height:l.height}}function C(t){if("html"===i(t))return t;const e=t.assignedSlot||t.parentNode||(u(t)?t.host:null)||O(t);return u(e)?e.host:e}function j(t){return c(t)&&"fixed"!==o(t).position?t.offsetParent:null}function F(t){const e=n(t);let r=j(t);for(;r&&d(r)&&"static"===o(r).position;)r=j(r);return r&&("html"===i(r)||"body"===i(r)&&"static"===o(r).position&&!h(r))?e:r||function(t){let e=C(t);for(;c(e)&&!g(e);){if(h(e))return e;e=C(e)}return null}(t)||e}function D(t){const e=C(t);return g(e)?t.ownerDocument.body:c(e)&&a(e)?e:D(e)}function S(t,e){var o;void 0===e&&(e=[]);const i=D(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=n(i);return r?e.concat(l,l.visualViewport||[],a(i)?i:[]):e.concat(i,S(i))}function W(t,i,r){return"viewport"===i?e.rectToClientRect(function(t,e){const o=n(t),i=O(t),r=o.visualViewport;let l=i.clientWidth,c=i.clientHeight,f=0,s=0;if(r){l=r.width,c=r.height;const t=p();(t||!t&&"fixed"===e)&&(f=r.offsetLeft,s=r.offsetTop)}return{width:l,height:c,x:f,y:s}}(t,r)):f(i)?function(t,e){const n=T(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=c(t)?L(t):{x:1,y:1},l=t.clientWidth*r.x,f=t.clientHeight*r.y,s=i*r.x,u=o*r.y;return{top:u,left:s,right:s+l,bottom:u+f,x:s,y:u,width:l,height:f}}(i,r):e.rectToClientRect(function(t){var e;const n=O(t),i=P(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=y(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=y(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let f=-i.scrollLeft+R(t);const s=-i.scrollTop;return"rtl"===o(r||n).direction&&(f+=y(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:f,y:s}}(O(t)))}const A={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:l}=t;const c="clippingAncestors"===n?function(t,e){const n=e.get(t);if(n)return n;let r=S(t).filter((t=>f(t)&&"body"!==i(t))),l=null;const c="fixed"===o(t).position;let s=c?C(t):t;for(;f(s)&&!g(s);){const t=o(s),e=h(s);(c?e||l:e||"static"!==t.position||!l||!["absolute","fixed"].includes(l.position))?l=t:r=r.filter((t=>t!==s)),s=C(s)}return e.set(t,r),r}(e,this._c):[].concat(n),s=[...c,r],u=s[0],a=s.reduce(((t,n)=>{const o=W(e,n,l);return t.top=y(o.top,t.top),t.right=m(o.right,t.right),t.bottom=m(o.bottom,t.bottom),t.left=y(o.left,t.left),t}),W(e,u,l));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const r=c(n),l=O(n);if(n===l)return e;let f={scrollLeft:0,scrollTop:0},s={x:1,y:1};const u={x:0,y:0};if((r||!r&&"fixed"!==o)&&(("body"!==i(n)||a(l))&&(f=P(n)),c(n))){const t=T(n);s=L(n),u.x=t.x+n.clientLeft,u.y=t.y+n.clientTop}return{width:e.width*s.x,height:e.height*s.y,x:e.x*s.x-f.scrollLeft*s.x+u.x,y:e.y*s.y-f.scrollTop*s.y+u.y}},isElement:f,getDimensions:function(t){return w(t)},getOffsetParent:F,getDocumentElement:O,getScale:L,async getElementRects(t){let{reference:e,floating:n,strategy:o}=t;const i=this.getOffsetParent||F,r=this.getDimensions;return{reference:E(e,await i(n),o),floating:{x:0,y:0,...await r(n)}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===o(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,s=i&&!c,u=s||r?[...f(t)?S(t):t.contextElement?S(t.contextElement):[],...S(e)]:[];u.forEach((t=>{s&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let a,d=null;if(l){let o=!0;d=new ResizeObserver((()=>{o||n(),o=!1})),f(t)&&!c&&d.observe(t),f(t)||!t.contextElement||c||d.observe(t.contextElement),d.observe(e)}let h=c?T(t):null;return c&&function e(){const o=T(t);!h||o.x===h.x&&o.y===h.y&&o.width===h.width&&o.height===h.height||n();h=o,a=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{s&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=d)||t.disconnect(),d=null,c&&cancelAnimationFrame(a)}},t.computePosition=(t,n,o)=>{const i=new Map,r={platform:A,...o},l={...r.platform,_c:i};return e.computePosition(t,n,{...r,platform:l})},t.getOverflowAncestors=S,t.platform=A,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@floating-ui/dom",
"version": "1.0.12",
"version": "1.1.0",
"@rollingversions": {
"baseVersion": [
0,
0,
1,
0

@@ -40,3 +40,2 @@ ]

],
"browserslist": "> 0.5%, not dead, not IE 11",
"scripts": {

@@ -65,21 +64,13 @@ "dev": "parcel test/visual/index.html",

"dependencies": {
"@floating-ui/core": "^1.0.4"
"@floating-ui/core": "^1.0.5"
},
"devDependencies": {
"@babel/preset-env": "^7.16.4",
"@babel/preset-typescript": "^7.16.0",
"@playwright/test": "^1.16.3",
"@rollup/plugin-replace": "^3.0.0",
"@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": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.1.1",
"rollup-plugin-terser": "^7.0.2",
"serve": "^13.0.2",
"ts-jest": "^27.0.7"
"serve": "^13.0.2"
}
}

@@ -7,3 +7,3 @@ import type { ComputePositionConfig, ReferenceElement, FloatingElement } from './types';

*/
export declare const computePosition: (reference: ReferenceElement, floating: FloatingElement, options?: Partial<ComputePositionConfig> | undefined) => Promise<import("@floating-ui/core").ComputePositionReturn>;
export declare const computePosition: (reference: ReferenceElement, floating: FloatingElement, options?: Partial<ComputePositionConfig>) => Promise<import("@floating-ui/core").ComputePositionReturn>;
export { arrow, autoPlacement, flip, hide, offset, shift, limitShift, size, inline, detectOverflow, } from '@floating-ui/core';

@@ -10,0 +10,0 @@ export { autoUpdate } from './autoUpdate';

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';
declare type Promisable<T> = T | Promise<T>;
type Promisable<T> = T | Promise<T>;
export interface Platform {

@@ -15,3 +15,3 @@ getElementRects: (args: {

}) => Promisable<Rect>;
getDimensions: (element: Element) => Promisable<Dimensions>;
getDimensions: (element: HTMLElement) => Promisable<Dimensions>;
convertOffsetParentRelativeRectToViewportRelativeRect?: (args: {

@@ -36,7 +36,7 @@ rect: Rect;

}
export declare type Boundary = 'clippingAncestors' | Element | Array<Element>;
export declare type DetectOverflowOptions = Omit<CoreDetectOverflowOptions, 'boundary'> & {
export type Boundary = 'clippingAncestors' | Element | Array<Element>;
export type DetectOverflowOptions = Omit<CoreDetectOverflowOptions, 'boundary'> & {
boundary: Boundary;
};
export declare type SizeOptions = Omit<CoreSizeOptions, 'apply'> & {
export type SizeOptions = Omit<CoreSizeOptions, 'apply'> & {
/**

@@ -52,3 +52,3 @@ * Function that is called to perform style mutations to the floating element

};
export declare type ComputePositionConfig = Omit<CoreComputePositionConfig, 'middleware' | 'platform'> & {
export type ComputePositionConfig = Omit<CoreComputePositionConfig, 'middleware' | 'platform'> & {
middleware?: Array<Middleware | null | undefined | false>;

@@ -65,4 +65,4 @@ platform?: Platform;

}
export declare type ReferenceElement = Element | VirtualElement;
export declare type FloatingElement = HTMLElement;
export type ReferenceElement = Element | VirtualElement;
export type FloatingElement = HTMLElement;
export interface Elements {

@@ -72,6 +72,6 @@ reference: ReferenceElement;

}
export declare type MiddlewareArguments = Omit<CoreMiddlewareArguments, 'elements'> & {
export type MiddlewareArguments = Omit<CoreMiddlewareArguments, 'elements'> & {
elements: Elements;
};
export declare type Middleware = Omit<CoreMiddleware, 'fn'> & {
export type Middleware = Omit<CoreMiddleware, 'fn'> & {
fn(args: MiddlewareArguments): Promisable<MiddlewareReturn>;

@@ -78,0 +78,0 @@ };

import { Boundary, RootBoundary, Rect, Strategy } from '@floating-ui/core';
import { Platform, ReferenceElement } from '../types';
declare type PlatformWithCache = Platform & {
type PlatformWithCache = Platform & {
_c: Map<ReferenceElement, Element[]>;

@@ -5,0 +5,0 @@ };

import type { Dimensions } from '@floating-ui/core';
export declare function getDimensions(element: Element): Dimensions;
export declare function getDimensions(element: HTMLElement): Dimensions;

@@ -1,3 +0,3 @@

declare type OverflowAncestors = Array<Element | Window | VisualViewport>;
type OverflowAncestors = Array<Element | Window | VisualViewport>;
export declare function getOverflowAncestors(node: Node, list?: OverflowAncestors): OverflowAncestors;
export {};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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