uikit 3.21.13 → 3.21.14-dev.2e8a07c7e

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 (142) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/css/uikit-core-rtl.css +233 -85
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +233 -85
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +237 -81
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +237 -81
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +2 -11
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +432 -127
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +449 -132
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +2 -2
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +2 -2
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +20 -28
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +2 -2
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +25 -34
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +4 -2
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +8 -12
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +242 -241
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +20 -17
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +668 -549
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +3 -3
  43. package/src/images/icons/arrow-down-arrow-up.svg +6 -0
  44. package/src/images/icons/arrow-down.svg +3 -3
  45. package/src/images/icons/arrow-left.svg +3 -3
  46. package/src/images/icons/arrow-right.svg +3 -3
  47. package/src/images/icons/arrow-up-right.svg +3 -3
  48. package/src/images/icons/arrow-up.svg +3 -3
  49. package/src/images/icons/close-circle.svg +5 -0
  50. package/src/images/icons/cloud-download.svg +4 -4
  51. package/src/images/icons/cloud-upload.svg +4 -4
  52. package/src/images/icons/download.svg +4 -4
  53. package/src/images/icons/expand.svg +5 -5
  54. package/src/images/icons/link-external.svg +4 -4
  55. package/src/images/icons/pull.svg +4 -4
  56. package/src/images/icons/push.svg +3 -3
  57. package/src/images/icons/shrink.svg +5 -5
  58. package/src/images/icons/sign-in.svg +4 -3
  59. package/src/images/icons/sign-out.svg +4 -3
  60. package/src/images/icons/sorting.svg +6 -0
  61. package/src/images/icons/upload.svg +4 -4
  62. package/src/js/api/boot.js +16 -20
  63. package/src/js/api/events.js +12 -13
  64. package/src/js/api/instance.js +1 -1
  65. package/src/js/components/internal/lightbox-animations.js +2 -1
  66. package/src/js/components/internal/slideshow-animations.js +5 -5
  67. package/src/js/components/lightbox-panel.js +184 -45
  68. package/src/js/components/lightbox.js +59 -6
  69. package/src/js/components/slideshow.js +1 -2
  70. package/src/js/components/sortable.js +3 -1
  71. package/src/js/core/drop.js +3 -1
  72. package/src/js/core/grid.js +1 -1
  73. package/src/js/core/icon.js +2 -2
  74. package/src/js/core/img.js +3 -5
  75. package/src/js/core/navbar.js +6 -2
  76. package/src/js/core/scrollspy-nav.js +1 -1
  77. package/src/js/core/svg.js +8 -10
  78. package/src/js/core/video.js +4 -3
  79. package/src/js/mixin/internal/slideshow-animations.js +1 -6
  80. package/src/js/mixin/modal.js +1 -4
  81. package/src/js/mixin/slider-drag.js +5 -6
  82. package/src/js/mixin/slider-nav.js +4 -2
  83. package/src/js/mixin/slider.js +11 -13
  84. package/src/js/mixin/slideshow.js +1 -1
  85. package/src/js/mixin/togglable.js +7 -2
  86. package/src/js/util/dom.js +3 -1
  87. package/src/js/util/filter.js +3 -1
  88. package/src/js/util/player.js +0 -4
  89. package/src/less/components/background.less +1 -9
  90. package/src/less/components/breadcrumb.less +6 -2
  91. package/src/less/components/button.less +1 -1
  92. package/src/less/components/form-range.less +52 -0
  93. package/src/less/components/form.less +1 -1
  94. package/src/less/components/lightbox.less +57 -89
  95. package/src/less/components/margin.less +14 -0
  96. package/src/less/components/search.less +49 -23
  97. package/src/less/components/sticky.less +1 -10
  98. package/src/less/components/totop.less +1 -1
  99. package/src/less/components/transition.less +4 -4
  100. package/src/less/components/visibility.less +3 -2
  101. package/src/less/theme/form-range.less +12 -0
  102. package/src/less/theme/lightbox.less +2 -20
  103. package/src/less/theme/search.less +24 -10
  104. package/src/scss/components/background.scss +1 -9
  105. package/src/scss/components/breadcrumb.scss +6 -2
  106. package/src/scss/components/button.scss +1 -1
  107. package/src/scss/components/form-range.scss +12 -0
  108. package/src/scss/components/form.scss +1 -1
  109. package/src/scss/components/lightbox.scss +50 -77
  110. package/src/scss/components/margin.scss +13 -0
  111. package/src/scss/components/search.scss +30 -12
  112. package/src/scss/components/sticky.scss +1 -10
  113. package/src/scss/components/totop.scss +1 -1
  114. package/src/scss/components/transition.scss +4 -4
  115. package/src/scss/components/visibility.scss +3 -2
  116. package/src/scss/mixins-theme.scss +51 -12
  117. package/src/scss/mixins.scss +45 -6
  118. package/src/scss/theme/form-range.scss +10 -0
  119. package/src/scss/theme/lightbox.scss +2 -20
  120. package/src/scss/theme/search.scss +10 -6
  121. package/src/scss/variables-theme.scss +32 -20
  122. package/src/scss/variables.scss +29 -24
  123. package/tests/badge.html +2 -2
  124. package/tests/base.html +1 -1
  125. package/tests/breadcrumb.html +23 -5
  126. package/tests/card.html +24 -24
  127. package/tests/dropbar.html +15 -15
  128. package/tests/dropdown.html +6 -6
  129. package/tests/dropnav.html +100 -100
  130. package/tests/icon.html +8 -0
  131. package/tests/index.html +15 -15
  132. package/tests/lightbox.html +379 -28
  133. package/tests/margin.html +19 -0
  134. package/tests/nav.html +21 -21
  135. package/tests/navbar.html +292 -292
  136. package/tests/offcanvas.html +27 -27
  137. package/tests/placeholder.html +2 -2
  138. package/tests/slider.html +0 -1
  139. package/tests/slideshow.html +1 -1
  140. package/tests/sortable.html +5 -5
  141. package/tests/sticky-navbar.html +114 -114
  142. package/tests/transition.html +2 -1
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.21.13 | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */
1
+ /*! UIkit 3.21.14-dev.2e8a07c7e | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
@@ -20,6 +20,177 @@
20
20
  }
21
21
  }
22
22
 
23
+ function callUpdate(instance, e = "update") {
24
+ if (!instance._connected) {
25
+ return;
26
+ }
27
+ if (!instance._updates.length) {
28
+ return;
29
+ }
30
+ if (!instance._queued) {
31
+ instance._queued = /* @__PURE__ */ new Set();
32
+ util.fastdom.read(() => {
33
+ if (instance._connected) {
34
+ runUpdates(instance, instance._queued);
35
+ }
36
+ instance._queued = null;
37
+ });
38
+ }
39
+ instance._queued.add(e.type || e);
40
+ }
41
+ function runUpdates(instance, types) {
42
+ for (const { read, write, events = [] } of instance._updates) {
43
+ if (!types.has("update") && !events.some((type) => types.has(type))) {
44
+ continue;
45
+ }
46
+ let result;
47
+ if (read) {
48
+ result = read.call(instance, instance._data, types);
49
+ if (result && util.isPlainObject(result)) {
50
+ util.assign(instance._data, result);
51
+ }
52
+ }
53
+ if (write && result !== false) {
54
+ util.fastdom.write(() => {
55
+ if (instance._connected) {
56
+ write.call(instance, instance._data, types);
57
+ }
58
+ });
59
+ }
60
+ }
61
+ }
62
+
63
+ function resize(options) {
64
+ return observe(util.observeResize, options, "resize");
65
+ }
66
+ function intersection(options) {
67
+ return observe(util.observeIntersection, options);
68
+ }
69
+ function observe(observe2, options, emit) {
70
+ return {
71
+ observe: observe2,
72
+ handler() {
73
+ callUpdate(this, emit);
74
+ },
75
+ ...options
76
+ };
77
+ }
78
+
79
+ ({
80
+ args: "dataSrc",
81
+ props: {
82
+ dataSrc: String,
83
+ sources: String,
84
+ margin: String,
85
+ target: String,
86
+ loading: String
87
+ },
88
+ data: {
89
+ dataSrc: "",
90
+ sources: false,
91
+ margin: "50%",
92
+ target: false,
93
+ loading: "lazy"
94
+ },
95
+ connected() {
96
+ if (this.loading !== "lazy") {
97
+ this.load();
98
+ } else if (isImg(this.$el)) {
99
+ this.$el.loading = "lazy";
100
+ setSrcAttrs(this.$el);
101
+ }
102
+ },
103
+ disconnected() {
104
+ if (this.img) {
105
+ this.img.onload = "";
106
+ }
107
+ delete this.img;
108
+ },
109
+ observe: intersection({
110
+ handler(entries, observer) {
111
+ this.load();
112
+ observer.disconnect();
113
+ },
114
+ options: ({ margin }) => ({ rootMargin: margin }),
115
+ filter: ({ loading }) => loading === "lazy",
116
+ target: ({ $el, $props }) => $props.target ? [$el, ...util.queryAll($props.target, $el)] : $el
117
+ }),
118
+ methods: {
119
+ load() {
120
+ if (this.img) {
121
+ return this.img;
122
+ }
123
+ const image = isImg(this.$el) ? this.$el : getImageFromElement(this.$el, this.dataSrc, this.sources);
124
+ util.removeAttr(image, "loading");
125
+ setSrcAttrs(this.$el, image.currentSrc);
126
+ return this.img = image;
127
+ }
128
+ }
129
+ });
130
+ function setSrcAttrs(el, src) {
131
+ if (isImg(el)) {
132
+ const parentNode = util.parent(el);
133
+ const elements = util.isTag(parentNode, "picture") ? util.children(parentNode) : [el];
134
+ elements.forEach((el2) => setSourceProps(el2, el2));
135
+ } else if (src) {
136
+ const change = !util.includes(el.style.backgroundImage, src);
137
+ if (change) {
138
+ util.css(el, "backgroundImage", `url(${util.escape(src)})`);
139
+ util.trigger(el, util.createEvent("load", false));
140
+ }
141
+ }
142
+ }
143
+ const srcProps = ["data-src", "data-srcset", "sizes"];
144
+ function setSourceProps(sourceEl, targetEl) {
145
+ for (const prop of srcProps) {
146
+ const value = util.data(sourceEl, prop);
147
+ if (value) {
148
+ util.attr(targetEl, prop.replace(/data-/g, ""), value);
149
+ }
150
+ }
151
+ }
152
+ function getImageFromElement(el, src, sources) {
153
+ const img = new Image();
154
+ wrapInPicture(img, sources);
155
+ setSourceProps(el, img);
156
+ img.onload = () => setSrcAttrs(el, img.currentSrc);
157
+ util.attr(img, "src", src);
158
+ return img;
159
+ }
160
+ function wrapInPicture(img, sources) {
161
+ sources = parseSources(sources);
162
+ if (sources.length) {
163
+ const picture = util.fragment("<picture>");
164
+ for (const attrs of sources) {
165
+ const source = util.fragment("<source>");
166
+ util.attr(source, attrs);
167
+ util.append(picture, source);
168
+ }
169
+ util.append(picture, img);
170
+ }
171
+ }
172
+ function parseSources(sources) {
173
+ if (!sources) {
174
+ return [];
175
+ }
176
+ if (util.startsWith(sources, "[")) {
177
+ try {
178
+ sources = JSON.parse(sources);
179
+ } catch (e) {
180
+ sources = [];
181
+ }
182
+ } else {
183
+ sources = parseOptions(sources);
184
+ }
185
+ if (!util.isArray(sources)) {
186
+ sources = [sources];
187
+ }
188
+ return sources.filter((source) => !util.isEmpty(source));
189
+ }
190
+ function isImg(el) {
191
+ return util.isTag(el, "img");
192
+ }
193
+
23
194
  let prevented;
