teacss 0.1.14 → 0.1.15

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/dist/index.cjs CHANGED
@@ -8,12 +8,12 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var classnames__default = /*#__PURE__*/_interopDefault(classnames);
10
10
 
11
- var y=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,l=clsx.clsx,T=(t,r)=>n=>{if(r?.variants==null)return l(t,n?.class,n?.className);let{variants:p,defaultVariants:s}=r,C=Object.keys(p).map(e=>{let a=n?.[e],o=s?.[e];if(a===null)return null;let i=y(a)||y(o);return p[e][i]}),c=n&&Object.entries(n).reduce((e,[a,o])=>(o===void 0||(e[a]=o),e),{}),u=r?.compoundVariants?.reduce((e,{class:a,className:o,...i})=>Object.entries(i).every(([m,f])=>Array.isArray(f)?f.includes({...s,...c}[m]):{...s,...c}[m]===f)?[...e,a,o]:e,[]);return l(t,C,u,n?.class,n?.className)};function g(...t){return tailwindMerge.twMerge(clsx.clsx(t))}
11
+ function x(...n){return tailwindMerge.twMerge(clsx.clsx(n))}var y=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,l=clsx.clsx,V=(n,s)=>t=>{if(s?.variants==null)return l(n,t?.class,t?.className);let{variants:p,defaultVariants:o}=s,d=Object.keys(p).map(e=>{let a=t?.[e],r=o?.[e];if(a===null)return null;let i=y(a)||y(r);return p[e][i]}),c=t&&Object.entries(t).reduce((e,[a,r])=>(r===void 0||(e[a]=r),e),{}),u=s?.compoundVariants?.reduce((e,{class:a,className:r,...i})=>Object.entries(i).every(([m,f])=>Array.isArray(f)?f.includes({...o,...c}[m]):{...o,...c}[m]===f)?[...e,a,r]:e,[]);return l(n,d,u,t?.class,t?.className)};
12
12
 
13
13
  Object.defineProperty(exports, "cn", {
14
14
  enumerable: true,
15
15
  get: function () { return classnames__default.default; }
16
16
  });
17
- exports.cva = T;
17
+ exports.cva = V;
18
18
  exports.cx = l;
19
- exports.tw = g;
19
+ exports.cxm = x;
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as cn } from 'classnames';
2
2
  import * as CLSX from 'clsx';
3
- import { clsx, ClassValue as ClassValue$1 } from 'clsx';
3
+ import { clsx } from 'clsx';
4
4
 
5
5
  type ClassValue = CLSX.ClassValue;
6
6
  type ClassProp = {
@@ -16,6 +16,7 @@ type ClassProp = {
16
16
  type OmitUndefined<T> = T extends undefined ? never : T;
17
17
  type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
18
18
 
19
+ declare function cxm(...inputs: ClassValue[]): string;
19
20
  type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
20
21
  type CxOptions = Parameters<typeof clsx>;
21
22
  type CxReturn = ReturnType<typeof clsx>;
@@ -35,6 +36,4 @@ type Config<T> = T extends ConfigSchema ? {
35
36
  type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp;
36
37
  declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T>) => string;
37
38
 
38
- declare function tw(...inputs: ClassValue$1[]): string;
39
-
40
- export { type CxOptions, type CxReturn, type VariantProps, cva, cx, tw };
39
+ export { type CxOptions, type CxReturn, type VariantProps as CxVariantProps, cva, cx, cxm };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as cn } from 'classnames';
2
2
  import * as CLSX from 'clsx';
3
- import { clsx, ClassValue as ClassValue$1 } from 'clsx';
3
+ import { clsx } from 'clsx';
4
4
 
5
5
  type ClassValue = CLSX.ClassValue;
6
6
  type ClassProp = {
@@ -16,6 +16,7 @@ type ClassProp = {
16
16
  type OmitUndefined<T> = T extends undefined ? never : T;
17
17
  type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
18
18
 
19
+ declare function cxm(...inputs: ClassValue[]): string;
19
20
  type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
20
21
  type CxOptions = Parameters<typeof clsx>;
21
22
  type CxReturn = ReturnType<typeof clsx>;
@@ -35,6 +36,4 @@ type Config<T> = T extends ConfigSchema ? {
35
36
  type Props<T> = T extends ConfigSchema ? ConfigVariants<T> & ClassProp : ClassProp;
36
37
  declare const cva: <T>(base?: ClassValue, config?: Config<T>) => (props?: Props<T>) => string;
37
38
 
38
- declare function tw(...inputs: ClassValue$1[]): string;
39
-
40
- export { type CxOptions, type CxReturn, type VariantProps, cva, cx, tw };
39
+ export { type CxOptions, type CxReturn, type VariantProps as CxVariantProps, cva, cx, cxm };
package/dist/index.js CHANGED
@@ -102,37 +102,6 @@ function clsx() {
102
102
  return n;
103
103
  }
104
104
 
105
- // src/cva/index.ts
106
- var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
107
- var cx = clsx;
108
- var cva = (base, config) => (props) => {
109
- if (config?.variants == null)
110
- return cx(base, props?.class, props?.className);
111
- const { variants, defaultVariants } = config;
112
- const getVariantClassNames = Object.keys(variants).map((variant) => {
113
- const variantProp = props?.[variant];
114
- const defaultVariantProp = defaultVariants?.[variant];
115
- if (variantProp === null)
116
- return null;
117
- const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
118
- return variants[variant][variantKey];
119
- });
120
- const propsWithoutUndefined = props && Object.entries(props).reduce((acc, [key, value]) => {
121
- if (value === undefined) {
122
- return acc;
123
- }
124
- acc[key] = value;
125
- return acc;
126
- }, {});
127
- const getCompoundVariantClassNames = config?.compoundVariants?.reduce((acc, { class: cvClass, className: cvClassName, ...compoundVariantOptions }) => Object.entries(compoundVariantOptions).every(([key, value]) => Array.isArray(value) ? value.includes({
128
- ...defaultVariants,
129
- ...propsWithoutUndefined
130
- }[key]) : {
131
- ...defaultVariants,
132
- ...propsWithoutUndefined
133
- }[key] === value) ? [...acc, cvClass, cvClassName] : acc, []);
134
- return cx(base, getVariantClassNames, getCompoundVariantClassNames, props?.class, props?.className);
135
- };
136
105
  // node_modules/tailwind-merge/dist/bundle-mjs.mjs
137
106
  function twJoin() {
138
107
  let index = 0;
@@ -1445,14 +1414,44 @@ var getDefaultConfig = () => {
1445
1414
  };
1446
1415
  var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
1447
1416
 
1448
- // src/tw.ts
1449
- function tw(...inputs) {
1417
+ // src/cva/index.ts
1418
+ function cxm(...inputs) {
1450
1419
  return twMerge(clsx(inputs));
1451
1420
  }
1421
+ var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
1422
+ var cx = clsx;
1423
+ var cva = (base, config) => (props) => {
1424
+ if (config?.variants == null)
1425
+ return cx(base, props?.class, props?.className);
1426
+ const { variants, defaultVariants } = config;
1427
+ const getVariantClassNames = Object.keys(variants).map((variant) => {
1428
+ const variantProp = props?.[variant];
1429
+ const defaultVariantProp = defaultVariants?.[variant];
1430
+ if (variantProp === null)
1431
+ return null;
1432
+ const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
1433
+ return variants[variant][variantKey];
1434
+ });
1435
+ const propsWithoutUndefined = props && Object.entries(props).reduce((acc, [key, value]) => {
1436
+ if (value === undefined) {
1437
+ return acc;
1438
+ }
1439
+ acc[key] = value;
1440
+ return acc;
1441
+ }, {});
1442
+ const getCompoundVariantClassNames = config?.compoundVariants?.reduce((acc, { class: cvClass, className: cvClassName, ...compoundVariantOptions }) => Object.entries(compoundVariantOptions).every(([key, value]) => Array.isArray(value) ? value.includes({
1443
+ ...defaultVariants,
1444
+ ...propsWithoutUndefined
1445
+ }[key]) : {
1446
+ ...defaultVariants,
1447
+ ...propsWithoutUndefined
1448
+ }[key] === value) ? [...acc, cvClass, cvClassName] : acc, []);
1449
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props?.class, props?.className);
1450
+ };
1452
1451
  var export_cn = import_classnames.default;
1453
1452
 
1454
1453
  export {
1455
- tw,
1454
+ cxm,
1456
1455
  cx,
1457
1456
  cva,
1458
1457
  export_cn as cn
package/dist/index.mjs CHANGED
@@ -2,6 +2,6 @@ export { default as cn } from 'classnames';
2
2
  import { clsx } from 'clsx';
3
3
  import { twMerge } from 'tailwind-merge';
4
4
 
5
- var y=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,l=clsx,T=(t,r)=>n=>{if(r?.variants==null)return l(t,n?.class,n?.className);let{variants:p,defaultVariants:s}=r,C=Object.keys(p).map(e=>{let a=n?.[e],o=s?.[e];if(a===null)return null;let i=y(a)||y(o);return p[e][i]}),c=n&&Object.entries(n).reduce((e,[a,o])=>(o===void 0||(e[a]=o),e),{}),u=r?.compoundVariants?.reduce((e,{class:a,className:o,...i})=>Object.entries(i).every(([m,f])=>Array.isArray(f)?f.includes({...s,...c}[m]):{...s,...c}[m]===f)?[...e,a,o]:e,[]);return l(t,C,u,n?.class,n?.className)};function g(...t){return twMerge(clsx(t))}
5
+ function x(...n){return twMerge(clsx(n))}var y=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,l=clsx,V=(n,s)=>t=>{if(s?.variants==null)return l(n,t?.class,t?.className);let{variants:p,defaultVariants:o}=s,d=Object.keys(p).map(e=>{let a=t?.[e],r=o?.[e];if(a===null)return null;let i=y(a)||y(r);return p[e][i]}),c=t&&Object.entries(t).reduce((e,[a,r])=>(r===void 0||(e[a]=r),e),{}),u=s?.compoundVariants?.reduce((e,{class:a,className:r,...i})=>Object.entries(i).every(([m,f])=>Array.isArray(f)?f.includes({...o,...c}[m]):{...o,...c}[m]===f)?[...e,a,r]:e,[]);return l(n,d,u,t?.class,t?.className)};
6
6
 
7
- export { T as cva, l as cx, g as tw };
7
+ export { V as cva, l as cx, x as cxm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teacss",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "license": "MIT",
5
5
  "description": "Teacss aims to provide a one-stop solution for writing stylesheet.",
6
6
  "author": "Billgo <hi@billgo.me>",
@@ -63,7 +63,10 @@
63
63
  },
64
64
  "./*": "./*"
65
65
  },
66
- "files": ["dist", "README.md"],
66
+ "files": [
67
+ "dist",
68
+ "README.md"
69
+ ],
67
70
  "scripts": {
68
71
  "prepublishOnly": "bun run build",
69
72
  "build": "bunx rimraf dist && bun run build:esm && bun run build:bun && rollup -c",
@@ -99,12 +102,12 @@
99
102
  "@devjskit/cross-env": "^1.0.0",
100
103
  "@devjskit/kill-port": "^1.0.0",
101
104
  "@devjskit/rimraf": "^1.0.0",
102
- "@happy-dom/global-registrator": "^14.12.3",
105
+ "@happy-dom/global-registrator": "^15.0.0",
103
106
  "@rsbuild/core": "^0.7.10",
104
107
  "@rsbuild/plugin-react": "^0.7.10",
105
108
  "@rsbuild/plugin-svgr": "^0.7.10",
106
- "@tanstack/react-query": "^5.52.0",
107
- "@tanstack/react-query-devtools": "^5.52.0",
109
+ "@tanstack/react-query": "^5.52.1",
110
+ "@tanstack/react-query-devtools": "^5.52.1",
108
111
  "@types/bun": "^1.1.6",
109
112
  "@types/postcss-import": "^14.0.3",
110
113
  "@types/react": "^18.3.4",
@@ -113,7 +116,7 @@
113
116
  "cpy-cli": "^5.0.0",
114
117
  "cypress": "^13.13.3",
115
118
  "cypress-real-events": "^1.13.0",
116
- "ky": "^1.7.0",
119
+ "ky": "^1.7.1",
117
120
  "nprogress": "^0.2.0",
118
121
  "postcss": "^8.4.41",
119
122
  "postcss-cli": "^11.0.0",