🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@zag-js/anatomy

Package Overview
Dependencies
Maintainers
1
Versions
810
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/anatomy - npm Package Compare versions

Comparing version
1.41.1
to
2.0.0-next.0
+2
-1
dist/create-anatomy.d.mts
interface AnatomyPart {
selector: string;
attrs: Record<"data-scope" | "data-part", string>;
attr: string;
attrs: (uid: string | undefined) => Record<string, string>;
}

@@ -5,0 +6,0 @@ type AnatomyInstance<T extends string> = Omit<Anatomy<T>, "parts">;

interface AnatomyPart {
selector: string;
attrs: Record<"data-scope" | "data-part", string>;
attr: string;
attrs: (uid: string | undefined) => Record<string, string>;
}

@@ -5,0 +6,0 @@ type AnatomyInstance<T extends string> = Omit<Anatomy<T>, "parts">;

@@ -37,14 +37,14 @@ "use strict";

keys: () => parts,
build: () => [...new Set(parts)].reduce(
(prev, part) => Object.assign(prev, {
build: () => [...new Set(parts)].reduce((prev, part) => {
const attrName = `data-${toKebabCase(name)}-${toKebabCase(part)}`;
return Object.assign(prev, {
[part]: {
selector: [
`&[data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`,
`& [data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`
].join(", "),
attrs: { "data-scope": toKebabCase(name), "data-part": toKebabCase(part) }
selector: [`&[${attrName}]`, `& [${attrName}]`].join(", "),
attr: attrName,
attrs: (uid = "") => {
return { [attrName]: uid };
}
}
}),
{}
)
});
}, {})
});

@@ -51,0 +51,0 @@ var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();

@@ -13,14 +13,14 @@ // src/create-anatomy.ts

keys: () => parts,
build: () => [...new Set(parts)].reduce(
(prev, part) => Object.assign(prev, {
build: () => [...new Set(parts)].reduce((prev, part) => {
const attrName = `data-${toKebabCase(name)}-${toKebabCase(part)}`;
return Object.assign(prev, {
[part]: {
selector: [
`&[data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`,
`& [data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`
].join(", "),
attrs: { "data-scope": toKebabCase(name), "data-part": toKebabCase(part) }
selector: [`&[${attrName}]`, `& [${attrName}]`].join(", "),
attr: attrName,
attrs: (uid = "") => {
return { [attrName]: uid };
}
}
}),
{}
)
});
}, {})
});

@@ -27,0 +27,0 @@ var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();

{
"name": "@zag-js/anatomy",
"version": "1.41.1",
"version": "2.0.0-next.0",
"keywords": [

@@ -5,0 +5,0 @@ "ui-machines",