@tomasvn/glightbox 0.0.0-stage → 3.3.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.
Files changed (41) hide show
  1. package/.editorconfig +16 -0
  2. package/.eslintrc.json +94 -0
  3. package/.github/FUNDING.yml +3 -0
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  6. package/.github/stale.yml +21 -0
  7. package/.github/workflows/greetings.yml +13 -0
  8. package/.lando.yml +10 -0
  9. package/.prettierignore +1 -0
  10. package/.prettierrc.json +31 -0
  11. package/CHANGELOG.md +247 -0
  12. package/CONTRIBUTING.md +29 -0
  13. package/LICENSE.md +21 -0
  14. package/README.md +710 -2
  15. package/bower.json +29 -0
  16. package/development/jscompiler.js +84 -0
  17. package/development/notifications.js +15 -0
  18. package/development/package.js +116 -0
  19. package/development/postcss.js +63 -0
  20. package/development/watcher.js +105 -0
  21. package/dist/css/glightbox.css +939 -0
  22. package/dist/css/glightbox.min.css +1 -0
  23. package/dist/js/glightbox.js +3087 -0
  24. package/dist/js/glightbox.min.js +1 -0
  25. package/index.d.ts +570 -0
  26. package/package.json +55 -4
  27. package/src/js/.jshintrc +6 -0
  28. package/src/js/core/drag.js +219 -0
  29. package/src/js/core/keyboard-navigation.js +98 -0
  30. package/src/js/core/slide-parser.js +231 -0
  31. package/src/js/core/slide.js +245 -0
  32. package/src/js/core/touch-events.js +378 -0
  33. package/src/js/core/touch-navigation.js +287 -0
  34. package/src/js/core/zoom.js +156 -0
  35. package/src/js/glightbox.js +1341 -0
  36. package/src/js/slides/iframe.js +24 -0
  37. package/src/js/slides/image.js +56 -0
  38. package/src/js/slides/inline.js +71 -0
  39. package/src/js/slides/video.js +105 -0
  40. package/src/js/utils/helpers.js +541 -0
  41. package/src/postcss/glightbox.css +723 -0
@@ -0,0 +1,723 @@
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
+ .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
+ .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
+ color: #000;
528
+ margin-bottom: 19px;
529
+ line-height: 1.4em;
530
+ }
531
+
532
+ .gslide-desc {
533
+ font-size: 0.86em;
534
+ margin-bottom: 0;
535
+ line-height: 1.4em;
536
+ }
537
+
538
+ .gslide-video {
539
+ background: #000;
540
+ }
541
+
542
+ .gprev,
543
+ .gnext,
544
+ .gclose {
545
+ background-color: rgba(0, 0, 0, 0.75);
546
+ border-radius: 4px;
547
+
548
+ @media (--medium-small-viewport) {
549
+ background-color: rgba(0, 0, 0, 0.32);
550
+
551
+ &:hover {
552
+ background-color: rgba(0, 0, 0, 0.7);
553
+ }
554
+ }
555
+
556
+ path {
557
+ fill: #fff;
558
+ }
559
+ }
560
+
561
+ .gprev {
562
+ position: absolute;
563
+ top: -100%;
564
+ left: 30px;
565
+ width: 40px;
566
+ height: 50px;
567
+
568
+ @media (--medium-small-viewport) {
569
+ top: 45%;
570
+ }
571
+ }
572
+
573
+ .gnext {
574
+ position: absolute;
575
+ top: -100%;
576
+ right: 30px;
577
+ width: 40px;
578
+ height: 50px;
579
+
580
+ @media (--medium-small-viewport) {
581
+ top: 45%;
582
+ }
583
+ }
584
+
585
+ .gclose {
586
+ width: 35px;
587
+ height: 35px;
588
+ top: 15px;
589
+ right: 10px;
590
+ position: absolute;
591
+
592
+ svg {
593
+ width: 18px;
594
+ height: auto;
595
+ }
596
+
597
+ @media (--medium-viewport) {
598
+ opacity: 0.7;
599
+ right: 20px;
600
+ }
601
+
602
+ &:hover {
603
+ opacity: 1;
604
+ }
605
+ }
606
+ }
607
+
608
+ /*CSS Animations*/
609
+ .gfadeIn {
610
+ animation: gfadeIn 0.5s ease;
611
+ }
612
+ .gfadeOut {
613
+ animation: gfadeOut 0.5s ease;
614
+ }
615
+ .gslideOutLeft {
616
+ animation: gslideOutLeft 0.3s ease;
617
+ }
618
+ .gslideInLeft {
619
+ animation: gslideInLeft 0.3s ease;
620
+ }
621
+ .gslideOutRight {
622
+ animation: gslideOutRight 0.3s ease;
623
+ }
624
+ .gslideInRight {
625
+ animation: gslideInRight 0.3s ease;
626
+ }
627
+ .gzoomIn {
628
+ animation: gzoomIn 0.5s ease;
629
+ }
630
+ .gzoomOut {
631
+ animation: gzoomOut 0.5s ease;
632
+ }
633
+
634
+ @keyframes lightboxLoader {
635
+ 0% {
636
+ transform: rotate(0deg);
637
+ }
638
+ 100% {
639
+ transform: rotate(360deg);
640
+ }
641
+ }
642
+ @keyframes gfadeIn {
643
+ from {
644
+ opacity: 0;
645
+ }
646
+ to {
647
+ opacity: 1;
648
+ }
649
+ }
650
+ @keyframes gfadeOut {
651
+ from {
652
+ opacity: 1;
653
+ }
654
+ to {
655
+ opacity: 0;
656
+ }
657
+ }
658
+ @keyframes gslideInLeft {
659
+ from {
660
+ opacity: 0;
661
+ transform: translate3d(-60%, 0, 0);
662
+ }
663
+ to {
664
+ visibility: visible;
665
+ transform: translate3d(0, 0, 0);
666
+ opacity: 1;
667
+ }
668
+ }
669
+ @keyframes gslideOutLeft {
670
+ from {
671
+ opacity: 1;
672
+ visibility: visible;
673
+ transform: translate3d(0, 0, 0);
674
+ }
675
+ to {
676
+ transform: translate3d(-60%, 0, 0);
677
+ opacity: 0;
678
+ visibility: hidden;
679
+ }
680
+ }
681
+ @keyframes gslideInRight {
682
+ from {
683
+ opacity: 0;
684
+ visibility: visible;
685
+ transform: translate3d(60%, 0, 0);
686
+ }
687
+ to {
688
+ transform: translate3d(0, 0, 0);
689
+ opacity: 1;
690
+ }
691
+ }
692
+ @keyframes gslideOutRight {
693
+ from {
694
+ opacity: 1;
695
+ visibility: visible;
696
+ transform: translate3d(0, 0, 0);
697
+ }
698
+ to {
699
+ transform: translate3d(60%, 0, 0);
700
+ opacity: 0;
701
+ }
702
+ }
703
+ @keyframes gzoomIn {
704
+ from {
705
+ opacity: 0;
706
+ transform: scale3d(0.3, 0.3, 0.3);
707
+ }
708
+ to {
709
+ opacity: 1;
710
+ }
711
+ }
712
+ @keyframes gzoomOut {
713
+ from {
714
+ opacity: 1;
715
+ }
716
+ 50% {
717
+ opacity: 0;
718
+ transform: scale3d(0.3, 0.3, 0.3);
719
+ }
720
+ to {
721
+ opacity: 0;
722
+ }
723
+ }