teacss 0.1.20 → 0.2.0-alpha.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/dist/index.cjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/stitches.cjs +4 -13
- package/dist/stitches.d.mts +1 -1
- package/dist/stitches.d.ts +1 -1
- package/dist/stitches.mjs +3 -3
- package/dist/unocss.cjs +10 -10
- package/dist/unocss.mjs +6 -6
- package/package.json +12 -12
- package/types/config.d.ts +218 -0
- package/types/css-util.d.ts +79 -0
- package/types/css.d.ts +9655 -0
- package/types/index.d.ts +80 -0
- package/types/stitches.d.ts +197 -0
- package/types/styled-component.d.ts +146 -0
- package/types/theme.d.ts +43 -0
- package/types/util.d.ts +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teacss",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
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,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"./*": "./*"
|
|
65
65
|
},
|
|
66
|
-
"files": ["dist", "README.md"],
|
|
66
|
+
"files": ["dist", "types", "README.md"],
|
|
67
67
|
"scripts": {
|
|
68
68
|
"prepublishOnly": "bun run build",
|
|
69
69
|
"build": "bunx rimraf dist && bun run build:esm && bun run build:bun && rollup -c",
|
|
@@ -95,36 +95,36 @@
|
|
|
95
95
|
"tailwind-merge": "^2.5.2"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@biomejs/biome": "1.
|
|
98
|
+
"@biomejs/biome": "1.9.0",
|
|
99
99
|
"@devjskit/biome-config": "^0.1.6",
|
|
100
100
|
"@devjskit/copy-files": "^1.0.0",
|
|
101
101
|
"@devjskit/cross-env": "^1.0.0",
|
|
102
102
|
"@devjskit/kill-port": "^1.0.0",
|
|
103
103
|
"@devjskit/rimraf": "^1.0.0",
|
|
104
|
-
"@happy-dom/global-registrator": "^15.7.
|
|
105
|
-
"@rsbuild/core": "^0.
|
|
106
|
-
"@rsbuild/plugin-react": "^0.
|
|
107
|
-
"@rsbuild/plugin-svgr": "^0.
|
|
108
|
-
"@tanstack/react-query": "^5.
|
|
109
|
-
"@tanstack/react-query-devtools": "^5.
|
|
104
|
+
"@happy-dom/global-registrator": "^15.7.4",
|
|
105
|
+
"@rsbuild/core": "^1.0.4",
|
|
106
|
+
"@rsbuild/plugin-react": "^1.0.2",
|
|
107
|
+
"@rsbuild/plugin-svgr": "^1.0.2",
|
|
108
|
+
"@tanstack/react-query": "^5.56.2",
|
|
109
|
+
"@tanstack/react-query-devtools": "^5.56.2",
|
|
110
110
|
"@types/bun": "^1.1.9",
|
|
111
111
|
"@types/postcss-import": "^14.0.3",
|
|
112
112
|
"@types/react": "^18.3.5",
|
|
113
113
|
"@types/react-dom": "^18.3.0",
|
|
114
|
-
"@types/web": "^0.0.
|
|
114
|
+
"@types/web": "^0.0.163",
|
|
115
115
|
"cpy-cli": "^5.0.0",
|
|
116
116
|
"cypress": "^13.14.2",
|
|
117
117
|
"cypress-real-events": "^1.13.0",
|
|
118
118
|
"ky": "^1.7.2",
|
|
119
119
|
"nprogress": "^0.2.0",
|
|
120
|
-
"postcss": "^8.4.
|
|
120
|
+
"postcss": "^8.4.47",
|
|
121
121
|
"postcss-cli": "^11.0.0",
|
|
122
122
|
"react": "^18.3.1",
|
|
123
123
|
"react-dom": "^18.3.1",
|
|
124
124
|
"react-hook-form": "^7.53.0",
|
|
125
125
|
"react-intl": "^6.6.8",
|
|
126
126
|
"react-router-dom": "^6.26.2",
|
|
127
|
-
"rollup": "^4.21.
|
|
127
|
+
"rollup": "^4.21.3",
|
|
128
128
|
"rollup-plugin-dts": "^6.1.1",
|
|
129
129
|
"styled-components": "^6.1.13",
|
|
130
130
|
"stylelint": "^16.9.0",
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type * as CSSUtil from "./css-util";
|
|
2
|
+
import type Stitches from "./stitches";
|
|
3
|
+
|
|
4
|
+
/** Configuration Interface */
|
|
5
|
+
declare namespace ConfigType {
|
|
6
|
+
/** Prefix interface. */
|
|
7
|
+
export type Prefix<T = ""> = T extends string ? T : string;
|
|
8
|
+
|
|
9
|
+
/** Media interface. */
|
|
10
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
11
|
+
export type Media<T = {}> = {
|
|
12
|
+
[name in keyof T]: T[name] extends string ? T[name] : string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Theme interface. */
|
|
16
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
17
|
+
export type Theme<T = {}> = {
|
|
18
|
+
borderStyles?: { [token in number | string]: boolean | number | string };
|
|
19
|
+
borderWidths?: { [token in number | string]: boolean | number | string };
|
|
20
|
+
colors?: { [token in number | string]: boolean | number | string };
|
|
21
|
+
fonts?: { [token in number | string]: boolean | number | string };
|
|
22
|
+
fontSizes?: { [token in number | string]: boolean | number | string };
|
|
23
|
+
fontWeights?: { [token in number | string]: boolean | number | string };
|
|
24
|
+
letterSpacings?: { [token in number | string]: boolean | number | string };
|
|
25
|
+
lineHeights?: { [token in number | string]: boolean | number | string };
|
|
26
|
+
radii?: { [token in number | string]: boolean | number | string };
|
|
27
|
+
shadows?: { [token in number | string]: boolean | number | string };
|
|
28
|
+
sizes?: { [token in number | string]: boolean | number | string };
|
|
29
|
+
space?: { [token in number | string]: boolean | number | string };
|
|
30
|
+
transitions?: { [token in number | string]: boolean | number | string };
|
|
31
|
+
zIndices?: { [token in number | string]: boolean | number | string };
|
|
32
|
+
} & {
|
|
33
|
+
[Scale in keyof T]: {
|
|
34
|
+
[Token in keyof T[Scale]]: T[Scale][Token] extends boolean | number | string ? T[Scale][Token] : boolean | number | string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** ThemeMap interface. */
|
|
39
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
40
|
+
export type ThemeMap<T = {}> = {
|
|
41
|
+
[Property in keyof T]: T[Property] extends string ? T[Property] : string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Utility interface. */
|
|
45
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
46
|
+
export type Utils<T = {}> = {
|
|
47
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
48
|
+
[Property in keyof T]: T[Property] extends (value: infer V) => {}
|
|
49
|
+
?
|
|
50
|
+
| T[Property]
|
|
51
|
+
| ((value: V) => {
|
|
52
|
+
[K in keyof CSSUtil.CSSProperties]?: CSSUtil.CSSProperties[K] | V;
|
|
53
|
+
})
|
|
54
|
+
: never;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Default ThemeMap. */
|
|
59
|
+
export interface DefaultThemeMap {
|
|
60
|
+
gap: "space";
|
|
61
|
+
gridGap: "space";
|
|
62
|
+
columnGap: "space";
|
|
63
|
+
gridColumnGap: "space";
|
|
64
|
+
rowGap: "space";
|
|
65
|
+
gridRowGap: "space";
|
|
66
|
+
inset: "space";
|
|
67
|
+
insetBlock: "space";
|
|
68
|
+
insetBlockEnd: "space";
|
|
69
|
+
insetBlockStart: "space";
|
|
70
|
+
insetInline: "space";
|
|
71
|
+
insetInlineEnd: "space";
|
|
72
|
+
insetInlineStart: "space";
|
|
73
|
+
margin: "space";
|
|
74
|
+
marginTop: "space";
|
|
75
|
+
marginRight: "space";
|
|
76
|
+
marginBottom: "space";
|
|
77
|
+
marginLeft: "space";
|
|
78
|
+
marginBlock: "space";
|
|
79
|
+
marginBlockEnd: "space";
|
|
80
|
+
marginBlockStart: "space";
|
|
81
|
+
marginInline: "space";
|
|
82
|
+
marginInlineEnd: "space";
|
|
83
|
+
marginInlineStart: "space";
|
|
84
|
+
padding: "space";
|
|
85
|
+
paddingTop: "space";
|
|
86
|
+
paddingRight: "space";
|
|
87
|
+
paddingBottom: "space";
|
|
88
|
+
paddingLeft: "space";
|
|
89
|
+
paddingBlock: "space";
|
|
90
|
+
paddingBlockEnd: "space";
|
|
91
|
+
paddingBlockStart: "space";
|
|
92
|
+
paddingInline: "space";
|
|
93
|
+
paddingInlineEnd: "space";
|
|
94
|
+
paddingInlineStart: "space";
|
|
95
|
+
scrollMargin: "space";
|
|
96
|
+
scrollMarginTop: "space";
|
|
97
|
+
scrollMarginRight: "space";
|
|
98
|
+
scrollMarginBottom: "space";
|
|
99
|
+
scrollMarginLeft: "space";
|
|
100
|
+
scrollMarginBlock: "space";
|
|
101
|
+
scrollMarginBlockEnd: "space";
|
|
102
|
+
scrollMarginBlockStart: "space";
|
|
103
|
+
scrollMarginInline: "space";
|
|
104
|
+
scrollMarginInlineEnd: "space";
|
|
105
|
+
scrollMarginInlineStart: "space";
|
|
106
|
+
scrollPadding: "space";
|
|
107
|
+
scrollPaddingTop: "space";
|
|
108
|
+
scrollPaddingRight: "space";
|
|
109
|
+
scrollPaddingBottom: "space";
|
|
110
|
+
scrollPaddingLeft: "space";
|
|
111
|
+
scrollPaddingBlock: "space";
|
|
112
|
+
scrollPaddingBlockEnd: "space";
|
|
113
|
+
scrollPaddingBlockStart: "space";
|
|
114
|
+
scrollPaddingInline: "space";
|
|
115
|
+
scrollPaddingInlineEnd: "space";
|
|
116
|
+
scrollPaddingInlineStart: "space";
|
|
117
|
+
top: "space";
|
|
118
|
+
right: "space";
|
|
119
|
+
bottom: "space";
|
|
120
|
+
left: "space";
|
|
121
|
+
|
|
122
|
+
fontSize: "fontSizes";
|
|
123
|
+
|
|
124
|
+
background: "colors";
|
|
125
|
+
backgroundColor: "colors";
|
|
126
|
+
backgroundImage: "colors";
|
|
127
|
+
borderImage: "colors";
|
|
128
|
+
border: "colors";
|
|
129
|
+
borderBlock: "colors";
|
|
130
|
+
borderBlockEnd: "colors";
|
|
131
|
+
borderBlockStart: "colors";
|
|
132
|
+
borderBottom: "colors";
|
|
133
|
+
borderBottomColor: "colors";
|
|
134
|
+
borderColor: "colors";
|
|
135
|
+
borderInline: "colors";
|
|
136
|
+
borderInlineEnd: "colors";
|
|
137
|
+
borderInlineStart: "colors";
|
|
138
|
+
borderLeft: "colors";
|
|
139
|
+
borderLeftColor: "colors";
|
|
140
|
+
borderRight: "colors";
|
|
141
|
+
borderRightColor: "colors";
|
|
142
|
+
borderTop: "colors";
|
|
143
|
+
borderTopColor: "colors";
|
|
144
|
+
caretColor: "colors";
|
|
145
|
+
color: "colors";
|
|
146
|
+
columnRuleColor: "colors";
|
|
147
|
+
outline: "colors";
|
|
148
|
+
outlineColor: "colors";
|
|
149
|
+
fill: "colors";
|
|
150
|
+
stroke: "colors";
|
|
151
|
+
textDecorationColor: "colors";
|
|
152
|
+
|
|
153
|
+
fontFamily: "fonts";
|
|
154
|
+
|
|
155
|
+
fontWeight: "fontWeights";
|
|
156
|
+
lineHeight: "lineHeights";
|
|
157
|
+
|
|
158
|
+
letterSpacing: "letterSpacings";
|
|
159
|
+
|
|
160
|
+
blockSize: "sizes";
|
|
161
|
+
minBlockSize: "sizes";
|
|
162
|
+
maxBlockSize: "sizes";
|
|
163
|
+
inlineSize: "sizes";
|
|
164
|
+
minInlineSize: "sizes";
|
|
165
|
+
maxInlineSize: "sizes";
|
|
166
|
+
width: "sizes";
|
|
167
|
+
minWidth: "sizes";
|
|
168
|
+
maxWidth: "sizes";
|
|
169
|
+
height: "sizes";
|
|
170
|
+
minHeight: "sizes";
|
|
171
|
+
maxHeight: "sizes";
|
|
172
|
+
flexBasis: "sizes";
|
|
173
|
+
gridTemplateColumns: "sizes";
|
|
174
|
+
gridTemplateRows: "sizes";
|
|
175
|
+
|
|
176
|
+
borderWidth: "borderWidths";
|
|
177
|
+
borderTopWidth: "borderWidths";
|
|
178
|
+
borderLeftWidth: "borderWidths";
|
|
179
|
+
borderRightWidth: "borderWidths";
|
|
180
|
+
borderBottomWidth: "borderWidths";
|
|
181
|
+
|
|
182
|
+
borderStyle: "borderStyles";
|
|
183
|
+
borderTopStyle: "borderStyles";
|
|
184
|
+
borderLeftStyle: "borderStyles";
|
|
185
|
+
borderRightStyle: "borderStyles";
|
|
186
|
+
borderBottomStyle: "borderStyles";
|
|
187
|
+
|
|
188
|
+
borderRadius: "radii";
|
|
189
|
+
borderTopLeftRadius: "radii";
|
|
190
|
+
borderTopRightRadius: "radii";
|
|
191
|
+
borderBottomRightRadius: "radii";
|
|
192
|
+
borderBottomLeftRadius: "radii";
|
|
193
|
+
|
|
194
|
+
boxShadow: "shadows";
|
|
195
|
+
textShadow: "shadows";
|
|
196
|
+
|
|
197
|
+
transition: "transitions";
|
|
198
|
+
|
|
199
|
+
zIndex: "zIndices";
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Returns a function used to create a new Stitches interface. */
|
|
203
|
+
export type CreateStitches = <
|
|
204
|
+
Prefix extends string = "",
|
|
205
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
206
|
+
Media extends {} = {},
|
|
207
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
208
|
+
Theme extends {} = {},
|
|
209
|
+
ThemeMap extends {} = DefaultThemeMap,
|
|
210
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
211
|
+
Utils extends {} = {},
|
|
212
|
+
>(config?: {
|
|
213
|
+
prefix?: ConfigType.Prefix<Prefix>;
|
|
214
|
+
media?: ConfigType.Media<Media>;
|
|
215
|
+
theme?: ConfigType.Theme<Theme>;
|
|
216
|
+
themeMap?: ConfigType.ThemeMap<ThemeMap>;
|
|
217
|
+
utils?: ConfigType.Utils<Utils>;
|
|
218
|
+
}) => Stitches<Prefix, Media, Theme, ThemeMap, Utils>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type * as Config from "./config";
|
|
2
|
+
import type * as Native from "./css";
|
|
3
|
+
import type * as ThemeUtil from "./theme";
|
|
4
|
+
import type * as Util from "./util";
|
|
5
|
+
|
|
6
|
+
export type { Native };
|
|
7
|
+
|
|
8
|
+
/** CSS style declaration object. */
|
|
9
|
+
export interface CSSProperties extends Native.StandardLonghandProperties, Native.StandardShorthandProperties, Native.SvgProperties {}
|
|
10
|
+
|
|
11
|
+
type ValueByPropertyName<PropertyName> = PropertyName extends keyof CSSProperties ? CSSProperties[PropertyName] : never;
|
|
12
|
+
|
|
13
|
+
type TokenByPropertyName<PropertyName, Theme, ThemeMap> = PropertyName extends keyof ThemeMap ? TokenByScaleName<ThemeMap[PropertyName], Theme> : never;
|
|
14
|
+
|
|
15
|
+
type TokenByScaleName<ScaleName, Theme> = ScaleName extends keyof Theme ? Util.Prefixed<"$", keyof Theme[ScaleName]> : never;
|
|
16
|
+
|
|
17
|
+
/** Returns a Style interface, leveraging the given media and style map. */
|
|
18
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
19
|
+
export type CSS<Media = {}, Theme = {}, ThemeMap = Config.DefaultThemeMap, Utils = {}> = {
|
|
20
|
+
// nested at-rule css styles
|
|
21
|
+
[K in Util.Prefixed<"@", keyof Media>]?: CSS<Media, Theme, ThemeMap, Utils>;
|
|
22
|
+
} & {
|
|
23
|
+
// known property styles
|
|
24
|
+
[K in keyof CSSProperties]?:
|
|
25
|
+
| ValueByPropertyName<K>
|
|
26
|
+
| TokenByPropertyName<K, Theme, ThemeMap>
|
|
27
|
+
| Native.Globals
|
|
28
|
+
| ThemeUtil.ScaleValue
|
|
29
|
+
| Util.Index
|
|
30
|
+
| undefined;
|
|
31
|
+
} & {
|
|
32
|
+
// known utility styles
|
|
33
|
+
[K in keyof Utils as K extends keyof CSSProperties ? never : K]?: Utils[K] extends (arg: infer P) => any
|
|
34
|
+
?
|
|
35
|
+
| (P extends any[]
|
|
36
|
+
?
|
|
37
|
+
| ($$PropertyValue extends keyof P[0]
|
|
38
|
+
?
|
|
39
|
+
| ValueByPropertyName<P[0][$$PropertyValue]>
|
|
40
|
+
| TokenByPropertyName<P[0][$$PropertyValue], Theme, ThemeMap>
|
|
41
|
+
| Native.Globals
|
|
42
|
+
| ThemeUtil.ScaleValue
|
|
43
|
+
| undefined
|
|
44
|
+
: $$ScaleValue extends keyof P[0]
|
|
45
|
+
? TokenByScaleName<P[0][$$ScaleValue], Theme> | { scale: P[0][$$ScaleValue] } | undefined
|
|
46
|
+
: never)[]
|
|
47
|
+
| P
|
|
48
|
+
: $$PropertyValue extends keyof P
|
|
49
|
+
? ValueByPropertyName<P[$$PropertyValue]> | TokenByPropertyName<P[$$PropertyValue], Theme, ThemeMap> | Native.Globals | undefined
|
|
50
|
+
: $$ScaleValue extends keyof P
|
|
51
|
+
? TokenByScaleName<P[$$ScaleValue], Theme> | { scale: P[$$ScaleValue] } | undefined
|
|
52
|
+
: never)
|
|
53
|
+
| P
|
|
54
|
+
: never;
|
|
55
|
+
} & {
|
|
56
|
+
// known theme styles
|
|
57
|
+
[K in keyof ThemeMap as K extends keyof CSSProperties ? never : K extends keyof Utils ? never : K]?: Native.Globals | Util.Index | undefined;
|
|
58
|
+
} & {
|
|
59
|
+
// unknown css declaration styles
|
|
60
|
+
/** Unknown property. */
|
|
61
|
+
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
62
|
+
[K: string]: number | string | CSS<Media, Theme, ThemeMap, Utils> | {} | undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** Unique symbol used to reference a property value. */
|
|
66
|
+
export declare const $$PropertyValue: any;
|
|
67
|
+
|
|
68
|
+
/** Unique symbol used to reference a property value. */
|
|
69
|
+
export type $$PropertyValue = typeof $$PropertyValue;
|
|
70
|
+
|
|
71
|
+
/** Unique symbol used to reference a token value. */
|
|
72
|
+
export declare const $$ScaleValue: unique symbol;
|
|
73
|
+
|
|
74
|
+
/** Unique symbol used to reference a token value. */
|
|
75
|
+
export type $$ScaleValue = typeof $$ScaleValue;
|
|
76
|
+
|
|
77
|
+
export declare const $$ThemeValue: unique symbol;
|
|
78
|
+
|
|
79
|
+
export type $$ThemeValue = typeof $$ThemeValue;
|