tailwind-variants 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <a href="https://www.npmjs.com/package/tailwind-variants">
13
13
  <img alt="NPM Version" src="https://badgen.net/npm/v/tailwind-variants" />
14
14
  </a>
15
- <a href="https://github.com/nextui-org/tailwind-variants/blob/main/LICENSE">
15
+ <a href="https://github.com/heroui-inc/tailwind-variants/blob/main/LICENSE">
16
16
  <img src="https://img.shields.io/npm/l/tailwind-variants?style=flat" alt="License">
17
17
  </a>
18
18
  </p>
@@ -125,11 +125,11 @@ module.exports = withTV(
125
125
 
126
126
  ## Community
127
127
 
128
- We're excited to see the community adopt NextUI, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!
128
+ We're excited to see the community adopt HeroUI, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!
129
129
 
130
130
  - [Discord](https://discord.gg/9b6yyZKmH4)
131
131
  - [Twitter](https://twitter.com/getnextui)
132
- - [GitHub Discussions](https://github.com/nextui-org/tailwind-variants/discussions)
132
+ - [GitHub Discussions](https://github.com/heroui-inc/tailwind-variants/discussions)
133
133
 
134
134
  ## Contributing
135
135
 
@@ -11,7 +11,7 @@ var w__default = /*#__PURE__*/_interopDefault(w);
11
11
  var O__default = /*#__PURE__*/_interopDefault(O);
12
12
 
13
13
  var S=t=>{w__default.default.writeFileSync(O__default.default.join(__dirname,"generated.d.ts"),t);},C=t=>`export type TVGeneratedScreens = ${Object.keys(t).map(r=>`"${r}"`).join(" | ")};
14
- `,v=t=>{queueMicrotask(()=>{if(t!=null&&t.screens){let r=C(t.screens);S(r);}});};var p={tv:/tv\s*\(((\([^\)]*?\)|\[[^\]]*?\]|.)*?)\)/gs,tvExtend:/extend:\s*\w+(,| )\s*/,comment:/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,blankLine:/^\s*$(?:\r\n?|\n)/gm,extension:/\.\w+/g},l=t=>Array.isArray(t),b=t=>typeof t=="string",d=t=>typeof t=="object",$=t=>typeof t=="boolean",y=t=>typeof t=="function",f=t=>!!(!t||l(t)&&t.length===0||b(t)&&t.length===0||d(t)&&Object.keys(t).length===0),k=(t,r)=>{let n={},e=r.length,s=Object.prototype.hasOwnProperty;for(let a=0;a<e;a++){let o=r[a];s.call(t,o)&&(n[o]=t[o]);}return n},A=(t,r)=>{let n="https://github.com/nextui-org/tailwind-variants/issues/new/choose";console.log("\x1B[31m%s\x1B[0m",`${t}: ${r.message}`),console.log(`If you think this is an issue, please submit it at ${n}`);},h=(...t)=>r=>t.reduce((n,e)=>e(n),r),P=t=>{let n=t.replace(p.comment,"$1").toString().replace(p.blankLine,"").toString(),e=s=>s[1].replace(p.tvExtend,"").toString();return Array.from(n.matchAll(p.tv),e)},F=t=>{let r=P(t);if(!f(r))return r.map(n=>n.includes("responsiveVariants")?new Function(`
14
+ `,g=t=>{queueMicrotask(()=>{if(t!=null&&t.screens){let r=C(t.screens);S(r);}});};var p={tv:/tv\s*\(((\([^\)]*?\)|\[[^\]]*?\]|.)*?)\)/gs,tvExtend:/extend:\s*\w+(,| )\s*/,comment:/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,blankLine:/^\s*$(?:\r\n?|\n)/gm,extension:/\.\w+/g},l=t=>Array.isArray(t),b=t=>typeof t=="string",d=t=>typeof t=="object",$=t=>typeof t=="boolean",y=t=>typeof t=="function",f=t=>!!(!t||l(t)&&t.length===0||b(t)&&t.length===0||d(t)&&Object.keys(t).length===0),k=(t,r)=>{let n={},e=r.length,s=Object.prototype.hasOwnProperty;for(let a=0;a<e;a++){let o=r[a];s.call(t,o)&&(n[o]=t[o]);}return n},A=(t,r)=>{let n="https://github.com/heroui-inc/tailwind-variants/issues/new/choose";console.log("\x1B[31m%s\x1B[0m",`${t}: ${r.message}`),console.log(`If you think this is an issue, please submit it at ${n}`);},h=(...t)=>r=>t.reduce((n,e)=>e(n),r),P=t=>{let n=t.replace(p.comment,"$1").toString().replace(p.blankLine,"").toString(),e=s=>s[1].replace(p.tvExtend,"").toString();return Array.from(n.matchAll(p.tv),e)},F=t=>{let r=P(t);if(!f(r))return r.map(n=>n.includes("responsiveVariants")?new Function(`
15
15
  const [options, config] = [${n.toString()}];
16
16
  return {options, config};
17
17
  `)():{})},E=t=>t.flatMap(r=>r).toString().replaceAll(","," ").split(" "),I=(t,r)=>{let n={};for(let[e,s]of Object.entries(t))n[e]={},n[e].original=s,!f(s)&&(n.temp=l(s)?E(s):s.split(" "),r.forEach(a=>{let o="";n.temp.forEach(i=>{o+=`${a}:${i} `;}),n[e][a]=o.trimEnd();}),delete n.temp);return n},B=(t,r)=>b(t)?t.split(" "):l(t)?E(t):d(t)?I(t,r):t,x=(t,r)=>{let n={};for(let[e,s]of Object.entries(t))if(n[e]={},!f(s))for(let[a,o]of Object.entries(s)){if(n[e][a]={},n[e][a].original=o,f(o))continue;let i=B(o,r);if(!f(i)){if(!l(i)){n[e][a]=i;continue}r.forEach(c=>{let m="";i.forEach(u=>{m+=`${c}:${u} `;}),n[e][a][c]=m.trimEnd();});}}return n},T=({options:t,config:r},n)=>{var a,o;let e=(a=t==null?void 0:t.variants)!=null?a:{},s=(o=r==null?void 0:r.responsiveVariants)!=null?o:!1;if(!(!s||f(e))){if($(s))return x(e,n);if(l(s))return x(e,s);if(d(s)){let i=[];for(let[c,m]of Object.entries(s)){if(!m||f(m))continue;let j={options:{variants:k(e,[c])},config:{responsiveVariants:m}};i.push(T(j,n));}return i}}},D=(t,r,n)=>{try{let e=["tailwind-variants"];if(!(l(n==null?void 0:n.aliases)?[...n.aliases,...e]:e).some(u=>t.includes(u)))return t;let o=F(t);if(f(o))return t;let i=JSON.stringify(o.map(u=>T(u,r)),void 0,2),c=`
@@ -20,7 +20,7 @@ var S=t=>{w__default.default.writeFileSync(O__default.default.join(__dirname,"ge
20
20
  `,m=`
21
21
 
22
22
  Tailwind Variants Transformed Content End */
23
- `;return t.concat(c+i+m)}catch(e){return A("Tailwind Variants Transform Failed",e),t}},g=t=>{let r=t.map(n=>{if(d(n)&&n.extension)return n.extension;let e=n.match(p.extension);return e||(e=n.split("{"),e=e.pop().replace("}","").split(",")),e.map(s=>s.replace(".","").split(".")).flat()}).flatMap(n=>n);return Array.from(new Set(r)).filter(n=>n!=="html")},G=(t,r)=>{var a;let n=V__default.default(t);if(v(n.theme),f((a=n.content)==null?void 0:a.files)||!l(n.content.files))return n;let e=o=>{var i,c;return D(o,Object.keys((c=(i=n.theme)==null?void 0:i.screens)!=null?c:{}),r)},s=n.content.transform;if(f(s)){let i=g(n.content.files).map(c=>[c,e]);return n.content.transform=Object.fromEntries(i),n}if(y(s)){let i=g(n.content.files).map(c=>[c,h(e,s)]);return n.content.transform=Object.fromEntries(i),n}if(d(s)){let i=g(n.content.files).map(c=>y(s[c])?[c,h(e,s[c])]:[c,e]);return n.content.transform=Object.fromEntries(i),n}return n};
23
+ `;return t.concat(c+i+m)}catch(e){return A("Tailwind Variants Transform Failed",e),t}},v=t=>{let r=t.map(n=>{if(d(n)&&n.extension)return n.extension;let e=n.match(p.extension);return e||(e=n.split("{"),e=e.pop().replace("}","").split(",")),e.map(s=>s.replace(".","").split(".")).flat()}).flatMap(n=>n);return Array.from(new Set(r)).filter(n=>n!=="html")},G=(t,r)=>{var a;let n=V__default.default(t);if(g(n.theme),f((a=n.content)==null?void 0:a.files)||!l(n.content.files))return n;let e=o=>{var i,c;return D(o,Object.keys((c=(i=n.theme)==null?void 0:i.screens)!=null?c:{}),r)},s=n.content.transform;if(f(s)){let i=v(n.content.files).map(c=>[c,e]);return n.content.transform=Object.fromEntries(i),n}if(y(s)){let i=v(n.content.files).map(c=>[c,h(e,s)]);return n.content.transform=Object.fromEntries(i),n}if(d(s)){let i=v(n.content.files).map(c=>y(s[c])?[c,h(e,s[c])]:[c,e]);return n.content.transform=Object.fromEntries(i),n}return n};
24
24
 
25
25
  exports.tvTransformer = D;
26
26
  exports.withTV = G;
@@ -1,15 +1,15 @@
1
1
  import { a } from './chunk-FUBUDMV2.js';
2
2
  import w from 'tailwindcss/resolveConfig';
3
3
 
4
- var p={tv:/tv\s*\(((\([^\)]*?\)|\[[^\]]*?\]|.)*?)\)/gs,tvExtend:/extend:\s*\w+(,| )\s*/,comment:/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,blankLine:/^\s*$(?:\r\n?|\n)/gm,extension:/\.\w+/g},l=n=>Array.isArray(n),E=n=>typeof n=="string",d=n=>typeof n=="object",T=n=>typeof n=="boolean",g=n=>typeof n=="function",f=n=>!!(!n||l(n)&&n.length===0||E(n)&&n.length===0||d(n)&&Object.keys(n).length===0),j=(n,r)=>{let t={},e=r.length,s=Object.prototype.hasOwnProperty;for(let a=0;a<e;a++){let o=r[a];s.call(n,o)&&(t[o]=n[o]);}return t},V=(n,r)=>{let t="https://github.com/nextui-org/tailwind-variants/issues/new/choose";console.log("\x1B[31m%s\x1B[0m",`${n}: ${r.message}`),console.log(`If you think this is an issue, please submit it at ${t}`);},x=(...n)=>r=>n.reduce((t,e)=>e(t),r),S=n=>{let t=n.replace(p.comment,"$1").toString().replace(p.blankLine,"").toString(),e=s=>s[1].replace(p.tvExtend,"").toString();return Array.from(t.matchAll(p.tv),e)},$=n=>{let r=S(n);if(!f(r))return r.map(t=>t.includes("responsiveVariants")?new Function(`
4
+ var p={tv:/tv\s*\(((\([^\)]*?\)|\[[^\]]*?\]|.)*?)\)/gs,tvExtend:/extend:\s*\w+(,| )\s*/,comment:/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,blankLine:/^\s*$(?:\r\n?|\n)/gm,extension:/\.\w+/g},l=n=>Array.isArray(n),E=n=>typeof n=="string",d=n=>typeof n=="object",T=n=>typeof n=="boolean",g=n=>typeof n=="function",f=n=>!!(!n||l(n)&&n.length===0||E(n)&&n.length===0||d(n)&&Object.keys(n).length===0),j=(n,r)=>{let t={},e=r.length,s=Object.prototype.hasOwnProperty;for(let a=0;a<e;a++){let o=r[a];s.call(n,o)&&(t[o]=n[o]);}return t},V=(n,r)=>{let t="https://github.com/heroui-inc/tailwind-variants/issues/new/choose";console.log("\x1B[31m%s\x1B[0m",`${n}: ${r.message}`),console.log(`If you think this is an issue, please submit it at ${t}`);},y=(...n)=>r=>n.reduce((t,e)=>e(t),r),S=n=>{let t=n.replace(p.comment,"$1").toString().replace(p.blankLine,"").toString(),e=s=>s[1].replace(p.tvExtend,"").toString();return Array.from(t.matchAll(p.tv),e)},$=n=>{let r=S(n);if(!f(r))return r.map(t=>t.includes("responsiveVariants")?new Function(`
5
5
  const [options, config] = [${t.toString()}];
6
6
  return {options, config};
7
- `)():{})},b=n=>n.flatMap(r=>r).toString().replaceAll(","," ").split(" "),k=(n,r)=>{let t={};for(let[e,s]of Object.entries(n))t[e]={},t[e].original=s,!f(s)&&(t.temp=l(s)?b(s):s.split(" "),r.forEach(a=>{let o="";t.temp.forEach(i=>{o+=`${a}:${i} `;}),t[e][a]=o.trimEnd();}),delete t.temp);return t},A=(n,r)=>E(n)?n.split(" "):l(n)?b(n):d(n)?k(n,r):n,y=(n,r)=>{let t={};for(let[e,s]of Object.entries(n))if(t[e]={},!f(s))for(let[a,o]of Object.entries(s)){if(t[e][a]={},t[e][a].original=o,f(o))continue;let i=A(o,r);if(!f(i)){if(!l(i)){t[e][a]=i;continue}r.forEach(c=>{let m="";i.forEach(u=>{m+=`${c}:${u} `;}),t[e][a][c]=m.trimEnd();});}}return t},C=({options:n,config:r},t)=>{var a,o;let e=(a=n==null?void 0:n.variants)!=null?a:{},s=(o=r==null?void 0:r.responsiveVariants)!=null?o:!1;if(!(!s||f(e))){if(T(s))return y(e,t);if(l(s))return y(e,s);if(d(s)){let i=[];for(let[c,m]of Object.entries(s)){if(!m||f(m))continue;let O={options:{variants:j(e,[c])},config:{responsiveVariants:m}};i.push(C(O,t));}return i}}},P=(n,r,t)=>{try{let e=["tailwind-variants"];if(!(l(t==null?void 0:t.aliases)?[...t.aliases,...e]:e).some(u=>n.includes(u)))return n;let o=$(n);if(f(o))return n;let i=JSON.stringify(o.map(u=>C(u,r)),void 0,2),c=`
7
+ `)():{})},b=n=>n.flatMap(r=>r).toString().replaceAll(","," ").split(" "),k=(n,r)=>{let t={};for(let[e,s]of Object.entries(n))t[e]={},t[e].original=s,!f(s)&&(t.temp=l(s)?b(s):s.split(" "),r.forEach(a=>{let o="";t.temp.forEach(i=>{o+=`${a}:${i} `;}),t[e][a]=o.trimEnd();}),delete t.temp);return t},A=(n,r)=>E(n)?n.split(" "):l(n)?b(n):d(n)?k(n,r):n,x=(n,r)=>{let t={};for(let[e,s]of Object.entries(n))if(t[e]={},!f(s))for(let[a,o]of Object.entries(s)){if(t[e][a]={},t[e][a].original=o,f(o))continue;let i=A(o,r);if(!f(i)){if(!l(i)){t[e][a]=i;continue}r.forEach(c=>{let m="";i.forEach(u=>{m+=`${c}:${u} `;}),t[e][a][c]=m.trimEnd();});}}return t},C=({options:n,config:r},t)=>{var a,o;let e=(a=n==null?void 0:n.variants)!=null?a:{},s=(o=r==null?void 0:r.responsiveVariants)!=null?o:!1;if(!(!s||f(e))){if(T(s))return x(e,t);if(l(s))return x(e,s);if(d(s)){let i=[];for(let[c,m]of Object.entries(s)){if(!m||f(m))continue;let O={options:{variants:j(e,[c])},config:{responsiveVariants:m}};i.push(C(O,t));}return i}}},P=(n,r,t)=>{try{let e=["tailwind-variants"];if(!(l(t==null?void 0:t.aliases)?[...t.aliases,...e]:e).some(u=>n.includes(u)))return n;let o=$(n);if(f(o))return n;let i=JSON.stringify(o.map(u=>C(u,r)),void 0,2),c=`
8
8
  /* Tailwind Variants Transformed Content Start
9
9
 
10
10
  `,m=`
11
11
 
12
12
  Tailwind Variants Transformed Content End */
13
- `;return n.concat(c+i+m)}catch(e){return V("Tailwind Variants Transform Failed",e),n}},v=n=>{let r=n.map(t=>{if(d(t)&&t.extension)return t.extension;let e=t.match(p.extension);return e||(e=t.split("{"),e=e.pop().replace("}","").split(",")),e.map(s=>s.replace(".","").split(".")).flat()}).flatMap(t=>t);return Array.from(new Set(r)).filter(t=>t!=="html")},D=(n,r)=>{var a$1;let t=w(n);if(a(t.theme),f((a$1=t.content)==null?void 0:a$1.files)||!l(t.content.files))return t;let e=o=>{var i,c;return P(o,Object.keys((c=(i=t.theme)==null?void 0:i.screens)!=null?c:{}),r)},s=t.content.transform;if(f(s)){let i=v(t.content.files).map(c=>[c,e]);return t.content.transform=Object.fromEntries(i),t}if(g(s)){let i=v(t.content.files).map(c=>[c,x(e,s)]);return t.content.transform=Object.fromEntries(i),t}if(d(s)){let i=v(t.content.files).map(c=>g(s[c])?[c,x(e,s[c])]:[c,e]);return t.content.transform=Object.fromEntries(i),t}return t};
13
+ `;return n.concat(c+i+m)}catch(e){return V("Tailwind Variants Transform Failed",e),n}},h=n=>{let r=n.map(t=>{if(d(t)&&t.extension)return t.extension;let e=t.match(p.extension);return e||(e=t.split("{"),e=e.pop().replace("}","").split(",")),e.map(s=>s.replace(".","").split(".")).flat()}).flatMap(t=>t);return Array.from(new Set(r)).filter(t=>t!=="html")},D=(n,r)=>{var a$1;let t=w(n);if(a(t.theme),f((a$1=t.content)==null?void 0:a$1.files)||!l(t.content.files))return t;let e=o=>{var i,c;return P(o,Object.keys((c=(i=t.theme)==null?void 0:i.screens)!=null?c:{}),r)},s=t.content.transform;if(f(s)){let i=h(t.content.files).map(c=>[c,e]);return t.content.transform=Object.fromEntries(i),t}if(g(s)){let i=h(t.content.files).map(c=>[c,y(e,s)]);return t.content.transform=Object.fromEntries(i),t}if(d(s)){let i=h(t.content.files).map(c=>g(s[c])?[c,y(e,s[c])]:[c,e]);return t.content.transform=Object.fromEntries(i),t}return t};
14
14
 
15
15
  export { P as tvTransformer, D as withTV };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-variants",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "🦄 Tailwindcss first-class variant API",
5
5
  "author": "Junior Garcia <jrgarciadev@gmail.com>",
6
6
  "license": "MIT",
@@ -9,10 +9,10 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/nextui-org/tailwind-variants"
12
+ "url": "https://github.com/heroui-inc/tailwind-variants"
13
13
  },
14
14
  "bugs": {
15
- "url": "https://github.com/nextui-org/tailwind-variants/issues"
15
+ "url": "https://github.com/heroui-inc/tailwind-variants/issues"
16
16
  },
17
17
  "type": "module",
18
18
  "main": "dist/index.cjs",
@@ -37,41 +37,42 @@
37
37
  "test:watch": "jest --watch --no-verbose"
38
38
  },
39
39
  "dependencies": {
40
- "tailwind-merge": "^2.5.4"
40
+ "tailwind-merge": "2.5.4"
41
41
  },
42
42
  "devDependencies": {
43
- "@commitlint/cli": "^17.2.0",
44
- "@commitlint/config-conventional": "^17.2.0",
45
- "@jest/globals": "^29.7.0",
46
- "@swc-node/jest": "^1.5.2",
47
- "@swc/cli": "0.1.57",
48
- "@swc/core": "1.2.198",
49
- "@swc/helpers": "^0.4.14",
50
- "@types/jest": "28.1.1",
51
- "@types/node": "^18.11.18",
52
- "@typescript-eslint/eslint-plugin": "^7.3.1",
53
- "@typescript-eslint/parser": "^7.3.1",
43
+ "@commitlint/cli": "19.5.0",
44
+ "@commitlint/config-conventional": "19.5.0",
45
+ "@jest/globals": "29.7.0",
46
+ "@swc-node/jest": "1.8.12",
47
+ "@swc/cli": "0.5.0",
48
+ "@swc/core": "1.9.2",
49
+ "@swc/helpers": "0.5.15",
50
+ "@swc/jest": "0.2.37",
51
+ "@types/jest": "29.5.14",
52
+ "@types/node": "22.9.0",
53
+ "@typescript-eslint/eslint-plugin": "8.14.0",
54
+ "@typescript-eslint/parser": "8.14.0",
54
55
  "benchmark": "2.1.4",
55
- "class-variance-authority": "^0.7.0",
56
- "clean-package": "2.1.1",
57
- "eslint": "^8.57.0",
58
- "eslint-config-prettier": "^9.1.0",
59
- "eslint-config-ts-lambdas": "^1.2.3",
60
- "eslint-import-resolver-typescript": "^3.6.1",
61
- "eslint-plugin-import": "^2.29.1",
62
- "eslint-plugin-jest": "^27.9.0",
63
- "eslint-plugin-node": "^11.1.0",
64
- "eslint-plugin-prettier": "^5.1.3",
65
- "eslint-plugin-promise": "^6.1.1",
66
- "expect": "^29.7.0",
67
- "jest": "28.1.1",
68
- "prettier": "^3.2.5",
69
- "prettier-eslint": "^16.3.0",
70
- "prettier-eslint-cli": "^8.0.1",
71
- "tailwindcss": "^3.2.7",
72
- "ts-node": "^10.9.1",
73
- "tsup": "6.6.3",
74
- "typescript": "5.1.3"
56
+ "class-variance-authority": "0.7.0",
57
+ "clean-package": "2.2.0",
58
+ "eslint": "8.57.0",
59
+ "eslint-config-prettier": "9.1.0",
60
+ "eslint-config-ts-lambdas": "1.2.3",
61
+ "eslint-import-resolver-typescript": "3.6.3",
62
+ "eslint-plugin-import": "2.31.0",
63
+ "eslint-plugin-jest": "28.9.0",
64
+ "eslint-plugin-node": "11.1.0",
65
+ "eslint-plugin-prettier": "5.2.1",
66
+ "eslint-plugin-promise": "7.1.0",
67
+ "expect": "29.7.0",
68
+ "jest": "29.7.0",
69
+ "prettier": "3.3.3",
70
+ "prettier-eslint": "16.3.0",
71
+ "prettier-eslint-cli": "8.0.1",
72
+ "tailwindcss": "3.4.14",
73
+ "ts-node": "10.9.2",
74
+ "tsup": "8.3.5",
75
+ "typescript": "5.6.3"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "tailwindcss": "*"