@zag-js/element-size
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -30,2 +30,3 @@ "use strict"; | ||
function trackElementSize(element, callback) { | ||
var _a; | ||
if (!element) { | ||
@@ -36,3 +37,3 @@ callback(void 0); | ||
callback({ width: element.offsetWidth, height: element.offsetHeight }); | ||
const win = element.ownerDocument.defaultView ?? window; | ||
const win = (_a = element.ownerDocument.defaultView) != null ? _a : window; | ||
const observer = new win.ResizeObserver((entries) => { | ||
@@ -86,6 +87,6 @@ if (!Array.isArray(entries) || !entries.length) | ||
function trackMutation(el, cb) { | ||
var _a; | ||
var _a, _b; | ||
if (!el || !el.parentElement) | ||
return; | ||
const win = ((_a = el.ownerDocument) == null ? void 0 : _a.defaultView) ?? window; | ||
const win = (_b = (_a = el.ownerDocument) == null ? void 0 : _a.defaultView) != null ? _b : window; | ||
const observer = new win.MutationObserver(() => { | ||
@@ -92,0 +93,0 @@ cb(); |
{ | ||
"name": "@zag-js/element-size", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "Observer the size of an element over time", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
8406
183