@anoki/fse-ui
Version:
FSE UI components library
133 lines (132 loc) • 3.67 kB
JavaScript
function c() {
return typeof window < "u";
}
function s(n) {
return p(n) ? (n.nodeName || "").toLowerCase() : "#document";
}
function i(n) {
var t;
return (n == null || (t = n.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function E(n) {
var t;
return (t = (p(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : t.documentElement;
}
function p(n) {
return c() ? n instanceof Node || n instanceof i(n).Node : !1;
}
function m(n) {
return c() ? n instanceof Element || n instanceof i(n).Element : !1;
}
function w(n) {
return c() ? n instanceof HTMLElement || n instanceof i(n).HTMLElement : !1;
}
function a(n) {
return !c() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof i(n).ShadowRoot;
}
function y(n) {
const {
overflow: t,
overflowX: e,
overflowY: o,
display: r
} = b(n);
return /auto|scroll|overlay|hidden|clip/.test(t + o + e) && !["inline", "contents"].includes(r);
}
function D(n) {
return ["table", "td", "th"].includes(s(n));
}
function N(n) {
return [":popover-open", ":modal"].some((t) => {
try {
return n.matches(t);
} catch {
return !1;
}
});
}
function T(n) {
const t = L(), e = m(n) ? b(n) : n;
return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => e[o] ? e[o] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (e.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (e.contain || "").includes(o));
}
function k(n) {
let t = u(n);
for (; w(t) && !g(t); ) {
if (T(t))
return t;
if (N(t))
return null;
t = u(t);
}
return null;
}
function L() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function g(n) {
return ["html", "body", "#document"].includes(s(n));
}
function b(n) {
return i(n).getComputedStyle(n);
}
function C(n) {
return m(n) ? {
scrollLeft: n.scrollLeft,
scrollTop: n.scrollTop
} : {
scrollLeft: n.scrollX,
scrollTop: n.scrollY
};
}
function u(n) {
if (s(n) === "html")
return n;
const t = (
// Step into the shadow DOM of the parent of a slotted node.
n.assignedSlot || // DOM Element detected.
n.parentNode || // ShadowRoot detected.
a(n) && n.host || // Fallback.
E(n)
);
return a(t) ? t.host : t;
}
function h(n) {
const t = u(n);
return g(t) ? n.ownerDocument ? n.ownerDocument.body : n.body : w(t) && y(t) ? t : h(t);
}
function d(n, t, e) {
var o;
t === void 0 && (t = []), e === void 0 && (e = !0);
const r = h(n), S = r === ((o = n.ownerDocument) == null ? void 0 : o.body), l = i(r);
if (S) {
const f = v(l);
return t.concat(l, l.visualViewport || [], y(r) ? r : [], f && e ? d(f) : []);
}
return t.concat(r, d(r, [], e));
}
function v(n) {
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
}
export {
b as getComputedStyle,
k as getContainingBlock,
E as getDocumentElement,
v as getFrameElement,
h as getNearestOverflowAncestor,
s as getNodeName,
C as getNodeScroll,
d as getOverflowAncestors,
u as getParentNode,
i as getWindow,
T as isContainingBlock,
m as isElement,
w as isHTMLElement,
g as isLastTraversableNode,
p as isNode,
y as isOverflowElement,
a as isShadowRoot,
D as isTableElement,
N as isTopLayer,
L as isWebKit
};
//# sourceMappingURL=index.es509.js.map