@zag-js/anatomy
Advanced tools
| 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">; |
+10
-10
@@ -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(); |
+10
-10
@@ -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(); |
+1
-1
| { | ||
| "name": "@zag-js/anatomy", | ||
| "version": "1.41.1", | ||
| "version": "2.0.0-next.0", | ||
| "keywords": [ | ||
@@ -5,0 +5,0 @@ "ui-machines", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
136
0.74%8666
-0.34%1
Infinity%