beathers 5.7.6 → 5.9.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.
Files changed (48) hide show
  1. package/.prettierrc.js +10 -8
  2. package/CHANGELOG +305 -274
  3. package/css/beathers.min.css +2 -2
  4. package/css/beathers.min.css.map +1 -1
  5. package/docs/colors.md +250 -250
  6. package/docs/grid-system.md +130 -130
  7. package/docs/shaping.md +272 -272
  8. package/docs/typography.md +124 -124
  9. package/package.json +107 -105
  10. package/readme.md +301 -301
  11. package/scripts/commands/build.js +4 -4
  12. package/scripts/commands/clean.d.ts +2 -0
  13. package/scripts/commands/clean.d.ts.map +1 -0
  14. package/scripts/commands/clean.js +22 -0
  15. package/scripts/commands/fonts.d.ts.map +1 -1
  16. package/scripts/commands/fonts.js +4 -3
  17. package/scripts/commands/index.js +8 -8
  18. package/scripts/commands/init.js +1 -1
  19. package/scripts/commands/version-update.d.ts +2 -0
  20. package/scripts/commands/version-update.d.ts.map +1 -0
  21. package/scripts/commands/version-update.js +122 -0
  22. package/scripts/commands/version.js +1 -1
  23. package/scripts/helpers/BuildScssVariables.d.ts +1 -1
  24. package/scripts/helpers/BuildScssVariables.d.ts.map +1 -1
  25. package/scripts/helpers/BuildScssVariables.js +20 -10
  26. package/scripts/helpers/LoadUserConfigs.js +1 -1
  27. package/scripts/helpers/ReadDefaultValues.js +20 -20
  28. package/scripts/types.d.ts +1 -1
  29. package/scripts/types.d.ts.map +1 -1
  30. package/scss/_variables.scss +19 -19
  31. package/scss/beathers.min.scss +15 -14
  32. package/scss/functions/_colors.scss +242 -230
  33. package/scss/functions/_mediaQueries.scss +140 -136
  34. package/scss/functions/_others.scss +113 -79
  35. package/scss/functions/_typographic.scss +133 -129
  36. package/scss/functions/_validations.scss +293 -251
  37. package/scss/settings/_configs.scss +270 -270
  38. package/scss/settings/_defaults.scss +209 -214
  39. package/scss/settings/_index.scss +90 -90
  40. package/scss/style/_button.scss +103 -101
  41. package/scss/style/_colors.scss +156 -146
  42. package/scss/style/_dialog.scss +147 -146
  43. package/scss/style/_glass.scss +98 -80
  44. package/scss/style/_grid.scss +121 -95
  45. package/scss/style/_loader.scss +74 -62
  46. package/scss/style/_resets.scss +176 -168
  47. package/scss/style/_shaping.scss +561 -439
  48. package/scss/style/_typographic.scss +400 -345
