@codeleap/styles 4.2.17 → 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 +3 -3
- package/package.json.bak +2 -2
- package/src/lib/StyleRegistry.ts +2 -2
- package/src/lib/createTheme.ts +3 -2
- package/src/lib/hooks.ts +2 -2
- package/src/types/theme.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/styles",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"directory": "packages/styles"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/config": "4.
|
|
12
|
+
"@codeleap/config": "4.3.0",
|
|
13
13
|
"ts-node-dev": "1.1.8"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "echo
|
|
16
|
+
"build": "echo 'No build needed'",
|
|
17
17
|
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
|
|
18
18
|
"test": "./node_modules/.bin/mocha --require ts-node/register src/tests/**/*.spec.ts",
|
|
19
19
|
"run-sc": "tsnd --transpile-only",
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/styles",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"ts-node-dev": "1.1.8"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "echo
|
|
16
|
+
"build": "echo 'No build needed'",
|
|
17
17
|
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
|
|
18
18
|
"test": "./node_modules/.bin/mocha --require ts-node/register src/tests/**/*.spec.ts",
|
|
19
19
|
"run-sc": "tsnd --transpile-only",
|
package/src/lib/StyleRegistry.ts
CHANGED
|
@@ -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
|
}
|
package/src/lib/createTheme.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
29
|
+
type ThemeSelector<T = Record<string, any>> = (store: ThemeStore) => T
|
|
30
30
|
|
|
31
|
-
export const useTheme = <T
|
|
31
|
+
export const useTheme = <T = Record<string, any>>(selector: ThemeSelector<T>): T => {
|
|
32
32
|
return themeStore(useShallow(selector))
|
|
33
33
|
}
|
|
34
34
|
|
package/src/types/theme.ts
CHANGED
|
@@ -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
|