uikit 3.21.17 → 3.21.18-dev.27bfd7d2b
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.
- package/CHANGELOG.md +32 -0
- package/dist/css/uikit-core-rtl.css +243 -69
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +243 -69
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +247 -65
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +247 -65
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +13 -8
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +1 -1
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +334 -103
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +351 -108
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +1 -1
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +3 -7
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +3 -7
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +7 -2
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +92 -93
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +20 -17
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +379 -262
- package/dist/js/uikit.min.js +1 -1
- package/package.json +3 -3
- package/src/images/icons/arrow-down-arrow-up.svg +6 -0
- package/src/images/icons/arrow-down.svg +3 -3
- package/src/images/icons/arrow-left.svg +3 -3
- package/src/images/icons/arrow-right.svg +3 -3
- package/src/images/icons/arrow-up-right.svg +3 -3
- package/src/images/icons/arrow-up.svg +3 -3
- package/src/images/icons/close-circle.svg +5 -0
- package/src/images/icons/cloud-download.svg +4 -4
- package/src/images/icons/cloud-upload.svg +4 -4
- package/src/images/icons/download.svg +4 -4
- package/src/images/icons/expand.svg +5 -5
- package/src/images/icons/link-external.svg +4 -4
- package/src/images/icons/pull.svg +4 -4
- package/src/images/icons/push.svg +3 -3
- package/src/images/icons/shrink.svg +5 -5
- package/src/images/icons/sign-in.svg +4 -3
- package/src/images/icons/sign-out.svg +4 -3
- package/src/images/icons/sorting.svg +6 -0
- package/src/images/icons/upload.svg +4 -4
- package/src/js/components/countdown.js +10 -5
- package/src/js/components/lightbox-panel.js +181 -45
- package/src/js/components/lightbox.js +59 -6
- package/src/js/core/img.js +3 -5
- package/src/js/core/navbar.js +3 -6
- package/src/js/mixin/modal.js +1 -4
- package/src/js/mixin/slider-drag.js +3 -6
- package/src/js/mixin/slider-nav.js +1 -1
- package/src/js/mixin/togglable.js +7 -2
- package/src/js/util/dom.js +3 -1
- package/src/less/components/breadcrumb.less +6 -2
- package/src/less/components/button.less +1 -1
- package/src/less/components/form-range.less +52 -0
- package/src/less/components/form.less +1 -1
- package/src/less/components/lightbox.less +57 -89
- package/src/less/components/margin.less +14 -0
- package/src/less/components/search.less +49 -23
- package/src/less/components/subnav.less +8 -0
- package/src/less/components/text.less +11 -0
- package/src/less/components/totop.less +1 -1
- package/src/less/components/utility.less +2 -1
- package/src/less/components/visibility.less +2 -1
- package/src/less/theme/form-range.less +20 -8
- package/src/less/theme/lightbox.less +2 -20
- package/src/less/theme/search.less +24 -10
- package/src/scss/components/breadcrumb.scss +6 -2
- package/src/scss/components/button.scss +1 -1
- package/src/scss/components/form-range.scss +12 -0
- package/src/scss/components/form.scss +1 -1
- package/src/scss/components/lightbox.scss +50 -77
- package/src/scss/components/margin.scss +13 -0
- package/src/scss/components/search.scss +30 -12
- package/src/scss/components/subnav.scss +7 -0
- package/src/scss/components/text.scss +10 -0
- package/src/scss/components/totop.scss +1 -1
- package/src/scss/components/utility.scss +1 -1
- package/src/scss/components/visibility.scss +2 -1
- package/src/scss/mixins-theme.scss +51 -12
- package/src/scss/mixins.scss +45 -6
- package/src/scss/theme/form-range.scss +14 -4
- package/src/scss/theme/lightbox.scss +2 -20
- package/src/scss/theme/search.scss +10 -6
- package/src/scss/variables-theme.scss +36 -21
- package/src/scss/variables.scss +32 -24
- package/tests/badge.html +2 -2
- package/tests/base.html +1 -1
- package/tests/breadcrumb.html +23 -5
- package/tests/card.html +24 -24
- package/tests/countdown.html +6 -0
- package/tests/dropbar.html +15 -15
- package/tests/dropdown.html +6 -6
- package/tests/dropnav.html +100 -100
- package/tests/icon.html +8 -0
- package/tests/index.html +15 -15
- package/tests/lightbox.html +379 -28
- package/tests/margin.html +19 -0
- package/tests/nav.html +21 -21
- package/tests/navbar.html +273 -273
- package/tests/offcanvas.html +27 -27
- package/tests/placeholder.html +2 -2
- package/tests/sortable.html +5 -5
- package/tests/sticky-navbar.html +114 -114
- package/tests/sticky.html +1 -1
- package/tests/text.html +8 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.21.
|
|
1
|
+
/*! UIkit 3.21.18-dev.27bfd7d2b | https://www.getuikit.com | (c) 2014 - 2025 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -6,6 +6,191 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitLightbox_panel = factory(global.UIkit.util));
|
|
7
7
|
})(this, (function (util) { 'use strict';
|
|
8
8
|
|
|
9
|
+
function callUpdate(instance, e = "update") {
|
|
10
|
+
if (!instance._connected) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!instance._updates.length) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!instance._queued) {
|
|
17
|
+
instance._queued = /* @__PURE__ */ new Set();
|
|
18
|
+
util.fastdom.read(() => {
|
|
19
|
+
if (instance._connected) {
|
|
20
|
+
runUpdates(instance, instance._queued);
|
|
21
|
+
}
|
|
22
|
+
instance._queued = null;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
instance._queued.add(e.type || e);
|
|
26
|
+
}
|
|
27
|
+
function runUpdates(instance, types) {
|
|
28
|
+
for (const { read, write, events = [] } of instance._updates) {
|
|
29
|
+
if (!types.has("update") && !events.some((type) => types.has(type))) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
let result;
|
|
33
|
+
if (read) {
|
|
34
|
+
result = read.call(instance, instance._data, types);
|
|
35
|
+
if (result && util.isPlainObject(result)) {
|
|
36
|
+
util.assign(instance._data, result);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (write && result !== false) {
|
|
40
|
+
util.fastdom.write(() => {
|
|
41
|
+
if (instance._connected) {
|
|
42
|
+
write.call(instance, instance._data, types);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function resize(options) {
|
|
50
|
+
return observe(util.observeResize, options, "resize");
|
|
51
|
+
}
|
|
52
|
+
function intersection(options) {
|
|
53
|
+
return observe(util.observeIntersection, options);
|
|
54
|
+
}
|
|
55
|
+
function observe(observe2, options, emit) {
|
|
56
|
+
return {
|
|
57
|
+
observe: observe2,
|
|
58
|
+
handler() {
|
|
59
|
+
callUpdate(this, emit);
|
|
60
|
+
},
|
|
61
|
+
...options
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function parseOptions(options, args = []) {
|
|
66
|
+
try {
|
|
67
|
+
return options ? util.startsWith(options, "{") ? JSON.parse(options) : args.length && !util.includes(options, ":") ? { [args[0]]: options } : options.split(";").reduce((options2, option) => {
|
|
68
|
+
const [key, value] = option.split(/:(.*)/);
|
|
69
|
+
if (key && !util.isUndefined(value)) {
|
|
70
|
+
options2[key.trim()] = value.trim();
|
|
71
|
+
}
|
|
72
|
+
return options2;
|
|
73
|
+
}, {}) : {};
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return {};
|
|
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
|
+
|
|
9
194
|
let prevented;
|
|
10
195
|
function preventBackgroundScroll(el) {
|
|
11
196
|
const off = util.on(
|
|
@@ -78,6 +263,16 @@
|
|
|
78
263
|
}
|
|
79
264
|
};
|
|
80
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
|
+
|
|
81
276
|
var Togglable = {
|
|
82
277
|
props: {
|
|
83
278
|
cls: Boolean,
|
|
@@ -115,8 +310,14 @@
|
|
|
115
310
|
util.addClass(el, cls);
|
|
116
311
|
util.trigger(el, show ? "show" : "hide", [this]);
|
|
117
312
|
const done = () => {
|
|
313
|
+
var _a;
|
|
118
314
|
util.removeClass(el, cls);
|
|
119
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
|
+
}
|
|
120
321
|
};
|
|
121
322
|
return promise ? promise.then(done, () => {
|
|
122
323
|
util.removeClass(el, cls);
|
|
@@ -149,7 +350,6 @@
|
|
|
149
350
|
if (changed) {
|
|
150
351
|
util.trigger(el, "toggled", [toggled, this]);
|
|
151
352
|
}
|
|
152
|
-
util.$$("[autofocus]", el).some((el2) => util.isVisible(el2) ? el2.focus() || true : el2.blur());
|
|
153
353
|
}
|
|
154
354
|
}
|
|
155
355
|
};
|
|
@@ -280,9 +480,6 @@
|
|
|
280
480
|
panel: ({ selPanel }, $el) => util.$(selPanel, $el),
|
|
281
481
|
transitionElement() {
|
|
282
482
|
return this.panel;
|
|
283
|
-
},
|
|
284
|
-
bgClose({ bgClose }) {
|
|
285
|
-
return bgClose && this.panel;
|
|
286
483
|
}
|
|
287
484
|
},
|
|
288
485
|
connected() {
|
|
@@ -445,7 +642,7 @@
|
|
|
445
642
|
}
|
|
446
643
|
function listenForBackgroundClose(modal) {
|
|
447
644
|
return util.on(document, util.pointerDown, ({ target }) => {
|
|
448
|
-
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)) {
|
|
449
646
|
return;
|
|
450
647
|
}
|
|
451
648
|
util.once(
|
|
@@ -468,59 +665,6 @@
|
|
|
468
665
|
});
|
|
469
666
|
}
|
|
470
667
|
|
|
471
|
-
function callUpdate(instance, e = "update") {
|
|
472
|
-
if (!instance._connected) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
if (!instance._updates.length) {
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
if (!instance._queued) {
|
|
479
|
-
instance._queued = /* @__PURE__ */ new Set();
|
|
480
|
-
util.fastdom.read(() => {
|
|
481
|
-
if (instance._connected) {
|
|
482
|
-
runUpdates(instance, instance._queued);
|
|
483
|
-
}
|
|
484
|
-
instance._queued = null;
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
instance._queued.add(e.type || e);
|
|
488
|
-
}
|
|
489
|
-
function runUpdates(instance, types) {
|
|
490
|
-
for (const { read, write, events = [] } of instance._updates) {
|
|
491
|
-
if (!types.has("update") && !events.some((type) => types.has(type))) {
|
|
492
|
-
continue;
|
|
493
|
-
}
|
|
494
|
-
let result;
|
|
495
|
-
if (read) {
|
|
496
|
-
result = read.call(instance, instance._data, types);
|
|
497
|
-
if (result && util.isPlainObject(result)) {
|
|
498
|
-
util.assign(instance._data, result);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
if (write && result !== false) {
|
|
502
|
-
util.fastdom.write(() => {
|
|
503
|
-
if (instance._connected) {
|
|
504
|
-
write.call(instance, instance._data, types);
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
function resize(options) {
|
|
512
|
-
return observe(util.observeResize, options, "resize");
|
|
513
|
-
}
|
|
514
|
-
function observe(observe2, options, emit) {
|
|
515
|
-
return {
|
|
516
|
-
observe: observe2,
|
|
517
|
-
handler() {
|
|
518
|
-
callUpdate(this, emit);
|
|
519
|
-
},
|
|
520
|
-
...options
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
|
|
524
668
|
var Animations$1 = {
|
|
525
669
|
slide: {
|
|
526
670
|
show(dir) {
|
|
@@ -675,7 +819,6 @@
|
|
|
675
819
|
const pointerDown = "touchstart mousedown";
|
|
676
820
|
const pointerMove = "touchmove mousemove";
|
|
677
821
|
const pointerUp = "touchend touchcancel mouseup click input scroll";
|
|
678
|
-
const preventClick = (e) => e.preventDefault();
|
|
679
822
|
var SliderDrag = {
|
|
680
823
|
props: {
|
|
681
824
|
draggable: Boolean
|
|
@@ -743,9 +886,6 @@
|
|
|
743
886
|
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
|
|
744
887
|
return;
|
|
745
888
|
}
|
|
746
|
-
if (!this.dragging) {
|
|
747
|
-
util.on(this.list, "click", preventClick, pointerOptions);
|
|
748
|
-
}
|
|
749
889
|
e.cancelable && e.preventDefault();
|
|
750
890
|
this.dragging = true;
|
|
751
891
|
this.dir = distance < 0 ? 1 : -1;
|
|
@@ -794,6 +934,7 @@
|
|
|
794
934
|
util.off(document, pointerMove, this.move, pointerOptions);
|
|
795
935
|
util.off(document, pointerUp, this.end, pointerUpOptions);
|
|
796
936
|
if (this.dragging) {
|
|
937
|
+
setTimeout(util.on(this.list, "click", (e) => e.preventDefault(), pointerOptions));
|
|
797
938
|
this.dragging = null;
|
|
798
939
|
if (this.index === this.prevIndex) {
|
|
799
940
|
this.percent = 1 - this.percent;
|
|
@@ -814,7 +955,6 @@
|
|
|
814
955
|
);
|
|
815
956
|
}
|
|
816
957
|
}
|
|
817
|
-
setTimeout(() => util.off(this.list, "click", preventClick, pointerOptions));
|
|
818
958
|
util.css(this.list, { userSelect: "" });
|
|
819
959
|
this.drag = this.percent = null;
|
|
820
960
|
}
|
|
@@ -994,7 +1134,7 @@
|
|
|
994
1134
|
const item = util.toNumber(cmd);
|
|
995
1135
|
const active = item === index;
|
|
996
1136
|
util.toggleClass(el, this.clsActive, active);
|
|
997
|
-
util.toggleClass(button, "uk-disabled", this.parallax);
|
|
1137
|
+
util.toggleClass(button, "uk-disabled", !!this.parallax);
|
|
998
1138
|
util.attr(button, {
|
|
999
1139
|
"aria-selected": active,
|
|
1000
1140
|
tabindex: active && !this.parallax ? null : -1
|
|
@@ -1335,34 +1475,67 @@
|
|
|
1335
1475
|
};
|
|
1336
1476
|
|
|
1337
1477
|
var Component = {
|
|
1478
|
+
i18n: {
|
|
1479
|
+
counter: "%s / %s"
|
|
1480
|
+
},
|
|
1338
1481
|
mixins: [Modal, Slideshow],
|
|
1339
1482
|
functional: true,
|
|
1340
1483
|
props: {
|
|
1341
|
-
|
|
1484
|
+
counter: Boolean,
|
|
1342
1485
|
preload: Number,
|
|
1486
|
+
nav: Boolean,
|
|
1487
|
+
slidenav: Boolean,
|
|
1488
|
+
delayControls: Number,
|
|
1343
1489
|
videoAutoplay: Boolean,
|
|
1344
1490
|
template: String
|
|
1345
1491
|
},
|
|
1346
1492
|
data: () => ({
|
|
1493
|
+
counter: false,
|
|
1347
1494
|
preload: 1,
|
|
1348
|
-
|
|
1495
|
+
nav: false,
|
|
1496
|
+
slidenav: true,
|
|
1349
1497
|
delayControls: 3e3,
|
|
1498
|
+
videoAutoplay: false,
|
|
1350
1499
|
items: [],
|
|
1351
1500
|
cls: "uk-open",
|
|
1352
1501
|
clsPage: "uk-lightbox-page",
|
|
1353
|
-
|
|
1502
|
+
clsFit: "uk-lightbox-items-fit",
|
|
1503
|
+
clsZoom: "uk-lightbox-zoom",
|
|
1354
1504
|
attrItem: "uk-lightbox-item",
|
|
1505
|
+
selList: ".uk-lightbox-items",
|
|
1355
1506
|
selClose: ".uk-close-large",
|
|
1507
|
+
selNav: ".uk-lightbox-thumbnav, .uk-lightbox-dotnav",
|
|
1356
1508
|
selCaption: ".uk-lightbox-caption",
|
|
1509
|
+
selCounter: ".uk-lightbox-counter",
|
|
1357
1510
|
pauseOnHover: false,
|
|
1358
1511
|
velocity: 2,
|
|
1359
1512
|
Animations,
|
|
1360
|
-
template: `<div class="uk-lightbox uk-overflow-hidden"> <div class="uk-lightbox-items"></div> <div class="uk-
|
|
1513
|
+
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>`
|
|
1361
1514
|
}),
|
|
1362
1515
|
created() {
|
|
1363
|
-
|
|
1516
|
+
let $el = util.$(this.template);
|
|
1517
|
+
if (util.isTag($el, "template")) {
|
|
1518
|
+
$el = util.fragment(util.html($el));
|
|
1519
|
+
}
|
|
1364
1520
|
const list = util.$(this.selList, $el);
|
|
1365
|
-
|
|
1521
|
+
const navType = this.$props.nav;
|
|
1522
|
+
util.remove(util.$$(this.selNav, $el).filter((el) => !util.matches(el, `.uk-${navType}`)));
|
|
1523
|
+
for (const [i, item] of this.items.entries()) {
|
|
1524
|
+
util.append(list, "<div>");
|
|
1525
|
+
if (navType === "thumbnav") {
|
|
1526
|
+
util.wrapAll(
|
|
1527
|
+
toThumbnavItem(item, this.videoAutoplay),
|
|
1528
|
+
util.append(util.$(this.selNav, $el), `<li uk-lightbox-item="${i}"><a href></a></li>`)
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
if (!this.slidenav) {
|
|
1533
|
+
util.remove(util.$$(".uk-lightbox-slidenav", $el));
|
|
1534
|
+
}
|
|
1535
|
+
if (!this.counter) {
|
|
1536
|
+
util.remove(util.$(this.selCounter, $el));
|
|
1537
|
+
}
|
|
1538
|
+
util.addClass(list, this.clsFit);
|
|
1366
1539
|
const close = util.$("[uk-close]", $el);
|
|
1367
1540
|
const closeLabel = this.t("close");
|
|
1368
1541
|
if (close && closeLabel) {
|
|
@@ -1372,21 +1545,33 @@
|
|
|
1372
1545
|
},
|
|
1373
1546
|
events: [
|
|
1374
1547
|
{
|
|
1375
|
-
name:
|
|
1376
|
-
|
|
1377
|
-
|
|
1548
|
+
name: "click",
|
|
1549
|
+
self: true,
|
|
1550
|
+
filter: ({ bgClose }) => bgClose,
|
|
1551
|
+
delegate: ({ selList }) => `${selList} > *`,
|
|
1552
|
+
handler(e) {
|
|
1553
|
+
if (!e.defaultPrevented) {
|
|
1554
|
+
this.hide();
|
|
1555
|
+
}
|
|
1378
1556
|
}
|
|
1379
1557
|
},
|
|
1380
1558
|
{
|
|
1381
1559
|
name: "click",
|
|
1382
1560
|
self: true,
|
|
1383
|
-
delegate: ({
|
|
1561
|
+
delegate: ({ clsZoom }) => `.${clsZoom}`,
|
|
1384
1562
|
handler(e) {
|
|
1385
1563
|
if (!e.defaultPrevented) {
|
|
1386
|
-
this.
|
|
1564
|
+
util.toggleClass(this.list, this.clsFit);
|
|
1387
1565
|
}
|
|
1388
1566
|
}
|
|
1389
1567
|
},
|
|
1568
|
+
{
|
|
1569
|
+
name: `${util.pointerMove} ${util.pointerDown} keydown`,
|
|
1570
|
+
filter: ({ delayControls }) => delayControls,
|
|
1571
|
+
handler() {
|
|
1572
|
+
this.showControls();
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1390
1575
|
{
|
|
1391
1576
|
name: "shown",
|
|
1392
1577
|
self: true,
|
|
@@ -1435,26 +1620,25 @@
|
|
|
1435
1620
|
{
|
|
1436
1621
|
name: "beforeitemshow",
|
|
1437
1622
|
handler(e) {
|
|
1623
|
+
util.html(util.$(this.selCaption, this.$el), this.getItem().caption || "");
|
|
1624
|
+
util.html(
|
|
1625
|
+
util.$(this.selCounter, this.$el),
|
|
1626
|
+
this.t("counter", this.index + 1, this.slides.length)
|
|
1627
|
+
);
|
|
1628
|
+
for (let j = -this.preload; j <= this.preload; j++) {
|
|
1629
|
+
this.loadItem(this.index + j);
|
|
1630
|
+
}
|
|
1438
1631
|
if (this.isToggled()) {
|
|
1439
1632
|
return;
|
|
1440
1633
|
}
|
|
1441
1634
|
this.draggable = false;
|
|
1442
1635
|
e.preventDefault();
|
|
1443
1636
|
this.toggleElement(this.$el, true, false);
|
|
1444
|
-
this.animation = Animations
|
|
1637
|
+
this.animation = Animations.scale;
|
|
1445
1638
|
util.removeClass(e.target, this.clsActive);
|
|
1446
1639
|
this.stack.splice(1, 0, this.index);
|
|
1447
1640
|
}
|
|
1448
1641
|
},
|
|
1449
|
-
{
|
|
1450
|
-
name: "itemshow",
|
|
1451
|
-
handler() {
|
|
1452
|
-
util.html(util.$(this.selCaption, this.$el), this.getItem().caption || "");
|
|
1453
|
-
for (let j = -this.preload; j <= this.preload; j++) {
|
|
1454
|
-
this.loadItem(this.index + j);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
},
|
|
1458
1642
|
{
|
|
1459
1643
|
name: "itemshown",
|
|
1460
1644
|
handler() {
|
|
@@ -1464,29 +1648,37 @@
|
|
|
1464
1648
|
{
|
|
1465
1649
|
name: "itemload",
|
|
1466
1650
|
async handler(_, item) {
|
|
1467
|
-
const { source: src, type,
|
|
1468
|
-
this.setItem(item, "<span uk-spinner></span>");
|
|
1651
|
+
const { source: src, type, attrs = {} } = item;
|
|
1652
|
+
this.setItem(item, "<span uk-spinner uk-inverse></span>");
|
|
1469
1653
|
if (!src) {
|
|
1470
1654
|
return;
|
|
1471
1655
|
}
|
|
1472
|
-
let
|
|
1656
|
+
let matches2;
|
|
1473
1657
|
const iframeAttrs = {
|
|
1474
1658
|
allowfullscreen: "",
|
|
1475
1659
|
style: "max-width: 100%; box-sizing: border-box;",
|
|
1476
1660
|
"uk-responsive": "",
|
|
1477
|
-
"uk-video": `${this.videoAutoplay}`
|
|
1661
|
+
"uk-video": `${Boolean(this.videoAutoplay)}`
|
|
1478
1662
|
};
|
|
1479
|
-
if (type === "image" || src
|
|
1480
|
-
const img = createEl("img"
|
|
1481
|
-
|
|
1663
|
+
if (type === "image" || isImage(src)) {
|
|
1664
|
+
const img = createEl("img");
|
|
1665
|
+
wrapInPicture(img, item.sources);
|
|
1666
|
+
util.attr(img, {
|
|
1667
|
+
src,
|
|
1668
|
+
...util.pick(item, ["alt", "srcset", "sizes"]),
|
|
1669
|
+
...attrs
|
|
1670
|
+
});
|
|
1671
|
+
util.on(img, "load", () => this.setItem(item, util.parent(img) || img));
|
|
1482
1672
|
util.on(img, "error", () => this.setError(item));
|
|
1483
|
-
} else if (type === "video" || src
|
|
1673
|
+
} else if (type === "video" || isVideo(src)) {
|
|
1674
|
+
const inline = this.videoAutoplay === "inline";
|
|
1484
1675
|
const video = createEl("video", {
|
|
1485
1676
|
src,
|
|
1486
|
-
poster,
|
|
1487
|
-
controls: "",
|
|
1488
1677
|
playsinline: "",
|
|
1489
|
-
"
|
|
1678
|
+
controls: inline ? null : "",
|
|
1679
|
+
loop: inline ? "" : null,
|
|
1680
|
+
poster: this.videoAutoplay ? null : item.poster,
|
|
1681
|
+
"uk-video": inline ? "automute: true" : Boolean(this.videoAutoplay),
|
|
1490
1682
|
...attrs
|
|
1491
1683
|
});
|
|
1492
1684
|
util.on(video, "loadedmetadata", () => this.setItem(item, video));
|
|
@@ -1501,20 +1693,20 @@
|
|
|
1501
1693
|
...attrs
|
|
1502
1694
|
})
|
|
1503
1695
|
);
|
|
1504
|
-
} else if (
|
|
1696
|
+
} else if (matches2 = src.match(
|
|
1505
1697
|
/\/\/(?:.*?youtube(-nocookie)?\..*?(?:[?&]v=|\/shorts\/)|youtu\.be\/)([\w-]{11})[&?]?(.*)?/
|
|
1506
1698
|
)) {
|
|
1507
1699
|
this.setItem(
|
|
1508
1700
|
item,
|
|
1509
1701
|
createEl("iframe", {
|
|
1510
|
-
src: `https://www.youtube${
|
|
1702
|
+
src: `https://www.youtube${matches2[1] || ""}.com/embed/${matches2[2]}${matches2[3] ? `?${matches2[3]}` : ""}`,
|
|
1511
1703
|
width: 1920,
|
|
1512
1704
|
height: 1080,
|
|
1513
1705
|
...iframeAttrs,
|
|
1514
1706
|
...attrs
|
|
1515
1707
|
})
|
|
1516
1708
|
);
|
|
1517
|
-
} else if (
|
|
1709
|
+
} else if (matches2 = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/)) {
|
|
1518
1710
|
try {
|
|
1519
1711
|
const { height, width } = await (await fetch(
|
|
1520
1712
|
`https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(
|
|
@@ -1525,7 +1717,7 @@
|
|
|
1525
1717
|
this.setItem(
|
|
1526
1718
|
item,
|
|
1527
1719
|
createEl("iframe", {
|
|
1528
|
-
src: `https://player.vimeo.com/video/${
|
|
1720
|
+
src: `https://player.vimeo.com/video/${matches2[1]}${matches2[2] ? `?${matches2[2]}` : ""}`,
|
|
1529
1721
|
width,
|
|
1530
1722
|
height,
|
|
1531
1723
|
...iframeAttrs,
|
|
@@ -1537,8 +1729,29 @@
|
|
|
1537
1729
|
}
|
|
1538
1730
|
}
|
|
1539
1731
|
}
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
name: "itemloaded",
|
|
1735
|
+
handler() {
|
|
1736
|
+
this.$emit("resize");
|
|
1737
|
+
}
|
|
1540
1738
|
}
|
|
1541
1739
|
],
|
|
1740
|
+
update: {
|
|
1741
|
+
read() {
|
|
1742
|
+
for (const media of util.$$(`${this.selList} :not([controls]):is(img,video)`, this.$el)) {
|
|
1743
|
+
util.toggleClass(
|
|
1744
|
+
media,
|
|
1745
|
+
this.clsZoom,
|
|
1746
|
+
(media.naturalHeight || media.videoHeight) - this.$el.offsetHeight > Math.max(
|
|
1747
|
+
0,
|
|
1748
|
+
(media.naturalWidth || media.videoWidth) - this.$el.offsetWidth
|
|
1749
|
+
)
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
events: ["resize"]
|
|
1754
|
+
},
|
|
1542
1755
|
methods: {
|
|
1543
1756
|
loadItem(index = this.index) {
|
|
1544
1757
|
const item = this.getItem(index);
|
|
@@ -1556,11 +1769,11 @@
|
|
|
1556
1769
|
return this.slides[this.items.indexOf(item)];
|
|
1557
1770
|
},
|
|
1558
1771
|
setError(item) {
|
|
1559
|
-
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
|
|
1772
|
+
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2" uk-inverse></span>');
|
|
1560
1773
|
},
|
|
1561
1774
|
showControls() {
|
|
1562
1775
|
clearTimeout(this.controlsTimer);
|
|
1563
|
-
this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
|
|
1776
|
+
this.controlsTimer = this.delayControls && setTimeout(this.hideControls, this.delayControls);
|
|
1564
1777
|
util.addClass(this.$el, "uk-active", "uk-transition-active");
|
|
1565
1778
|
},
|
|
1566
1779
|
hideControls() {
|
|
@@ -1573,6 +1786,24 @@
|
|
|
1573
1786
|
util.attr(el, attrs);
|
|
1574
1787
|
return el;
|
|
1575
1788
|
}
|
|
1789
|
+
function toThumbnavItem(item, videoAutoplay) {
|
|
1790
|
+
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", {
|
|
1791
|
+
src: item.thumb,
|
|
1792
|
+
loop: "",
|
|
1793
|
+
playsinline: "",
|
|
1794
|
+
"uk-video": `autoplay: ${Boolean(videoAutoplay)}; automute: true`
|
|
1795
|
+
}) : createEl("canvas");
|
|
1796
|
+
if (item.thumbRatio) {
|
|
1797
|
+
el.style.aspectRatio = item.thumbRatio;
|
|
1798
|
+
}
|
|
1799
|
+
return el;
|
|
1800
|
+
}
|
|
1801
|
+
function isImage(src) {
|
|
1802
|
+
return src == null ? void 0 : src.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i);
|
|
1803
|
+
}
|
|
1804
|
+
function isVideo(src) {
|
|
1805
|
+
return src == null ? void 0 : src.match(/\.(mp4|webm|ogv)($|\?)/i);
|
|
1806
|
+
}
|
|
1576
1807
|
|
|
1577
1808
|
if (typeof window !== "undefined" && window.UIkit) {
|
|
1578
1809
|
window.UIkit.component("lightboxPanel", Component);
|