vgapp 0.7.8 → 0.8.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +22 -0
  3. package/app/langs/en/buttons.json +10 -0
  4. package/app/langs/en/messages.json +32 -0
  5. package/app/langs/en/titles.json +6 -0
  6. package/app/langs/ru/buttons.json +10 -0
  7. package/app/langs/ru/messages.json +32 -0
  8. package/app/langs/ru/titles.json +6 -0
  9. package/app/modules/base-module.js +23 -2
  10. package/app/modules/module-fn.js +20 -9
  11. package/app/modules/vgalert/js/vgalert.js +362 -214
  12. package/app/modules/vgalert/readme.md +242 -0
  13. package/app/modules/vgcollapse/js/vgcollapse.js +216 -62
  14. package/app/modules/vgcollapse/readme.md +56 -0
  15. package/app/modules/vgcollapse/scss/_variables.scss +5 -0
  16. package/app/modules/vgcollapse/scss/vgcollapse.scss +41 -0
  17. package/app/modules/vgdropdown/js/vgdropdown.js +140 -38
  18. package/app/modules/vgdropdown/readme.md +225 -0
  19. package/app/modules/vgfiles/js/base.js +499 -0
  20. package/app/modules/vgfiles/js/droppable.js +159 -0
  21. package/app/modules/vgfiles/js/loader.js +389 -0
  22. package/app/modules/vgfiles/js/render.js +83 -0
  23. package/app/modules/vgfiles/js/sortable.js +155 -0
  24. package/app/modules/vgfiles/js/vgfiles.js +796 -280
  25. package/app/modules/vgfiles/readme.md +193 -0
  26. package/app/modules/vgfiles/scss/_animations.scss +18 -0
  27. package/app/modules/vgfiles/scss/_mixins.scss +73 -0
  28. package/app/modules/vgfiles/scss/_variables.scss +103 -26
  29. package/app/modules/vgfiles/scss/vgfiles.scss +573 -60
  30. package/app/modules/vgformsender/js/vgformsender.js +5 -1
  31. package/app/modules/vgformsender/readme.md +30 -1
  32. package/app/modules/vglawcookie/js/vglawcookie.js +96 -62
  33. package/app/modules/vglawcookie/readme.md +102 -0
  34. package/app/modules/vgsidebar/js/vgsidebar.js +6 -4
  35. package/app/utils/js/components/ajax.js +176 -104
  36. package/app/utils/js/components/animation.js +124 -39
  37. package/app/utils/js/components/backdrop.js +54 -31
  38. package/app/utils/js/components/lang.js +71 -64
  39. package/app/utils/js/components/params.js +34 -31
  40. package/app/utils/js/components/scrollbar.js +118 -67
  41. package/app/utils/js/components/templater.js +14 -4
  42. package/app/utils/js/dom/cookie.js +107 -64
  43. package/app/utils/js/dom/data.js +68 -20
  44. package/app/utils/js/dom/event.js +272 -239
  45. package/app/utils/js/dom/manipulator.js +135 -62
  46. package/app/utils/js/dom/selectors.js +134 -59
  47. package/app/utils/js/functions.js +183 -349
  48. package/build/vgapp.css +1 -1
  49. package/build/vgapp.css.map +1 -1
  50. package/index.scss +3 -0
  51. package/package.json +1 -1
  52. package/app/utils/js/components/overflow.js +0 -28
@@ -9,10 +9,22 @@
9
9
  @import "../../../utils/scss/functions";
10
10
  @import "../../../utils/scss/mixin";
11
11
  @import "../../../utils/scss/variables";
12
+ @import "./_animations";
13
+ @import "./_mixins";
12
14
  @import "variables";
13
15
 
14
16
  .vg-files {
15
17
  @include mix-vars('files', $files-map);
18
+ position: relative;
19
+
20
+ a {
21
+ text-decoration: none;
22
+
23
+ &:hover {
24
+ outline: none;
25
+ text-decoration: none;
26
+ }
27
+ }
16
28
 
17
29
  input {
18
30
  visibility: initial;
@@ -39,7 +51,7 @@
39
51
  width: 24px;
40
52
 
41
53
  path {
42
- fill: var(--vg-files-label-color)
54
+ fill: var(--vg-files-label-color);
43
55
  }
44
56
  }
45
57
  }
