@zag-js/focus-visible
Advanced tools
Comparing version 0.70.0 to 0.71.0
@@ -1,32 +0,6 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
'use strict'; | ||
var domQuery = require('@zag-js/dom-query'); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
getInteractionModality: () => getInteractionModality, | ||
isFocusVisible: () => isFocusVisible, | ||
listenerMap: () => listenerMap, | ||
setInteractionModality: () => setInteractionModality, | ||
trackFocusVisible: () => trackFocusVisible, | ||
trackInteractionModality: () => trackInteractionModality | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var import_dom_query = require("@zag-js/dom-query"); | ||
function isVirtualClick(event) { | ||
@@ -37,10 +11,10 @@ if (event.mozInputSource === 0 && event.isTrusted) return true; | ||
function isValidKey(e) { | ||
return !(e.metaKey || !(0, import_dom_query.isMac)() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta"); | ||
return !(e.metaKey || !domQuery.isMac() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta"); | ||
} | ||
var nonTextInputTypes = /* @__PURE__ */ new Set(["checkbox", "radio", "range", "color", "file", "image", "button", "submit", "reset"]); | ||
function isKeyboardFocusEvent(isTextInput, modality, e) { | ||
const IHTMLInputElement = typeof window !== "undefined" ? (0, import_dom_query.getWindow)(e?.target).HTMLInputElement : HTMLInputElement; | ||
const IHTMLTextAreaElement = typeof window !== "undefined" ? (0, import_dom_query.getWindow)(e?.target).HTMLTextAreaElement : HTMLTextAreaElement; | ||
const IHTMLElement = typeof window !== "undefined" ? (0, import_dom_query.getWindow)(e?.target).HTMLElement : HTMLElement; | ||
const IKeyboardEvent = typeof window !== "undefined" ? (0, import_dom_query.getWindow)(e?.target).KeyboardEvent : KeyboardEvent; | ||
const IHTMLInputElement = typeof window !== "undefined" ? domQuery.getWindow(e?.target).HTMLInputElement : HTMLInputElement; | ||
const IHTMLTextAreaElement = typeof window !== "undefined" ? domQuery.getWindow(e?.target).HTMLTextAreaElement : HTMLTextAreaElement; | ||
const IHTMLElement = typeof window !== "undefined" ? domQuery.getWindow(e?.target).HTMLElement : HTMLElement; | ||
const IKeyboardEvent = typeof window !== "undefined" ? domQuery.getWindow(e?.target).KeyboardEvent : KeyboardEvent; | ||
isTextInput = isTextInput || e?.target instanceof IHTMLInputElement && !nonTextInputTypes.has(e?.target?.type) || e?.target instanceof IHTMLTextAreaElement || e?.target instanceof IHTMLElement && e?.target.isContentEditable; | ||
@@ -84,3 +58,3 @@ return !(isTextInput && modality === "keyboard" && e instanceof IKeyboardEvent && !Reflect.has(FOCUS_VISIBLE_INPUT_KEYS, e.key)); | ||
function handleFocusEvent(e) { | ||
if (e.target === (0, import_dom_query.getWindow)(e.target) || e.target === (0, import_dom_query.getDocument)(e.target)) { | ||
if (e.target === domQuery.getWindow(e.target) || e.target === domQuery.getDocument(e.target)) { | ||
return; | ||
@@ -100,7 +74,7 @@ } | ||
function setupGlobalFocusEvents(root) { | ||
if (typeof window === "undefined" || listenerMap.get((0, import_dom_query.getWindow)(root))) { | ||
if (typeof window === "undefined" || listenerMap.get(domQuery.getWindow(root))) { | ||
return; | ||
} | ||
const win = (0, import_dom_query.getWindow)(root); | ||
const doc = (0, import_dom_query.getDocument)(root); | ||
const win = domQuery.getWindow(root); | ||
const doc = domQuery.getDocument(root); | ||
let focus = win.HTMLElement.prototype.focus; | ||
@@ -137,7 +111,4 @@ win.HTMLElement.prototype.focus = function() { | ||
var tearDownWindowFocusTracking = (root, loadListener) => { | ||
const win = (0, import_dom_query.getWindow)(root); | ||
const doc = (0, import_dom_query.getDocument)(root); | ||
if (loadListener) { | ||
doc.removeEventListener("DOMContentLoaded", loadListener); | ||
} | ||
const win = domQuery.getWindow(root); | ||
const doc = domQuery.getDocument(root); | ||
if (!listenerMap.has(win)) { | ||
@@ -196,11 +167,8 @@ return; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
getInteractionModality, | ||
isFocusVisible, | ||
listenerMap, | ||
setInteractionModality, | ||
trackFocusVisible, | ||
trackInteractionModality | ||
}); | ||
//# sourceMappingURL=index.js.map | ||
exports.getInteractionModality = getInteractionModality; | ||
exports.isFocusVisible = isFocusVisible; | ||
exports.listenerMap = listenerMap; | ||
exports.setInteractionModality = setInteractionModality; | ||
exports.trackFocusVisible = trackFocusVisible; | ||
exports.trackInteractionModality = trackInteractionModality; |
{ | ||
"name": "@zag-js/focus-visible", | ||
"version": "0.70.0", | ||
"version": "0.71.0", | ||
"description": "Focus visible polyfill utility based on WICG", | ||
@@ -17,4 +17,3 @@ "keywords": [ | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -30,3 +29,3 @@ "publishConfig": { | ||
"dependencies": { | ||
"@zag-js/dom-query": "0.70.0" | ||
"@zag-js/dom-query": "0.71.0" | ||
}, | ||
@@ -48,3 +47,3 @@ "devDependencies": { | ||
"build": "tsup", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"test": "vitest", | ||
"lint": "eslint src", | ||
@@ -51,0 +50,0 @@ "test-ci": "pnpm test --ci --runInBand -u", |
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
19257
7
364
+ Added@zag-js/dom-query@0.71.0(transitive)
- Removed@zag-js/dom-query@0.70.0(transitive)
Updated@zag-js/dom-query@0.71.0