tailwind-variants 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ var l=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,u=e=>!e||typeof e!="object"||Object.keys(e).length===0,x=(e,o)=>JSON.stringify(e)===JSON.stringify(o),A=e=>typeof e=="boolean";function i(e,o){e.forEach(function(r){Array.isArray(r)?i(r,o):o.push(r);});}function y(e){let o=[];return i(e,o),o}var a=(...e)=>y(e).filter(Boolean),p=(e,o)=>{let r={},c=Object.keys(e),f=Object.keys(o);for(let t of c)if(f.includes(t)){let s=e[t],n=o[t];typeof s=="object"&&typeof n=="object"?r[t]=p(s,n):Array.isArray(s)||Array.isArray(n)?r[t]=a(n,s):r[t]=n+" "+s;}else r[t]=e[t];for(let t of f)c.includes(t)||(r[t]=o[t]);return r},g=e=>!e||typeof e!="string"?e:e.replace(/\s+/g," ").trim();
2
+
3
+ export { l as a, u as b, x as c, A as d, y as e, a as f, p as g, g as h };
package/dist/index.cjs CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  var tailwindMerge = require('tailwind-merge');
4
4
 
5
- var x=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,g=e=>!e||typeof e!="object"||Object.keys(e).length===0,L=(e,l)=>JSON.stringify(e)===JSON.stringify(l);function Q(e,l){e.forEach(function(t){Array.isArray(t)?Q(t,l):l.push(t);});}function q(e){let l=[];return Q(e,l),l}var X=(...e)=>q(e).filter(Boolean),k=(e,l)=>{let t={},C=Object.keys(e),O=Object.keys(l);for(let u of C)if(O.includes(u)){let V=e[u],h=l[u];typeof V=="object"&&typeof h=="object"?t[u]=k(V,h):t[u]=h+" "+V;}else t[u]=e[u];for(let u of O)C.includes(u)||(t[u]=l[u]);return t},J=e=>!e||typeof e!="string"?e:e.replace(/\s+/g," ").trim();var se={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Z=e=>e||void 0,S=(...e)=>Z(q(e).filter(Boolean).join(" ")),R=null,M={},F=!1,j=(...e)=>l=>l.twMerge?((!R||F)&&(F=!1,R=g(M)?tailwindMerge.twMerge:tailwindMerge.extendTailwindMerge(M)),Z(R(S(e)))):S(e),Y=(e,l)=>{for(let t in l)e.hasOwnProperty(t)?e[t]=S(e[t],l[t]):e[t]=l[t];return e},ce=(e,l)=>{let{extend:t=null,slots:C={},variants:O={},compoundVariants:u=[],compoundSlots:V=[],defaultVariants:h={}}=e,b={...se,...l},$=t!=null&&t.base?S(t.base,e==null?void 0:e.base):e==null?void 0:e.base,d=t!=null&&t.variants&&!g(t.variants)?k(O,t.variants):O,w=t!=null&&t.defaultVariants&&!g(t.defaultVariants)?{...t.defaultVariants,...h}:h;!g(b.twMergeConfig)&&!L(b.twMergeConfig,M)&&(F=!0,M=b.twMergeConfig);let E=g(C)?{}:{base:e==null?void 0:e.base,...C},N=g(t==null?void 0:t.slots)?E:Y({...t==null?void 0:t.slots},g(E)?{base:e==null?void 0:e.base}:E),A=f=>{if(g(d)&&g(C)&&g(t==null?void 0:t.slots))return j($,f==null?void 0:f.class,f==null?void 0:f.className)(b);if(u&&!Array.isArray(u))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof u}`);if(V&&!Array.isArray(V))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof V}`);let p=(n,a,r=[],c)=>{let s=r;if(typeof a=="string")s=s.concat(J(a).split(" ").map(i=>`${n}:${i}`));else if(Array.isArray(a))s=s.concat(a.reduce((i,o)=>i.concat(`${n}:${o}`),[]));else if(typeof a=="object"&&typeof c=="string"){for(let i in a)if(a.hasOwnProperty(i)&&i===c){let o=a[i];if(o&&typeof o=="string"){let y=J(o);s[c]?s[c]=s[c].concat(y.split(" ").map(m=>`${n}:${m}`)):s[c]=y.split(" ").map(m=>`${n}:${m}`);}else Array.isArray(o)&&o.length>0&&(s[c]=o.reduce((y,m)=>y.concat(`${n}:${m}`),[]));}}return s},U=(n,a=d,r=null,c=null)=>{var H;let s=a[n];if(!s||g(s))return null;let i=(H=c==null?void 0:c[n])!=null?H:f==null?void 0:f[n];if(i===null)return null;let o=x(i),y=Array.isArray(b.responsiveVariants)&&b.responsiveVariants.length>0||b.responsiveVariants===!0,m=w==null?void 0:w[n],v=[];if(typeof o=="object"&&y)for(let[B,I]of Object.entries(o)){let ne=s[I];if(B==="initial"){m=I;continue}Array.isArray(b.responsiveVariants)&&!b.responsiveVariants.includes(B)||(v=p(B,ne,v,r));}let T=s[o]||s[x(m)];return typeof v=="object"&&typeof r=="string"&&v[r]?Y(v,T):v.length>0?(v.push(T),v):T},K=()=>d?Object.keys(d).map(n=>U(n,d)):null,P=(n,a)=>{if(!d||typeof d!="object")return null;let r=new Array;for(let c in d){let s=U(c,d,n,a),i=n==="base"&&typeof s=="string"?s:s&&s[n];i&&(r[r.length]=i);}return r},W={};for(let n in f)f[n]!==void 0&&(W[n]=f[n]);let z=(n,a)=>{var c;let r=typeof(f==null?void 0:f[n])=="object"?{[n]:(c=f[n])==null?void 0:c.initial}:{};return {...w,...W,...r,...a}},D=(n=[],a)=>{let r=[];for(let{class:c,className:s,...i}of n){let o=!0;for(let[y,m]of Object.entries(i)){let v=z(y,a);if(Array.isArray(m)){if(!m.includes(v[y])){o=!1;break}}else if(v[y]!==m){o=!1;break}}o&&(c&&r.push(c),s&&r.push(s));}return r},G=n=>{let a=D(u,n),r=D(t==null?void 0:t.compoundVariants,n);return X(r,a)},ee=n=>{let a=G(n);if(!Array.isArray(a))return a;let r={};for(let c of a)if(typeof c=="string"&&(r.base=j(r.base,c)(b)),typeof c=="object")for(let[s,i]of Object.entries(c))r[s]=j(r[s],i)(b);return r},te=n=>{if(V.length<1)return null;let a={};for(let{slots:r=[],class:c,className:s,...i}of V){if(!g(i)){let o=!0;for(let y of Object.keys(i)){let m=z(y,n)[y];if(m===void 0||(Array.isArray(i[y])?!i[y].includes(m):i[y]!==m)){o=!1;break}}if(!o)continue}for(let o of r)a[o]=a[o]||[],a[o].push([c,s]);}return a};if(!g(C)||!g(t==null?void 0:t.slots)){let n={};if(typeof N=="object"&&!g(N))for(let a of Object.keys(N))n[a]=r=>{var c,s;return j(N[a],P(a,r),((c=ee(r))!=null?c:[])[a],((s=te(r))!=null?s:[])[a],r==null?void 0:r.class,r==null?void 0:r.className)(b)};return n}return j($,K(),G(),f==null?void 0:f.class,f==null?void 0:f.className)(b)},_=()=>{if(!(!d||typeof d!="object"))return Object.keys(d)};return A.variantKeys=_(),A.extend=t,A.base=$,A.slots=N,A.variants=d,A.defaultVariants=w,A.compoundSlots=V,A.compoundVariants=u,A},le=e=>(l,t)=>ce(l,t?k(e,t):e);
5
+ var q=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,g=e=>!e||typeof e!="object"||Object.keys(e).length===0,Q=(e,l)=>JSON.stringify(e)===JSON.stringify(l);function X(e,l){e.forEach(function(t){Array.isArray(t)?X(t,l):l.push(t);});}function J(e){let l=[];return X(e,l),l}var R=(...e)=>J(e).filter(Boolean),M=(e,l)=>{let t={},h=Object.keys(e),O=Object.keys(l);for(let u of h)if(O.includes(u)){let v=e[u],C=l[u];typeof v=="object"&&typeof C=="object"?t[u]=M(v,C):Array.isArray(v)||Array.isArray(C)?t[u]=R(C,v):t[u]=C+" "+v;}else t[u]=e[u];for(let u of O)h.includes(u)||(t[u]=l[u]);return t},F=e=>!e||typeof e!="string"?e:e.replace(/\s+/g," ").trim();var ce={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Z=e=>e||void 0,k=(...e)=>Z(J(e).filter(Boolean).join(" ")),U=null,E={},W=!1,j=(...e)=>l=>l.twMerge?((!U||W)&&(W=!1,U=g(E)?tailwindMerge.twMerge:tailwindMerge.extendTailwindMerge(E)),Z(U(k(e)))):k(e),Y=(e,l)=>{for(let t in l)e.hasOwnProperty(t)?e[t]=k(e[t],l[t]):e[t]=l[t];return e},ie=(e,l)=>{let{extend:t=null,slots:h={},variants:O={},compoundVariants:u=[],compoundSlots:v=[],defaultVariants:C={}}=e,d={...ce,...l},$=t!=null&&t.base?k(t.base,e==null?void 0:e.base):e==null?void 0:e.base,b=t!=null&&t.variants&&!g(t.variants)?M(O,t.variants):O,w=t!=null&&t.defaultVariants&&!g(t.defaultVariants)?{...t.defaultVariants,...C}:C;!g(d.twMergeConfig)&&!Q(d.twMergeConfig,E)&&(W=!0,E=d.twMergeConfig);let S=g(t==null?void 0:t.slots),T=g(h)?{}:{base:k(e==null?void 0:e.base,S&&(t==null?void 0:t.base)),...h},N=S?T:Y({...t==null?void 0:t.slots},g(T)?{base:e==null?void 0:e.base}:T),V=f=>{if(g(b)&&g(h)&&S)return j($,f==null?void 0:f.class,f==null?void 0:f.className)(d);if(u&&!Array.isArray(u))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof u}`);if(v&&!Array.isArray(v))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof v}`);let K=(n,a,r=[],c)=>{let s=r;if(typeof a=="string")s=s.concat(F(a).split(" ").map(i=>`${n}:${i}`));else if(Array.isArray(a))s=s.concat(a.reduce((i,o)=>i.concat(`${n}:${o}`),[]));else if(typeof a=="object"&&typeof c=="string"){for(let i in a)if(a.hasOwnProperty(i)&&i===c){let o=a[i];if(o&&typeof o=="string"){let y=F(o);s[c]?s[c]=s[c].concat(y.split(" ").map(m=>`${n}:${m}`)):s[c]=y.split(" ").map(m=>`${n}:${m}`);}else Array.isArray(o)&&o.length>0&&(s[c]=o.reduce((y,m)=>y.concat(`${n}:${m}`),[]));}}return s},p=(n,a=b,r=null,c=null)=>{var I;let s=a[n];if(!s||g(s))return null;let i=(I=c==null?void 0:c[n])!=null?I:f==null?void 0:f[n];if(i===null)return null;let o=q(i),y=Array.isArray(d.responsiveVariants)&&d.responsiveVariants.length>0||d.responsiveVariants===!0,m=w==null?void 0:w[n],A=[];if(typeof o=="object"&&y)for(let[x,L]of Object.entries(o)){let re=s[L];if(x==="initial"){m=L;continue}Array.isArray(d.responsiveVariants)&&!d.responsiveVariants.includes(x)||(A=K(x,re,A,r));}let B=s[o]||s[q(m)];return typeof A=="object"&&typeof r=="string"&&A[r]?Y(A,B):A.length>0?(A.push(B),A):B},P=()=>b?Object.keys(b).map(n=>p(n,b)):null,ee=(n,a)=>{if(!b||typeof b!="object")return null;let r=new Array;for(let c in b){let s=p(c,b,n,a),i=n==="base"&&typeof s=="string"?s:s&&s[n];i&&(r[r.length]=i);}return r},z={};for(let n in f)f[n]!==void 0&&(z[n]=f[n]);let D=(n,a)=>{var c;let r=typeof(f==null?void 0:f[n])=="object"?{[n]:(c=f[n])==null?void 0:c.initial}:{};return {...w,...z,...r,...a}},G=(n=[],a)=>{let r=[];for(let{class:c,className:s,...i}of n){let o=!0;for(let[y,m]of Object.entries(i)){let A=D(y,a);if(Array.isArray(m)){if(!m.includes(A[y])){o=!1;break}}else if(A[y]!==m){o=!1;break}}o&&(c&&r.push(c),s&&r.push(s));}return r},H=n=>{let a=G(u,n),r=G(t==null?void 0:t.compoundVariants,n);return R(r,a)},te=n=>{let a=H(n);if(!Array.isArray(a))return a;let r={};for(let c of a)if(typeof c=="string"&&(r.base=j(r.base,c)(d)),typeof c=="object")for(let[s,i]of Object.entries(c))r[s]=j(r[s],i)(d);return r},ne=n=>{if(v.length<1)return null;let a={};for(let{slots:r=[],class:c,className:s,...i}of v){if(!g(i)){let o=!0;for(let y of Object.keys(i)){let m=D(y,n)[y];if(m===void 0||(Array.isArray(i[y])?!i[y].includes(m):i[y]!==m)){o=!1;break}}if(!o)continue}for(let o of r)a[o]=a[o]||[],a[o].push([c,s]);}return a};if(!g(h)||!S){let n={};if(typeof N=="object"&&!g(N))for(let a of Object.keys(N))n[a]=r=>{var c,s;return j(N[a],ee(a,r),((c=te(r))!=null?c:[])[a],((s=ne(r))!=null?s:[])[a],r==null?void 0:r.class,r==null?void 0:r.className)(d)};return n}return j($,P(),H(),f==null?void 0:f.class,f==null?void 0:f.className)(d)},_=()=>{if(!(!b||typeof b!="object"))return Object.keys(b)};return V.variantKeys=_(),V.extend=t,V.base=$,V.slots=N,V.variants=b,V.defaultVariants=w,V.compoundSlots=v,V.compoundVariants=u,V},ue=e=>(l,t)=>ie(l,t?M(e,t):e);
6
6
 
