@zag-js/anatomy
Advanced tools
Comparing version 0.53.0 to 0.54.0
@@ -1,2 +0,57 @@ | ||
"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);var src_exports={};__export(src_exports,{createAnatomy:()=>createAnatomy});module.exports=__toCommonJS(src_exports);var createAnatomy=(name,parts=[])=>({parts:(...values)=>{if(isEmpty(parts)){return createAnatomy(name,values)}throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...values)=>createAnatomy(name,[...parts,...values]),rename:newName=>createAnatomy(newName,parts),keys:()=>parts,build:()=>[...new Set(parts)].reduce((prev,part)=>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)}}}),{})});var toKebabCase=value=>value.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase();var isEmpty=v=>v.length===0;0&&(module.exports={createAnatomy}); | ||
"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); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
createAnatomy: () => createAnatomy | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/create-anatomy.ts | ||
var createAnatomy = (name, parts = []) => ({ | ||
parts: (...values) => { | ||
if (isEmpty(parts)) { | ||
return createAnatomy(name, values); | ||
} | ||
throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?"); | ||
}, | ||
extendWith: (...values) => createAnatomy(name, [...parts, ...values]), | ||
rename: (newName) => createAnatomy(newName, parts), | ||
keys: () => parts, | ||
build: () => [...new Set(parts)].reduce( | ||
(prev, part) => 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) } | ||
} | ||
}), | ||
{} | ||
) | ||
}); | ||
var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(); | ||
var isEmpty = (v) => v.length === 0; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
createAnatomy | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@zag-js/anatomy", | ||
"version": "0.53.0", | ||
"version": "0.54.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "ui-machines", |
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
14564
145