24
195
  function preventBackgroundScroll(el) {
25
196
  const off = util.on(
@@ -92,6 +263,16 @@
92
263
  }
93
264
  };
94
265
 
266
+ function storeScrollPosition(element) {
267
+ const scrollElement = util.scrollParent(element);
268
+ const { scrollTop } = scrollElement;
269
+ return () => {
270
+ if (scrollTop !== scrollElement.scrollTop) {
271
+ scrollElement.scrollTop = scrollTop;
272
+ }
273
+ };
274
+ }
275
+
95
276
  var Togglable = {
96
277
  props: {
97
278
  cls: Boolean,
@@ -129,8 +310,14 @@
129
310
  util.addClass(el, cls);
130
311
  util.trigger(el, show ? "show" : "hide", [this]);
131
312
  const done = () => {
313
+ var _a;
132
314
  util.removeClass(el, cls);
133
315
  util.trigger(el, show ? "shown" : "hidden", [this]);
316
+ if (show) {
317
+ const restoreScrollPosition = storeScrollPosition(el);
318
+ (_a = util.$$("[autofocus]", el).find(util.isVisible)) == null ? void 0 : _a.focus();
319
+ restoreScrollPosition();
320
+ }
134
321
  };
135
322
  return promise ? promise.then(done, () => {
136
323
  util.removeClass(el, cls);
@@ -163,7 +350,6 @@
163
350
  if (changed) {
164
351
  util.trigger(el, "toggled", [toggled, this]);
165
352
  }
166
- util.$$("[autofocus]", el).some((el2) => util.isVisible(el2) ? el2.focus() || true : el2.blur());
167
353
  }
168
354
  }
169
355
  };
@@ -294,9 +480,6 @@
294
480
  panel: ({ selPanel }, $el) => util.$(selPanel, $el),
295
481
  transitionElement() {
296
482
  return this.panel;
297
- },
298
- bgClose({ bgClose }) {
299
- return bgClose && this.panel;
300
483
  }
301
484
  },