7
7
  exports.cn = j;
8
- exports.cnBase = S;
9
- exports.createTV = le;
10
- exports.defaultConfig = se;
11
- exports.tv = ce;
8
+ exports.cnBase = k;
9
+ exports.createTV = ue;
10
+ exports.defaultConfig = ce;
11
+ exports.tv = ie;
12
12
  exports.voidEmpty = Z;
package/dist/index.d.ts CHANGED
@@ -62,11 +62,13 @@ type SlotsClassValue<S extends TVSlots, B extends ClassValue> = {
62
62
  [K in TVSlotsWithBase<S, B>]?: ClassValue;
63
63
  };
64
64
 
65
- type TVVariantsDefault<S extends TVSlots, B extends ClassValue> = {
66
- [key: string]: {
67
- [key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassValue : ClassValue;
68
- };
69
- };
65
+ type TVVariantsDefault<S extends TVSlots, B extends ClassValue> = S extends undefined
66
+ ? {}
67
+ : {
68
+ [key: string]: {
69
+ [key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassValue : ClassValue;
70
+ };
71
+ };
70
72
 
71
73
  export type TVVariants<
72
74
  S extends TVSlots | undefined,
@@ -77,12 +79,11 @@ export type TVVariants<
77
79
  ? TVVariantsDefault<S, B>
78
80
  :
79
81
  | {
80
- [K in keyof EV]?:
81
- | {
82
- [K2 in keyof EV[K]]?: S extends TVSlots
83
- ? SlotsClassValue<S, B> | ClassValue
84
- : ClassValue;
85
- };
82
+ [K in keyof EV]: {
83
+ [K2 in keyof EV[K]]: S extends TVSlots
84
+ ? SlotsClassValue<S, B> | ClassValue
85
+ : ClassValue;
86
+ };
86
87
  }
87
88
  | TVVariantsDefault<S, B>;
88
89
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { e, b, g, c, f, a, h } from './chunk-T24HS5CV.js';
1
+ import { e, b, g, c, f, a, h } from './chunk-JXBJZR5A.js';
2
2
  import { twMerge, extendTailwindMerge } from 'tailwind-merge';
3
3
 
4
- var re={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Z=s=>s||void 0,j=(...s)=>Z(e(s).filter(Boolean).join(" ")),R=null,O={},q=!1,w=(...s)=>d=>d.twMerge?((!R||q)&&(q=!1,R=b(O)?twMerge:extendTailwindMerge(O)),Z(R(j(s)))):j(s),Y=(s,d)=>{for(let e in d)s.hasOwnProperty(e)?s[e]=j(s[e],d[e]):s[e]=d[e];return s},se=(s,d)=>{let{extend:e=null,slots:N={},variants:F={},compoundVariants:C=[],compoundSlots:V=[],defaultVariants:U={}}=s,m={...re,...d},M=e!=null&&e.base?j(e.base,s==null?void 0:s.base):s==null?void 0:s.base,g$1=e!=null&&e.variants&&!b(e.variants)?g(F,e.variants):F,A=e!=null&&e.defaultVariants&&!b(e.defaultVariants)?{...e.defaultVariants,...U}:U;!b(m.twMergeConfig)&&!c(m.twMergeConfig,O)&&(q=!0,O=m.twMergeConfig);let $=b(N)?{}:{base:s==null?void 0:s.base,...N},h$1=b(e==null?void 0:e.slots)?$:Y({...e==null?void 0:e.slots},b($)?{base:s==null?void 0:s.base}:$),v=l=>{if(b(g$1)&&b(N)&&b(e==null?void 0:e.slots))return w(M,l==null?void 0:l.class,l==null?void 0:l.className)(m);if(C&&!Array.isArray(C))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof C}`);if(V&&!Array.isArray(V))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof V}`);let K=(t,n,a=[],i)=>{let r=a;if(typeof n=="string")r=r.concat(h(n).split(" ").map(c=>`${t}:${c}`));else if(Array.isArray(n))r=r.concat(n.reduce((c,f)=>c.concat(`${t}:${f}`),[]));else if(typeof n=="object"&&typeof i=="string"){for(let c in n)if(n.hasOwnProperty(c)&&c===i){let f=n[c];if(f&&typeof f=="string"){let o=h(f);r[i]?r[i]=r[i].concat(o.split(" ").map(u=>`${t}:${u}`)):r[i]=o.split(" ").map(u=>`${t}:${u}`);}else Array.isArray(f)&&f.length>0&&(r[i]=f.reduce((o,u)=>o.concat(`${t}:${u}`),[]));}}return r},W=(t,n=g$1,a$1=null,i=null)=>{var I;let r=n[t];if(!r||b(r))return null;let c=(I=i==null?void 0:i[t])!=null?I:l==null?void 0:l[t];if(c===null)return null;let f=a(c),o=Array.isArray(m.responsiveVariants)&&m.responsiveVariants.length>0||m.responsiveVariants===!0,u=A==null?void 0:A[t],b$1=[];if(typeof f=="object"&&o)for(let[T,J]of Object.entries(f)){let te=r[J];if(T==="initial"){u=J;continue}Array.isArray(m.responsiveVariants)&&!m.responsiveVariants.includes(T)||(b$1=K(T,te,b$1,a$1));}let S=r[f]||r[a(u)];return typeof b$1=="object"&&typeof a$1=="string"&&b$1[a$1]?Y(b$1,S):b$1.length>0?(b$1.push(S),b$1):S},x=()=>g$1?Object.keys(g$1).map(t=>W(t,g$1)):null,P=(t,n)=>{if(!g$1||typeof g$1!="object")return null;let a=new Array;for(let i in g$1){let r=W(i,g$1,t,n),c=t==="base"&&typeof r=="string"?r:r&&r[t];c&&(a[a.length]=c);}return a},z={};for(let t in l)l[t]!==void 0&&(z[t]=l[t]);let D=(t,n)=>{var i;let a=typeof(l==null?void 0:l[t])=="object"?{[t]:(i=l[t])==null?void 0:i.initial}:{};return {...A,...z,...a,...n}},G=(t=[],n)=>{let a=[];for(let{class:i,className:r,...c}of t){let f=!0;for(let[o,u]of Object.entries(c)){let b=D(o,n);if(Array.isArray(u)){if(!u.includes(b[o])){f=!1;break}}else if(b[o]!==u){f=!1;break}}f&&(i&&a.push(i),r&&a.push(r));}return a},H=t=>{let n=G(C,t),a=G(e==null?void 0:e.compoundVariants,t);return f(a,n)},p=t=>{let n=H(t);if(!Array.isArray(n))return n;let a={};for(let i of n)if(typeof i=="string"&&(a.base=w(a.base,i)(m)),typeof i=="object")for(let[r,c]of Object.entries(i))a[r]=w(a[r],c)(m);return a},ee=t=>{if(V.length<1)return null;let n={};for(let{slots:a=[],class:i,className:r,...c}of V){if(!b(c)){let f=!0;for(let o of Object.keys(c)){let u=D(o,t)[o];if(u===void 0||(Array.isArray(c[o])?!c[o].includes(u):c[o]!==u)){f=!1;break}}if(!f)continue}for(let f of a)n[f]=n[f]||[],n[f].push([i,r]);}return n};if(!b(N)||!b(e==null?void 0:e.slots)){let t={};if(typeof h$1=="object"&&!b(h$1))for(let n of Object.keys(h$1))t[n]=a=>{var i,r;return w(h$1[n],P(n,a),((i=p(a))!=null?i:[])[n],((r=ee(a))!=null?r:[])[n],a==null?void 0:a.class,a==null?void 0:a.className)(m)};return t}return w(M,x(),H(),l==null?void 0:l.class,l==null?void 0:l.className)(m)},_=()=>{if(!(!g$1||typeof g$1!="object"))return Object.keys(g$1)};return v.variantKeys=_(),v.extend=e,v.base=M,v.slots=h$1,v.variants=g$1,v.defaultVariants=A,v.compoundSlots=V,v.compoundVariants=C,v},fe=s=>(d,e)=>se(d,e?g(s,e):s);
4
+ var se={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},_=s=>s||void 0,N=(...s)=>_(e(s).filter(Boolean).join(" ")),q=null,M={},F=!1,w=(...s)=>b$1=>b$1.twMerge?((!q||F)&&(F=!1,q=b(M)?twMerge:extendTailwindMerge(M)),_(q(N(s)))):N(s),Z=(s,b)=>{for(let e in b)s.hasOwnProperty(e)?s[e]=N(s[e],b[e]):s[e]=b[e];return s},ie=(s,b$1)=>{let{extend:e=null,slots:j={},variants:U={},compoundVariants:C=[],compoundSlots:V=[],defaultVariants:W={}}=s,m={...se,...b$1},S=e!=null&&e.base?N(e.base,s==null?void 0:s.base):s==null?void 0:s.base,g$1=e!=null&&e.variants&&!b(e.variants)?g(U,e.variants):U,A=e!=null&&e.defaultVariants&&!b(e.defaultVariants)?{...e.defaultVariants,...W}:W;!b(m.twMergeConfig)&&!c(m.twMergeConfig,M)&&(F=!0,M=m.twMergeConfig);let O=b(e==null?void 0:e.slots),$=b(j)?{}:{base:N(s==null?void 0:s.base,O&&(e==null?void 0:e.base)),...j},h$1=O?$:Z({...e==null?void 0:e.slots},b($)?{base:s==null?void 0:s.base}:$),v=l=>{if(b(g$1)&&b(j)&&O)return w(S,l==null?void 0:l.class,l==null?void 0:l.className)(m);if(C&&!Array.isArray(C))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof C}`);if(V&&!Array.isArray(V))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof V}`);let K=(t,n,a=[],i)=>{let r=a;if(typeof n=="string")r=r.concat(h(n).split(" ").map(c=>`${t}:${c}`));else if(Array.isArray(n))r=r.concat(n.reduce((c,f)=>c.concat(`${t}:${f}`),[]));else if(typeof n=="object"&&typeof i=="string"){for(let c in n)if(n.hasOwnProperty(c)&&c===i){let f=n[c];if(f&&typeof f=="string"){let o=h(f);r[i]?r[i]=r[i].concat(o.split(" ").map(u=>`${t}:${u}`)):r[i]=o.split(" ").map(u=>`${t}:${u}`);}else Array.isArray(f)&&f.length>0&&(r[i]=f.reduce((o,u)=>o.concat(`${t}:${u}`),[]));}}return r},z=(t,n=g$1,a$1=null,i=null)=>{var J;let r=n[t];if(!r||b(r))return null;let c=(J=i==null?void 0:i[t])!=null?J:l==null?void 0:l[t];if(c===null)return null;let f=a(c),o=Array.isArray(m.responsiveVariants)&&m.responsiveVariants.length>0||m.responsiveVariants===!0,u=A==null?void 0:A[t],d=[];if(typeof f=="object"&&o)for(let[k,L]of Object.entries(f)){let ae=r[L];if(k==="initial"){u=L;continue}Array.isArray(m.responsiveVariants)&&!m.responsiveVariants.includes(k)||(d=K(k,ae,d,a$1));}let T=r[f]||r[a(u)];return typeof d=="object"&&typeof a$1=="string"&&d[a$1]?Z(d,T):d.length>0?(d.push(T),d):T},P=()=>g$1?Object.keys(g$1).map(t=>z(t,g$1)):null,p=(t,n)=>{if(!g$1||typeof g$1!="object")return null;let a=new Array;for(let i in g$1){let r=z(i,g$1,t,n),c=t==="base"&&typeof r=="string"?r:r&&r[t];c&&(a[a.length]=c);}return a},D={};for(let t in l)l[t]!==void 0&&(D[t]=l[t]);let G=(t,n)=>{var i;let a=typeof(l==null?void 0:l[t])=="object"?{[t]:(i=l[t])==null?void 0:i.initial}:{};return {...A,...D,...a,...n}},H=(t=[],n)=>{let a=[];for(let{class:i,className:r,...c}of t){let f=!0;for(let[o,u]of Object.entries(c)){let d=G(o,n);if(Array.isArray(u)){if(!u.includes(d[o])){f=!1;break}}else if(d[o]!==u){f=!1;break}}f&&(i&&a.push(i),r&&a.push(r));}return a},I=t=>{let n=H(C,t),a=H(e==null?void 0:e.compoundVariants,t);return f(a,n)},ee=t=>{let n=I(t);if(!Array.isArray(n))return n;let a={};for(let i of n)if(typeof i=="string"&&(a.base=w(a.base,i)(m)),typeof i=="object")for(let[r,c]of Object.entries(i))a[r]=w(a[r],c)(m);return a},te=t=>{if(V.length<1)return null;let n={};for(let{slots:a=[],class:i,className:r,...c}of V){if(!b(c)){let f=!0;for(let o of Object.keys(c)){let u=G(o,t)[o];if(u===void 0||(Array.isArray(c[o])?!c[o].includes(u):c[o]!==u)){f=!1;break}}if(!f)continue}for(let f of a)n[f]=n[f]||[],n[f].push([i,r]);}return n};if(!b(j)||!O){let t={};if(typeof h$1=="object"&&!b(h$1))for(let n of Object.keys(h$1))t[n]=a=>{var i,r;return w(h$1[n],p(n,a),((i=ee(a))!=null?i:[])[n],((r=te(a))!=null?r:[])[n],a==null?void 0:a.class,a==null?void 0:a.className)(m)};return t}return w(S,P(),I(),l==null?void 0:l.class,l==null?void 0:l.className)(m)},x=()=>{if(!(!g$1||typeof g$1!="object"))return Object.keys(g$1)};return v.variantKeys=x(),v.extend=e,v.base=S,v.slots=h$1,v.variants=g$1,v.defaultVariants=A,v.compoundSlots=V,v.compoundVariants=C,v},le=s=>(b,e)=>ie(b,e?g(s,e):s);
5
5
 
