css-engine-test-pb 0.1.5 → 0.1.7
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/compiler.d.ts +2 -0
- package/dist/compiler.js +40 -4
- package/dist/index.d.ts +23 -1
- package/dist/index.js +24 -2
- package/dist/makeStaticStyles.js +29 -3
- package/dist/makeStyles.d.ts +3 -1
- package/dist/shorthands/border.d.ts +2 -0
- package/dist/shorthands/border.js +32 -0
- package/dist/shorthands/borderBottom.d.ts +2 -0
- package/dist/shorthands/borderBottom.js +29 -0
- package/dist/shorthands/borderLeft.d.ts +2 -0
- package/dist/shorthands/borderLeft.js +29 -0
- package/dist/shorthands/borderRadius.d.ts +2 -0
- package/dist/shorthands/borderRadius.js +8 -0
- package/dist/shorthands/borderRight.d.ts +2 -0
- package/dist/shorthands/borderRight.js +29 -0
- package/dist/shorthands/borderStyle.d.ts +2 -0
- package/dist/shorthands/borderStyle.js +8 -0
- package/dist/shorthands/borderTop.d.ts +2 -0
- package/dist/shorthands/borderTop.js +29 -0
- package/dist/shorthands/borderWidth.d.ts +2 -0
- package/dist/shorthands/borderWidth.js +8 -0
- package/dist/shorthands/flex.d.ts +2 -0
- package/dist/shorthands/flex.js +49 -0
- package/dist/shorthands/gap.d.ts +2 -0
- package/dist/shorthands/gap.js +6 -0
- package/dist/shorthands/gridArea.d.ts +2 -0
- package/dist/shorthands/gridArea.js +8 -0
- package/dist/shorthands/index.d.ts +22 -0
- package/dist/shorthands/index.js +22 -0
- package/dist/shorthands/inset.d.ts +2 -0
- package/dist/shorthands/inset.js +8 -0
- package/dist/shorthands/margin.d.ts +2 -0
- package/dist/shorthands/margin.js +8 -0
- package/dist/shorthands/marginBlock.d.ts +2 -0
- package/dist/shorthands/marginBlock.js +6 -0
- package/dist/shorthands/marginInline.d.ts +2 -0
- package/dist/shorthands/marginInline.js +6 -0
- package/dist/shorthands/outline.d.ts +2 -0
- package/dist/shorthands/outline.js +7 -0
- package/dist/shorthands/overflow.d.ts +2 -0
- package/dist/shorthands/overflow.js +6 -0
- package/dist/shorthands/padding.d.ts +2 -0
- package/dist/shorthands/padding.js +8 -0
- package/dist/shorthands/paddingBlock.d.ts +2 -0
- package/dist/shorthands/paddingBlock.js +6 -0
- package/dist/shorthands/paddingInline.d.ts +2 -0
- package/dist/shorthands/paddingInline.js +6 -0
- package/dist/shorthands/textDecoration.d.ts +2 -0
- package/dist/shorthands/textDecoration.js +23 -0
- package/dist/shorthands/transition.d.ts +4 -0
- package/dist/shorthands/transition.js +37 -0
- package/dist/types.d.ts +122 -38
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +3 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
package/dist/compiler.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export declare class StyleCompiler {
|
|
|
11
11
|
private compileMonolithic;
|
|
12
12
|
private buildCSSBlock;
|
|
13
13
|
private buildMonolithicPseudos;
|
|
14
|
+
private buildMonolithicCombinators;
|
|
14
15
|
private buildMonolithicMedia;
|
|
15
16
|
private processProperties;
|
|
16
17
|
private processPseudos;
|
|
18
|
+
private processCombinators;
|
|
17
19
|
private processMediaQueries;
|
|
18
20
|
}
|
|
19
21
|
export {};
|
package/dist/compiler.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleBucket } from './types';
|
|
2
2
|
import { createClassName, hashString } from './utils/hash';
|
|
3
|
-
import { camelToKebab, isPseudoSelector, isMediaQuery, determineBucket } from './utils';
|
|
3
|
+
import { camelToKebab, isPseudoSelector, isMediaQuery, isCombinator, determineBucket } from './utils';
|
|
4
4
|
export class StyleCompiler {
|
|
5
5
|
compile(styleDefinition, mode = 'atomic') {
|
|
6
6
|
if (mode === 'monolithic') {
|
|
@@ -12,6 +12,7 @@ export class StyleCompiler {
|
|
|
12
12
|
const rules = [];
|
|
13
13
|
this.processProperties(styleDefinition, rules);
|
|
14
14
|
this.processPseudos(styleDefinition, rules);
|
|
15
|
+
this.processCombinators(styleDefinition, rules);
|
|
15
16
|
this.processMediaQueries(styleDefinition, rules);
|
|
16
17
|
return rules;
|
|
17
18
|
}
|
|
@@ -24,6 +25,7 @@ export class StyleCompiler {
|
|
|
24
25
|
cssText += `.${className} { ${mainStyles} }\n`;
|
|
25
26
|
}
|
|
26
27
|
cssText += this.buildMonolithicPseudos(styleDefinition, className);
|
|
28
|
+
cssText += this.buildMonolithicCombinators(styleDefinition, className);
|
|
27
29
|
cssText += this.buildMonolithicMedia(styleDefinition, className);
|
|
28
30
|
return [{
|
|
29
31
|
className,
|
|
@@ -34,7 +36,7 @@ export class StyleCompiler {
|
|
|
34
36
|
buildCSSBlock(styles) {
|
|
35
37
|
let css = '';
|
|
36
38
|
for (const [property, value] of Object.entries(styles)) {
|
|
37
|
-
if (isPseudoSelector(property) || isMediaQuery(property)) {
|
|
39
|
+
if (isPseudoSelector(property) || isMediaQuery(property) || isCombinator(property)) {
|
|
38
40
|
continue;
|
|
39
41
|
}
|
|
40
42
|
if (value === undefined || value === null) {
|
|
@@ -66,6 +68,19 @@ export class StyleCompiler {
|
|
|
66
68
|
}
|
|
67
69
|
return css;
|
|
68
70
|
}
|
|
71
|
+
buildMonolithicCombinators(styleDefinition, className) {
|
|
72
|
+
let css = '';
|
|
73
|
+
for (const [key, value] of Object.entries(styleDefinition)) {
|
|
74
|
+
if (isCombinator(key) && value) {
|
|
75
|
+
const combinatorStyles = this.buildCSSBlock(value);
|
|
76
|
+
if (combinatorStyles) {
|
|
77
|
+
const selector = key.replace('&', `.${className}`);
|
|
78
|
+
css += `${selector} { ${combinatorStyles} }\n`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return css;
|
|
83
|
+
}
|
|
69
84
|
buildMonolithicMedia(styleDefinition, className) {
|
|
70
85
|
let css = '';
|
|
71
86
|
for (const [key, value] of Object.entries(styleDefinition)) {
|
|
@@ -92,6 +107,13 @@ export class StyleCompiler {
|
|
|
92
107
|
}
|
|
93
108
|
}
|
|
94
109
|
}
|
|
110
|
+
else if (isCombinator(nestedKey) && nestedValue) {
|
|
111
|
+
const combinatorStyles = this.buildCSSBlock(nestedValue);
|
|
112
|
+
if (combinatorStyles) {
|
|
113
|
+
const selector = nestedKey.replace('&', `.${className}`);
|
|
114
|
+
mediaCss += `${selector} { ${combinatorStyles} }\n`;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
95
117
|
}
|
|
96
118
|
if (mediaCss) {
|
|
97
119
|
css += `${key} {\n${mediaCss}}\n`;
|
|
@@ -102,7 +124,7 @@ export class StyleCompiler {
|
|
|
102
124
|
}
|
|
103
125
|
processProperties(styles, rules, pseudo, media) {
|
|
104
126
|
Object.entries(styles).forEach(([property, value]) => {
|
|
105
|
-
if (isPseudoSelector(property) || isMediaQuery(property)) {
|
|
127
|
+
if (isPseudoSelector(property) || isMediaQuery(property) || isCombinator(property)) {
|
|
106
128
|
return;
|
|
107
129
|
}
|
|
108
130
|
if (value === undefined || value === null) {
|
|
@@ -112,7 +134,11 @@ export class StyleCompiler {
|
|
|
112
134
|
const hashInput = `${kebabProperty}:${value}${pseudo || ''}${media || ''}`;
|
|
113
135
|
const className = createClassName(hashInput);
|
|
114
136
|
let selector;
|
|
115
|
-
if (pseudo && pseudo.
|
|
137
|
+
if (pseudo && pseudo.startsWith('& ')) {
|
|
138
|
+
// It's a combinator - replace & with class
|
|
139
|
+
selector = pseudo.replace('&', `.${className}`);
|
|
140
|
+
}
|
|
141
|
+
else if (pseudo && pseudo.includes(',')) {
|
|
116
142
|
const selectors = pseudo
|
|
117
143
|
.split(',')
|
|
118
144
|
.map(s => `.${className}${s.trim()}`)
|
|
@@ -142,6 +168,13 @@ export class StyleCompiler {
|
|
|
142
168
|
}
|
|
143
169
|
});
|
|
144
170
|
}
|
|
171
|
+
processCombinators(styleDefinition, rules) {
|
|
172
|
+
Object.entries(styleDefinition).forEach(([key, value]) => {
|
|
173
|
+
if (isCombinator(key) && value) {
|
|
174
|
+
this.processProperties(value, rules, key);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
145
178
|
processMediaQueries(styleDefinition, rules) {
|
|
146
179
|
Object.entries(styleDefinition).forEach(([key, value]) => {
|
|
147
180
|
if (isMediaQuery(key) && value) {
|
|
@@ -151,6 +184,9 @@ export class StyleCompiler {
|
|
|
151
184
|
if (isPseudoSelector(nestedKey) && nestedValue) {
|
|
152
185
|
this.processProperties(nestedValue, rules, nestedKey, key);
|
|
153
186
|
}
|
|
187
|
+
else if (isCombinator(nestedKey) && nestedValue) {
|
|
188
|
+
this.processProperties(nestedValue, rules, nestedKey, key);
|
|
189
|
+
}
|
|
154
190
|
});
|
|
155
191
|
}
|
|
156
192
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import { borderColor } from './shorthands';
|
|
1
|
+
import { border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderStyle, borderWidth, borderRadius, flex, gap, gridArea, inset, margin, marginBlock, marginInline, outline, overflow, padding, paddingBlock, paddingInline, textDecoration, transition } from './shorthands';
|
|
2
2
|
export declare const shorthands: {
|
|
3
|
+
border: typeof border;
|
|
4
|
+
borderTop: typeof borderTop;
|
|
5
|
+
borderRight: typeof borderRight;
|
|
6
|
+
borderBottom: typeof borderBottom;
|
|
7
|
+
borderLeft: typeof borderLeft;
|
|
3
8
|
borderColor: typeof borderColor;
|
|
9
|
+
borderStyle: typeof borderStyle;
|
|
10
|
+
borderWidth: typeof borderWidth;
|
|
11
|
+
borderRadius: typeof borderRadius;
|
|
12
|
+
flex: typeof flex;
|
|
13
|
+
gap: typeof gap;
|
|
14
|
+
gridArea: typeof gridArea;
|
|
15
|
+
inset: typeof inset;
|
|
16
|
+
margin: typeof margin;
|
|
17
|
+
marginBlock: typeof marginBlock;
|
|
18
|
+
marginInline: typeof marginInline;
|
|
19
|
+
outline: typeof outline;
|
|
20
|
+
overflow: typeof overflow;
|
|
21
|
+
padding: typeof padding;
|
|
22
|
+
paddingBlock: typeof paddingBlock;
|
|
23
|
+
paddingInline: typeof paddingInline;
|
|
24
|
+
textDecoration: typeof textDecoration;
|
|
25
|
+
transition: typeof transition;
|
|
4
26
|
};
|
|
5
27
|
export { makeStyles } from './makeStyles';
|
|
6
28
|
export { makeResetStyles } from './makeResetStyles';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import { borderColor } from './shorthands';
|
|
1
|
+
import { border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderStyle, borderWidth, borderRadius, flex, gap, gridArea, inset, margin, marginBlock, marginInline, outline, overflow, padding, paddingBlock, paddingInline, textDecoration, transition, } from './shorthands';
|
|
2
2
|
export const shorthands = {
|
|
3
|
-
|
|
3
|
+
border,
|
|
4
|
+
borderTop,
|
|
5
|
+
borderRight,
|
|
6
|
+
borderBottom,
|
|
7
|
+
borderLeft,
|
|
8
|
+
borderColor,
|
|
9
|
+
borderStyle,
|
|
10
|
+
borderWidth,
|
|
11
|
+
borderRadius,
|
|
12
|
+
flex,
|
|
13
|
+
gap,
|
|
14
|
+
gridArea,
|
|
15
|
+
inset,
|
|
16
|
+
margin,
|
|
17
|
+
marginBlock,
|
|
18
|
+
marginInline,
|
|
19
|
+
outline,
|
|
20
|
+
overflow,
|
|
21
|
+
padding,
|
|
22
|
+
paddingBlock,
|
|
23
|
+
paddingInline,
|
|
24
|
+
textDecoration,
|
|
25
|
+
transition,
|
|
4
26
|
};
|
|
5
27
|
export { makeStyles } from './makeStyles';
|
|
6
28
|
export { makeResetStyles } from './makeResetStyles';
|
package/dist/makeStaticStyles.js
CHANGED
|
@@ -10,15 +10,20 @@ export function makeStaticStyles(styles) {
|
|
|
10
10
|
}
|
|
11
11
|
stylesArray.forEach(styleBlock => {
|
|
12
12
|
Object.entries(styleBlock).forEach(([selector, properties]) => {
|
|
13
|
+
const isFontFace = selector === '@font-face';
|
|
13
14
|
const cssProperties = Object.entries(properties)
|
|
14
15
|
.map(([prop, value]) => {
|
|
15
16
|
const kebabProp = prop.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
|
|
16
|
-
|
|
17
|
+
let cssValue = String(value);
|
|
18
|
+
// Quote font-family values that contain spaces and aren't already quoted
|
|
19
|
+
if (kebabProp === 'font-family' && typeof value === 'string') {
|
|
20
|
+
cssValue = quoteFontFamily(value);
|
|
21
|
+
}
|
|
22
|
+
return `${kebabProp}: ${cssValue};`;
|
|
17
23
|
})
|
|
18
24
|
.join(' ');
|
|
19
25
|
let cssRule;
|
|
20
|
-
|
|
21
|
-
if (selector === '@font-face') {
|
|
26
|
+
if (isFontFace) {
|
|
22
27
|
cssRule = `@font-face { ${cssProperties} }`;
|
|
23
28
|
}
|
|
24
29
|
else {
|
|
@@ -30,3 +35,24 @@ export function makeStaticStyles(styles) {
|
|
|
30
35
|
inserted = true;
|
|
31
36
|
};
|
|
32
37
|
}
|
|
38
|
+
function quoteFontFamily(value) {
|
|
39
|
+
// Handle comma-separated font stacks
|
|
40
|
+
return value.split(',').map(font => {
|
|
41
|
+
font = font.trim();
|
|
42
|
+
// Already quoted
|
|
43
|
+
if ((font.startsWith('"') && font.endsWith('"')) ||
|
|
44
|
+
(font.startsWith("'") && font.endsWith("'"))) {
|
|
45
|
+
return font;
|
|
46
|
+
}
|
|
47
|
+
// Generic families don't need quotes
|
|
48
|
+
const genericFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui', 'ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded', 'inherit', 'initial', 'unset'];
|
|
49
|
+
if (genericFamilies.includes(font.toLowerCase())) {
|
|
50
|
+
return font;
|
|
51
|
+
}
|
|
52
|
+
// Quote if contains spaces or special characters
|
|
53
|
+
if (/[\s\-()]/.test(font)) {
|
|
54
|
+
return `"${font}"`;
|
|
55
|
+
}
|
|
56
|
+
return font;
|
|
57
|
+
}).join(', ');
|
|
58
|
+
}
|
package/dist/makeStyles.d.ts
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { borderWidth } from './borderWidth';
|
|
2
|
+
import { borderStyle } from './borderStyle';
|
|
3
|
+
import { borderColor } from './borderColor';
|
|
4
|
+
const BORDER_STYLES = ['dashed', 'dotted', 'double', 'groove', 'hidden', 'inset', 'none', 'outset', 'ridge', 'solid'];
|
|
5
|
+
function isBorderStyleValue(value) {
|
|
6
|
+
return typeof value === 'string' && BORDER_STYLES.includes(value);
|
|
7
|
+
}
|
|
8
|
+
export function border(width, style, color) {
|
|
9
|
+
if (style === undefined && color === undefined) {
|
|
10
|
+
if (isBorderStyleValue(width)) {
|
|
11
|
+
return borderStyle(width);
|
|
12
|
+
}
|
|
13
|
+
return borderWidth(width);
|
|
14
|
+
}
|
|
15
|
+
if (color === undefined) {
|
|
16
|
+
if (isBorderStyleValue(width)) {
|
|
17
|
+
return {
|
|
18
|
+
...borderStyle(width),
|
|
19
|
+
...borderColor(style),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
...borderWidth(width),
|
|
24
|
+
...borderStyle(style),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...borderWidth(width),
|
|
29
|
+
...borderStyle(style),
|
|
30
|
+
...borderColor(color),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const BORDER_STYLES = ['dashed', 'dotted', 'double', 'groove', 'hidden', 'inset', 'none', 'outset', 'ridge', 'solid'];
|
|
2
|
+
function isBorderStyle(value) {
|
|
3
|
+
return typeof value === 'string' && BORDER_STYLES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function borderBottom(width, style, color) {
|
|
6
|
+
if (style === undefined && color === undefined) {
|
|
7
|
+
if (isBorderStyle(width)) {
|
|
8
|
+
return { borderBottomStyle: width };
|
|
9
|
+
}
|
|
10
|
+
return { borderBottomWidth: width };
|
|
11
|
+
}
|
|
12
|
+
if (color === undefined) {
|
|
13
|
+
if (isBorderStyle(width)) {
|
|
14
|
+
return {
|
|
15
|
+
borderBottomStyle: width,
|
|
16
|
+
borderBottomColor: style,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
borderBottomWidth: width,
|
|
21
|
+
borderBottomStyle: style,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
borderBottomWidth: width,
|
|
26
|
+
borderBottomStyle: style,
|
|
27
|
+
borderBottomColor: color,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const BORDER_STYLES = ['dashed', 'dotted', 'double', 'groove', 'hidden', 'inset', 'none', 'outset', 'ridge', 'solid'];
|
|
2
|
+
function isBorderStyle(value) {
|
|
3
|
+
return typeof value === 'string' && BORDER_STYLES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function borderLeft(width, style, color) {
|
|
6
|
+
if (style === undefined && color === undefined) {
|
|
7
|
+
if (isBorderStyle(width)) {
|
|
8
|
+
return { borderLeftStyle: width };
|
|
9
|
+
}
|
|
10
|
+
return { borderLeftWidth: width };
|
|
11
|
+
}
|
|
12
|
+
if (color === undefined) {
|
|
13
|
+
if (isBorderStyle(width)) {
|
|
14
|
+
return {
|
|
15
|
+
borderLeftStyle: width,
|
|
16
|
+
borderLeftColor: style,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
borderLeftWidth: width,
|
|
21
|
+
borderLeftStyle: style,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
borderLeftWidth: width,
|
|
26
|
+
borderLeftStyle: style,
|
|
27
|
+
borderLeftColor: color,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function borderRadius(topLeft, topRight = topLeft, bottomRight = topLeft, bottomLeft = topRight) {
|
|
2
|
+
return {
|
|
3
|
+
borderTopLeftRadius: topLeft,
|
|
4
|
+
borderTopRightRadius: topRight,
|
|
5
|
+
borderBottomRightRadius: bottomRight,
|
|
6
|
+
borderBottomLeftRadius: bottomLeft,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const BORDER_STYLES = ['dashed', 'dotted', 'double', 'groove', 'hidden', 'inset', 'none', 'outset', 'ridge', 'solid'];
|
|
2
|
+
function isBorderStyle(value) {
|
|
3
|
+
return typeof value === 'string' && BORDER_STYLES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function borderRight(width, style, color) {
|
|
6
|
+
if (style === undefined && color === undefined) {
|
|
7
|
+
if (isBorderStyle(width)) {
|
|
8
|
+
return { borderRightStyle: width };
|
|
9
|
+
}
|
|
10
|
+
return { borderRightWidth: width };
|
|
11
|
+
}
|
|
12
|
+
if (color === undefined) {
|
|
13
|
+
if (isBorderStyle(width)) {
|
|
14
|
+
return {
|
|
15
|
+
borderRightStyle: width,
|
|
16
|
+
borderRightColor: style,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
borderRightWidth: width,
|
|
21
|
+
borderRightStyle: style,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
borderRightWidth: width,
|
|
26
|
+
borderRightStyle: style,
|
|
27
|
+
borderRightColor: color,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const BORDER_STYLES = ['dashed', 'dotted', 'double', 'groove', 'hidden', 'inset', 'none', 'outset', 'ridge', 'solid'];
|
|
2
|
+
function isBorderStyle(value) {
|
|
3
|
+
return typeof value === 'string' && BORDER_STYLES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function borderTop(width, style, color) {
|
|
6
|
+
if (style === undefined && color === undefined) {
|
|
7
|
+
if (isBorderStyle(width)) {
|
|
8
|
+
return { borderTopStyle: width };
|
|
9
|
+
}
|
|
10
|
+
return { borderTopWidth: width };
|
|
11
|
+
}
|
|
12
|
+
if (color === undefined) {
|
|
13
|
+
if (isBorderStyle(width)) {
|
|
14
|
+
return {
|
|
15
|
+
borderTopStyle: width,
|
|
16
|
+
borderTopColor: style,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
borderTopWidth: width,
|
|
21
|
+
borderTopStyle: style,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
borderTopWidth: width,
|
|
26
|
+
borderTopStyle: style,
|
|
27
|
+
borderTopColor: color,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const WIDTH_KEYWORDS = ['max-content', 'min-content', 'fit-content', 'content'];
|
|
2
|
+
function isUnitless(value) {
|
|
3
|
+
return typeof value === 'number' || (typeof value === 'string' && /^[0-9.]+$/.test(value));
|
|
4
|
+
}
|
|
5
|
+
function isWidth(value) {
|
|
6
|
+
if (typeof value === 'number')
|
|
7
|
+
return false;
|
|
8
|
+
if (typeof value === 'string') {
|
|
9
|
+
if (WIDTH_KEYWORDS.includes(value))
|
|
10
|
+
return true;
|
|
11
|
+
if (/^[0-9.]+(%|px|em|rem|vh|vw|ch|ex|cm|mm|in|pt|pc|vmin|vmax)$/.test(value))
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
export function flex(grow, shrinkOrBasis, basis) {
|
|
17
|
+
// Single value
|
|
18
|
+
if (shrinkOrBasis === undefined && basis === undefined) {
|
|
19
|
+
if (grow === 'initial') {
|
|
20
|
+
return { flexGrow: 0, flexShrink: 1, flexBasis: 'auto' };
|
|
21
|
+
}
|
|
22
|
+
if (grow === 'auto') {
|
|
23
|
+
return { flexGrow: 1, flexShrink: 1, flexBasis: 'auto' };
|
|
24
|
+
}
|
|
25
|
+
if (grow === 'none') {
|
|
26
|
+
return { flexGrow: 0, flexShrink: 0, flexBasis: 'auto' };
|
|
27
|
+
}
|
|
28
|
+
if (isUnitless(grow)) {
|
|
29
|
+
return { flexGrow: grow, flexShrink: 1, flexBasis: 0 };
|
|
30
|
+
}
|
|
31
|
+
if (isWidth(grow)) {
|
|
32
|
+
return { flexGrow: 1, flexShrink: 1, flexBasis: grow };
|
|
33
|
+
}
|
|
34
|
+
return { flexGrow: grow };
|
|
35
|
+
}
|
|
36
|
+
// Two values
|
|
37
|
+
if (basis === undefined) {
|
|
38
|
+
if (isUnitless(shrinkOrBasis)) {
|
|
39
|
+
return { flexGrow: grow, flexShrink: shrinkOrBasis };
|
|
40
|
+
}
|
|
41
|
+
return { flexGrow: grow, flexShrink: 1, flexBasis: shrinkOrBasis };
|
|
42
|
+
}
|
|
43
|
+
// Three values
|
|
44
|
+
return {
|
|
45
|
+
flexGrow: grow,
|
|
46
|
+
flexShrink: shrinkOrBasis,
|
|
47
|
+
flexBasis: basis,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1 +1,23 @@
|
|
|
1
|
+
export { border } from './border';
|
|
2
|
+
export { borderTop } from './borderTop';
|
|
3
|
+
export { borderRight } from './borderRight';
|
|
4
|
+
export { borderBottom } from './borderBottom';
|
|
5
|
+
export { borderLeft } from './borderLeft';
|
|
1
6
|
export { borderColor } from './borderColor';
|
|
7
|
+
export { borderStyle } from './borderStyle';
|
|
8
|
+
export { borderWidth } from './borderWidth';
|
|
9
|
+
export { borderRadius } from './borderRadius';
|
|
10
|
+
export { flex } from './flex';
|
|
11
|
+
export { gap } from './gap';
|
|
12
|
+
export { gridArea } from './gridArea';
|
|
13
|
+
export { inset } from './inset';
|
|
14
|
+
export { margin } from './margin';
|
|
15
|
+
export { marginBlock } from './marginBlock';
|
|
16
|
+
export { marginInline } from './marginInline';
|
|
17
|
+
export { outline } from './outline';
|
|
18
|
+
export { overflow } from './overflow';
|
|
19
|
+
export { padding } from './padding';
|
|
20
|
+
export { paddingBlock } from './paddingBlock';
|
|
21
|
+
export { paddingInline } from './paddingInline';
|
|
22
|
+
export { textDecoration } from './textDecoration';
|
|
23
|
+
export { transition } from './transition';
|
package/dist/shorthands/index.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
+
export { border } from './border';
|
|
2
|
+
export { borderTop } from './borderTop';
|
|
3
|
+
export { borderRight } from './borderRight';
|
|
4
|
+
export { borderBottom } from './borderBottom';
|
|
5
|
+
export { borderLeft } from './borderLeft';
|
|
1
6
|
export { borderColor } from './borderColor';
|
|
7
|
+
export { borderStyle } from './borderStyle';
|
|
8
|
+
export { borderWidth } from './borderWidth';
|
|
9
|
+
export { borderRadius } from './borderRadius';
|
|
10
|
+
export { flex } from './flex';
|
|
11
|
+
export { gap } from './gap';
|
|
12
|
+
export { gridArea } from './gridArea';
|
|
13
|
+
export { inset } from './inset';
|
|
14
|
+
export { margin } from './margin';
|
|
15
|
+
export { marginBlock } from './marginBlock';
|
|
16
|
+
export { marginInline } from './marginInline';
|
|
17
|
+
export { outline } from './outline';
|
|
18
|
+
export { overflow } from './overflow';
|
|
19
|
+
export { padding } from './padding';
|
|
20
|
+
export { paddingBlock } from './paddingBlock';
|
|
21
|
+
export { paddingInline } from './paddingInline';
|
|
22
|
+
export { textDecoration } from './textDecoration';
|
|
23
|
+
export { transition } from './transition';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const TEXT_DECORATION_STYLES = ['dashed', 'dotted', 'double', 'solid', 'wavy'];
|
|
2
|
+
function isTextDecorationStyle(value) {
|
|
3
|
+
return typeof value === 'string' && TEXT_DECORATION_STYLES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function textDecoration(line, style, color, thickness) {
|
|
6
|
+
// Handle case where first arg is a style (for backward compat)
|
|
7
|
+
if (style === undefined && isTextDecorationStyle(line)) {
|
|
8
|
+
return { textDecorationStyle: line };
|
|
9
|
+
}
|
|
10
|
+
const result = {
|
|
11
|
+
textDecorationLine: line,
|
|
12
|
+
};
|
|
13
|
+
if (style !== undefined) {
|
|
14
|
+
result.textDecorationStyle = style;
|
|
15
|
+
}
|
|
16
|
+
if (color !== undefined) {
|
|
17
|
+
result.textDecorationColor = color;
|
|
18
|
+
}
|
|
19
|
+
if (thickness !== undefined) {
|
|
20
|
+
result.textDecorationThickness = thickness;
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const GLOBAL_VALUES = ['inherit', 'initial', 'revert', 'revert-layer', 'unset'];
|
|
2
|
+
function isGlobalValue(value) {
|
|
3
|
+
return typeof value === 'string' && GLOBAL_VALUES.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function transition(...args) {
|
|
6
|
+
// Handle global values
|
|
7
|
+
if (args.length === 1 && !Array.isArray(args[0]) && isGlobalValue(args[0])) {
|
|
8
|
+
const value = args[0];
|
|
9
|
+
return {
|
|
10
|
+
transitionProperty: value,
|
|
11
|
+
transitionDuration: value,
|
|
12
|
+
transitionDelay: value,
|
|
13
|
+
transitionTimingFunction: value,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// Normalize inputs
|
|
17
|
+
const transitions = Array.isArray(args[0])
|
|
18
|
+
? args
|
|
19
|
+
: [args];
|
|
20
|
+
const properties = [];
|
|
21
|
+
const durations = [];
|
|
22
|
+
const delays = [];
|
|
23
|
+
const timings = [];
|
|
24
|
+
for (const t of transitions) {
|
|
25
|
+
const [property, duration = '0s', delay = '0s', timing = 'ease'] = t;
|
|
26
|
+
properties.push(property);
|
|
27
|
+
durations.push(duration);
|
|
28
|
+
delays.push(delay);
|
|
29
|
+
timings.push(timing);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
transitionProperty: properties.join(', '),
|
|
33
|
+
transitionDuration: durations.join(', '),
|
|
34
|
+
transitionDelay: delays.join(', '),
|
|
35
|
+
transitionTimingFunction: timings.join(', '),
|
|
36
|
+
};
|
|
37
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
export type CSSValue = string | number;
|
|
2
|
+
type CSSGlobals = 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset';
|
|
3
|
+
type CSSDisplay = 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'grid' | 'inline-grid' | 'flow-root' | 'none' | 'contents' | 'table' | 'table-row' | 'list-item' | CSSGlobals | (string & {});
|
|
4
|
+
type CSSPosition = 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky' | CSSGlobals | (string & {});
|
|
5
|
+
type CSSBoxSizing = 'content-box' | 'border-box' | CSSGlobals | (string & {});
|
|
6
|
+
type CSSFlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse' | CSSGlobals | (string & {});
|
|
7
|
+
type CSSFlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse' | CSSGlobals | (string & {});
|
|
8
|
+
type CSSJustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'start' | 'end' | 'stretch' | CSSGlobals | (string & {});
|
|
9
|
+
type CSSAlignItems = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch' | 'start' | 'end' | 'self-start' | 'self-end' | CSSGlobals | (string & {});
|
|
10
|
+
type CSSAlignContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'start' | 'end' | 'baseline' | CSSGlobals | (string & {});
|
|
11
|
+
type CSSAlignSelf = 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch' | 'start' | 'end' | 'self-start' | 'self-end' | CSSGlobals | (string & {});
|
|
12
|
+
type CSSVerticalAlign = 'baseline' | 'sub' | 'super' | 'text-top' | 'text-bottom' | 'middle' | 'top' | 'bottom' | 'center' | CSSGlobals | (string & {});
|
|
13
|
+
type CSSOverflow = 'visible' | 'hidden' | 'clip' | 'scroll' | 'auto' | CSSGlobals | (string & {});
|
|
14
|
+
type CSSTextAlign = 'left' | 'right' | 'center' | 'justify' | 'start' | 'end' | CSSGlobals | (string & {});
|
|
15
|
+
type CSSTextTransform = 'none' | 'capitalize' | 'uppercase' | 'lowercase' | 'full-width' | 'full-size-kana' | CSSGlobals | (string & {});
|
|
16
|
+
type CSSTextDecorationLine = 'none' | 'underline' | 'overline' | 'line-through' | 'blink' | CSSGlobals | (string & {});
|
|
17
|
+
type CSSTextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy' | CSSGlobals | (string & {});
|
|
18
|
+
type CSSWhiteSpace = 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line' | 'break-spaces' | CSSGlobals | (string & {});
|
|
19
|
+
type CSSWordBreak = 'normal' | 'break-all' | 'keep-all' | 'break-word' | CSSGlobals | (string & {});
|
|
20
|
+
type CSSTextOverflow = 'clip' | 'ellipsis' | CSSGlobals | (string & {});
|
|
21
|
+
type CSSBorderStyle = 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | CSSGlobals | (string & {});
|
|
22
|
+
type CSSOutlineStyle = 'auto' | 'none' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | CSSGlobals | (string & {});
|
|
23
|
+
type CSSCursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'all-scroll' | 'col-resize' | 'row-resize' | 'n-resize' | 'e-resize' | 's-resize' | 'w-resize' | 'ne-resize' | 'nw-resize' | 'se-resize' | 'sw-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'zoom-in' | 'zoom-out' | CSSGlobals | (string & {});
|
|
24
|
+
type CSSPointerEvents = 'auto' | 'none' | 'visiblePainted' | 'visibleFill' | 'visibleStroke' | 'visible' | 'painted' | 'fill' | 'stroke' | 'all' | CSSGlobals | (string & {});
|
|
25
|
+
type CSSVisibility = 'visible' | 'hidden' | 'collapse' | CSSGlobals | (string & {});
|
|
26
|
+
type CSSBackgroundSize = 'auto' | 'cover' | 'contain' | CSSGlobals | (string & {});
|
|
27
|
+
type CSSBackgroundPosition = 'top' | 'right' | 'bottom' | 'left' | 'center' | CSSGlobals | (string & {});
|
|
28
|
+
type CSSBackgroundRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round' | CSSGlobals | (string & {});
|
|
29
|
+
type CSSAnimationDirection = 'normal' | 'reverse' | 'alternate' | 'alternate-reverse' | CSSGlobals | (string & {});
|
|
30
|
+
type CSSAnimationFillMode = 'none' | 'forwards' | 'backwards' | 'both' | CSSGlobals | (string & {});
|
|
31
|
+
type CSSAnimationPlayState = 'running' | 'paused' | CSSGlobals | (string & {});
|
|
32
|
+
type CSSAnimationTimingFunction = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step-start' | 'step-end' | CSSGlobals | (string & {});
|
|
33
|
+
type CSSFontWeight = 100 | 200 | 300 | 400 | 450 | 500 | 530 | 600 | 700 | 800 | 900 | 'normal' | 'bold' | 'bolder' | 'lighter' | CSSGlobals | (string & {}) | (number & {});
|
|
34
|
+
type CSSFontStyle = 'normal' | 'italic' | 'oblique' | CSSGlobals | (string & {});
|
|
2
35
|
export interface CSSProperties {
|
|
3
|
-
display?:
|
|
4
|
-
position?:
|
|
36
|
+
display?: CSSDisplay;
|
|
37
|
+
position?: CSSPosition;
|
|
5
38
|
top?: CSSValue;
|
|
6
39
|
right?: CSSValue;
|
|
7
40
|
bottom?: CSSValue;
|
|
@@ -12,88 +45,130 @@ export interface CSSProperties {
|
|
|
12
45
|
minHeight?: CSSValue;
|
|
13
46
|
maxWidth?: CSSValue;
|
|
14
47
|
maxHeight?: CSSValue;
|
|
15
|
-
boxSizing?:
|
|
48
|
+
boxSizing?: CSSBoxSizing;
|
|
16
49
|
flex?: CSSValue;
|
|
17
|
-
flexDirection?:
|
|
18
|
-
flexWrap?:
|
|
50
|
+
flexDirection?: CSSFlexDirection;
|
|
51
|
+
flexWrap?: CSSFlexWrap;
|
|
19
52
|
flexGrow?: CSSValue;
|
|
20
53
|
flexShrink?: CSSValue;
|
|
21
54
|
flexBasis?: CSSValue;
|
|
22
|
-
justifyContent?:
|
|
23
|
-
alignItems?:
|
|
24
|
-
alignContent?:
|
|
25
|
-
alignSelf?:
|
|
26
|
-
verticalAlign?:
|
|
55
|
+
justifyContent?: CSSJustifyContent;
|
|
56
|
+
alignItems?: CSSAlignItems;
|
|
57
|
+
alignContent?: CSSAlignContent;
|
|
58
|
+
alignSelf?: CSSAlignSelf;
|
|
59
|
+
verticalAlign?: CSSVerticalAlign;
|
|
27
60
|
order?: CSSValue;
|
|
28
61
|
gap?: CSSValue;
|
|
29
62
|
gridTemplateColumns?: CSSValue;
|
|
30
63
|
gridTemplateRows?: CSSValue;
|
|
31
64
|
gridColumn?: CSSValue;
|
|
32
65
|
gridRow?: CSSValue;
|
|
66
|
+
gridArea?: CSSValue;
|
|
67
|
+
gridRowStart?: CSSValue;
|
|
68
|
+
gridRowEnd?: CSSValue;
|
|
69
|
+
gridColumnStart?: CSSValue;
|
|
70
|
+
gridColumnEnd?: CSSValue;
|
|
71
|
+
columnGap?: CSSValue;
|
|
72
|
+
rowGap?: CSSValue;
|
|
33
73
|
margin?: CSSValue;
|
|
34
74
|
marginTop?: CSSValue;
|
|
35
75
|
marginRight?: CSSValue;
|
|
36
76
|
marginBottom?: CSSValue;
|
|
37
77
|
marginLeft?: CSSValue;
|
|
78
|
+
marginBlock?: CSSValue;
|
|
79
|
+
marginBlockStart?: CSSValue;
|
|
80
|
+
marginBlockEnd?: CSSValue;
|
|
81
|
+
marginInline?: CSSValue;
|
|
82
|
+
marginInlineStart?: CSSValue;
|
|
83
|
+
marginInlineEnd?: CSSValue;
|
|
38
84
|
padding?: CSSValue;
|
|
39
85
|
paddingTop?: CSSValue;
|
|
40
86
|
paddingRight?: CSSValue;
|
|
41
87
|
paddingBottom?: CSSValue;
|
|
42
88
|
paddingLeft?: CSSValue;
|
|
89
|
+
paddingBlock?: CSSValue;
|
|
90
|
+
paddingBlockStart?: CSSValue;
|
|
91
|
+
paddingBlockEnd?: CSSValue;
|
|
92
|
+
paddingInline?: CSSValue;
|
|
93
|
+
paddingInlineStart?: CSSValue;
|
|
94
|
+
paddingInlineEnd?: CSSValue;
|
|
95
|
+
inset?: CSSValue;
|
|
43
96
|
color?: CSSValue;
|
|
44
97
|
fontSize?: CSSValue;
|
|
45
|
-
fontWeight?:
|
|
98
|
+
fontWeight?: CSSFontWeight;
|
|
99
|
+
fontStyle?: CSSFontStyle;
|
|
46
100
|
fontFamily?: CSSValue;
|
|
47
101
|
lineHeight?: CSSValue;
|
|
48
|
-
textAlign?:
|
|
102
|
+
textAlign?: CSSTextAlign;
|
|
49
103
|
textDecoration?: CSSValue;
|
|
50
|
-
textDecorationLine?:
|
|
51
|
-
|
|
104
|
+
textDecorationLine?: CSSTextDecorationLine;
|
|
105
|
+
textDecorationStyle?: CSSTextDecorationStyle;
|
|
106
|
+
textDecorationColor?: CSSValue;
|
|
107
|
+
textDecorationThickness?: CSSValue;
|
|
108
|
+
textTransform?: CSSTextTransform;
|
|
109
|
+
textOverflow?: CSSTextOverflow;
|
|
110
|
+
whiteSpace?: CSSWhiteSpace;
|
|
111
|
+
wordBreak?: CSSWordBreak;
|
|
52
112
|
letterSpacing?: CSSValue;
|
|
53
113
|
background?: CSSValue;
|
|
54
114
|
backgroundColor?: CSSValue;
|
|
55
115
|
backgroundImage?: CSSValue;
|
|
56
|
-
backgroundSize?:
|
|
57
|
-
backgroundPosition?:
|
|
58
|
-
backgroundRepeat?:
|
|
116
|
+
backgroundSize?: CSSBackgroundSize;
|
|
117
|
+
backgroundPosition?: CSSBackgroundPosition;
|
|
118
|
+
backgroundRepeat?: CSSBackgroundRepeat;
|
|
59
119
|
border?: CSSValue;
|
|
60
120
|
borderTop?: CSSValue;
|
|
61
121
|
borderRight?: CSSValue;
|
|
62
122
|
borderBottom?: CSSValue;
|
|
63
123
|
borderLeft?: CSSValue;
|
|
64
124
|
borderWidth?: CSSValue;
|
|
65
|
-
borderStyle?:
|
|
125
|
+
borderStyle?: CSSBorderStyle;
|
|
66
126
|
borderColor?: CSSValue;
|
|
67
127
|
borderRadius?: CSSValue;
|
|
68
128
|
borderTopColor?: CSSValue;
|
|
69
129
|
borderRightColor?: CSSValue;
|
|
70
130
|
borderBottomColor?: CSSValue;
|
|
71
131
|
borderLeftColor?: CSSValue;
|
|
132
|
+
borderTopWidth?: CSSValue;
|
|
133
|
+
borderRightWidth?: CSSValue;
|
|
134
|
+
borderBottomWidth?: CSSValue;
|
|
135
|
+
borderLeftWidth?: CSSValue;
|
|
136
|
+
borderTopStyle?: CSSBorderStyle;
|
|
137
|
+
borderRightStyle?: CSSBorderStyle;
|
|
138
|
+
borderBottomStyle?: CSSBorderStyle;
|
|
139
|
+
borderLeftStyle?: CSSBorderStyle;
|
|
140
|
+
borderTopLeftRadius?: CSSValue;
|
|
141
|
+
borderTopRightRadius?: CSSValue;
|
|
142
|
+
borderBottomRightRadius?: CSSValue;
|
|
143
|
+
borderBottomLeftRadius?: CSSValue;
|
|
72
144
|
opacity?: CSSValue;
|
|
73
|
-
|
|
145
|
+
outline?: CSSValue;
|
|
146
|
+
outlineWidth?: CSSValue;
|
|
147
|
+
outlineStyle?: CSSOutlineStyle;
|
|
148
|
+
outlineColor?: CSSValue;
|
|
74
149
|
boxShadow?: CSSValue;
|
|
75
150
|
transform?: CSSValue;
|
|
76
151
|
transition?: CSSValue;
|
|
77
152
|
transitionDuration?: CSSValue;
|
|
78
153
|
transitionProperty?: CSSValue;
|
|
79
|
-
transitionTimingFunction?:
|
|
154
|
+
transitionTimingFunction?: CSSAnimationTimingFunction;
|
|
80
155
|
transitionDelay?: CSSValue;
|
|
81
156
|
animation?: CSSValue;
|
|
82
157
|
animationDuration?: CSSValue;
|
|
83
|
-
animationTimingFunction?:
|
|
158
|
+
animationTimingFunction?: CSSAnimationTimingFunction;
|
|
84
159
|
animationDelay?: CSSValue;
|
|
85
160
|
animationIterationCount?: CSSValue;
|
|
86
|
-
animationDirection?:
|
|
87
|
-
animationFillMode?:
|
|
88
|
-
animationPlayState?:
|
|
161
|
+
animationDirection?: CSSAnimationDirection;
|
|
162
|
+
animationFillMode?: CSSAnimationFillMode;
|
|
163
|
+
animationPlayState?: CSSAnimationPlayState;
|
|
89
164
|
animationName?: CSSValue;
|
|
90
|
-
overflow?:
|
|
91
|
-
overflowX?:
|
|
92
|
-
overflowY?:
|
|
93
|
-
cursor?:
|
|
94
|
-
pointerEvents?:
|
|
165
|
+
overflow?: CSSOverflow;
|
|
166
|
+
overflowX?: CSSOverflow;
|
|
167
|
+
overflowY?: CSSOverflow;
|
|
168
|
+
cursor?: CSSCursor;
|
|
169
|
+
pointerEvents?: CSSPointerEvents;
|
|
95
170
|
zIndex?: CSSValue;
|
|
96
|
-
visibility?:
|
|
171
|
+
visibility?: CSSVisibility;
|
|
97
172
|
content?: CSSValue;
|
|
98
173
|
}
|
|
99
174
|
export interface CSSPseudos {
|
|
@@ -117,15 +192,23 @@ export interface CSSPseudos {
|
|
|
117
192
|
[key: `${':' | '::'}${string}`]: CSSProperties | undefined;
|
|
118
193
|
}
|
|
119
194
|
export interface CSSMediaQueries {
|
|
120
|
-
'@media (min-width: 480px)'?: CSSProperties & CSSPseudos;
|
|
121
|
-
'@media (min-width: 768px)'?: CSSProperties & CSSPseudos;
|
|
122
|
-
'@media (min-width: 1024px)'?: CSSProperties & CSSPseudos;
|
|
123
|
-
'@media (min-width: 1440px)'?: CSSProperties & CSSPseudos;
|
|
124
|
-
'@media (prefers-color-scheme: dark)'?: CSSProperties & CSSPseudos;
|
|
125
|
-
'@media (prefers-reduced-motion: reduce)'?: CSSProperties & CSSPseudos;
|
|
126
|
-
[key: `@media ${string}`]: (CSSProperties & CSSPseudos) | undefined;
|
|
195
|
+
'@media (min-width: 480px)'?: CSSProperties & CSSPseudos & CSSCombinators;
|
|
196
|
+
'@media (min-width: 768px)'?: CSSProperties & CSSPseudos & CSSCombinators;
|
|
197
|
+
'@media (min-width: 1024px)'?: CSSProperties & CSSPseudos & CSSCombinators;
|
|
198
|
+
'@media (min-width: 1440px)'?: CSSProperties & CSSPseudos & CSSCombinators;
|
|
199
|
+
'@media (prefers-color-scheme: dark)'?: CSSProperties & CSSPseudos & CSSCombinators;
|
|
200
|
+
'@media (prefers-reduced-motion: reduce)'?: CSSProperties & CSSPseudos & CSSCombinators;
|
|
201
|
+
[key: `@media ${string}`]: (CSSProperties & CSSPseudos & CSSCombinators) | undefined;
|
|
202
|
+
}
|
|
203
|
+
export interface CSSCombinators {
|
|
204
|
+
'& > *'?: CSSProperties;
|
|
205
|
+
'& > *:first-child'?: CSSProperties;
|
|
206
|
+
'& > *:last-child'?: CSSProperties;
|
|
207
|
+
'& + *'?: CSSProperties;
|
|
208
|
+
'& ~ *'?: CSSProperties;
|
|
209
|
+
[key: `& ${string}`]: CSSProperties | undefined;
|
|
127
210
|
}
|
|
128
|
-
export type StyleRule = CSSProperties & CSSPseudos & CSSMediaQueries;
|
|
211
|
+
export type StyleRule = CSSProperties & CSSPseudos & CSSMediaQueries & CSSCombinators;
|
|
129
212
|
export type StyleDefinition = StyleRule | (() => StyleRule);
|
|
130
213
|
export declare enum StyleBucket {
|
|
131
214
|
RESET = "d",
|
|
@@ -182,3 +265,4 @@ export interface FontFaceDefinition {
|
|
|
182
265
|
descentOverride?: string;
|
|
183
266
|
lineGapOverride?: string;
|
|
184
267
|
}
|
|
268
|
+
export {};
|
package/dist/utils/css.d.ts
CHANGED
package/dist/utils/css.js
CHANGED
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED