Socket
Socket
Sign inDemoInstall

@zag-js/mutation-observer

Package Overview
Dependencies
Maintainers
1
Versions
468
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/mutation-observer - npm Package Compare versions

Comparing version 0.0.0-dev-20230601120732 to 0.0.0-dev-20230605130234

4

dist/index.d.ts

@@ -1,2 +0,2 @@

export { ObserveAttributesCallback, observeAttributes } from './observe-attributes.js';
export { observeChildren } from './observe-children.js';
export * from "./observe-attributes";
export * from "./observe-children";

@@ -1,57 +0,11 @@

"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';
// src/index.ts
var src_exports = {};
__export(src_exports, {
observeAttributes: () => observeAttributes,
observeChildren: () => observeChildren
});
module.exports = __toCommonJS(src_exports);
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
// src/observe-attributes.ts
function observeAttributes(node, attributes, fn) {
if (!node)
return;
const win = node.ownerDocument.defaultView || window;
const obs = new win.MutationObserver((changes) => {
for (const change of changes) {
if (change.type === "attributes" && change.attributeName && attributes.includes(change.attributeName)) {
fn(change);
}
}
});
obs.observe(node, { attributes: true, attributeFilter: attributes });
return () => obs.disconnect();
}
const observeAttributes = require('./observe-attributes.js');
const observeChildren = require('./observe-children.js');
// src/observe-children.ts
function observeChildren(node, fn) {
if (!node)
return;
const win = node.ownerDocument.defaultView || window;
const obs = new win.MutationObserver(fn);
obs.observe(node, { childList: true, subtree: true });
return () => obs.disconnect();
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
observeAttributes,
observeChildren
});
exports.observeAttributes = observeAttributes.observeAttributes;
exports.observeChildren = observeChildren.observeChildren;

@@ -1,4 +0,2 @@

type ObserveAttributesCallback = (record: MutationRecord) => void;
declare function observeAttributes(node: HTMLElement | null, attributes: string[], fn: ObserveAttributesCallback): (() => void) | undefined;
export { ObserveAttributesCallback, observeAttributes };
export type ObserveAttributesCallback = (record: MutationRecord) => void;
export declare function observeAttributes(node: HTMLElement | null, attributes: string[], fn: ObserveAttributesCallback): (() => void) | undefined;

@@ -1,26 +0,5 @@

"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';
// src/observe-attributes.ts
var observe_attributes_exports = {};
__export(observe_attributes_exports, {
observeAttributes: () => observeAttributes
});
module.exports = __toCommonJS(observe_attributes_exports);
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
function observeAttributes(node, attributes, fn) {

@@ -40,5 +19,3 @@ if (!node)

}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
observeAttributes
});
exports.observeAttributes = observeAttributes;

@@ -1,3 +0,1 @@

declare function observeChildren(node: HTMLElement | null, fn: (v: MutationRecord[]) => void): (() => void) | undefined;
export { observeChildren };
export declare function observeChildren(node: HTMLElement | null, fn: (v: MutationRecord[]) => void): (() => void) | undefined;

@@ -1,26 +0,5 @@

"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';
// src/observe-children.ts
var observe_children_exports = {};
__export(observe_children_exports, {
observeChildren: () => observeChildren
});
module.exports = __toCommonJS(observe_children_exports);
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
function observeChildren(node, fn) {

@@ -34,5 +13,3 @@ if (!node)

}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
observeChildren
});
exports.observeChildren = observeChildren;
{
"name": "@zag-js/mutation-observer",
"version": "0.0.0-dev-20230601120732",
"version": "0.0.0-dev-20230605130234",
"description": "",

@@ -41,11 +41,6 @@ "keywords": [

"scripts": {
"build-fast": "tsup src",
"start": "pnpm build --watch",
"build": "tsup src --dts",
"test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
"build": "vite build -c ../../../vite.config.ts",
"lint": "eslint src --ext .ts,.tsx",
"test-ci": "pnpm test --ci --runInBand",
"test-watch": "pnpm test --watch -u",
"typecheck": "tsc --noEmit"
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc