tailwind-variants
Advanced tools
Comparing version 0.0.6 to 0.0.7
import { cx } from 'class-variance-authority'; | ||
import { extendTailwindMerge, twMerge } from 'tailwind-merge'; | ||
var d=e=>{var c;return (c=e==null?void 0:e.filter)==null?void 0:c.call(e,n=>n&&String(n).match(/^[\w\s]*$/))},w=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,D=e=>e&&Object.keys(e).length>0,b=(...e)=>(c={})=>c.twMerge?(D(c.twMergeConfig)?extendTailwindMerge(c.twMergeConfig):twMerge)(cx(e)):cx(e),S=e=>Array.from(new Set(e));var K=(e,c={twMerge:!0,twMergeConfig:{}})=>n=>{var V;if((e==null?void 0:e.variants)==null)return b(e==null?void 0:e.base,n==null?void 0:n.class,n==null?void 0:n.className)(c);let{slots:C=[],variants:g,defaultVariants:f}=e,x=Array.isArray(C)?S(["base",...C]):[],M=t=>{let a=n==null?void 0:n[t],r=f==null?void 0:f[t];if(a===null)return null;let i=w(a)||w(r);return g[t][i]},h=Object.keys(g).map(M),N=t=>d(Object.keys(g).map(a=>{let r=M(a);return !r||typeof r!="object"?null:r[t]})),A=n&&Object.entries(n).reduce((t,[a,r])=>(r===void 0||(t[a]=r),t),{}),j=(V=e==null?void 0:e.compoundVariants)==null?void 0:V.reduce((t,{class:a,className:r,...i})=>Object.entries(i).every(([m,u])=>Array.isArray(u)?u.includes({...f,...A}[m]):{...f,...A}[m]===u)?[...t,a,r]:t,[]),B=()=>{let t=d(j);return Array.isArray(t)?t.reduce((a,r)=>(typeof r=="string"&&(a.base=b(a.base,r)(c)),typeof r=="object"&&Object.entries(r).forEach(([i,m])=>{a[i]=b(a[i],m)(c);}),a),{}):t};if(x.length>1){let t=N("base"),a=B(),r=x.slice(1).reduce((i,m)=>(i[m]=u=>b(N(m),a[m],u==null?void 0:u.class,u==null?void 0:u.className)(c),i),{});return {base:i=>b(e==null?void 0:e.base,t,a.base,i==null?void 0:i.class,i==null?void 0:i.className)(c),...r}}return b(e==null?void 0:e.base,h,j,n==null?void 0:n.class,n==null?void 0:n.className)(c)}; | ||
var O=e=>{var i;return (i=e==null?void 0:e.filter)==null?void 0:i.call(e,n=>n&&String(n).match(/^[\w\s]*$/))},o=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,D=e=>e&&Object.keys(e).length>0,f=(...e)=>(i={})=>i.twMerge?(D(i.twMergeConfig)?extendTailwindMerge(i.twMergeConfig):twMerge)(cx(e)):cx(e),S=e=>Array.from(new Set(e));var K=(e,i={twMerge:!0,twMergeConfig:{}})=>n=>{var j,V;if((e==null?void 0:e.variants)==null)return f(e==null?void 0:e.base,n==null?void 0:n.class,n==null?void 0:n.className)(i);let{slots:d=[],variants:g,defaultVariants:b}=e,w=Array.isArray(d)?S(["base",...d]):[],x=t=>{let r=n==null?void 0:n[t],a=b==null?void 0:b[t];if(r===null)return null;let u=o(r)||o(a);return g[t][u]},h=Object.keys(g).map(x),C=t=>Object.keys(g).map(r=>{let a=x(r);return !a||typeof a!="object"?null:a[t]}),M=n&&Object.entries(n).reduce((t,[r,a])=>(a===void 0||(t[r]=a),t),{}),A=(j=e==null?void 0:e.compoundVariants)==null?void 0:j.reduce((t,{class:r,className:a,...u})=>Object.entries(u).every(([m,c])=>Array.isArray(c)?c.includes({...b,...M}[m]):{...b,...M}[m]===c)?[...t,r,a]:t,[]),B=()=>{let t=O(A);return Array.isArray(t)?t.reduce((r,a)=>(typeof a=="string"&&(r.base=f(r.base,a)(i)),typeof a=="object"&&Object.entries(a).forEach(([u,m])=>{r[u]=f(r[u],m)(i);}),r),{}):t};if(w.length>1){let t=C("base"),r=(V=B())!=null?V:[];return {...w.reduce((u,m)=>(u[m]=c=>f(m==="base"?[e==null?void 0:e.base,t]:[],C(m),r==null?void 0:r[m],c==null?void 0:c.class,c==null?void 0:c.className)(i),u),{})}}return f(e==null?void 0:e.base,h,A,n==null?void 0:n.class,n==null?void 0:n.className)(i)}; | ||
export { K as tv }; |
{ | ||
"name": "tailwind-variants", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "🦄 Tailwindcss first-class variant API", | ||
@@ -5,0 +5,0 @@ "author": "Junior Garcia <jrgarciadev@gmail.com>", |
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
11657
110