@ws-serenity/sass-styling 1.1.3 → 1.2.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.
@@ -4,3 +4,4 @@
4
4
  @import './styling';
5
5
  @import './svgUtils';
6
6
  @import './textUtils';
7
+ @import './keyframes';
@@ -1,5 +1,14 @@
1
- @mixin shake-animation($color, $animation-duration, $animation-curve) {
2
- animation: shake $animation-duration $animation-curve;
1
+ $default-animation-timing: ease-out;
2
+ $default-shimmer-color: rgba(255, 255, 255, 0.5);
3
+
4
+ /**
5
+ * Миксин для создания fade-анимаций с опциональным направлением.
6
+ * @param $color - цвет для анимации.
7
+ * @param $animation-duration - Длительность анимации.
8
+ * @param $animation-timing - Функция плавности (по умолчанию: ease-out)
9
+ */
10
+ @mixin shake-animation($color, $animation-duration, $animation-timing: $default-animation-timing) {
11
+ animation: shake $animation-duration $animation-timing;
3
12
 
4
13
  // @formatter:off
5
14
  @keyframes shake {
@@ -13,7 +22,9 @@
13
22
  // @formatter:on
14
23
  }
15
24
 
16
-
25
+ /**
26
+ * Миксин для создания эффекта пульсации (осцилляции) прозрачности элемента
27
+ */
17
28
  // @formatter:off
18
29
  @keyframes oscillating {
19
30
  0% { opacity: 100%; }
@@ -21,3 +32,181 @@
21
32
  100% { opacity: 100%; }
22
33
  }
23
34
  // @formatter:on
35
+
36
+ /**
37
+ * Миксин для создания keyframes с автоматической генерацией префиксов.
38
+ * @param $name - Название анимации.
39
+ * @content - Блок с ключевыми кадрами анимации.
40
+ */
41
+ @mixin keyframes($name) {
42
+ @keyframes #{$name} {
43
+ @content;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Миксин для transition с настраиваемыми параметрами
49
+ * @param $animation-duration - Длительность анимации.
50
+ * @param $property - Свойство для анимации (по умолчанию: all)
51
+ * @param $animation-timing - Функция плавности (по умолчанию: ease-out)
52
+ */
53
+ @mixin transition($animation-duration, $properties: all, $animation-timing: $default-animation-timing) {
54
+ @if type-of($properties) == 'list' {
55
+ transition: #{$properties} $animation-duration $animation-timing;
56
+ } @else {
57
+ transition: $properties $animation-duration $animation-timing;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Миксин для создания fade-анимаций с опциональным направлением.
63
+ * Генерирует анимации исчезновения/появления с перемещением или без.
64
+ * @param $animation-duration - Длительность анимации.
65
+ * @param $direction - Направление анимации (Up, Down или null для появления без смещения).
66
+ * @param $animation-distance - Расстояние смещения (e.g. 100%, 64px) при появлении.
67
+ * @param $animation-timing - Функция плавности (по умолчанию: ease-out)
68
+ * @param $start-opacity - Изначальная прозрачность (по умолчанию - 0)
69
+ * @param $end-opacity - Конечная прозрачность (по умолчанию - 1).
70
+ */
71
+ @mixin fade-animation($animation-duration, $direction: null, $animation-distance: 100%, $animation-timing: $default-animation-timing, $start-opacity: 0, $end-opacity: 1) {
72
+ // Генерация имени анимации в зависимости от направления.
73
+ $animation-name: if($direction, fadeIn#{$direction}, fadeIn);
74
+
75
+ @include keyframes(#{$animation-name}) {
76
+ 0% {
77
+ opacity: $start-opacity;
78
+ @if $direction == 'Up' {
79
+ transform: translate3d(0, $animation-distance, 0);
80
+ } @else if $direction == 'Down' {
81
+ transform: translate3d(0, calc(-1 * #{$animation-distance}), 0);
82
+ }
83
+ }
84
+
85
+ 100% {
86
+ opacity: $end-opacity;
87
+ @if $direction {
88
+ transform: none;
89
+ }
90
+ }
91
+ }
92
+
93
+ animation: $animation-name $animation-duration $animation-timing;
94
+ }
95
+
96
+ /**
97
+ * Миксин для создания slide-анимаций с различными направлениями.
98
+ * @param $animation-duration - Длительность анимации.
99
+ * @param $direction - Направление движения (Left, Right, Up, Down).
100
+ * @param $animation-slide-offset - Расстояние смещения (e.g. 100%, 64px).
101
+ * @param $animation-timing - Функция плавности (по умолчанию: ease-out)
102
+ */
103
+ @mixin slide-animation($animation-duration, $direction, $animation-slide-offset: 100%, $animation-timing: $default-animation-timing) {
104
+ $animation-name: slideIn#{$direction};
105
+
106
+ @include keyframes(#{$animation-name}) {
107
+ 0% {
108
+ opacity: 0;
109
+ @if $direction == 'Left' {
110
+ transform: translate3d(calc(-1 * #{$animation-slide-offset}), 0, 0);
111
+ } @else if $direction == 'Right' {
112
+ transform: translate3d($animation-slide-offset, 0, 0);
113
+ } @else if $direction == 'Up' {
114
+ transform: translate3d(0, calc(-1 * #{$animation-slide-offset}), 0);
115
+ } @else if $direction == 'Down' {
116
+ transform: translate3d(0, $animation-slide-offset, 0);
117
+ }
118
+ }
119
+
120
+ 100% {
121
+ opacity: 1;
122
+ transform: none;
123
+ }
124
+ }
125
+
126
+ animation: $animation-name $animation-duration $animation-timing;
127
+ }
128
+
129
+ /**
130
+ * Миксин для создания scale-анимации.
131
+ * @param $animation-duration - Длительность анимации.
132
+ * @param $values - Значения для трансформации.
133
+ * @param $animation-timing - Функция плавности (по умолчанию: ease-out)
134
+ */
135
+ @mixin scale3d-animation($animation-duration, $scaleX, $scaleY: $scaleX, $scaleZ: $scaleX, $animation-timing: $default-animation-timing) {
136
+ @include keyframes(fadeInWithScale) {
137
+ 0% {
138
+ opacity: 0;
139
+ transform: scale3d($scaleX, $scaleY, $scaleZ);
140
+ }
141
+
142
+ 100% {
143
+ opacity: 1;
144
+ transform: none;
145
+ }
146
+ }
147
+
148
+ animation: fadeInWithScale $animation-duration $animation-timing;
149
+ }
150
+
151
+ /**
152
+ * Миксин для создания pulse-анимации.
153
+ * @param $animation-duration - Длительность анимации.
154
+ * @param $animation-timing - Функция плавности (по умолчанию: ease-out)
155
+ */
156
+ @mixin pulse-animation($animation-duration: 1s, $animation-timing: $default-animation-timing) {
157
+ @include keyframes(pulse) {
158
+ 0% {
159
+ opacity: 1;
160
+ filter: brightness(1);
161
+ }
162
+ 50% {
163
+ opacity: 0.4;
164
+ filter: brightness(0.95);
165
+ }
166
+ 100% {
167
+ opacity: 1;
168
+ filter: brightness(1);
169
+ }
170
+ }
171
+
172
+ animation: pulse $animation-duration $animation-timing infinite !important;
173
+ }
174
+
175
+ /**
176
+ * Миксин для создания эффекта "блика" (Shimmer/Skeleton).
177
+ * Создает псевдоэлемент ::after с градиентом, который пробегает по контейнеру.
178
+ *
179
+ * ВАЖНО: Родительский элемент должен иметь position: relative и overflow: hidden.
180
+ *
181
+ * @param $color - Цвет блика (по умолчанию полупрозрачный белый).
182
+ * @param $animation-duration - Длительность анимаци (по умолчанию 2s).
183
+ */
184
+ @mixin shimmer-animation($color: $default-shimmer-color, $animation-duration: 2s) {
185
+ @include keyframes(shimmerSlide) {
186
+ 0% {
187
+ transform: translateX(-100%);
188
+ }
189
+ 100% {
190
+ transform: translateX(100%);
191
+ }
192
+ }
193
+
194
+ &::after {
195
+ content: '';
196
+ position: absolute;
197
+ top: 0;
198
+ right: 0;
199
+ bottom: 0;
200
+ left: 0;
201
+
202
+ background: linear-gradient(
203
+ 90deg,
204
+ transparent 0%,
205
+ $color 50%,
206
+ transparent 100%
207
+ );
208
+
209
+ animation: shimmerSlide $animation-duration infinite;
210
+ pointer-events: none;
211
+ }
212
+ }
@@ -33,3 +33,23 @@
33
33
  scrollbar-width: none; /* Firefox */
34
34
  }
35
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
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ws-serenity/sass-styling",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "directories": {
6
6
  "lib": "lib"