@floating-ui/utils
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -23,3 +23,3 @@ declare function getComputedStyle_2(element: Element): CSSStyleDeclaration; | ||
export declare function isContainingBlock(element: Element): boolean; | ||
export declare function isContainingBlock(elementOrCss: Element | CSSStyleDeclaration): boolean; | ||
@@ -26,0 +26,0 @@ export declare function isElement(value: unknown): value is Element; |
@@ -55,5 +55,5 @@ function getNodeName(node) { | ||
} | ||
function isContainingBlock(element) { | ||
function isContainingBlock(elementOrCss) { | ||
const webkit = isWebKit(); | ||
const css = getComputedStyle(element); | ||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; | ||
@@ -66,7 +66,6 @@ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
if (isContainingBlock(currentNode)) { | ||
return currentNode; | ||
} else if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
@@ -73,0 +72,0 @@ currentNode = getParentNode(currentNode); |
@@ -61,5 +61,5 @@ (function (global, factory) { | ||
} | ||
function isContainingBlock(element) { | ||
function isContainingBlock(elementOrCss) { | ||
const webkit = isWebKit(); | ||
const css = getComputedStyle(element); | ||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; | ||
@@ -72,7 +72,6 @@ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
if (isContainingBlock(currentNode)) { | ||
return currentNode; | ||
} else if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
@@ -79,0 +78,0 @@ currentNode = getParentNode(currentNode); |
@@ -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}=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=d(),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 d(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function a(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 a(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)&&!a(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.scrollX,scrollTop:e.scrollY}},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=a,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=d})); | ||
!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=d(),t=i(e)?m(e):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 d(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function a(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 a(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)&&!a(n);){if(f(n))return n;if(s(n))return null;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.scrollX,scrollTop:e.scrollY}},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=a,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=d})); |
@@ -23,3 +23,3 @@ declare function getComputedStyle_2(element: Element): CSSStyleDeclaration; | ||
export declare function isContainingBlock(element: Element): boolean; | ||
export declare function isContainingBlock(elementOrCss: Element | CSSStyleDeclaration): boolean; | ||
@@ -26,0 +26,0 @@ export declare function isElement(value: unknown): value is Element; |
@@ -55,5 +55,5 @@ function getNodeName(node) { | ||
} | ||
function isContainingBlock(element) { | ||
function isContainingBlock(elementOrCss) { | ||
const webkit = isWebKit(); | ||
const css = getComputedStyle(element); | ||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; | ||
@@ -66,7 +66,6 @@ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
if (isContainingBlock(currentNode)) { | ||
return currentNode; | ||
} else if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
@@ -73,0 +72,0 @@ currentNode = getParentNode(currentNode); |
@@ -61,5 +61,5 @@ (function (global, factory) { | ||
} | ||
function isContainingBlock(element) { | ||
function isContainingBlock(elementOrCss) { | ||
const webkit = isWebKit(); | ||
const css = getComputedStyle(element); | ||
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; | ||
@@ -72,7 +72,6 @@ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block | ||
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { | ||
if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
if (isContainingBlock(currentNode)) { | ||
return currentNode; | ||
} else if (isTopLayer(currentNode)) { | ||
return null; | ||
} | ||
@@ -79,0 +78,0 @@ currentNode = getParentNode(currentNode); |
{ | ||
"name": "@floating-ui/utils", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61788
1308