@ws-serenity/sass-styling 1.2.0 → 2.0.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.
@@ -1,55 +1,65 @@
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
-
36
- @mixin scrollbar($width, $track-color, $track-radius, $thumb-color, $thumb-color-hover, $thumb-radius) {
37
- &::-webkit-scrollbar {
38
- width: $width;
39
- }
40
-
41
- &::-webkit-scrollbar-track {
42
- background-color: $track-color;
43
- border-radius: $track-radius;
44
- }
45
-
46
- &::-webkit-scrollbar-thumb {
47
- background-color: $thumb-color;
48
- border-radius: $thumb-radius;
49
-
50
- &:hover {
51
- background-color: $thumb-color-hover;
52
- }
53
- }
54
- }
55
-
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
+
36
+ @mixin scrollbar($width, $track-color, $track-radius, $thumb-color, $thumb-color-hover, $thumb-radius) {
37
+ &::-webkit-scrollbar {
38
+ width: $width;
39
+ }
40
+
41
+ &::-webkit-scrollbar-track {
42
+ background-color: $track-color;
43
+ border-radius: $track-radius;
44
+ }
45
+
46
+ &::-webkit-scrollbar-thumb {
47
+ background-color: $thumb-color;
48
+ border-radius: $thumb-radius;
49
+
50
+ &:hover {
51
+ background-color: $thumb-color-hover;
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * миксин для выставление стилей по кол-ву дочерних эл-тов
58
+ * @param $childrenNumber - количество дочерних элементов.
59
+ */
60
+ // выставление стилей по кол-ву дочерних эл-тов
61
+ @mixin has-n-children($childrenNumber) {
62
+ &:has(> :nth-child(#{$childrenNumber}):last-child) {
63
+ @content;
64
+ }
65
+ }
@@ -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,37 @@
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
+ }
20
+
21
+ %user-select-none {
22
+ -webkit-user-select: none;
23
+ -moz-user-select: none;
24
+ -ms-user-select: none;
25
+ user-select: none;
26
+ }
27
+
28
+ /**
29
+ * миксин для регулирования возможности выделять текст
30
+ * @param $value - none, text, all, auto (default)
31
+ */
32
+ @mixin user-select($value: auto) {
33
+ -webkit-user-select: $value;
34
+ -moz-user-select: $value;
35
+ -ms-user-select: $value;
36
+ user-select: $value;
37
+ }
@@ -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.2.0",
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": "2.0.0",
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, grid, ...)
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
+ ```