6
- export { w as cn, j as cnBase, fe as createTV, re as defaultConfig, se as tv, Z as voidEmpty };
6
+ export { w as cn, N as cnBase, le as createTV, se as defaultConfig, ie as tv, _ as voidEmpty };
package/dist/utils.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var a=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,l=t=>!t||typeof t!="object"||Object.keys(t).length===0,u=(t,e)=>JSON.stringify(t)===JSON.stringify(e),x=t=>typeof t=="boolean";function i(t,e){t.forEach(function(n){Array.isArray(n)?i(n,e):e.push(n);});}function y(t){let e=[];return i(t,e),e}var g=(...t)=>y(t).filter(Boolean),p=(t,e)=>{let n={},c=Object.keys(t),f=Object.keys(e);for(let o of c)if(f.includes(o)){let s=t[o],r=e[o];typeof s=="object"&&typeof r=="object"?n[o]=p(s,r):n[o]=r+" "+s;}else n[o]=t[o];for(let o of f)c.includes(o)||(n[o]=e[o]);return n},k=t=>!t||typeof t!="string"?t:t.replace(/\s+/g," ").trim();
3
+ var l=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,u=e=>!e||typeof e!="object"||Object.keys(e).length===0,x=(e,o)=>JSON.stringify(e)===JSON.stringify(o),A=e=>typeof e=="boolean";function i(e,o){e.forEach(function(r){Array.isArray(r)?i(r,o):o.push(r);});}function y(e){let o=[];return i(e,o),o}var a=(...e)=>y(e).filter(Boolean),p=(e,o)=>{let r={},c=Object.keys(e),f=Object.keys(o);for(let t of c)if(f.includes(t)){let s=e[t],n=o[t];typeof s=="object"&&typeof n=="object"?r[t]=p(s,n):Array.isArray(s)||Array.isArray(n)?r[t]=a(n,s):r[t]=n+" "+s;}else r[t]=e[t];for(let t of f)c.includes(t)||(r[t]=o[t]);return r},g=e=>!e||typeof e!="string"?e:e.replace(/\s+/g," ").trim();
4
4
 
