teacss 0.2.0-alpha.0 → 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.
@@ -6278,4 +6278,4 @@ declare const css: Stitches["css"];
6278
6278
  /** Returns a function that applies styles and variants for a specific class. */
6279
6279
  declare const styled: Stitches["styled"];
6280
6280
 
6281
- export { $$PropertyValue, $$ScaleValue, $$ThemeValue, type CSS, type CSSProperties, type ComponentProps, type CreateStitches, type DefaultThemeMap, type PropertyValue, type ScaleValue, type VariantProps, createStitches, createTheme, css, defaultThemeMap, globalCss, keyframes, styled };
6281
+ export { $$PropertyValue, $$ScaleValue, $$ThemeValue, type CSS, type CSSProperties, type ComponentProps, type CreateStitches, type DefaultThemeMap, type PropertyValue, type ScaleValue, type StyledComponent, type VariantProps, createStitches, createTheme, css, defaultThemeMap, globalCss, keyframes, styled };
@@ -6278,4 +6278,4 @@ declare const css: Stitches["css"];
6278
6278
  /** Returns a function that applies styles and variants for a specific class. */
6279
6279
  declare const styled: Stitches["styled"];
6280
6280
 
6281
- export { $$PropertyValue, $$ScaleValue, $$ThemeValue, type CSS, type CSSProperties, type ComponentProps, type CreateStitches, type DefaultThemeMap, type PropertyValue, type ScaleValue, type VariantProps, createStitches, createTheme, css, defaultThemeMap, globalCss, keyframes, styled };
6281
+ export { $$PropertyValue, $$ScaleValue, $$ThemeValue, type CSS, type CSSProperties, type ComponentProps, type CreateStitches, type DefaultThemeMap, type PropertyValue, type ScaleValue, type StyledComponent, type VariantProps, createStitches, createTheme, css, defaultThemeMap, globalCss, keyframes, styled };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teacss",
3
- "version": "0.2.0-alpha.0",
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",
@@ -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;