@codeleap/styles 5.4.4 → 5.5.0
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/package.json +2 -2
- package/package.json.bak +1 -1
- package/src/lib/dynamicVariants.ts +7 -5
- package/src/types/style.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/styles",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/styles"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/config": "5.
|
|
12
|
+
"@codeleap/config": "5.5.0",
|
|
13
13
|
"ts-node-dev": "^1.1.8"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
package/package.json.bak
CHANGED
|
@@ -22,14 +22,16 @@ export type Value =
|
|
|
22
22
|
| number
|
|
23
23
|
| ''
|
|
24
24
|
|
|
25
|
+
type Color = string // keyof IColors
|
|
26
|
+
|
|
25
27
|
export type DynamicVariants =
|
|
26
|
-
`color:${
|
|
28
|
+
`color:${Color}` |
|
|
27
29
|
`border${Capitalize<typeof borderDirection[number]>}Width:${keyof IBorderRadius}` |
|
|
28
|
-
`border${Capitalize<typeof borderDirection[number]>}Color:${
|
|
30
|
+
`border${Capitalize<typeof borderDirection[number]>}Color:${Color}` |
|
|
29
31
|
`borderRadius:${keyof IBorderRadius}` |
|
|
30
32
|
`border${Capitalize<typeof borderYDirection[number]>}${Capitalize<typeof borderXDirection[number]>}Radius:${keyof IBorderRadius}` |
|
|
31
33
|
`cursor:${typeof cursorTypes[number]}` |
|
|
32
|
-
`bg:${
|
|
34
|
+
`bg:${Color}` |
|
|
33
35
|
`br:${keyof IBorderRadius}` |
|
|
34
36
|
`scale:${Value}`
|
|
35
37
|
|
|
@@ -41,7 +43,7 @@ export const createDynamicVariants = () => {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
colorVariants.forEach(variant => {
|
|
44
|
-
createVariant(variant, (theme, color:
|
|
46
|
+
createVariant(variant, (theme, color: Color) => ({
|
|
45
47
|
[variant]: theme.baseColors[color],
|
|
46
48
|
}))
|
|
47
49
|
})
|
|
@@ -68,7 +70,7 @@ export const createDynamicVariants = () => {
|
|
|
68
70
|
|
|
69
71
|
createVariant('cursor', (theme, cursor: typeof cursorTypes[number]) => ({ cursor }))
|
|
70
72
|
|
|
71
|
-
createVariant('bg', (theme, color:
|
|
73
|
+
createVariant('bg', (theme, color: Color) => ({
|
|
72
74
|
backgroundColor: theme.baseColors[color],
|
|
73
75
|
}))
|
|
74
76
|
|
package/src/types/style.ts
CHANGED
|
@@ -59,3 +59,5 @@ export type VariantStyleSheet = Record<string, any>
|
|
|
59
59
|
export type StyledProp<T extends string> = StyleProp<Record<T, ICSS>>
|
|
60
60
|
|
|
61
61
|
export type StyleAggregator<T extends string = any> = (theme: ITheme, style: Record< T, ICSS>) => Record< T, ICSS>
|
|
62
|
+
|
|
63
|
+
export type StyleRecord<K extends string> = Record<K, ICSS>
|