teacss 0.1.14 → 0.1.16
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 +3 -3
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +33 -34
- package/dist/index.mjs +2 -2
- package/package.json +23 -23
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=
|
|
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 =
|
|
17
|
+
exports.cva = V;
|
|
18
18
|
exports.cx = l;
|
|
19
|
-
exports.
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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/
|
|
1449
|
-
function
|
|
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
|
-
|
|
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=
|
|
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 {
|
|
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.
|
|
3
|
+
"version": "0.1.16",
|
|
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>",
|
|
@@ -74,60 +74,60 @@
|
|
|
74
74
|
"start": "bunx kill-port 3000 && bunx rsbuild dev --open http://localhost:3000"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@unocss/core": "^0.62.
|
|
78
|
-
"@unocss/postcss": "^0.62.
|
|
79
|
-
"@unocss/rule-utils": "^0.62.
|
|
80
|
-
"@unocss/transformer-directives": "^0.62.
|
|
81
|
-
"@unocss/transformer-variant-group": "^0.62.
|
|
77
|
+
"@unocss/core": "^0.62.3",
|
|
78
|
+
"@unocss/postcss": "^0.62.3",
|
|
79
|
+
"@unocss/rule-utils": "^0.62.3",
|
|
80
|
+
"@unocss/transformer-directives": "^0.62.3",
|
|
81
|
+
"@unocss/transformer-variant-group": "^0.62.3",
|
|
82
82
|
"autoprefixer": "^10.4.20",
|
|
83
83
|
"classnames": "^2.5.1",
|
|
84
84
|
"clsx": "^2.1.1",
|
|
85
85
|
"postcss-combine-duplicated-selectors": "^10.0.3",
|
|
86
86
|
"postcss-custom-media": "^11.0.1",
|
|
87
|
-
"postcss-discard-comments": "^7.0.
|
|
87
|
+
"postcss-discard-comments": "^7.0.3",
|
|
88
88
|
"postcss-discard-duplicates": "^7.0.1",
|
|
89
89
|
"postcss-discard-empty": "^7.0.0",
|
|
90
|
-
"postcss-discard-unused": "^7.0.
|
|
90
|
+
"postcss-discard-unused": "^7.0.3",
|
|
91
91
|
"postcss-import": "^16.1.0",
|
|
92
92
|
"postcss-nesting": "^13.0.0",
|
|
93
93
|
"tailwind-merge": "^2.5.2"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@biomejs/biome": "1.8.3",
|
|
97
|
-
"@devjskit/biome-config": "^0.1.
|
|
97
|
+
"@devjskit/biome-config": "^0.1.6",
|
|
98
98
|
"@devjskit/copy-files": "^1.0.0",
|
|
99
99
|
"@devjskit/cross-env": "^1.0.0",
|
|
100
100
|
"@devjskit/kill-port": "^1.0.0",
|
|
101
101
|
"@devjskit/rimraf": "^1.0.0",
|
|
102
|
-
"@happy-dom/global-registrator": "^
|
|
102
|
+
"@happy-dom/global-registrator": "^15.7.3",
|
|
103
103
|
"@rsbuild/core": "^0.7.10",
|
|
104
104
|
"@rsbuild/plugin-react": "^0.7.10",
|
|
105
105
|
"@rsbuild/plugin-svgr": "^0.7.10",
|
|
106
|
-
"@tanstack/react-query": "^5.
|
|
107
|
-
"@tanstack/react-query-devtools": "^5.
|
|
108
|
-
"@types/bun": "^1.1.
|
|
106
|
+
"@tanstack/react-query": "^5.55.4",
|
|
107
|
+
"@tanstack/react-query-devtools": "^5.55.4",
|
|
108
|
+
"@types/bun": "^1.1.9",
|
|
109
109
|
"@types/postcss-import": "^14.0.3",
|
|
110
|
-
"@types/react": "^18.3.
|
|
110
|
+
"@types/react": "^18.3.5",
|
|
111
111
|
"@types/react-dom": "^18.3.0",
|
|
112
112
|
"@types/web": "^0.0.155",
|
|
113
113
|
"cpy-cli": "^5.0.0",
|
|
114
|
-
"cypress": "^13.
|
|
114
|
+
"cypress": "^13.14.2",
|
|
115
115
|
"cypress-real-events": "^1.13.0",
|
|
116
|
-
"ky": "^1.7.
|
|
116
|
+
"ky": "^1.7.2",
|
|
117
117
|
"nprogress": "^0.2.0",
|
|
118
|
-
"postcss": "^8.4.
|
|
118
|
+
"postcss": "^8.4.45",
|
|
119
119
|
"postcss-cli": "^11.0.0",
|
|
120
120
|
"react": "^18.3.1",
|
|
121
121
|
"react-dom": "^18.3.1",
|
|
122
|
-
"react-hook-form": "^7.
|
|
122
|
+
"react-hook-form": "^7.53.0",
|
|
123
123
|
"react-intl": "^6.6.8",
|
|
124
|
-
"react-router-dom": "^6.26.
|
|
125
|
-
"rollup": "^4.21.
|
|
124
|
+
"react-router-dom": "^6.26.2",
|
|
125
|
+
"rollup": "^4.21.2",
|
|
126
126
|
"rollup-plugin-dts": "^6.1.1",
|
|
127
|
-
"styled-components": "^6.1.
|
|
128
|
-
"stylelint": "^16.
|
|
127
|
+
"styled-components": "^6.1.13",
|
|
128
|
+
"stylelint": "^16.9.0",
|
|
129
129
|
"tsup": "^8.2.4",
|
|
130
|
-
"typescript": "^5.
|
|
130
|
+
"typescript": "^5.6.2",
|
|
131
131
|
"zustand": "^4.5.5"
|
|
132
132
|
},
|
|
133
133
|
"peerDependencies": {
|