Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-variants

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-variants - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

12

dist/index.d.ts

@@ -155,4 +155,4 @@ import type {ClassNameValue as ClassValue} from "tailwind-merge";

[K in keyof V]?: isTrueOrArray<C["responsiveVariants"]> extends true
? StringToBoolean<keyof V[K]> | TVScreenPropsValue<V, S, K, C>
: StringToBoolean<keyof V[K]>;
? StringToBoolean<keyof V[K]> | TVScreenPropsValue<V, S, K, C> | undefined
: StringToBoolean<keyof V[K]> | undefined;
} & ClassProp<ClassValue>

@@ -162,4 +162,4 @@ : V extends undefined

[K in keyof EV]?: isTrueOrArray<C["responsiveVariants"]> extends true
? StringToBoolean<keyof EV[K]> | TVScreenPropsValue<EV, ES, K, C>
: StringToBoolean<keyof EV[K]>;
? StringToBoolean<keyof EV[K]> | TVScreenPropsValue<EV, ES, K, C> | undefined
: StringToBoolean<keyof EV[K]> | undefined;
} & ClassProp<ClassValue>

@@ -172,5 +172,7 @@ : {

| TVScreenPropsValue<EV & V, S, K, C>
| undefined
:
| (K extends keyof V ? StringToBoolean<keyof V[K]> : never)
| (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never);
| (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never)
| undefined;
} & ClassProp<ClassValue>;

@@ -177,0 +179,0 @@

@@ -1,6 +0,6 @@

