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
56
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.0.27 to 0.0.28

2

dist/index.js
import { a, g, c, f, e, d, b, h } from './chunk-C5RUXROF.js';
var o=(e$1,x={twMerge:!0,twMergeConfig:{}})=>{var E,k,w,B,T;let{slots:V={},variants:I={},compoundVariants:s=[],defaultVariants:J={}}=e$1,A=a((E=e$1==null?void 0:e$1.extend)==null?void 0:E.base,e$1==null?void 0:e$1.base),l=g(I,(k=e$1==null?void 0:e$1.extend)==null?void 0:k.variants),i=Object.assign({},(w=e$1==null?void 0:e$1.extend)==null?void 0:w.defaultVariants,J),$=c(V)?{}:{base:e$1==null?void 0:e$1.base,...V},O=c((B=e$1==null?void 0:e$1.extend)==null?void 0:B.slots)?$:f((T=e$1==null?void 0:e$1.extend)==null?void 0:T.slots,c($)?{base:e$1==null?void 0:e$1.base}:$),y=c$1=>{var U,W,q;if(c(l)&&c(V)&&c((U=e$1==null?void 0:e$1.extend)==null?void 0:U.slots))return e(A,c$1==null?void 0:c$1.class,c$1==null?void 0:c$1.className)(x);if(s&&!Array.isArray(s))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof s}`);let Q=(t,a,n=[],r)=>{let u=n;if(typeof a=="string")u.push(h(a).split(" ").map(f=>`${t}:${f}`));else if(Array.isArray(a))u.push(a.flatMap(f=>`${t}:${f}`));else if(typeof a=="object"&&typeof r=="string"){let f=a==null?void 0:a[r];if(f&&typeof f=="string"){let d=h(f);u[r]=u[r]?[...u[r],...d.split(" ").map(b=>`${t}:${b}`)]:d.split(" ").map(b=>`${t}:${b}`);}else Array.isArray(f)&&f.length>0&&(u[r]=f.flatMap(d=>`${t}:${d}`));}return u},v=(t,a=l,n=null)=>{let r=a==null?void 0:a[t];if(typeof r!="object"||c(r))return null;let u=c$1==null?void 0:c$1[t],f$1=i==null?void 0:i[t],d=[];if(u===null)return null;let b$1=b(u);typeof b$1=="object"&&(d=Object.keys(b$1).reduce((z,C)=>{let D=b$1[C],P=r==null?void 0:r[D];return C==="initial"?(f$1=D,z):Q(C,P,z,n)},[]));let j=r[b$1]||r[b(f$1)];return typeof d=="object"&&typeof n=="string"&&d[n]?f(d,j):d.length>0?[j,...d]:j},X=()=>{var n;let t=l?Object.keys(l).map(r=>v(r,l)):null,a=(n=e$1==null?void 0:e$1.extend)!=null&&n.variants?Object.keys(e$1.extend.variants).map(r=>v(r,e$1.extend.variants)):null;return d(a,t)},Y=t=>!l||typeof l!="object"?null:Object.keys(l).map(a=>{let n=v(a,l,t);return t==="base"&&typeof n=="string"?n:n&&n[t]}).filter(Boolean),Z=c$1&&Object.fromEntries(Object.entries(c$1).filter(([,t])=>t!==void 0)),F=(t=[])=>t==null?void 0:t.filter(({class:a,className:n,...r})=>Object.entries(r).every(([u,f])=>{var j;let d=typeof(c$1==null?void 0:c$1[u])=="object"?(j=c$1[u])==null?void 0:j.initial:{},b={...i,...d,...Z};return Array.isArray(f)?f.includes(b[u]):b[u]===f})).flatMap(({class:a,className:n})=>[a,n]),R=()=>{var n;let t=F(s),a=F((n=e$1==null?void 0:e$1.extend)==null?void 0:n.compoundVariants);return d(a,t)},_=()=>{let t=R();return Array.isArray(t)?t.reduce((a,n)=>(typeof n=="string"&&(a.base=e(a.base,n)(x)),typeof n=="object"&&Object.entries(n).forEach(([r,u])=>{a[r]=e(a[r],u)(x);}),a),{}):t};if(!c(V)||!c((W=e$1==null?void 0:e$1.extend)==null?void 0:W.slots)){let t=(q=_())!=null?q:[];return {...typeof O=="object"&&!c(O)?Object.keys(O).reduce((n,r)=>(n[r]=u=>e(O[r],Y(r),t==null?void 0:t[r],u==null?void 0:u.class,u==null?void 0:u.className)(x),n),{}):{}}}return e(A,X(),R(),c$1==null?void 0:c$1.class,c$1==null?void 0:c$1.className)(x)},L=()=>{if(!(!l||typeof l!="object"))return Object.keys(l)};return y.variantkeys=L(),y.base=A,y.slots=O,y.variants=l,y.defaultVariants=i,y.compoundVariants=s,y};
var o=(e$1,i={twMerge:!0,twMergeConfig:{}})=>{var M,S,E,w,B;let{slots:A={},variants:I={},compoundVariants:s=[],defaultVariants:J={}}=e$1,$=a((M=e$1==null?void 0:e$1.extend)==null?void 0:M.base,e$1==null?void 0:e$1.base),l=g(I,(S=e$1==null?void 0:e$1.extend)==null?void 0:S.variants),x=Object.assign({},(E=e$1==null?void 0:e$1.extend)==null?void 0:E.defaultVariants,J),C=c(A)?{}:{base:e$1==null?void 0:e$1.base,...A},O=c((w=e$1==null?void 0:e$1.extend)==null?void 0:w.slots)?C:f((B=e$1==null?void 0:e$1.extend)==null?void 0:B.slots,c(C)?{base:e$1==null?void 0:e$1.base}:C),y=c$1=>{var R,U,W;if(c(l)&&c(A)&&c((R=e$1==null?void 0:e$1.extend)==null?void 0:R.slots))return e($,c$1==null?void 0:c$1.class,c$1==null?void 0:c$1.className)(i);if(s&&!Array.isArray(s))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof s}`);let Q=(t,a,r=[],n)=>{let u=r;if(typeof a=="string")u.push(h(a).split(" ").map(f=>`${t}:${f}`));else if(Array.isArray(a))u.push(a.flatMap(f=>`${t}:${f}`));else if(typeof a=="object"&&typeof n=="string"){let f=a==null?void 0:a[n];if(f&&typeof f=="string"){let b=h(f);u[n]=u[n]?[...u[n],...b.split(" ").map(d=>`${t}:${d}`)]:b.split(" ").map(d=>`${t}:${d}`);}else Array.isArray(f)&&f.length>0&&(u[n]=f.flatMap(b=>`${t}:${b}`));}return u},k=(t,a=l,r=null)=>{let n=a==null?void 0:a[t];if(typeof n!="object"||c(n))return null;let u=c$1==null?void 0:c$1[t],f$1=x==null?void 0:x[t],b$1=[];if(u===null)return null;let d=b(u);typeof d=="object"&&(b$1=Object.keys(d).reduce((q,V)=>{let z=d[V],P=n==null?void 0:n[z];return V==="initial"?(f$1=z,q):Q(V,P,q,r)},[]));let j=n[d]||n[b(f$1)];return typeof b$1=="object"&&typeof r=="string"&&b$1[r]?f(b$1,j):b$1.length>0?[j,...b$1]:j},X=()=>l?Object.keys(l).map(t=>k(t,l)):null,Y=t=>!l||typeof l!="object"?null:Object.keys(l).map(a=>{let r=k(a,l,t);return t==="base"&&typeof r=="string"?r:r&&r[t]}).filter(Boolean),Z=c$1&&Object.fromEntries(Object.entries(c$1).filter(([,t])=>t!==void 0)),T=(t=[])=>t==null?void 0:t.filter(({class:a,className:r,...n})=>Object.entries(n).every(([u,f])=>{var j;let b=typeof(c$1==null?void 0:c$1[u])=="object"?(j=c$1[u])==null?void 0:j.initial:{},d={...x,...b,...Z};return Array.isArray(f)?f.includes(d[u]):d[u]===f})).flatMap(({class:a,className:r})=>[a,r]),F=()=>{var r;let t=T(s),a=T((r=e$1==null?void 0:e$1.extend)==null?void 0:r.compoundVariants);return d(a,t)},_=()=>{let t=F();return Array.isArray(t)?t.reduce((a,r)=>(typeof r=="string"&&(a.base=e(a.base,r)(i)),typeof r=="object"&&Object.entries(r).forEach(([n,u])=>{a[n]=e(a[n],u)(i);}),a),{}):t};if(!c(A)||!c((U=e$1==null?void 0:e$1.extend)==null?void 0:U.slots)){let t=(W=_())!=null?W:[];return {...typeof O=="object"&&!c(O)?Object.keys(O).reduce((r,n)=>(r[n]=u=>e(O[n],Y(n),t==null?void 0:t[n],u==null?void 0:u.class,u==null?void 0:u.className)(i),r),{}):{}}}return e($,X(),F(),c$1==null?void 0:c$1.class,c$1==null?void 0:c$1.className)(i)},L=()=>{if(!(!l||typeof l!="object"))return Object.keys(l)};return y.variantkeys=L(),y.base=$,y.slots=O,y.variants=l,y.defaultVariants=x,y.compoundVariants=s,y};
export { o as tv };
{
"name": "tailwind-variants",
"version": "0.0.27",
"version": "0.0.28",
"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