@tomasvn/glightbox 0.0.0-stage → 3.3.4

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 (46) hide show
  1. package/.editorconfig +16 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.json +94 -0
  4. package/.github/FUNDING.yml +3 -0
  5. package/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  6. package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  7. package/.github/stale.yml +21 -0
  8. package/.github/workflows/greetings.yml +13 -0
  9. package/.husky/pre-commit +3 -0
  10. package/.lando.yml +10 -0
  11. package/.prettierignore +3 -0
  12. package/.prettierrc.json +30 -0
  13. package/CHANGELOG.md +259 -0
  14. package/CONTRIBUTING.md +29 -0
  15. package/LICENSE.md +21 -0
  16. package/README.md +714 -2
  17. package/bower.json +29 -0
  18. package/development/build.js +44 -0
  19. package/development/jscompiler.js +90 -0
  20. package/development/notifications.js +15 -0
  21. package/development/package.js +116 -0
  22. package/development/postcss.js +63 -0
  23. package/development/watcher.js +105 -0
  24. package/dist/css/glightbox.css +939 -0
  25. package/dist/css/glightbox.min.css +1 -0
  26. package/dist/js/glightbox.js +3109 -0
  27. package/dist/js/glightbox.min.js +1 -0
  28. package/index.d.ts +586 -0
  29. package/package.json +60 -4
  30. package/src/js/.jshintrc +6 -0
  31. package/src/js/core/drag.js +203 -0
  32. package/src/js/core/keyboard-navigation.js +101 -0
  33. package/src/js/core/slide-parser.js +236 -0
  34. package/src/js/core/slide.js +251 -0
  35. package/src/js/core/touch-events.js +378 -0
  36. package/src/js/core/touch-navigation.js +291 -0
  37. package/src/js/core/zoom.js +156 -0
  38. package/src/js/glightbox.js +1351 -0
  39. package/src/js/slides/iframe.js +24 -0
  40. package/src/js/slides/image.js +56 -0
  41. package/src/js/slides/inline.js +71 -0
  42. package/src/js/slides/video.js +108 -0
  43. package/src/js/utils/helpers.js +541 -0
  44. package/src/postcss/glightbox.css +725 -0
  45. package/tests/slide.test.mjs +130 -0
  46. package/tests/touch-navigation.test.mjs +13 -0
