@codeleap/styles 5.7.0 → 5.7.1

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.7.0",
3
+ "version": "5.7.1",
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.7.0",
12
+ "@codeleap/config": "5.7.1",
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.7.0",
3
+ "version": "5.7.1",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -95,6 +95,17 @@ export const createTheme = <T extends Theme>(theme: T, themePersistor: ThemePers
95
95
 
96
96
  themePersistor.set(alternateColorsKey, unpersistedAlternateColors)
97
97
  },
98
+ ejectColorScheme(name) {
99
+ themeStore.ejectColorScheme(name)
100
+
101
+ const persistedAlternateColors = themePersistor.get(alternateColorsKey)
102
+
103
+ if (name in persistedAlternateColors) {
104
+ delete persistedAlternateColors[name]
105
+ }
106
+
107
+ themePersistor.set(alternateColorsKey, persistedAlternateColors)
108
+ },
98
109
 
99
110
  baseSpacing: theme.baseSpacing,
100
111
 
@@ -56,11 +56,11 @@ class ThemeStore {
56
56
  private getBaseColorScheme(): ColorMap {
57
57
  const alternateColors = this.alternateColorsScheme ?? {}
58
58
  const colorSchemeKeys = Object.keys(alternateColors)
59
-
59
+
60
60
  if (colorSchemeKeys.length === 0) {
61
61
  return {}
62
62
  }
63
-
63
+
64
64
  return alternateColors[colorSchemeKeys[0]] ?? {}
65
65
  }
66
66
 
@@ -74,20 +74,32 @@ class ThemeStore {
74
74
  [name]: {
75
75
  ...baseColors,
76
76
  ...colors,
77
- }
77
+ },
78
78
  }
79
-
79
+
80
80
  this.setAlternateColorsScheme(alternateColors)
81
81
 
82
82
  return alternateColors
83
83
  }
84
+
85
+ ejectColorScheme(name:string) {
86
+ const currentAlternateColors = this.alternateColorsScheme ?? {}
87
+
88
+ if (name in currentAlternateColors) {
89
+ delete currentAlternateColors[name]
90
+ }
91
+
92
+ this.setAlternateColorsScheme(currentAlternateColors)
93
+
94
+ return currentAlternateColors
95
+ }
84
96
  }
85
97
 
86
98
  export const themeStore = new ThemeStore()
87
99
 
88
100
  export const themeStoreComputed = computed([
89
- themeStore['themeStore'],
90
- themeStore['colorSchemeStore'],
101
+ themeStore.themeStore,
102
+ themeStore.colorSchemeStore,
91
103
  ], (theme, colorScheme) => ({
92
104
  theme: theme as unknown as AppTheme<Theme>,
93
105
  colorScheme,
@@ -78,6 +78,7 @@ type PredefinedAppTheme<T extends Theme> = PredefinedThemeDerivedValues<T> & {
78
78
  setColorScheme: (colorScheme: string) => void
79
79
  currentColorScheme: () => ColorScheme<T>
80
80
  injectColorScheme: (name: string, colorMap: ColorMap) => void
81
+ ejectColorScheme: (name: string) => void
81
82
  spacing: SpacingMap
82
83
  media: MediaQueries
83
84
  border: BorderCreator