Socket
Socket
Sign inDemoInstall

@floating-ui/utils

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/utils - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

17

dist/floating-ui.utils.d.ts

@@ -11,3 +11,3 @@ export declare type AlignedPlacement = `${Side}-${Alignment}`;

export declare type ClientRectObject = Rect & SideObject;
export declare type ClientRectObject = Prettify<Rect & SideObject>;

@@ -68,10 +68,14 @@ export declare type Coords = {

export declare type Padding = number | Partial<SideObject>;
export declare type Padding = number | Prettify<Partial<SideObject>>;
export declare type Placement = Side | AlignedPlacement;
export declare type Placement = Prettify<Side | AlignedPlacement>;
export declare const placements: Placement[];
export declare type Rect = Coords & Dimensions;
declare type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
export declare type Rect = Prettify<Coords & Dimensions>;
export declare function rectToClientRect(rect: Rect): ClientRectObject;

@@ -95,7 +99,8 @@

*/
export declare type VirtualElement = {
export declare interface VirtualElement {
getBoundingClientRect(): ClientRectObject;
getClientRects?(): Array<ClientRectObject>;
contextElement?: any;
};
}
export { }

@@ -39,2 +39,4 @@ declare function getComputedStyle_2(element: Element): CSSStyleDeclaration;

export declare function isTopLayer(element: Element): boolean;
export declare function isWebKit(): boolean;

@@ -41,0 +43,0 @@

@@ -46,2 +46,11 @@ function getNodeName(node) {

}
function isTopLayer(element) {
return [':popover-open', ':modal'].some(selector => {
try {
return element.matches(selector);
} catch (e) {
return false;
}
});
}
function isContainingBlock(element) {

@@ -57,2 +66,5 @@ const webkit = isWebKit();

while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isTopLayer(currentNode)) {
return null;
}
if (isContainingBlock(currentNode)) {

@@ -129,2 +141,2 @@ return currentNode;

export { getComputedStyle, getContainingBlock, getDocumentElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isWebKit };
export { getComputedStyle, getContainingBlock, getDocumentElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };

@@ -52,2 +52,11 @@ (function (global, factory) {

}
function isTopLayer(element) {
return [':popover-open', ':modal'].some(selector => {
try {
return element.matches(selector);
} catch (e) {
return false;
}
});
}
function isContainingBlock(element) {

@@ -63,2 +72,5 @@ const webkit = isWebKit();

while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isTopLayer(currentNode)) {
return null;
}
if (isContainingBlock(currentNode)) {

@@ -152,4 +164,5 @@ return currentNode;

exports.isTableElement = isTableElement;
exports.isTopLayer = isTopLayer;
exports.isWebKit = isWebKit;
}));

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIUtilsDOM={})}(this,(function(e){"use strict";function n(e){return r(e)?(e.nodeName||"").toLowerCase():"#document"}function t(e){var n;return(null==e||null==(n=e.ownerDocument)?void 0:n.defaultView)||window}function o(e){var n;return null==(n=(r(e)?e.ownerDocument:e.document)||window.document)?void 0:n.documentElement}function r(e){return e instanceof Node||e instanceof t(e).Node}function i(e){return e instanceof Element||e instanceof t(e).Element}function l(e){return e instanceof HTMLElement||e instanceof t(e).HTMLElement}function c(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof t(e).ShadowRoot)}function u(e){const{overflow:n,overflowX:t,overflowY:o,display:r}=a(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+t)&&!["inline","contents"].includes(r)}function s(e){const n=f(),t=a(e);return"none"!==t.transform||"none"!==t.perspective||!!t.containerType&&"normal"!==t.containerType||!n&&!!t.backdropFilter&&"none"!==t.backdropFilter||!n&&!!t.filter&&"none"!==t.filter||["transform","perspective","filter"].some((e=>(t.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(t.contain||"").includes(e)))}function f(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function d(e){return["html","body","#document"].includes(n(e))}function a(e){return t(e).getComputedStyle(e)}function m(e){if("html"===n(e))return e;const t=e.assignedSlot||e.parentNode||c(e)&&e.host||o(e);return c(t)?t.host:t}function p(e){const n=m(e);return d(n)?e.ownerDocument?e.ownerDocument.body:e.body:l(n)&&u(n)?n:p(n)}e.getComputedStyle=a,e.getContainingBlock=function(e){let n=m(e);for(;l(n)&&!d(n);){if(s(n))return n;n=m(n)}return null},e.getDocumentElement=o,e.getNearestOverflowAncestor=p,e.getNodeName=n,e.getNodeScroll=function(e){return i(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}},e.getOverflowAncestors=function e(n,o,r){var i;void 0===o&&(o=[]),void 0===r&&(r=!0);const l=p(n),c=l===(null==(i=n.ownerDocument)?void 0:i.body),s=t(l);return c?o.concat(s,s.visualViewport||[],u(l)?l:[],s.frameElement&&r?e(s.frameElement):[]):o.concat(l,e(l,[],r))},e.getParentNode=m,e.getWindow=t,e.isContainingBlock=s,e.isElement=i,e.isHTMLElement=l,e.isLastTraversableNode=d,e.isNode=r,e.isOverflowElement=u,e.isShadowRoot=c,e.isTableElement=function(e){return["table","td","th"].includes(n(e))},e.isWebKit=f}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIUtilsDOM={})}(this,(function(e){"use strict";function n(e){return r(e)?(e.nodeName||"").toLowerCase():"#document"}function t(e){var n;return(null==e||null==(n=e.ownerDocument)?void 0:n.defaultView)||window}function o(e){var n;return null==(n=(r(e)?e.ownerDocument:e.document)||window.document)?void 0:n.documentElement}function r(e){return e instanceof Node||e instanceof t(e).Node}function i(e){return e instanceof Element||e instanceof t(e).Element}function l(e){return e instanceof HTMLElement||e instanceof t(e).HTMLElement}function c(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof t(e).ShadowRoot)}function u(e){const{overflow:n,overflowX:t,overflowY:o,display:r}=m(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+t)&&!["inline","contents"].includes(r)}function s(e){return[":popover-open",":modal"].some((n=>{try{return e.matches(n)}catch(e){return!1}}))}function f(e){const n=a(),t=m(e);return"none"!==t.transform||"none"!==t.perspective||!!t.containerType&&"normal"!==t.containerType||!n&&!!t.backdropFilter&&"none"!==t.backdropFilter||!n&&!!t.filter&&"none"!==t.filter||["transform","perspective","filter"].some((e=>(t.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(t.contain||"").includes(e)))}function a(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function d(e){return["html","body","#document"].includes(n(e))}function m(e){return t(e).getComputedStyle(e)}function p(e){if("html"===n(e))return e;const t=e.assignedSlot||e.parentNode||c(e)&&e.host||o(e);return c(t)?t.host:t}function w(e){const n=p(e);return d(n)?e.ownerDocument?e.ownerDocument.body:e.body:l(n)&&u(n)?n:w(n)}e.getComputedStyle=m,e.getContainingBlock=function(e){let n=p(e);for(;l(n)&&!d(n);){if(s(n))return null;if(f(n))return n;n=p(n)}return null},e.getDocumentElement=o,e.getNearestOverflowAncestor=w,e.getNodeName=n,e.getNodeScroll=function(e){return i(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}},e.getOverflowAncestors=function e(n,o,r){var i;void 0===o&&(o=[]),void 0===r&&(r=!0);const l=w(n),c=l===(null==(i=n.ownerDocument)?void 0:i.body),s=t(l);return c?o.concat(s,s.visualViewport||[],u(l)?l:[],s.frameElement&&r?e(s.frameElement):[]):o.concat(l,e(l,[],r))},e.getParentNode=p,e.getWindow=t,e.isContainingBlock=f,e.isElement=i,e.isHTMLElement=l,e.isLastTraversableNode=d,e.isNode=r,e.isOverflowElement=u,e.isShadowRoot=c,e.isTableElement=function(e){return["table","td","th"].includes(n(e))},e.isTopLayer=s,e.isWebKit=a}));

@@ -39,2 +39,4 @@ declare function getComputedStyle_2(element: Element): CSSStyleDeclaration;

export declare function isTopLayer(element: Element): boolean;
export declare function isWebKit(): boolean;

@@ -41,0 +43,0 @@

@@ -46,2 +46,11 @@ function getNodeName(node) {

}
function isTopLayer(element) {
return [':popover-open', ':modal'].some(selector => {
try {
return element.matches(selector);
} catch (e) {
return false;
}
});
}
function isContainingBlock(element) {

@@ -57,2 +66,5 @@ const webkit = isWebKit();

while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isTopLayer(currentNode)) {
return null;
}
if (isContainingBlock(currentNode)) {

@@ -129,2 +141,2 @@ return currentNode;

export { getComputedStyle, getContainingBlock, getDocumentElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isWebKit };
export { getComputedStyle, getContainingBlock, getDocumentElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };

@@ -52,2 +52,11 @@ (function (global, factory) {

}
function isTopLayer(element) {
return [':popover-open', ':modal'].some(selector => {
try {
return element.matches(selector);
} catch (e) {
return false;
}
});
}
function isContainingBlock(element) {

@@ -63,2 +72,5 @@ const webkit = isWebKit();

while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isTopLayer(currentNode)) {
return null;
}
if (isContainingBlock(currentNode)) {

@@ -152,4 +164,5 @@ return currentNode;

exports.isTableElement = isTableElement;
exports.isTopLayer = isTopLayer;
exports.isWebKit = isWebKit;
}));
{
"name": "@floating-ui/utils",
"version": "0.2.2",
"version": "0.2.3",
"description": "Utilities for Floating UI",

@@ -5,0 +5,0 @@ "publishConfig": {

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