import { e, b, g, c, f, d, a, h } from './chunk-T24HS5CV.js';
import { e, b, g, c, f, a, h } from './chunk-T24HS5CV.js';
import { twMerge, extendTailwindMerge } from 'tailwind-merge';
var se={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},_=i=>i||void 0,j=(...i)=>_(e(i).filter(Boolean).join(" ")),E=null,O={},R=!1,A=(...i)=>v=>v.twMerge?((!E||R)&&(R=!1,E=b(O)?twMerge:extendTailwindMerge(O)),_(E(j(i)))):j(i),Z=(i,v)=>{for(let e in v)i.hasOwnProperty(e)?i[e]=j(i[e],v[e]):i[e]=v[e];return i},fe=(i,v)=>{let{extend:e=null,slots:N={},variants:q={},compoundVariants:C=[],compoundSlots:V=[],defaultVariants:F={}}=i,m={...se,...v},M=e!=null&&e.base?j(e.base,i==null?void 0:i.base):i==null?void 0:i.base,g$1=e!=null&&e.variants&&!b(e.variants)?g(q,e.variants):q,h$1=e!=null&&e.defaultVariants&&!b(e.defaultVariants)?{...e.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==null?void 0:e.slots)?$:Z({...e==null?void 0:e.slots},b($)?{base:i==null?void 0:i.base}:$),d$1=l=>{if(b(g$1)&&b(N)&&b(e==null?void 0:e.slots))return A(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 x=(t,n,a=[],s)=>{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 s=="string"){for(let c in n)if(n.hasOwnProperty(c)&&c===s){let f=n[c];if(f&&typeof f=="string"){let o=h(f);r[s]?r[s]=r[s].concat(o.split(" ").map(y=>`${t}:${y}`)):r[s]=o.split(" ").map(y=>`${t}:${y}`);}else Array.isArray(f)&&f.length>0&&(r[s]=f.reduce((o,y)=>o.concat(`${t}:${y}`),[]));}}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 c=(H=s==null?void 0:s[t])!=null?H: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,y=h$1==null?void 0:h$1[t],b$1=[];if(typeof f=="object"&&o)for(let[k,I]of Object.entries(f)){let ae=r[I];if(k==="initial"){y=I;continue}Array.isArray(m.responsiveVariants)&&!m.responsiveVariants.includes(k)||(b$1=x(k,ae,b$1,a$1));}let S=r[f]||r[a(y)];return typeof b$1=="object"&&typeof a$1=="string"&&b$1[a$1]?Z(b$1,S):b$1.length>0?(b$1.push(S),b$1):S},P=()=>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),c=t==="base"&&typeof r=="string"?r:r&&r[t];c&&(a[a.length]=c);}return a},W={};for(let t in l)l[t]!==void 0&&(W[t]=l[t]);let z=(t,n)=>{var s;let a=typeof(l==null?void 0:l[t])=="object"?{[t]:(s=l[t])==null?void 0:s.initial}:{};return {...h$1,...W,...a,...n}},D=(t=[],n)=>{let a=[];for(let{class:s,className:r,...c}of t){let f=!0;for(let[o,y]of Object.entries(c)){let b=z(o,n);if(Array.isArray(y)){if(!y.includes(b[o])){f=!1;break}}else if(b[o]!==y){f=!1;break}}f&&(s&&a.push(s),r&&a.push(r));}return a},G=t=>{let n=D(C,t),a=D(e==null?void 0:e.compoundVariants,t);return f(a,n)},ee=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,c]of Object.entries(s))a[r]=A(a[r],c)(m);return a},te=t=>{if(V.length<1)return null;let n={};for(let{slots:a=[],class:s,className:r,...c}of V){if(!b(c)){let f=!0;for(let o of Object.keys(c)){let y=z(o,t)[o];if(d(c[o]))break;if(y===void 0||!c[o]||!c[o].includes(y)){f=!1;break}}if(!f)continue}for(let f of a)n[f]=n[f]||[],n[f].push([s,r]);}return n};if(!b(N)||!b(e==null?void 0:e.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=ee(a))!=null?s:[])[n],((r=te(a))!=null?r:[])[n],a==null?void 0:a.class,a==null?void 0:a.className)(m)};return t}return A(M,P(),G(),l==null?void 0:l.class,l==null?void 0:l.className)(m)},K=()=>{if(!(!g$1||typeof g$1!="object"))return Object.keys(g$1)};return d$1.variantKeys=K(),d$1.extend=e,d$1.base=M,d$1.slots=w,d$1.variants=g$1,d$1.defaultVariants=h$1,d$1.compoundSlots=V,d$1.compoundVariants=C,d$1};
var re={twMerge:!0,twMergeConfig:{},responsiveVariants:!1},Z=i=>i||void 0,j=(...i)=>Z(e(i).filter(Boolean).join(" ")),E=null,O={},R=!1,w=(...i)=>v=>v.twMerge?((!E||R)&&(R=!1,E=b(O)?twMerge:extendTailwindMerge(O)),Z(E(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},fe=(i,v)=>{let{extend:e=null,slots:N={},variants:q={},compoundVariants:C=[],compoundSlots:V=[],defaultVariants:F={}}=i,m={...re,...v},M=e!=null&&e.base?j(e.base,i==null?void 0:i.base):i==null?void 0:i.base,g$1=e!=null&&e.variants&&!b(e.variants)?g(q,e.variants):q,A=e!=null&&e.defaultVariants&&!b(e.defaultVariants)?{...e.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},h$1=b(e==null?void 0:e.slots)?$:Y({...e==null?void 0:e.slots},b($)?{base:i==null?void 0:i.base}:$),d=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=[],s)=>{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 s=="string"){for(let c in n)if(n.hasOwnProperty(c)&&c===s){let f=n[c];if(f&&typeof f=="string"){let o=h(f);r[s]?r[s]=r[s].concat(o.split(" ").map(u=>`${t}:${u}`)):r[s]=o.split(" ").map(u=>`${t}:${u}`);}else Array.isArray(f)&&f.length>0&&(r[s]=f.reduce((o,u)=>o.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 c=(H=s==null?void 0:s[t])!=null?H: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[k,I]of Object.entries(f)){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[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=>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),c=t==="base"&&typeof r=="string"?r:r&&r[t];c&&(a[a.length]=c);}return a},W={};for(let t in l)l[t]!==void 0&&(W[t]=l[t]);let z=(t,n)=>{var s;let a=typeof(l==null?void 0:l[t])=="object"?{[t]:(s=l[t])==null?void 0:s.initial}:{};return {...A,...W,...a,...n}},D=(t=[],n)=>{let a=[];for(let{class:s,className:r,...c}of t){let f=!0;for(let[o,u]of Object.entries(c)){let b=z(o,n);if(Array.isArray(u)){if(!u.includes(b[o])){f=!1;break}}else if(b[o]!==u){f=!1;break}}f&&(s&&a.push(s),r&&a.push(r));}return a},G=t=>{let n=D(C,t),a=D(e==null?void 0:e.compoundVariants,t);return f(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=w(a.base,s)(m)),typeof s=="object")for(let[r,c]of Object.entries(s))a[r]=w(a[r],c)(m);return a},ee=t=>{if(V.length<1)return null;let n={};for(let{slots:a=[],class:s,className:r,...c}of V){if(!b(c)){let f=!0;for(let o of Object.keys(c)){let u=z(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([s,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 s,r;return w(h$1[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 w(M,x(),G(),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 d.variantKeys=_(),d.extend=e,d.base=M,d.slots=h$1,d.variants=g$1,d.defaultVariants=A,d.compoundSlots=V,d.compoundVariants=C,d};
export { A as cn, j as cnBase, se as defaultConfig, fe as tv, _ as voidEmpty };
export { w as cn, j as cnBase, re as defaultConfig, fe as tv, Z as voidEmpty };
{
"name": "tailwind-variants",
"version": "0.1.16",
"version": "0.1.17",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc