igniteui-theming 1.3.0 → 1.4.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 +1 -1
- package/sass/color/_mixins.scss +36 -16
- package/sass/typography/_mixins.scss +16 -4
- package/sass/typography/_types.scss +1 -1
- package/sass/utils/_meta.scss +18 -1
package/package.json
CHANGED
package/sass/color/_mixins.scss
CHANGED
|
@@ -5,33 +5,39 @@
|
|
|
5
5
|
@use 'sass:string';
|
|
6
6
|
@use '../utils/meta' as *;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/// @param {Map} $palette - The palette used to generate CSS variables.
|
|
12
|
-
/// @param {Boolean} $contrast [true] - Specify if contrast colors should be included.
|
|
13
|
-
/// @example scss Generate css variables for a palette
|
|
14
|
-
/// $palette: palette($primary: red, $secondary: blue, $gray: #000);
|
|
15
|
-
/// @include palette($palette);
|
|
16
|
-
/// @require {function} is-root
|
|
17
|
-
@mixin palette($palette, $contrast: true) {
|
|
8
|
+
// Generates CSS variables for the base colors.
|
|
9
|
+
// @access private
|
|
10
|
+
@mixin _base-colors($palette) {
|
|
18
11
|
$scope: if(is-root(), ':root', '&');
|
|
19
12
|
|
|
20
13
|
#{$scope} {
|
|
21
14
|
@each $color, $shades in map.remove($palette, '_meta') {
|
|
22
15
|
@each $shade, $value in $shades {
|
|
23
|
-
$
|
|
24
|
-
$_valid
|
|
25
|
-
$_other-shade: meta.type-of($shade) == 'string';
|
|
26
|
-
$_hsl: if($_other-shade, string.index($shade, 'hsl'), false);
|
|
27
|
-
$_contrast: if($_other-shade, string.index($shade, 'contrast'), false);
|
|
16
|
+
$_shade: $shade == 500;
|
|
17
|
+
$_valid: meta.type-of($value == 'color');
|
|
28
18
|
|
|
29
|
-
@if $
|
|
19
|
+
@if $_shade and $_valid {
|
|
30
20
|
--ig-#{$color}-h: #{math.round(color.hue($value))};
|
|
31
21
|
--ig-#{$color}-s: #{math.round(color.saturation($value))};
|
|
32
22
|
--ig-#{$color}-l: #{math.round(color.lightness($value))};
|
|
33
23
|
--ig-#{$color}-a: #{color.alpha($value)};
|
|
34
24
|
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Generates shade CSS variables from the base colors.
|
|
31
|
+
// @access private
|
|
32
|
+
@mixin _shade-colors($palette, $contrast: true) {
|
|
33
|
+
$scope: if(is-root(), '*', '&');
|
|
34
|
+
|
|
35
|
+
#{$scope} {
|
|
36
|
+
@each $color, $shades in map.remove($palette, '_meta') {
|
|
37
|
+
@each $shade, $value in $shades {
|
|
38
|
+
$_shade: meta.type-of($shade) == 'string';
|
|
39
|
+
$_hsl: if($_shade, string.index($shade, 'hsl'), false);
|
|
40
|
+
$_contrast: if($_shade, string.index($shade, 'contrast'), false);
|
|
35
41
|
|
|
36
42
|
@if $_hsl {
|
|
37
43
|
$variant: string.slice($shade, 1, string.index($shade, '-hsl') - 1);
|
|
@@ -46,3 +52,17 @@
|
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
}
|
|
55
|
+
|
|
56
|
+
/// Generates CSS variables for a given palette.
|
|
57
|
+
/// @access public
|
|
58
|
+
/// @group Palettes
|
|
59
|
+
/// @param {Map} $palette - The palette used to generate CSS variables.
|
|
60
|
+
/// @param {Boolean} $contrast [true] - Specify if contrast colors should be included.
|
|
61
|
+
/// @example scss Generate css variables for a palette
|
|
62
|
+
/// $palette: palette($primary: red, $secondary: blue, $gray: #000);
|
|
63
|
+
/// @include palette($palette);
|
|
64
|
+
/// @require {function} is-root
|
|
65
|
+
@mixin palette($palette, $contrast: true) {
|
|
66
|
+
@include _base-colors($palette);
|
|
67
|
+
@include _shade-colors($palette, $contrast);
|
|
68
|
+
}
|
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
@if $valid {
|
|
25
25
|
@each $key, $value in types.$ITypeStyle {
|
|
26
|
-
#{$key}
|
|
26
|
+
@if #{$key} == 'font-family' {
|
|
27
|
+
font-family: var(--ig-#{$category}-#{$key}, var(--ig-font-family));
|
|
28
|
+
} @else {
|
|
29
|
+
#{$key}: var(--ig-#{$category}-#{$key});
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
@content;
|
|
29
33
|
} @else {
|
|
@@ -39,7 +43,13 @@
|
|
|
39
43
|
/// @include type-style-vars('h1', $h1-style);
|
|
40
44
|
@mixin type-style-vars($name, $type-style) {
|
|
41
45
|
@each $key, $value in map.remove($type-style, '_meta') {
|
|
42
|
-
|
|
46
|
+
@if $key == 'font-family' and $value != inherit {
|
|
47
|
+
--ig-#{$name}-#{$key}: #{$value};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@if $key != 'font-family' {
|
|
51
|
+
--ig-#{$name}-#{$key}: #{$value};
|
|
52
|
+
}
|
|
43
53
|
}
|
|
44
54
|
}
|
|
45
55
|
|
|
@@ -111,7 +121,9 @@
|
|
|
111
121
|
/// @example scss
|
|
112
122
|
/// @include typography('Roboto', $my-type-scale);
|
|
113
123
|
@mixin typography($font-family, $type-scale) {
|
|
114
|
-
$
|
|
124
|
+
$root: is-root();
|
|
125
|
+
$host: is-host();
|
|
126
|
+
$scope: if($root, ':root', '&');
|
|
115
127
|
|
|
116
128
|
#{$scope} {
|
|
117
129
|
--ig-font-family: #{string.unquote($font-family)};
|
|
@@ -121,7 +133,7 @@
|
|
|
121
133
|
}
|
|
122
134
|
}
|
|
123
135
|
|
|
124
|
-
@if
|
|
136
|
+
@if $root or $host {
|
|
125
137
|
.ig-typography {
|
|
126
138
|
@include type-style-elements();
|
|
127
139
|
@include type-style-classes();
|
package/sass/utils/_meta.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:selector';
|
|
2
|
+
|
|
1
3
|
/// Returns true if the scope where it's called is the root of the document.
|
|
2
4
|
/// @access private
|
|
3
5
|
/// @example scss Check if the current scope is root
|
|
@@ -11,6 +13,21 @@
|
|
|
11
13
|
/// @return {Boolean} - Returns a boolean depending on the scope where it's called
|
|
12
14
|
@function is-root() {
|
|
13
15
|
@each $selector in & {
|
|
14
|
-
@return
|
|
16
|
+
@return $selector == null;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
19
|
+
|
|
20
|
+
/// Returns true if the scope where it's called is :host.
|
|
21
|
+
/// @access private
|
|
22
|
+
/// @example scss Check if the current scope is :root
|
|
23
|
+
/// @mixin smart-mixin() {
|
|
24
|
+
/// $host: is-host();
|
|
25
|
+
///
|
|
26
|
+
/// @if is-host() {
|
|
27
|
+
/// /* style rules here */
|
|
28
|
+
/// }
|
|
29
|
+
/// }
|
|
30
|
+
/// @return {Boolean} - Returns a boolean depending on the scope where it's called
|
|
31
|
+
@function is-host() {
|
|
32
|
+
@return not(is-root()) and selector.is-superselector(':host', &);
|
|
33
|
+
}
|