@ws-serenity/sass-styling 1.0.2 → 1.1.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/lib/generator/colors/functions/regenerateColor.scss +58 -58
- package/lib/generator/colors/functions/strReplace.scss +9 -9
- package/lib/generator/colors/index.scss +101 -101
- package/lib/generator/fonts/index.scss +38 -38
- package/lib/sass/adaptive.scss +11 -11
- package/lib/sass/alignment.scss +66 -36
- package/lib/sass/functions.scss +3 -3
- package/lib/sass/index.scss +6 -6
- package/lib/sass/keyframes.scss +23 -23
- package/lib/sass/styling.scss +24 -24
- package/lib/sass/svgUtils.scss +14 -14
- package/lib/sass/textUtils.scss +19 -19
- package/lib/side-effect/reset.scss +74 -77
- package/package.json +2 -2
- package/readme.md +92 -92
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
// https://github.com/KittyGiraudel/SassyJSON/tree/master/stylesheets/decode/helpers/color
|
|
2
|
-
|
|
3
|
-
@function hex-to-dec($string) {
|
|
4
|
-
$hex: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'f';
|
|
5
|
-
$string: to-lower-case($string);
|
|
6
|
-
$length: str-length($string);
|
|
7
|
-
$dec: 0;
|
|
8
|
-
|
|
9
|
-
@for $i from 1 through $length {
|
|
10
|
-
$factor: 1 + (15 * ($length - $i));
|
|
11
|
-
$index: index($hex, str-slice($string, $i, $i));
|
|
12
|
-
$dec: $dec + $factor * ($index - 1);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@return $dec;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@function regenerateColor($string) {
|
|
19
|
-
@if type-of($string) == 'color' {
|
|
20
|
-
@return $string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
$string-lower: to-lower-case($string);
|
|
24
|
-
$r: '';
|
|
25
|
-
$g: '';
|
|
26
|
-
$b: '';
|
|
27
|
-
$hex: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'f';
|
|
28
|
-
$length: str-length($string);
|
|
29
|
-
$max: if($length == 4, 1, 2);
|
|
30
|
-
|
|
31
|
-
@if $length != 4 and $length != 7 {
|
|
32
|
-
@return $string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@for $i from 2 through $length {
|
|
36
|
-
$c: str-slice($string-lower, $i, $i);
|
|
37
|
-
|
|
38
|
-
@if index($hex, $c) == null {
|
|
39
|
-
@return $string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@if str-length($r) < $max {
|
|
43
|
-
$r: $r + $c;
|
|
44
|
-
} @else if str-length($g) < $max {
|
|
45
|
-
$g: $g + $c;
|
|
46
|
-
} @else if str-length($b) < $max {
|
|
47
|
-
$b: $b + $c;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@if $length == 4 {
|
|
52
|
-
$r: $r + $r;
|
|
53
|
-
$g: $g + $g;
|
|
54
|
-
$b: $b + $b;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@return rgb(hex-to-dec($r), hex-to-dec($g), hex-to-dec($b));
|
|
58
|
-
}
|
|
1
|
+
// https://github.com/KittyGiraudel/SassyJSON/tree/master/stylesheets/decode/helpers/color
|
|
2
|
+
|
|
3
|
+
@function hex-to-dec($string) {
|
|
4
|
+
$hex: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'f';
|
|
5
|
+
$string: to-lower-case($string);
|
|
6
|
+
$length: str-length($string);
|
|
7
|
+
$dec: 0;
|
|
8
|
+
|
|
9
|
+
@for $i from 1 through $length {
|
|
10
|
+
$factor: 1 + (15 * ($length - $i));
|
|
11
|
+
$index: index($hex, str-slice($string, $i, $i));
|
|
12
|
+
$dec: $dec + $factor * ($index - 1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@return $dec;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@function regenerateColor($string) {
|
|
19
|
+
@if type-of($string) == 'color' {
|
|
20
|
+
@return $string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
$string-lower: to-lower-case($string);
|
|
24
|
+
$r: '';
|
|
25
|
+
$g: '';
|
|
26
|
+
$b: '';
|
|
27
|
+
$hex: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'f';
|
|
28
|
+
$length: str-length($string);
|
|
29
|
+
$max: if($length == 4, 1, 2);
|
|
30
|
+
|
|
31
|
+
@if $length != 4 and $length != 7 {
|
|
32
|
+
@return $string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@for $i from 2 through $length {
|
|
36
|
+
$c: str-slice($string-lower, $i, $i);
|
|
37
|
+
|
|
38
|
+
@if index($hex, $c) == null {
|
|
39
|
+
@return $string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@if str-length($r) < $max {
|
|
43
|
+
$r: $r + $c;
|
|
44
|
+
} @else if str-length($g) < $max {
|
|
45
|
+
$g: $g + $c;
|
|
46
|
+
} @else if str-length($b) < $max {
|
|
47
|
+
$b: $b + $c;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@if $length == 4 {
|
|
52
|
+
$r: $r + $r;
|
|
53
|
+
$g: $g + $g;
|
|
54
|
+
$b: $b + $b;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@return rgb(hex-to-dec($r), hex-to-dec($g), hex-to-dec($b));
|
|
58
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
@function str-replace($string, $search, $replace: '') {
|
|
2
|
-
$index: str-index($string, $search);
|
|
3
|
-
|
|
4
|
-
@if $index {
|
|
5
|
-
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@return $string;
|
|
9
|
-
}
|
|
1
|
+
@function str-replace($string, $search, $replace: '') {
|
|
2
|
+
$index: str-index($string, $search);
|
|
3
|
+
|
|
4
|
+
@if $index {
|
|
5
|
+
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@return $string;
|
|
9
|
+
}
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
@use 'sass:list';
|
|
2
|
-
@use 'sass:string';
|
|
3
|
-
@import './functions/strReplace';
|
|
4
|
-
@import './functions/regenerateColor';
|
|
5
|
-
|
|
6
|
-
@function get-color($color-name, $theme, $theme-colors, $group-name) {
|
|
7
|
-
@if string.index($color-name, '%') == 1 {
|
|
8
|
-
$group: map-get($theme, $group-name);
|
|
9
|
-
@return map-get($group, str-replace($color-name, '%'));
|
|
10
|
-
}
|
|
11
|
-
@return map-get($theme-colors, str-replace($color-name, '@', $group-name));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@function generate-theme-colors($theme, $theme-config) {
|
|
15
|
-
$theme-colors: ();
|
|
16
|
-
|
|
17
|
-
// Main
|
|
18
|
-
@each $group-name, $group in $theme-config {
|
|
19
|
-
$group-type: map-get($group, 'type');
|
|
20
|
-
$group-colors: map-get($group, 'colors');
|
|
21
|
-
@if $group-type == 'single' {
|
|
22
|
-
@each $shade-name, $shade-layers in $group-colors {
|
|
23
|
-
$color-rest: black;
|
|
24
|
-
$color-hover: black;
|
|
25
|
-
$color-active: black;
|
|
26
|
-
@for $i from 1 through list.length($shade-layers) {
|
|
27
|
-
$layer-config: list.nth($shade-layers, -$i);
|
|
28
|
-
$layer-color-name: list.nth($layer-config, 1);
|
|
29
|
-
$layer-color: get-color($layer-color-name, $theme, $theme-colors, $group-name);
|
|
30
|
-
$layer-color-state-modifiers: list.nth($layer-config, 2);
|
|
31
|
-
$rest-modifier: list.nth($layer-color-state-modifiers, 1);
|
|
32
|
-
$hover-modifier: $rest-modifier;
|
|
33
|
-
@if list.length($layer-color-state-modifiers) >= 2 {
|
|
34
|
-
$hover-modifier: list.nth($layer-color-state-modifiers, 2);
|
|
35
|
-
}
|
|
36
|
-
$active-modifier: $hover-modifier;
|
|
37
|
-
@if list.length($layer-color-state-modifiers) >= 3 {
|
|
38
|
-
$active-modifier: list.nth($layer-color-state-modifiers, 3);
|
|
39
|
-
}
|
|
40
|
-
$color-rest: mix($layer-color, $color-rest, $rest-modifier);
|
|
41
|
-
$color-hover: mix($layer-color, $color-hover, $hover-modifier);
|
|
42
|
-
$color-active: mix($layer-color, $color-active, $active-modifier);
|
|
43
|
-
}
|
|
44
|
-
$theme-colors: map-merge($theme-colors, (
|
|
45
|
-
'#{$group-name}-#{$shade-name}': $color-rest,
|
|
46
|
-
'#{$group-name}-#{$shade-name}-hover': $color-hover,
|
|
47
|
-
'#{$group-name}-#{$shade-name}-active': $color-active
|
|
48
|
-
));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
@if $group-type == 'foreach' {
|
|
52
|
-
@each $color-name, $_ in map-get($theme, $group-name) {
|
|
53
|
-
@each $shade-name, $shade-layers in $group-colors {
|
|
54
|
-
$color-rest: black;
|
|
55
|
-
$color-hover: black;
|
|
56
|
-
$color-active: black;
|
|
57
|
-
@for $i from 1 through list.length($shade-layers) {
|
|
58
|
-
$layer-config: list.nth($shade-layers, -$i);
|
|
59
|
-
$layer-color-name: list.nth($layer-config, 1);
|
|
60
|
-
$layer-color: get-color(
|
|
61
|
-
str-replace(
|
|
62
|
-
str-replace($layer-color-name, '%', '%#{$color-name}'),
|
|
63
|
-
'@',
|
|
64
|
-
'@#{$color-name}'
|
|
65
|
-
),
|
|
66
|
-
$theme,
|
|
67
|
-
$theme-colors,
|
|
68
|
-
$group-name
|
|
69
|
-
);
|
|
70
|
-
$layer-color-state-modifiers: list.nth($layer-config, 2);
|
|
71
|
-
$rest-modifier: list.nth($layer-color-state-modifiers, 1);
|
|
72
|
-
$hover-modifier: $rest-modifier;
|
|
73
|
-
@if list.length($layer-color-state-modifiers) >= 2 {
|
|
74
|
-
$hover-modifier: list.nth($layer-color-state-modifiers, 2);
|
|
75
|
-
}
|
|
76
|
-
$active-modifier: $hover-modifier;
|
|
77
|
-
@if list.length($layer-color-state-modifiers) >= 3 {
|
|
78
|
-
$active-modifier: list.nth($layer-color-state-modifiers, 3);
|
|
79
|
-
}
|
|
80
|
-
$color-rest: mix($layer-color, $color-rest, $rest-modifier);
|
|
81
|
-
$color-hover: mix($layer-color, $color-hover, $hover-modifier);
|
|
82
|
-
$color-active: mix($layer-color, $color-active, $active-modifier);
|
|
83
|
-
}
|
|
84
|
-
$theme-colors: map-merge($theme-colors, (
|
|
85
|
-
'#{$group-name}#{$color-name}-#{$shade-name}': $color-rest,
|
|
86
|
-
'#{$group-name}#{$color-name}-#{$shade-name}-hover': $color-hover,
|
|
87
|
-
'#{$group-name}#{$color-name}-#{$shade-name}-active': $color-active
|
|
88
|
-
));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Overrides
|
|
95
|
-
$overrides: map-get($theme, 'overrides');
|
|
96
|
-
@each $color-name, $color-value in $overrides {
|
|
97
|
-
$theme-colors: map-merge($theme-colors, ($color-name: $color-value));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
@return $theme-colors;
|
|
101
|
-
}
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@import './functions/strReplace';
|
|
4
|
+
@import './functions/regenerateColor';
|
|
5
|
+
|
|
6
|
+
@function get-color($color-name, $theme, $theme-colors, $group-name) {
|
|
7
|
+
@if string.index($color-name, '%') == 1 {
|
|
8
|
+
$group: map-get($theme, $group-name);
|
|
9
|
+
@return map-get($group, str-replace($color-name, '%'));
|
|
10
|
+
}
|
|
11
|
+
@return map-get($theme-colors, str-replace($color-name, '@', $group-name));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@function generate-theme-colors($theme, $theme-config) {
|
|
15
|
+
$theme-colors: ();
|
|
16
|
+
|
|
17
|
+
// Main
|
|
18
|
+
@each $group-name, $group in $theme-config {
|
|
19
|
+
$group-type: map-get($group, 'type');
|
|
20
|
+
$group-colors: map-get($group, 'colors');
|
|
21
|
+
@if $group-type == 'single' {
|
|
22
|
+
@each $shade-name, $shade-layers in $group-colors {
|
|
23
|
+
$color-rest: black;
|
|
24
|
+
$color-hover: black;
|
|
25
|
+
$color-active: black;
|
|
26
|
+
@for $i from 1 through list.length($shade-layers) {
|
|
27
|
+
$layer-config: list.nth($shade-layers, -$i);
|
|
28
|
+
$layer-color-name: list.nth($layer-config, 1);
|
|
29
|
+
$layer-color: get-color($layer-color-name, $theme, $theme-colors, $group-name);
|
|
30
|
+
$layer-color-state-modifiers: list.nth($layer-config, 2);
|
|
31
|
+
$rest-modifier: list.nth($layer-color-state-modifiers, 1);
|
|
32
|
+
$hover-modifier: $rest-modifier;
|
|
33
|
+
@if list.length($layer-color-state-modifiers) >= 2 {
|
|
34
|
+
$hover-modifier: list.nth($layer-color-state-modifiers, 2);
|
|
35
|
+
}
|
|
36
|
+
$active-modifier: $hover-modifier;
|
|
37
|
+
@if list.length($layer-color-state-modifiers) >= 3 {
|
|
38
|
+
$active-modifier: list.nth($layer-color-state-modifiers, 3);
|
|
39
|
+
}
|
|
40
|
+
$color-rest: mix($layer-color, $color-rest, $rest-modifier);
|
|
41
|
+
$color-hover: mix($layer-color, $color-hover, $hover-modifier);
|
|
42
|
+
$color-active: mix($layer-color, $color-active, $active-modifier);
|
|
43
|
+
}
|
|
44
|
+
$theme-colors: map-merge($theme-colors, (
|
|
45
|
+
'#{$group-name}-#{$shade-name}': $color-rest,
|
|
46
|
+
'#{$group-name}-#{$shade-name}-hover': $color-hover,
|
|
47
|
+
'#{$group-name}-#{$shade-name}-active': $color-active
|
|
48
|
+
));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
@if $group-type == 'foreach' {
|
|
52
|
+
@each $color-name, $_ in map-get($theme, $group-name) {
|
|
53
|
+
@each $shade-name, $shade-layers in $group-colors {
|
|
54
|
+
$color-rest: black;
|
|
55
|
+
$color-hover: black;
|
|
56
|
+
$color-active: black;
|
|
57
|
+
@for $i from 1 through list.length($shade-layers) {
|
|
58
|
+
$layer-config: list.nth($shade-layers, -$i);
|
|
59
|
+
$layer-color-name: list.nth($layer-config, 1);
|
|
60
|
+
$layer-color: get-color(
|
|
61
|
+
str-replace(
|
|
62
|
+
str-replace($layer-color-name, '%', '%#{$color-name}'),
|
|
63
|
+
'@',
|
|
64
|
+
'@#{$color-name}'
|
|
65
|
+
),
|
|
66
|
+
$theme,
|
|
67
|
+
$theme-colors,
|
|
68
|
+
$group-name
|
|
69
|
+
);
|
|
70
|
+
$layer-color-state-modifiers: list.nth($layer-config, 2);
|
|
71
|
+
$rest-modifier: list.nth($layer-color-state-modifiers, 1);
|
|
72
|
+
$hover-modifier: $rest-modifier;
|
|
73
|
+
@if list.length($layer-color-state-modifiers) >= 2 {
|
|
74
|
+
$hover-modifier: list.nth($layer-color-state-modifiers, 2);
|
|
75
|
+
}
|
|
76
|
+
$active-modifier: $hover-modifier;
|
|
77
|
+
@if list.length($layer-color-state-modifiers) >= 3 {
|
|
78
|
+
$active-modifier: list.nth($layer-color-state-modifiers, 3);
|
|
79
|
+
}
|
|
80
|
+
$color-rest: mix($layer-color, $color-rest, $rest-modifier);
|
|
81
|
+
$color-hover: mix($layer-color, $color-hover, $hover-modifier);
|
|
82
|
+
$color-active: mix($layer-color, $color-active, $active-modifier);
|
|
83
|
+
}
|
|
84
|
+
$theme-colors: map-merge($theme-colors, (
|
|
85
|
+
'#{$group-name}#{$color-name}-#{$shade-name}': $color-rest,
|
|
86
|
+
'#{$group-name}#{$color-name}-#{$shade-name}-hover': $color-hover,
|
|
87
|
+
'#{$group-name}#{$color-name}-#{$shade-name}-active': $color-active
|
|
88
|
+
));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Overrides
|
|
95
|
+
$overrides: map-get($theme, 'overrides');
|
|
96
|
+
@each $color-name, $color-value in $overrides {
|
|
97
|
+
$theme-colors: map-merge($theme-colors, ($color-name: $color-value));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@return $theme-colors;
|
|
101
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
$weight-name-to-value-map: (
|
|
2
|
-
regular: 400,
|
|
3
|
-
semi-bold: 600,
|
|
4
|
-
bold: 700, // TODO DEAL WITH ME
|
|
5
|
-
);
|
|
6
|
-
|
|
7
|
-
$default-line-height-multiplier: 1.25;
|
|
8
|
-
|
|
9
|
-
@mixin set-font-css-vars(
|
|
10
|
-
$name,
|
|
11
|
-
$size,
|
|
12
|
-
$weight: regular,
|
|
13
|
-
$line-height: $size * $default-line-height-multiplier,
|
|
14
|
-
$letter-spacing: 0
|
|
15
|
-
) {
|
|
16
|
-
--#{$name}-font-size: #{$size}px;
|
|
17
|
-
--#{$name}-line-height: #{$line-height};
|
|
18
|
-
--#{$name}-letter-spacing: #{$letter-spacing};
|
|
19
|
-
|
|
20
|
-
@if type-of($weight) == string {
|
|
21
|
-
--#{$name}-font-weight: #{map-get($weight-name-to-value-map, $weight)};
|
|
22
|
-
} @else {
|
|
23
|
-
--#{$name}-font-weight: #{$weight};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@mixin set-fonts-css-vars-by-map($map) {
|
|
28
|
-
@each $name, $size, $weight, $line-height, $letter-spacing in $map {
|
|
29
|
-
@include set-font-css-vars($name, $size, $weight, $line-height, $letter-spacing);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@mixin use-css-vars-based-font($name) {
|
|
34
|
-
font-size: var(--#{$name}-font-size);
|
|
35
|
-
line-height: var(--#{$name}-line-height);
|
|
36
|
-
letter-spacing: var(--#{$name}-letter-spacing);
|
|
37
|
-
font-weight: var(--#{$name}-font-weight);
|
|
38
|
-
}
|
|
1
|
+
$weight-name-to-value-map: (
|
|
2
|
+
regular: 400,
|
|
3
|
+
semi-bold: 600,
|
|
4
|
+
bold: 700, // TODO DEAL WITH ME
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
$default-line-height-multiplier: 1.25;
|
|
8
|
+
|
|
9
|
+
@mixin set-font-css-vars(
|
|
10
|
+
$name,
|
|
11
|
+
$size,
|
|
12
|
+
$weight: regular,
|
|
13
|
+
$line-height: $size * $default-line-height-multiplier,
|
|
14
|
+
$letter-spacing: 0
|
|
15
|
+
) {
|
|
16
|
+
--#{$name}-font-size: #{$size}px;
|
|
17
|
+
--#{$name}-line-height: #{$line-height};
|
|
18
|
+
--#{$name}-letter-spacing: #{$letter-spacing};
|
|
19
|
+
|
|
20
|
+
@if type-of($weight) == string {
|
|
21
|
+
--#{$name}-font-weight: #{map-get($weight-name-to-value-map, $weight)};
|
|
22
|
+
} @else {
|
|
23
|
+
--#{$name}-font-weight: #{$weight};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin set-fonts-css-vars-by-map($map) {
|
|
28
|
+
@each $name, $size, $weight, $line-height, $letter-spacing in $map {
|
|
29
|
+
@include set-font-css-vars($name, $size, $weight, $line-height, $letter-spacing);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@mixin use-css-vars-based-font($name) {
|
|
34
|
+
font-size: var(--#{$name}-font-size);
|
|
35
|
+
line-height: var(--#{$name}-line-height);
|
|
36
|
+
letter-spacing: var(--#{$name}-letter-spacing);
|
|
37
|
+
font-weight: var(--#{$name}-font-weight);
|
|
38
|
+
}
|
package/lib/sass/adaptive.scss
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
@mixin max-width($resolution) {
|
|
2
|
-
@media (max-width: #{$resolution}px) {
|
|
3
|
-
@content;
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
@mixin min-width($resolution) {
|
|
8
|
-
@media (min-width: #{$resolution}px) {
|
|
9
|
-
@content;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
@mixin max-width($resolution) {
|
|
2
|
+
@media (max-width: #{$resolution}px) {
|
|
3
|
+
@content;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@mixin min-width($resolution) {
|
|
8
|
+
@media (min-width: #{$resolution}px) {
|
|
9
|
+
@content;
|
|
10
|
+
}
|
|
11
|
+
}
|
package/lib/sass/alignment.scss
CHANGED
|
@@ -1,36 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
@use 'sass:string';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
|
|
4
|
+
%__flex {
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
%__flex-column {
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin flex-column($gap:null) {
|
|
13
|
+
@extend %__flex;
|
|
14
|
+
@extend %__flex-column;
|
|
15
|
+
|
|
16
|
+
@if ($gap != null) {
|
|
17
|
+
row-gap: $gap;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@mixin flex($gap:null) {
|
|
22
|
+
@extend %__flex;
|
|
23
|
+
|
|
24
|
+
@if ($gap != null) {
|
|
25
|
+
column-gap: $gap;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
%margin-center {
|
|
30
|
+
margin: 0 auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
%absolute-stretch {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
bottom: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@mixin grid-areas($grid-template-areas, $isGlobal:false) {
|
|
42
|
+
display: grid;
|
|
43
|
+
grid-template-areas: $grid-template-areas;
|
|
44
|
+
// чтобы не дублировать стили храним массив созданных классов
|
|
45
|
+
$used: ();
|
|
46
|
+
|
|
47
|
+
@each $areaLine in $grid-template-areas {
|
|
48
|
+
$areas: string.split($areaLine, ' ');
|
|
49
|
+
|
|
50
|
+
@each $a in $areas {
|
|
51
|
+
@if not list.index($used, $a) {
|
|
52
|
+
@if ($isGlobal) {
|
|
53
|
+
:global(.#{$a}) {
|
|
54
|
+
grid-area: string.unquote($a);
|
|
55
|
+
}
|
|
56
|
+
} @else {
|
|
57
|
+
.#{$a} {
|
|
58
|
+
grid-area: string.unquote($a);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$used: list.append($used, $a);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
package/lib/sass/functions.scss
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
@function hex-to-rgba($hex, $alpha) {
|
|
2
|
-
@return rgba(red($hex), green($hex), blue($hex), $alpha);
|
|
3
|
-
}
|
|
1
|
+
@function hex-to-rgba($hex, $alpha) {
|
|
2
|
+
@return rgba(red($hex), green($hex), blue($hex), $alpha);
|
|
3
|
+
}
|
package/lib/sass/index.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@import './adaptive';
|
|
2
|
-
@import './alignment';
|
|
3
|
-
@import './functions';
|
|
4
|
-
@import './styling';
|
|
5
|
-
@import './svgUtils';
|
|
6
|
-
@import './textUtils';
|
|
1
|
+
@import './adaptive';
|
|
2
|
+
@import './alignment';
|
|
3
|
+
@import './functions';
|
|
4
|
+
@import './styling';
|
|
5
|
+
@import './svgUtils';
|
|
6
|
+
@import './textUtils';
|
package/lib/sass/keyframes.scss
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
@mixin shake-animation($color, $animation-duration, $animation-curve) {
|
|
2
|
-
animation: shake $animation-duration $animation-curve;
|
|
3
|
-
|
|
4
|
-
// @formatter:off
|
|
5
|
-
@keyframes shake {
|
|
6
|
-
// allow pass color
|
|
7
|
-
5%, 45% { transform: translate3d(-1px, 0, 0); }
|
|
8
|
-
10%, 40% { transform: translate3d(2px, 0, 0); }
|
|
9
|
-
20%, 80% { color: $color; }
|
|
10
|
-
15%, 25%, 35% { transform: translate3d(-4px, 0, 0); }
|
|
11
|
-
20%, 30% { transform: translate3d(4px, 0, 0); }
|
|
12
|
-
}
|
|
13
|
-
// @formatter:on
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// @formatter:off
|
|
18
|
-
@keyframes oscillating {
|
|
19
|
-
0% { opacity: 100%; }
|
|
20
|
-
50% { opacity: 50%; }
|
|
21
|
-
100% { opacity: 100%; }
|
|
22
|
-
}
|
|
23
|
-
// @formatter:on
|
|
1
|
+
@mixin shake-animation($color, $animation-duration, $animation-curve) {
|
|
2
|
+
animation: shake $animation-duration $animation-curve;
|
|
3
|
+
|
|
4
|
+
// @formatter:off
|
|
5
|
+
@keyframes shake {
|
|
6
|
+
// allow pass color
|
|
7
|
+
5%, 45% { transform: translate3d(-1px, 0, 0); }
|
|
8
|
+
10%, 40% { transform: translate3d(2px, 0, 0); }
|
|
9
|
+
20%, 80% { color: $color; }
|
|
10
|
+
15%, 25%, 35% { transform: translate3d(-4px, 0, 0); }
|
|
11
|
+
20%, 30% { transform: translate3d(4px, 0, 0); }
|
|
12
|
+
}
|
|
13
|
+
// @formatter:on
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// @formatter:off
|
|
18
|
+
@keyframes oscillating {
|
|
19
|
+
0% { opacity: 100%; }
|
|
20
|
+
50% { opacity: 50%; }
|
|
21
|
+
100% { opacity: 100%; }
|
|
22
|
+
}
|
|
23
|
+
// @formatter:on
|
package/lib/sass/styling.scss
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
%__background-alpha {
|
|
2
|
-
&::before {
|
|
3
|
-
content: '';
|
|
4
|
-
width: 100%;
|
|
5
|
-
height: 100%;
|
|
6
|
-
position: absolute;
|
|
7
|
-
left: 0;
|
|
8
|
-
z-index: -1;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@mixin background-alpha($color, $alpha) {
|
|
13
|
-
@extend %__background-alpha;
|
|
14
|
-
|
|
15
|
-
&::before {
|
|
16
|
-
background-color: $color;
|
|
17
|
-
opacity: $alpha;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
%border-radius-max {
|
|
22
|
-
// таким образом получается добиться максимального радиуса скругления, а не круглого элемента
|
|
23
|
-
border-radius: 9999px;
|
|
24
|
-
}
|
|
1
|
+
%__background-alpha {
|
|
2
|
+
&::before {
|
|
3
|
+
content: '';
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
position: absolute;
|
|
7
|
+
left: 0;
|
|
8
|
+
z-index: -1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin background-alpha($color, $alpha) {
|
|
13
|
+
@extend %__background-alpha;
|
|
14
|
+
|
|
15
|
+
&::before {
|
|
16
|
+
background-color: $color;
|
|
17
|
+
opacity: $alpha;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
%border-radius-max {
|
|
22
|
+
// таким образом получается добиться максимального радиуса скругления, а не круглого элемента
|
|
23
|
+
border-radius: 9999px;
|
|
24
|
+
}
|
package/lib/sass/svgUtils.scss
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
@mixin color-svg($color) {
|
|
2
|
-
color: $color;
|
|
3
|
-
|
|
4
|
-
svg {
|
|
5
|
-
fill: $color;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
@mixin size-svg($height, $width: $height) {
|
|
10
|
-
svg {
|
|
11
|
-
height: $height;
|
|
12
|
-
width: $width;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
@mixin color-svg($color) {
|
|
2
|
+
color: $color;
|
|
3
|
+
|
|
4
|
+
svg {
|
|
5
|
+
fill: $color;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@mixin size-svg($height, $width: $height) {
|
|
10
|
+
svg {
|
|
11
|
+
height: $height;
|
|
12
|
+
width: $width;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/lib/sass/textUtils.scss
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
%__multiline-ellipsis-overflow {
|
|
2
|
-
display: -webkit-box;
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
text-overflow: ellipsis;
|
|
5
|
-
-webkit-box-orient: vertical;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@mixin multiline-ellipsis-overflow($lines-amount) {
|
|
9
|
-
@extend %__multiline-ellipsis-overflow;
|
|
10
|
-
|
|
11
|
-
-webkit-line-clamp: $lines-amount;
|
|
12
|
-
line-clamp: $lines-amount;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
%text-overflow-ellipsis {
|
|
16
|
-
white-space: nowrap;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
text-overflow: ellipsis;
|
|
19
|
-
}
|
|
1
|
+
%__multiline-ellipsis-overflow {
|
|
2
|
+
display: -webkit-box;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
text-overflow: ellipsis;
|
|
5
|
+
-webkit-box-orient: vertical;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@mixin multiline-ellipsis-overflow($lines-amount) {
|
|
9
|
+
@extend %__multiline-ellipsis-overflow;
|
|
10
|
+
|
|
11
|
+
-webkit-line-clamp: $lines-amount;
|
|
12
|
+
line-clamp: $lines-amount;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
%text-overflow-ellipsis {
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
text-overflow: ellipsis;
|
|
19
|
+
}
|
|
@@ -1,77 +1,74 @@
|
|
|
1
|
-
* {
|
|
2
|
-
padding: 0;
|
|
3
|
-
margin: 0;
|
|
4
|
-
border: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
*, *::before, *::after {
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
:focus, :active {
|
|
12
|
-
outline: none;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
a
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
background-color: inherit;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
}
|
|
1
|
+
* {
|
|
2
|
+
padding: 0;
|
|
3
|
+
margin: 0;
|
|
4
|
+
border: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
*, *::before, *::after {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:focus, :active {
|
|
12
|
+
outline: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a {
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
a:focus, a:active {
|
|
20
|
+
outline: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
nav, footer, header, aside {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
html, body, #root {
|
|
28
|
+
overflow-x: hidden;
|
|
29
|
+
height: 100%;
|
|
30
|
+
width: 100%;
|
|
31
|
+
line-height: 1;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
text-size-adjust: 100%;
|
|
34
|
+
-webkit-tap-highlight-color: transparent;
|
|
35
|
+
scroll-behavior: smooth;
|
|
36
|
+
overscroll-behavior: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
input, button, textarea {
|
|
40
|
+
font-family: inherit;
|
|
41
|
+
outline: none !important;
|
|
42
|
+
box-shadow: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
input {
|
|
46
|
+
color: inherit;
|
|
47
|
+
|
|
48
|
+
&::-ms-clear {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
button::-moz-focus-inner {
|
|
54
|
+
padding: 0;
|
|
55
|
+
border: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ul li {
|
|
59
|
+
list-style: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
img {
|
|
63
|
+
vertical-align: top;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
h1, h2, h3, h4, h5, h6 {
|
|
67
|
+
font-size: inherit;
|
|
68
|
+
font-weight: 400;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
button {
|
|
72
|
+
background-color: inherit;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ws-serenity/sass-styling",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"directories": {
|
|
6
6
|
"lib": "lib"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"sass": "^1.
|
|
12
|
+
"sass": "^1.69.3"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "",
|
package/readme.md
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
## About
|
|
2
|
-
|
|
3
|
-
Библиотека базовых sass-стилей
|
|
4
|
-
|
|
5
|
-
## Sass
|
|
6
|
-
|
|
7
|
-
Папка не обладает сайд-эффектами, ее можно импортировать сколько угодно.
|
|
8
|
-
|
|
9
|
-
Общий импорт:
|
|
10
|
-
```scss
|
|
11
|
-
@import '@ws-serenity/sass-styling/lib/sass';
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Содержимое
|
|
15
|
-
- `adaptive` - миксины для адаптива
|
|
16
|
-
- `alignment` - размещение элементов (flex, margin-center,...)
|
|
17
|
-
- `functions` - полезные sass-функции
|
|
18
|
-
- `keyframes` - анимации
|
|
19
|
-
- `styling` - внешний вид (максимальное скругление, background-alpha)
|
|
20
|
-
- `svgUtils` - цвет и размер svg
|
|
21
|
-
- `textUtils` - оверфлоу текста
|
|
22
|
-
|
|
23
|
-
## Side-effect
|
|
24
|
-
|
|
25
|
-
Импортировать эти файлы необходимо единожды! Иначе возникнет дублирование стилей
|
|
26
|
-
|
|
27
|
-
## Generator
|
|
28
|
-
|
|
29
|
-
### Палитры
|
|
30
|
-
```scss
|
|
31
|
-
@import '@ws-serenity/sass-styling/lib/generator/colors';
|
|
32
|
-
|
|
33
|
-
// for $themes and $themes-config declaration check storybook
|
|
34
|
-
|
|
35
|
-
@mixin create-css-themes-root() {
|
|
36
|
-
@each $theme-name, $theme in $themes {
|
|
37
|
-
$theme-colors: generate-theme-colors($theme, $theme-config);
|
|
38
|
-
|
|
39
|
-
&.#{$theme-name}-theme {
|
|
40
|
-
@each $color-name, $color-value in $theme-colors {
|
|
41
|
-
--#{$color-name}: #{$color-value}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Шрифтов
|
|
49
|
-
|
|
50
|
-
```scss
|
|
51
|
-
@import '@ws-serenity/sass-styling/lib/generator/fonts';
|
|
52
|
-
|
|
53
|
-
// for full example check storybook
|
|
54
|
-
|
|
55
|
-
:root {
|
|
56
|
-
// 1. declare css-vars
|
|
57
|
-
@include set-fonts-css-vars-by-map((
|
|
58
|
-
// @formatter:off
|
|
59
|
-
heading-1 50 bold 140% -0.03em,
|
|
60
|
-
body-1 18 regular 140% -0.03em,
|
|
61
|
-
// @formatter:on
|
|
62
|
-
));
|
|
63
|
-
|
|
64
|
-
// 2. declare font and use in as placeholder, combined with mixin
|
|
65
|
-
%font-family-roboto {
|
|
66
|
-
font-family: 'Roboto', sans-serif;
|
|
67
|
-
}
|
|
68
|
-
@mixin use-font($name) {
|
|
69
|
-
@extend %font-family-roboto;
|
|
70
|
-
// 2.5 call special mixin from library, to set css-vars
|
|
71
|
-
@include use-css-vars-based-font($name);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// 3. declare placeholders and just use mixin above
|
|
75
|
-
%heading-1 {
|
|
76
|
-
@include use-font(heading-1);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
%body-1 {
|
|
80
|
-
@include use-font(body-1);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// 4. declare the styles
|
|
84
|
-
.body-1 {
|
|
85
|
-
@extend %body-1;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.heading-1 {
|
|
89
|
-
@extend %heading-1;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
1
|
+
## About
|
|
2
|
+
|
|
3
|
+
Библиотека базовых sass-стилей
|
|
4
|
+
|
|
5
|
+
## Sass
|
|
6
|
+
|
|
7
|
+
Папка не обладает сайд-эффектами, ее можно импортировать сколько угодно.
|
|
8
|
+
|
|
9
|
+
Общий импорт:
|
|
10
|
+
```scss
|
|
11
|
+
@import '@ws-serenity/sass-styling/lib/sass';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Содержимое
|
|
15
|
+
- `adaptive` - миксины для адаптива
|
|
16
|
+
- `alignment` - размещение элементов (flex, margin-center,...)
|
|
17
|
+
- `functions` - полезные sass-функции
|
|
18
|
+
- `keyframes` - анимации
|
|
19
|
+
- `styling` - внешний вид (максимальное скругление, background-alpha)
|
|
20
|
+
- `svgUtils` - цвет и размер svg
|
|
21
|
+
- `textUtils` - оверфлоу текста
|
|
22
|
+
|
|
23
|
+
## Side-effect
|
|
24
|
+
|
|
25
|
+
Импортировать эти файлы необходимо единожды! Иначе возникнет дублирование стилей
|
|
26
|
+
|
|
27
|
+
## Generator
|
|
28
|
+
|
|
29
|
+
### Палитры
|
|
30
|
+
```scss
|
|
31
|
+
@import '@ws-serenity/sass-styling/lib/generator/colors';
|
|
32
|
+
|
|
33
|
+
// for $themes and $themes-config declaration check storybook
|
|
34
|
+
|
|
35
|
+
@mixin create-css-themes-root() {
|
|
36
|
+
@each $theme-name, $theme in $themes {
|
|
37
|
+
$theme-colors: generate-theme-colors($theme, $theme-config);
|
|
38
|
+
|
|
39
|
+
&.#{$theme-name}-theme {
|
|
40
|
+
@each $color-name, $color-value in $theme-colors {
|
|
41
|
+
--#{$color-name}: #{$color-value}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Шрифтов
|
|
49
|
+
|
|
50
|
+
```scss
|
|
51
|
+
@import '@ws-serenity/sass-styling/lib/generator/fonts';
|
|
52
|
+
|
|
53
|
+
// for full example check storybook
|
|
54
|
+
|
|
55
|
+
:root {
|
|
56
|
+
// 1. declare css-vars
|
|
57
|
+
@include set-fonts-css-vars-by-map((
|
|
58
|
+
// @formatter:off
|
|
59
|
+
heading-1 50 bold 140% -0.03em,
|
|
60
|
+
body-1 18 regular 140% -0.03em,
|
|
61
|
+
// @formatter:on
|
|
62
|
+
));
|
|
63
|
+
|
|
64
|
+
// 2. declare font and use in as placeholder, combined with mixin
|
|
65
|
+
%font-family-roboto {
|
|
66
|
+
font-family: 'Roboto', sans-serif;
|
|
67
|
+
}
|
|
68
|
+
@mixin use-font($name) {
|
|
69
|
+
@extend %font-family-roboto;
|
|
70
|
+
// 2.5 call special mixin from library, to set css-vars
|
|
71
|
+
@include use-css-vars-based-font($name);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 3. declare placeholders and just use mixin above
|
|
75
|
+
%heading-1 {
|
|
76
|
+
@include use-font(heading-1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
%body-1 {
|
|
80
|
+
@include use-font(body-1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 4. declare the styles
|
|
84
|
+
.body-1 {
|
|
85
|
+
@extend %body-1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.heading-1 {
|
|
89
|
+
@extend %heading-1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|