@ws-serenity/sass-styling 1.1.2 → 1.1.3

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.
@@ -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,12 +1,12 @@
1
- // https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping
2
- $weight-name-to-value-map: (
3
- thin: 100,
4
- extra-light: 200,
5
- light: 300,
6
- regular: 400,
7
- medium: 500,
8
- semi-bold: 600,
9
- bold: 700,
10
- extra-bold: 800,
11
- heavy: 900,
12
- );
1
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping
2
+ $weight-name-to-value-map: (
3
+ thin: 100,
4
+ extra-light: 200,
5
+ light: 300,
6
+ regular: 400,
7
+ medium: 500,
8
+ semi-bold: 600,
9
+ bold: 700,
10
+ extra-bold: 800,
11
+ heavy: 900,
12
+ );
@@ -1,60 +1,60 @@
1
- @use 'sass:list';
2
- @use 'sass:map';
3
-
4
- @mixin use-css-vars-conveyor(
5
- $key-vars-tuples,
6
- $conveyor,
7
- $defaults: (),
8
- $aliases: (),
9
- $default-markers: [ d, def, null ]
10
- ) {
11
- // Если в конвейере есть ключ, существующий в дефолтсах
12
- // То помечаем ключ, как override-friendly
13
- $override-friendly-props: [];
14
- @each $key in $conveyor {
15
- @if map.get($defaults, $key) != null {
16
- $override-friendly-props: append($override-friendly-props, $key);
17
- }
18
- }
19
-
20
- // Если в дефолтсах есть ключ, не существующий в конвейере
21
- // То помещаем его в конец конвейера
22
- @each $key, $_ in $defaults {
23
- @if index($conveyor, $key) == null {
24
- $conveyor: append($conveyor, $key);
25
- }
26
- }
27
-
28
- @each $key, $vars in $key-vars-tuples {
29
- @for $i from 1 through length($conveyor) {
30
- $prop: nth($conveyor, $i);
31
- $var: null;
32
-
33
- // Находим raw значение
34
- @if map.get($defaults, $prop) != null {
35
- @if $i <= length($vars) and index($override-friendly-props, $prop) != null {
36
- $var: nth($vars, $i);
37
-
38
- @if index($default-markers, $var) != null {
39
- $var: map.get($defaults, $prop);
40
- }
41
- } @else {
42
- $var: map.get($defaults, $prop);
43
- }
44
- } @else {
45
- $var: nth($vars, $i);
46
- }
47
-
48
- // Находим и применяем алиасы
49
- $prop-aliases: map.get($aliases, $prop);
50
- @if $prop-aliases != null {
51
- $var-aliased-value: map.get($prop-aliases, $var);
52
- @if $var-aliased-value != null {
53
- $var: $var-aliased-value;
54
- }
55
- }
56
-
57
- --#{$key}-#{$prop}: #{$var};
58
- }
59
- }
60
- }
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+
4
+ @mixin use-css-vars-conveyor(
5
+ $key-vars-tuples,
6
+ $conveyor,
7
+ $defaults: (),
8
+ $aliases: (),
9
+ $default-markers: [ d, def, null ]
10
+ ) {
11
+ // Если в конвейере есть ключ, существующий в дефолтсах
12
+ // То помечаем ключ, как override-friendly
13
+ $override-friendly-props: [];
14
+ @each $key in $conveyor {
15
+ @if map.get($defaults, $key) != null {
16
+ $override-friendly-props: append($override-friendly-props, $key);
17
+ }
18
+ }
19
+
20
+ // Если в дефолтсах есть ключ, не существующий в конвейере
21
+ // То помещаем его в конец конвейера
22
+ @each $key, $_ in $defaults {
23
+ @if index($conveyor, $key) == null {
24
+ $conveyor: append($conveyor, $key);
25
+ }
26
+ }
27
+
28
+ @each $key, $vars in $key-vars-tuples {
29
+ @for $i from 1 through length($conveyor) {
30
+ $prop: nth($conveyor, $i);
31
+ $var: null;
32
+
33
+ // Находим raw значение
34
+ @if map.get($defaults, $prop) != null {
35
+ @if $i <= length($vars) and index($override-friendly-props, $prop) != null {
36
+ $var: nth($vars, $i);
37
+
38
+ @if index($default-markers, $var) != null {
39
+ $var: map.get($defaults, $prop);
40
+ }
41
+ } @else {
42
+ $var: map.get($defaults, $prop);
43
+ }
44
+ } @else {
45
+ $var: nth($vars, $i);
46
+ }
47
+
48
+ // Находим и применяем алиасы
49
+ $prop-aliases: map.get($aliases, $prop);
50
+ @if $prop-aliases != null {
51
+ $var-aliased-value: map.get($prop-aliases, $var);
52
+ @if $var-aliased-value != null {
53
+ $var: $var-aliased-value;
54
+ }
55
+ }
56
+
57
+ --#{$key}-#{$prop}: #{$var};
58
+ }
59
+ }
60
+ }
@@ -1,35 +1,35 @@
1
- @import './commonWeights';
2
-
3
- $default-line-height-multiplier: 1.25;
4
-
5
- // todo: cssVarsConveyor can be reused
6
- @mixin set-font-css-vars(
7
- $name,
8
- $size,
9
- $weight: regular,
10
- $line-height: $size * $default-line-height-multiplier,
11
- $letter-spacing: 0
12
- ) {
13
- --#{$name}-font-size: #{$size}px;
14
- --#{$name}-line-height: #{$line-height};
15
- --#{$name}-letter-spacing: #{$letter-spacing};
16
-
17
- @if type-of($weight) == string {
18
- --#{$name}-font-weight: #{map-get($weight-name-to-value-map, $weight)};
19
- } @else {
20
- --#{$name}-font-weight: #{$weight};
21
- }
22
- }
23
-
24
- @mixin set-fonts-css-vars-by-map($map) {
25
- @each $name, $size, $weight, $line-height, $letter-spacing in $map {
26
- @include set-font-css-vars($name, $size, $weight, $line-height, $letter-spacing);
27
- }
28
- }
29
-
30
- @mixin use-css-vars-based-font($name) {
31
- font-size: var(--#{$name}-font-size);
32
- line-height: var(--#{$name}-line-height);
33
- letter-spacing: var(--#{$name}-letter-spacing);
34
- font-weight: var(--#{$name}-font-weight);
35
- }
1
+ @import './commonWeights';
2
+
3
+ $default-line-height-multiplier: 1.25;
4
+
5
+ // todo: cssVarsConveyor can be reused
6
+ @mixin set-font-css-vars(
7
+ $name,
8
+ $size,
9
+ $weight: regular,
10
+ $line-height: $size * $default-line-height-multiplier,
11
+ $letter-spacing: 0
12
+ ) {
13
+ --#{$name}-font-size: #{$size}px;
14
+ --#{$name}-line-height: #{$line-height};
15
+ --#{$name}-letter-spacing: #{$letter-spacing};
16
+
17
+ @if type-of($weight) == string {
18
+ --#{$name}-font-weight: #{map-get($weight-name-to-value-map, $weight)};
19
+ } @else {
20
+ --#{$name}-font-weight: #{$weight};
21
+ }
22
+ }
23
+
24
+ @mixin set-fonts-css-vars-by-map($map) {
25
+ @each $name, $size, $weight, $line-height, $letter-spacing in $map {
26
+ @include set-font-css-vars($name, $size, $weight, $line-height, $letter-spacing);
27
+ }
28
+ }
29
+
30
+ @mixin use-css-vars-based-font($name) {
31
+ font-size: var(--#{$name}-font-size);
32
+ line-height: var(--#{$name}-line-height);
33
+ letter-spacing: var(--#{$name}-letter-spacing);
34
+ font-weight: var(--#{$name}-font-weight);
35
+ }
@@ -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
+ }
@@ -1,66 +1,66 @@
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
- }
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) and $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
+ }
@@ -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
+ }
@@ -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';
@@ -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
@@ -1,35 +1,35 @@
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
- }
25
-
26
- %hide-scrollbar {
27
- /* Hide scrollbar for Chrome, Safari and Opera */
28
- &::-webkit-scrollbar {
29
- display: none;
30
- }
31
-
32
- -ms-overflow-style: none; /* IE and Edge */
33
- scrollbar-width: none; /* Firefox */
34
- }
35
-
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
+ }
25
+
26
+ %hide-scrollbar {
27
+ /* Hide scrollbar for Chrome, Safari and Opera */
28
+ &::-webkit-scrollbar {
29
+ display: none;
30
+ }
31
+
32
+ -ms-overflow-style: none; /* IE and Edge */
33
+ scrollbar-width: none; /* Firefox */
34
+ }
35
+
@@ -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
+ }
@@ -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,74 +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
- 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
- }
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,17 +1,17 @@
1
- {
2
- "name": "@ws-serenity/sass-styling",
3
- "version": "1.1.2",
4
- "description": "",
5
- "directories": {
6
- "lib": "lib"
7
- },
8
- "scripts": {
9
- "test": "echo \"Error: no test specified\" && exit 1"
10
- },
11
- "peerDependencies": {
12
- "sass": "^1.69.3"
13
- },
14
- "keywords": [],
15
- "author": "",
16
- "license": "ISC"
17
- }
1
+ {
2
+ "name": "@ws-serenity/sass-styling",
3
+ "version": "1.1.3",
4
+ "description": "",
5
+ "directories": {
6
+ "lib": "lib"
7
+ },
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "peerDependencies": {
12
+ "sass": "^1.69.3"
13
+ },
14
+ "keywords": [],
15
+ "author": "",
16
+ "license": "ISC"
17
+ }
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
+ ```