@@ -0,0 +1,725 @@
1
+ @custom-media --small-viewport (width >=576px);
2
+ @custom-media --medium-small-viewport (width > 768px);
3
+ @custom-media --medium-viewport (width >=992px);
4
+ @custom-media --large-viewport (width >=1200px);
5
+
6
+ .glightbox-container {
7
+ width: 100%;
8
+ height: 100%;
9
+ position: fixed;
10
+ top: 0;
11
+ left: 0;
12
+ z-index: 999999 !important;
13
+ overflow: hidden;
14
+ touch-action: none;
15
+ text-size-adjust: 100%;
16
+ backface-visibility: hidden;
17
+ outline: none;
18
+
19
+ &.inactive {
20
+ display: none;
21
+ }
22
+
23
+ & .gcontainer {
24
+ position: relative;
25
+ width: 100%;
26
+ height: 100%;
27
+ z-index: 9999;
28
+ overflow: hidden;
29
+ }
30
+
31
+ .gslider {
32
+ transition: transform 0.4s ease;
33
+ height: 100%;
34
+ left: 0;
35
+ top: 0;
36
+ width: 100%;
37
+ position: relative;
38
+ overflow: hidden;
39
+ display: flex !important;
40
+ justify-content: center;
41
+ align-items: center;
42
+ transform: translate3d(0, 0, 0);
43
+ }
44
+
45
+ .gslide {
46
+ width: 100%;
47
+ position: absolute;
48
+ user-select: none;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ opacity: 0;
53
+
54
+ &.current {
55
+ opacity: 1;
56
+ z-index: 99999;
57
+ position: relative;
58
+ }
59
+
60
+ &.prev {
61
+ opacity: 1;
62
+ z-index: 9999;
63
+ }
64
+ }
65
+
66
+ .gslide-inner-content {
67
+ width: 100%;
68
+ }
69
+
70
+ .ginner-container {
71
+ position: relative;
72
+ width: 100%;
73
+ display: flex;
74
+ justify-content: center;
75
+ flex-direction: column;
76
+ max-width: 100%;
77
+ margin: auto;
78
+ height: 100vh;
79
+
80
+ &.gvideo-container {
81
+ width: 100%;
82
+ }
83
+
84
+ @media (--medium-small-viewport) {
85
+ width: auto;
86
+ height: auto;
87
+ flex-direction: row;
88
+ }
89
+
90
+ &.desc-bottom,
91
+ &.desc-top {
92
+ flex-direction: column;
93
+ }
94
+
95
+ &.desc-left,
96
+ &.desc-right {
97
+ max-width: 100% !important;
98
+ }
99
+
100
+ &.desc-top {
101
+ @media (--medium-small-viewport) {
102
+ .gslide-description {
103
+ order: 0;
104
+ }
105
+ .gslide-image,
106
+ .gslide-image img {
107
+ order: 1;
108
+ }
109
+ }
110
+ }
111
+
112
+ &.desc-left {
113
+ @media (--medium-small-viewport) {
114
+ .gslide-description {
115
+ order: 0;
116
+ }
117
+ .gslide-image {
118
+ order: 1;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ .gslide {
126
+ iframe,
127
+ video {
128
+ outline: none !important;
129
+ border: none;
130
+ min-height: 165px;
131
+ -webkit-overflow-scrolling: touch;
132
+ touch-action: auto;
133
+ }
134
+ }
135
+
136
+ .gslide:not(.current) {
137
+ pointer-events: none;
138
+ }
139
+
140
+ .gslide-image {
141
+ align-items: center;
142
+
143
+ img {
144
+ max-height: 100vh;
145
+ display: block;
146
+ padding: 0;
147
+ float: none;
148
+ outline: none;
149
+ border: none;
150
+ user-select: none;
151
+ max-width: 100vw;
152
+ width: auto;
153
+ height: auto;
154
+ object-fit: cover;
155
+ touch-action: none;
156
+ margin: auto;
157
+ min-width: 200px;
158
+
159
+ @media (--medium-small-viewport) {
160
+ max-height: 97vh;
161
+ max-width: 100%;
162
+ }
163
+
164
+ .desc-top &,
165
+ .desc-bottom & {
166
+ width: auto;
167
+ }
168
+
169
+ .desc-left &,
170
+ .desc-right & {
171
+ width: auto;
172
+ max-width: 100%;
173
+ }
174
+
175
+ &.zoomable {
176
+ position: relative;
177
+
178
+ @media (--medium-small-viewport) {
179
+ cursor: zoom-in;
180
+
181
+ .zoomed & {
182
+ cursor: grab;
183
+ }
184
+ }
185
+ }
186
+
187
+ &.dragging {
188
+ cursor: grabbing !important;
189
+ transition: none;
190
+ }
191
+ }
192
+ }
193
+
194
+ .gslide-video {
195
+ position: relative;
196
+ max-width: 100vh;
197
+ width: 100% !important;
198
+
199
+ .plyr__poster-enabled.plyr--loading {
200
+ .plyr__poster {
201
+ display: none;
202
+ }
203
+ }
204
+
205
+ .gvideo-wrapper {
206
+ width: 100%;
207
+ /* max-width: 160vmin; */
208
+ margin: auto;
209
+ }
210
+
211
+ &::before {
212
+ content: '';
213
+ position: absolute;
214
+ width: 100%;
215
+ height: 100%;
216
+ background: rgba(255, 0, 0, 0.34);
217
+ display: none;
218
+ }
219
+ &.playing::before {
220
+ display: none;
221
+ }
222
+
223
+ &.fullscreen {
224
+ max-width: 100% !important;
225
+ min-width: 100%;
226
+ height: 75vh;
227
+
228
+ video {
229
+ max-width: 100% !important;
230
+ width: 100% !important;
231
+ }
232
+ }
233
+ }
234
+
235
+ .gslide-inline {
236
+ background: #fff;
237
+ text-align: left;
238
+ max-height: calc(100vh - 40px);
239
+ overflow: auto;
240
+ max-width: 100%;
241
+ margin: auto;
242
+
243
+ @media (--medium-small-viewport) {
244
+ max-height: 95vh;
245
+ }
246
+
247
+ .ginlined-content {
248
+ padding: 20px;
249
+ width: 100%;
250
+ }
251
+
252
+ .dragging {
253
+ cursor: grabbing !important;
254
+ transition: none;
255
+ }
256
+ }
257
+
258
+ .ginlined-content {
259
+ overflow: auto;
260
+ display: block !important;
261
+ opacity: 1;
262
+ }
263
+
264
+ .gslide-external {
265
+ display: flex;
266
+ width: 100%;
267
+ min-width: 100%;
268
+ background: #fff;
269
+ padding: 0;
270
+ overflow: auto;
271
+ max-height: 75vh;
272
+ height: 100%;
273
+
274
+ @media (--medium-small-viewport) {
275
+ max-height: 100vh;
276
+ }
277
+ }
278
+
279
+ .gslide-media {
280
+ display: flex;
281
+ width: auto;
282
+
283
+ .zoomed & {
284
+ box-shadow: none !important;
285
+ }
286
+
287
+ .desc-top &,
288
+ .desc-bottom & {
289
+ margin: 0 auto;
290
+ flex-direction: column;
291
+ }
292
+ }
293
+
294
+ .gslide-description {
295
+ position: relative;
296
+ flex: 1 0 100%;
297
+
298
+ &.description-left,
299
+ &.description-right {
300
+ max-width: 100%;
301
+
302
+ @media (--medium-small-viewport) {
303
+ max-width: 275px;
304
+ }
305
+ }
306
+
307
+ &.description-bottom,
308
+ &.description-top {
309
+ margin: 0 auto;
310
+ width: 100%;
311
+ }
312
+
313
+ p {
314
+ margin-bottom: 12px;
315
+
316
+ &:last-child {
317
+ margin-bottom: 0;
318
+ }
319
+ }
320
+
321
+ .zoomed & {
322
+ display: none;
323
+ }
324
+ }
325
+
326
+ .glightbox-button-hidden {
327
+ display: none;
328
+ }
329
+
330
+ /*
331
+ * Description for mobiles
332
+ * something like facebook does the description
333
+ * for the photos
334
+ */
335
+ .glightbox-mobile .glightbox-container {
336
+ .gslide-description {
337
+ height: auto !important;
338
+ width: 100%;
339
+ position: absolute;
340
+ bottom: 0;
341
+ padding: 19px 11px;
342
+ max-width: 100vw !important;
343
+ order: 2 !important;
344
+ max-height: 78vh;
345
+ overflow: auto !important;
346
+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%);
347
+ transition: opacity 0.3s linear;
348
+ padding-bottom: 50px;
349
+ }
350
+
351
+ .gslide-title {
352
+ color: #fff;
353
+ font-size: 1em;
354
+ }
355
+ .gslide-desc {
356
+ color: #a1a1a1;
357
+
358
+ a {
359
+ color: #fff;
360
+ font-weight: bold;
361
+ }
362
+
363
+ * {
364
+ color: inherit;
365
+ }
366
+ .desc-more {
367
+ color: #fff;
368
+ opacity: 0.4;
369
+ }
370
+ }
371
+ }
372
+
373
+ .glightbox-mobile.gdesc-open {
374
+ .gslide-media {
375
+ transition: opacity 0.5s ease;
376
+ opacity: 0.4;
377
+ }
378
+ .gdesc-inner {
379
+ padding-bottom: 30px;
380
+ }
381
+ }
382
+ .glightbox-mobile.gdesc-closed {
383
+ .gslide-media {
384
+ transition: opacity 0.5s ease;
385
+ opacity: 1;
386
+ }
387
+ }
388
+
389
+ .greset {
390
+ transition: all 0.3s ease;
391
+ }
392
+
393
+ .gabsolute {
394
+ position: absolute;
395
+ }
396
+
397
+ .grelative {
398
+ position: relative;
399
+ }
400
+
401
+ .glightbox-desc {
402
+ display: none !important;
403
+ }
404
+
405
+ .glightbox-open {
406
+ overflow: hidden;
407
+
408
+ @media (--medium-small-viewport) {
409
+ height: auto;
410
+ }
411
+ }
412
+
413
+ .gloader {
414
+ height: 25px;
415
+ width: 25px;
416
+ animation: lightboxLoader 0.8s infinite linear;
417
+ border: 2px solid #fff;
418
+ border-right-color: transparent;
419
+ border-radius: 50%;
420
+ position: absolute;
421
+ display: block;
422
+ z-index: 9999;
423
+ left: 0;
424
+ right: 0;
425
+ margin: 0 auto;
426
+ top: 47%;
427
+ }
428
+
429
+ .goverlay {
430
+ width: 100%;
431
+ height: calc(100vh + 1px);
432
+ position: fixed;
433
+ top: -1px;
434
+ left: 0;
435
+ background: #000;
436
+ will-change: opacity;
437
+
438
+ .glightbox-mobile & {
439
+ background: #000;
440
+ }
441
+
442
+ @media (--medium-small-viewport) {
443
+ background: rgba(0, 0, 0, 0.92);
444
+ }
445
+
446
+ @media screen and (max-height: 420px) {
447
+ background: #000;
448
+ }
449
+ }
450
+
451
+ .gprev,
452
+ .gnext,
453
+ .gclose {
454
+ z-index: 99999;
455
+ cursor: pointer;
456
+ width: 26px;
457
+ height: 44px;
458
+ border: none;
459
+ display: flex;
460
+ justify-content: center;
461
+ align-items: center;
462
+ flex-direction: column;
463
+
464
+ svg {
465
+ display: block;
466
+ width: 25px;
467
+ height: auto;
468
+ margin: 0;
469
+ padding: 0;
470
+ }
471
+
472
+ &.disabled {
473
+ opacity: 0.1;
474
+ }
475
+
476
+ .garrow {
477
+ stroke: #fff;
478
+ }
479
+ }
480
+
481
+ .gbtn.focused {
482
+ outline: 2px solid #0f3d81;
483
+ }
484
+
485
+ iframe.wait-autoplay {
486
+ opacity: 0;
487
+ }
488
+
489
+ .glightbox-closing {
490
+ .gnext,
491
+ .gprev,
492
+ .gclose {
493
+ opacity: 0 !important;
494
+ }
495
+ }
496
+
497
+ /*Skin */
498
+ .glightbox-clean {
499
+ .gslide-media {
500
+ @media (--medium-small-viewport) {
501
+ box-shadow: 1px 2px 9px 0px rgba(0, 0, 0, 0.65);
502
+ }
503
+ }
504
+
505
+ .gslide-description {
506
+ background: #fff;
507
+ }
508
+
509
+ .gdesc-inner {
510
+ padding: 22px 20px;
511
+ }
512
+
513
+ @media (--medium-small-viewport) {
514
+ .description-left,
515
+ .description-right {
516
+ .gdesc-inner {
517
+ position: absolute;
518
+ height: 100%;
519
+ overflow-y: auto;
520
+ }
521
+ }
522
+ }
523
+
524
+ .gslide-title {
525
+ font-size: 1em;
526
+ font-weight: normal;
527
+ font-family: Arial, sans-serif;
528
+ color: #000;
529
+ margin-bottom: 19px;
530
+ line-height: 1.4em;
531
+ }
532
+
533
+ .gslide-desc {
534
+ font-size: 0.86em;
535
+ font-family: Arial, sans-serif;
536
+ margin-bottom: 0;
537
+ line-height: 1.4em;
538
+ }
539
+
540
+ .gslide-video {
541
+ background: #000;
542
+ }
543
+
544
+ .gprev,
545
+ .gnext,
546
+ .gclose {
547
+ background-color: rgba(0, 0, 0, 0.75);
548
+ border-radius: 4px;
549
+
550
+ @media (--medium-small-viewport) {
551
+ background-color: rgba(0, 0, 0, 0.32);
552
+
553
+ &:hover {
554
+ background-color: rgba(0, 0, 0, 0.7);
555
+ }
556
+ }
557
+
558
+ path {
559
+ fill: #fff;
560
+ }
561
+ }
562
+
563
+ .gprev {
564
+ position: absolute;
565
+ top: -100%;
566
+ left: 30px;
567
+ width: 40px;
568
+ height: 50px;
569
+
570
+ @media (--medium-small-viewport) {
571
+ top: 45%;
572
+ }
573
+ }
574
+
575
+ .gnext {
576
+ position: absolute;
577
+ top: -100%;
578
+ right: 30px;
579
+ width: 40px;
580
+ height: 50px;
581
+
582
+ @media (--medium-small-viewport) {
583
+ top: 45%;
584
+ }
585
+ }
586
+
587
+ .gclose {
588
+ width: 35px;
589
+ height: 35px;
590
+ top: 15px;
591
+ right: 10px;
592
+ position: absolute;
593
+
594
+ svg {
595
+ width: 18px;
596
+ height: auto;
597
+ }
598
+
599
+ @media (--medium-viewport) {
600
+ opacity: 0.7;
601
+ right: 20px;
602
+ }
603
+
604
+ &:hover {
605
+ opacity: 1;
606
+ }
607
+ }
608
+ }
609
+
610
+ /*CSS Animations*/
611
+ .gfadeIn {
612
+ animation: gfadeIn 0.5s ease;
613
+ }
614
+ .gfadeOut {
615
+ animation: gfadeOut 0.5s ease;
616
+ }
617
+ .gslideOutLeft {
618
+ animation: gslideOutLeft 0.3s ease;
619
+ }
620
+ .gslideInLeft {
621
+ animation: gslideInLeft 0.3s ease;
622
+ }
623
+ .gslideOutRight {
624
+ animation: gslideOutRight 0.3s ease;
625
+ }
626
+ .gslideInRight {
627
+ animation: gslideInRight 0.3s ease;
628
+ }
629
+ .gzoomIn {
630
+ animation: gzoomIn 0.5s ease;
631
+ }
632
+ .gzoomOut {
633
+ animation: gzoomOut 0.5s ease;
634
+ }
635
+
636
+ @keyframes lightboxLoader {
637
+ 0% {
638
+ transform: rotate(0deg);
639
+ }
640
+ 100% {
641
+ transform: rotate(360deg);
642
+ }
643
+ }
644
+ @keyframes gfadeIn {
645
+ from {
646
+ opacity: 0;
647
+ }
648
+ to {
649
+ opacity: 1;
650
+ }
651
+ }
652
+ @keyframes gfadeOut {
653
+ from {
654
+ opacity: 1;
655
+ }
656
+ to {
657
+ opacity: 0;
658
+ }
659
+ }
660
+ @keyframes gslideInLeft {
661
+ from {
662
+ opacity: 0;
663
+ transform: translate3d(-60%, 0, 0);
664
+ }
665
+ to {
666
+ visibility: visible;
667
+ transform: translate3d(0, 0, 0);
668
+ opacity: 1;
669
+ }
670
+ }
671
+ @keyframes gslideOutLeft {
672
+ from {
673
+ opacity: 1;
674
+ visibility: visible;
675
+ transform: translate3d(0, 0, 0);
676
+ }
677
+ to {
678
+ transform: translate3d(-60%, 0, 0);
679
+ opacity: 0;
680
+ visibility: hidden;
681
+ }
682
+ }
683
+ @keyframes gslideInRight {
684
+ from {
685
+ opacity: 0;
686
+ visibility: visible;
687
+ transform: translate3d(60%, 0, 0);
688
+ }
689
+ to {
690
+ transform: translate3d(0, 0, 0);
691
+ opacity: 1;
692
+ }
693
+ }
694
+ @keyframes gslideOutRight {
695
+ from {
696
+ opacity: 1;
697
+ visibility: visible;
698
+ transform: translate3d(0, 0, 0);
699
+ }
700
+ to {
701
+ transform: translate3d(60%, 0, 0);
702
+ opacity: 0;
703
+ }
704
+ }
705
+ @keyframes gzoomIn {
706
+ from {
707
+ opacity: 0;
708
+ transform: scale3d(0.3, 0.3, 0.3);
709
+ }
710
+ to {
711
+ opacity: 1;
712
+ }
713
+ }
714
+ @keyframes gzoomOut {
715
+ from {
716
+ opacity: 1;
717
+ }
718
+ 50% {
719
+ opacity: 0;
720
+ transform: scale3d(0.3, 0.3, 0.3);
721
+ }
722
+ to {
723
+ opacity: 0;
724
+ }
725
+ }