@@ -49,101 +61,602 @@
49
61
  }
50
62
  }
51
63
 
52
- &-info {
53
- display: none;
54
- margin-bottom: var(--vg-files-info-mb);
55
- padding-top: var(--vg-files-info-mt);
64
+ &-errors {
65
+ padding: var(--vg-files-errors-padding-y) 0;
56
66
 
57
- &.show {
67
+ span {
68
+ font-size: var(--vg-files-errors-font-size);
69
+ color: var(--vg-danger);
58
70
  display: block;
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+ white-space: nowrap;
59
74
  }
75
+ }
60
76
 
61
- &--wrapper {
62
- display: flex;
63
- align-items: center;
77
+ &-stat {
78
+ padding: var(--vg-files-stat-padding);
79
+ border-bottom: 1px solid var(--vg-files-stat-border-color);
80
+ display: flex;
81
+ gap: var(--vg-files-stat-gap);
82
+ align-items: center;
83
+ margin-bottom: var(--vg-files-stat-mb);
64
84
 
65
- &-title {
66
- font-weight: var(--vg-files-info-title-fw);
67
- color: var(--vg-files-info-title-color);
85
+ &:not(.show) {
86
+ display: none;
87
+ }
88
+
89
+ &-title {
90
+ color: var(--vg-success);
91
+ font-weight: var(--vg-files-stat-title-fw);
92
+ }
93
+
94
+ &-count {
95
+ span {
96
+ color: var(--vg-secondary);
97
+ font-weight: 400;
98
+ font-size: var(--vg-files-stat-count-font-size);
99
+ margin-left: var(--vg-files-stat-count-ms);
68
100
  }
101
+ }
102
+
103
+ &-dismiss {
104
+ margin-left: auto;
105
+
106
+ a {
107
+ --vg-color-link: var(--vg-secondary);
108
+ display: flex;
109
+ align-items: center;
110
+ gap: 4px;
111
+ line-height: 1;
112
+ text-decoration: none;
113
+ color: var(--vg-color-link);
114
+ font-size: var(--vg-files-stat-dismiss-font-size);
115
+
116
+ &[disabled] {
117
+ pointer-events: none;
118
+ opacity: .5;
119
+ }
69
120
 
70
- &-count {
71
- span {
72
- display: inline-block;
73
- font-weight: var(--vg-files-info-count-fw);
74
- font-size: var(--vg-files-info-count-fs);
75
- color: var(--vg-files-info-count-color);
76
- margin-left: var(--vg-files-info-count-ms);
121
+ &:hover {
122
+ --vg-color-link: var(--vg-body-color);
123
+ }
124
+
125
+ i {
126
+ svg {
127
+ width: 18px;
128
+ height: 18px;
129
+
130
+ path {
131
+ fill: var(--vg-color-link);
132
+ }
133
+ }
77
134
  }
78
135
  }
136
+ }
137
+
138
+ &-progress {
139
+ &-list {
140
+ display: flex;
141
+ gap: 4px;
142
+ list-style: none;
143
+ padding: 0;
144
+ margin: 0;
145
+ font-size: 14px;
146
+ color: var(--vg-secondary);
147
+
148
+ .stat-item {
149
+ display: flex;
150
+ align-items: center;
151
+ gap: 2px;
152
+
153
+ &.pending {
154
+ .stat-label {
155
+ svg {
156
+ path.dot {
157
+ animation: flash 1s linear infinite;
158
+ }
159
+ }
160
+ }
161
+ }
79
162
 
80
- &-dismiss {
81
- font-size: var(--vg-files-info-dismiss-fs);
82
- margin-left: var(--vg-files-info-dismiss-ms);
163
+ &.pending[data-count="0"] {
164
+ .stat-label {
165
+ svg {
166
+ path.dot {
167
+ animation: none;
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ &.completed:not([data-count="0"]) {
174
+ .stat-label {
175
+ svg {
176
+ path.dot {
177
+ fill: var(--vg-success);
178
+ opacity: .72;
179
+ }
180
+ }
181
+ }
182
+ }
183
+
184
+ &.failing:not([data-count="0"]) {
185
+ .stat-label {
186
+ svg {
187
+ path.dot {
188
+ fill: var(--vg-danger);
189
+ opacity: .72;
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+
196
+ .stat-label {
197
+ svg {
198
+ path {
199
+ fill: var(--vg-secondary-bg);
200
+ }
201
+ }
202
+ }
83
203
  }
84
204
  }
205
+ }
206
+
207
+ &-info {
208
+ margin-top: var(--vg-files-info-mt);
209
+ border: 1px solid var(--vg-files-info-border-color);
210
+ border-radius: var(--vg-files-info-radius);
211
+
212
+ &:not(.show) {
213
+ display: none;
214
+ }
85
215
 
86
- &--images {
216
+ &--list {
217
+ padding: 0;
218
+ margin: 0;
87
219
  display: flex;
88
- flex-wrap: wrap;
220
+ flex-direction: column;
221
+ max-height: var(--vg-files-info-list-max-height);
222
+ overflow-y: auto;
223
+ overflow-x: hidden;
224
+ --vg-files-image-width: 0px;
225
+ --vg-files-image-height: 0px;
226
+ --vg-files-info-width: 100%;
227
+ --vg-files-remove-width: 0px;
228
+ --vg-files-remove-height: 0px;
229
+ --vg-files-gap: 8px;
230
+ --vg-files-image-gap: 0px;
231
+ --vg-files-remove-gap: 0px;
232
+
233
+ &.list-row {
234
+ --vg-files-image-width: 100px;
235
+ --vg-files-image-height: 100px;
236
+ flex-direction: row;
237
+ flex-wrap: wrap;
238
+ }
239
+
240
+ &:not(.list-row) .file {
241
+ &.with-image {
242
+ --vg-files-image-width: 48px;
243
+ --vg-files-image-height: 48px;
244
+ }
245
+
246
+ &.with-remove {
247
+ --vg-files-remove-width: calc(28px - var(--vg-files-gap));
248
+ --vg-files-remove-height: 28px;
249
+ }
250
+
251
+ &.with-info {
252
+ &.with-image {
253
+ --vg-files-image-gap: calc(var(--vg-files-image-width) + var(--vg-files-gap));
254
+ }
255
+
256
+ &.with-remove {
257
+ --vg-files-remove-gap: calc(var(--vg-files-remove-width) + var(--vg-files-gap));
258
+ }
259
+
260
+ --vg-files-info-width: calc(100% - ((var(--vg-files-image-gap) + var(--vg-files-remove-gap))));
261
+ }
262
+ }
89
263
 
90
- > span {
264
+ .file {
265
+ --vg-button-color: var(--vg-secondary);
266
+ display: flex;
267
+ align-items: center;
268
+ gap: var(--vg-files-info-gap);
269
+ padding: var(--vg-files-info-padding);
270
+ border-bottom: 1px solid var(--vg-files-info-border-bottom-color);
271
+ transition: all .2s ease-in-out;
91
272
  position: relative;
92
- width: var(--vg-files-info-image-width);
93
- margin-right: var(--vg-files-info-image-me);
94
- margin-bottom: var(--vg-files-info-image-mb);
95
- padding: var(--vg-files-info-image-padding);
96
- border: var(--vg-files-info-image-border);
97
273
 
98
- &:after {
99
- content: '';
100
- display: block;
101
- padding-bottom: 100%;
274
+ @include vgfiles-sortable();
275
+ @include vgfiles-state();
276
+
277
+ &:last-child {
278
+ border-bottom: none;
279
+ }
280
+
281
+ &:hover {
282
+ background-color: var(--vg-files-info-hover-bg);
102
283
  }
103
284
 
104
285
  > * {
105
- height: calc(100% - 10px);
106
- width: calc(100% - 10px);
107
- position: absolute;
286
+ transition: all .2s ease-in-out;
108
287
  }
109
288
 
110
- &:last-child {
111
- margin-right: 0;
289
+ &-image {
290
+ flex: 0 0 var(--vg-files-image-width);
291
+ width: var(--vg-files-image-width);
292
+ height: var(--vg-files-image-height);
293
+ border-radius: var(--vg-files-info-image-radius);
294
+ overflow: hidden;
295
+
296
+ img {
297
+ object-fit: cover;
298
+ width: 100%;
299
+ height: 100%;
300
+ object-position: center;
301
+ }
302
+
303
+ i {
304
+ display: flex;
305
+ align-items: center;
306
+ width: 100%;
307
+ height: 100%;
308
+
309
+ svg {
310
+ width: 90%;
311
+ height: 90%;
312
+
313
+ path {
314
+ fill: var(--vg-secondary);
315
+ }
316
+ }
317
+ }
318
+ }
319
+
320
+ &-info {
321
+ flex: 1; // 0 0 var(--vg-files-info-width)
322
+ max-width: var(--vg-files-info-width);
323
+ display: flex;
324
+ gap: 4px;
325
+ align-items: center;
326
+
327
+ .iteration {
328
+ color: var(--vg-secondary);
329
+ font-size: var(--vg-files-info-iteration-font-size);
330
+ display: none;
331
+ }
332
+
333
+ .name {
334
+ display: block;
335
+ overflow: hidden;
336
+ text-overflow: ellipsis;
337
+ white-space: nowrap;
338
+ font-size: var(--vg-files-info-name-font-size);
339
+ }
340
+
341
+ .size {
342
+ color: var(--vg-secondary);
343
+ font-size: var(--vg-files-info-size-font-size);
344
+ white-space: nowrap;
345
+ margin-left: auto;
346
+ }
347
+ }
348
+
349
+ &-remove {
350
+ flex: 0 0 var(--vg-files-remove-width);
351
+ width: var(--vg-files-remove-width);
352
+ margin-left: auto;
353
+
354
+ button {
355
+ width: var(--vg-files-remove-width);
356
+ height: var(--vg-files-remove-height);
357
+ border: none;
358
+ background: transparent;
359
+ cursor: pointer;
360
+ outline: none;
361
+ padding: 0;
362
+ display: flex;
363
+ align-items: center;
364
+ justify-content: center;
365
+ transition: all .2s ease-in-out;
366
+ position: relative;
367
+
368
+ &:hover {
369
+ --vg-button-color: var(--vg-danger);
370
+ }
371
+
372
+ i {
373
+ svg {
374
+ width: var(--vg-files-info-remove-icon-size);
375
+ height: var(--vg-files-info-remove-icon-size);
376
+ position: absolute;
377
+ left: 50%;
378
+ top: 50%;
379
+ transform: translate(-50%, -50%);
380
+
381
+ path {
382
+ fill: var(--vg-button-color);
383
+ }
384
+ }
385
+ }
386
+ }
387
+ }
388
+
389
+ &:not(.with-image) {
390
+ .file-info {
391
+ .iteration {
392
+ display: block;
393
+ }
394
+ }
395
+ }
396
+ }
397
+
398
+ &.list-row {
399
+ .file {
400
+ border: none;
401
+
402
+ .file-remove {
403
+ position: absolute;
404
+ right: 0;
405
+ top: 4px;
406
+ width: var(--vg-files-info-row-remove-size);
407
+ height: var(--vg-files-info-row-remove-size);
408
+ display: flex;
409
+ align-items: center;
410
+ justify-content: center;
411
+
412
+ button {
413
+ width: 100%;
414
+ height: 100%;
415
+ display: flex;
416
+ align-items: center;
417
+ justify-content: center;
418
+ background: var(--vg-secondary-bg);
419
+ border-radius: 50%;
420
+
421
+ i {
422
+ display: flex;
423
+ width: 100%;
424
+ height: 100%;
425
+ align-items: center;
426
+ justify-content: center;
427
+
428
+ svg {
429
+ width: var(--vg-files-info-row-remove-icon-size);
430
+ height: var(--vg-files-info-row-remove-icon-size);
431
+
432
+ path {
433
+ fill: var(--vg-body-color);
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }
112
439
  }
440
+ }
441
+ }
442
+ }
443
+
444
+ &-drop {
445
+ background-color: var(--vg-files-drop-bg);
446
+ border: var(--vg-files-drop-border-width) var(--vg-files-drop-border-style) var(--vg-files-drop-border-color);
447
+ cursor: pointer;
448
+ height: var(--vg-files-drop-height);
449
+ text-align: center;
450
+ max-width: 100%;
451
+ overflow: hidden;
452
+ position: relative;
453
+ width: 100%;
454
+ transition: var(--vg-files-drop-transition);
455
+ border-radius: var(--vg-files-drop-radius);
456
+
457
+ &.active {
458
+ border: none;
459
+ height: auto;
460
+ min-height: var(--vg-files-drop-height);
461
+
462
+ &:hover {
463
+ animation: none;
464
+ background-image: none;
465
+ }
466
+ }
467
+
468
+ &::after {
469
+ content: "Отпустите, чтобы загрузить";
470
+ position: absolute;
471
+ bottom: var(--vg-files-drop-after-bottom);
472
+ left: 0;
473
+ right: 0;
474
+ font-size: var(--vg-files-drop-after-font-size);
475
+ color: var(--vg-files-drop-after-color);
476
+ opacity: 0;
477
+ transition: opacity 0.2s;
478
+ pointer-events: none;
479
+ }
480
+
481
+ &:hover {
482
+ animation: stripes var(--vg-files-drop-stripes-duration) linear infinite;
483
+ background-image: linear-gradient(
484
+ -45deg,
485
+ rgba(var(--vg-secondary-rgb), var(--vg-files-drop-stripes-alpha)) 25%,
486
+ transparent 0,
487
+ transparent 50%,
488
+ rgba(var(--vg-secondary-rgb), var(--vg-files-drop-stripes-alpha)) 0,
489
+ rgba(var(--vg-secondary-rgb), var(--vg-files-drop-stripes-alpha)) 75%,
490
+ transparent 0,
491
+ transparent
492
+ );
493
+ background-size: var(--vg-files-drop-stripes-size);
494
+ }
495
+
496
+ &:is(.drop-hover, .drop-active) {
497
+ border-color: var(--vg-files-drop-hover-border-color);
498
+ background-color: var(--vg-files-drop-hover-bg);
499
+ box-shadow: var(--vg-files-drop-hover-shadow);
500
+ }
501
+
502
+ &.drop-active::after {
503
+ opacity: 1;
504
+ }
113
505
 
114
- img {
115
- object-fit: cover;
116
- object-position: center;
506
+ > * {
507
+ display: block;
508
+ }
509
+
510
+ &-message {
511
+ width: 100%;
512
+ height: 100%;
513
+ display: flex;
514
+ flex-direction: column;
515
+ justify-content: center;
516
+ align-items: center;
517
+ gap: var(--vg-files-drop-message-gap);
518
+ font-size: var(--vg-files-drop-message-font-size);
519
+ line-height: var(--vg-files-drop-message-line-height);
520
+ color: var(--vg-files-drop-message-color);
521
+
522
+ &:not(.show) {
523
+ display: none;
524
+ }
525
+
526
+ .icon {
527
+ width: var(--vg-files-drop-message-icon-size);
528
+ height: var(--vg-files-drop-message-icon-size);
529
+
530
+ svg {
531
+ width: 100%;
532
+ height: 100%;
533
+
534
+ path {
535
+ fill: var(--vg-files-drop-message-icon-color);
536
+ }
117
537
  }
118
538
  }
119
539
  }
120
540
 
121
541
  &--list {
122
- padding: 0;
542
+ display: flex;
543
+ align-items: center;
544
+ gap: var(--vg-files-drop-list-gap);
545
+ flex-wrap: wrap;
546
+ margin: 0;
547
+ padding: var(--vg-files-drop-list-padding);
548
+ width: 100%;
549
+ height: 100%;
550
+ border-radius: var(--vg-files-drop-radius);
551
+ overflow: hidden;
123
552
 
124
- li {
125
- font-size: var(--vg-files-info-list-fs);
126
- display: flex;
127
- align-items: baseline;
553
+ .file {
554
+ --vg-button-color: var(--vg-body-color);
555
+ border-radius: var(--vg-files-drop-file-radius);
556
+ position: relative;
557
+ overflow: hidden;
558
+ flex: 0 0 var(--vg-files-drop-file-flex);
559
+ height: var(--vg-files-drop-file-height);
560
+
561
+ @include vgfiles-sortable();
562
+ @include vgfiles-state();
563
+
564
+ .file-image {
565
+ width: 100%;
566
+ height: 100%;
567
+ overflow: hidden;
128
568
 
129
- + li {
130
- margin-top: var(--vg-files-info-list-mt);
569
+ img {
570
+ object-fit: cover;
571
+ width: 100%;
572
+ height: 100%;
573
+ object-position: center;
574
+ }
131
575
  }
132
576
 
133
- span {
134
- font-size: var(--vg-files-info-list-span-fs);
135
- color: var(--vg-files-info-list-span-color);
136
- display: inline-block;
137
- margin-right: var(--vg-files-info-list-span-me);
577
+ &.single {
578
+ flex: 0 0 100%;
579
+ gap: 0;
580
+ height: 100%;
581
+ display: flex;
582
+ align-items: center;
583
+ justify-content: center;
138
584
 
139
- &:nth-child(2) {
140
- --vg-files-info-list-span-fs: 15px;
141
- --vg-files-info-list-span-color: #000000;
585
+ &-image {
586
+ .file-image {
587
+ width: 100%;
588
+ height: 100%;
589
+ overflow: hidden;
590
+ }
142
591
  }
143
592
 
144
- &:last-child {
145
- margin-left: auto;
146
- white-space: nowrap;
593
+ &-file {
594
+ .file-image {
595
+ width: 100%;
596
+ height: 100%;
597
+ overflow: hidden;
598
+
599
+ i {
600
+ width: 100%;
601
+ height: 100%;
602
+ display: flex;
603
+ align-items: center;
604
+ justify-content: center;
605
+
606
+ svg {
607
+ width: 50%;
608
+ height: 50%;
609
+
610
+ path {
611
+ fill: var(--vg-secondary);
612
+ }
613
+ }
614
+ }
615
+ }
616
+ }
617
+ }
618
+
619
+ &-remove {
620
+ position: absolute;
621
+ right: var(--vg-files-drop-remove-offset);
622
+ top: var(--vg-files-drop-remove-offset);
623
+
624
+ button {
625
+ background: var(--vg-body-bg);
626
+ color: var(--vg-body-color);
627
+ border: none;
628
+ cursor: pointer;
629
+ outline: none;
630
+ padding: 0;
631
+ display: flex;
632
+ align-items: center;
633
+ justify-content: center;
634
+ transition: all .2s ease-in-out;
635
+ position: relative;
636
+ width: var(--vg-files-drop-remove-size);
637
+ height: var(--vg-files-drop-remove-size);
638
+ border-radius: var(--vg-files-drop-remove-radius);
639
+
640
+ &:hover {
641
+ background-color: var(--vg-files-drop-remove-hover-bg);
642
+ }
643
+
644
+ i {
645
+ position: absolute;
646
+ left: 0;
647
+ top: 0;
648
+ width: 100%;
649
+ height: 100%;
650
+ display: flex;
651
+ align-items: center;
652
+ justify-content: center;
653
+
654
+ svg {
655
+ path {
656
+ fill: var(--vg-button-color);
657
+ }
658
+ }
659
+ }
147
660
  }
148
661
  }
149
662
  }
@@ -356,7 +356,11 @@ class VGFormSender extends BaseModule {
356
356
  }
357
357
 
358
358
  _this._statusButton('before');
359
- EventHandler.trigger(_this._element, EVENT_KEY_BEFORE, _this);
359
+ EventHandler.trigger(_this._element, EVENT_KEY_BEFORE, {
360
+ vgformsender: {
361
+ self: _this
362
+ }
363
+ });
360
364
  }
361
365
 
362
366
  /**