5
- exports.falsyToString = a;
5
+ exports.falsyToString = l;
6
6
  exports.flatArray = y;
7
- exports.flatMergeArrays = g;
8
- exports.isBoolean = x;
9
- exports.isEmptyObject = l;
10
- exports.isEqual = u;
7
+ exports.flatMergeArrays = a;
8
+ exports.isBoolean = A;
9
+ exports.isEmptyObject = u;
10
+ exports.isEqual = x;
11
11
  exports.mergeObjects = p;
12
- exports.removeExtraSpaces = k;
12
+ exports.removeExtraSpaces = g;
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- export { a as falsyToString, e as flatArray, f as flatMergeArrays, d as isBoolean, b as isEmptyObject, c as isEqual, g as mergeObjects, h as removeExtraSpaces } from './chunk-T24HS5CV.js';
1
+ export { a as falsyToString, e as flatArray, f as flatMergeArrays, d as isBoolean, b as isEmptyObject, c as isEqual, g as mergeObjects, h as removeExtraSpaces } from './chunk-JXBJZR5A.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-variants",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "🦄 Tailwindcss first-class variant API",
5
5
  "author": "Junior Garcia <jrgarciadev@gmail.com>",
6
6
  "license": "MIT",
@@ -41,6 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@commitlint/cli": "^17.2.0",
43
43
  "@commitlint/config-conventional": "^17.2.0",
