@codeleap/styles 4.2.18 → 4.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/styles",
3
- "version": "4.2.18",
3
+ "version": "4.3.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": "4.2.18",
12
+ "@codeleap/config": "4.3.0",
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": "4.2.18",
3
+ "version": "4.3.0",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -30,7 +30,7 @@ export class CodeleapStyleRegistry {
30
30
 
31
31
  this.registerCommonVariants()
32
32
 
33
- const currentColorScheme = this.theme?.current?.['currentColorScheme'] ?? this.theme?.colorScheme ?? 'default'
33
+ const currentColorScheme = this.theme?.current?.['currentColorScheme']?.() ?? this.theme?.colorScheme ?? 'default'
34
34
 
35
35
  this.styleCache.registerBaseKey([currentColorScheme, this.theme.current, this.commonVariants])
36
36
  }
@@ -515,7 +515,7 @@ export class CodeleapStyleRegistry {
515
515
  update() {
516
516
  this.theme = themeStore.getState()
517
517
 
518
- const currentColorScheme = this.theme?.current?.['currentColorScheme'] ?? this.theme?.colorScheme ?? 'default'
518
+ const currentColorScheme = this.theme?.current?.['currentColorScheme']?.() ?? this.theme?.colorScheme ?? 'default'
519
519
 
520
520
  this.styleCache.registerBaseKey([currentColorScheme, this.theme.current, this.commonVariants])
521
521
  }
@@ -24,9 +24,10 @@ export const createTheme = <T extends Theme>(theme: T, colorSchemaPersistor: Col
24
24
  ...otherThemeValues
25
25
  } = theme
26
26
 
27
- const themeObj:AppTheme<T> = {
27
+ const themeObj: AppTheme<T> = {
28
28
  ...otherThemeValues,
29
- get currentColorScheme(): string {
29
+
30
+ currentColorScheme() {
30
31
  return themeStore.getState().colorScheme
31
32
  },
32
33
 
package/src/lib/hooks.ts CHANGED
@@ -26,9 +26,9 @@ export function useNestedStylesByKey<T extends string>(match: string, componentS
26
26
  }, [styles])
27
27
  }
28
28
 
29
- type ThemeSelector<T extends Record<string, any>> = (store: ThemeStore) => T
29
+ type ThemeSelector<T = Record<string, any>> = (store: ThemeStore) => T
30
30
 
31
- export const useTheme = <T extends Record<string, any>>(selector: ThemeSelector<T>): T => {
31
+ export const useTheme = <T = Record<string, any>>(selector: ThemeSelector<T>): T => {
32
32
  return themeStore(useShallow(selector))
33
33
  }
34
34
 
@@ -69,7 +69,7 @@ type PredefinedThemeDerivedValues<T extends Theme> = {
69
69
 
70
70
  type PredefinedAppTheme<T extends Theme> = PredefinedThemeDerivedValues<T> & {
71
71
  setColorScheme: (colorScheme: ColorScheme<T>) => void
72
- currentColorScheme: ColorScheme<T>
72
+ currentColorScheme: () => ColorScheme<T>
73
73
  spacing: SpacingMap
74
74
  media: MediaQueries
75
75
  border: BorderCreator