You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@zag-js/dom-query

Package Overview
Dependencies
Maintainers
1
Versions
800
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/dom-query - npm Package Compare versions

Comparing version
1.37.0
to
1.38.0
+1
-0
dist/node.d.mts

@@ -15,2 +15,3 @@ declare const isHTMLElement: (el: any) => el is HTMLElement;

type Target = HTMLElement | EventTarget | null | undefined;
/** Whether `parent` contains `child` in the light tree, or `child` is inside a shadow tree hosted under `parent`. */
declare function contains(parent: Target, child: Target): boolean;

@@ -17,0 +18,0 @@ declare function getDocument(el: Element | Window | Node | Document | null | undefined): Document;

@@ -15,2 +15,3 @@ declare const isHTMLElement: (el: any) => el is HTMLElement;

type Target = HTMLElement | EventTarget | null | undefined;
/** Whether `parent` contains `child` in the light tree, or `child` is inside a shadow tree hosted under `parent`. */
declare function contains(parent: Target, child: Target): boolean;

@@ -17,0 +18,0 @@ declare function getDocument(el: Element | Window | Node | Document | null | undefined): Document;

+3
-3

@@ -84,6 +84,6 @@ "use strict";

if (!parent || !child) return false;
if (!isHTMLElement(parent) || !isHTMLElement(child)) return false;
if (!isHTMLElement(parent) || !isNode(child)) return false;
if (isHTMLElement(child) && parent === child) return true;
if (parent.contains(child)) return true;
const rootNode = child.getRootNode?.();
if (parent === child) return true;
if (parent.contains(child)) return true;
if (rootNode && isShadowRoot(rootNode)) {

@@ -90,0 +90,0 @@ let next = child;

@@ -43,6 +43,6 @@ import "./chunk-QZ7TP4HQ.mjs";

if (!parent || !child) return false;
if (!isHTMLElement(parent) || !isHTMLElement(child)) return false;
if (!isHTMLElement(parent) || !isNode(child)) return false;
if (isHTMLElement(child) && parent === child) return true;
if (parent.contains(child)) return true;
const rootNode = child.getRootNode?.();
if (parent === child) return true;
if (parent.contains(child)) return true;
if (rootNode && isShadowRoot(rootNode)) {

@@ -49,0 +49,0 @@ let next = child;

@@ -45,2 +45,17 @@ "use strict";

var hasNegativeTabIndex = (el) => parseTabIndex(el) < 0;
function isRadioInput(element) {
return (0, import_node.isInputElement)(element) && element.type === "radio";
}
function isTabbableRadio(element) {
if (!isRadioInput(element) || !element.name) return true;
if (element.checked) return true;
const selector = `input[type="radio"][name="${CSS.escape(element.name)}"]`;
const scope = element.form ?? element.ownerDocument;
const group = Array.from(scope.querySelectorAll(selector)).filter(
(radio) => radio.form === element.form && isFocusable(radio)
);
const checked = group.find((radio) => radio.checked);
if (checked) return checked === element;
return group[0] === element;
}
function getShadowRootForNode(element, getShadowRoot) {

@@ -153,3 +168,4 @@ if (!getShadowRoot) return null;

if ((0, import_node.isHTMLElement)(el) && el.tabIndex > 0) return true;
return isFocusable(el) && !hasNegativeTabIndex(el);
if (!isFocusable(el) || hasNegativeTabIndex(el)) return false;
return isTabbableRadio(el);
}

@@ -156,0 +172,0 @@ function getFirstTabbable(container, options = {}) {

import "./chunk-QZ7TP4HQ.mjs";
// src/tabbable.ts
import { getActiveElement, isEditableElement, isElementVisible, isHTMLElement } from "./node.mjs";
import { getActiveElement, isEditableElement, isElementVisible, isHTMLElement, isInputElement } from "./node.mjs";
var isFrame = (el) => isHTMLElement(el) && el.tagName === "IFRAME";

@@ -14,2 +14,17 @@ var NATURALLY_TABBABLE_REGEX = /^(audio|video|details)$/;

var hasNegativeTabIndex = (el) => parseTabIndex(el) < 0;
function isRadioInput(element) {
return isInputElement(element) && element.type === "radio";
}
function isTabbableRadio(element) {
if (!isRadioInput(element) || !element.name) return true;
if (element.checked) return true;
const selector = `input[type="radio"][name="${CSS.escape(element.name)}"]`;
const scope = element.form ?? element.ownerDocument;
const group = Array.from(scope.querySelectorAll(selector)).filter(
(radio) => radio.form === element.form && isFocusable(radio)
);
const checked = group.find((radio) => radio.checked);
if (checked) return checked === element;
return group[0] === element;
}
function getShadowRootForNode(element, getShadowRoot) {

@@ -122,3 +137,4 @@ if (!getShadowRoot) return null;

if (isHTMLElement(el) && el.tabIndex > 0) return true;
return isFocusable(el) && !hasNegativeTabIndex(el);
if (!isFocusable(el) || hasNegativeTabIndex(el)) return false;
return isTabbableRadio(el);
}

@@ -125,0 +141,0 @@ function getFirstTabbable(container, options = {}) {

{
"name": "@zag-js/dom-query",
"version": "1.37.0",
"version": "1.38.0",
"description": "The dom helper library for zag.js machines",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"@zag-js/types": "1.37.0"
"@zag-js/types": "1.38.0"
},

@@ -34,0 +34,0 @@ "module": "dist/index.mjs",