@codeleap/styles 5.0.6 → 5.0.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/styles",
3
- "version": "5.0.6",
3
+ "version": "5.0.8",
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.0.6",
12
+ "@codeleap/config": "5.0.8",
13
13
  "ts-node-dev": "^1.1.8"
14
14
  },
15
15
  "scripts": {
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/styles",
3
- "version": "5.0.6",
3
+ "version": "5.0.8",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -23,7 +23,7 @@ export const borderCreator: BorderCreator = (args) => {
23
23
 
24
24
  const theme = themeStore.getState().current as AppTheme<Theme>
25
25
 
26
- const color = theme?.colors?.[colorKey] ?? colorKey
26
+ const color = theme?.baseColors?.[colorKey] ?? colorKey
27
27
 
28
28
  let borderStyles: ICSS = {}
29
29
 
@@ -16,10 +16,13 @@ export const createTheme = <T extends Theme>(theme: T, colorSchemaPersistor: Col
16
16
  colors,
17
17
  breakpoints,
18
18
  presets,
19
- borderRadius,
19
+ radius,
20
+ stroke,
21
+ size,
20
22
  effects,
21
23
  typography,
22
24
  icons,
25
+ baseColors,
23
26
  values,
24
27
  ...otherThemeValues
25
28
  } = theme
@@ -27,6 +30,8 @@ export const createTheme = <T extends Theme>(theme: T, colorSchemaPersistor: Col
27
30
  const themeObj: AppTheme<T> = {
28
31
  ...otherThemeValues,
29
32
 
33
+ baseColors,
34
+
30
35
  currentColorScheme() {
31
36
  return themeStore.getState().colorScheme
32
37
  },
@@ -37,10 +42,13 @@ export const createTheme = <T extends Theme>(theme: T, colorSchemaPersistor: Col
37
42
  const colorScheme = themeStore.getState().colorScheme
38
43
 
39
44
  if (colorScheme === 'default') return colors
45
+
40
46
  const scheme = theme.alternateColors?.[colorScheme]
47
+
41
48
  if (!scheme) {
42
49
  console.warn(`Color scheme ${colorScheme} not found in theme`)
43
50
  }
51
+
44
52
  return scheme ?? colors
45
53
  },
46
54
 
@@ -73,7 +81,11 @@ export const createTheme = <T extends Theme>(theme: T, colorSchemaPersistor: Col
73
81
  ...presets,
74
82
  },
75
83
 
76
- borderRadius: borderRadius ?? {},
84
+ radius: radius ?? {},
85
+
86
+ stroke: stroke ?? {},
87
+
88
+ size: size ?? {},
77
89
 
78
90
  effects: effects ?? {},
79
91
 
@@ -1,9 +1,6 @@
1
1
  import { ICSS } from '../types'
2
2
 
3
3
  export const defaultVariants = {
4
- inline: {
5
- display: 'inline-block',
6
- },
7
4
  block: {
8
5
  display: 'block',
9
6
  },
@@ -11,9 +8,6 @@ export const defaultVariants = {
11
8
  display: 'flex',
12
9
  flex: 1,
13
10
  },
14
- inlineFlex: {
15
- display: 'inline-flex',
16
- },
17
11
  absolute: {
18
12
  position: 'absolute',
19
13
  },
@@ -26,12 +20,6 @@ export const defaultVariants = {
26
20
  sticky: {
27
21
  position: 'sticky',
28
22
  },
29
- inset: {
30
- top: 0,
31
- right: 0,
32
- bottom: 0,
33
- left: 0,
34
- },
35
23
  insetX: {
36
24
  left: 0,
37
25
  right: 0,
@@ -56,16 +44,6 @@ export const defaultVariants = {
56
44
  fullHeight: {
57
45
  height: '100%',
58
46
  },
59
- fullView: {
60
- width: '100vw',
61
- height: 'calc(100vh - calc(100vh - 100%))',
62
- },
63
- fullViewWidth: {
64
- width: '100vw',
65
- },
66
- fullViewHeight: {
67
- height: 'calc(100vh - calc(100vh - 100%))',
68
- },
69
47
  whole: {
70
48
  top: 0,
71
49
  bottom: 0,
@@ -81,9 +59,6 @@ export const defaultVariants = {
81
59
  display: 'flex',
82
60
  flexDirection: 'row',
83
61
  },
84
- listStyles: {
85
- overflow: 'auto',
86
- },
87
62
  column: {
88
63
  flexDirection: 'column',
89
64
  },
@@ -139,42 +114,9 @@ export const defaultVariants = {
139
114
  textCenter: {
140
115
  textAlign: 'center',
141
116
  },
142
- blur: {
143
- backdropFilter: 'blur(4px)',
144
- '-webkit-backdrop-filter': 'blur(4px)',
145
- transition: '500ms',
146
- },
147
- elevated: {
148
- boxShadow: '0px 0px 16px 16px #aaaaaa1a',
149
- },
150
- neumorphism: {
151
- boxShadow: '10px 10px 20px 0 #AEAEC077, -10px -10px 20px 0 #fff',
152
- },
153
- scrollX: {
154
- overflowX: 'auto',
155
- },
156
- scrollY: {
157
- overflowY: 'auto',
158
- },
159
- scrollXY: {
160
- overflowX: 'auto',
161
- overflowY: 'auto',
162
- },
163
117
  wrap: {
164
118
  flexWrap: 'wrap',
165
119
  },
166
- debRed: {
167
- backgroundColor: '#f00',
168
- },
169
- debGreen: {
170
- backgroundColor: '#0f0',
171
- },
172
- debBlue: {
173
- backgroundColor: '#00f',
174
- },
175
- debYellow: {
176
- backgroundColor: '#f9e902',
177
- },
178
120
  } as const
179
121
 
180
122
  export type DefaultVariants = Record<keyof typeof defaultVariants, ICSS>
@@ -23,7 +23,7 @@ export type Value =
23
23
  | ''
24
24
 
25
25
  export type DynamicVariants =
26
- `${typeof colorVariants[number]}:${keyof IColors}` |
26
+ `color:${keyof IColors}` |
27
27
  `border${Capitalize<typeof borderDirection[number]>}Width:${keyof IBorderRadius}` |
28
28
  `border${Capitalize<typeof borderDirection[number]>}Color:${keyof IColors}` |
29
29
  `borderRadius:${keyof IBorderRadius}` |
@@ -31,11 +31,9 @@ export type DynamicVariants =
31
31
  `cursor:${typeof cursorTypes[number]}` |
32
32
  `bg:${keyof IColors}` |
33
33
  `br:${keyof IBorderRadius}` |
34
- `cl:${keyof IColors}` |
35
34
  `scale:${Value}`
36
35
 
37
36
  export const createDynamicVariants = () => {
38
-
39
37
  const dynamicVariants = {}
40
38
 
41
39
  function createVariant(variantName: string, variantReturn: any) {
@@ -44,7 +42,7 @@ export const createDynamicVariants = () => {
44
42
 
45
43
  colorVariants.forEach(variant => {
46
44
  createVariant(variant, (theme, color: keyof IColors) => ({
47
- [variant]: theme.colors[color],
45
+ [variant]: theme.baseColors[color],
48
46
  }))
49
47
  })
50
48
 
@@ -54,7 +52,7 @@ export const createDynamicVariants = () => {
54
52
  const variant = `border${capitalize(direction)}${capitalize(y)}Radius`
55
53
 
56
54
  createVariant(variant, (theme, value: keyof IBorderRadius) => ({
57
- [variant]: theme.borderRadius[value],
55
+ [variant]: theme.radius[value],
58
56
  }))
59
57
  })
60
58
  }
@@ -63,7 +61,7 @@ export const createDynamicVariants = () => {
63
61
  const variant = `border${capitalize(direction)}${capitalize(property)}`
64
62
 
65
63
  createVariant(variant, (theme, value: string) => ({
66
- [variant]: property == 'color' ? theme.colors[value] : theme.borderRadius[value],
64
+ [variant]: property == 'color' ? theme.baseColors[value] : theme.radius[value],
67
65
  }))
68
66
  })
69
67
  })
@@ -71,11 +69,7 @@ export const createDynamicVariants = () => {
71
69
  createVariant('cursor', (theme, cursor: typeof cursorTypes[number]) => ({ cursor }))
72
70
 
73
71
  createVariant('bg', (theme, color: keyof IColors) => ({
74
- backgroundColor: theme.colors[color],
75
- }))
76
-
77
- createVariant('cl', (theme, color: keyof IColors) => ({
78
- color: theme.colors[color],
72
+ backgroundColor: theme.baseColors[color],
79
73
  }))
80
74
 
81
75
  createVariant('effect', (theme, effect: keyof IEffects) => theme.effects[effect])
@@ -85,11 +79,11 @@ export const createDynamicVariants = () => {
85
79
  }))
86
80
 
87
81
  createVariant('br', (theme, value: keyof IBorderRadius) => ({
88
- borderRadius: theme.borderRadius[value],
82
+ borderRadius: theme.radius[value],
89
83
  }))
90
84
 
91
85
  createVariant('borderRadius', (theme, value: keyof IBorderRadius) => ({
92
- borderRadius: theme.borderRadius[value],
86
+ borderRadius: theme.radius[value],
93
87
  }))
94
88
 
95
89
  return dynamicVariants
@@ -38,6 +38,7 @@ export type InsetMap =
38
38
  }
39
39
 
40
40
  export type Theme = {
41
+ baseColors: ColorMap
41
42
  colors: ColorMap
42
43
  alternateColors?: {
43
44
  [key: string]: ColorMap
@@ -45,7 +46,9 @@ export type Theme = {
45
46
  breakpoints?: BreakpointMap
46
47
  baseSpacing?: number
47
48
  presets?: AnyMap
48
- borderRadius?: AnyMap
49
+ radius?: AnyMap
50
+ stroke?: AnyMap
51
+ size?: AnyMap
49
52
  effects?: EffectsMap
50
53
  typography: AnyMap
51
54
  icons: AnyMap
@@ -58,10 +61,13 @@ export type DefaultColorSchemeName = 'default'
58
61
  export type ColorScheme<T extends Theme = Theme> = DefaultColorSchemeName | keyof T['alternateColors']
59
62
 
60
63
  type PredefinedThemeDerivedValues<T extends Theme> = {
64
+ baseColors: T['baseColors']
61
65
  colors: T['colors']
62
66
  breakpoints: T['breakpoints']
63
67
  presets: DefaultVariants & T['presets']
64
- borderRadius: T['borderRadius']
68
+ radius: T['radius']
69
+ stroke: T['stroke']
70
+ size: T['size']
65
71
  effects: T['effects']
66
72
  typography: T['typography']
67
73
  icons: T['icons']