@zag-js/dom-query
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -29,3 +29,3 @@ "use strict"; | ||
function isHTMLElement(value) { | ||
return typeof value === "object" && (value == null ? void 0 : value.nodeType) === Node.ELEMENT_NODE && typeof (value == null ? void 0 : value.nodeName) === "string"; | ||
return typeof value === "object" && value?.nodeType === Node.ELEMENT_NODE && typeof value?.nodeName === "string"; | ||
} | ||
@@ -32,0 +32,0 @@ |
@@ -36,6 +36,5 @@ "use strict"; | ||
function getDocument(el) { | ||
var _a; | ||
if (isDocument(el)) | ||
return el; | ||
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document; | ||
return el?.ownerDocument ?? document; | ||
} | ||
@@ -46,4 +45,3 @@ function getRootNode(el) { | ||
function getWindow(el) { | ||
var _a; | ||
return (_a = getDocument(el).defaultView) != null ? _a : window; | ||
return getDocument(el).defaultView ?? window; | ||
} | ||
@@ -50,0 +48,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -34,10 +34,8 @@ "use strict"; | ||
function getDocument(el) { | ||
var _a; | ||
if (isDocument(el)) | ||
return el; | ||
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document; | ||
return el?.ownerDocument ?? document; | ||
} | ||
function getWindow(el) { | ||
var _a; | ||
return (_a = getDocument(el).defaultView) != null ? _a : window; | ||
return getDocument(el).defaultView ?? window; | ||
} | ||
@@ -49,4 +47,3 @@ | ||
getRootNode(ctx) { | ||
var _a, _b; | ||
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document; | ||
return ctx.getRootNode?.() ?? document; | ||
}, | ||
@@ -67,3 +64,3 @@ getDoc(ctx) { | ||
return function emit(evt, detail, options) { | ||
const { bubbles = true, cancelable, composed = true } = options != null ? options : {}; | ||
const { bubbles = true, cancelable, composed = true } = options ?? {}; | ||
const eventName = `zag:${String(evt)}`; | ||
@@ -70,0 +67,0 @@ const init = { |
@@ -36,6 +36,6 @@ "use strict"; | ||
function isWindow(value) { | ||
return (value == null ? void 0 : value.toString()) === "[object Window]"; | ||
return value?.toString() === "[object Window]"; | ||
} | ||
function isHTMLElement(value) { | ||
return typeof value === "object" && (value == null ? void 0 : value.nodeType) === Node.ELEMENT_NODE && typeof (value == null ? void 0 : value.nodeName) === "string"; | ||
return typeof value === "object" && value?.nodeType === Node.ELEMENT_NODE && typeof value?.nodeName === "string"; | ||
} | ||
@@ -54,10 +54,8 @@ | ||
function getDocument(el) { | ||
var _a; | ||
if (isDocument(el)) | ||
return el; | ||
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document; | ||
return el?.ownerDocument ?? document; | ||
} | ||
function getWindow(el) { | ||
var _a; | ||
return (_a = getDocument(el).defaultView) != null ? _a : window; | ||
return getDocument(el).defaultView ?? window; | ||
} | ||
@@ -69,4 +67,3 @@ | ||
getRootNode(ctx) { | ||
var _a, _b; | ||
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document; | ||
return ctx.getRootNode?.() ?? document; | ||
}, | ||
@@ -87,3 +84,3 @@ getDoc(ctx) { | ||
return function emit(evt, detail, options) { | ||
const { bubbles = true, cancelable, composed = true } = options != null ? options : {}; | ||
const { bubbles = true, cancelable, composed = true } = options ?? {}; | ||
const eventName = `zag:${String(evt)}`; | ||
@@ -90,0 +87,0 @@ const init = { |
@@ -32,6 +32,6 @@ "use strict"; | ||
function isWindow(value) { | ||
return (value == null ? void 0 : value.toString()) === "[object Window]"; | ||
return value?.toString() === "[object Window]"; | ||
} | ||
function isHTMLElement(value) { | ||
return typeof value === "object" && (value == null ? void 0 : value.nodeType) === Node.ELEMENT_NODE && typeof (value == null ? void 0 : value.nodeName) === "string"; | ||
return typeof value === "object" && value?.nodeType === Node.ELEMENT_NODE && typeof value?.nodeName === "string"; | ||
} | ||
@@ -38,0 +38,0 @@ // Annotate the CommonJS export names for ESM import in node: |
{ | ||
"name": "@zag-js/dom-query", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "The dom helper library for zag.js machines", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
18846
524