@@ -1,251 +1,293 @@
1
- @use 'sass:meta';
2
- @use 'sass:list';
3
- @use 'sass:map';
4
- @use 'sass:string';
5
- @use '../variables' as vars;
6
- @use '../settings/defaults' as defs;
7
- @use '../settings/configs' as configs;
8
-
9
- // Definitions
10
- $opacities: if(vars.$opacities != (), vars.$opacities, defs.$opacities);
11
-
12
- // Basics validations functions
13
-
14
- // @function number
15
- // @description Validates if a value is a number.
16
- // @param {*} $number - The value to validate.
17
- // @param {String | Null} $in - Optional context for the error message.
18
- // @return {*} The original value if it's a number.
19
- // @error If the value is not a number.
20
- @function number($number, $in: null) {
21
- @if $number != null and (meta.type-of($number) != 'number') {
22
- $in: if($in != null, ' | in #{$in}', '.');
23
- @error '❌ Error at "validate.number()": Please enter a valid number | Expected a number, but got "#{$number}"#{$in}';
24
- }
25
- @return $number;
26
- }
27
-
28
- // @function string
29
- // @description Validates if a value is a string.
30
- // @param {*} $string - The value to validate.
31
- // @param {String | Null} $in - Optional context for the error message.
32
- // @return {*} The original value if it's a string.
33
- // @error If the value is not a string.
34
- @function string($string, $in: null) {
35
- @if $string != null and (meta.type-of($string) != 'string') {
36
- $in: if($in != null, ' | in #{$in}', '.');
37
- @error '❌ Error at "validate.string()": Please enter a valid string | Expected a string, but got "#{$string}"#{$in}';
38
- }
39
- @return $string;
40
- }
41
-
42
- // @function boolean
43
- // @description Validates if a value is a boolean.
44
- // @param {*} $boolean - The value to validate.
45
- // @param {String | Null} $in - Optional context for the error message.
46
- // @return {*} The original value if it's a boolean.
47
- // @error If the value is not a boolean.
48
- @function boolean($boolean, $in: null) {
49
- @if $boolean != null and (meta.type-of($boolean) != 'bool') {
50
- $in: if($in != null, ' | in #{$in}', '.');
51
- @error '❌ Error at "validate.boolean()": Please enter a valid boolean | Expected a (true or false), but got "#{$boolean}"#{$in}';
52
- }
53
- @return $boolean;
54
- }
55
-
56
- // @function notNull
57
- // @description Validates if a value is not null.
58
- // @param {*} $value - The value to validate.
59
- // @param {String | Null} $in - Optional context for the error message.
60
- // @return {*} The original value if it's not null.
61
- // @error If the value is null.
62
- @function notNull($value, $in: null) {
63
- @if $value == null {
64
- $in: if($in != null, ' | in #{$in}', '.');
65
- @error '❌ Error at "validate.notNull()": Please enter a valid value | Value must not be null#{$in}';
66
- }
67
- @return $value;
68
- }
69
-
70
- // Colors validations functions
71
-
72
- // @function opacity
73
- // @description Validates if a value is a valid opacity (number between 0 and 1).
74
- // @param {*} $opacity - The value to validate.
75
- // @param {String | Null} $in - Optional context for the error message.
76
- // @return {*} The original value if it's a valid opacity.
77
- // @error If the value is not a number or not between 0 and 1.
78
- @function opacity($opacity, $in: null) {
79
- @if $opacity != null and (meta.type-of($opacity) != 'number' or $opacity < 0 or $opacity > 1) {
80
- $in: if($in != null, ' | in #{$in}', '.');
81
- @error '❌ Error at "validate.opacity()": Please enter a valid number | Opacity must be a number between 0 and 1. You entered: "#{$opacity}"#{$in}';
82
- }
83
- @return $opacity;
84
- }
85
-
86
- // @function colorMode
87
- // @description Validates if a value is a valid color mode ('light' or 'dark').
88
- // @param {*} $mode - The value to validate.
89
- // @param {String | Null} $in - Optional context for the error message.
90
- // @return {*} The original value if it's a valid color mode.
91
- // @error If the value is not 'light' or 'dark'.
92
- @function colorMode($mode, $in: null) {
93
- @if $mode != null and not($mode == 'light' or $mode == 'dark') {
94
- $in: if($in != null, ' | in #{$in}', '.');
95
- @error '❌ Error at "validate.colorMode()": Please enter a valid mode | Allowed values are "light" or "dark"#{$in}';
96
- }
97
- @return $mode;
98
- }
99
-
100
- // @function hexColor
101
- // @description Validates if a value is a valid hex color.
102
- // @param {String} $key - The key name of the color (for error messages).
103
- // @param {*} $value - The value to validate.
104
- // @param {String | Null} $in - Optional context for the error message.
105
- // @return {*} The original value if it's a valid hex color.
106
- // @error If the value is null, not a string/color, or doesn't start with '#'.
107
- @function hexColor($key, $value, $in: null) {
108
- $in: if($in != null, ' | in #{$in}', '.');
109
-
110
- @if $value == null {
111
- @error '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value is null#{$in}';
112
- } @else if meta.type-of($value) != 'string' and meta.type-of($value) != 'color' {
113
- @error '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value must be a string or color, got type #{meta.type-of($value)}#{$in}';
114
- } @else if meta.type-of($value) == 'string' and string.index($value, '#') != 1 {
115
- @error '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value must start with "#", got "#{$value}"#{$in}';
116
- }
117
-
118
- @return $value;
119
- }
120
-
121
- // Map validations functions
122
-
123
- // @function map
124
- // @description Validates if a value is a map.
125
- // @param {*} $map - The value to validate.
126
- // @param {String | Null} $in - Optional context for the error message.
127
- // @return {*} The original value if it's a map.
128
- // @error If the value is not a map.
129
- @function map($map, $in: null) {
130
- @if meta.type-of($map) != map {
131
- $in: if($in != null, ' | in #{$in}', '.');
132
- @error '❌ Error at "validate.map()": Invalid type provided | Expected a map, but got "#{$map}" of type "#{meta.type-of($map)}"#{$in}';
133
- }
134
- @return $map;
135
- }
136
-
137
- // @function mapItem
138
- // @description Validates if a map contains a specific key.
139
- // @param {Map} $map - The map to validate.
140
- // @param {String} $key - The key to check for.
141
- // @param {List} $expectedKeys - A list of expected keys (for error messages).
142
- // @param {String | Null} $in - Optional context for the error message.
143
- // @return {Map} The original map if the key exists.
144
- // @error If the key is missing from the map.
145
- @function mapItem($map, $key, $expectedKeys, $in: null) {
146
- @if not map.has-key($map, $key) {
147
- $in: if($in != null, ' | in #{$in}', '.');
148
- @error '❌ Error at "validate.mapItem()": Missing key | Missing key "#{$key}" in the map "#{$map}" | Expected keys: "#{$expectedKeys}"#{$in}';
149
- }
150
- @return $map;
151
- }
152
-
153
- // List validations functions
154
-
155
- // @function list
156
- // @description Validates if a value is a list. If it's a single string, number, boolean, or color, it's converted to a single-item list.
157
- // @param {*} $list - The value to validate.
158
- // @param {String | Null} $in - Optional context for the error message.
159
- // @return {List} The original value if it's a list, or a new list containing the value.
160
- // @error If the value is not a list and cannot be converted.
161
- @function list($list, $in: null) {
162
- $list-type: meta.type-of($list);
163
-
164
- @if $list != null and $list-type != 'list' {
165
- @if $list-type == 'string' or $list-type == 'number' or $list-type == 'bool' or $list-type == 'color' {
166
- @return ($list);
167
- } @else {
168
- $in: if($in != null, ' | in #{$in}', '.');
169
- @error '❌ Error at "validate.list()": Please enter a valid list | Expected a list, but got "#{$list}" of type "#{$list-type}"#{$in}';
170
- }
171
- }
172
-
173
- @return $list;
174
- }
175
-
176
- // @function listItem
177
- // @description Validates if an item exists in a list.
178
- // @param {List} $list - The list to search in.
179
- // @param {*} $item - The item to search for.
180
- // @param {String | Null} $in - Optional context for the error message.
181
- // @return {*} The item if it's found in the list.
182
- // @error If the item is not found in the list.
183
- @function listItem($list, $item, $in: null) {
184
- @if not list.index($list, $item) {
185
- $in: if($in != null, ' | in #{$in}', '.');
186
- @error '❌ Error at "validate.listItem()": Invalid item | Missing item "#{$item}" not found in the list "#{$list}"#{$in}';
187
- }
188
- @return $item;
189
- }
190
-
191
- // Custom colors validations functions
192
-
193
- // @function colorMap
194
- // @description Validates a map of colors, ensuring each color has 'light' and 'dark' variants that are valid hex colors.
195
- // @param {Map} $map - The color map to validate.
196
- // @param {String | Null} $in - Optional context for the error message.
197
- // @return {Map} The original map if all colors and variants are valid.
198
- // @error If the map structure is incorrect or color values are invalid.
199
- @function colorMap($map, $in: null) {
200
- $mapVal: map($map);
201
-
202
- @each $key, $value in $map {
203
- $mapVal: map($value, $in);
204
- $lightKey: colorMode($value, $in);
205
- $darkKey: colorMode($value, $in);
206
- $light: hexColor('#{$key}.light', map.get($value, 'light'), $in);
207
- $dark: hexColor('#{$key}.dark', map.get($value, 'dark'), $in);
208
- }
209
-
210
- @return $map;
211
- }
212
-
213
- // @function colorOpacity
214
- // @description Validates if an opacity value is one of the predefined opacities in `$opacities`.
215
- // @param {*} $opacity - The opacity value to validate.
216
- // @param {String | Null} $in - Optional context for the error message.
217
- // @return {*} The original opacity value if it's valid.
218
- // @error If the opacity value is not in `$opacities`.
219
- @function colorOpacity($opacity, $in: null) {
220
- @if $opacity != null and $opacity != 100 and not(list.index($opacities, $opacity)) {
221
- $in: if($in != null, ' | in #{$in}', '.');
222
- @error '❌ Error at "validate.colorOpacity()": Invalid color property value | Expected one of (#{$opacities}), but got "#{$opacity}"#{$in}';
223
- }
224
- @return $opacity;
225
- }
226
-
227
- // @function colorProperty
228
- // @description Validates if a color property value is one of the allowed values in `configs.$colorsPropertiesMap`.
229
- // @param {*} $value - The color property value to validate.
230
- // @param {String | Null} $in - Optional context for the error message.
231
- // @return {*} The original value if it's a valid color property.
232
- // @error If the value is not an allowed color property.
233
- @function colorProperty($value, $in: null) {
234
- @if $value != null and not(list.index(map.values(configs.$colorsPropertiesMap), $value)) {
235
- @error '❌ Error at "validate.colorProperty()": Invalid color property value | Expected one of #{map.values(configs.$colorsPropertiesMap)}, but got "#{$value}"#{$in}';
236
- }
237
- @return $value;
238
- }
239
-
240
- // @function colorClass
241
- // @description Validates if a color class value is one of the allowed keys in `configs.$colorsPropertiesMap`.
242
- // @param {*} $value - The color class value to validate.
243
- // @param {String | Null} $in - Optional context for the error message.
244
- // @return {*} The original value if it's a valid color class.
245
- // @error If the value is not an allowed color class.
246
- @function colorClass($value, $in: null) {
247
- @if $value != null and not($value == null or list.index(map.keys(configs.$colorsPropertiesMap), $value)) {
248
- @error '❌ Error at "validate.colorClass()": Invalid color class value | Expected one of #{map.keys(configs.$colorsPropertiesMap)}, but got "#{$value}"#{$in}';
249
- }
250
- @return $value;
251
- }
1
+ @use 'sass:meta';
2
+ @use 'sass:list';
3
+ @use 'sass:map';
4
+ @use 'sass:string';
5
+ @use '../variables' as vars;
6
+ @use '../settings/defaults' as defs;
7
+ @use '../settings/configs' as configs;
8
+
9
+ // Definitions
10
+ $opacities: if(
11
+ sass(vars.$opacities != null): vars.$opacities; else: defs.$opacities
12
+ );
13
+
14
+ // Basics validations functions
15
+
16
+ // @function number
17
+ // @description Validates if a value is a number.
18
+ // @param {*} $number - The value to validate.
19
+ // @param {String | Null} $in - Optional context for the error message.
20
+ // @return {*} The original value if it's a number.
21
+ // @error If the value is not a number.
22
+ @function number($number, $in: null) {
23
+ @if $number != null and (meta.type-of($number) != 'number') {
24
+ $in: if(
25
+ sass($in != null): ' | in #{$in}' ; else: '.'
26
+ );
27
+ @debug '❌ Error at "validate.number()": Please enter a valid number | Expected a number, but got "#{$number}"#{$in}';
28
+ @return null;
29
+ }
30
+ @return $number;
31
+ }
32
+
33
+ // @function string
34
+ // @description Validates if a value is a string.
35
+ // @param {*} $string - The value to validate.
36
+ // @param {String | Null} $in - Optional context for the error message.
37
+ // @return {*} The original value if it's a string.
38
+ // @error If the value is not a string.
39
+ @function string($string, $in: null) {
40
+ @if $string != null and (meta.type-of($string) != 'string') {
41
+ $in: if(
42
+ sass($in != null): ' | in #{$in}' ; else: '.'
43
+ );
44
+ @debug '❌ Error at "validate.string()": Please enter a valid string | Expected a string, but got "#{$string}"#{$in}';
45
+ @return null;
46
+ }
47
+ @return $string;
48
+ }
49
+
50
+ // @function boolean
51
+ // @description Validates if a value is a boolean.
52
+ // @param {*} $boolean - The value to validate.
53
+ // @param {String | Null} $in - Optional context for the error message.
54
+ // @return {*} The original value if it's a boolean.
55
+ // @error If the value is not a boolean.
56
+ @function boolean($boolean, $in: null) {
57
+ @if $boolean != null and (meta.type-of($boolean) != 'bool') {
58
+ $in: if(
59
+ sass($in != null): ' | in #{$in}' ; else: '.'
60
+ );
61
+ @debug '❌ Error at "validate.boolean()": Please enter a valid boolean | Expected a (true or false), but got "#{$boolean}"#{$in}';
62
+ @return null;
63
+ }
64
+ @return $boolean;
65
+ }
66
+
67
+ // @function notNull
68
+ // @description Validates if a value is not null.
69
+ // @param {*} $value - The value to validate.
70
+ // @param {String | Null} $in - Optional context for the error message.
71
+ // @return {*} The original value if it's not null.
72
+ // @error If the value is null.
73
+ @function notNull($value, $in: null) {
74
+ @if $value == null {
75
+ $in: if(
76
+ sass($in != null): ' | in #{$in}' ; else: '.'
77
+ );
78
+ @debug '❌ Error at "validate.notNull()": Please enter a valid value | Value must not be null#{$in}';
79
+ @return null;
80
+ }
81
+ @return $value;
82
+ }
83
+
84
+ // Colors validations functions
85
+
86
+ // @function opacity
87
+ // @description Validates if a value is a valid opacity (number between 0 and 1).
88
+ // @param {*} $opacity - The value to validate.
89
+ // @param {String | Null} $in - Optional context for the error message.
90
+ // @return {*} The original value if it's a valid opacity.
91
+ // @error If the value is not a number or not between 0 and 1.
92
+ @function opacity($opacity, $in: null) {
93
+ @if $opacity != null and (meta.type-of($opacity) != 'number' or $opacity < 0 or $opacity > 1) {
94
+ $in: if(
95
+ sass($in != null): ' | in #{$in}' ; else: '.'
96
+ );
97
+ @debug '❌ Error at "validate.opacity()": Please enter a valid number | Opacity must be a number between 0 and 1. You entered: "#{$opacity}"#{$in}';
98
+ @return null;
99
+ }
100
+ @return $opacity;
101
+ }
102
+
103
+ // @function colorMode
104
+ // @description Validates if a value is a valid color mode ('light' or 'dark').
105
+ // @param {*} $mode - The value to validate.
106
+ // @param {String | Null} $in - Optional context for the error message.
107
+ // @return {*} The original value if it's a valid color mode.
108
+ // @error If the value is not 'light' or 'dark'.
109
+ @function colorMode($mode, $in: null) {
110
+ @if $mode != null and not($mode == 'light' or $mode == 'dark') {
111
+ $in: if(
112
+ sass($in != null): ' | in #{$in}' ; else: '.'
113
+ );
114
+ @debug '❌ Error at "validate.colorMode()": Please enter a valid mode | Allowed values are "light" or "dark"#{$in}';
115
+ @return null;
116
+ }
117
+ @return $mode;
118
+ }
119
+
120
+ // @function hexColor
121
+ // @description Validates if a value is a valid hex color.
122
+ // @param {String} $key - The key name of the color (for error messages).
123
+ // @param {*} $value - The value to validate.
124
+ // @param {String | Null} $in - Optional context for the error message.
125
+ // @return {*} The original value if it's a valid hex color.
126
+ // @error If the value is null, not a string/color, or doesn't start with '#'.
127
+ @function hexColor($key, $value, $in: null) {
128
+ $in: if(
129
+ sass($in != null): ' | in #{$in}' ; else: '.'
130
+ );
131
+
132
+ @if $value == null {
133
+ @debug '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value is null#{$in}';
134
+ @return null;
135
+ } @else if meta.type-of($value) != 'string' and meta.type-of($value) != 'color' {
136
+ @debug '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value must be a string or color, got type #{meta.type-of($value)}#{$in}';
137
+ @return null;
138
+ } @else if meta.type-of($value) == 'string' and string.index($value, '#') != 1 {
139
+ @debug '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value must start with "#", got "#{$value}"#{$in}';
140
+ @return null;
141
+ }
142
+
143
+ @return $value;
144
+ }
145
+
146
+ // Map validations functions
147
+
148
+ // @function map
149
+ // @description Validates if a value is a map.
150
+ // @param {*} $map - The value to validate.
151
+ // @param {String | Null} $in - Optional context for the error message.
152
+ // @return {*} The original value if it's a map.
153
+ // @error If the value is not a map.
154
+ @function map($map, $in: null) {
155
+ @if meta.type-of($map) != map {
156
+ $in: if(
157
+ sass($in != null): ' | in #{$in}' ; else: '.'
158
+ );
159
+ @debug '❌ Error at "validate.map()": Invalid type provided | Expected a map, but got "#{$map}" of type "#{meta.type-of($map)}"#{$in}';
160
+ @return null;
161
+ }
162
+ @return $map;
163
+ }
164
+
165
+ // @function mapItem
166
+ // @description Validates if a map contains a specific key.
167
+ // @param {Map} $map - The map to validate.
168
+ // @param {String} $key - The key to check for.
169
+ // @param {List} $expectedKeys - A list of expected keys (for error messages).
170
+ // @param {String | Null} $in - Optional context for the error message.
171
+ // @return {Map} The original map if the key exists.
172
+ // @error If the key is missing from the map.
173
+ @function mapItem($map, $key, $expectedKeys, $in: null) {
174
+ @if not map.has-key($map, $key) {
175
+ $in: if(
176
+ sass($in != null): ' | in #{$in}' ; else: '.'
177
+ );
178
+ @debug '❌ Error at "validate.mapItem()": Missing key | Missing key "#{$key}" in the map "#{$map}" | Expected keys: "#{$expectedKeys}"#{$in}';
179
+ @return null;
180
+ }
181
+ @return $map;
182
+ }
183
+
184
+ // List validations functions
185
+
186
+ // @function list
187
+ // @description Validates if a value is a list. If it's a single string, number, boolean, or color, it's converted to a single-item list.
188
+ // @param {*} $list - The value to validate.
189
+ // @param {String | Null} $in - Optional context for the error message.
190
+ // @return {List} The original value if it's a list, or a new list containing the value.
191
+ // @error If the value is not a list and cannot be converted.
192
+ @function list($list, $in: null) {
193
+ $list-type: meta.type-of($list);
194
+
195
+ @if $list != null and $list-type != 'list' {
196
+ @if $list-type == 'string' or $list-type == 'number' or $list-type == 'bool' or $list-type == 'color' {
197
+ @return ($list);
198
+ } @else {
199
+ $in: if(
200
+ sass($in != null): ' | in #{$in}' ; else: '.'
201
+ );
202
+ @debug '❌ Error at "validate.list()": Please enter a valid list | Expected a list, but got "#{$list}" of type "#{$list-type}"#{$in}';
203
+ @return null;
204
+ }
205
+ }
206
+
207
+ @return $list;
208
+ }
209
+
210
+ // @function listItem
211
+ // @description Validates if an item exists in a list.
212
+ // @param {List} $list - The list to search in.
213
+ // @param {*} $item - The item to search for.
214
+ // @param {String | Null} $in - Optional context for the error message.
215
+ // @return {*} The item if it's found in the list.
216
+ // @error If the item is not found in the list.
217
+ @function listItem($list, $item, $in: null) {
218
+ @if not list.index($list, $item) {
219
+ $in: if(
220
+ sass($in != null): ' | in #{$in}' ; else: '.'
221
+ );
222
+ @debug '❌ Error at "validate.listItem()": Invalid item | Missing item "#{$item}" not found in the list "#{$list}"#{$in}';
223
+ @return null;
224
+ }
225
+ @return $item;
226
+ }
227
+
228
+ // Custom colors validations functions
229
+
230
+ // @function colorMap
231
+ // @description Validates a map of colors, ensuring each color has 'light' and 'dark' variants that are valid hex colors.
232
+ // @param {Map} $map - The color map to validate.
233
+ // @param {String | Null} $in - Optional context for the error message.
234
+ // @return {Map} The original map if all colors and variants are valid.
235
+ // @error If the map structure is incorrect or color values are invalid.
236
+ @function colorMap($map, $in: null) {
237
+ $mapVal: map($map);
238
+
239
+ @each $key, $value in $map {
240
+ $mapVal: map($value, $in);
241
+ $lightKey: colorMode($value, $in);
242
+ $darkKey: colorMode($value, $in);
243
+ $light: hexColor('#{$key}.light', map.get($value, 'light'), $in);
244
+ $dark: hexColor('#{$key}.dark', map.get($value, 'dark'), $in);
245
+ }
246
+
247
+ @return $map;
248
+ }
249
+
250
+ // @function colorOpacity
251
+ // @description Validates if an opacity value is one of the predefined opacities in `$opacities`.
252
+ // @param {*} $opacity - The opacity value to validate.
253
+ // @param {String | Null} $in - Optional context for the error message.
254
+ // @return {*} The original opacity value if it's valid.
255
+ // @error If the opacity value is not in `$opacities`.
256
+ @function colorOpacity($opacity, $in: null) {
257
+ @if $opacity != null and $opacity != 100 and not(list.index($opacities, $opacity)) {
258
+ $in: if(
259
+ sass($in != null): ' | in #{$in}' ; else: '.'
260
+ );
261
+ @debug '❌ Error at "validate.colorOpacity()": Invalid color property value | Expected one of (#{$opacities}), but got "#{$opacity}"#{$in}';
262
+ @return null;
263
+ }
264
+ @return $opacity;
265
+ }
266
+
267
+ // @function colorProperty
268
+ // @description Validates if a color property value is one of the allowed values in `configs.$colorsPropertiesMap`.
269
+ // @param {*} $value - The color property value to validate.
270
+ // @param {String | Null} $in - Optional context for the error message.
271
+ // @return {*} The original value if it's a valid color property.
272
+ // @error If the value is not an allowed color property.
273
+ @function colorProperty($value, $in: null) {
274
+ @if $value != null and not(list.index(map.values(configs.$colorsPropertiesMap), $value)) {
275
+ @debug '❌ Error at "validate.colorProperty()": Invalid color property value | Expected one of #{map.values(configs.$colorsPropertiesMap)}, but got "#{$value}"#{$in}';
276
+ @return null;
277
+ }
278
+ @return $value;
279
+ }
280
+
281
+ // @function colorClass
282
+ // @description Validates if a color class value is one of the allowed keys in `configs.$colorsPropertiesMap`.
283
+ // @param {*} $value - The color class value to validate.
284
+ // @param {String | Null} $in - Optional context for the error message.
285
+ // @return {*} The original value if it's a valid color class.
286
+ // @error If the value is not an allowed color class.
287
+ @function colorClass($value, $in: null) {
288
+ @if $value != null and not($value == null or list.index(map.keys(configs.$colorsPropertiesMap), $value)) {
289
+ @debug '❌ Error at "validate.colorClass()": Invalid color class value | Expected one of #{map.keys(configs.$colorsPropertiesMap)}, but got "#{$value}"#{$in}';
290
+ @return null;
291
+ }
292
+ @return $value;
293
+ }