tailwind-variants
Advanced tools
Comparing version 0.0.5 to 0.0.6
import { cx } from 'class-variance-authority'; | ||
import { extendTailwindMerge, twMerge } from 'tailwind-merge'; | ||
var g=e=>e.filter(c=>c),C=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 U=(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:w=[],variants:d,defaultVariants:f}=e,x=Array.isArray(w)?S(["base",...w]):[],M=a=>{let t=n==null?void 0:n[a],r=f==null?void 0:f[a];if(t===null)return null;let i=C(t)||C(r);return d[a][i]},h=Object.keys(d).map(M),N=a=>g(Object.keys(d).map(t=>{let r=M(t);return !r||typeof r!="object"?null:r[a]})),A=n&&Object.entries(n).reduce((a,[t,r])=>(r===void 0||(a[t]=r),a),{}),j=(V=e==null?void 0:e.compoundVariants)==null?void 0:V.reduce((a,{class:t,className:r,...i})=>Object.entries(i).every(([m,u])=>Array.isArray(u)?u.includes({...f,...A}[m]):{...f,...A}[m]===u)?[...a,t,r]:a,[]),B=()=>{let a=g(j);return Array.isArray(a)?a.reduce((t,r)=>(typeof r=="string"&&(t.base=b(t.base,r)(c)),typeof r=="object"&&Object.entries(r).forEach(([i,m])=>{t[i]=b(t[i],m)(c);}),t),{}):a};if(x.length>1){let a=N("base"),t=B(),r=x.slice(1).reduce((i,m)=>(i[m]=u=>b(N(m),t[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,a,t.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 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)}; | ||
export { U as tv }; | ||
export { K as tv }; |
@@ -5,3 +5,3 @@ import {CxOptions, CxReturn} from "class-variance-authority"; | ||
export declare const cleanArray: (array: string[]) => string[]; | ||
export declare const cleanArray: (array: string[]) => string[] | undefined; | ||
@@ -8,0 +8,0 @@ export declare const falsyToString: <T extends unknown>(value: T) => string | T; |
{ | ||
"name": "tailwind-variants", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "🦄 Tailwindcss first-class variant API", | ||
@@ -24,6 +24,2 @@ "author": "Junior Garcia <jrgarciadev@gmail.com>", | ||
], | ||
"dependencies": { | ||
"class-variance-authority": "0.4.0", | ||
"tailwind-merge": "^1.8.1" | ||
}, | ||
"scripts": { | ||
@@ -36,5 +32,3 @@ "build": "tsup src/index.js && node copy-types.cjs", | ||
"prepack": "clean-package", | ||
"new:pack": "npm pack && clean-package restore", | ||
"new:publish:dry": "pnpm prepack && npm publish --dry-run && clean-package restore", | ||
"new:publish:prod": "pnpm prepack && npm publish && clean-package restore", | ||
"postpack": "clean-package restore", | ||
"lint": "eslint -c .eslintrc.json ./src/**/*.{ts,tsx}", | ||
@@ -44,2 +38,36 @@ "lint:fix": "eslint --fix -c .eslintrc.json ./src/**/*.{ts,tsx}", | ||
}, | ||
"dependencies": { | ||
"class-variance-authority": "0.4.0", | ||
"tailwind-merge": "^1.8.1" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.2.0", | ||
"@commitlint/config-conventional": "^17.2.0", | ||
"@swc-node/jest": "^1.5.2", | ||
"@swc/cli": "0.1.57", | ||
"@swc/core": "1.2.198", | ||
"@types/jest": "28.1.1", | ||
"@types/node": "^18.11.18", | ||
"@typescript-eslint/eslint-plugin": "^5.42.0", | ||
"@typescript-eslint/parser": "^5.42.0", | ||
"clean-package": "2.1.1", | ||
"eslint": "^7.29.0", | ||
"eslint-config-prettier": "^8.2.0", | ||
"eslint-config-ts-lambdas": "^1.2.3", | ||
"eslint-import-resolver-typescript": "^2.4.0", | ||
"eslint-loader": "^4.0.2", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"prettier": "^2.2.1", | ||
"prettier-eslint": "^12.0.0", | ||
"prettier-eslint-cli": "^5.0.1", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.4.1", | ||
"tsup": "6.4.0", | ||
"typescript": "4.6.2", | ||
"webpack": "^5.53.0" | ||
}, | ||
"keywords": [ | ||
@@ -46,0 +74,0 @@ "tailwindcss", |
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
11735
28
8
111