tailwind-variants
Advanced tools
Comparing version 0.0.23 to 0.0.24
export type TVTransformer = { | ||
(content: string): string; | ||
tsx(content: string): string; | ||
ts(content: string): string; | ||
jsx(content: string): string; | ||
js(content: string): string; | ||
}; | ||
export declare const transformer: TVTransformer; |
@@ -1,2 +0,2 @@ | ||
var g=["xs","sm","md","lg","xl","2xl"],i={tv:new RegExp(/tv\({[\s\S]*?}\)/g),tvContent:new RegExp(/\({[\s\S]*?}\)/g),comment:new RegExp(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm),blankLine:new RegExp(/^\s*$(?:\r\n?|\n)/gm)},n=t=>!!(!t||Array.isArray(t)&&t.length===0||typeof t=="string"&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),v=t=>t.replace(i.comment,"$1").toString().replace(i.blankLine,"").toString().match(i.tv),p=content=>{let tvStrArray=v(content);if(!n(tvStrArray))return tvStrArray.map(item=>{let str=item.toString(),tv=str.match(i.tvContent).toString();return eval(tv.replaceAll("`",'"').replaceAll("'",'"').replaceAll(/\s{2,}/g," ").replaceAll(/(\r\n|\n|\r)/gm,"").trim())})},d=t=>{let{variants:s={}}=t;if(n(s))return;let e={};for(let[r,a]of Object.entries(s))if(!n(a)){e[r]={};for(let[o,c]of Object.entries(a)){if(n(c))continue;let l=c.split(" ");if(!n(l)){e[r][o]={};for(let m of g.values()){let u="";l.forEach(f=>{u+=`${m}:${f} `;}),e[r][o].original=c,e[r][o][m]=u.trimEnd();}}}}return e},y=t=>{try{if(!t.includes("tailwind-variants"))return t;let e=p(t);if(n(e))return t;let r=e.map(o=>d(o));return t.concat(` | ||
var v=["xs","sm","md","lg","xl","2xl"],a={tv:new RegExp(/tv\({[\s\S]*?}\)/g),tvContent:new RegExp(/\({[\s\S]*?}\)/g),comment:new RegExp(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm),blankLine:new RegExp(/^\s*$(?:\r\n?|\n)/gm)},n=t=>!!(!t||Array.isArray(t)&&t.length===0||typeof t=="string"&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),p=t=>t.replace(a.comment,"$1").toString().replace(a.blankLine,"").toString().match(a.tv),d=content=>{let tvStrArray=p(content);if(!n(tvStrArray))return tvStrArray.map(item=>{let str=item.toString(),tv=str.match(a.tvContent).toString();return eval(tv.replaceAll("`",'"').replaceAll("'",'"').replaceAll(/\s{2,}/g," ").replaceAll(/(\r\n|\n|\r)/gm,"").trim())})},y=t=>{let{variants:s={}}=t;if(n(s))return;let e={};for(let[r,c]of Object.entries(s))if(!n(c)){e[r]={};for(let[o,l]of Object.entries(c)){if(n(l))continue;let m=l.split(" ");if(!n(m)){e[r][o]={};for(let u of v.values()){let f="";m.forEach(g=>{f+=`${u}:${g} `;}),e[r][o].original=l,e[r][o][u]=f.trimEnd();}}}}return e},i=t=>{try{if(!t.includes("tailwind-variants"))return t;let e=d(t);if(n(e))return t;let r=e.map(o=>y(o));return t.concat(` | ||
/* | ||
@@ -7,4 +7,4 @@ | ||
*/ | ||
`)}catch{return t}}; | ||
`)}catch{return t}},C={tsx:t=>i(t),ts:t=>i(t),jsx:t=>i(t),js:t=>i(t)}; | ||
export { y as transformer }; | ||
export { C as transformer }; |
{ | ||
"name": "tailwind-variants", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"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
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
19408
172