302
485
  connected() {
@@ -459,7 +642,7 @@
459
642
  }
460
643
  function listenForBackgroundClose(modal) {
461
644
  return util.on(document, util.pointerDown, ({ target }) => {
462
- if (util.last(active) !== modal || modal.overlay && !modal.$el.contains(target) || modal.panel.contains(target)) {
645
+ if (util.last(active) !== modal || modal.overlay && !modal.$el.contains(target) || !modal.panel || modal.panel.contains(target)) {
463
646
  return;
464
647
  }
465
648
  util.once(
@@ -482,59 +665,6 @@
482
665
  });
483
666
  }
484
667
 
485
- function callUpdate(instance, e = "update") {
486
- if (!instance._connected) {
487
- return;
488
- }
489
- if (!instance._updates.length) {
490
- return;
491
- }
492
- if (!instance._queued) {
493
- instance._queued = /* @__PURE__ */ new Set();
494
- util.fastdom.read(() => {
495
- if (instance._connected) {
496
- runUpdates(instance, instance._queued);
497
- }
498
- instance._queued = null;
499
- });
500
- }
501
- instance._queued.add(e.type || e);
502
- }
503
- function runUpdates(instance, types) {
504
- for (const { read, write, events = [] } of instance._updates) {
505
- if (!types.has("update") && !events.some((type) => types.has(type))) {
506
- continue;
507
- }
508
- let result;
509
- if (read) {
510
- result = read.call(instance, instance._data, types);
511
- if (result && util.isPlainObject(result)) {
512
- util.assign(instance._data, result);
513
- }
514
- }
515
- if (write && result !== false) {
516
- util.fastdom.write(() => {
517
- if (instance._connected) {
518
- write.call(instance, instance._data, types);
519
- }
520
- });
521
- }
522
- }
523
- }
524
-
525
- function resize(options) {
526
- return observe(util.observeResize, options, "resize");
527
- }
528
- function observe(observe2, options, emit) {
529
- return {
530
- observe: observe2,
531
- handler() {
532
- callUpdate(this, emit);
533
- },
534
- ...options
535
- };
536
- }
537
-
538
668
  var Animations$1 = {
539
669
  slide: {
540
670
  show(dir) {
@@ -555,11 +685,7 @@
555
685
  return Math.abs(new DOMMatrix(util.css(el, "transform")).m41 / el.offsetWidth);
556
686
  }
557
687
  function translate(value = 0, unit = "%") {
558
- value += value ? unit : "";
559
- return `translate3d(${value}, 0, 0)`;
560
- }
561
- function scale3d(value) {
562
- return `scale3d(${value}, ${value}, 1)`;
688
+ return value ? `translate3d(${value + unit}, 0, 0)` : "";
563
689
  }
564
690
 
565
691
  function Transitioner(prev, next, dir, { animation, easing }) {
@@ -693,7 +819,6 @@
693
819
  const pointerDown = "touchstart mousedown";
694
820
  const pointerMove = "touchmove mousemove";
695
821
  const pointerUp = "touchend touchcancel mouseup click input scroll";
696
- const preventClick = (e) => e.preventDefault();
697
822
  var SliderDrag = {
698
823
  props: {
699
824
  draggable: Boolean
@@ -761,9 +886,6 @@
761
886
  if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
762
887
  return;
763
888
  }
764
- if (!this.dragging) {
765
- util.on(this.list, "click", preventClick, pointerOptions);
766
- }
767
889
  e.cancelable && e.preventDefault();
768
890
  this.dragging = true;
769
891
  this.dir = distance < 0 ? 1 : -1;
@@ -812,6 +934,7 @@
812
934
  util.off(document, pointerMove, this.move, pointerOptions);
813
935
  util.off(document, pointerUp, this.end, pointerUpOptions);
814
936
  if (this.dragging) {
937
+ setTimeout(util.on(this.list, "click", (e) => e.preventDefault(), pointerOptions));
815
938
  this.dragging = null;
816
939
  if (this.index === this.prevIndex) {
817
940
  this.percent = 1 - this.percent;
@@ -822,6 +945,8 @@
822
945
  const dirChange = (util.isRtl ? this.dir * (util.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
823
946
  this.index = dirChange ? this.index : this.prevIndex;
824
947
  if (dirChange) {
948
+ util.trigger(this.slides[this.prevIndex], "itemhidden", [this]);
949
+ util.trigger(this.slides[this.index], "itemshown", [this]);
825
950
  this.percent = 1 - this.percent;
826
951
  }
827
952
  this.show(
@@ -830,7 +955,6 @@
830
955
  );
831
956
  }
832
957
  }
833
- setTimeout(() => util.off(this.list, "click", preventClick, pointerOptions));
834
958
  util.css(this.list, { userSelect: "" });
835
959
  this.drag = this.percent = null;
836
960
  }
@@ -855,16 +979,11 @@
855
979
  }
856
980
 
857
981
  const keyMap = {
858
- TAB: 9,
859
- ESC: 27,
860
982
  SPACE: 32,
861
983
  END: 35,
862
984
  HOME: 36,
863
985
  LEFT: 37,
864
- UP: 38,
865
- RIGHT: 39,
866
- DOWN: 40
867
- };
986
+ RIGHT: 39};
868
987
 
869
988
  var SliderNav = {
870
989
  i18n: {
@@ -978,7 +1097,9 @@
978
1097
  },
979
1098
  {
980
1099
  name: "itemshow",
981
- handler: "updateNav"
1100
+ handler() {
1101
+ this.updateNav();
1102
+ }
982
1103
  },
983
1104
  {
984
1105
  name: "keydown",
@@ -1008,7 +1129,7 @@
1008
1129
  const item = util.toNumber(cmd);
1009
1130
  const active = item === index;
1010
1131
  util.toggleClass(el, this.clsActive, active);
1011
- util.toggleClass(button, "uk-disabled", this.parallax);
1132
+ util.toggleClass(button, "uk-disabled", !!this.parallax);
1012
1133
  util.attr(button, {
1013
1134
  "aria-selected": active,
1014
1135
  tabindex: active && !this.parallax ? null : -1
@@ -1111,7 +1232,7 @@
1111
1232
  }
1112
1233
  },
1113
1234
  methods: {
1114
- show(index, force = false) {
1235
+ async show(index, force = false) {
1115
1236
  var _a;
1116
1237
  if (this.dragging || !this.length || this.parallax) {
1117
1238
  return;
@@ -1147,18 +1268,16 @@
1147
1268
  reset();
1148
1269
  return;
1149
1270
  }
1150
- const promise = this._show(prev, next, force).then(() => {
1151
- prev && util.trigger(prev, "itemhidden", [this]);
1152
- util.trigger(next, "itemshown", [this]);
1153
- stack.shift();
1154
- this._transitioner = null;
1155
- if (stack.length) {
1156
- requestAnimationFrame(() => stack.length && this.show(stack.shift(), true));
1157
- }
1158
- });
1159
1271
  prev && util.trigger(prev, "itemhide", [this]);
1160
1272
  util.trigger(next, "itemshow", [this]);
1161
- return promise;
1273
+ await this._show(prev, next, force);
1274
+ prev && util.trigger(prev, "itemhidden", [this]);
1275
+ util.trigger(next, "itemshown", [this]);
1276
+ stack.shift();
1277
+ this._transitioner = null;
1278
+ if (stack.length) {
1279
+ requestAnimationFrame(() => stack.length && this.show(stack.shift(), true));
1280
+ }
1162
1281
  },
1163
1282
  getIndex(index = this.index, prev = this.index) {
1164
1283
  return util.clamp(
@@ -1228,7 +1347,7 @@
1228
1347
  },
1229
1348
  observe: resize(),
1230
1349
  events: {
1231
- beforeitemshow({ target }) {
1350
+ itemshow({ target }) {
1232
1351
  util.addClass(target, this.clsActive);
1233
1352
  },
1234
1353
  itemshown({ target }) {
@@ -1240,6 +1359,84 @@
1240
1359
  }
1241
1360
  };
1242
1361
 
1362
+ ({
1363
+ ...Animations$1,
1364
+ fade: {
1365
+ show() {
1366
+ return [{ opacity: 0, zIndex: 0 }, { zIndex: -1 }];
1367
+ },
1368
+ percent(current) {
1369
+ return 1 - util.css(current, "opacity");
1370
+ },
1371
+ translate(percent) {
1372
+ return [{ opacity: 1 - percent, zIndex: 0 }, { zIndex: -1 }];
1373
+ }
1374
+ },
1375
+ scale: {
1376
+ show() {
1377
+ return [{ opacity: 0, transform: scale3d(1 + 0.5), zIndex: 0 }, { zIndex: -1 }];
1378
+ },
1379
+ percent(current) {
1380
+ return 1 - util.css(current, "opacity");
1381
+ },
1382
+ translate(percent) {
1383
+ return [
1384
+ { opacity: 1 - percent, transform: scale3d(1 + 0.5 * percent), zIndex: 0 },
1385
+ { zIndex: -1 }
1386
+ ];
1387
+ }
1388
+ },
1389
+ pull: {
1390
+ show(dir) {
1391
+ return dir < 0 ? [
1392
+ { transform: translate(30), zIndex: -1 },
1393
+ { transform: translate(), zIndex: 0 }
1394
+ ] : [
1395
+ { transform: translate(-100), zIndex: 0 },
1396
+ { transform: translate(), zIndex: -1 }
1397
+ ];
1398
+ },
1399
+ percent(current, next, dir) {
1400
+ return dir < 0 ? 1 - translated(next) : translated(current);
1401
+ },
1402
+ translate(percent, dir) {
1403
+ return dir < 0 ? [
1404
+ { transform: translate(30 * percent), zIndex: -1 },
1405
+ { transform: translate(-100 * (1 - percent)), zIndex: 0 }
1406
+ ] : [
1407
+ { transform: translate(-percent * 100), zIndex: 0 },
1408
+ { transform: translate(30 * (1 - percent)), zIndex: -1 }
1409
+ ];
1410
+ }
1411
+ },
1412
+ push: {
1413
+ show(dir) {
1414
+ return dir < 0 ? [
1415
+ { transform: translate(100), zIndex: 0 },
1416
+ { transform: translate(), zIndex: -1 }
1417
+ ] : [
1418
+ { transform: translate(-30), zIndex: -1 },
1419
+ { transform: translate(), zIndex: 0 }
1420
+ ];
1421
+ },
1422
+ percent(current, next, dir) {
1423
+ return dir > 0 ? 1 - translated(next) : translated(current);
1424
+ },
1425
+ translate(percent, dir) {
1426
+ return dir < 0 ? [
1427
+ { transform: translate(percent * 100), zIndex: 0 },
1428
+ { transform: translate(-30 * (1 - percent)), zIndex: -1 }
1429
+ ] : [
1430
+ { transform: translate(-30 * percent), zIndex: -1 },
1431
+ { transform: translate(100 * (1 - percent)), zIndex: 0 }
1432
+ ];
1433
+ }
1434
+ }
1435
+ });
1436
+ function scale3d(value) {
1437
+ return `scale3d(${value}, ${value}, 1)`;
1438
+ }
1439
+
1243
1440
  var Animations = {
1244
1441
  ...Animations$1,
1245
1442
  fade: {
@@ -1273,34 +1470,67 @@
1273
1470
  };
1274
1471
 
1275
1472
  var LightboxPanel = {
1473
+ i18n: {
1474
+ counter: "%s / %s"
1475
+ },
1276
1476
  mixins: [Modal, Slideshow],
1277
1477
  functional: true,
1278
1478
  props: {
1279
- delayControls: Number,
1479
+ counter: Boolean,
1280
1480
  preload: Number,
1481
+ nav: Boolean,
1482
+ slidenav: Boolean,
1483
+ delayControls: Number,
1281
1484
  videoAutoplay: Boolean,
1282
1485
  template: String
1283
1486
  },
1284
1487
  data: () => ({
1488
+ counter: false,
1285
1489
  preload: 1,
1286
- videoAutoplay: false,
1490
+ nav: false,
1491
+ slidenav: true,
1287
1492
  delayControls: 3e3,
1493
+ videoAutoplay: false,
1288
1494
  items: [],
1289
1495
  cls: "uk-open",
1290
1496
  clsPage: "uk-lightbox-page",
1291
- selList: ".uk-lightbox-items",
1497
+ clsFit: "uk-lightbox-items-fit",
1498
+ clsZoom: "uk-lightbox-zoom",
1292
1499
  attrItem: "uk-lightbox-item",
1500
+ selList: ".uk-lightbox-items",
1293
1501
  selClose: ".uk-close-large",
1502
+ selNav: ".uk-lightbox-thumbnav, .uk-lightbox-dotnav",
1294
1503
  selCaption: ".uk-lightbox-caption",
1504
+ selCounter: ".uk-lightbox-counter",
1295
1505
  pauseOnHover: false,
1296
1506
  velocity: 2,
1297
1507
  Animations,
1298
- template: `<div class="uk-lightbox uk-overflow-hidden"> <div class="uk-lightbox-items"></div> <div class="uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque"> <button class="uk-lightbox-toolbar-icon uk-close-large" type="button" uk-close></button> </div> <a class="uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade" href uk-slidenav-previous uk-lightbox-item="previous"></a> <a class="uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade" href uk-slidenav-next uk-lightbox-item="next"></a> <div class="uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div> </div>`
1508
+ template: `<div class="uk-lightbox uk-overflow-hidden"> <div class="uk-lightbox-items"></div> <div class="uk-position-top-right uk-position-small uk-transition-fade" uk-inverse> <button class="uk-lightbox-close uk-close-large" type="button" uk-close></button> </div> <div class="uk-lightbox-slidenav uk-position-center-left uk-position-medium uk-transition-fade" uk-inverse> <a href uk-slidenav-previous uk-lightbox-item="previous"></a> </div> <div class="uk-lightbox-slidenav uk-position-center-right uk-position-medium uk-transition-fade" uk-inverse> <a href uk-slidenav-next uk-lightbox-item="next"></a> </div> <div class="uk-position-center-right uk-position-medium uk-transition-fade" uk-inverse style="max-height: 90vh; overflow: auto;"> <ul class="uk-lightbox-thumbnav uk-lightbox-thumbnav-vertical uk-thumbnav uk-thumbnav-vertical"></ul> <ul class="uk-lightbox-dotnav uk-dotnav uk-dotnav-vertical"></ul> </div> <div class="uk-lightbox-counter uk-text-large uk-position-top-left uk-position-small uk-transition-fade" uk-inverse></div> <div class="uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div> </div>`
1299
1509
  }),
1300
1510
  created() {
1301
- const $el = util.$(this.template);
1511
+ let $el = util.$(this.template);
1512
+ if (util.isTag($el, "template")) {
1513
+ $el = util.fragment(util.html($el));
1514
+ }
1302
1515
  const list = util.$(this.selList, $el);
1303
- this.items.forEach(() => util.append(list, "<div>"));
1516
+ const navType = this.$props.nav;
1517
+ util.remove(util.$$(this.selNav, $el).filter((el) => !util.matches(el, `.uk-${navType}`)));
1518
+ for (const [i, item] of this.items.entries()) {
1519
+ util.append(list, "<div>");
1520
+ if (navType === "thumbnav") {
1521
+ util.wrapAll(
1522
+ toThumbnavItem(item, this.videoAutoplay),
1523
+ util.append(util.$(this.selNav, $el), `<li uk-lightbox-item="${i}"><a href></a></li>`)
1524
+ );
1525
+ }
1526
+ }
1527
+ if (!this.slidenav) {
1528
+ util.remove(util.$$(".uk-lightbox-slidenav", $el));
1529
+ }
1530
+ if (!this.counter) {
1531
+ util.remove(util.$(this.selCounter, $el));
1532
+ }
1533
+ util.addClass(list, this.clsFit);
1304
1534
  const close = util.$("[uk-close]", $el);
1305
1535
  const closeLabel = this.t("close");
1306
1536
  if (close && closeLabel) {
@@ -1309,13 +1539,10 @@
1309
1539
  this.$mount(util.append(this.container, $el));
1310
1540
  },
1311
1541
  events: [
1312
- {
1313
- name: `${util.pointerMove} ${util.pointerDown} keydown`,
1314
- handler: "showControls"
1315
- },
1316
1542
  {
1317
1543
  name: "click",
1318
1544
  self: true,
1545
+ filter: ({ bgClose }) => bgClose,
1319
1546
  delegate: ({ selList }) => `${selList} > *`,
1320
1547
  handler(e) {
1321
1548
  if (!e.defaultPrevented) {
@@ -1323,10 +1550,29 @@
1323
1550
  }
1324
1551
  }
1325
1552
  },
1553
+ {
1554
+ name: "click",
1555
+ self: true,
1556
+ delegate: ({ clsZoom }) => `.${clsZoom}`,
1557
+ handler(e) {
1558
+ if (!e.defaultPrevented) {
1559
+ util.toggleClass(this.list, this.clsFit);
1560
+ }
1561
+ }
1562
+ },
1563
+ {
1564
+ name: `${util.pointerMove} ${util.pointerDown} keydown`,
1565
+ filter: ({ delayControls }) => delayControls,
1566
+ handler() {
1567
+ this.showControls();
1568
+ }
1569
+ },
1326
1570
  {
1327
1571
  name: "shown",
1328
1572
  self: true,
1329
- handler: "showControls"
1573
+ handler() {
1574
+ this.showControls();
1575
+ }
1330
1576
  },
1331
1577
  {
1332
1578
  name: "hide",
@@ -1369,26 +1615,25 @@
1369
1615
  {
1370
1616
  name: "beforeitemshow",
1371
1617
  handler(e) {
1618
+ util.html(util.$(this.selCaption, this.$el), this.getItem().caption || "");
1619
+ util.html(
1620
+ util.$(this.selCounter, this.$el),
1621
+ this.t("counter", this.index + 1, this.slides.length)
1622
+ );
1623
+ for (let j = -this.preload; j <= this.preload; j++) {
1624
+ this.loadItem(this.index + j);
1625
+ }
1372
1626
  if (this.isToggled()) {
1373
1627
  return;
1374
1628
  }
1375
1629
  this.draggable = false;
1376
1630
  e.preventDefault();
1377
1631
  this.toggleElement(this.$el, true, false);
1378
- this.animation = Animations["scale"];
1632
+ this.animation = Animations.scale;
1379
1633
  util.removeClass(e.target, this.clsActive);
1380
1634
  this.stack.splice(1, 0, this.index);
1381
1635
  }
1382
1636
  },
1383
- {
1384
- name: "itemshow",
1385
- handler() {
1386
- util.html(util.$(this.selCaption, this.$el), this.getItem().caption || "");
1387
- for (let j = -this.preload; j <= this.preload; j++) {
1388
- this.loadItem(this.index + j);
1389
- }
1390
- }
1391
- },
1392
1637
  {
1393
1638
  name: "itemshown",
1394
1639
  handler() {
@@ -1398,29 +1643,36 @@
1398
1643
  {
1399
1644
  name: "itemload",
1400
1645
  async handler(_, item) {
1401
- const { source: src, type, alt = "", poster, attrs = {} } = item;
1402
- this.setItem(item, "<span uk-spinner></span>");
1646
+ const { source: src, type, attrs = {} } = item;
1647
+ this.setItem(item, "<span uk-spinner uk-inverse></span>");
1403
1648
  if (!src) {
1404
1649
  return;
1405
1650
  }
1406
- let matches;
1651
+ let matches2;
1407
1652
  const iframeAttrs = {
1408
1653
  allowfullscreen: "",
1409
1654
  style: "max-width: 100%; box-sizing: border-box;",
1410
1655
  "uk-responsive": "",
1411
- "uk-video": `${this.videoAutoplay}`
1656
+ "uk-video": `${Boolean(this.videoAutoplay)}`
1412
1657
  };
1413
- if (type === "image" || src.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i)) {
1414
- const img = createEl("img", { src, alt, ...attrs });
1415
- util.on(img, "load", () => this.setItem(item, img));
1658
+ if (type === "image" || isImage(src)) {
1659
+ const img = createEl("img");
1660
+ wrapInPicture(img, item.sources);
1661
+ util.attr(img, {
1662
+ src,
1663
+ ...util.pick(item, ["alt", "srcset", "sizes"]),
1664
+ ...attrs
1665
+ });
1666
+ util.on(img, "load", () => this.setItem(item, util.parent(img) || img));
1416
1667
  util.on(img, "error", () => this.setError(item));
1417
- } else if (type === "video" || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
1668
+ } else if (type === "video" || isVideo(src)) {
1669
+ const inline = this.videoAutoplay === "inline";
1418
1670
  const video = createEl("video", {
1419
1671
  src,
1420
- poster,
1421
- controls: "",
1422
1672
  playsinline: "",
1423
- "uk-video": `${this.videoAutoplay}`,
1673
+ controls: inline ? null : "",
1674
+ poster: this.videoAutoplay ? null : item.poster,
1675
+ "uk-video": inline ? "automute: true" : Boolean(this.videoAutoplay),
1424
1676
  ...attrs
1425
1677
  });
1426
1678
  util.on(video, "loadedmetadata", () => this.setItem(item, video));
@@ -1435,20 +1687,20 @@
1435
1687
  ...attrs
1436
1688
  })
1437
1689
  );
1438
- } else if (matches = src.match(
1690
+ } else if (matches2 = src.match(
1439
1691
  /\/\/(?:.*?youtube(-nocookie)?\..*?(?:[?&]v=|\/shorts\/)|youtu\.be\/)([\w-]{11})[&?]?(.*)?/
1440
1692
  )) {
1441
1693
  this.setItem(
1442
1694
  item,
1443
1695
  createEl("iframe", {
1444
- src: `https://www.youtube${matches[1] || ""}.com/embed/${matches[2]}${matches[3] ? `?${matches[3]}` : ""}`,
1696
+ src: `https://www.youtube${matches2[1] || ""}.com/embed/${matches2[2]}${matches2[3] ? `?${matches2[3]}` : ""}`,
1445
1697
  width: 1920,
1446
1698
  height: 1080,
1447
1699
  ...iframeAttrs,
1448
1700
  ...attrs
1449
1701
  })
1450
1702
  );
1451
- } else if (matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/)) {
1703
+ } else if (matches2 = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/)) {
1452
1704
  try {
1453
1705
  const { height, width } = await (await fetch(
1454
1706
  `https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(
@@ -1459,7 +1711,7 @@
1459
1711
  this.setItem(
1460
1712
  item,
1461
1713
  createEl("iframe", {
1462
- src: `https://player.vimeo.com/video/${matches[1]}${matches[2] ? `?${matches[2]}` : ""}`,
1714
+ src: `https://player.vimeo.com/video/${matches2[1]}${matches2[2] ? `?${matches2[2]}` : ""}`,
1463
1715
  width,
1464
1716
  height,
1465
1717
  ...iframeAttrs,
@@ -1471,8 +1723,29 @@
1471
1723
  }
1472
1724
  }
1473
1725
  }
1726
+ },
1727
+ {
1728
+ name: "itemloaded",
1729
+ handler() {
1730
+ this.$emit("resize");
1731
+ }
1474
1732
  }
1475
1733
  ],
1734
+ update: {
1735
+ read() {
1736
+ for (const media of util.$$(`${this.selList} :not([controls]):is(img,video)`, this.$el)) {
1737
+ util.toggleClass(
1738
+ media,
1739
+ this.clsZoom,
1740
+ (media.naturalHeight || media.videoHeight) - this.$el.offsetHeight > Math.max(
1741
+ 0,
1742
+ (media.naturalWidth || media.videoWidth) - this.$el.offsetWidth
1743
+ )
1744
+ );
1745
+ }
1746
+ },
1747
+ events: ["resize"]
1748
+ },
1476
1749
  methods: {
1477
1750
  loadItem(index = this.index) {
1478
1751
  const item = this.getItem(index);
@@ -1490,11 +1763,11 @@
1490
1763
  return this.slides[this.items.indexOf(item)];
1491
1764
  },
1492
1765
  setError(item) {
1493
- this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
1766
+ this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2" uk-inverse></span>');
1494
1767
  },
1495
1768
  showControls() {
1496
1769
  clearTimeout(this.controlsTimer);
1497
- this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
1770
+ this.controlsTimer = this.delayControls && setTimeout(this.hideControls, this.delayControls);
1498
1771
  util.addClass(this.$el, "uk-active", "uk-transition-active");
1499
1772
  },
1500
1773
  hideControls() {
@@ -1507,7 +1780,26 @@
1507
1780
  util.attr(el, attrs);
1508
1781
  return el;
1509
1782
  }
1783
+ function toThumbnavItem(item, videoAutoplay) {
1784
+ const el = item.poster || item.thumb && (item.type === "image" || isImage(item.thumb)) ? createEl("img", { src: item.poster || item.thumb, alt: "" }) : item.thumb && (item.type === "video" || isVideo(item.thumb)) ? createEl("video", {
1785
+ src: item.thumb,
1786
+ loop: "",
1787
+ playsinline: "",
1788
+ "uk-video": `autoplay: ${Boolean(videoAutoplay)}; automute: true`
1789
+ }) : createEl("canvas");
1790
+ if (item.thumbRatio) {
1791
+ el.style.aspectRatio = item.thumbRatio;
1792
+ }
1793
+ return el;
1794
+ }
1795
+ function isImage(src) {
1796
+ return src == null ? void 0 : src.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i);
1797
+ }
1798
+ function isVideo(src) {
1799
+ return src == null ? void 0 : src.match(/\.(mp4|webm|ogv)($|\?)/i);
1800
+ }
1510
1801
 
1802
+ const selDisabled = ".uk-disabled *, .uk-disabled, [disabled]";
1511
1803
  var Component = {
1512
1804
  install,
1513
1805
  props: { toggle: String },
@@ -1530,17 +1822,23 @@
1530
1822
  },
1531
1823
  events: {
1532
1824
  name: "click",
1533
- delegate: ({ toggle }) => `${toggle}:not(.uk-disabled)`,
1825
+ delegate: ({ toggle }) => toggle,
1534
1826
  handler(e) {
1535
1827
  if (!e.defaultPrevented) {
1536
1828
  e.preventDefault();
1537
- this.show(e.current);
1829
+ if (!util.matches(e.current, selDisabled)) {
1830
+ this.show(e.current);
1831
+ }
1538
1832
  }
1539
1833
  }
1540
1834
  },
1541
1835
  methods: {
1542
1836
  show(index) {
1543
- const items = util.uniqueBy(this.toggles.map(toItem), "source");
1837
+ let items = this.toggles.map(toItem);
1838
+ if (this.nav === "thumbnav") {
1839
+ ensureThumb.call(this, this.toggles, items);
1840
+ }
1841
+ items = util.uniqueBy(items, "source");
1544
1842
  if (util.isElement(index)) {
1545
1843
  const { source } = toItem(index);
1546
1844
  index = util.findIndex(items, ({ source: src }) => source === src);
@@ -1561,10 +1859,29 @@
1561
1859
  }
1562
1860
  util.assign(Lightbox.props, UIkit.component("lightboxPanel").options.props);
1563
1861
  }
1862
+ function ensureThumb(toggles, items) {
1863
+ for (const [i, toggle] of Object.entries(toggles)) {
1864
+ if (items[i].thumb) {
1865
+ continue;
1866
+ }
1867
+ const parent = util.parents(toggle).reverse().concat(toggle).find(
1868
+ (parent2) => this.$el.contains(parent2) && (parent2 === toggle || util.$$(this.toggle, parent2).length === 1)
1869
+ );
1870
+ if (!parent) {
1871
+ continue;
1872
+ }
1873
+ const media = util.$("img,video", parent);
1874
+ if (media) {
1875
+ items[i].thumb = media.currentSrc || media.poster || media.src;
1876
+ items[i].thumbRatio = (media.naturalWidth || media.videoWidth) / (media.naturalHeight || media.videoHeight);
1877
+ }
1878
+ }
1879
+ }
1564
1880
  function toItem(el) {
1565
1881
  const item = {};
1566
- for (const attr2 of ["href", "caption", "type", "poster", "alt", "attrs"]) {
1567
- item[attr2 === "href" ? "source" : attr2] = util.data(el, attr2);
1882
+ for (const attribute of el.getAttributeNames()) {
1883
+ const key = attribute.replace(/^data-/, "");
1884
+ item[key === "href" ? "source" : key] = el.getAttribute(attribute);
1568
1885
  }
1569
1886
  item.attrs = parseOptions(item.attrs);
1570
1887
  return item;