@zag-js/form-utils
Advanced tools
Comparing version 0.0.0-dev-20230202113057 to 0.0.0-dev-20230222120620
@@ -28,21 +28,3 @@ "use strict"; | ||
module.exports = __toCommonJS(form_exports); | ||
// ../dom/src/mutation-observer.ts | ||
function observeAttributes(node, attributes, fn) { | ||
if (!node) | ||
return; | ||
const attrs = Array.isArray(attributes) ? attributes : [attributes]; | ||
const win = node.ownerDocument.defaultView || window; | ||
const obs = new win.MutationObserver((changes) => { | ||
for (const change of changes) { | ||
if (change.type === "attributes" && change.attributeName && attrs.includes(change.attributeName)) { | ||
fn(change); | ||
} | ||
} | ||
}); | ||
obs.observe(node, { attributes: true, attributeFilter: attrs }); | ||
return () => obs.disconnect(); | ||
} | ||
// src/form.ts | ||
var import_mutation_observer = require("@zag-js/mutation-observer"); | ||
function getClosestForm(el) { | ||
@@ -71,3 +53,3 @@ if (isFormElement(el)) | ||
callback(fieldset.disabled); | ||
return observeAttributes(fieldset, ["disabled"], () => callback(fieldset.disabled)); | ||
return (0, import_mutation_observer.observeAttributes)(fieldset, ["disabled"], () => callback(fieldset.disabled)); | ||
} | ||
@@ -74,0 +56,0 @@ function isNativeDisabled(el) { |
@@ -32,25 +32,4 @@ "use strict"; | ||
// ../dom/src/query.ts | ||
function getWindow(el) { | ||
return el?.ownerDocument.defaultView ?? window; | ||
} | ||
// ../dom/src/mutation-observer.ts | ||
function observeAttributes(node, attributes, fn) { | ||
if (!node) | ||
return; | ||
const attrs = Array.isArray(attributes) ? attributes : [attributes]; | ||
const win = node.ownerDocument.defaultView || window; | ||
const obs = new win.MutationObserver((changes) => { | ||
for (const change of changes) { | ||
if (change.type === "attributes" && change.attributeName && attrs.includes(change.attributeName)) { | ||
fn(change); | ||
} | ||
} | ||
}); | ||
obs.observe(node, { attributes: true, attributeFilter: attrs }); | ||
return () => obs.disconnect(); | ||
} | ||
// src/input-event.ts | ||
var getWindow = (el) => el.ownerDocument.defaultView || window; | ||
function getDescriptor(el, options) { | ||
@@ -89,2 +68,3 @@ const { type, property = "value" } = options; | ||
// src/form.ts | ||
var import_mutation_observer = require("@zag-js/mutation-observer"); | ||
function getClosestForm(el) { | ||
@@ -113,3 +93,3 @@ if (isFormElement(el)) | ||
callback(fieldset.disabled); | ||
return observeAttributes(fieldset, ["disabled"], () => callback(fieldset.disabled)); | ||
return (0, import_mutation_observer.observeAttributes)(fieldset, ["disabled"], () => callback(fieldset.disabled)); | ||
} | ||
@@ -116,0 +96,0 @@ function isNativeDisabled(el) { |
@@ -28,9 +28,3 @@ "use strict"; | ||
module.exports = __toCommonJS(input_event_exports); | ||
// ../dom/src/query.ts | ||
function getWindow(el) { | ||
return el?.ownerDocument.defaultView ?? window; | ||
} | ||
// src/input-event.ts | ||
var getWindow = (el) => el.ownerDocument.defaultView || window; | ||
function getDescriptor(el, options) { | ||
@@ -37,0 +31,0 @@ const { type, property = "value" } = options; |
{ | ||
"name": "@zag-js/form-utils", | ||
"version": "0.0.0-dev-20230202113057", | ||
"version": "0.0.0-dev-20230222120620", | ||
"description": "", | ||
@@ -18,5 +18,7 @@ "keywords": [ | ||
], | ||
"dependencies": { | ||
"@zag-js/mutation-observer": "0.0.0-dev-20230222120620" | ||
}, | ||
"devDependencies": { | ||
"clean-package": "2.2.0", | ||
"@zag-js/dom-utils": "0.0.0-dev-20230202113057" | ||
"clean-package": "2.2.0" | ||
}, | ||
@@ -23,0 +25,0 @@ "publishConfig": { |
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
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
1
15706
1
400
+ Added@zag-js/mutation-observer@0.0.0-dev-20230222120620(transitive)