44
+ "@jest/globals": "^29.7.0",
44
45
  "@swc-node/jest": "^1.5.2",
45
46
  "@swc/cli": "0.1.57",
46
47
  "@swc/core": "1.2.198",
@@ -49,6 +50,7 @@
49
50
  "@types/node": "^18.11.18",
50
51
  "@typescript-eslint/eslint-plugin": "^5.42.0",
51
52
  "@typescript-eslint/parser": "^5.42.0",
53
+ "benchmark": "2.1.4",
52
54
  "clean-package": "2.1.1",
53
55
  "eslint": "^7.29.0",
54
56
  "eslint-config-prettier": "^8.2.0",
@@ -60,6 +62,7 @@
60
62
  "eslint-plugin-node": "^11.1.0",
61
63
  "eslint-plugin-prettier": "^4.0.0",
62
64
  "eslint-plugin-promise": "^6.0.0",
65
+ "expect": "^29.7.0",
63
66
  "jest": "28.1.1",
64
67
  "prettier": "^2.2.1",
65
68
  "prettier-eslint": "^12.0.0",
@@ -69,8 +72,7 @@
69
72
  "tslib": "^2.4.1",
70
73
  "tsup": "6.6.3",
71
74
  "typescript": "5.1.3",
72
- "webpack": "^5.53.0",
73
- "benchmark": "2.1.4"
75
+ "webpack": "^5.53.0"
74
76
  },
75
77
  "peerDependencies": {
76
78
  "tailwindcss": "*"
@@ -1,3 +0,0 @@
1
- var a=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,l=t=>!t||typeof t!="object"||Object.keys(t).length===0,u=(t,e)=>JSON.stringify(t)===JSON.stringify(e),x=t=>typeof t=="boolean";function i(t,e){t.forEach(function(n){Array.isArray(n)?i(n,e):e.push(n);});}function y(t){let e=[];return i(t,e),e}var g=(...t)=>y(t).filter(Boolean),p=(t,e)=>{let n={},c=Object.keys(t),f=Object.keys(e);for(let o of c)if(f.includes(o)){let s=t[o],r=e[o];typeof s=="object"&&typeof r=="object"?n[o]=p(s,r):n[o]=r+" "+s;}else n[o]=t[o];for(let o of f)c.includes(o)||(n[o]=e[o]);return n},k=t=>!t||typeof t!="string"?t:t.replace(/\s+/g," ").trim();
2
-
3
- export { a, l as b, u as c, x as d, y as e, g as f, p as g, k as h };