igniteui-theming 1.3.0 → 1.4.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 +1 -1
- package/sass/color/_mixins.scss +34 -22
- 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,6 +5,38 @@
|
|
|
5
5
|
@use 'sass:string';
|
|
6
6
|
@use '../utils/meta' as *;
|
|
7
7
|
|
|
8
|
+
// Generates CSS variables for a base color
|
|
9
|
+
// @access private
|
|
10
|
+
@mixin _base($color, $shade, $value) {
|
|
11
|
+
$_shade: $shade == 500;
|
|
12
|
+
$_valid: meta.type-of($value == 'color');
|
|
13
|
+
|
|
14
|
+
@if $_shade and $_valid {
|
|
15
|
+
--ig-#{$color}-h: #{math.round(color.hue($value))};
|
|
16
|
+
--ig-#{$color}-s: #{math.round(color.saturation($value))};
|
|
17
|
+
--ig-#{$color}-l: #{math.round(color.lightness($value))};
|
|
18
|
+
--ig-#{$color}-a: #{color.alpha($value)};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Generates CSS variables for a shade color
|
|
23
|
+
// @access private
|
|
24
|
+
@mixin _shade($color, $shade, $value, $contrast) {
|
|
25
|
+
$_shade: meta.type-of($shade) == 'string';
|
|
26
|
+
$_hsl: if($_shade, string.index($shade, 'hsl'), false);
|
|
27
|
+
$_contrast: if($_shade, string.index($shade, 'contrast'), false);
|
|
28
|
+
|
|
29
|
+
@if $_hsl {
|
|
30
|
+
$variant: string.slice($shade, 1, string.index($shade, '-hsl') - 1);
|
|
31
|
+
|
|
32
|
+
--ig-#{$color}-#{$variant}: #{$value};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@if $_contrast and $contrast {
|
|
36
|
+
--ig-#{$color}-#{$shade}: #{$value};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
8
40
|
/// Generates CSS variables for a given palette.
|
|
9
41
|
/// @access public
|
|
10
42
|
/// @group Palettes
|
|
@@ -20,28 +52,8 @@
|
|
|
20
52
|
#{$scope} {
|
|
21
53
|
@each $color, $shades in map.remove($palette, '_meta') {
|
|
22
54
|
@each $shade, $value in $shades {
|
|
23
|
-
$
|
|
24
|
-
$
|
|
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);
|
|
28
|
-
|
|
29
|
-
@if $_base-shade and $_valid-color {
|
|
30
|
-
--ig-#{$color}-h: #{math.round(color.hue($value))};
|
|
31
|
-
--ig-#{$color}-s: #{math.round(color.saturation($value))};
|
|
32
|
-
--ig-#{$color}-l: #{math.round(color.lightness($value))};
|
|
33
|
-
--ig-#{$color}-a: #{color.alpha($value)};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@if $_hsl {
|
|
37
|
-
$variant: string.slice($shade, 1, string.index($shade, '-hsl') - 1);
|
|
38
|
-
|
|
39
|
-
--ig-#{$color}-#{$variant}: #{$value};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@if $_contrast and $contrast {
|
|
43
|
-
--ig-#{$color}-#{$shade}: #{$value};
|
|
44
|
-
}
|
|
55
|
+
@include _base($color, $shade, $value);
|
|
56
|
+
@include _shade($color, $shade, $value, $contrast);
|
|
45
57
|
}
|
|
46
58
|
}
|
|
47
59
|
}
|
|
@@ -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
|
+
}
|