beathers 5.2.1 → 5.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/CHANGELOG +113 -0
- package/dist/css/beathers-icons.min.css +1 -1
- package/dist/css/beathers-icons.min.css.map +1 -1
- package/dist/css/beathers.min.css +2 -2
- package/dist/css/beathers.min.css.map +1 -1
- package/dist/data/colors.d.ts +9 -0
- package/dist/data/colors.js +54 -0
- package/dist/data/font.d.ts +3 -0
- package/dist/data/font.js +32 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +2 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -1
- package/dist/scripts/cli.js +7 -220
- package/dist/scripts/commands/build.d.ts +1 -0
- package/dist/scripts/commands/build.js +128 -0
- package/dist/scripts/commands/colors.d.ts +4 -0
- package/dist/scripts/commands/colors.js +140 -0
- package/dist/scripts/commands/fonts.d.ts +3 -0
- package/dist/scripts/commands/fonts.js +124 -0
- package/dist/scripts/commands/help.d.ts +1 -0
- package/dist/scripts/commands/help.js +42 -0
- package/dist/scripts/commands/index.d.ts +13 -0
- package/dist/scripts/commands/index.js +95 -0
- package/dist/scripts/commands/init.d.ts +1 -0
- package/dist/scripts/commands/init.js +129 -0
- package/dist/scripts/commands/list.d.ts +2 -0
- package/dist/scripts/commands/list.js +29 -0
- package/dist/scripts/commands/version.d.ts +1 -0
- package/dist/scripts/commands/version.js +13 -0
- package/dist/scripts/{BuildScssVariables.d.ts → helpers/BuildScssVariables.d.ts} +1 -1
- package/dist/scripts/{BuildScssVariables.js → helpers/BuildScssVariables.js} +4 -4
- package/dist/scripts/{LoadUserConfigs.d.ts → helpers/LoadUserConfigs.d.ts} +1 -1
- package/dist/scripts/{Merge.d.ts → helpers/Merge.d.ts} +1 -1
- package/dist/scripts/{ReadDefaultValues.d.ts → helpers/ReadDefaultValues.d.ts} +1 -1
- package/dist/scripts/{ReadDefaultValues.js → helpers/ReadDefaultValues.js} +6 -2
- package/dist/scripts/helpers/index.d.ts +5 -0
- package/dist/scripts/helpers/index.js +5 -0
- package/dist/scripts/types.d.ts +41 -4
- package/dist/scripts/types.js +1 -0
- package/package.json +17 -14
- package/readme.md +29 -1
- package/src/scss/_variables.scss +1 -305
- package/src/scss/beathers-icons.min.scss +245 -245
- package/src/scss/beathers.min.scss +2 -4
- package/src/scss/functions/_colors.scss +79 -68
- package/src/scss/functions/_mediaQueries.scss +22 -12
- package/src/scss/functions/_others.scss +31 -22
- package/src/scss/functions/_typographic.scss +11 -2
- package/src/scss/functions/_validations.scss +38 -43
- package/src/scss/settings/_configs.scss +1 -72
- package/src/scss/settings/_defaults.scss +139 -212
- package/src/scss/style/_colors.scss +39 -23
- package/src/scss/style/_grid.scss +23 -25
- package/src/scss/style/_resets.scss +119 -0
- package/src/scss/style/_shaping.scss +142 -89
- package/src/scss/style/_typographic.scss +79 -36
- package/dist/scripts/BuildTheme.d.ts +0 -1
- package/dist/scripts/BuildTheme.js +0 -75
- package/src/scss/settings/_resets.scss +0 -103
- /package/dist/scripts/{CallNewVariables.d.ts → helpers/CallNewVariables.d.ts} +0 -0
- /package/dist/scripts/{CallNewVariables.js → helpers/CallNewVariables.js} +0 -0
- /package/dist/scripts/{LoadUserConfigs.js → helpers/LoadUserConfigs.js} +0 -0
- /package/dist/scripts/{Merge.js → helpers/Merge.js} +0 -0
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
5
|
-
@use
|
|
6
|
-
@use
|
|
7
|
-
@use
|
|
8
|
-
@use
|
|
9
|
-
@use
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:color';
|
|
3
|
+
@use 'sass:math';
|
|
4
|
+
@use 'sass:list';
|
|
5
|
+
@use 'sass:map';
|
|
6
|
+
@use '../settings/configs' as configs;
|
|
7
|
+
@use '../settings/index' as settings;
|
|
8
|
+
@use '../variables' as vars;
|
|
9
|
+
@use '../settings/defaults' as defs;
|
|
10
|
+
@use '../functions/validations' as val;
|
|
11
|
+
|
|
12
|
+
// Definitions
|
|
13
|
+
$colors: if(meta.variable-exists('vars.$colors') and vars.$colors, vars.$colors, defs.$colors);
|
|
14
|
+
$opacities: if(meta.variable-exists('vars.$opacities') and vars.$opacities, vars.$opacities, defs.$opacities);
|
|
15
|
+
$useColorsLightMode: if(
|
|
16
|
+
meta.variable-exists('vars.$useColorsLightMode') and vars.$useColorsLightMode,
|
|
17
|
+
vars.$useColorsLightMode,
|
|
18
|
+
settings.$useColorsLightMode
|
|
19
|
+
);
|
|
20
|
+
$useColorsDarkMode: if(
|
|
21
|
+
meta.variable-exists('vars.$useColorsDarkMode') and vars.$useColorsDarkMode,
|
|
22
|
+
vars.$useColorsDarkMode,
|
|
23
|
+
settings.$useColorsDarkMode
|
|
24
|
+
);
|
|
25
|
+
$useColorsOpacities: if(
|
|
26
|
+
meta.variable-exists('vars.$useColorsOpacities') and vars.$useColorsOpacities,
|
|
27
|
+
vars.$useColorsOpacities,
|
|
28
|
+
settings.$useColorsOpacities
|
|
29
|
+
);
|
|
10
30
|
|
|
11
31
|
// Color Convertors ----- ----- ----- -----
|
|
12
32
|
//
|
|
@@ -28,13 +48,13 @@
|
|
|
28
48
|
//
|
|
29
49
|
@function hexToRgba($color, $opacity: 1, $debugIn: null) {
|
|
30
50
|
// Validate parameters
|
|
31
|
-
$checkedColor: val.hexColor(
|
|
32
|
-
$checkedOpacity: val.opacity($opacity,
|
|
51
|
+
$checkedColor: val.hexColor('color', $color, 'hexToRgba().#{$debugIn}');
|
|
52
|
+
$checkedOpacity: val.opacity($opacity, 'hexToRgba().#{$debugIn}');
|
|
33
53
|
|
|
34
54
|
@return rgba(
|
|
35
|
-
color.channel($checkedColor,
|
|
36
|
-
color.channel($checkedColor,
|
|
37
|
-
color.channel($checkedColor,
|
|
55
|
+
color.channel($checkedColor, 'red', $space: rgb),
|
|
56
|
+
color.channel($checkedColor, 'green', $space: rgb),
|
|
57
|
+
color.channel($checkedColor, 'blue', $space: rgb),
|
|
38
58
|
$checkedOpacity
|
|
39
59
|
);
|
|
40
60
|
}
|
|
@@ -48,13 +68,13 @@
|
|
|
48
68
|
// @param {String} $color - The color key to retrieve from the map
|
|
49
69
|
// @param {String} $mode - Optional mode, must be 'light' or 'dark' (default: 'light')
|
|
50
70
|
// @param {Number} $opacity - Optional opacity value between 0 and 100 (default: 100)
|
|
51
|
-
// @param {Map} $map - Optional color map to use (defaults to
|
|
71
|
+
// @param {Map} $map - Optional color map to use (defaults to $colors)
|
|
52
72
|
// @return {Color} - The color value, possibly with applied opacity
|
|
53
73
|
// @throws {Error} - If mode is provided but isn't 'light' or 'dark'
|
|
54
74
|
// @throws {Error} - If opacity is provided but isn't a number between 0 and 100
|
|
55
75
|
//
|
|
56
76
|
// @example scss
|
|
57
|
-
// // Using default color map (
|
|
77
|
+
// // Using default color map ($colors)
|
|
58
78
|
// color: useColor('primary', 'light', 0.5);
|
|
59
79
|
// // Returns the light variant of primary color with 50% opacity
|
|
60
80
|
//
|
|
@@ -62,23 +82,27 @@
|
|
|
62
82
|
// color: useColor('secondary', 'dark', null, $customMap);
|
|
63
83
|
// // Returns the dark variant of secondary color from custom map
|
|
64
84
|
//
|
|
65
|
-
@function useColor($color, $mode:
|
|
85
|
+
@function useColor($color, $mode: 'light', $opacity: 100) {
|
|
66
86
|
// Validate parameters
|
|
67
|
-
$checkedMode: val.colorMode($mode,
|
|
68
|
-
$checkedOpacity: val.colorOpacity($opacity,
|
|
87
|
+
$checkedMode: val.colorMode($mode, 'useColor()');
|
|
88
|
+
$checkedOpacity: val.colorOpacity($opacity, 'useColor()');
|
|
69
89
|
|
|
70
|
-
|
|
90
|
+
@if $color {
|
|
91
|
+
$value: map.get($color, $mode);
|
|
71
92
|
|
|
72
|
-
|
|
73
|
-
|
|
93
|
+
@if $checkedOpacity {
|
|
94
|
+
@return hexToRgba($value, math.div($opacity, 100), 'useColor().#{$value}');
|
|
95
|
+
} @else {
|
|
96
|
+
@return $value;
|
|
97
|
+
}
|
|
74
98
|
} @else {
|
|
75
|
-
@return
|
|
99
|
+
@return null;
|
|
76
100
|
}
|
|
77
101
|
}
|
|
78
102
|
|
|
79
|
-
@function useColorWithMap($color, $mode:
|
|
103
|
+
@function useColorWithMap($color, $mode: 'light', $opacity: 100, $map: $colors) {
|
|
80
104
|
// Validate parameters
|
|
81
|
-
$checkedMap: val.map($map,
|
|
105
|
+
$checkedMap: val.map($map, 'useColorWithMap().map');
|
|
82
106
|
|
|
83
107
|
$colorValue: map.get($checkedMap, $color);
|
|
84
108
|
@return useColor($colorValue, $mode, $opacity);
|
|
@@ -123,38 +147,38 @@
|
|
|
123
147
|
// modifiers is generated to reduce CSS output size.
|
|
124
148
|
@mixin useColorProperty($colorClass, $class, $property, $color, $map, $opacity: 100) {
|
|
125
149
|
// Validate parameters
|
|
126
|
-
$checkedClass: val.colorClass($class,
|
|
127
|
-
$checkedProperty: val.colorProperty($property,
|
|
128
|
-
$checkedMap: val.map($map,
|
|
129
|
-
$checkedOpacity: val.colorOpacity($opacity,
|
|
130
|
-
$checkedLight: val.mapItem($color,
|
|
131
|
-
$checkedDark: val.mapItem($color,
|
|
150
|
+
$checkedClass: val.colorClass($class, 'useColorProperty().class');
|
|
151
|
+
$checkedProperty: val.colorProperty($property, 'useColorProperty().property');
|
|
152
|
+
$checkedMap: val.map($map, 'useColorProperty().map');
|
|
153
|
+
$checkedOpacity: val.colorOpacity($opacity, 'useColorProperty().opacity');
|
|
154
|
+
$checkedLight: val.mapItem($color, 'light', 'light/dark', 'useColorProperty().color');
|
|
155
|
+
$checkedDark: val.mapItem($color, 'dark', 'light/dark', 'useColorProperty().color');
|
|
132
156
|
|
|
133
|
-
$light: map.get($color,
|
|
134
|
-
$dark: map.get($color,
|
|
157
|
+
$light: map.get($color, 'light');
|
|
158
|
+
$dark: map.get($color, 'dark');
|
|
135
159
|
|
|
136
|
-
$checkedLightValue: val.hexColor(
|
|
137
|
-
$checkedDarkValue: val.hexColor(
|
|
160
|
+
$checkedLightValue: val.hexColor('#{$colorClass}.light', $light, 'root-colors()');
|
|
161
|
+
$checkedDarkValue: val.hexColor('#{$colorClass}.dark', $dark, 'root-colors()');
|
|
138
162
|
|
|
139
|
-
@if $dark != $light {
|
|
140
|
-
@if (
|
|
163
|
+
@if $light and $dark and $dark != $light {
|
|
164
|
+
@if ($useColorsLightMode) {
|
|
141
165
|
.light .#{$colorClass},
|
|
142
166
|
.#{$colorClass}.light,
|
|
143
167
|
.light\:#{$colorClass} {
|
|
144
|
-
#{$property}: useColor($color,
|
|
168
|
+
#{$property}: useColor($color, 'light', $opacity);
|
|
145
169
|
}
|
|
146
170
|
}
|
|
147
171
|
|
|
148
|
-
@if (
|
|
172
|
+
@if ($useColorsDarkMode) {
|
|
149
173
|
.dark .#{$colorClass},
|
|
150
174
|
.#{$colorClass}.dark,
|
|
151
175
|
.dark\:#{$colorClass} {
|
|
152
|
-
#{$property}: useColor($color,
|
|
176
|
+
#{$property}: useColor($color, 'dark', $opacity);
|
|
153
177
|
}
|
|
154
178
|
}
|
|
155
179
|
} @else {
|
|
156
180
|
.#{$colorClass} {
|
|
157
|
-
#{$property}: useColor($color,
|
|
181
|
+
#{$property}: useColor($color, if($light, 'light', 'dark'), $opacity);
|
|
158
182
|
}
|
|
159
183
|
}
|
|
160
184
|
}
|
|
@@ -164,7 +188,7 @@
|
|
|
164
188
|
// @mixin useColorsMap
|
|
165
189
|
// --------------------------------------
|
|
166
190
|
// Creates color utility classes using useColor() function for theme variant handling
|
|
167
|
-
// @param {Map} $map - The color map to use (e.g.,
|
|
191
|
+
// @param {Map} $map - The color map to use (e.g., $colors)
|
|
168
192
|
// @param {Boolean} $withOpacity - Whether to generate opacity variants (default: true)
|
|
169
193
|
// @throws {Error} - If $map is not a valid map
|
|
170
194
|
//
|
|
@@ -177,45 +201,32 @@
|
|
|
177
201
|
// // With optional opacity variants like :50, :75
|
|
178
202
|
// // With pseudo-class variants like :hover, :focus
|
|
179
203
|
//
|
|
180
|
-
@mixin useColorsMap($map:
|
|
204
|
+
@mixin useColorsMap($map: $colors, $withOpacity: true) {
|
|
181
205
|
// Validate parameters
|
|
182
|
-
$checkedMap: val.map($map,
|
|
183
|
-
$checkedWithOpacity: val.boolean($withOpacity,
|
|
206
|
+
$checkedMap: val.map($map, 'useColorsMap()');
|
|
207
|
+
$checkedWithOpacity: val.boolean($withOpacity, 'useColorsMap()');
|
|
184
208
|
|
|
185
209
|
@each $color, $modes in $checkedMap {
|
|
186
210
|
@if $color {
|
|
187
211
|
@each $class, $property in configs.$colorsPropertiesMap {
|
|
188
|
-
$mainClass: if($class,
|
|
212
|
+
$mainClass: if($class, '#{$class}#{\:}color-#{$color}', 'color-#{$color}');
|
|
189
213
|
|
|
190
214
|
@include useColorProperty($mainClass, $class, $property, $modes, $map);
|
|
191
215
|
|
|
192
|
-
@if $checkedWithOpacity and
|
|
193
|
-
@each $opacity in
|
|
194
|
-
@include useColorProperty(
|
|
195
|
-
"#{$mainClass}#{\:}#{$opacity}",
|
|
196
|
-
$class,
|
|
197
|
-
$property,
|
|
198
|
-
$modes,
|
|
199
|
-
$map,
|
|
200
|
-
$opacity
|
|
201
|
-
);
|
|
216
|
+
@if $checkedWithOpacity and $useColorsOpacities {
|
|
217
|
+
@each $opacity in $opacities {
|
|
218
|
+
@include useColorProperty('#{$mainClass}#{\:}#{$opacity}', $class, $property, $modes, $map, $opacity);
|
|
202
219
|
}
|
|
203
220
|
}
|
|
204
221
|
|
|
205
222
|
@each $pseudoClass, $pseudo in configs.$colorsPseudoMap {
|
|
206
|
-
@if $pseudoClass !=
|
|
207
|
-
@include useColorProperty(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
$
|
|
211
|
-
$modes,
|
|
212
|
-
$map
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
@if $checkedWithOpacity and settings.$useColorsOpacities {
|
|
216
|
-
@each $opacity in configs.$opacities {
|
|
223
|
+
@if $pseudoClass != 'placeholder' or ($pseudoClass == 'placeholder' and $class == null) {
|
|
224
|
+
@include useColorProperty('#{$mainClass}#{\:}#{$pseudoClass}#{$pseudo}', $class, $property, $modes, $map);
|
|
225
|
+
|
|
226
|
+
@if $checkedWithOpacity and $useColorsOpacities {
|
|
227
|
+
@each $opacity in $opacities {
|
|
217
228
|
@include useColorProperty(
|
|
218
|
-
|
|
229
|
+
'#{$mainClass}#{\:}#{$opacity}#{\:}#{$pseudoClass}#{$pseudo}',
|
|
219
230
|
$class,
|
|
220
231
|
$property,
|
|
221
232
|
$modes,
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
@use '../variables' as vars;
|
|
5
|
+
@use '../settings/defaults' as defs;
|
|
6
|
+
@use '../settings/index' as settings;
|
|
7
|
+
|
|
8
|
+
// Definitions
|
|
9
|
+
$breakpoints: if(meta.variable-exists('vars.$breakpoints') and vars.$breakpoints, vars.$breakpoints, defs.$breakpoints);
|
|
10
|
+
$useMediaQueries: if(
|
|
11
|
+
meta.variable-exists('vars.$useMediaQueries') and vars.$useMediaQueries,
|
|
12
|
+
vars.$useMediaQueries,
|
|
13
|
+
settings.$useMediaQueries
|
|
14
|
+
);
|
|
5
15
|
|
|
6
16
|
// Breakpoint Mixin
|
|
7
17
|
// --------------------------------------
|
|
@@ -10,7 +20,7 @@
|
|
|
10
20
|
// it applies the content directly without a media query.
|
|
11
21
|
//
|
|
12
22
|
// @param {String} $type - The type of media query (e.g., "min", "max").
|
|
13
|
-
// @param {String | Null} $key - The breakpoint key from
|
|
23
|
+
// @param {String | Null} $key - The breakpoint key from `$breakpoints` (e.g., "sm", "md", "lg").
|
|
14
24
|
// If null or an empty string, content is applied directly.
|
|
15
25
|
//
|
|
16
26
|
// @content - Styles to be applied within the media query or directly.
|
|
@@ -51,9 +61,9 @@
|
|
|
51
61
|
//
|
|
52
62
|
@mixin mQ($type, $key) {
|
|
53
63
|
// Retrieve the size value from the breakpoints map using the provided key
|
|
54
|
-
$size: map.get(
|
|
64
|
+
$size: map.get($breakpoints, $key);
|
|
55
65
|
|
|
56
|
-
@if $size and $size > 0 and
|
|
66
|
+
@if $size and $size > 0 and $useMediaQueries {
|
|
57
67
|
// Check if a valid size value exists
|
|
58
68
|
// Generate the media query using the provided type and size
|
|
59
69
|
@media (string.unquote("#{$type}-width"): $size) {
|
|
@@ -80,7 +90,7 @@
|
|
|
80
90
|
// @example scss
|
|
81
91
|
// // In another file (e.g., _typographic.scss)
|
|
82
92
|
// @use "mediaQueries" as mQ;
|
|
83
|
-
// @use "
|
|
93
|
+
// @use "defs";
|
|
84
94
|
//
|
|
85
95
|
// @include mQ.multiSizes() using ($size, $divider) {
|
|
86
96
|
// $classPrefix: if($size, "#{$size}#{$divider}", "");
|
|
@@ -111,9 +121,9 @@
|
|
|
111
121
|
// }
|
|
112
122
|
//
|
|
113
123
|
@mixin multiSizes() {
|
|
114
|
-
@if
|
|
115
|
-
@each $size, $value in
|
|
116
|
-
$divider: if($size, #{\:},
|
|
124
|
+
@if $useMediaQueries {
|
|
125
|
+
@each $size, $value in $breakpoints {
|
|
126
|
+
$divider: if($size, #{\:}, '');
|
|
117
127
|
|
|
118
128
|
@include mQ(min, $size) {
|
|
119
129
|
@content ($size, $divider);
|
|
@@ -121,7 +131,7 @@
|
|
|
121
131
|
}
|
|
122
132
|
} @else {
|
|
123
133
|
$size: null;
|
|
124
|
-
$divider:
|
|
134
|
+
$divider: '';
|
|
125
135
|
|
|
126
136
|
@content ($size, $divider);
|
|
127
137
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use '../variables' as vars;
|
|
4
|
+
@use '../settings/defaults' as defs;
|
|
5
|
+
@use '../functions/validations' as val;
|
|
6
|
+
|
|
7
|
+
// Definitions
|
|
8
|
+
$axisDivisions: if(
|
|
9
|
+
meta.variable-exists('vars.$axisDivisions') and vars.$axisDivisions,
|
|
10
|
+
vars.$axisDivisions,
|
|
11
|
+
defs.$axisDivisions
|
|
12
|
+
);
|
|
4
13
|
|
|
5
14
|
// @function shadowValue
|
|
6
15
|
// @description Converts a unitless number to a pixel value for shadows, unless the value is 0.
|
|
7
16
|
// @param {Number} $value - The shadow value.
|
|
8
17
|
// @return {String} The shadow value with "px" appended, or 0.
|
|
9
18
|
@function shadowValue($value) {
|
|
10
|
-
@return if($value != 0, #{$value}#{
|
|
19
|
+
@return if($value != 0, #{$value}#{'px'}, $value);
|
|
11
20
|
}
|
|
12
21
|
|
|
13
22
|
// @mixin gridDivision
|
|
@@ -17,23 +26,23 @@
|
|
|
17
26
|
// @param {String} $divider - A divider string for the generated classes (e.g., '-').
|
|
18
27
|
@mixin gridDivision($axis, $size, $divider) {
|
|
19
28
|
// Validate parameters
|
|
20
|
-
$checkedAxis: val.listItem((column, row), $axis,
|
|
21
|
-
$checkedBase: val.number(
|
|
29
|
+
$checkedAxis: val.listItem((column, row), $axis, 'gridDivision.axis');
|
|
30
|
+
$checkedBase: val.number($axisDivisions, 'gridDivision.axisDivisions');
|
|
22
31
|
|
|
23
|
-
$type: if($axis ==
|
|
24
|
-
$mainClass: if($size,
|
|
25
|
-
$subClass: if($size,
|
|
32
|
+
$type: if($axis == 'column', 'col', 'row');
|
|
33
|
+
$mainClass: if($size, '#{$size}#{$divider}#{$type}s', '#{$type}s');
|
|
34
|
+
$subClass: if($size, '#{$size}#{$divider}#{$type}', $type);
|
|
26
35
|
|
|
27
|
-
@for $i from 0 through
|
|
36
|
+
@for $i from 0 through $axisDivisions {
|
|
28
37
|
@if ($i > 0) {
|
|
29
38
|
&.#{$mainClass}#{\:}#{$i} {
|
|
30
39
|
grid-template-#{$axis}s: repeat($i, 1fr);
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
$axisProperty: if($i == 0,
|
|
43
|
+
$axisProperty: if($i == 0, 'grid-#{$axis}-end', 'grid-#{$axis}');
|
|
35
44
|
$class: if($i == 0, auto, $i);
|
|
36
|
-
$value: if($i == 0, -1,
|
|
45
|
+
$value: if($i == 0, -1, 'span #{$i}');
|
|
37
46
|
|
|
38
47
|
> .#{$subClass}#{\:}#{$class} {
|
|
39
48
|
#{$axisProperty}: #{$value};
|
|
@@ -49,30 +58,30 @@
|
|
|
49
58
|
// @param {String} $divider - A divider string for the generated classes (e.g., '-').
|
|
50
59
|
@mixin flexDivision($axis, $type, $size, $divider) {
|
|
51
60
|
// Validate parameters
|
|
52
|
-
$checkedAxis: val.listItem((width, height), $axis,
|
|
53
|
-
$checkedType: val.listItem((
|
|
54
|
-
$checkedBase: val.number(
|
|
61
|
+
$checkedAxis: val.listItem((width, height), $axis, 'flexDivision.axis');
|
|
62
|
+
$checkedType: val.listItem(('col', 'cols', 'rows', 'row'), $type, 'flexDivision.type');
|
|
63
|
+
$checkedBase: val.number($axisDivisions, 'flexDivision.axisDivisions');
|
|
55
64
|
|
|
56
|
-
$mainClass: if($size,
|
|
65
|
+
$mainClass: if($size, '#{$size}#{$divider}#{$type}', $type);
|
|
57
66
|
|
|
58
|
-
@if (not $size) and $type ==
|
|
67
|
+
@if (not $size) and $type == 'cols' or $type == 'rows' {
|
|
59
68
|
> * {
|
|
60
69
|
flex: 0 0 auto;
|
|
61
70
|
max-#{$axis}: 100%;
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
@for $i from 0 through
|
|
66
|
-
@if $type ==
|
|
74
|
+
@for $i from 0 through $axisDivisions {
|
|
75
|
+
@if $type == 'cols' or $type == 'rows' {
|
|
67
76
|
$class: if($i == 0, auto, $i);
|
|
68
77
|
$axisSize: if($i == 0, auto, calc(100% / $i));
|
|
69
78
|
|
|
70
79
|
&.#{$mainClass}#{\:}#{$class} > * {
|
|
71
80
|
#{$axis}: if($size, $axisSize !important, $axisSize);
|
|
72
81
|
}
|
|
73
|
-
} @else if $type ==
|
|
74
|
-
$axisSize: if($i == 0, 100%, calc(($i /
|
|
75
|
-
$class: if($i == 0,
|
|
82
|
+
} @else if $type == 'col' or $type == 'row' {
|
|
83
|
+
$axisSize: if($i == 0, 100%, calc(($i / $axisDivisions) * 100%));
|
|
84
|
+
$class: if($i == 0, '', $i);
|
|
76
85
|
$classSize: if($i == 0, #{$class}, #{\:}#{$class});
|
|
77
86
|
|
|
78
87
|
> .#{$mainClass}#{$classSize} {
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
1
2
|
@use 'sass:string';
|
|
2
3
|
@use 'sass:map';
|
|
3
|
-
@use '../
|
|
4
|
+
@use '../variables' as vars;
|
|
5
|
+
@use '../settings/defaults' as defs;
|
|
4
6
|
@use '../functions/validations' as val;
|
|
5
7
|
@use '../settings/configs' as configs;
|
|
6
8
|
|
|
9
|
+
// Definitions
|
|
10
|
+
$fontMainPath: if(
|
|
11
|
+
meta.variable-exists('vars.$fontMainPath') and vars.$fontMainPath,
|
|
12
|
+
vars.$fontMainPath,
|
|
13
|
+
defs.$fontMainPath
|
|
14
|
+
);
|
|
15
|
+
|
|
7
16
|
// Font Face Mixin
|
|
8
17
|
// --------------------------------------
|
|
9
18
|
// Generates an @font-face rule.
|
|
@@ -70,7 +79,7 @@
|
|
|
70
79
|
@if ($isLocal) {
|
|
71
80
|
src:
|
|
72
81
|
local('#{$title}-#{$weight}'),
|
|
73
|
-
url(string.unquote('#{
|
|
82
|
+
url(string.unquote('#{$fontMainPath}#{$title}-#{$weight}.#{$format}')) format('#{$format}');
|
|
74
83
|
} @else {
|
|
75
84
|
src: url(string.unquote('#{$externalUrl}'));
|
|
76
85
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
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(meta.variable-exists('vars.$opacities') and vars.$opacities, vars.$opacities, defs.$opacities);
|
|
5
11
|
|
|
6
12
|
// Basics validations functions
|
|
7
13
|
|
|
@@ -12,8 +18,8 @@
|
|
|
12
18
|
// @return {*} The original value if it's a number.
|
|
13
19
|
// @error If the value is not a number.
|
|
14
20
|
@function number($number, $in: null) {
|
|
15
|
-
@if $number != null and (meta.type-of($number) !=
|
|
16
|
-
$in: if($in != null,
|
|
21
|
+
@if $number != null and (meta.type-of($number) != 'number') {
|
|
22
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
17
23
|
@error '❌ Error at "validate.number()": Please enter a valid number | Expected a number, but got "#{$number}"#{$in}';
|
|
18
24
|
}
|
|
19
25
|
@return $number;
|
|
@@ -26,8 +32,8 @@
|
|
|
26
32
|
// @return {*} The original value if it's a string.
|
|
27
33
|
// @error If the value is not a string.
|
|
28
34
|
@function string($string, $in: null) {
|
|
29
|
-
@if $string != null and (meta.type-of($string) !=
|
|
30
|
-
$in: if($in != null,
|
|
35
|
+
@if $string != null and (meta.type-of($string) != 'string') {
|
|
36
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
31
37
|
@error '❌ Error at "validate.string()": Please enter a valid string | Expected a string, but got "#{$string}"#{$in}';
|
|
32
38
|
}
|
|
33
39
|
@return $string;
|
|
@@ -40,8 +46,8 @@
|
|
|
40
46
|
// @return {*} The original value if it's a boolean.
|
|
41
47
|
// @error If the value is not a boolean.
|
|
42
48
|
@function boolean($boolean, $in: null) {
|
|
43
|
-
@if $boolean != null and (meta.type-of($boolean) !=
|
|
44
|
-
$in: if($in != null,
|
|
49
|
+
@if $boolean != null and (meta.type-of($boolean) != 'bool') {
|
|
50
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
45
51
|
@error '❌ Error at "validate.boolean()": Please enter a valid boolean | Expected a (true or false), but got "#{$boolean}"#{$in}';
|
|
46
52
|
}
|
|
47
53
|
@return $boolean;
|
|
@@ -55,7 +61,7 @@
|
|
|
55
61
|
// @error If the value is null.
|
|
56
62
|
@function notNull($value, $in: null) {
|
|
57
63
|
@if $value == null {
|
|
58
|
-
$in: if($in != null,
|
|
64
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
59
65
|
@error '❌ Error at "validate.notNull()": Please enter a valid value | Value must not be null#{$in}';
|
|
60
66
|
}
|
|
61
67
|
@return $value;
|
|
@@ -70,8 +76,8 @@
|
|
|
70
76
|
// @return {*} The original value if it's a valid opacity.
|
|
71
77
|
// @error If the value is not a number or not between 0 and 1.
|
|
72
78
|
@function opacity($opacity, $in: null) {
|
|
73
|
-
@if $opacity != null and (meta.type-of($opacity) !=
|
|
74
|
-
$in: if($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}', '.');
|
|
75
81
|
@error '❌ Error at "validate.opacity()": Please enter a valid number | Opacity must be a number between 0 and 1. You entered: "#{$opacity}"#{$in}';
|
|
76
82
|
}
|
|
77
83
|
@return $opacity;
|
|
@@ -84,8 +90,8 @@
|
|
|
84
90
|
// @return {*} The original value if it's a valid color mode.
|
|
85
91
|
// @error If the value is not 'light' or 'dark'.
|
|
86
92
|
@function colorMode($mode, $in: null) {
|
|
87
|
-
@if $mode != null and not($mode ==
|
|
88
|
-
$in: if($in != null,
|
|
93
|
+
@if $mode != null and not($mode == 'light' or $mode == 'dark') {
|
|
94
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
89
95
|
@error '❌ Error at "validate.colorMode()": Please enter a valid mode | Allowed values are "light" or "dark"#{$in}';
|
|
90
96
|
}
|
|
91
97
|
@return $mode;
|
|
@@ -99,13 +105,13 @@
|
|
|
99
105
|
// @return {*} The original value if it's a valid hex color.
|
|
100
106
|
// @error If the value is null, not a string/color, or doesn't start with '#'.
|
|
101
107
|
@function hexColor($key, $value, $in: null) {
|
|
102
|
-
$in: if($in != null,
|
|
108
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
103
109
|
|
|
104
110
|
@if $value == null {
|
|
105
111
|
@error '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value is null#{$in}';
|
|
106
|
-
} @else if meta.type-of($value) !=
|
|
112
|
+
} @else if meta.type-of($value) != 'string' and meta.type-of($value) != 'color' {
|
|
107
113
|
@error '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value must be a string or color, got type #{meta.type-of($value)}#{$in}';
|
|
108
|
-
} @else if meta.type-of($value) ==
|
|
114
|
+
} @else if meta.type-of($value) == 'string' and string.index($value, '#') != 1 {
|
|
109
115
|
@error '❌ Error at "validate.hexColor()": Invalid "#{$key}" value | "#{$key}" value must start with "#", got "#{$value}"#{$in}';
|
|
110
116
|
}
|
|
111
117
|
|
|
@@ -122,7 +128,7 @@
|
|
|
122
128
|
// @error If the value is not a map.
|
|
123
129
|
@function map($map, $in: null) {
|
|
124
130
|
@if meta.type-of($map) != map {
|
|
125
|
-
$in: if($in != null,
|
|
131
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
126
132
|
@error '❌ Error at "validate.map()": Invalid type provided | Expected a map, but got "#{$map}" of type "#{meta.type-of($map)}"#{$in}';
|
|
127
133
|
}
|
|
128
134
|
@return $map;
|
|
@@ -138,7 +144,7 @@
|
|
|
138
144
|
// @error If the key is missing from the map.
|
|
139
145
|
@function mapItem($map, $key, $expectedKeys, $in: null) {
|
|
140
146
|
@if not map.has-key($map, $key) {
|
|
141
|
-
$in: if($in != null,
|
|
147
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
142
148
|
@error '❌ Error at "validate.mapItem()": Missing key | Missing key "#{$key}" in the map "#{$map}" | Expected keys: "#{$expectedKeys}"#{$in}';
|
|
143
149
|
}
|
|
144
150
|
@return $map;
|
|
@@ -155,19 +161,11 @@
|
|
|
155
161
|
@function list($list, $in: null) {
|
|
156
162
|
$list-type: meta.type-of($list);
|
|
157
163
|
|
|
158
|
-
@if $list != null and $list-type !=
|
|
159
|
-
@if $list-type ==
|
|
160
|
-
"string" or
|
|
161
|
-
$list-type ==
|
|
162
|
-
"number" or
|
|
163
|
-
$list-type ==
|
|
164
|
-
"bool" or
|
|
165
|
-
$list-type ==
|
|
166
|
-
"color"
|
|
167
|
-
{
|
|
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' {
|
|
168
166
|
@return ($list);
|
|
169
167
|
} @else {
|
|
170
|
-
$in: if($in != null,
|
|
168
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
171
169
|
@error '❌ Error at "validate.list()": Please enter a valid list | Expected a list, but got "#{$list}" of type "#{$list-type}"#{$in}';
|
|
172
170
|
}
|
|
173
171
|
}
|
|
@@ -184,7 +182,7 @@
|
|
|
184
182
|
// @error If the item is not found in the list.
|
|
185
183
|
@function listItem($list, $item, $in: null) {
|
|
186
184
|
@if not list.index($list, $item) {
|
|
187
|
-
$in: if($in != null,
|
|
185
|
+
$in: if($in != null, ' | in #{$in}', '.');
|
|
188
186
|
@error '❌ Error at "validate.listItem()": Invalid item | Missing item "#{$item}" not found in the list "#{$list}"#{$in}';
|
|
189
187
|
}
|
|
190
188
|
@return $item;
|
|
@@ -205,23 +203,23 @@
|
|
|
205
203
|
$mapVal: map($value, $in);
|
|
206
204
|
$lightKey: colorMode($value, $in);
|
|
207
205
|
$darkKey: colorMode($value, $in);
|
|
208
|
-
$light: hexColor(
|
|
209
|
-
$dark: hexColor(
|
|
206
|
+
$light: hexColor('#{$key}.light', map.get($value, 'light'), $in);
|
|
207
|
+
$dark: hexColor('#{$key}.dark', map.get($value, 'dark'), $in);
|
|
210
208
|
}
|
|
211
209
|
|
|
212
210
|
@return $map;
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
// @function colorOpacity
|
|
216
|
-
// @description Validates if an opacity value is one of the predefined opacities in
|
|
214
|
+
// @description Validates if an opacity value is one of the predefined opacities in `$opacities`.
|
|
217
215
|
// @param {*} $opacity - The opacity value to validate.
|
|
218
216
|
// @param {String | Null} $in - Optional context for the error message.
|
|
219
217
|
// @return {*} The original opacity value if it's valid.
|
|
220
|
-
// @error If the opacity value is not in
|
|
218
|
+
// @error If the opacity value is not in `$opacities`.
|
|
221
219
|
@function colorOpacity($opacity, $in: null) {
|
|
222
|
-
@if $opacity != null and not(list.index(
|
|
223
|
-
$in: if($in != null,
|
|
224
|
-
@error '❌ Error at "validate.colorOpacity()": Invalid color property value | Expected one of (#{
|
|
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}';
|
|
225
223
|
}
|
|
226
224
|
@return $opacity;
|
|
227
225
|
}
|
|
@@ -246,10 +244,7 @@
|
|
|
246
244
|
// @return {*} The original value if it's a valid color class.
|
|
247
245
|
// @error If the value is not an allowed color class.
|
|
248
246
|
@function colorClass($value, $in: null) {
|
|
249
|
-
@if $value !=
|
|
250
|
-
null and
|
|
251
|
-
not($value == null or list.index(map.keys(configs.$colorsPropertiesMap), $value))
|
|
252
|
-
{
|
|
247
|
+
@if $value != null and not($value == null or list.index(map.keys(configs.$colorsPropertiesMap), $value)) {
|
|
253
248
|
@error '❌ Error at "validate.colorClass()": Invalid color class value | Expected one of #{map.keys(configs.$colorsPropertiesMap)}, but got "#{$value}"#{$in}';
|
|
254
249
|
}
|
|
255
250
|
@return $value;
|