@zag-js/dom-query
Advanced tools
Comparing version 0.62.1 to 0.63.0
@@ -79,3 +79,3 @@ type Booleanish = boolean | "true" | "false"; | ||
declare const isHTMLElement: (v: any) => v is HTMLElement; | ||
declare const isHTMLElement: (el: any) => el is HTMLElement; | ||
declare const isDocument: (el: any) => el is Document; | ||
@@ -82,0 +82,0 @@ declare const isWindow: (el: any) => el is Window; |
@@ -110,6 +110,10 @@ "use strict"; | ||
// src/is.ts | ||
var isHTMLElement = (v) => typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string"; | ||
var isDocument = (el) => el.nodeType === Node.DOCUMENT_NODE; | ||
var isWindow = (el) => el != null && el === el.window; | ||
var isVisualViewport = (el) => el != null && el.constructor.name === "VisualViewport"; | ||
var ELEMENT_NODE = 1; | ||
var DOCUMENT_NODE = 9; | ||
var DOCUMENT_FRAGMENT_NODE = 11; | ||
var isObject = (v) => typeof v === "object" && v !== null; | ||
var isHTMLElement = (el) => isObject(el) && el.nodeType === ELEMENT_NODE && typeof el.nodeName === "string"; | ||
var isDocument = (el) => isObject(el) && el.nodeType === DOCUMENT_NODE; | ||
var isWindow = (el) => isObject(el) && el === el.window; | ||
var isVisualViewport = (el) => isObject(el) && el.constructor.name === "VisualViewport"; | ||
var getNodeName = (node) => { | ||
@@ -122,4 +126,4 @@ if (isHTMLElement(node)) return node.localName || ""; | ||
} | ||
var isNode = (el) => el.nodeType !== void 0; | ||
var isShadowRoot = (el) => el && isNode(el) && el.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in el; | ||
var isNode = (el) => isObject(el) && el.nodeType !== void 0; | ||
var isShadowRoot = (el) => isNode(el) && el.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in el; | ||
@@ -126,0 +130,0 @@ // src/contains.ts |
{ | ||
"name": "@zag-js/dom-query", | ||
"version": "0.62.1", | ||
"version": "0.63.0", | ||
"description": "The dom helper library for zag.js machines", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,10 +0,16 @@ | ||
export const isHTMLElement = (v: any): v is HTMLElement => | ||
typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string" | ||
const ELEMENT_NODE: typeof Node.ELEMENT_NODE = 1 | ||
const DOCUMENT_NODE: typeof Node.DOCUMENT_NODE = 9 | ||
const DOCUMENT_FRAGMENT_NODE: typeof Node.DOCUMENT_FRAGMENT_NODE = 11 | ||
export const isDocument = (el: any): el is Document => el.nodeType === Node.DOCUMENT_NODE | ||
const isObject = (v: unknown): v is Record<string, unknown> => typeof v === "object" && v !== null | ||
export const isWindow = (el: any): el is Window => el != null && el === el.window | ||
export const isHTMLElement = (el: any): el is HTMLElement => | ||
isObject(el) && el.nodeType === ELEMENT_NODE && typeof el.nodeName === "string" | ||
export const isDocument = (el: any): el is Document => isObject(el) && el.nodeType === DOCUMENT_NODE | ||
export const isWindow = (el: any): el is Window => isObject(el) && el === el.window | ||
export const isVisualViewport = (el: any): el is VisualViewport => | ||
el != null && el.constructor.name === "VisualViewport" | ||
isObject(el) && el.constructor.name === "VisualViewport" | ||
@@ -20,5 +26,5 @@ export const getNodeName = (node: Node | Window): string => { | ||
export const isNode = (el: any): el is Node => el.nodeType !== undefined | ||
export const isNode = (el: any): el is Node => isObject(el) && el.nodeType !== undefined | ||
export const isShadowRoot = (el: any): el is ShadowRoot => | ||
el && isNode(el) && el.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in el | ||
isNode(el) && el.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in el |
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
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
212902
2636