tailwind-variants 0.1.14 → 0.1.15

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.
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var tailwindMerge = require('tailwind-merge');
4
4
 
5
- var B=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,y=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),x=(e,l)=>{let t={},A=Object.keys(e),O=Object.keys(l);for(let u of A)if(O.includes(u)){let V=e[u],h=l[u];typeof V=="object"&&typeof h=="object"?t[u]=x(V,h):t[u]=h+" "+V;}else t[u]=e[u];for(let u of O)A.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,k=(...e)=>Z(q(e).filter(Boolean).join(" ")),R=null,S={},F=!1,j=(...e)=>l=>l.twMerge?((!R||F)&&(F=!1,R=y(S)?tailwindMerge.twMerge:tailwindMerge.extendTailwindMerge(S)),Z(R(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},fe=(e,l)=>{let{extend:t=null,slots:A={},variants:O={},compoundVariants:u=[],compoundSlots:V=[],defaultVariants:h={}}=e,b={...se,...l},M=t!=null&&t.base?k(t.base,e==null?void 0:e.base):e==null?void 0:e.base,d=t!=null&&t.variants&&!y(t.variants)?x(O,t.variants):O,w=t!=null&&t.defaultVariants&&!y(t.defaultVariants)?{...t.defaultVariants,...h}:h;!y(b.twMergeConfig)&&!L(b.twMergeConfig,S)&&(F=!0,S=b.twMergeConfig);let $=y(A)?{}:{base:e==null?void 0:e.base,...A},N=y(t==null?void 0:t.slots)?$:Y(t==null?void 0:t.slots,y($)?{base:e==null?void 0:e.base}:$),C=o=>{if(y(d)&&y(A)&&y(t==null?void 0:t.slots))return j(M,o==null?void 0:o.class,o==null?void 0:o.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,r,a=[],c)=>{let s=a;if(typeof r=="string")s=s.concat(J(r).split(" ").map(f=>`${n}:${f}`));else if(Array.isArray(r))s=s.concat(r.reduce((f,i)=>f.concat(`${n}:${i}`),[]));else if(typeof r=="object"&&typeof c=="string"){for(let f in r)if(r.hasOwnProperty(f)&&f===c){let i=r[f];if(i&&typeof i=="string"){let m=J(i);s[c]?s[c]=s[c].concat(m.split(" ").map(g=>`${n}:${g}`)):s[c]=m.split(" ").map(g=>`${n}:${g}`);}else Array.isArray(i)&&i.length>0&&(s[c]=i.reduce((m,g)=>m.concat(`${n}:${g}`),[]));}}return s},U=(n,r=d,a=null,c=null)=>{var H;let s=r[n];if(!s||y(s))return null;let f=(H=c==null?void 0:c[n])!=null?H:o==null?void 0:o[n];if(f===null)return null;let i=B(f),m=Array.isArray(b.responsiveVariants)&&b.responsiveVariants.length>0||b.responsiveVariants===!0,g=w==null?void 0:w[n],v=[];if(typeof i=="object"&&m)for(let[T,I]of Object.entries(i)){let ne=s[I];if(T==="initial"){g=I;continue}Array.isArray(b.responsiveVariants)&&!b.responsiveVariants.includes(T)||(v=p(T,ne,v,a));}let E=s[i]||s[B(g)];return typeof v=="object"&&typeof a=="string"&&v[a]?Y(v,E):v.length>0?(v.push(E),v):E},K=()=>d?Object.keys(d).map(n=>U(n,d)):null,P=(n,r)=>{if(!d||typeof d!="object")return null;let a=new Array;for(let c in d){let s=U(c,d,n,r),f=n==="base"&&typeof s=="string"?s:s&&s[n];f&&(a[a.length]=f);}return a},W={};for(let n in o)o[n]!==void 0&&(W[n]=o[n]);let z=(n,r)=>{var c;let a=typeof(o==null?void 0:o[n])=="object"?{[n]:(c=o[n])==null?void 0:c.initial}:{};return {...w,...W,...a,...r}},D=(n=[],r)=>{let a=[];for(let{class:c,className:s,...f}of n){let i=!0;for(let[m,g]of Object.entries(f)){let v=z(m,r);if(Array.isArray(g)){if(!g.includes(v[m])){i=!1;break}}else if(v[m]!==g){i=!1;break}}i&&(c&&a.push(c),s&&a.push(s));}return a},G=n=>{let r=D(u,n),a=D(t==null?void 0:t.compoundVariants,n);return X(a,r)},ee=n=>{let r=G(n);if(!Array.isArray(r))return r;let a={};for(let c of r)if(typeof c=="string"&&(a.base=j(a.base,c)(b)),typeof c=="object")for(let[s,f]of Object.entries(c))a[s]=j(a[s],f)(b);return a},te=n=>{if(V.length<1)return null;let r={};for(let{slots:a=[],class:c,className:s,...f}of V){if(!y(f)){let i=!0;for(let m of Object.keys(f)){let g=z(m,n)[m];if(g===void 0||g!==f[m]){i=!1;break}}if(!i)continue}for(let i of a)r[i]=r[i]||[],r[i].push([c,s]);}return r};if(!y(A)||!y(t==null?void 0:t.slots)){let n={};if(typeof N=="object"&&!y(N))for(let r of Object.keys(N))n[r]=a=>{var c,s;return j(N[r],P(r,a),((c=ee(a))!=null?c:[])[r],((s=te(a))!=null?s:[])[r],a==null?void 0:a.class,a==null?void 0:a.className)(b)};return n}return j(M,K(),G(),o==null?void 0:o.class,o==null?void 0:o.className)(b)},_=()=>{if(!(!d||typeof d!="object"))return Object.keys(d)};return C.variantKeys=_(),C.extend=t,C.base=M,C.slots=N,C.variants=d,C.defaultVariants=w,C.compoundSlots=V,C.compoundVariants=u,C};
5
+ var B=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,y=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),x=(e,l)=>{let t={},A=Object.keys(e),O=Object.keys(l);for(let u of A)if(O.includes(u)){let V=e[u],h=l[u];typeof V=="object"&&typeof h=="object"?t[u]=x(V,h):t[u]=h+" "+V;}else t[u]=e[u];for(let u of O)A.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,k=(...e)=>Z(q(e).filter(Boolean).join(" ")),R=null,S={},F=!1,j=(...e)=>l=>l.twMerge?((!R||F)&&(F=!1,R=y(S)?tailwindMerge.twMerge:tailwindMerge.extendTailwindMerge(S)),Z(R(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},fe=(e,l)=>{let{extend:t=null,slots:A={},variants:O={},compoundVariants:u=[],compoundSlots:V=[],defaultVariants:h={}}=e,b={...se,...l},M=t!=null&&t.base?k(t.base,e==null?void 0:e.base):e==null?void 0:e.base,d=t!=null&&t.variants&&!y(t.variants)?x(O,t.variants):O,w=t!=null&&t.defaultVariants&&!y(t.defaultVariants)?{...t.defaultVariants,...h}:h;!y(b.twMergeConfig)&&!L(b.twMergeConfig,S)&&(F=!0,S=b.twMergeConfig);let $=y(A)?{}:{base:e==null?void 0:e.base,...A},N=y(t==null?void 0:t.slots)?$:Y({...t==null?void 0:t.slots},y($)?{base:e==null?void 0:e.base}:$),C=o=>{if(y(d)&&y(A)&&y(t==null?void 0:t.slots))return j(M,o==null?void 0:o.class,o==null?void 0:o.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,r,a=[],c)=>{let s=a;if(typeof r=="string")s=s.concat(J(r).split(" ").map(f=>`${n}:${f}`));else if(Array.isArray(r))s=s.concat(r.reduce((f,i)=>f.concat(`${n}:${i}`),[]));else if(typeof r=="object"&&typeof c=="string"){for(let f in r)if(r.hasOwnProperty(f)&&f===c){let i=r[f];if(i&&typeof i=="string"){let m=J(i);s[c]?s[c]=s[c].concat(m.split(" ").map(g=>`${n}:${g}`)):s[c]=m.split(" ").map(g=>`${n}:${g}`);}else Array.isArray(i)&&i.length>0&&(s[c]=i.reduce((m,g)=>m.concat(`${n}:${g}`),[]));}}return s},U=(n,r=d,a=null,c=null)=>{var H;let s=r[n];if(!s||y(s))return null;let f=(H=c==null?void 0:c[n])!=null?H:o==null?void 0:o[n];if(f===null)return null;let i=B(f),m=Array.isArray(b.responsiveVariants)&&b.responsiveVariants.length>0||b.responsiveVariants===!0,g=w==null?void 0:w[n],v=[];if(typeof i=="object"&&m)for(let[T,I]of Object.entries(i)){let ne=s[I];if(T==="initial"){g=I;continue}Array.isArray(b.responsiveVariants)&&!b.responsiveVariants.includes(T)||(v=p(T,ne,v,a));}let E=s[i]||s[B(g)];return typeof v=="object"&&typeof a=="string"&&v[a]?Y(v,E):v.length>0?(v.push(E),v):E},K=()=>d?Object.keys(d).map(n=>U(n,d)):null,P=(n,r)=>{if(!d||typeof d!="object")return null;let a=new Array;for(let c in d){let s=U(c,d,n,r),f=n==="base"&&typeof s=="string"?s:s&&s[n];f&&(a[a.length]=f);}return a},W={};for(let n in o)o[n]!==void 0&&(W[n]=o[n]);let z=(n,r)=>{var c;let a=typeof(o==null?void 0:o[n])=="object"?{[n]:(c=o[n])==null?void 0:c.initial}:{};return {...w,...W,...a,...r}},D=(n=[],r)=>{let a=[];for(let{class:c,className:s,...f}of n){let i=!0;for(let[m,g]of Object.entries(f)){let v=z(m,r);if(Array.isArray(g)){if(!g.includes(v[m])){i=!1;break}}else if(v[m]!==g){i=!1;break}}i&&(c&&a.push(c),s&&a.push(s));}return a},G=n=>{let r=D(u,n),a=D(t==null?void 0:t.compoundVariants,n);return X(a,r)},ee=n=>{let r=G(n);if(!Array.isArray(r))return r;let a={};for(let c of r)if(typeof c=="string"&&(a.base=j(a.base,c)(b)),typeof c=="object")for(let[s,f]of Object.entries(c))a[s]=j(a[s],f)(b);return a},te=n=>{if(V.length<1)return null;let r={};for(let{slots:a=[],class:c,className:s,...f}of V){for(let i of a)r[i]=r[i]||[],r[i].push([c,s]);if(!y(f)){let i=!0;for(let m of Object.keys(f)){let g=z(m,n)[m];if(g===void 0||g!==f[m]){i=!1;break}}if(!i)continue}}return r};if(!y(A)||!y(t==null?void 0:t.slots)){let n={};if(typeof N=="object"&&!y(N))for(let r of Object.keys(N))n[r]=a=>{var c,s;return j(N[r],P(r,a),((c=ee(a))!=null?c:[])[r],((s=te(a))!=null?s:[])[r],a==null?void 0:a.class,a==null?void 0:a.className)(b)};return n}return j(M,K(),G(),o==null?void 0:o.class,o==null?void 0:o.className)(b)},_=()=>{if(!(!d||typeof d!="object"))return Object.keys(d)};return C.variantKeys=_(),C.extend=t,C.base=M,C.slots=N,C.variants=d,C.defaultVariants=w,C.compoundSlots=V,C.compoundVariants=u,C};
6
6
 
7
7
  exports.cn = j;
8
8
  exports.cnBase = k;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type {ClassNameValue as ClassValue} from "tailwind-merge";
2
+
1
3
  import {TVConfig, TWMConfig} from "./config";
2
4
  import {TVGeneratedScreens} from "./generated";
3
5
 
@@ -7,7 +9,7 @@ import {TVGeneratedScreens} from "./generated";
7
9
  * ----------------------------------------
8
10
  */
9
11
 
10
- export type ClassValue = string | string[] | null | undefined | ClassValue[];
12
+ export type {ClassValue};
11
13
 
12
14
  export type ClassProp<V extends unknown = ClassValue> =
13
15
  | {
@@ -193,6 +195,12 @@ export type TVReturnProps<
193
195
  variantKeys: TVVariantKeys<V, S>;
194
196
  };
195
197
 
198
+ type HasSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined
199
+ ? ES extends undefined
200
+ ? false
201
+ : true
202
+ : true;
203
+
196
204
  export type TVReturnType<
197
205
  V extends TVVariants<S>,
198
206
  S extends TVSlots,
@@ -203,11 +211,19 @@ export type TVReturnType<
203
211
  // @ts-expect-error
204
212
  E extends TVReturnType = undefined,
205
213
  > = {
206
- (props?: TVProps<V, S, C, EV, ES>): ES extends undefined
207
- ? S extends undefined
208
- ? string
209
- : {[K in TVSlotsWithBase<S, B>]: (slotProps?: TVProps<V, S, C, EV, ES>) => string}
210
- : {[K in TVSlotsWithBase<ES & S, B>]: (slotProps?: TVProps<V, S, C, EV, ES>) => string};
214
+ (props?: TVProps<V, S, C, EV, ES>): HasSlots<S, ES> extends true
215
+ ? {
216
+ [K in keyof (ES extends undefined ? {} : ES)]: (
217
+ slotProps?: TVProps<V, S, C, EV, ES>,
218
+ ) => string;
219
+ } & {
220
+ [K in keyof (S extends undefined ? {} : S)]: (
221
+ slotProps?: TVProps<V, S, C, EV, ES>,
222
+ ) => string;
223
+ } & {
224
+ [K in TVSlotsWithBase<{}, B>]: (slotProps?: TVProps<V, S, C, EV, ES>) => string;
225
+ }
226
+ : string;
211
227
  } & TVReturnProps<V, S, B, EV, ES, E>;
212
228
 
213
229
  export type TV = {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { d, b, f, c, e, a, g } from './chunk-FHRYMRZ3.js';
2
2
  import { twMerge, extendTailwindMerge } from 'tailwind-merge';
3
3
 
4
- var re={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Z=i=>i||void 0,j=(...i)=>Z(d(i).filter(Boolean).join(" ")),B=null,O={},R=!1,A=(...i)=>v=>v.twMerge?((!B||R)&&(R=!1,B=b(O)?twMerge:extendTailwindMerge(O)),Z(B(j(i)))):j(i),Y=(i,v)=>{for(let e in v)i.hasOwnProperty(e)?i[e]=j(i[e],v[e]):i[e]=v[e];return i},ce=(i,v)=>{let{extend:e$1=null,slots:N={},variants:q={},compoundVariants:C=[],compoundSlots:V=[],defaultVariants:F={}}=i,m={...re,...v},M=e$1!=null&&e$1.base?j(e$1.base,i==null?void 0:i.base):i==null?void 0:i.base,g$1=e$1!=null&&e$1.variants&&!b(e$1.variants)?f(q,e$1.variants):q,h=e$1!=null&&e$1.defaultVariants&&!b(e$1.defaultVariants)?{...e$1.defaultVariants,...F}:F;!b(m.twMergeConfig)&&!c(m.twMergeConfig,O)&&(R=!0,O=m.twMergeConfig);let $=b(N)?{}:{base:i==null?void 0:i.base,...N},w=b(e$1==null?void 0:e$1.slots)?$:Y(e$1==null?void 0:e$1.slots,b($)?{base:i==null?void 0:i.base}:$),d=f=>{if(b(g$1)&&b(N)&&b(e$1==null?void 0:e$1.slots))return A(M,f==null?void 0:f.class,f==null?void 0:f.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=[],s)=>{let r=a;if(typeof n=="string")r=r.concat(g(n).split(" ").map(l=>`${t}:${l}`));else if(Array.isArray(n))r=r.concat(n.reduce((l,c)=>l.concat(`${t}:${c}`),[]));else if(typeof n=="object"&&typeof s=="string"){for(let l in n)if(n.hasOwnProperty(l)&&l===s){let c=n[l];if(c&&typeof c=="string"){let y=g(c);r[s]?r[s]=r[s].concat(y.split(" ").map(u=>`${t}:${u}`)):r[s]=y.split(" ").map(u=>`${t}:${u}`);}else Array.isArray(c)&&c.length>0&&(r[s]=c.reduce((y,u)=>y.concat(`${t}:${u}`),[]));}}return r},U=(t,n=g$1,a$1=null,s=null)=>{var H;let r=n[t];if(!r||b(r))return null;let l=(H=s==null?void 0:s[t])!=null?H:f==null?void 0:f[t];if(l===null)return null;let c=a(l),y=Array.isArray(m.responsiveVariants)&&m.responsiveVariants.length>0||m.responsiveVariants===!0,u=h==null?void 0:h[t],b$1=[];if(typeof c=="object"&&y)for(let[k,I]of Object.entries(c)){let te=r[I];if(k==="initial"){u=I;continue}Array.isArray(m.responsiveVariants)&&!m.responsiveVariants.includes(k)||(b$1=K(k,te,b$1,a$1));}let S=r[c]||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=>U(t,g$1)):null,P=(t,n)=>{if(!g$1||typeof g$1!="object")return null;let a=new Array;for(let s in g$1){let r=U(s,g$1,t,n),l=t==="base"&&typeof r=="string"?r:r&&r[t];l&&(a[a.length]=l);}return a},W={};for(let t in f)f[t]!==void 0&&(W[t]=f[t]);let z=(t,n)=>{var s;let a=typeof(f==null?void 0:f[t])=="object"?{[t]:(s=f[t])==null?void 0:s.initial}:{};return {...h,...W,...a,...n}},D=(t=[],n)=>{let a=[];for(let{class:s,className:r,...l}of t){let c=!0;for(let[y,u]of Object.entries(l)){let b=z(y,n);if(Array.isArray(u)){if(!u.includes(b[y])){c=!1;break}}else if(b[y]!==u){c=!1;break}}c&&(s&&a.push(s),r&&a.push(r));}return a},G=t=>{let n=D(C,t),a=D(e$1==null?void 0:e$1.compoundVariants,t);return e(a,n)},p=t=>{let n=G(t);if(!Array.isArray(n))return n;let a={};for(let s of n)if(typeof s=="string"&&(a.base=A(a.base,s)(m)),typeof s=="object")for(let[r,l]of Object.entries(s))a[r]=A(a[r],l)(m);return a},ee=t=>{if(V.length<1)return null;let n={};for(let{slots:a=[],class:s,className:r,...l}of V){if(!b(l)){let c=!0;for(let y of Object.keys(l)){let u=z(y,t)[y];if(u===void 0||u!==l[y]){c=!1;break}}if(!c)continue}for(let c of a)n[c]=n[c]||[],n[c].push([s,r]);}return n};if(!b(N)||!b(e$1==null?void 0:e$1.slots)){let t={};if(typeof w=="object"&&!b(w))for(let n of Object.keys(w))t[n]=a=>{var s,r;return A(w[n],P(n,a),((s=p(a))!=null?s:[])[n],((r=ee(a))!=null?r:[])[n],a==null?void 0:a.class,a==null?void 0:a.className)(m)};return t}return A(M,x(),G(),f==null?void 0:f.class,f==null?void 0:f.className)(m)},_=()=>{if(!(!g$1||typeof g$1!="object"))return Object.keys(g$1)};return d.variantKeys=_(),d.extend=e$1,d.base=M,d.slots=w,d.variants=g$1,d.defaultVariants=h,d.compoundSlots=V,d.compoundVariants=C,d};
4
+ var re={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Z=i=>i||void 0,j=(...i)=>Z(d(i).filter(Boolean).join(" ")),B=null,O={},R=!1,A=(...i)=>v=>v.twMerge?((!B||R)&&(R=!1,B=b(O)?twMerge:extendTailwindMerge(O)),Z(B(j(i)))):j(i),Y=(i,v)=>{for(let e in v)i.hasOwnProperty(e)?i[e]=j(i[e],v[e]):i[e]=v[e];return i},ce=(i,v)=>{let{extend:e$1=null,slots:N={},variants:q={},compoundVariants:C=[],compoundSlots:V=[],defaultVariants:F={}}=i,m={...re,...v},M=e$1!=null&&e$1.base?j(e$1.base,i==null?void 0:i.base):i==null?void 0:i.base,g$1=e$1!=null&&e$1.variants&&!b(e$1.variants)?f(q,e$1.variants):q,h=e$1!=null&&e$1.defaultVariants&&!b(e$1.defaultVariants)?{...e$1.defaultVariants,...F}:F;!b(m.twMergeConfig)&&!c(m.twMergeConfig,O)&&(R=!0,O=m.twMergeConfig);let $=b(N)?{}:{base:i==null?void 0:i.base,...N},w=b(e$1==null?void 0:e$1.slots)?$:Y({...e$1==null?void 0:e$1.slots},b($)?{base:i==null?void 0:i.base}:$),d=f=>{if(b(g$1)&&b(N)&&b(e$1==null?void 0:e$1.slots))return A(M,f==null?void 0:f.class,f==null?void 0:f.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=[],s)=>{let r=a;if(typeof n=="string")r=r.concat(g(n).split(" ").map(l=>`${t}:${l}`));else if(Array.isArray(n))r=r.concat(n.reduce((l,c)=>l.concat(`${t}:${c}`),[]));else if(typeof n=="object"&&typeof s=="string"){for(let l in n)if(n.hasOwnProperty(l)&&l===s){let c=n[l];if(c&&typeof c=="string"){let y=g(c);r[s]?r[s]=r[s].concat(y.split(" ").map(u=>`${t}:${u}`)):r[s]=y.split(" ").map(u=>`${t}:${u}`);}else Array.isArray(c)&&c.length>0&&(r[s]=c.reduce((y,u)=>y.concat(`${t}:${u}`),[]));}}return r},U=(t,n=g$1,a$1=null,s=null)=>{var H;let r=n[t];if(!r||b(r))return null;let l=(H=s==null?void 0:s[t])!=null?H:f==null?void 0:f[t];if(l===null)return null;let c=a(l),y=Array.isArray(m.responsiveVariants)&&m.responsiveVariants.length>0||m.responsiveVariants===!0,u=h==null?void 0:h[t],b$1=[];if(typeof c=="object"&&y)for(let[k,I]of Object.entries(c)){let te=r[I];if(k==="initial"){u=I;continue}Array.isArray(m.responsiveVariants)&&!m.responsiveVariants.includes(k)||(b$1=K(k,te,b$1,a$1));}let S=r[c]||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=>U(t,g$1)):null,P=(t,n)=>{if(!g$1||typeof g$1!="object")return null;let a=new Array;for(let s in g$1){let r=U(s,g$1,t,n),l=t==="base"&&typeof r=="string"?r:r&&r[t];l&&(a[a.length]=l);}return a},W={};for(let t in f)f[t]!==void 0&&(W[t]=f[t]);let z=(t,n)=>{var s;let a=typeof(f==null?void 0:f[t])=="object"?{[t]:(s=f[t])==null?void 0:s.initial}:{};return {...h,...W,...a,...n}},D=(t=[],n)=>{let a=[];for(let{class:s,className:r,...l}of t){let c=!0;for(let[y,u]of Object.entries(l)){let b=z(y,n);if(Array.isArray(u)){if(!u.includes(b[y])){c=!1;break}}else if(b[y]!==u){c=!1;break}}c&&(s&&a.push(s),r&&a.push(r));}return a},G=t=>{let n=D(C,t),a=D(e$1==null?void 0:e$1.compoundVariants,t);return e(a,n)},p=t=>{let n=G(t);if(!Array.isArray(n))return n;let a={};for(let s of n)if(typeof s=="string"&&(a.base=A(a.base,s)(m)),typeof s=="object")for(let[r,l]of Object.entries(s))a[r]=A(a[r],l)(m);return a},ee=t=>{if(V.length<1)return null;let n={};for(let{slots:a=[],class:s,className:r,...l}of V){for(let c of a)n[c]=n[c]||[],n[c].push([s,r]);if(!b(l)){let c=!0;for(let y of Object.keys(l)){let u=z(y,t)[y];if(u===void 0||u!==l[y]){c=!1;break}}if(!c)continue}}return n};if(!b(N)||!b(e$1==null?void 0:e$1.slots)){let t={};if(typeof w=="object"&&!b(w))for(let n of Object.keys(w))t[n]=a=>{var s,r;return A(w[n],P(n,a),((s=p(a))!=null?s:[])[n],((r=ee(a))!=null?r:[])[n],a==null?void 0:a.class,a==null?void 0:a.className)(m)};return t}return A(M,x(),G(),f==null?void 0:f.class,f==null?void 0:f.className)(m)},_=()=>{if(!(!g$1||typeof g$1!="object"))return Object.keys(g$1)};return d.variantKeys=_(),d.extend=e$1,d.base=M,d.slots=w,d.variants=g$1,d.defaultVariants=h,d.compoundSlots=V,d.compoundVariants=C,d};
5
5
 
6
6
  export { A as cn, j as cnBase, re as defaultConfig, ce as tv, Z as voidEmpty };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-variants",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "🦄 Tailwindcss first-class variant API",
5
5
  "author": "Junior Garcia <jrgarciadev@gmail.com>",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "test": "jest --verbose"
37
37
  },
38
38
  "dependencies": {
39
- "tailwind-merge": "^1.13.2"
39
+ "tailwind-merge": "^1.14.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@commitlint/cli": "^17.2.0",