@zag-js/dom-utils
Advanced tools
Comparing version 0.0.0-dev-20220709173135 to 0.0.0-dev-20220709181637
@@ -6,3 +6,2 @@ export * from "./attrs"; | ||
export * from "./fire-event"; | ||
export * from "./focus-event"; | ||
export * from "./focusable"; | ||
@@ -17,3 +16,2 @@ export * from "./form"; | ||
export * from "./listener"; | ||
export * from "./live-region"; | ||
export * from "./mutation-observer"; | ||
@@ -20,0 +18,0 @@ export * from "./next-tick"; |
@@ -49,3 +49,2 @@ "use strict"; | ||
copyVisualStyles: () => copyVisualStyles, | ||
createLiveRegion: () => createLiveRegion, | ||
dataAttr: () => dataAttr, | ||
@@ -157,3 +156,2 @@ defineDomHelpers: () => defineDomHelpers, | ||
trackVisualViewport: () => trackVisualViewport, | ||
validateBlur: () => validateBlur, | ||
visuallyHiddenStyle: () => visuallyHiddenStyle, | ||
@@ -434,10 +432,2 @@ waitFor: () => waitFor, | ||
// src/focus-event.ts | ||
function validateBlur(event, opts) { | ||
var _a; | ||
const exclude = Array.isArray(opts.exclude) ? opts.exclude : [opts.exclude]; | ||
const relatedTarget = (_a = event.relatedTarget) != null ? _a : opts.fallback; | ||
return exclude.every((el) => !(el == null ? void 0 : el.contains(relatedTarget))); | ||
} | ||
// src/focusable.ts | ||
@@ -769,55 +759,2 @@ function hasNegativeTabIndex(element) { | ||
// src/visually-hidden.ts | ||
var visuallyHiddenStyle = { | ||
border: "0", | ||
clip: "rect(0 0 0 0)", | ||
height: "1px", | ||
margin: "-1px", | ||
overflow: "hidden", | ||
padding: "0", | ||
position: "absolute", | ||
width: "1px", | ||
whiteSpace: "nowrap", | ||
wordWrap: "normal" | ||
}; | ||
function setVisuallyHidden(el) { | ||
Object.assign(el.style, visuallyHiddenStyle); | ||
} | ||
// src/live-region.ts | ||
var LIVE_REGION_ID = "__live-region__"; | ||
function createLiveRegion(opts = {}) { | ||
var _a; | ||
const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts; | ||
const win = (_a = doc.defaultView) != null ? _a : window; | ||
const parent = root != null ? root : doc.body; | ||
function announce(message, delay) { | ||
const oldRegion = doc.getElementById(LIVE_REGION_ID); | ||
oldRegion == null ? void 0 : oldRegion.remove(); | ||
delay = delay != null ? delay : _delay; | ||
const region = doc.createElement("span"); | ||
region.id = LIVE_REGION_ID; | ||
region.dataset.liveAnnouncer = "true"; | ||
const role = level !== "assertive" ? "status" : "alert"; | ||
region.setAttribute("aria-live", level); | ||
region.setAttribute("role", role); | ||
setVisuallyHidden(region); | ||
parent.appendChild(region); | ||
win.setTimeout(() => { | ||
region.textContent = message; | ||
}, delay); | ||
} | ||
function destroy() { | ||
const oldRegion = doc.getElementById(LIVE_REGION_ID); | ||
oldRegion == null ? void 0 : oldRegion.remove(); | ||
} | ||
return { | ||
announce, | ||
destroy, | ||
toJSON() { | ||
return LIVE_REGION_ID; | ||
} | ||
}; | ||
} | ||
// src/next-tick.ts | ||
@@ -1197,2 +1134,19 @@ function nextTick(fn) { | ||
// src/visually-hidden.ts | ||
var visuallyHiddenStyle = { | ||
border: "0", | ||
clip: "rect(0 0 0 0)", | ||
height: "1px", | ||
margin: "-1px", | ||
overflow: "hidden", | ||
padding: "0", | ||
position: "absolute", | ||
width: "1px", | ||
whiteSpace: "nowrap", | ||
wordWrap: "normal" | ||
}; | ||
function setVisuallyHidden(el) { | ||
Object.assign(el.style, visuallyHiddenStyle); | ||
} | ||
// src/wait.ts | ||
@@ -1199,0 +1153,0 @@ function waitFor(predicate) { |
{ | ||
"name": "@zag-js/dom-utils", | ||
"version": "0.0.0-dev-20220709173135", | ||
"version": "0.0.0-dev-20220709181637", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/types": "0.0.0-dev-20220709173135", | ||
"@zag-js/types": "0.0.0-dev-20220709181637", | ||
"@zag-js/utils": "0.1.2" | ||
@@ -31,0 +31,0 @@ }, |
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
90327
36
2608
+ Added@zag-js/types@0.0.0-dev-20220709181637(transitive)
- Removed@zag-js/types@0.0.0-dev-20220709173135(transitive)