uikit 3.16.6 → 3.16.7-dev.248cd00b6
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 +9 -0
- package/README.md +2 -0
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +2 -2
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +2 -2
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +5 -414
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +196 -2021
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +207 -2018
- 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 +3 -248
- 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 +144 -2453
- 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 +98 -2407
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +3 -408
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +81 -2367
- 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 +89 -79
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +99 -112
- package/dist/js/uikit.min.js +1 -1
- package/package.json +9 -8
- package/src/js/api/app.js +1 -1
- package/src/js/api/boot.js +1 -1
- package/src/js/api/component.js +1 -1
- package/src/js/api/computed.js +1 -1
- package/src/js/api/events.js +1 -1
- package/src/js/api/global.js +43 -43
- package/src/js/api/index.js +5 -5
- package/src/js/api/instance.js +42 -41
- package/src/js/api/observables.js +1 -1
- package/src/js/api/observer.js +9 -1
- package/src/js/api/options.js +1 -1
- package/src/js/api/props.js +1 -1
- package/src/js/api/state.js +1 -1
- package/src/js/api/update.js +1 -1
- package/src/js/api/watch.js +1 -1
- package/src/js/core/accordion.js +4 -0
- package/src/js/mixin/slider-autoplay.js +13 -42
- package/src/js/mixin/slider-nav.js +4 -1
- package/src/js/util/scroll.js +2 -1
- package/src/less/components/dropdown.less +1 -1
- package/src/less/theme/dropdown.less +2 -0
- package/src/scss/components/dropdown.scss +1 -1
- package/src/scss/theme/dropdown.scss +2 -0
- package/src/scss/variables-theme.scss +2 -2
- package/src/scss/variables.scss +1 -1
|
@@ -1,1689 +1,29 @@
|
|
|
1
|
-
/*! UIkit 3.16.
|
|
1
|
+
/*! UIkit 3.16.7-dev.248cd00b6 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define('uikitslider', ['uikit-util'], factory) :
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitSlider = factory(global.UIkit.util));
|
|
7
|
-
})(this, (function (
|
|
7
|
+
})(this, (function (util) { 'use strict';
|
|
8
8
|
|
|
9
9
|
var Class = {
|
|
10
10
|
connected() {
|
|
11
|
-
|
|
11
|
+
util.addClass(this.$el, this.$options.id);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const { hasOwnProperty, toString } = Object.prototype;
|
|
16
|
-
function hasOwn(obj, key) {
|
|
17
|
-
return hasOwnProperty.call(obj, key);
|
|
18
|
-
}
|
|
19
|
-
const hyphenateRe = /\B([A-Z])/g;
|
|
20
|
-
const hyphenate = memoize((str) => str.replace(hyphenateRe, "-$1").toLowerCase());
|
|
21
|
-
const camelizeRe = /-(\w)/g;
|
|
22
|
-
const camelize = memoize(
|
|
23
|
-
(str) => (str.charAt(0).toLowerCase() + str.slice(1)).replace(camelizeRe, (_, c) => c.toUpperCase())
|
|
24
|
-
);
|
|
25
|
-
const ucfirst = memoize((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
26
|
-
function startsWith(str, search) {
|
|
27
|
-
var _a;
|
|
28
|
-
return (_a = str == null ? void 0 : str.startsWith) == null ? void 0 : _a.call(str, search);
|
|
29
|
-
}
|
|
30
|
-
function endsWith(str, search) {
|
|
31
|
-
var _a;
|
|
32
|
-
return (_a = str == null ? void 0 : str.endsWith) == null ? void 0 : _a.call(str, search);
|
|
33
|
-
}
|
|
34
|
-
function includes(obj, search) {
|
|
35
|
-
var _a;
|
|
36
|
-
return (_a = obj == null ? void 0 : obj.includes) == null ? void 0 : _a.call(obj, search);
|
|
37
|
-
}
|
|
38
|
-
function findIndex(array, predicate) {
|
|
39
|
-
var _a;
|
|
40
|
-
return (_a = array == null ? void 0 : array.findIndex) == null ? void 0 : _a.call(array, predicate);
|
|
41
|
-
}
|
|
42
|
-
const { isArray, from: toArray } = Array;
|
|
43
|
-
const { assign } = Object;
|
|
44
|
-
function isFunction(obj) {
|
|
45
|
-
return typeof obj === "function";
|
|
46
|
-
}
|
|
47
|
-
function isObject(obj) {
|
|
48
|
-
return obj !== null && typeof obj === "object";
|
|
49
|
-
}
|
|
50
|
-
function isPlainObject(obj) {
|
|
51
|
-
return toString.call(obj) === "[object Object]";
|
|
52
|
-
}
|
|
53
|
-
function isWindow(obj) {
|
|
54
|
-
return isObject(obj) && obj === obj.window;
|
|
55
|
-
}
|
|
56
|
-
function isDocument(obj) {
|
|
57
|
-
return nodeType(obj) === 9;
|
|
58
|
-
}
|
|
59
|
-
function isNode(obj) {
|
|
60
|
-
return nodeType(obj) >= 1;
|
|
61
|
-
}
|
|
62
|
-
function isElement(obj) {
|
|
63
|
-
return nodeType(obj) === 1;
|
|
64
|
-
}
|
|
65
|
-
function nodeType(obj) {
|
|
66
|
-
return !isWindow(obj) && isObject(obj) && obj.nodeType;
|
|
67
|
-
}
|
|
68
|
-
function isBoolean(value) {
|
|
69
|
-
return typeof value === "boolean";
|
|
70
|
-
}
|
|
71
|
-
function isString(value) {
|
|
72
|
-
return typeof value === "string";
|
|
73
|
-
}
|
|
74
|
-
function isNumber(value) {
|
|
75
|
-
return typeof value === "number";
|
|
76
|
-
}
|
|
77
|
-
function isNumeric(value) {
|
|
78
|
-
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
|
|
79
|
-
}
|
|
80
|
-
function isEmpty(obj) {
|
|
81
|
-
return !(isArray(obj) ? obj.length : isObject(obj) ? Object.keys(obj).length : false);
|
|
82
|
-
}
|
|
83
|
-
function isUndefined(value) {
|
|
84
|
-
return value === void 0;
|
|
85
|
-
}
|
|
86
|
-
function toBoolean(value) {
|
|
87
|
-
return isBoolean(value) ? value : value === "true" || value === "1" || value === "" ? true : value === "false" || value === "0" ? false : value;
|
|
88
|
-
}
|
|
89
|
-
function toNumber(value) {
|
|
90
|
-
const number = Number(value);
|
|
91
|
-
return isNaN(number) ? false : number;
|
|
92
|
-
}
|
|
93
|
-
function toFloat(value) {
|
|
94
|
-
return parseFloat(value) || 0;
|
|
95
|
-
}
|
|
96
|
-
function toNode(element) {
|
|
97
|
-
return toNodes(element)[0];
|
|
98
|
-
}
|
|
99
|
-
function toNodes(element) {
|
|
100
|
-
return isNode(element) ? [element] : Array.from(element || []).filter(isNode);
|
|
101
|
-
}
|
|
102
|
-
function toWindow(element) {
|
|
103
|
-
if (isWindow(element)) {
|
|
104
|
-
return element;
|
|
105
|
-
}
|
|
106
|
-
element = toNode(element);
|
|
107
|
-
const document = isDocument(element) ? element : element == null ? void 0 : element.ownerDocument;
|
|
108
|
-
return (document == null ? void 0 : document.defaultView) || window;
|
|
109
|
-
}
|
|
110
|
-
function isEqual(value, other) {
|
|
111
|
-
return value === other || isObject(value) && isObject(other) && Object.keys(value).length === Object.keys(other).length && each(value, (val, key) => val === other[key]);
|
|
112
|
-
}
|
|
113
|
-
function swap(value, a, b) {
|
|
114
|
-
return value.replace(new RegExp(`${a}|${b}`, "g"), (match) => match === a ? b : a);
|
|
115
|
-
}
|
|
116
|
-
function last(array) {
|
|
117
|
-
return array[array.length - 1];
|
|
118
|
-
}
|
|
119
|
-
function each(obj, cb) {
|
|
120
|
-
for (const key in obj) {
|
|
121
|
-
if (false === cb(obj[key], key)) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
function sortBy(array, prop) {
|
|
128
|
-
return array.slice().sort(
|
|
129
|
-
({ [prop]: propA = 0 }, { [prop]: propB = 0 }) => propA > propB ? 1 : propB > propA ? -1 : 0
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
function sumBy(array, iteratee) {
|
|
133
|
-
return array.reduce(
|
|
134
|
-
(sum, item) => sum + toFloat(isFunction(iteratee) ? iteratee(item) : item[iteratee]),
|
|
135
|
-
0
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
function uniqueBy(array, prop) {
|
|
139
|
-
const seen = /* @__PURE__ */ new Set();
|
|
140
|
-
return array.filter(({ [prop]: check }) => seen.has(check) ? false : seen.add(check));
|
|
141
|
-
}
|
|
142
|
-
function pick(obj, props) {
|
|
143
|
-
return props.reduce((res, prop) => ({ ...res, [prop]: obj[prop] }), {});
|
|
144
|
-
}
|
|
145
|
-
function clamp(number, min = 0, max = 1) {
|
|
146
|
-
return Math.min(Math.max(toNumber(number) || 0, min), max);
|
|
147
|
-
}
|
|
148
|
-
function noop() {
|
|
149
|
-
}
|
|
150
|
-
function intersectRect(...rects) {
|
|
151
|
-
return [
|
|
152
|
-
["bottom", "top"],
|
|
153
|
-
["right", "left"]
|
|
154
|
-
].every(
|
|
155
|
-
([minProp, maxProp]) => Math.min(...rects.map(({ [minProp]: min }) => min)) - Math.max(...rects.map(({ [maxProp]: max }) => max)) > 0
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
function pointInRect(point, rect) {
|
|
159
|
-
return point.x <= rect.right && point.x >= rect.left && point.y <= rect.bottom && point.y >= rect.top;
|
|
160
|
-
}
|
|
161
|
-
function ratio(dimensions, prop, value) {
|
|
162
|
-
const aProp = prop === "width" ? "height" : "width";
|
|
163
|
-
return {
|
|
164
|
-
[aProp]: dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp],
|
|
165
|
-
[prop]: value
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function contain(dimensions, maxDimensions) {
|
|
169
|
-
dimensions = { ...dimensions };
|
|
170
|
-
for (const prop in dimensions) {
|
|
171
|
-
dimensions = dimensions[prop] > maxDimensions[prop] ? ratio(dimensions, prop, maxDimensions[prop]) : dimensions;
|
|
172
|
-
}
|
|
173
|
-
return dimensions;
|
|
174
|
-
}
|
|
175
|
-
function cover(dimensions, maxDimensions) {
|
|
176
|
-
dimensions = contain(dimensions, maxDimensions);
|
|
177
|
-
for (const prop in dimensions) {
|
|
178
|
-
dimensions = dimensions[prop] < maxDimensions[prop] ? ratio(dimensions, prop, maxDimensions[prop]) : dimensions;
|
|
179
|
-
}
|
|
180
|
-
return dimensions;
|
|
181
|
-
}
|
|
182
|
-
const Dimensions = { ratio, contain, cover };
|
|
183
|
-
function getIndex(i, elements, current = 0, finite = false) {
|
|
184
|
-
elements = toNodes(elements);
|
|
185
|
-
const { length } = elements;
|
|
186
|
-
if (!length) {
|
|
187
|
-
return -1;
|
|
188
|
-
}
|
|
189
|
-
i = isNumeric(i) ? toNumber(i) : i === "next" ? current + 1 : i === "previous" ? current - 1 : i === "last" ? length - 1 : elements.indexOf(toNode(i));
|
|
190
|
-
if (finite) {
|
|
191
|
-
return clamp(i, 0, length - 1);
|
|
192
|
-
}
|
|
193
|
-
i %= length;
|
|
194
|
-
return i < 0 ? i + length : i;
|
|
195
|
-
}
|
|
196
|
-
function memoize(fn) {
|
|
197
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
198
|
-
return (key) => cache[key] || (cache[key] = fn(key));
|
|
199
|
-
}
|
|
200
|
-
class Deferred {
|
|
201
|
-
constructor() {
|
|
202
|
-
this.promise = new Promise((resolve, reject) => {
|
|
203
|
-
this.reject = reject;
|
|
204
|
-
this.resolve = resolve;
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function attr(element, name, value) {
|
|
210
|
-
var _a;
|
|
211
|
-
if (isObject(name)) {
|
|
212
|
-
for (const key in name) {
|
|
213
|
-
attr(element, key, name[key]);
|
|
214
|
-
}
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (isUndefined(value)) {
|
|
218
|
-
return (_a = toNode(element)) == null ? void 0 : _a.getAttribute(name);
|
|
219
|
-
} else {
|
|
220
|
-
for (const el of toNodes(element)) {
|
|
221
|
-
if (isFunction(value)) {
|
|
222
|
-
value = value.call(el, attr(el, name));
|
|
223
|
-
}
|
|
224
|
-
if (value === null) {
|
|
225
|
-
removeAttr(el, name);
|
|
226
|
-
} else {
|
|
227
|
-
el.setAttribute(name, value);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
function hasAttr(element, name) {
|
|
233
|
-
return toNodes(element).some((element2) => element2.hasAttribute(name));
|
|
234
|
-
}
|
|
235
|
-
function removeAttr(element, name) {
|
|
236
|
-
toNodes(element).forEach((element2) => element2.removeAttribute(name));
|
|
237
|
-
}
|
|
238
|
-
function data(element, attribute) {
|
|
239
|
-
for (const name of [attribute, `data-${attribute}`]) {
|
|
240
|
-
if (hasAttr(element, name)) {
|
|
241
|
-
return attr(element, name);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const voidElements = {
|
|
247
|
-
area: true,
|
|
248
|
-
base: true,
|
|
249
|
-
br: true,
|
|
250
|
-
col: true,
|
|
251
|
-
embed: true,
|
|
252
|
-
hr: true,
|
|
253
|
-
img: true,
|
|
254
|
-
input: true,
|
|
255
|
-
keygen: true,
|
|
256
|
-
link: true,
|
|
257
|
-
meta: true,
|
|
258
|
-
param: true,
|
|
259
|
-
source: true,
|
|
260
|
-
track: true,
|
|
261
|
-
wbr: true
|
|
262
|
-
};
|
|
263
|
-
function isVoidElement(element) {
|
|
264
|
-
return toNodes(element).some((element2) => voidElements[element2.tagName.toLowerCase()]);
|
|
265
|
-
}
|
|
266
|
-
function isVisible(element) {
|
|
267
|
-
return toNodes(element).some(
|
|
268
|
-
(element2) => element2.offsetWidth || element2.offsetHeight || element2.getClientRects().length
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
const selInput = "input,select,textarea,button";
|
|
272
|
-
function isInput(element) {
|
|
273
|
-
return toNodes(element).some((element2) => matches(element2, selInput));
|
|
274
|
-
}
|
|
275
|
-
const selFocusable = `${selInput},a[href],[tabindex]`;
|
|
276
|
-
function isFocusable(element) {
|
|
277
|
-
return matches(element, selFocusable);
|
|
278
|
-
}
|
|
279
|
-
function parent(element) {
|
|
280
|
-
var _a;
|
|
281
|
-
return (_a = toNode(element)) == null ? void 0 : _a.parentElement;
|
|
282
|
-
}
|
|
283
|
-
function filter(element, selector) {
|
|
284
|
-
return toNodes(element).filter((element2) => matches(element2, selector));
|
|
285
|
-
}
|
|
286
|
-
function matches(element, selector) {
|
|
287
|
-
return toNodes(element).some((element2) => element2.matches(selector));
|
|
288
|
-
}
|
|
289
|
-
function closest(element, selector) {
|
|
290
|
-
return isElement(element) ? element.closest(startsWith(selector, ">") ? selector.slice(1) : selector) : toNodes(element).map((element2) => closest(element2, selector)).filter(Boolean);
|
|
291
|
-
}
|
|
292
|
-
function within(element, selector) {
|
|
293
|
-
return isString(selector) ? !!closest(element, selector) : toNode(selector).contains(toNode(element));
|
|
294
|
-
}
|
|
295
|
-
function parents(element, selector) {
|
|
296
|
-
const elements = [];
|
|
297
|
-
while (element = parent(element)) {
|
|
298
|
-
if (!selector || matches(element, selector)) {
|
|
299
|
-
elements.push(element);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return elements;
|
|
303
|
-
}
|
|
304
|
-
function children(element, selector) {
|
|
305
|
-
element = toNode(element);
|
|
306
|
-
const children2 = element ? toNodes(element.children) : [];
|
|
307
|
-
return selector ? filter(children2, selector) : children2;
|
|
308
|
-
}
|
|
309
|
-
function index(element, ref) {
|
|
310
|
-
return ref ? toNodes(element).indexOf(toNode(ref)) : children(parent(element)).indexOf(element);
|
|
311
|
-
}
|
|
312
|
-
function isSameSiteAnchor(el) {
|
|
313
|
-
el = toNode(el);
|
|
314
|
-
return el && ["origin", "pathname", "search"].every((part) => el[part] === location[part]);
|
|
315
|
-
}
|
|
316
|
-
function getTargetedElement(el) {
|
|
317
|
-
if (isSameSiteAnchor(el)) {
|
|
318
|
-
el = toNode(el);
|
|
319
|
-
const id = decodeURIComponent(el.hash).substring(1);
|
|
320
|
-
return document.getElementById(id) || document.getElementsByName(id)[0];
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function query(selector, context) {
|
|
325
|
-
return find(selector, getContext(selector, context));
|
|
326
|
-
}
|
|
327
|
-
function queryAll(selector, context) {
|
|
328
|
-
return findAll(selector, getContext(selector, context));
|
|
329
|
-
}
|
|
330
|
-
function find(selector, context) {
|
|
331
|
-
return toNode(_query(selector, toNode(context), "querySelector"));
|
|
332
|
-
}
|
|
333
|
-
function findAll(selector, context) {
|
|
334
|
-
return toNodes(_query(selector, toNode(context), "querySelectorAll"));
|
|
335
|
-
}
|
|
336
|
-
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
337
|
-
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
338
|
-
function getContext(selector, context = document) {
|
|
339
|
-
return isString(selector) && isContextSelector(selector) || isDocument(context) ? context : context.ownerDocument;
|
|
340
|
-
}
|
|
341
|
-
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
342
|
-
const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, "$1 *"));
|
|
343
|
-
function _query(selector, context = document, queryFn) {
|
|
344
|
-
if (!selector || !isString(selector)) {
|
|
345
|
-
return selector;
|
|
346
|
-
}
|
|
347
|
-
selector = sanatize(selector);
|
|
348
|
-
if (isContextSelector(selector)) {
|
|
349
|
-
const split = splitSelector(selector);
|
|
350
|
-
selector = "";
|
|
351
|
-
for (let sel of split) {
|
|
352
|
-
let ctx = context;
|
|
353
|
-
if (sel[0] === "!") {
|
|
354
|
-
const selectors = sel.substr(1).trim().split(" ");
|
|
355
|
-
ctx = closest(parent(context), selectors[0]);
|
|
356
|
-
sel = selectors.slice(1).join(" ").trim();
|
|
357
|
-
if (!sel.length && split.length === 1) {
|
|
358
|
-
return ctx;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (sel[0] === "-") {
|
|
362
|
-
const selectors = sel.substr(1).trim().split(" ");
|
|
363
|
-
const prev = (ctx || context).previousElementSibling;
|
|
364
|
-
ctx = matches(prev, sel.substr(1)) ? prev : null;
|
|
365
|
-
sel = selectors.slice(1).join(" ");
|
|
366
|
-
}
|
|
367
|
-
if (ctx) {
|
|
368
|
-
selector += `${selector ? "," : ""}${domPath(ctx)} ${sel}`;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
context = document;
|
|
372
|
-
}
|
|
373
|
-
try {
|
|
374
|
-
return context[queryFn](selector);
|
|
375
|
-
} catch (e) {
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
const selectorRe = /.*?[^\\](?:,|$)/g;
|
|
380
|
-
const splitSelector = memoize(
|
|
381
|
-
(selector) => selector.match(selectorRe).map((selector2) => selector2.replace(/,$/, "").trim())
|
|
382
|
-
);
|
|
383
|
-
function domPath(element) {
|
|
384
|
-
const names = [];
|
|
385
|
-
while (element.parentNode) {
|
|
386
|
-
const id = attr(element, "id");
|
|
387
|
-
if (id) {
|
|
388
|
-
names.unshift(`#${escape(id)}`);
|
|
389
|
-
break;
|
|
390
|
-
} else {
|
|
391
|
-
let { tagName } = element;
|
|
392
|
-
if (tagName !== "HTML") {
|
|
393
|
-
tagName += `:nth-child(${index(element) + 1})`;
|
|
394
|
-
}
|
|
395
|
-
names.unshift(tagName);
|
|
396
|
-
element = element.parentNode;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return names.join(" > ");
|
|
400
|
-
}
|
|
401
|
-
function escape(css) {
|
|
402
|
-
return isString(css) ? CSS.escape(css) : "";
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function on(...args) {
|
|
406
|
-
let [targets, types, selector, listener, useCapture = false] = getArgs(args);
|
|
407
|
-
if (listener.length > 1) {
|
|
408
|
-
listener = detail(listener);
|
|
409
|
-
}
|
|
410
|
-
if (useCapture == null ? void 0 : useCapture.self) {
|
|
411
|
-
listener = selfFilter(listener);
|
|
412
|
-
}
|
|
413
|
-
if (selector) {
|
|
414
|
-
listener = delegate(selector, listener);
|
|
415
|
-
}
|
|
416
|
-
for (const type of types) {
|
|
417
|
-
for (const target of targets) {
|
|
418
|
-
target.addEventListener(type, listener, useCapture);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return () => off(targets, types, listener, useCapture);
|
|
422
|
-
}
|
|
423
|
-
function off(...args) {
|
|
424
|
-
let [targets, types, , listener, useCapture = false] = getArgs(args);
|
|
425
|
-
for (const type of types) {
|
|
426
|
-
for (const target of targets) {
|
|
427
|
-
target.removeEventListener(type, listener, useCapture);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
function once(...args) {
|
|
432
|
-
const [element, types, selector, listener, useCapture = false, condition] = getArgs(args);
|
|
433
|
-
const off2 = on(
|
|
434
|
-
element,
|
|
435
|
-
types,
|
|
436
|
-
selector,
|
|
437
|
-
(e) => {
|
|
438
|
-
const result = !condition || condition(e);
|
|
439
|
-
if (result) {
|
|
440
|
-
off2();
|
|
441
|
-
listener(e, result);
|
|
442
|
-
}
|
|
443
|
-
},
|
|
444
|
-
useCapture
|
|
445
|
-
);
|
|
446
|
-
return off2;
|
|
447
|
-
}
|
|
448
|
-
function trigger(targets, event, detail2) {
|
|
449
|
-
return toEventTargets(targets).every(
|
|
450
|
-
(target) => target.dispatchEvent(createEvent(event, true, true, detail2))
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
|
-
function createEvent(e, bubbles = true, cancelable = false, detail2) {
|
|
454
|
-
if (isString(e)) {
|
|
455
|
-
e = new CustomEvent(e, { bubbles, cancelable, detail: detail2 });
|
|
456
|
-
}
|
|
457
|
-
return e;
|
|
458
|
-
}
|
|
459
|
-
function getArgs(args) {
|
|
460
|
-
args[0] = toEventTargets(args[0]);
|
|
461
|
-
if (isString(args[1])) {
|
|
462
|
-
args[1] = args[1].split(" ");
|
|
463
|
-
}
|
|
464
|
-
if (isFunction(args[2])) {
|
|
465
|
-
args.splice(2, 0, false);
|
|
466
|
-
}
|
|
467
|
-
return args;
|
|
468
|
-
}
|
|
469
|
-
function delegate(selector, listener) {
|
|
470
|
-
return (e) => {
|
|
471
|
-
const current = selector[0] === ">" ? findAll(selector, e.currentTarget).reverse().filter((element) => within(e.target, element))[0] : closest(e.target, selector);
|
|
472
|
-
if (current) {
|
|
473
|
-
e.current = current;
|
|
474
|
-
listener.call(this, e);
|
|
475
|
-
delete e.current;
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
function detail(listener) {
|
|
480
|
-
return (e) => isArray(e.detail) ? listener(e, ...e.detail) : listener(e);
|
|
481
|
-
}
|
|
482
|
-
function selfFilter(listener) {
|
|
483
|
-
return function(e) {
|
|
484
|
-
if (e.target === e.currentTarget || e.target === e.current) {
|
|
485
|
-
return listener.call(null, e);
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
function isEventTarget(target) {
|
|
490
|
-
return target && "addEventListener" in target;
|
|
491
|
-
}
|
|
492
|
-
function toEventTarget(target) {
|
|
493
|
-
return isEventTarget(target) ? target : toNode(target);
|
|
494
|
-
}
|
|
495
|
-
function toEventTargets(target) {
|
|
496
|
-
return isArray(target) ? target.map(toEventTarget).filter(Boolean) : isString(target) ? findAll(target) : isEventTarget(target) ? [target] : toNodes(target);
|
|
497
|
-
}
|
|
498
|
-
function isTouch(e) {
|
|
499
|
-
return e.pointerType === "touch" || !!e.touches;
|
|
500
|
-
}
|
|
501
|
-
function getEventPos(e) {
|
|
502
|
-
var _a, _b;
|
|
503
|
-
const { clientX: x, clientY: y } = ((_a = e.touches) == null ? void 0 : _a[0]) || ((_b = e.changedTouches) == null ? void 0 : _b[0]) || e;
|
|
504
|
-
return { x, y };
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
const cssNumber = {
|
|
508
|
-
"animation-iteration-count": true,
|
|
509
|
-
"column-count": true,
|
|
510
|
-
"fill-opacity": true,
|
|
511
|
-
"flex-grow": true,
|
|
512
|
-
"flex-shrink": true,
|
|
513
|
-
"font-weight": true,
|
|
514
|
-
"line-height": true,
|
|
515
|
-
opacity: true,
|
|
516
|
-
order: true,
|
|
517
|
-
orphans: true,
|
|
518
|
-
"stroke-dasharray": true,
|
|
519
|
-
"stroke-dashoffset": true,
|
|
520
|
-
widows: true,
|
|
521
|
-
"z-index": true,
|
|
522
|
-
zoom: true
|
|
523
|
-
};
|
|
524
|
-
function css(element, property, value, priority) {
|
|
525
|
-
const elements = toNodes(element);
|
|
526
|
-
for (const element2 of elements) {
|
|
527
|
-
if (isString(property)) {
|
|
528
|
-
property = propName(property);
|
|
529
|
-
if (isUndefined(value)) {
|
|
530
|
-
return getComputedStyle(element2).getPropertyValue(property);
|
|
531
|
-
} else {
|
|
532
|
-
element2.style.setProperty(
|
|
533
|
-
property,
|
|
534
|
-
isNumeric(value) && !cssNumber[property] ? `${value}px` : value || isNumber(value) ? value : "",
|
|
535
|
-
priority
|
|
536
|
-
);
|
|
537
|
-
}
|
|
538
|
-
} else if (isArray(property)) {
|
|
539
|
-
const props = {};
|
|
540
|
-
for (const prop of property) {
|
|
541
|
-
props[prop] = css(element2, prop);
|
|
542
|
-
}
|
|
543
|
-
return props;
|
|
544
|
-
} else if (isObject(property)) {
|
|
545
|
-
priority = value;
|
|
546
|
-
each(property, (value2, property2) => css(element2, property2, value2, priority));
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
return elements[0];
|
|
550
|
-
}
|
|
551
|
-
const propName = memoize((name) => vendorPropName(name));
|
|
552
|
-
function vendorPropName(name) {
|
|
553
|
-
if (startsWith(name, "--")) {
|
|
554
|
-
return name;
|
|
555
|
-
}
|
|
556
|
-
name = hyphenate(name);
|
|
557
|
-
const { style } = document.documentElement;
|
|
558
|
-
if (name in style) {
|
|
559
|
-
return name;
|
|
560
|
-
}
|
|
561
|
-
for (const prefix of ["webkit", "moz"]) {
|
|
562
|
-
const prefixedName = `-${prefix}-${name}`;
|
|
563
|
-
if (prefixedName in style) {
|
|
564
|
-
return prefixedName;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
function addClass(element, ...args) {
|
|
570
|
-
apply$1(element, args, "add");
|
|
571
|
-
}
|
|
572
|
-
function removeClass(element, ...args) {
|
|
573
|
-
apply$1(element, args, "remove");
|
|
574
|
-
}
|
|
575
|
-
function removeClasses(element, cls) {
|
|
576
|
-
attr(
|
|
577
|
-
element,
|
|
578
|
-
"class",
|
|
579
|
-
(value) => (value || "").replace(new RegExp(`\\b${cls}\\b\\s?`, "g"), "")
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
function replaceClass(element, ...args) {
|
|
583
|
-
args[0] && removeClass(element, args[0]);
|
|
584
|
-
args[1] && addClass(element, args[1]);
|
|
585
|
-
}
|
|
586
|
-
function hasClass(element, cls) {
|
|
587
|
-
[cls] = getClasses(cls);
|
|
588
|
-
return !!cls && toNodes(element).some((node) => node.classList.contains(cls));
|
|
589
|
-
}
|
|
590
|
-
function toggleClass(element, cls, force) {
|
|
591
|
-
const classes = getClasses(cls);
|
|
592
|
-
if (!isUndefined(force)) {
|
|
593
|
-
force = !!force;
|
|
594
|
-
}
|
|
595
|
-
for (const node of toNodes(element)) {
|
|
596
|
-
for (const cls2 of classes) {
|
|
597
|
-
node.classList.toggle(cls2, force);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
function apply$1(element, args, fn) {
|
|
602
|
-
args = args.reduce((args2, arg) => args2.concat(getClasses(arg)), []);
|
|
603
|
-
for (const node of toNodes(element)) {
|
|
604
|
-
node.classList[fn](...args);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
function getClasses(str) {
|
|
608
|
-
return String(str).split(/[ ,]/).filter(Boolean);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
function transition(element, props, duration = 400, timing = "linear") {
|
|
612
|
-
duration = Math.round(duration);
|
|
613
|
-
return Promise.all(
|
|
614
|
-
toNodes(element).map(
|
|
615
|
-
(element2) => new Promise((resolve, reject) => {
|
|
616
|
-
for (const name in props) {
|
|
617
|
-
const value = css(element2, name);
|
|
618
|
-
if (value === "") {
|
|
619
|
-
css(element2, name, value);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
const timer = setTimeout(() => trigger(element2, "transitionend"), duration);
|
|
623
|
-
once(
|
|
624
|
-
element2,
|
|
625
|
-
"transitionend transitioncanceled",
|
|
626
|
-
({ type }) => {
|
|
627
|
-
clearTimeout(timer);
|
|
628
|
-
removeClass(element2, "uk-transition");
|
|
629
|
-
css(element2, {
|
|
630
|
-
transitionProperty: "",
|
|
631
|
-
transitionDuration: "",
|
|
632
|
-
transitionTimingFunction: ""
|
|
633
|
-
});
|
|
634
|
-
type === "transitioncanceled" ? reject() : resolve(element2);
|
|
635
|
-
},
|
|
636
|
-
{ self: true }
|
|
637
|
-
);
|
|
638
|
-
addClass(element2, "uk-transition");
|
|
639
|
-
css(element2, {
|
|
640
|
-
transitionProperty: Object.keys(props).map(propName).join(","),
|
|
641
|
-
transitionDuration: `${duration}ms`,
|
|
642
|
-
transitionTimingFunction: timing,
|
|
643
|
-
...props
|
|
644
|
-
});
|
|
645
|
-
})
|
|
646
|
-
)
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
const Transition = {
|
|
650
|
-
start: transition,
|
|
651
|
-
async stop(element) {
|
|
652
|
-
trigger(element, "transitionend");
|
|
653
|
-
await Promise.resolve();
|
|
654
|
-
},
|
|
655
|
-
async cancel(element) {
|
|
656
|
-
trigger(element, "transitioncanceled");
|
|
657
|
-
await Promise.resolve();
|
|
658
|
-
},
|
|
659
|
-
inProgress(element) {
|
|
660
|
-
return hasClass(element, "uk-transition");
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
const animationPrefix = "uk-animation-";
|
|
664
|
-
function animate(element, animation, duration = 200, origin, out) {
|
|
665
|
-
return Promise.all(
|
|
666
|
-
toNodes(element).map(
|
|
667
|
-
(element2) => new Promise((resolve, reject) => {
|
|
668
|
-
trigger(element2, "animationcanceled");
|
|
669
|
-
const timer = setTimeout(() => trigger(element2, "animationend"), duration);
|
|
670
|
-
once(
|
|
671
|
-
element2,
|
|
672
|
-
"animationend animationcanceled",
|
|
673
|
-
({ type }) => {
|
|
674
|
-
clearTimeout(timer);
|
|
675
|
-
type === "animationcanceled" ? reject() : resolve(element2);
|
|
676
|
-
css(element2, "animationDuration", "");
|
|
677
|
-
removeClasses(element2, `${animationPrefix}\\S*`);
|
|
678
|
-
},
|
|
679
|
-
{ self: true }
|
|
680
|
-
);
|
|
681
|
-
css(element2, "animationDuration", `${duration}ms`);
|
|
682
|
-
addClass(element2, animation, animationPrefix + (out ? "leave" : "enter"));
|
|
683
|
-
if (startsWith(animation, animationPrefix)) {
|
|
684
|
-
origin && addClass(element2, `uk-transform-origin-${origin}`);
|
|
685
|
-
out && addClass(element2, `${animationPrefix}reverse`);
|
|
686
|
-
}
|
|
687
|
-
})
|
|
688
|
-
)
|
|
689
|
-
);
|
|
690
|
-
}
|
|
691
|
-
const inProgressRe = new RegExp(`${animationPrefix}(enter|leave)`);
|
|
692
|
-
const Animation = {
|
|
693
|
-
in: animate,
|
|
694
|
-
out(element, animation, duration, origin) {
|
|
695
|
-
return animate(element, animation, duration, origin, true);
|
|
696
|
-
},
|
|
697
|
-
inProgress(element) {
|
|
698
|
-
return inProgressRe.test(attr(element, "class"));
|
|
699
|
-
},
|
|
700
|
-
cancel(element) {
|
|
701
|
-
trigger(element, "animationcanceled");
|
|
702
|
-
}
|
|
703
|
-
};
|
|
704
|
-
|
|
705
|
-
function ready(fn) {
|
|
706
|
-
if (document.readyState !== "loading") {
|
|
707
|
-
fn();
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
once(document, "DOMContentLoaded", fn);
|
|
711
|
-
}
|
|
712
|
-
function isTag(element, ...tagNames) {
|
|
713
|
-
return tagNames.some((tagName) => {
|
|
714
|
-
var _a;
|
|
715
|
-
return ((_a = element == null ? void 0 : element.tagName) == null ? void 0 : _a.toLowerCase()) === tagName.toLowerCase();
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
function empty(element) {
|
|
719
|
-
element = $(element);
|
|
720
|
-
element.innerHTML = "";
|
|
721
|
-
return element;
|
|
722
|
-
}
|
|
723
|
-
function html(parent2, html2) {
|
|
724
|
-
return isUndefined(html2) ? $(parent2).innerHTML : append(empty(parent2), html2);
|
|
725
|
-
}
|
|
726
|
-
const prepend = applyFn("prepend");
|
|
727
|
-
const append = applyFn("append");
|
|
728
|
-
const before = applyFn("before");
|
|
729
|
-
const after = applyFn("after");
|
|
730
|
-
function applyFn(fn) {
|
|
731
|
-
return function(ref, element) {
|
|
732
|
-
var _a;
|
|
733
|
-
const nodes = toNodes(isString(element) ? fragment(element) : element);
|
|
734
|
-
(_a = $(ref)) == null ? void 0 : _a[fn](...nodes);
|
|
735
|
-
return unwrapSingle(nodes);
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
function remove$1(element) {
|
|
739
|
-
toNodes(element).forEach((element2) => element2.remove());
|
|
740
|
-
}
|
|
741
|
-
function wrapAll(element, structure) {
|
|
742
|
-
structure = toNode(before(element, structure));
|
|
743
|
-
while (structure.firstChild) {
|
|
744
|
-
structure = structure.firstChild;
|
|
745
|
-
}
|
|
746
|
-
append(structure, element);
|
|
747
|
-
return structure;
|
|
748
|
-
}
|
|
749
|
-
function wrapInner(element, structure) {
|
|
750
|
-
return toNodes(
|
|
751
|
-
toNodes(element).map(
|
|
752
|
-
(element2) => element2.hasChildNodes() ? wrapAll(toNodes(element2.childNodes), structure) : append(element2, structure)
|
|
753
|
-
)
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
function unwrap(element) {
|
|
757
|
-
toNodes(element).map(parent).filter((value, index, self) => self.indexOf(value) === index).forEach((parent2) => parent2.replaceWith(...parent2.childNodes));
|
|
758
|
-
}
|
|
759
|
-
const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
|
|
760
|
-
const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
|
|
761
|
-
function fragment(html2) {
|
|
762
|
-
const matches = singleTagRe.exec(html2);
|
|
763
|
-
if (matches) {
|
|
764
|
-
return document.createElement(matches[1]);
|
|
765
|
-
}
|
|
766
|
-
const container = document.createElement("div");
|
|
767
|
-
if (fragmentRe.test(html2)) {
|
|
768
|
-
container.insertAdjacentHTML("beforeend", html2.trim());
|
|
769
|
-
} else {
|
|
770
|
-
container.textContent = html2;
|
|
771
|
-
}
|
|
772
|
-
return unwrapSingle(container.childNodes);
|
|
773
|
-
}
|
|
774
|
-
function unwrapSingle(nodes) {
|
|
775
|
-
return nodes.length > 1 ? nodes : nodes[0];
|
|
776
|
-
}
|
|
777
|
-
function apply(node, fn) {
|
|
778
|
-
if (!isElement(node)) {
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
fn(node);
|
|
782
|
-
node = node.firstElementChild;
|
|
783
|
-
while (node) {
|
|
784
|
-
const next = node.nextElementSibling;
|
|
785
|
-
apply(node, fn);
|
|
786
|
-
node = next;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
function $(selector, context) {
|
|
790
|
-
return isHtml(selector) ? toNode(fragment(selector)) : find(selector, context);
|
|
791
|
-
}
|
|
792
|
-
function $$(selector, context) {
|
|
793
|
-
return isHtml(selector) ? toNodes(fragment(selector)) : findAll(selector, context);
|
|
794
|
-
}
|
|
795
|
-
function isHtml(str) {
|
|
796
|
-
return isString(str) && startsWith(str.trim(), "<");
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
const dirs$1 = {
|
|
800
|
-
width: ["left", "right"],
|
|
801
|
-
height: ["top", "bottom"]
|
|
802
|
-
};
|
|
803
|
-
function dimensions(element) {
|
|
804
|
-
const rect = isElement(element) ? toNode(element).getBoundingClientRect() : { height: height(element), width: width(element), top: 0, left: 0 };
|
|
805
|
-
return {
|
|
806
|
-
height: rect.height,
|
|
807
|
-
width: rect.width,
|
|
808
|
-
top: rect.top,
|
|
809
|
-
left: rect.left,
|
|
810
|
-
bottom: rect.top + rect.height,
|
|
811
|
-
right: rect.left + rect.width
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
function offset(element, coordinates) {
|
|
815
|
-
const currentOffset = dimensions(element);
|
|
816
|
-
if (element) {
|
|
817
|
-
const { scrollY, scrollX } = toWindow(element);
|
|
818
|
-
const offsetBy = { height: scrollY, width: scrollX };
|
|
819
|
-
for (const dir in dirs$1) {
|
|
820
|
-
for (const prop of dirs$1[dir]) {
|
|
821
|
-
currentOffset[prop] += offsetBy[dir];
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
if (!coordinates) {
|
|
826
|
-
return currentOffset;
|
|
827
|
-
}
|
|
828
|
-
const pos = css(element, "position");
|
|
829
|
-
each(
|
|
830
|
-
css(element, ["left", "top"]),
|
|
831
|
-
(value, prop) => css(
|
|
832
|
-
element,
|
|
833
|
-
prop,
|
|
834
|
-
coordinates[prop] - currentOffset[prop] + toFloat(pos === "absolute" && value === "auto" ? position(element)[prop] : value)
|
|
835
|
-
)
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
function position(element) {
|
|
839
|
-
let { top, left } = offset(element);
|
|
840
|
-
const {
|
|
841
|
-
ownerDocument: { body, documentElement },
|
|
842
|
-
offsetParent
|
|
843
|
-
} = toNode(element);
|
|
844
|
-
let parent = offsetParent || documentElement;
|
|
845
|
-
while (parent && (parent === body || parent === documentElement) && css(parent, "position") === "static") {
|
|
846
|
-
parent = parent.parentNode;
|
|
847
|
-
}
|
|
848
|
-
if (isElement(parent)) {
|
|
849
|
-
const parentOffset = offset(parent);
|
|
850
|
-
top -= parentOffset.top + toFloat(css(parent, "borderTopWidth"));
|
|
851
|
-
left -= parentOffset.left + toFloat(css(parent, "borderLeftWidth"));
|
|
852
|
-
}
|
|
853
|
-
return {
|
|
854
|
-
top: top - toFloat(css(element, "marginTop")),
|
|
855
|
-
left: left - toFloat(css(element, "marginLeft"))
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
function offsetPosition(element) {
|
|
859
|
-
element = toNode(element);
|
|
860
|
-
const offset2 = [element.offsetTop, element.offsetLeft];
|
|
861
|
-
while (element = element.offsetParent) {
|
|
862
|
-
offset2[0] += element.offsetTop + toFloat(css(element, `borderTopWidth`));
|
|
863
|
-
offset2[1] += element.offsetLeft + toFloat(css(element, `borderLeftWidth`));
|
|
864
|
-
if (css(element, "position") === "fixed") {
|
|
865
|
-
const win = toWindow(element);
|
|
866
|
-
offset2[0] += win.scrollY;
|
|
867
|
-
offset2[1] += win.scrollX;
|
|
868
|
-
return offset2;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
return offset2;
|
|
872
|
-
}
|
|
873
|
-
const height = dimension("height");
|
|
874
|
-
const width = dimension("width");
|
|
875
|
-
function dimension(prop) {
|
|
876
|
-
const propName = ucfirst(prop);
|
|
877
|
-
return (element, value) => {
|
|
878
|
-
if (isUndefined(value)) {
|
|
879
|
-
if (isWindow(element)) {
|
|
880
|
-
return element[`inner${propName}`];
|
|
881
|
-
}
|
|
882
|
-
if (isDocument(element)) {
|
|
883
|
-
const doc = element.documentElement;
|
|
884
|
-
return Math.max(doc[`offset${propName}`], doc[`scroll${propName}`]);
|
|
885
|
-
}
|
|
886
|
-
element = toNode(element);
|
|
887
|
-
value = css(element, prop);
|
|
888
|
-
value = value === "auto" ? element[`offset${propName}`] : toFloat(value) || 0;
|
|
889
|
-
return value - boxModelAdjust(element, prop);
|
|
890
|
-
} else {
|
|
891
|
-
return css(
|
|
892
|
-
element,
|
|
893
|
-
prop,
|
|
894
|
-
!value && value !== 0 ? "" : +value + boxModelAdjust(element, prop) + "px"
|
|
895
|
-
);
|
|
896
|
-
}
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
function boxModelAdjust(element, prop, sizing = "border-box") {
|
|
900
|
-
return css(element, "boxSizing") === sizing ? sumBy(
|
|
901
|
-
dirs$1[prop].map(ucfirst),
|
|
902
|
-
(prop2) => toFloat(css(element, `padding${prop2}`)) + toFloat(css(element, `border${prop2}Width`))
|
|
903
|
-
) : 0;
|
|
904
|
-
}
|
|
905
|
-
function flipPosition(pos) {
|
|
906
|
-
for (const dir in dirs$1) {
|
|
907
|
-
for (const i in dirs$1[dir]) {
|
|
908
|
-
if (dirs$1[dir][i] === pos) {
|
|
909
|
-
return dirs$1[dir][1 - i];
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
return pos;
|
|
914
|
-
}
|
|
915
|
-
function toPx(value, property = "width", element = window, offsetDim = false) {
|
|
916
|
-
if (!isString(value)) {
|
|
917
|
-
return toFloat(value);
|
|
918
|
-
}
|
|
919
|
-
return sumBy(parseCalc(value), (value2) => {
|
|
920
|
-
const unit = parseUnit(value2);
|
|
921
|
-
return unit ? percent(
|
|
922
|
-
unit === "vh" ? getViewportHeight() : unit === "vw" ? width(toWindow(element)) : offsetDim ? element[`offset${ucfirst(property)}`] : dimensions(element)[property],
|
|
923
|
-
value2
|
|
924
|
-
) : value2;
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
|
|
928
|
-
const parseCalc = memoize((calc) => calc.toString().replace(/\s/g, "").match(calcRe) || []);
|
|
929
|
-
const unitRe = /(?:v[hw]|%)$/;
|
|
930
|
-
const parseUnit = memoize((str) => (str.match(unitRe) || [])[0]);
|
|
931
|
-
function percent(base, value) {
|
|
932
|
-
return base * toFloat(value) / 100;
|
|
933
|
-
}
|
|
934
|
-
let vh;
|
|
935
|
-
let vhEl;
|
|
936
|
-
function getViewportHeight() {
|
|
937
|
-
if (vh) {
|
|
938
|
-
return vh;
|
|
939
|
-
}
|
|
940
|
-
if (!vhEl) {
|
|
941
|
-
vhEl = $("<div>");
|
|
942
|
-
css(vhEl, {
|
|
943
|
-
height: "100vh",
|
|
944
|
-
position: "fixed"
|
|
945
|
-
});
|
|
946
|
-
on(window, "resize", () => vh = null);
|
|
947
|
-
}
|
|
948
|
-
append(document.body, vhEl);
|
|
949
|
-
vh = vhEl.clientHeight;
|
|
950
|
-
remove$1(vhEl);
|
|
951
|
-
return vh;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
const inBrowser = typeof window !== "undefined";
|
|
955
|
-
const isRtl = inBrowser && document.dir === "rtl";
|
|
956
|
-
const hasTouch = inBrowser && "ontouchstart" in window;
|
|
957
|
-
const hasPointerEvents = inBrowser && window.PointerEvent;
|
|
958
|
-
const pointerDown$1 = hasPointerEvents ? "pointerdown" : hasTouch ? "touchstart" : "mousedown";
|
|
959
|
-
const pointerMove$1 = hasPointerEvents ? "pointermove" : hasTouch ? "touchmove" : "mousemove";
|
|
960
|
-
const pointerUp$1 = hasPointerEvents ? "pointerup" : hasTouch ? "touchend" : "mouseup";
|
|
961
|
-
const pointerEnter = hasPointerEvents ? "pointerenter" : hasTouch ? "" : "mouseenter";
|
|
962
|
-
const pointerLeave = hasPointerEvents ? "pointerleave" : hasTouch ? "" : "mouseleave";
|
|
963
|
-
const pointerCancel = hasPointerEvents ? "pointercancel" : "touchcancel";
|
|
964
|
-
|
|
965
|
-
const fastdom = {
|
|
966
|
-
reads: [],
|
|
967
|
-
writes: [],
|
|
968
|
-
read(task) {
|
|
969
|
-
this.reads.push(task);
|
|
970
|
-
scheduleFlush();
|
|
971
|
-
return task;
|
|
972
|
-
},
|
|
973
|
-
write(task) {
|
|
974
|
-
this.writes.push(task);
|
|
975
|
-
scheduleFlush();
|
|
976
|
-
return task;
|
|
977
|
-
},
|
|
978
|
-
clear(task) {
|
|
979
|
-
remove(this.reads, task);
|
|
980
|
-
remove(this.writes, task);
|
|
981
|
-
},
|
|
982
|
-
flush
|
|
983
|
-
};
|
|
984
|
-
function flush(recursion) {
|
|
985
|
-
runTasks(fastdom.reads);
|
|
986
|
-
runTasks(fastdom.writes.splice(0));
|
|
987
|
-
fastdom.scheduled = false;
|
|
988
|
-
if (fastdom.reads.length || fastdom.writes.length) {
|
|
989
|
-
scheduleFlush(recursion + 1);
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
const RECURSION_LIMIT = 4;
|
|
993
|
-
function scheduleFlush(recursion) {
|
|
994
|
-
if (fastdom.scheduled) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
fastdom.scheduled = true;
|
|
998
|
-
if (recursion && recursion < RECURSION_LIMIT) {
|
|
999
|
-
Promise.resolve().then(() => flush(recursion));
|
|
1000
|
-
} else {
|
|
1001
|
-
requestAnimationFrame(() => flush(1));
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
function runTasks(tasks) {
|
|
1005
|
-
let task;
|
|
1006
|
-
while (task = tasks.shift()) {
|
|
1007
|
-
try {
|
|
1008
|
-
task();
|
|
1009
|
-
} catch (e) {
|
|
1010
|
-
console.error(e);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
function remove(array, item) {
|
|
1015
|
-
const index = array.indexOf(item);
|
|
1016
|
-
return ~index && array.splice(index, 1);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
function MouseTracker() {
|
|
1020
|
-
}
|
|
1021
|
-
MouseTracker.prototype = {
|
|
1022
|
-
positions: [],
|
|
1023
|
-
init() {
|
|
1024
|
-
this.positions = [];
|
|
1025
|
-
let position;
|
|
1026
|
-
this.unbind = on(document, "mousemove", (e) => position = getEventPos(e));
|
|
1027
|
-
this.interval = setInterval(() => {
|
|
1028
|
-
if (!position) {
|
|
1029
|
-
return;
|
|
1030
|
-
}
|
|
1031
|
-
this.positions.push(position);
|
|
1032
|
-
if (this.positions.length > 5) {
|
|
1033
|
-
this.positions.shift();
|
|
1034
|
-
}
|
|
1035
|
-
}, 50);
|
|
1036
|
-
},
|
|
1037
|
-
cancel() {
|
|
1038
|
-
var _a;
|
|
1039
|
-
(_a = this.unbind) == null ? void 0 : _a.call(this);
|
|
1040
|
-
clearInterval(this.interval);
|
|
1041
|
-
},
|
|
1042
|
-
movesTo(target) {
|
|
1043
|
-
if (this.positions.length < 2) {
|
|
1044
|
-
return false;
|
|
1045
|
-
}
|
|
1046
|
-
const p = target.getBoundingClientRect();
|
|
1047
|
-
const { left, right, top, bottom } = p;
|
|
1048
|
-
const [prevPosition] = this.positions;
|
|
1049
|
-
const position = last(this.positions);
|
|
1050
|
-
const path = [prevPosition, position];
|
|
1051
|
-
if (pointInRect(position, p)) {
|
|
1052
|
-
return false;
|
|
1053
|
-
}
|
|
1054
|
-
const diagonals = [
|
|
1055
|
-
[
|
|
1056
|
-
{ x: left, y: top },
|
|
1057
|
-
{ x: right, y: bottom }
|
|
1058
|
-
],
|
|
1059
|
-
[
|
|
1060
|
-
{ x: left, y: bottom },
|
|
1061
|
-
{ x: right, y: top }
|
|
1062
|
-
]
|
|
1063
|
-
];
|
|
1064
|
-
return diagonals.some((diagonal) => {
|
|
1065
|
-
const intersection = intersect(path, diagonal);
|
|
1066
|
-
return intersection && pointInRect(intersection, p);
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
};
|
|
1070
|
-
function intersect([{ x: x1, y: y1 }, { x: x2, y: y2 }], [{ x: x3, y: y3 }, { x: x4, y: y4 }]) {
|
|
1071
|
-
const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
|
|
1072
|
-
if (denominator === 0) {
|
|
1073
|
-
return false;
|
|
1074
|
-
}
|
|
1075
|
-
const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
|
|
1076
|
-
if (ua < 0) {
|
|
1077
|
-
return false;
|
|
1078
|
-
}
|
|
1079
|
-
return { x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1) };
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
function observeIntersection(targets, cb, options = {}, intersecting = true) {
|
|
1083
|
-
const observer = new IntersectionObserver(
|
|
1084
|
-
intersecting ? (entries, observer2) => {
|
|
1085
|
-
if (entries.some((entry) => entry.isIntersecting)) {
|
|
1086
|
-
cb(entries, observer2);
|
|
1087
|
-
}
|
|
1088
|
-
} : cb,
|
|
1089
|
-
options
|
|
1090
|
-
);
|
|
1091
|
-
for (const el of toNodes(targets)) {
|
|
1092
|
-
observer.observe(el);
|
|
1093
|
-
}
|
|
1094
|
-
return observer;
|
|
1095
|
-
}
|
|
1096
|
-
const hasResizeObserver = inBrowser && window.ResizeObserver;
|
|
1097
|
-
function observeResize(targets, cb, options = { box: "border-box" }) {
|
|
1098
|
-
if (hasResizeObserver) {
|
|
1099
|
-
return observe$1(ResizeObserver, targets, cb, options);
|
|
1100
|
-
}
|
|
1101
|
-
initResizeListener();
|
|
1102
|
-
listeners.add(cb);
|
|
1103
|
-
return {
|
|
1104
|
-
observe: noop,
|
|
1105
|
-
unobserve: noop,
|
|
1106
|
-
disconnect() {
|
|
1107
|
-
listeners.delete(cb);
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
}
|
|
1111
|
-
let listeners;
|
|
1112
|
-
function initResizeListener() {
|
|
1113
|
-
if (listeners) {
|
|
1114
|
-
return;
|
|
1115
|
-
}
|
|
1116
|
-
listeners = /* @__PURE__ */ new Set();
|
|
1117
|
-
let pendingResize;
|
|
1118
|
-
const handleResize = () => {
|
|
1119
|
-
if (pendingResize) {
|
|
1120
|
-
return;
|
|
1121
|
-
}
|
|
1122
|
-
pendingResize = true;
|
|
1123
|
-
requestAnimationFrame(() => pendingResize = false);
|
|
1124
|
-
for (const listener of listeners) {
|
|
1125
|
-
listener();
|
|
1126
|
-
}
|
|
1127
|
-
};
|
|
1128
|
-
on(window, "load resize", handleResize);
|
|
1129
|
-
on(document, "loadedmetadata load", handleResize, true);
|
|
1130
|
-
}
|
|
1131
|
-
function observeMutation(targets, cb, options) {
|
|
1132
|
-
return observe$1(MutationObserver, targets, cb, options);
|
|
1133
|
-
}
|
|
1134
|
-
function observe$1(Observer, targets, cb, options) {
|
|
1135
|
-
const observer = new Observer(cb);
|
|
1136
|
-
for (const el of toNodes(targets)) {
|
|
1137
|
-
observer.observe(el, options);
|
|
1138
|
-
}
|
|
1139
|
-
return observer;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
function play(el) {
|
|
1143
|
-
if (isIFrame(el)) {
|
|
1144
|
-
call(el, { func: "playVideo", method: "play" });
|
|
1145
|
-
}
|
|
1146
|
-
if (isHTML5(el)) {
|
|
1147
|
-
try {
|
|
1148
|
-
el.play().catch(noop);
|
|
1149
|
-
} catch (e) {
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
function pause(el) {
|
|
1154
|
-
if (isIFrame(el)) {
|
|
1155
|
-
call(el, { func: "pauseVideo", method: "pause" });
|
|
1156
|
-
}
|
|
1157
|
-
if (isHTML5(el)) {
|
|
1158
|
-
el.pause();
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
function mute(el) {
|
|
1162
|
-
if (isIFrame(el)) {
|
|
1163
|
-
call(el, { func: "mute", method: "setVolume", value: 0 });
|
|
1164
|
-
}
|
|
1165
|
-
if (isHTML5(el)) {
|
|
1166
|
-
el.muted = true;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
function isVideo(el) {
|
|
1170
|
-
return isHTML5(el) || isIFrame(el);
|
|
1171
|
-
}
|
|
1172
|
-
function isHTML5(el) {
|
|
1173
|
-
return isTag(el, "video");
|
|
1174
|
-
}
|
|
1175
|
-
function isIFrame(el) {
|
|
1176
|
-
return isTag(el, "iframe") && (isYoutube(el) || isVimeo(el));
|
|
1177
|
-
}
|
|
1178
|
-
function isYoutube(el) {
|
|
1179
|
-
return !!el.src.match(
|
|
1180
|
-
/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/
|
|
1181
|
-
);
|
|
1182
|
-
}
|
|
1183
|
-
function isVimeo(el) {
|
|
1184
|
-
return !!el.src.match(/vimeo\.com\/video\/.*/);
|
|
1185
|
-
}
|
|
1186
|
-
async function call(el, cmd) {
|
|
1187
|
-
await enableApi(el);
|
|
1188
|
-
post(el, cmd);
|
|
1189
|
-
}
|
|
1190
|
-
function post(el, cmd) {
|
|
1191
|
-
try {
|
|
1192
|
-
el.contentWindow.postMessage(JSON.stringify({ event: "command", ...cmd }), "*");
|
|
1193
|
-
} catch (e) {
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
const stateKey = "_ukPlayer";
|
|
1197
|
-
let counter = 0;
|
|
1198
|
-
function enableApi(el) {
|
|
1199
|
-
if (el[stateKey]) {
|
|
1200
|
-
return el[stateKey];
|
|
1201
|
-
}
|
|
1202
|
-
const youtube = isYoutube(el);
|
|
1203
|
-
const vimeo = isVimeo(el);
|
|
1204
|
-
const id = ++counter;
|
|
1205
|
-
let poller;
|
|
1206
|
-
return el[stateKey] = new Promise((resolve) => {
|
|
1207
|
-
youtube && once(el, "load", () => {
|
|
1208
|
-
const listener = () => post(el, { event: "listening", id });
|
|
1209
|
-
poller = setInterval(listener, 100);
|
|
1210
|
-
listener();
|
|
1211
|
-
});
|
|
1212
|
-
once(window, "message", resolve, false, ({ data }) => {
|
|
1213
|
-
try {
|
|
1214
|
-
data = JSON.parse(data);
|
|
1215
|
-
return youtube && (data == null ? void 0 : data.id) === id && data.event === "onReady" || vimeo && Number(data == null ? void 0 : data.player_id) === id;
|
|
1216
|
-
} catch (e) {
|
|
1217
|
-
}
|
|
1218
|
-
});
|
|
1219
|
-
el.src = `${el.src}${includes(el.src, "?") ? "&" : "?"}${youtube ? "enablejsapi=1" : `api=1&player_id=${id}`}`;
|
|
1220
|
-
}).then(() => clearInterval(poller));
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
1224
|
-
if (!isVisible(element)) {
|
|
1225
|
-
return false;
|
|
1226
|
-
}
|
|
1227
|
-
return intersectRect(
|
|
1228
|
-
...overflowParents(element).map((parent) => {
|
|
1229
|
-
const { top, left, bottom, right } = offsetViewport(parent);
|
|
1230
|
-
return {
|
|
1231
|
-
top: top - offsetTop,
|
|
1232
|
-
left: left - offsetLeft,
|
|
1233
|
-
bottom: bottom + offsetTop,
|
|
1234
|
-
right: right + offsetLeft
|
|
1235
|
-
};
|
|
1236
|
-
}).concat(offset(element))
|
|
1237
|
-
);
|
|
1238
|
-
}
|
|
1239
|
-
function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
1240
|
-
const parents2 = isVisible(element) ? scrollParents(element, false, ["hidden"]) : [];
|
|
1241
|
-
return parents2.reduce(
|
|
1242
|
-
(fn, scrollElement, i) => {
|
|
1243
|
-
const { scrollTop, scrollHeight, offsetHeight } = scrollElement;
|
|
1244
|
-
const viewport = offsetViewport(scrollElement);
|
|
1245
|
-
const maxScroll = scrollHeight - viewport.height;
|
|
1246
|
-
const { height: elHeight, top: elTop } = parents2[i - 1] ? offsetViewport(parents2[i - 1]) : offset(element);
|
|
1247
|
-
let top = Math.ceil(elTop - viewport.top - offsetBy + scrollTop);
|
|
1248
|
-
if (offsetBy > 0 && offsetHeight < elHeight + offsetBy) {
|
|
1249
|
-
top += offsetBy;
|
|
1250
|
-
} else {
|
|
1251
|
-
offsetBy = 0;
|
|
1252
|
-
}
|
|
1253
|
-
if (top > maxScroll) {
|
|
1254
|
-
offsetBy -= top - maxScroll;
|
|
1255
|
-
top = maxScroll;
|
|
1256
|
-
} else if (top < 0) {
|
|
1257
|
-
offsetBy -= top;
|
|
1258
|
-
top = 0;
|
|
1259
|
-
}
|
|
1260
|
-
return () => scrollTo(scrollElement, top - scrollTop).then(fn);
|
|
1261
|
-
},
|
|
1262
|
-
() => Promise.resolve()
|
|
1263
|
-
)();
|
|
1264
|
-
function scrollTo(element2, top) {
|
|
1265
|
-
return new Promise((resolve) => {
|
|
1266
|
-
const scroll = element2.scrollTop;
|
|
1267
|
-
const duration = getDuration(Math.abs(top));
|
|
1268
|
-
const start = Date.now();
|
|
1269
|
-
(function step() {
|
|
1270
|
-
const percent = ease(clamp((Date.now() - start) / duration));
|
|
1271
|
-
element2.scrollTop = scroll + top * percent;
|
|
1272
|
-
if (percent === 1) {
|
|
1273
|
-
resolve();
|
|
1274
|
-
} else {
|
|
1275
|
-
requestAnimationFrame(step);
|
|
1276
|
-
}
|
|
1277
|
-
})();
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
function getDuration(dist) {
|
|
1281
|
-
return 40 * Math.pow(dist, 0.375);
|
|
1282
|
-
}
|
|
1283
|
-
function ease(k) {
|
|
1284
|
-
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
function scrolledOver(element, startOffset = 0, endOffset = 0) {
|
|
1288
|
-
if (!isVisible(element)) {
|
|
1289
|
-
return 0;
|
|
1290
|
-
}
|
|
1291
|
-
const [scrollElement] = scrollParents(element, true);
|
|
1292
|
-
const { scrollHeight, scrollTop } = scrollElement;
|
|
1293
|
-
const { height: viewportHeight } = offsetViewport(scrollElement);
|
|
1294
|
-
const maxScroll = scrollHeight - viewportHeight;
|
|
1295
|
-
const elementOffsetTop = offsetPosition(element)[0] - offsetPosition(scrollElement)[0];
|
|
1296
|
-
const start = Math.max(0, elementOffsetTop - viewportHeight + startOffset);
|
|
1297
|
-
const end = Math.min(maxScroll, elementOffsetTop + element.offsetHeight - endOffset);
|
|
1298
|
-
return clamp((scrollTop - start) / (end - start));
|
|
1299
|
-
}
|
|
1300
|
-
function scrollParents(element, scrollable = false, props = []) {
|
|
1301
|
-
const scrollEl = scrollingElement(element);
|
|
1302
|
-
let ancestors = parents(element).reverse();
|
|
1303
|
-
ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
|
|
1304
|
-
const fixedIndex = findIndex(ancestors, (el) => css(el, "position") === "fixed");
|
|
1305
|
-
if (~fixedIndex) {
|
|
1306
|
-
ancestors = ancestors.slice(fixedIndex);
|
|
1307
|
-
}
|
|
1308
|
-
return [scrollEl].concat(
|
|
1309
|
-
ancestors.filter(
|
|
1310
|
-
(parent) => css(parent, "overflow").split(" ").some((prop) => includes(["auto", "scroll", ...props], prop)) && (!scrollable || parent.scrollHeight > offsetViewport(parent).height)
|
|
1311
|
-
)
|
|
1312
|
-
).reverse();
|
|
1313
|
-
}
|
|
1314
|
-
function overflowParents(element) {
|
|
1315
|
-
return scrollParents(element, false, ["hidden", "clip"]);
|
|
1316
|
-
}
|
|
1317
|
-
function offsetViewport(scrollElement) {
|
|
1318
|
-
const window = toWindow(scrollElement);
|
|
1319
|
-
const {
|
|
1320
|
-
visualViewport,
|
|
1321
|
-
document: { documentElement }
|
|
1322
|
-
} = window;
|
|
1323
|
-
let viewportElement = scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
|
|
1324
|
-
if (isWindow(viewportElement) && visualViewport) {
|
|
1325
|
-
let { height, width, scale, pageTop: top, pageLeft: left } = visualViewport;
|
|
1326
|
-
height = Math.round(height * scale);
|
|
1327
|
-
width = Math.round(width * scale);
|
|
1328
|
-
return { height, width, top, left, bottom: top + height, right: left + width };
|
|
1329
|
-
}
|
|
1330
|
-
let rect = offset(viewportElement);
|
|
1331
|
-
if (css(viewportElement, "display") === "inline") {
|
|
1332
|
-
return rect;
|
|
1333
|
-
}
|
|
1334
|
-
for (let [prop, dir, start, end] of [
|
|
1335
|
-
["width", "x", "left", "right"],
|
|
1336
|
-
["height", "y", "top", "bottom"]
|
|
1337
|
-
]) {
|
|
1338
|
-
if (isWindow(viewportElement)) {
|
|
1339
|
-
viewportElement = documentElement;
|
|
1340
|
-
} else {
|
|
1341
|
-
rect[start] += toFloat(css(viewportElement, `border-${start}-width`));
|
|
1342
|
-
}
|
|
1343
|
-
rect[prop] = rect[dir] = viewportElement[`client${ucfirst(prop)}`];
|
|
1344
|
-
rect[end] = rect[prop] + rect[start];
|
|
1345
|
-
}
|
|
1346
|
-
return rect;
|
|
1347
|
-
}
|
|
1348
|
-
function scrollingElement(element) {
|
|
1349
|
-
return toWindow(element).document.scrollingElement;
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
const dirs = [
|
|
1353
|
-
["width", "x", "left", "right"],
|
|
1354
|
-
["height", "y", "top", "bottom"]
|
|
1355
|
-
];
|
|
1356
|
-
function positionAt(element, target, options) {
|
|
1357
|
-
options = {
|
|
1358
|
-
attach: {
|
|
1359
|
-
element: ["left", "top"],
|
|
1360
|
-
target: ["left", "top"],
|
|
1361
|
-
...options.attach
|
|
1362
|
-
},
|
|
1363
|
-
offset: [0, 0],
|
|
1364
|
-
placement: [],
|
|
1365
|
-
...options
|
|
1366
|
-
};
|
|
1367
|
-
if (!isArray(target)) {
|
|
1368
|
-
target = [target, target];
|
|
1369
|
-
}
|
|
1370
|
-
offset(element, getPosition(element, target, options));
|
|
1371
|
-
}
|
|
1372
|
-
function getPosition(element, target, options) {
|
|
1373
|
-
const position = attachTo(element, target, options);
|
|
1374
|
-
const { boundary, viewportOffset = 0, placement } = options;
|
|
1375
|
-
let offsetPosition = position;
|
|
1376
|
-
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
1377
|
-
const viewport = getViewport(element, target[i], viewportOffset, boundary, i);
|
|
1378
|
-
if (isWithin(position, viewport, i)) {
|
|
1379
|
-
continue;
|
|
1380
|
-
}
|
|
1381
|
-
let offsetBy = 0;
|
|
1382
|
-
if (placement[i] === "flip") {
|
|
1383
|
-
const attach = options.attach.target[i];
|
|
1384
|
-
if (attach === end && position[end] <= viewport[end] || attach === start && position[start] >= viewport[start]) {
|
|
1385
|
-
continue;
|
|
1386
|
-
}
|
|
1387
|
-
offsetBy = flip(element, target, options, i)[start] - position[start];
|
|
1388
|
-
const scrollArea = getScrollArea(element, target[i], viewportOffset, i);
|
|
1389
|
-
if (!isWithin(applyOffset(position, offsetBy, i), scrollArea, i)) {
|
|
1390
|
-
if (isWithin(position, scrollArea, i)) {
|
|
1391
|
-
continue;
|
|
1392
|
-
}
|
|
1393
|
-
if (options.recursion) {
|
|
1394
|
-
return false;
|
|
1395
|
-
}
|
|
1396
|
-
const newPos = flipAxis(element, target, options);
|
|
1397
|
-
if (newPos && isWithin(newPos, scrollArea, 1 - i)) {
|
|
1398
|
-
return newPos;
|
|
1399
|
-
}
|
|
1400
|
-
continue;
|
|
1401
|
-
}
|
|
1402
|
-
} else if (placement[i] === "shift") {
|
|
1403
|
-
const targetDim = offset(target[i]);
|
|
1404
|
-
const { offset: elOffset } = options;
|
|
1405
|
-
offsetBy = clamp(
|
|
1406
|
-
clamp(position[start], viewport[start], viewport[end] - position[prop]),
|
|
1407
|
-
targetDim[start] - position[prop] + elOffset[i],
|
|
1408
|
-
targetDim[end] - elOffset[i]
|
|
1409
|
-
) - position[start];
|
|
1410
|
-
}
|
|
1411
|
-
offsetPosition = applyOffset(offsetPosition, offsetBy, i);
|
|
1412
|
-
}
|
|
1413
|
-
return offsetPosition;
|
|
1414
|
-
}
|
|
1415
|
-
function attachTo(element, target, options) {
|
|
1416
|
-
let { attach, offset: offsetBy } = {
|
|
1417
|
-
attach: {
|
|
1418
|
-
element: ["left", "top"],
|
|
1419
|
-
target: ["left", "top"],
|
|
1420
|
-
...options.attach
|
|
1421
|
-
},
|
|
1422
|
-
offset: [0, 0],
|
|
1423
|
-
...options
|
|
1424
|
-
};
|
|
1425
|
-
let elOffset = offset(element);
|
|
1426
|
-
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
1427
|
-
const targetOffset = attach.target[i] === attach.element[i] ? offsetViewport(target[i]) : offset(target[i]);
|
|
1428
|
-
elOffset = applyOffset(
|
|
1429
|
-
elOffset,
|
|
1430
|
-
targetOffset[start] - elOffset[start] + moveBy(attach.target[i], end, targetOffset[prop]) - moveBy(attach.element[i], end, elOffset[prop]) + +offsetBy[i],
|
|
1431
|
-
i
|
|
1432
|
-
);
|
|
1433
|
-
}
|
|
1434
|
-
return elOffset;
|
|
1435
|
-
}
|
|
1436
|
-
function applyOffset(position, offset2, i) {
|
|
1437
|
-
const [, dir, start, end] = dirs[i];
|
|
1438
|
-
const newPos = { ...position };
|
|
1439
|
-
newPos[start] = position[dir] = position[start] + offset2;
|
|
1440
|
-
newPos[end] += offset2;
|
|
1441
|
-
return newPos;
|
|
1442
|
-
}
|
|
1443
|
-
function moveBy(attach, end, dim) {
|
|
1444
|
-
return attach === "center" ? dim / 2 : attach === end ? dim : 0;
|
|
1445
|
-
}
|
|
1446
|
-
function getViewport(element, target, viewportOffset, boundary, i) {
|
|
1447
|
-
let viewport = getIntersectionArea(...commonScrollParents(element, target).map(offsetViewport));
|
|
1448
|
-
if (viewportOffset) {
|
|
1449
|
-
viewport[dirs[i][2]] += viewportOffset;
|
|
1450
|
-
viewport[dirs[i][3]] -= viewportOffset;
|
|
1451
|
-
}
|
|
1452
|
-
if (boundary) {
|
|
1453
|
-
viewport = getIntersectionArea(
|
|
1454
|
-
viewport,
|
|
1455
|
-
offset(isArray(boundary) ? boundary[i] : boundary)
|
|
1456
|
-
);
|
|
1457
|
-
}
|
|
1458
|
-
return viewport;
|
|
1459
|
-
}
|
|
1460
|
-
function getScrollArea(element, target, viewportOffset, i) {
|
|
1461
|
-
const [prop, axis, start, end] = dirs[i];
|
|
1462
|
-
const [scrollElement] = commonScrollParents(element, target);
|
|
1463
|
-
const viewport = offsetViewport(scrollElement);
|
|
1464
|
-
if (["auto", "scroll"].includes(css(scrollElement, `overflow-${axis}`))) {
|
|
1465
|
-
viewport[start] -= scrollElement[`scroll${ucfirst(start)}`];
|
|
1466
|
-
viewport[end] = viewport[start] + scrollElement[`scroll${ucfirst(prop)}`];
|
|
1467
|
-
}
|
|
1468
|
-
viewport[start] += viewportOffset;
|
|
1469
|
-
viewport[end] -= viewportOffset;
|
|
1470
|
-
return viewport;
|
|
1471
|
-
}
|
|
1472
|
-
function commonScrollParents(element, target) {
|
|
1473
|
-
return overflowParents(target).filter((parent) => within(element, parent));
|
|
1474
|
-
}
|
|
1475
|
-
function getIntersectionArea(...rects) {
|
|
1476
|
-
let area = {};
|
|
1477
|
-
for (const rect of rects) {
|
|
1478
|
-
for (const [, , start, end] of dirs) {
|
|
1479
|
-
area[start] = Math.max(area[start] || 0, rect[start]);
|
|
1480
|
-
area[end] = Math.min(...[area[end], rect[end]].filter(Boolean));
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
return area;
|
|
1484
|
-
}
|
|
1485
|
-
function isWithin(positionA, positionB, i) {
|
|
1486
|
-
const [, , start, end] = dirs[i];
|
|
1487
|
-
return positionA[start] >= positionB[start] && positionA[end] <= positionB[end];
|
|
1488
|
-
}
|
|
1489
|
-
function flip(element, target, { offset: offset2, attach }, i) {
|
|
1490
|
-
return attachTo(element, target, {
|
|
1491
|
-
attach: {
|
|
1492
|
-
element: flipAttach(attach.element, i),
|
|
1493
|
-
target: flipAttach(attach.target, i)
|
|
1494
|
-
},
|
|
1495
|
-
offset: flipOffset(offset2, i)
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
function flipAxis(element, target, options) {
|
|
1499
|
-
return getPosition(element, target, {
|
|
1500
|
-
...options,
|
|
1501
|
-
attach: {
|
|
1502
|
-
element: options.attach.element.map(flipAttachAxis).reverse(),
|
|
1503
|
-
target: options.attach.target.map(flipAttachAxis).reverse()
|
|
1504
|
-
},
|
|
1505
|
-
offset: options.offset.reverse(),
|
|
1506
|
-
placement: options.placement.reverse(),
|
|
1507
|
-
recursion: true
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
function flipAttach(attach, i) {
|
|
1511
|
-
const newAttach = [...attach];
|
|
1512
|
-
const index = dirs[i].indexOf(attach[i]);
|
|
1513
|
-
if (~index) {
|
|
1514
|
-
newAttach[i] = dirs[i][1 - index % 2 + 2];
|
|
1515
|
-
}
|
|
1516
|
-
return newAttach;
|
|
1517
|
-
}
|
|
1518
|
-
function flipAttachAxis(prop) {
|
|
1519
|
-
for (let i = 0; i < dirs.length; i++) {
|
|
1520
|
-
const index = dirs[i].indexOf(prop);
|
|
1521
|
-
if (~index) {
|
|
1522
|
-
return dirs[1 - i][index % 2 + 2];
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
function flipOffset(offset2, i) {
|
|
1527
|
-
offset2 = [...offset2];
|
|
1528
|
-
offset2[i] *= -1;
|
|
1529
|
-
return offset2;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
var util = /*#__PURE__*/Object.freeze({
|
|
1533
|
-
__proto__: null,
|
|
1534
|
-
$: $,
|
|
1535
|
-
$$: $$,
|
|
1536
|
-
Animation: Animation,
|
|
1537
|
-
Deferred: Deferred,
|
|
1538
|
-
Dimensions: Dimensions,
|
|
1539
|
-
MouseTracker: MouseTracker,
|
|
1540
|
-
Transition: Transition,
|
|
1541
|
-
addClass: addClass,
|
|
1542
|
-
after: after,
|
|
1543
|
-
append: append,
|
|
1544
|
-
apply: apply,
|
|
1545
|
-
assign: assign,
|
|
1546
|
-
attr: attr,
|
|
1547
|
-
before: before,
|
|
1548
|
-
boxModelAdjust: boxModelAdjust,
|
|
1549
|
-
camelize: camelize,
|
|
1550
|
-
children: children,
|
|
1551
|
-
clamp: clamp,
|
|
1552
|
-
closest: closest,
|
|
1553
|
-
createEvent: createEvent,
|
|
1554
|
-
css: css,
|
|
1555
|
-
data: data,
|
|
1556
|
-
dimensions: dimensions,
|
|
1557
|
-
each: each,
|
|
1558
|
-
empty: empty,
|
|
1559
|
-
endsWith: endsWith,
|
|
1560
|
-
escape: escape,
|
|
1561
|
-
fastdom: fastdom,
|
|
1562
|
-
filter: filter,
|
|
1563
|
-
find: find,
|
|
1564
|
-
findAll: findAll,
|
|
1565
|
-
findIndex: findIndex,
|
|
1566
|
-
flipPosition: flipPosition,
|
|
1567
|
-
fragment: fragment,
|
|
1568
|
-
getEventPos: getEventPos,
|
|
1569
|
-
getIndex: getIndex,
|
|
1570
|
-
getTargetedElement: getTargetedElement,
|
|
1571
|
-
hasAttr: hasAttr,
|
|
1572
|
-
hasClass: hasClass,
|
|
1573
|
-
hasOwn: hasOwn,
|
|
1574
|
-
hasTouch: hasTouch,
|
|
1575
|
-
height: height,
|
|
1576
|
-
html: html,
|
|
1577
|
-
hyphenate: hyphenate,
|
|
1578
|
-
inBrowser: inBrowser,
|
|
1579
|
-
includes: includes,
|
|
1580
|
-
index: index,
|
|
1581
|
-
intersectRect: intersectRect,
|
|
1582
|
-
isArray: isArray,
|
|
1583
|
-
isBoolean: isBoolean,
|
|
1584
|
-
isDocument: isDocument,
|
|
1585
|
-
isElement: isElement,
|
|
1586
|
-
isEmpty: isEmpty,
|
|
1587
|
-
isEqual: isEqual,
|
|
1588
|
-
isFocusable: isFocusable,
|
|
1589
|
-
isFunction: isFunction,
|
|
1590
|
-
isInView: isInView,
|
|
1591
|
-
isInput: isInput,
|
|
1592
|
-
isNode: isNode,
|
|
1593
|
-
isNumber: isNumber,
|
|
1594
|
-
isNumeric: isNumeric,
|
|
1595
|
-
isObject: isObject,
|
|
1596
|
-
isPlainObject: isPlainObject,
|
|
1597
|
-
isRtl: isRtl,
|
|
1598
|
-
isSameSiteAnchor: isSameSiteAnchor,
|
|
1599
|
-
isString: isString,
|
|
1600
|
-
isTag: isTag,
|
|
1601
|
-
isTouch: isTouch,
|
|
1602
|
-
isUndefined: isUndefined,
|
|
1603
|
-
isVideo: isVideo,
|
|
1604
|
-
isVisible: isVisible,
|
|
1605
|
-
isVoidElement: isVoidElement,
|
|
1606
|
-
isWindow: isWindow,
|
|
1607
|
-
last: last,
|
|
1608
|
-
matches: matches,
|
|
1609
|
-
memoize: memoize,
|
|
1610
|
-
mute: mute,
|
|
1611
|
-
noop: noop,
|
|
1612
|
-
observeIntersection: observeIntersection,
|
|
1613
|
-
observeMutation: observeMutation,
|
|
1614
|
-
observeResize: observeResize,
|
|
1615
|
-
off: off,
|
|
1616
|
-
offset: offset,
|
|
1617
|
-
offsetPosition: offsetPosition,
|
|
1618
|
-
offsetViewport: offsetViewport,
|
|
1619
|
-
on: on,
|
|
1620
|
-
once: once,
|
|
1621
|
-
overflowParents: overflowParents,
|
|
1622
|
-
parent: parent,
|
|
1623
|
-
parents: parents,
|
|
1624
|
-
pause: pause,
|
|
1625
|
-
pick: pick,
|
|
1626
|
-
play: play,
|
|
1627
|
-
pointInRect: pointInRect,
|
|
1628
|
-
pointerCancel: pointerCancel,
|
|
1629
|
-
pointerDown: pointerDown$1,
|
|
1630
|
-
pointerEnter: pointerEnter,
|
|
1631
|
-
pointerLeave: pointerLeave,
|
|
1632
|
-
pointerMove: pointerMove$1,
|
|
1633
|
-
pointerUp: pointerUp$1,
|
|
1634
|
-
position: position,
|
|
1635
|
-
positionAt: positionAt,
|
|
1636
|
-
prepend: prepend,
|
|
1637
|
-
propName: propName,
|
|
1638
|
-
query: query,
|
|
1639
|
-
queryAll: queryAll,
|
|
1640
|
-
ready: ready,
|
|
1641
|
-
remove: remove$1,
|
|
1642
|
-
removeAttr: removeAttr,
|
|
1643
|
-
removeClass: removeClass,
|
|
1644
|
-
removeClasses: removeClasses,
|
|
1645
|
-
replaceClass: replaceClass,
|
|
1646
|
-
scrollIntoView: scrollIntoView,
|
|
1647
|
-
scrollParents: scrollParents,
|
|
1648
|
-
scrolledOver: scrolledOver,
|
|
1649
|
-
selFocusable: selFocusable,
|
|
1650
|
-
selInput: selInput,
|
|
1651
|
-
sortBy: sortBy,
|
|
1652
|
-
startsWith: startsWith,
|
|
1653
|
-
sumBy: sumBy,
|
|
1654
|
-
swap: swap,
|
|
1655
|
-
toArray: toArray,
|
|
1656
|
-
toBoolean: toBoolean,
|
|
1657
|
-
toEventTargets: toEventTargets,
|
|
1658
|
-
toFloat: toFloat,
|
|
1659
|
-
toNode: toNode,
|
|
1660
|
-
toNodes: toNodes,
|
|
1661
|
-
toNumber: toNumber,
|
|
1662
|
-
toPx: toPx,
|
|
1663
|
-
toWindow: toWindow,
|
|
1664
|
-
toggleClass: toggleClass,
|
|
1665
|
-
trigger: trigger,
|
|
1666
|
-
ucfirst: ucfirst,
|
|
1667
|
-
uniqueBy: uniqueBy,
|
|
1668
|
-
unwrap: unwrap,
|
|
1669
|
-
width: width,
|
|
1670
|
-
within: within,
|
|
1671
|
-
wrapAll: wrapAll,
|
|
1672
|
-
wrapInner: wrapInner
|
|
1673
|
-
});
|
|
1674
|
-
|
|
1675
15
|
function resize(options) {
|
|
1676
|
-
return observe(observeResize, options, "resize");
|
|
16
|
+
return observe(util.observeResize, options, "resize");
|
|
1677
17
|
}
|
|
1678
18
|
function intersection(options) {
|
|
1679
|
-
return observe(observeIntersection, options);
|
|
19
|
+
return observe(util.observeIntersection, options);
|
|
1680
20
|
}
|
|
1681
21
|
function lazyload(options = {}) {
|
|
1682
22
|
return intersection({
|
|
1683
23
|
handler: function(entries, observer) {
|
|
1684
24
|
const { targets = this.$el, preload = 5 } = options;
|
|
1685
|
-
for (const el of toNodes(isFunction(targets) ? targets(this) : targets)) {
|
|
1686
|
-
|
|
25
|
+
for (const el of util.toNodes(util.isFunction(targets) ? targets(this) : targets)) {
|
|
26
|
+
util.$$('[loading="lazy"]', el).slice(0, preload - 1).forEach((el2) => util.removeAttr(el2, "loading"));
|
|
1687
27
|
}
|
|
1688
28
|
for (const el of entries.filter(({ isIntersecting }) => isIntersecting).map(({ target }) => target)) {
|
|
1689
29
|
observer.unobserve(el);
|
|
@@ -1733,638 +73,12 @@
|
|
|
1733
73
|
DOWN: 40
|
|
1734
74
|
};
|
|
1735
75
|
|
|
1736
|
-
function initObservers(instance) {
|
|
1737
|
-
instance._observers = [];
|
|
1738
|
-
instance._observerUpdates = /* @__PURE__ */ new Map();
|
|
1739
|
-
for (const observer of instance.$options.observe || []) {
|
|
1740
|
-
if (hasOwn(observer, "handler")) {
|
|
1741
|
-
registerObservable(instance, observer);
|
|
1742
|
-
} else {
|
|
1743
|
-
for (const key in observer) {
|
|
1744
|
-
registerObservable(instance, observer[key], key);
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
function registerObserver(instance, ...observer) {
|
|
1750
|
-
instance._observers.push(...observer);
|
|
1751
|
-
}
|
|
1752
|
-
function disconnectObservers(instance) {
|
|
1753
|
-
for (const observer of instance._observers) {
|
|
1754
|
-
observer == null ? void 0 : observer.disconnect();
|
|
1755
|
-
instance._observerUpdates.delete(observer);
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
function callObserverUpdates(instance) {
|
|
1759
|
-
for (const [observer, update] of instance._observerUpdates) {
|
|
1760
|
-
update(observer);
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
function registerObservable(instance, observable, key) {
|
|
1764
|
-
let {
|
|
1765
|
-
observe,
|
|
1766
|
-
target = instance.$el,
|
|
1767
|
-
handler,
|
|
1768
|
-
options,
|
|
1769
|
-
filter,
|
|
1770
|
-
args
|
|
1771
|
-
} = isPlainObject(observable) ? observable : { type: key, handler: observable };
|
|
1772
|
-
if (filter && !filter.call(instance, instance)) {
|
|
1773
|
-
return;
|
|
1774
|
-
}
|
|
1775
|
-
const targets = isFunction(target) ? target.call(instance, instance) : target;
|
|
1776
|
-
handler = isString(handler) ? instance[handler] : handler.bind(instance);
|
|
1777
|
-
if (isFunction(options)) {
|
|
1778
|
-
options = options.call(instance, instance);
|
|
1779
|
-
}
|
|
1780
|
-
const observer = observe(targets, handler, options, args);
|
|
1781
|
-
if (isFunction(target) && isArray(targets) && observer.unobserve) {
|
|
1782
|
-
instance._observerUpdates.set(observer, watchChange(instance, target, targets));
|
|
1783
|
-
}
|
|
1784
|
-
registerObserver(instance, observer);
|
|
1785
|
-
}
|
|
1786
|
-
function watchChange(instance, targetFn, targets) {
|
|
1787
|
-
return (observer) => {
|
|
1788
|
-
const newTargets = targetFn.call(instance, instance);
|
|
1789
|
-
if (isEqual(targets, newTargets)) {
|
|
1790
|
-
return;
|
|
1791
|
-
}
|
|
1792
|
-
targets.forEach((target) => !includes(newTargets, target) && observer.unobserve(target));
|
|
1793
|
-
newTargets.forEach((target) => !includes(targets, target) && observer.observe(target));
|
|
1794
|
-
targets.splice(0, targets.length, ...newTargets);
|
|
1795
|
-
};
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
function callWatches(instance) {
|
|
1799
|
-
if (instance._watch) {
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
const initial = !hasOwn(instance, "_watch");
|
|
1803
|
-
instance._watch = fastdom.read(() => {
|
|
1804
|
-
if (instance._connected) {
|
|
1805
|
-
runWatches(instance, initial);
|
|
1806
|
-
}
|
|
1807
|
-
instance._watch = null;
|
|
1808
|
-
});
|
|
1809
|
-
}
|
|
1810
|
-
function runWatches(instance, initial) {
|
|
1811
|
-
const values = { ...instance._computed };
|
|
1812
|
-
instance._computed = {};
|
|
1813
|
-
for (const [key, { watch, immediate }] of Object.entries(instance.$options.computed || {})) {
|
|
1814
|
-
if (watch && (initial && immediate || hasOwn(values, key) && !isEqual(values[key], instance[key]))) {
|
|
1815
|
-
watch.call(instance, instance[key], initial ? void 0 : values[key]);
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
callObserverUpdates(instance);
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
function callUpdate(instance, e = "update") {
|
|
1822
|
-
if (!instance._connected) {
|
|
1823
|
-
return;
|
|
1824
|
-
}
|
|
1825
|
-
if (e === "update" || e === "resize") {
|
|
1826
|
-
callWatches(instance);
|
|
1827
|
-
}
|
|
1828
|
-
if (!instance.$options.update) {
|
|
1829
|
-
return;
|
|
1830
|
-
}
|
|
1831
|
-
if (!instance._updates) {
|
|
1832
|
-
instance._updates = /* @__PURE__ */ new Set();
|
|
1833
|
-
fastdom.read(() => {
|
|
1834
|
-
if (instance._connected) {
|
|
1835
|
-
runUpdates(instance, instance._updates);
|
|
1836
|
-
}
|
|
1837
|
-
delete instance._updates;
|
|
1838
|
-
});
|
|
1839
|
-
}
|
|
1840
|
-
instance._updates.add(e.type || e);
|
|
1841
|
-
}
|
|
1842
|
-
function runUpdates(instance, types) {
|
|
1843
|
-
for (const { read, write, events = [] } of instance.$options.update) {
|
|
1844
|
-
if (!types.has("update") && !events.some((type) => types.has(type))) {
|
|
1845
|
-
continue;
|
|
1846
|
-
}
|
|
1847
|
-
let result;
|
|
1848
|
-
if (read) {
|
|
1849
|
-
result = read.call(instance, instance._data, types);
|
|
1850
|
-
if (result && isPlainObject(result)) {
|
|
1851
|
-
assign(instance._data, result);
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
if (write && result !== false) {
|
|
1855
|
-
fastdom.write(() => {
|
|
1856
|
-
if (instance._connected) {
|
|
1857
|
-
write.call(instance, instance._data, types);
|
|
1858
|
-
}
|
|
1859
|
-
});
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
function initUpdateObserver(instance) {
|
|
1864
|
-
let { el, computed, observe } = instance.$options;
|
|
1865
|
-
if (!computed && !(observe == null ? void 0 : observe.some((options) => isFunction(options.target)))) {
|
|
1866
|
-
return;
|
|
1867
|
-
}
|
|
1868
|
-
for (const key in computed || {}) {
|
|
1869
|
-
if (computed[key].document) {
|
|
1870
|
-
el = el.ownerDocument;
|
|
1871
|
-
break;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
const observer = new MutationObserver(() => callWatches(instance));
|
|
1875
|
-
observer.observe(el, {
|
|
1876
|
-
childList: true,
|
|
1877
|
-
subtree: true
|
|
1878
|
-
});
|
|
1879
|
-
registerObserver(instance, observer);
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
function initEvents(instance) {
|
|
1883
|
-
instance._events = [];
|
|
1884
|
-
for (const event of instance.$options.events || []) {
|
|
1885
|
-
if (hasOwn(event, "handler")) {
|
|
1886
|
-
registerEvent(instance, event);
|
|
1887
|
-
} else {
|
|
1888
|
-
for (const key in event) {
|
|
1889
|
-
registerEvent(instance, event[key], key);
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
function unbindEvents(instance) {
|
|
1895
|
-
instance._events.forEach((unbind) => unbind());
|
|
1896
|
-
delete instance._events;
|
|
1897
|
-
}
|
|
1898
|
-
function registerEvent(instance, event, key) {
|
|
1899
|
-
let { name, el, handler, capture, passive, delegate, filter, self } = isPlainObject(event) ? event : { name: key, handler: event };
|
|
1900
|
-
el = isFunction(el) ? el.call(instance, instance) : el || instance.$el;
|
|
1901
|
-
if (isArray(el)) {
|
|
1902
|
-
el.forEach((el2) => registerEvent(instance, { ...event, el: el2 }, key));
|
|
1903
|
-
return;
|
|
1904
|
-
}
|
|
1905
|
-
if (!el || filter && !filter.call(instance)) {
|
|
1906
|
-
return;
|
|
1907
|
-
}
|
|
1908
|
-
instance._events.push(
|
|
1909
|
-
on(
|
|
1910
|
-
el,
|
|
1911
|
-
name,
|
|
1912
|
-
delegate ? isString(delegate) ? delegate : delegate.call(instance, instance) : null,
|
|
1913
|
-
isString(handler) ? instance[handler] : handler.bind(instance),
|
|
1914
|
-
{ passive, capture, self }
|
|
1915
|
-
)
|
|
1916
|
-
);
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
const strats = {};
|
|
1920
|
-
strats.events = strats.observe = strats.created = strats.beforeConnect = strats.connected = strats.beforeDisconnect = strats.disconnected = strats.destroy = concatStrat;
|
|
1921
|
-
strats.args = function(parentVal, childVal) {
|
|
1922
|
-
return childVal !== false && concatStrat(childVal || parentVal);
|
|
1923
|
-
};
|
|
1924
|
-
strats.update = function(parentVal, childVal) {
|
|
1925
|
-
return sortBy(
|
|
1926
|
-
concatStrat(parentVal, isFunction(childVal) ? { read: childVal } : childVal),
|
|
1927
|
-
"order"
|
|
1928
|
-
);
|
|
1929
|
-
};
|
|
1930
|
-
strats.props = function(parentVal, childVal) {
|
|
1931
|
-
if (isArray(childVal)) {
|
|
1932
|
-
const value = {};
|
|
1933
|
-
for (const key of childVal) {
|
|
1934
|
-
value[key] = String;
|
|
1935
|
-
}
|
|
1936
|
-
childVal = value;
|
|
1937
|
-
}
|
|
1938
|
-
return strats.methods(parentVal, childVal);
|
|
1939
|
-
};
|
|
1940
|
-
strats.computed = strats.methods = function(parentVal, childVal) {
|
|
1941
|
-
return childVal ? parentVal ? { ...parentVal, ...childVal } : childVal : parentVal;
|
|
1942
|
-
};
|
|
1943
|
-
strats.i18n = strats.data = function(parentVal, childVal, vm) {
|
|
1944
|
-
if (!vm) {
|
|
1945
|
-
if (!childVal) {
|
|
1946
|
-
return parentVal;
|
|
1947
|
-
}
|
|
1948
|
-
if (!parentVal) {
|
|
1949
|
-
return childVal;
|
|
1950
|
-
}
|
|
1951
|
-
return function(vm2) {
|
|
1952
|
-
return mergeFnData(parentVal, childVal, vm2);
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
return mergeFnData(parentVal, childVal, vm);
|
|
1956
|
-
};
|
|
1957
|
-
function mergeFnData(parentVal, childVal, vm) {
|
|
1958
|
-
return strats.computed(
|
|
1959
|
-
isFunction(parentVal) ? parentVal.call(vm, vm) : parentVal,
|
|
1960
|
-
isFunction(childVal) ? childVal.call(vm, vm) : childVal
|
|
1961
|
-
);
|
|
1962
|
-
}
|
|
1963
|
-
function concatStrat(parentVal, childVal) {
|
|
1964
|
-
parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
|
|
1965
|
-
return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
|
|
1966
|
-
}
|
|
1967
|
-
function defaultStrat(parentVal, childVal) {
|
|
1968
|
-
return isUndefined(childVal) ? parentVal : childVal;
|
|
1969
|
-
}
|
|
1970
|
-
function mergeOptions(parent, child, vm) {
|
|
1971
|
-
const options = {};
|
|
1972
|
-
if (isFunction(child)) {
|
|
1973
|
-
child = child.options;
|
|
1974
|
-
}
|
|
1975
|
-
if (child.extends) {
|
|
1976
|
-
parent = mergeOptions(parent, child.extends, vm);
|
|
1977
|
-
}
|
|
1978
|
-
if (child.mixins) {
|
|
1979
|
-
for (const mixin of child.mixins) {
|
|
1980
|
-
parent = mergeOptions(parent, mixin, vm);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
for (const key in parent) {
|
|
1984
|
-
mergeKey(key);
|
|
1985
|
-
}
|
|
1986
|
-
for (const key in child) {
|
|
1987
|
-
if (!hasOwn(parent, key)) {
|
|
1988
|
-
mergeKey(key);
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
function mergeKey(key) {
|
|
1992
|
-
options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
|
|
1993
|
-
}
|
|
1994
|
-
return options;
|
|
1995
|
-
}
|
|
1996
|
-
function parseOptions(options, args = []) {
|
|
1997
|
-
try {
|
|
1998
|
-
return options ? startsWith(options, "{") ? JSON.parse(options) : args.length && !includes(options, ":") ? { [args[0]]: options } : options.split(";").reduce((options2, option) => {
|
|
1999
|
-
const [key, value] = option.split(/:(.*)/);
|
|
2000
|
-
if (key && !isUndefined(value)) {
|
|
2001
|
-
options2[key.trim()] = value.trim();
|
|
2002
|
-
}
|
|
2003
|
-
return options2;
|
|
2004
|
-
}, {}) : {};
|
|
2005
|
-
} catch (e) {
|
|
2006
|
-
return {};
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
function coerce(type, value) {
|
|
2010
|
-
if (type === Boolean) {
|
|
2011
|
-
return toBoolean(value);
|
|
2012
|
-
} else if (type === Number) {
|
|
2013
|
-
return toNumber(value);
|
|
2014
|
-
} else if (type === "list") {
|
|
2015
|
-
return toList(value);
|
|
2016
|
-
} else if (type === Object && isString(value)) {
|
|
2017
|
-
return parseOptions(value);
|
|
2018
|
-
}
|
|
2019
|
-
return type ? type(value) : value;
|
|
2020
|
-
}
|
|
2021
|
-
function toList(value) {
|
|
2022
|
-
return isArray(value) ? value : isString(value) ? value.split(/,(?![^(]*\))/).map((value2) => isNumeric(value2) ? toNumber(value2) : toBoolean(value2.trim())) : [value];
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
function initProps(instance) {
|
|
2026
|
-
const props = getProps(instance.$options);
|
|
2027
|
-
for (let key in props) {
|
|
2028
|
-
if (!isUndefined(props[key])) {
|
|
2029
|
-
instance.$props[key] = props[key];
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
const exclude = [instance.$options.computed, instance.$options.methods];
|
|
2033
|
-
for (let key in instance.$props) {
|
|
2034
|
-
if (key in props && notIn(exclude, key)) {
|
|
2035
|
-
instance[key] = instance.$props[key];
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
function getProps(opts) {
|
|
2040
|
-
const data$1 = {};
|
|
2041
|
-
const { args = [], props = {}, el, id } = opts;
|
|
2042
|
-
if (!props) {
|
|
2043
|
-
return data$1;
|
|
2044
|
-
}
|
|
2045
|
-
for (const key in props) {
|
|
2046
|
-
const prop = hyphenate(key);
|
|
2047
|
-
let value = data(el, prop);
|
|
2048
|
-
if (isUndefined(value)) {
|
|
2049
|
-
continue;
|
|
2050
|
-
}
|
|
2051
|
-
value = props[key] === Boolean && value === "" ? true : coerce(props[key], value);
|
|
2052
|
-
if (prop === "target" && startsWith(value, "_")) {
|
|
2053
|
-
continue;
|
|
2054
|
-
}
|
|
2055
|
-
data$1[key] = value;
|
|
2056
|
-
}
|
|
2057
|
-
const options = parseOptions(data(el, id), args);
|
|
2058
|
-
for (const key in options) {
|
|
2059
|
-
const prop = camelize(key);
|
|
2060
|
-
if (!isUndefined(props[prop])) {
|
|
2061
|
-
data$1[prop] = coerce(props[prop], options[key]);
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
return data$1;
|
|
2065
|
-
}
|
|
2066
|
-
function notIn(options, key) {
|
|
2067
|
-
return options.every((arr) => !arr || !hasOwn(arr, key));
|
|
2068
|
-
}
|
|
2069
|
-
function initPropsObserver(instance) {
|
|
2070
|
-
const { $options, $props } = instance;
|
|
2071
|
-
const { id, attrs, props, el } = $options;
|
|
2072
|
-
if (!props || attrs === false) {
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
const attributes = isArray(attrs) ? attrs : Object.keys(props);
|
|
2076
|
-
const filter = attributes.map((key) => hyphenate(key)).concat(id);
|
|
2077
|
-
const observer = new MutationObserver((records) => {
|
|
2078
|
-
const data = getProps($options);
|
|
2079
|
-
if (records.some(({ attributeName }) => {
|
|
2080
|
-
const prop = attributeName.replace("data-", "");
|
|
2081
|
-
return (prop === id ? attributes : [camelize(prop), camelize(attributeName)]).some(
|
|
2082
|
-
(prop2) => !isUndefined(data[prop2]) && data[prop2] !== $props[prop2]
|
|
2083
|
-
);
|
|
2084
|
-
})) {
|
|
2085
|
-
instance.$reset();
|
|
2086
|
-
}
|
|
2087
|
-
});
|
|
2088
|
-
observer.observe(el, {
|
|
2089
|
-
attributes: true,
|
|
2090
|
-
attributeFilter: filter.concat(filter.map((key) => `data-${key}`))
|
|
2091
|
-
});
|
|
2092
|
-
registerObserver(instance, observer);
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
function callHook(instance, hook) {
|
|
2096
|
-
var _a;
|
|
2097
|
-
(_a = instance.$options[hook]) == null ? void 0 : _a.forEach((handler) => handler.call(instance));
|
|
2098
|
-
}
|
|
2099
|
-
function callConnected(instance) {
|
|
2100
|
-
if (instance._connected) {
|
|
2101
|
-
return;
|
|
2102
|
-
}
|
|
2103
|
-
instance._data = {};
|
|
2104
|
-
instance._computed = {};
|
|
2105
|
-
initProps(instance);
|
|
2106
|
-
callHook(instance, "beforeConnect");
|
|
2107
|
-
instance._connected = true;
|
|
2108
|
-
initEvents(instance);
|
|
2109
|
-
initObservers(instance);
|
|
2110
|
-
initPropsObserver(instance);
|
|
2111
|
-
initUpdateObserver(instance);
|
|
2112
|
-
callHook(instance, "connected");
|
|
2113
|
-
callUpdate(instance);
|
|
2114
|
-
}
|
|
2115
|
-
function callDisconnected(instance) {
|
|
2116
|
-
if (!instance._connected) {
|
|
2117
|
-
return;
|
|
2118
|
-
}
|
|
2119
|
-
callHook(instance, "beforeDisconnect");
|
|
2120
|
-
disconnectObservers(instance);
|
|
2121
|
-
unbindEvents(instance);
|
|
2122
|
-
callHook(instance, "disconnected");
|
|
2123
|
-
instance._connected = false;
|
|
2124
|
-
delete instance._watch;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
function initComputed(instance) {
|
|
2128
|
-
const { computed } = instance.$options;
|
|
2129
|
-
instance._computed = {};
|
|
2130
|
-
if (computed) {
|
|
2131
|
-
for (const key in computed) {
|
|
2132
|
-
registerComputed(instance, key, computed[key]);
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
function registerComputed(instance, key, cb) {
|
|
2137
|
-
Object.defineProperty(instance, key, {
|
|
2138
|
-
enumerable: true,
|
|
2139
|
-
get() {
|
|
2140
|
-
const { _computed, $props, $el } = instance;
|
|
2141
|
-
if (!hasOwn(_computed, key)) {
|
|
2142
|
-
_computed[key] = (cb.get || cb).call(instance, $props, $el);
|
|
2143
|
-
}
|
|
2144
|
-
return _computed[key];
|
|
2145
|
-
},
|
|
2146
|
-
set(value) {
|
|
2147
|
-
const { _computed } = instance;
|
|
2148
|
-
_computed[key] = cb.set ? cb.set.call(instance, value) : value;
|
|
2149
|
-
if (isUndefined(_computed[key])) {
|
|
2150
|
-
delete _computed[key];
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
});
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
let uid = 0;
|
|
2157
|
-
function init(instance, options = {}) {
|
|
2158
|
-
options.data = normalizeData(options, instance.constructor.options);
|
|
2159
|
-
instance.$options = mergeOptions(instance.constructor.options, options, instance);
|
|
2160
|
-
instance.$props = {};
|
|
2161
|
-
instance._uid = uid++;
|
|
2162
|
-
initData(instance);
|
|
2163
|
-
initMethods(instance);
|
|
2164
|
-
initComputed(instance);
|
|
2165
|
-
callHook(instance, "created");
|
|
2166
|
-
if (options.el) {
|
|
2167
|
-
instance.$mount(options.el);
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
function initData(instance) {
|
|
2171
|
-
const { data = {} } = instance.$options;
|
|
2172
|
-
for (const key in data) {
|
|
2173
|
-
instance.$props[key] = instance[key] = data[key];
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
function initMethods(instance) {
|
|
2177
|
-
const { methods } = instance.$options;
|
|
2178
|
-
if (methods) {
|
|
2179
|
-
for (const key in methods) {
|
|
2180
|
-
instance[key] = methods[key].bind(instance);
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
function normalizeData({ data = {} }, { args = [], props = {} }) {
|
|
2185
|
-
if (isArray(data)) {
|
|
2186
|
-
data = data.slice(0, args.length).reduce((data2, value, index) => {
|
|
2187
|
-
if (isPlainObject(value)) {
|
|
2188
|
-
assign(data2, value);
|
|
2189
|
-
} else {
|
|
2190
|
-
data2[args[index]] = value;
|
|
2191
|
-
}
|
|
2192
|
-
return data2;
|
|
2193
|
-
}, {});
|
|
2194
|
-
}
|
|
2195
|
-
for (const key in data) {
|
|
2196
|
-
if (isUndefined(data[key])) {
|
|
2197
|
-
delete data[key];
|
|
2198
|
-
} else if (props[key]) {
|
|
2199
|
-
data[key] = coerce(props[key], data[key]);
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
return data;
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
const App = function(options) {
|
|
2206
|
-
init(this, options);
|
|
2207
|
-
};
|
|
2208
|
-
App.util = util;
|
|
2209
|
-
App.options = {};
|
|
2210
|
-
App.version = "3.16.6";
|
|
2211
|
-
|
|
2212
|
-
const PREFIX = "uk-";
|
|
2213
|
-
const DATA = "__uikit__";
|
|
2214
|
-
const components = {};
|
|
2215
|
-
function component(name, options) {
|
|
2216
|
-
var _a;
|
|
2217
|
-
const id = PREFIX + hyphenate(name);
|
|
2218
|
-
if (!options) {
|
|
2219
|
-
if (isPlainObject(components[id])) {
|
|
2220
|
-
components[id] = App.extend(components[id]);
|
|
2221
|
-
}
|
|
2222
|
-
return components[id];
|
|
2223
|
-
}
|
|
2224
|
-
name = camelize(name);
|
|
2225
|
-
App[name] = (element, data) => createComponent(name, element, data);
|
|
2226
|
-
const opt = isPlainObject(options) ? { ...options } : options.options;
|
|
2227
|
-
opt.id = id;
|
|
2228
|
-
opt.name = name;
|
|
2229
|
-
(_a = opt.install) == null ? void 0 : _a.call(opt, App, opt, name);
|
|
2230
|
-
if (App._initialized && !opt.functional) {
|
|
2231
|
-
requestAnimationFrame(() => createComponent(name, `[${id}],[data-${id}]`));
|
|
2232
|
-
}
|
|
2233
|
-
return components[id] = opt;
|
|
2234
|
-
}
|
|
2235
|
-
function createComponent(name, element, data, ...args) {
|
|
2236
|
-
const Component = component(name);
|
|
2237
|
-
return Component.options.functional ? new Component({ data: isPlainObject(element) ? element : [element, data, ...args] }) : element ? $$(element).map(init)[0] : init();
|
|
2238
|
-
function init(element2) {
|
|
2239
|
-
const instance = getComponent(element2, name);
|
|
2240
|
-
if (instance) {
|
|
2241
|
-
if (data) {
|
|
2242
|
-
instance.$destroy();
|
|
2243
|
-
} else {
|
|
2244
|
-
return instance;
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
return new Component({ el: element2, data });
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
function getComponents(element) {
|
|
2251
|
-
return (element == null ? void 0 : element[DATA]) || {};
|
|
2252
|
-
}
|
|
2253
|
-
function getComponent(element, name) {
|
|
2254
|
-
return getComponents(element)[name];
|
|
2255
|
-
}
|
|
2256
|
-
function attachToElement(element, instance) {
|
|
2257
|
-
if (!element[DATA]) {
|
|
2258
|
-
element[DATA] = {};
|
|
2259
|
-
}
|
|
2260
|
-
element[DATA][instance.$options.name] = instance;
|
|
2261
|
-
}
|
|
2262
|
-
function detachFromElement(element, instance) {
|
|
2263
|
-
var _a;
|
|
2264
|
-
(_a = element[DATA]) == null ? true : delete _a[instance.$options.name];
|
|
2265
|
-
if (!isEmpty(element[DATA])) {
|
|
2266
|
-
delete element[DATA];
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
App.component = component;
|
|
2271
|
-
App.getComponents = getComponents;
|
|
2272
|
-
App.getComponent = getComponent;
|
|
2273
|
-
App.use = function(plugin) {
|
|
2274
|
-
if (plugin.installed) {
|
|
2275
|
-
return;
|
|
2276
|
-
}
|
|
2277
|
-
plugin.call(null, this);
|
|
2278
|
-
plugin.installed = true;
|
|
2279
|
-
return this;
|
|
2280
|
-
};
|
|
2281
|
-
App.mixin = function(mixin, component2) {
|
|
2282
|
-
component2 = (isString(component2) ? this.component(component2) : component2) || this;
|
|
2283
|
-
component2.options = mergeOptions(component2.options, mixin);
|
|
2284
|
-
};
|
|
2285
|
-
App.extend = function(options) {
|
|
2286
|
-
options = options || {};
|
|
2287
|
-
const Super = this;
|
|
2288
|
-
const Sub = function UIkitComponent(options2) {
|
|
2289
|
-
init(this, options2);
|
|
2290
|
-
};
|
|
2291
|
-
Sub.prototype = Object.create(Super.prototype);
|
|
2292
|
-
Sub.prototype.constructor = Sub;
|
|
2293
|
-
Sub.options = mergeOptions(Super.options, options);
|
|
2294
|
-
Sub.super = Super;
|
|
2295
|
-
Sub.extend = Super.extend;
|
|
2296
|
-
return Sub;
|
|
2297
|
-
};
|
|
2298
|
-
function update(element, e) {
|
|
2299
|
-
element = element ? toNode(element) : document.body;
|
|
2300
|
-
for (const parentEl of parents(element).reverse()) {
|
|
2301
|
-
updateElement(parentEl, e);
|
|
2302
|
-
}
|
|
2303
|
-
apply(element, (element2) => updateElement(element2, e));
|
|
2304
|
-
}
|
|
2305
|
-
App.update = update;
|
|
2306
|
-
function updateElement(element, e) {
|
|
2307
|
-
const components = getComponents(element);
|
|
2308
|
-
for (const name in components) {
|
|
2309
|
-
callUpdate(components[name], e);
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
let container;
|
|
2313
|
-
Object.defineProperty(App, "container", {
|
|
2314
|
-
get() {
|
|
2315
|
-
return container || document.body;
|
|
2316
|
-
},
|
|
2317
|
-
set(element) {
|
|
2318
|
-
container = $(element);
|
|
2319
|
-
}
|
|
2320
|
-
});
|
|
2321
|
-
|
|
2322
|
-
App.prototype.$mount = function(el) {
|
|
2323
|
-
const instance = this;
|
|
2324
|
-
attachToElement(el, instance);
|
|
2325
|
-
instance.$options.el = el;
|
|
2326
|
-
if (within(el, document)) {
|
|
2327
|
-
callConnected(instance);
|
|
2328
|
-
}
|
|
2329
|
-
};
|
|
2330
|
-
App.prototype.$destroy = function(removeEl = false) {
|
|
2331
|
-
const instance = this;
|
|
2332
|
-
const { el } = instance.$options;
|
|
2333
|
-
if (el) {
|
|
2334
|
-
callDisconnected(instance);
|
|
2335
|
-
}
|
|
2336
|
-
callHook(instance, "destroy");
|
|
2337
|
-
detachFromElement(el, instance);
|
|
2338
|
-
if (removeEl) {
|
|
2339
|
-
remove$1(instance.$el);
|
|
2340
|
-
}
|
|
2341
|
-
};
|
|
2342
|
-
App.prototype.$create = createComponent;
|
|
2343
|
-
App.prototype.$emit = function(e) {
|
|
2344
|
-
callUpdate(this, e);
|
|
2345
|
-
};
|
|
2346
|
-
App.prototype.$update = function(element = this.$el, e) {
|
|
2347
|
-
update(element, e);
|
|
2348
|
-
};
|
|
2349
|
-
App.prototype.$reset = function() {
|
|
2350
|
-
callDisconnected(this);
|
|
2351
|
-
callConnected(this);
|
|
2352
|
-
};
|
|
2353
|
-
App.prototype.$getComponent = getComponent;
|
|
2354
|
-
Object.defineProperties(App.prototype, {
|
|
2355
|
-
$el: {
|
|
2356
|
-
get() {
|
|
2357
|
-
return this.$options.el;
|
|
2358
|
-
}
|
|
2359
|
-
},
|
|
2360
|
-
$container: Object.getOwnPropertyDescriptor(App, "container")
|
|
2361
|
-
});
|
|
2362
76
|
function generateId(instance, el = instance.$el, postfix = "") {
|
|
2363
77
|
if (el.id) {
|
|
2364
78
|
return el.id;
|
|
2365
79
|
}
|
|
2366
80
|
let id = `${instance.$options.id}-${instance._uid}${postfix}`;
|
|
2367
|
-
if (
|
|
81
|
+
if (util.$(`#${id}`)) {
|
|
2368
82
|
id = generateId(instance, el, `${postfix}-2`);
|
|
2369
83
|
}
|
|
2370
84
|
return id;
|
|
@@ -2383,10 +97,10 @@
|
|
|
2383
97
|
computed: {
|
|
2384
98
|
nav: {
|
|
2385
99
|
get({ selNav }, $el) {
|
|
2386
|
-
return
|
|
100
|
+
return util.$(selNav, $el);
|
|
2387
101
|
},
|
|
2388
102
|
watch(nav, prev) {
|
|
2389
|
-
|
|
103
|
+
util.attr(nav, "role", "tablist");
|
|
2390
104
|
if (prev) {
|
|
2391
105
|
this.$emit();
|
|
2392
106
|
}
|
|
@@ -2398,7 +112,7 @@
|
|
|
2398
112
|
},
|
|
2399
113
|
navItems: {
|
|
2400
114
|
get(_, $el) {
|
|
2401
|
-
return
|
|
115
|
+
return util.$$(this.selNavItem, $el);
|
|
2402
116
|
},
|
|
2403
117
|
watch() {
|
|
2404
118
|
this.$emit();
|
|
@@ -2406,32 +120,35 @@
|
|
|
2406
120
|
}
|
|
2407
121
|
},
|
|
2408
122
|
connected() {
|
|
2409
|
-
|
|
123
|
+
util.attr(this.$el, {
|
|
124
|
+
role: "region",
|
|
125
|
+
ariaRoleDescription: "carousel"
|
|
126
|
+
});
|
|
2410
127
|
},
|
|
2411
128
|
update: [
|
|
2412
129
|
{
|
|
2413
130
|
write() {
|
|
2414
131
|
this.slides.forEach(
|
|
2415
|
-
(slide, i) =>
|
|
132
|
+
(slide, i) => util.attr(slide, {
|
|
2416
133
|
role: this.nav ? "tabpanel" : "group",
|
|
2417
134
|
"aria-label": this.t("slideLabel", i + 1, this.length),
|
|
2418
135
|
"aria-roledescription": this.nav ? null : "slide"
|
|
2419
136
|
})
|
|
2420
137
|
);
|
|
2421
138
|
if (this.nav && this.length !== this.nav.children.length) {
|
|
2422
|
-
|
|
139
|
+
util.html(
|
|
2423
140
|
this.nav,
|
|
2424
141
|
this.slides.map((_, i) => `<li ${this.attrItem}="${i}"><a href></a></li>`).join("")
|
|
2425
142
|
);
|
|
2426
143
|
}
|
|
2427
|
-
|
|
144
|
+
util.attr(util.children(this.nav).concat(this.list), "role", "presentation");
|
|
2428
145
|
for (const el of this.navItems) {
|
|
2429
|
-
const cmd =
|
|
2430
|
-
const button =
|
|
146
|
+
const cmd = util.data(el, this.attrItem);
|
|
147
|
+
const button = util.$("a,button", el) || el;
|
|
2431
148
|
let ariaLabel;
|
|
2432
149
|
let ariaControls = null;
|
|
2433
|
-
if (
|
|
2434
|
-
const item =
|
|
150
|
+
if (util.isNumeric(cmd)) {
|
|
151
|
+
const item = util.toNumber(cmd);
|
|
2435
152
|
const slide = this.slides[item];
|
|
2436
153
|
if (slide) {
|
|
2437
154
|
if (!slide.id) {
|
|
@@ -2439,8 +156,8 @@
|
|
|
2439
156
|
}
|
|
2440
157
|
ariaControls = slide.id;
|
|
2441
158
|
}
|
|
2442
|
-
ariaLabel = this.t("slideX",
|
|
2443
|
-
|
|
159
|
+
ariaLabel = this.t("slideX", util.toFloat(cmd) + 1);
|
|
160
|
+
util.attr(button, "role", "tab");
|
|
2444
161
|
} else {
|
|
2445
162
|
if (this.list) {
|
|
2446
163
|
if (!this.list.id) {
|
|
@@ -2450,9 +167,9 @@
|
|
|
2450
167
|
}
|
|
2451
168
|
ariaLabel = this.t(cmd);
|
|
2452
169
|
}
|
|
2453
|
-
|
|
170
|
+
util.attr(button, {
|
|
2454
171
|
"aria-controls": ariaControls,
|
|
2455
|
-
"aria-label":
|
|
172
|
+
"aria-label": util.attr(button, "aria-label") || ariaLabel
|
|
2456
173
|
});
|
|
2457
174
|
}
|
|
2458
175
|
}
|
|
@@ -2472,9 +189,9 @@
|
|
|
2472
189
|
return this.selNavItem;
|
|
2473
190
|
},
|
|
2474
191
|
handler(e) {
|
|
2475
|
-
if (
|
|
192
|
+
if (util.closest(e.target, "a,button") && (e.type === "click" || e.keyCode === keyMap.SPACE)) {
|
|
2476
193
|
e.preventDefault();
|
|
2477
|
-
this.show(
|
|
194
|
+
this.show(util.data(e.current, this.attrItem));
|
|
2478
195
|
}
|
|
2479
196
|
}
|
|
2480
197
|
},
|
|
@@ -2489,8 +206,8 @@
|
|
|
2489
206
|
},
|
|
2490
207
|
handler(e) {
|
|
2491
208
|
const { current, keyCode } = e;
|
|
2492
|
-
const cmd =
|
|
2493
|
-
if (!
|
|
209
|
+
const cmd = util.data(current, this.attrItem);
|
|
210
|
+
if (!util.isNumeric(cmd)) {
|
|
2494
211
|
return;
|
|
2495
212
|
}
|
|
2496
213
|
let i = keyCode === keyMap.HOME ? 0 : keyCode === keyMap.END ? "last" : keyCode === keyMap.LEFT ? "previous" : keyCode === keyMap.RIGHT ? "next" : -1;
|
|
@@ -2507,22 +224,22 @@
|
|
|
2507
224
|
let focus;
|
|
2508
225
|
let focusEl;
|
|
2509
226
|
for (const el of this.navItems) {
|
|
2510
|
-
const cmd =
|
|
2511
|
-
const button =
|
|
2512
|
-
if (
|
|
2513
|
-
const item =
|
|
227
|
+
const cmd = util.data(el, this.attrItem);
|
|
228
|
+
const button = util.$("a,button", el) || el;
|
|
229
|
+
if (util.isNumeric(cmd)) {
|
|
230
|
+
const item = util.toNumber(cmd);
|
|
2514
231
|
const active = item === index;
|
|
2515
|
-
|
|
2516
|
-
|
|
232
|
+
util.toggleClass(el, this.clsActive, active);
|
|
233
|
+
util.attr(button, {
|
|
2517
234
|
"aria-selected": active,
|
|
2518
235
|
tabindex: active ? null : -1
|
|
2519
236
|
});
|
|
2520
237
|
if (active) {
|
|
2521
238
|
focusEl = button;
|
|
2522
239
|
}
|
|
2523
|
-
focus = focus ||
|
|
240
|
+
focus = focus || util.matches(button, ":focus");
|
|
2524
241
|
} else {
|
|
2525
|
-
|
|
242
|
+
util.toggleClass(
|
|
2526
243
|
el,
|
|
2527
244
|
"uk-invisible",
|
|
2528
245
|
this.finite && (cmd === "previous" && index === 0 || cmd === "next" && index >= this.maxIndex)
|
|
@@ -2553,7 +270,7 @@
|
|
|
2553
270
|
for (const key of ["start", "move", "end"]) {
|
|
2554
271
|
const fn = this[key];
|
|
2555
272
|
this[key] = (e) => {
|
|
2556
|
-
const pos =
|
|
273
|
+
const pos = util.getEventPos(e).x * (util.isRtl ? -1 : 1);
|
|
2557
274
|
this.prevPos = pos === this.pos ? this.prevPos : this.pos;
|
|
2558
275
|
this.pos = pos;
|
|
2559
276
|
fn(e);
|
|
@@ -2568,7 +285,7 @@
|
|
|
2568
285
|
return `${this.selList} > *`;
|
|
2569
286
|
},
|
|
2570
287
|
handler(e) {
|
|
2571
|
-
if (!this.draggable || !
|
|
288
|
+
if (!this.draggable || !util.isTouch(e) && hasSelectableText(e.target) || util.closest(e.target, util.selInput) || e.button > 0 || this.length < 2) {
|
|
2572
289
|
return;
|
|
2573
290
|
}
|
|
2574
291
|
this.start(e);
|
|
@@ -2586,7 +303,7 @@
|
|
|
2586
303
|
el() {
|
|
2587
304
|
return this.list;
|
|
2588
305
|
},
|
|
2589
|
-
handler:
|
|
306
|
+
handler: util.noop,
|
|
2590
307
|
...pointerOptions
|
|
2591
308
|
}
|
|
2592
309
|
],
|
|
@@ -2603,16 +320,16 @@
|
|
|
2603
320
|
} else {
|
|
2604
321
|
this.prevIndex = this.index;
|
|
2605
322
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
323
|
+
util.on(document, pointerMove, this.move, pointerOptions);
|
|
324
|
+
util.on(document, pointerUp, this.end, pointerUpOptions);
|
|
325
|
+
util.css(this.list, "userSelect", "none");
|
|
2609
326
|
},
|
|
2610
327
|
move(e) {
|
|
2611
328
|
const distance = this.pos - this.drag;
|
|
2612
329
|
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
|
|
2613
330
|
return;
|
|
2614
331
|
}
|
|
2615
|
-
|
|
332
|
+
util.css(this.list, "pointerEvents", "none");
|
|
2616
333
|
e.cancelable && e.preventDefault();
|
|
2617
334
|
this.dragging = true;
|
|
2618
335
|
this.dir = distance < 0 ? 1 : -1;
|
|
@@ -2634,31 +351,31 @@
|
|
|
2634
351
|
const changed = this.index !== nextIndex;
|
|
2635
352
|
const edge = prevIndex === nextIndex;
|
|
2636
353
|
let itemShown;
|
|
2637
|
-
[this.index, this.prevIndex].filter((i) => !
|
|
2638
|
-
|
|
354
|
+
[this.index, this.prevIndex].filter((i) => !util.includes([nextIndex, prevIndex], i)).forEach((i) => {
|
|
355
|
+
util.trigger(slides[i], "itemhidden", [this]);
|
|
2639
356
|
if (edge) {
|
|
2640
357
|
itemShown = true;
|
|
2641
358
|
this.prevIndex = prevIndex;
|
|
2642
359
|
}
|
|
2643
360
|
});
|
|
2644
361
|
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
|
|
2645
|
-
|
|
362
|
+
util.trigger(slides[this.index], "itemshown", [this]);
|
|
2646
363
|
}
|
|
2647
364
|
if (changed) {
|
|
2648
365
|
this.prevIndex = prevIndex;
|
|
2649
366
|
this.index = nextIndex;
|
|
2650
|
-
!edge &&
|
|
2651
|
-
|
|
367
|
+
!edge && util.trigger(prev, "beforeitemhide", [this]);
|
|
368
|
+
util.trigger(next, "beforeitemshow", [this]);
|
|
2652
369
|
}
|
|
2653
370
|
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
|
|
2654
371
|
if (changed) {
|
|
2655
|
-
!edge &&
|
|
2656
|
-
|
|
372
|
+
!edge && util.trigger(prev, "itemhide", [this]);
|
|
373
|
+
util.trigger(next, "itemshow", [this]);
|
|
2657
374
|
}
|
|
2658
375
|
},
|
|
2659
376
|
end() {
|
|
2660
|
-
|
|
2661
|
-
|
|
377
|
+
util.off(document, pointerMove, this.move, pointerOptions);
|
|
378
|
+
util.off(document, pointerUp, this.end, pointerUpOptions);
|
|
2662
379
|
if (this.dragging) {
|
|
2663
380
|
this.dragging = null;
|
|
2664
381
|
if (this.index === this.prevIndex) {
|
|
@@ -2667,7 +384,7 @@
|
|
|
2667
384
|
this._show(false, this.index, true);
|
|
2668
385
|
this._transitioner = null;
|
|
2669
386
|
} else {
|
|
2670
|
-
const dirChange = (
|
|
387
|
+
const dirChange = (util.isRtl ? this.dir * (util.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
|
|
2671
388
|
this.index = dirChange ? this.index : this.prevIndex;
|
|
2672
389
|
if (dirChange) {
|
|
2673
390
|
this.percent = 1 - this.percent;
|
|
@@ -2678,13 +395,13 @@
|
|
|
2678
395
|
);
|
|
2679
396
|
}
|
|
2680
397
|
}
|
|
2681
|
-
|
|
398
|
+
util.css(this.list, { userSelect: "", pointerEvents: "" });
|
|
2682
399
|
this.drag = this.percent = null;
|
|
2683
400
|
}
|
|
2684
401
|
}
|
|
2685
402
|
};
|
|
2686
403
|
function hasSelectableText(el) {
|
|
2687
|
-
return
|
|
404
|
+
return util.css(el, "userSelect") !== "none" && util.toNodes(el.childNodes).some((el2) => el2.nodeType === 3 && el2.textContent.trim());
|
|
2688
405
|
}
|
|
2689
406
|
|
|
2690
407
|
var SliderAutoplay = {
|
|
@@ -2699,14 +416,14 @@
|
|
|
2699
416
|
pauseOnHover: true
|
|
2700
417
|
},
|
|
2701
418
|
connected() {
|
|
2702
|
-
|
|
419
|
+
util.attr(this.list, "aria-live", this.autoplay ? "off" : "polite");
|
|
2703
420
|
this.autoplay && this.startAutoplay();
|
|
2704
421
|
},
|
|
2705
422
|
disconnected() {
|
|
2706
423
|
this.stopAutoplay();
|
|
2707
424
|
},
|
|
2708
425
|
update() {
|
|
2709
|
-
|
|
426
|
+
util.attr(this.slides, "tabindex", "-1");
|
|
2710
427
|
},
|
|
2711
428
|
events: [
|
|
2712
429
|
{
|
|
@@ -2724,45 +441,19 @@
|
|
|
2724
441
|
this.startAutoplay();
|
|
2725
442
|
}
|
|
2726
443
|
}
|
|
2727
|
-
},
|
|
2728
|
-
{
|
|
2729
|
-
name: `${uikitUtil.pointerEnter} focusin`,
|
|
2730
|
-
filter() {
|
|
2731
|
-
return this.autoplay;
|
|
2732
|
-
},
|
|
2733
|
-
handler(e) {
|
|
2734
|
-
if (e.type !== uikitUtil.pointerEnter || this.pauseOnHover) {
|
|
2735
|
-
this.stopAutoplay();
|
|
2736
|
-
}
|
|
2737
|
-
}
|
|
2738
|
-
},
|
|
2739
|
-
{
|
|
2740
|
-
name: `${uikitUtil.pointerLeave} focusout`,
|
|
2741
|
-
filter() {
|
|
2742
|
-
return this.autoplay;
|
|
2743
|
-
},
|
|
2744
|
-
handler(e) {
|
|
2745
|
-
if (e.type !== uikitUtil.pointerLeave || this.pauseOnHover) {
|
|
2746
|
-
this.startAutoplay();
|
|
2747
|
-
}
|
|
2748
|
-
}
|
|
2749
444
|
}
|
|
2750
445
|
],
|
|
2751
446
|
methods: {
|
|
2752
447
|
startAutoplay() {
|
|
2753
|
-
if (this.draggable && uikitUtil.matches(this.$el, ":focus-within") || this.pauseOnHover && uikitUtil.matches(this.$el, ":hover")) {
|
|
2754
|
-
return;
|
|
2755
|
-
}
|
|
2756
448
|
this.stopAutoplay();
|
|
2757
|
-
this.interval = setInterval(
|
|
2758
|
-
(
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
449
|
+
this.interval = setInterval(() => {
|
|
450
|
+
if (!(this.stack.length || this.draggable && util.matches(this.$el, ":focus-within") || this.pauseOnHover && util.matches(this.$el, ":hover"))) {
|
|
451
|
+
this.show("next");
|
|
452
|
+
}
|
|
453
|
+
}, this.autoplayInterval);
|
|
2762
454
|
},
|
|
2763
455
|
stopAutoplay() {
|
|
2764
456
|
clearInterval(this.interval);
|
|
2765
|
-
uikitUtil.attr(this.list, "aria-live", "polite");
|
|
2766
457
|
}
|
|
2767
458
|
}
|
|
2768
459
|
};
|
|
@@ -2795,21 +486,21 @@
|
|
|
2795
486
|
this.stack = [];
|
|
2796
487
|
},
|
|
2797
488
|
disconnected() {
|
|
2798
|
-
|
|
489
|
+
util.removeClass(this.slides, this.clsActive);
|
|
2799
490
|
},
|
|
2800
491
|
computed: {
|
|
2801
492
|
duration({ velocity }, $el) {
|
|
2802
493
|
return speedUp($el.offsetWidth / velocity);
|
|
2803
494
|
},
|
|
2804
495
|
list({ selList }, $el) {
|
|
2805
|
-
return
|
|
496
|
+
return util.$(selList, $el);
|
|
2806
497
|
},
|
|
2807
498
|
maxIndex() {
|
|
2808
499
|
return this.length - 1;
|
|
2809
500
|
},
|
|
2810
501
|
slides: {
|
|
2811
502
|
get() {
|
|
2812
|
-
return
|
|
503
|
+
return util.children(this.list);
|
|
2813
504
|
},
|
|
2814
505
|
watch() {
|
|
2815
506
|
this.$emit();
|
|
@@ -2842,7 +533,7 @@
|
|
|
2842
533
|
return;
|
|
2843
534
|
}
|
|
2844
535
|
const prevIndex = this.getIndex(this.index);
|
|
2845
|
-
const prev =
|
|
536
|
+
const prev = util.hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
|
|
2846
537
|
const nextIndex = this.getIndex(index, this.index);
|
|
2847
538
|
const next = this.slides[nextIndex];
|
|
2848
539
|
if (prev === next) {
|
|
@@ -2852,25 +543,25 @@
|
|
|
2852
543
|
this.dir = getDirection(index, prevIndex);
|
|
2853
544
|
this.prevIndex = prevIndex;
|
|
2854
545
|
this.index = nextIndex;
|
|
2855
|
-
if (prev && !
|
|
546
|
+
if (prev && !util.trigger(prev, "beforeitemhide", [this]) || !util.trigger(next, "beforeitemshow", [this, prev])) {
|
|
2856
547
|
this.index = this.prevIndex;
|
|
2857
548
|
reset();
|
|
2858
549
|
return;
|
|
2859
550
|
}
|
|
2860
551
|
const promise = this._show(prev, next, force).then(() => {
|
|
2861
|
-
prev &&
|
|
2862
|
-
|
|
552
|
+
prev && util.trigger(prev, "itemhidden", [this]);
|
|
553
|
+
util.trigger(next, "itemshown", [this]);
|
|
2863
554
|
stack.shift();
|
|
2864
555
|
this._transitioner = null;
|
|
2865
556
|
requestAnimationFrame(() => stack.length && this.show(stack.shift(), true));
|
|
2866
557
|
});
|
|
2867
|
-
prev &&
|
|
2868
|
-
|
|
558
|
+
prev && util.trigger(prev, "itemhide", [this]);
|
|
559
|
+
util.trigger(next, "itemshow", [this]);
|
|
2869
560
|
return promise;
|
|
2870
561
|
},
|
|
2871
562
|
getIndex(index = this.index, prev = this.index) {
|
|
2872
|
-
return
|
|
2873
|
-
|
|
563
|
+
return util.clamp(
|
|
564
|
+
util.getIndex(index, this.slides, prev, this.finite),
|
|
2874
565
|
0,
|
|
2875
566
|
Math.max(0, this.maxIndex)
|
|
2876
567
|
);
|
|
@@ -2903,9 +594,9 @@
|
|
|
2903
594
|
},
|
|
2904
595
|
_getTransitioner(prev = this.prevIndex, next = this.index, dir = this.dir || 1, options = this.transitionOptions) {
|
|
2905
596
|
return new this.Transitioner(
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
dir * (
|
|
597
|
+
util.isNumber(prev) ? this.slides[prev] : prev,
|
|
598
|
+
util.isNumber(next) ? this.slides[next] : next,
|
|
599
|
+
dir * (util.isRtl ? -1 : 1),
|
|
2909
600
|
options
|
|
2910
601
|
);
|
|
2911
602
|
}
|
|
@@ -2948,16 +639,16 @@
|
|
|
2948
639
|
}
|
|
2949
640
|
|
|
2950
641
|
function Transitioner(prev, next, dir, { center, easing, list }) {
|
|
2951
|
-
const deferred = new
|
|
2952
|
-
const from = prev ? getLeft(prev, list, center) : getLeft(next, list, center) +
|
|
2953
|
-
const to = next ? getLeft(next, list, center) : from +
|
|
642
|
+
const deferred = new util.Deferred();
|
|
643
|
+
const from = prev ? getLeft(prev, list, center) : getLeft(next, list, center) + util.dimensions(next).width * dir;
|
|
644
|
+
const to = next ? getLeft(next, list, center) : from + util.dimensions(prev).width * dir * (util.isRtl ? -1 : 1);
|
|
2954
645
|
return {
|
|
2955
646
|
dir,
|
|
2956
647
|
show(duration, percent = 0, linear) {
|
|
2957
648
|
const timing = linear ? "linear" : easing;
|
|
2958
|
-
duration -= Math.round(duration *
|
|
649
|
+
duration -= Math.round(duration * util.clamp(percent, -1, 1));
|
|
2959
650
|
this.translate(percent);
|
|
2960
|
-
percent = prev ? percent :
|
|
651
|
+
percent = prev ? percent : util.clamp(percent, 0, 1);
|
|
2961
652
|
triggerUpdate(this.getItemIn(), "itemin", { percent, duration, timing, dir });
|
|
2962
653
|
prev && triggerUpdate(this.getItemIn(true), "itemout", {
|
|
2963
654
|
percent: 1 - percent,
|
|
@@ -2965,47 +656,47 @@
|
|
|
2965
656
|
timing,
|
|
2966
657
|
dir
|
|
2967
658
|
});
|
|
2968
|
-
|
|
659
|
+
util.Transition.start(
|
|
2969
660
|
list,
|
|
2970
|
-
{ transform: translate(-to * (
|
|
661
|
+
{ transform: translate(-to * (util.isRtl ? -1 : 1), "px") },
|
|
2971
662
|
duration,
|
|
2972
663
|
timing
|
|
2973
|
-
).then(deferred.resolve,
|
|
664
|
+
).then(deferred.resolve, util.noop);
|
|
2974
665
|
return deferred.promise;
|
|
2975
666
|
},
|
|
2976
667
|
cancel() {
|
|
2977
|
-
|
|
668
|
+
util.Transition.cancel(list);
|
|
2978
669
|
},
|
|
2979
670
|
reset() {
|
|
2980
|
-
|
|
671
|
+
util.css(list, "transform", "");
|
|
2981
672
|
},
|
|
2982
673
|
forward(duration, percent = this.percent()) {
|
|
2983
|
-
|
|
674
|
+
util.Transition.cancel(list);
|
|
2984
675
|
return this.show(duration, percent, true);
|
|
2985
676
|
},
|
|
2986
677
|
translate(percent) {
|
|
2987
|
-
const distance = this.getDistance() * dir * (
|
|
2988
|
-
|
|
678
|
+
const distance = this.getDistance() * dir * (util.isRtl ? -1 : 1);
|
|
679
|
+
util.css(
|
|
2989
680
|
list,
|
|
2990
681
|
"transform",
|
|
2991
682
|
translate(
|
|
2992
|
-
|
|
683
|
+
util.clamp(
|
|
2993
684
|
-to + (distance - distance * percent),
|
|
2994
685
|
-getWidth(list),
|
|
2995
|
-
|
|
2996
|
-
) * (
|
|
686
|
+
util.dimensions(list).width
|
|
687
|
+
) * (util.isRtl ? -1 : 1),
|
|
2997
688
|
"px"
|
|
2998
689
|
)
|
|
2999
690
|
);
|
|
3000
691
|
const actives = this.getActives();
|
|
3001
692
|
const itemIn = this.getItemIn();
|
|
3002
693
|
const itemOut = this.getItemIn(true);
|
|
3003
|
-
percent = prev ?
|
|
3004
|
-
for (const slide of
|
|
3005
|
-
const isActive =
|
|
694
|
+
percent = prev ? util.clamp(percent, -1, 1) : 0;
|
|
695
|
+
for (const slide of util.children(list)) {
|
|
696
|
+
const isActive = util.includes(actives, slide);
|
|
3006
697
|
const isIn = slide === itemIn;
|
|
3007
698
|
const isOut = slide === itemOut;
|
|
3008
|
-
const translateIn = isIn || !isOut && (isActive || dir * (
|
|
699
|
+
const translateIn = isIn || !isOut && (isActive || dir * (util.isRtl ? -1 : 1) === -1 ^ getElLeft(slide, list) > getElLeft(prev || next));
|
|
3009
700
|
triggerUpdate(slide, `itemtranslate${translateIn ? "in" : "out"}`, {
|
|
3010
701
|
dir,
|
|
3011
702
|
percent: isOut ? 1 - percent : isIn ? percent : isActive ? 1 : 0
|
|
@@ -3014,7 +705,7 @@
|
|
|
3014
705
|
},
|
|
3015
706
|
percent() {
|
|
3016
707
|
return Math.abs(
|
|
3017
|
-
(
|
|
708
|
+
(util.css(list, "transform").split(",")[4] * (util.isRtl ? -1 : 1) + from) / (to - from)
|
|
3018
709
|
);
|
|
3019
710
|
},
|
|
3020
711
|
getDistance() {
|
|
@@ -3028,7 +719,7 @@
|
|
|
3028
719
|
actives = nextActives;
|
|
3029
720
|
nextActives = temp;
|
|
3030
721
|
}
|
|
3031
|
-
return nextActives[
|
|
722
|
+
return nextActives[util.findIndex(nextActives, (el) => !util.includes(actives, el))];
|
|
3032
723
|
},
|
|
3033
724
|
getActives() {
|
|
3034
725
|
return inView(list, getLeft(prev || next, list, center));
|
|
@@ -3040,29 +731,29 @@
|
|
|
3040
731
|
return center ? left - centerEl(el, list) : Math.min(left, getMax(list));
|
|
3041
732
|
}
|
|
3042
733
|
function getMax(list) {
|
|
3043
|
-
return Math.max(0, getWidth(list) -
|
|
734
|
+
return Math.max(0, getWidth(list) - util.dimensions(list).width);
|
|
3044
735
|
}
|
|
3045
736
|
function getWidth(list) {
|
|
3046
|
-
return
|
|
737
|
+
return util.sumBy(util.children(list), (el) => util.dimensions(el).width);
|
|
3047
738
|
}
|
|
3048
739
|
function centerEl(el, list) {
|
|
3049
|
-
return
|
|
740
|
+
return util.dimensions(list).width / 2 - util.dimensions(el).width / 2;
|
|
3050
741
|
}
|
|
3051
742
|
function getElLeft(el, list) {
|
|
3052
|
-
return el && (
|
|
743
|
+
return el && (util.position(el).left + (util.isRtl ? util.dimensions(el).width - util.dimensions(list).width : 0)) * (util.isRtl ? -1 : 1) || 0;
|
|
3053
744
|
}
|
|
3054
745
|
function inView(list, listLeft) {
|
|
3055
746
|
listLeft -= 1;
|
|
3056
|
-
const listWidth =
|
|
747
|
+
const listWidth = util.dimensions(list).width;
|
|
3057
748
|
const listRight = listLeft + listWidth + 2;
|
|
3058
|
-
return
|
|
749
|
+
return util.children(list).filter((slide) => {
|
|
3059
750
|
const slideLeft = getElLeft(slide, list);
|
|
3060
|
-
const slideRight = slideLeft + Math.min(
|
|
751
|
+
const slideRight = slideLeft + Math.min(util.dimensions(slide).width, listWidth);
|
|
3061
752
|
return slideLeft >= listLeft && slideRight <= listRight;
|
|
3062
753
|
});
|
|
3063
754
|
}
|
|
3064
755
|
function triggerUpdate(el, type, data) {
|
|
3065
|
-
|
|
756
|
+
util.trigger(el, util.createEvent(type, false, false, data));
|
|
3066
757
|
}
|
|
3067
758
|
|
|
3068
759
|
var Component = {
|
|
@@ -3092,15 +783,15 @@
|
|
|
3092
783
|
return this.length - 1;
|
|
3093
784
|
}
|
|
3094
785
|
if (this.center) {
|
|
3095
|
-
return
|
|
786
|
+
return util.last(this.sets);
|
|
3096
787
|
}
|
|
3097
788
|
let lft = 0;
|
|
3098
789
|
const max = getMax(this.list);
|
|
3099
|
-
const index =
|
|
790
|
+
const index = util.findIndex(this.slides, (el) => {
|
|
3100
791
|
if (lft >= max) {
|
|
3101
792
|
return true;
|
|
3102
793
|
}
|
|
3103
|
-
lft +=
|
|
794
|
+
lft += util.dimensions(el).width;
|
|
3104
795
|
});
|
|
3105
796
|
return ~index ? index : this.length - 1;
|
|
3106
797
|
},
|
|
@@ -3110,14 +801,14 @@
|
|
|
3110
801
|
}
|
|
3111
802
|
let left = 0;
|
|
3112
803
|
const sets = [];
|
|
3113
|
-
const width =
|
|
804
|
+
const width = util.dimensions(this.list).width;
|
|
3114
805
|
for (let i = 0; i < this.length; i++) {
|
|
3115
|
-
const slideWidth =
|
|
806
|
+
const slideWidth = util.dimensions(this.slides[i]).width;
|
|
3116
807
|
if (left + slideWidth > width) {
|
|
3117
808
|
left = 0;
|
|
3118
809
|
}
|
|
3119
810
|
if (this.center) {
|
|
3120
|
-
if (left < width / 2 && left + slideWidth +
|
|
811
|
+
if (left < width / 2 && left + slideWidth + util.dimensions(this.slides[+i + 1]).width / 2 > width / 2) {
|
|
3121
812
|
sets.push(+i);
|
|
3122
813
|
left = width / 2 - slideWidth / 2;
|
|
3123
814
|
}
|
|
@@ -3137,11 +828,11 @@
|
|
|
3137
828
|
};
|
|
3138
829
|
},
|
|
3139
830
|
slides() {
|
|
3140
|
-
return
|
|
831
|
+
return util.children(this.list).filter(util.isVisible);
|
|
3141
832
|
}
|
|
3142
833
|
},
|
|
3143
834
|
connected() {
|
|
3144
|
-
|
|
835
|
+
util.toggleClass(this.$el, this.clsContainer, !util.$(`.${this.clsContainer}`, this.$el));
|
|
3145
836
|
},
|
|
3146
837
|
observe: resize({
|
|
3147
838
|
target: ({ slides }) => slides
|
|
@@ -3149,9 +840,9 @@
|
|
|
3149
840
|
update: {
|
|
3150
841
|
write() {
|
|
3151
842
|
for (const el of this.navItems) {
|
|
3152
|
-
const index =
|
|
843
|
+
const index = util.toNumber(util.data(el, this.attrItem));
|
|
3153
844
|
if (index !== false) {
|
|
3154
|
-
el.hidden = !this.maxIndex || index > this.maxIndex || this.sets && !
|
|
845
|
+
el.hidden = !this.maxIndex || index > this.maxIndex || this.sets && !util.includes(this.sets, index);
|
|
3155
846
|
}
|
|
3156
847
|
}
|
|
3157
848
|
if (this.length && !this.dragging && !this.stack.length) {
|
|
@@ -3164,7 +855,7 @@
|
|
|
3164
855
|
},
|
|
3165
856
|
events: {
|
|
3166
857
|
beforeitemshow(e) {
|
|
3167
|
-
if (!this.dragging && this.sets && this.stack.length < 2 && !
|
|
858
|
+
if (!this.dragging && this.sets && this.stack.length < 2 && !util.includes(this.sets, this.index)) {
|
|
3168
859
|
this.index = this.getValidIndex();
|
|
3169
860
|
}
|
|
3170
861
|
const diff = Math.abs(
|
|
@@ -3178,12 +869,12 @@
|
|
|
3178
869
|
return;
|
|
3179
870
|
}
|
|
3180
871
|
const index = this.dir < 0 || !this.slides[this.prevIndex] ? this.index : this.prevIndex;
|
|
3181
|
-
this.duration = speedUp(this.avgWidth / this.velocity) * (
|
|
872
|
+
this.duration = speedUp(this.avgWidth / this.velocity) * (util.dimensions(this.slides[index]).width / this.avgWidth);
|
|
3182
873
|
this.reorder();
|
|
3183
874
|
},
|
|
3184
875
|
itemshow() {
|
|
3185
876
|
if (~this.prevIndex) {
|
|
3186
|
-
|
|
877
|
+
util.addClass(this._getTransitioner().getItemIn(), this.clsActive);
|
|
3187
878
|
}
|
|
3188
879
|
},
|
|
3189
880
|
itemshown() {
|
|
@@ -3193,12 +884,12 @@
|
|
|
3193
884
|
methods: {
|
|
3194
885
|
reorder() {
|
|
3195
886
|
if (this.finite) {
|
|
3196
|
-
|
|
887
|
+
util.css(this.slides, "order", "");
|
|
3197
888
|
return;
|
|
3198
889
|
}
|
|
3199
890
|
const index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
|
|
3200
891
|
this.slides.forEach(
|
|
3201
|
-
(slide, i) =>
|
|
892
|
+
(slide, i) => util.css(
|
|
3202
893
|
slide,
|
|
3203
894
|
"order",
|
|
3204
895
|
this.dir > 0 && i < index ? 1 : this.dir < 0 && i >= this.index ? -1 : ""
|
|
@@ -3208,26 +899,26 @@
|
|
|
3208
899
|
return;
|
|
3209
900
|
}
|
|
3210
901
|
const next = this.slides[index];
|
|
3211
|
-
let width =
|
|
902
|
+
let width = util.dimensions(this.list).width / 2 - util.dimensions(next).width / 2;
|
|
3212
903
|
let j = 0;
|
|
3213
904
|
while (width > 0) {
|
|
3214
905
|
const slideIndex = this.getIndex(--j + index, index);
|
|
3215
906
|
const slide = this.slides[slideIndex];
|
|
3216
|
-
|
|
3217
|
-
width -=
|
|
907
|
+
util.css(slide, "order", slideIndex > index ? -2 : -1);
|
|
908
|
+
width -= util.dimensions(slide).width;
|
|
3218
909
|
}
|
|
3219
910
|
},
|
|
3220
911
|
updateActiveClasses() {
|
|
3221
912
|
const actives = this._getTransitioner(this.index).getActives();
|
|
3222
913
|
const activeClasses = [
|
|
3223
914
|
this.clsActive,
|
|
3224
|
-
(!this.sets ||
|
|
915
|
+
(!this.sets || util.includes(this.sets, util.toFloat(this.index))) && this.clsActivated || ""
|
|
3225
916
|
];
|
|
3226
917
|
for (const slide of this.slides) {
|
|
3227
|
-
const active =
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
918
|
+
const active = util.includes(actives, slide);
|
|
919
|
+
util.toggleClass(slide, activeClasses, active);
|
|
920
|
+
util.attr(slide, "aria-hidden", !active);
|
|
921
|
+
util.attr(util.$$(util.selFocusable, slide), "tabindex", active ? null : -1);
|
|
3231
922
|
}
|
|
3232
923
|
},
|
|
3233
924
|
getValidIndex(index = this.index, prevIndex = this.prevIndex) {
|
|
@@ -3237,7 +928,7 @@
|
|
|
3237
928
|
}
|
|
3238
929
|
let prev;
|
|
3239
930
|
do {
|
|
3240
|
-
if (
|
|
931
|
+
if (util.includes(this.sets, index)) {
|
|
3241
932
|
return index;
|
|
3242
933
|
}
|
|
3243
934
|
prev = index;
|
|
@@ -3246,10 +937,10 @@
|
|
|
3246
937
|
return index;
|
|
3247
938
|
},
|
|
3248
939
|
getAdjacentSlides() {
|
|
3249
|
-
const { width } =
|
|
940
|
+
const { width } = util.dimensions(this.list);
|
|
3250
941
|
const left = -width;
|
|
3251
942
|
const right = width * 2;
|
|
3252
|
-
const slideWidth =
|
|
943
|
+
const slideWidth = util.dimensions(this.slides[this.index]).width;
|
|
3253
944
|
const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
|
|
3254
945
|
const slides = /* @__PURE__ */ new Set();
|
|
3255
946
|
for (const i of [-1, 1]) {
|
|
@@ -3257,7 +948,7 @@
|
|
|
3257
948
|
let j = 0;
|
|
3258
949
|
do {
|
|
3259
950
|
const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
|
|
3260
|
-
currentLeft +=
|
|
951
|
+
currentLeft += util.dimensions(slide).width * i;
|
|
3261
952
|
slides.add(slide);
|
|
3262
953
|
} while (this.length > j && currentLeft > left && currentLeft < right);
|
|
3263
954
|
}
|
|
@@ -3269,36 +960,36 @@
|
|
|
3269
960
|
if (!list || list.length < 2) {
|
|
3270
961
|
return true;
|
|
3271
962
|
}
|
|
3272
|
-
const { width: listWidth } =
|
|
963
|
+
const { width: listWidth } = util.dimensions(list);
|
|
3273
964
|
if (!center) {
|
|
3274
965
|
return Math.ceil(getWidth(list)) < Math.trunc(listWidth + getMaxElWidth(list));
|
|
3275
966
|
}
|
|
3276
|
-
const slides =
|
|
967
|
+
const slides = util.children(list);
|
|
3277
968
|
const listHalf = Math.trunc(listWidth / 2);
|
|
3278
969
|
for (const index in slides) {
|
|
3279
970
|
const slide = slides[index];
|
|
3280
|
-
const slideWidth =
|
|
971
|
+
const slideWidth = util.dimensions(slide).width;
|
|
3281
972
|
const slidesInView = /* @__PURE__ */ new Set([slide]);
|
|
3282
973
|
let diff = 0;
|
|
3283
974
|
for (const i of [-1, 1]) {
|
|
3284
975
|
let left = slideWidth / 2;
|
|
3285
976
|
let j = 0;
|
|
3286
977
|
while (left < listHalf) {
|
|
3287
|
-
const nextSlide = slides[
|
|
978
|
+
const nextSlide = slides[util.getIndex(+index + i + j++ * i, slides)];
|
|
3288
979
|
if (slidesInView.has(nextSlide)) {
|
|
3289
980
|
return true;
|
|
3290
981
|
}
|
|
3291
|
-
left +=
|
|
982
|
+
left += util.dimensions(nextSlide).width;
|
|
3292
983
|
slidesInView.add(nextSlide);
|
|
3293
984
|
}
|
|
3294
985
|
diff = Math.max(
|
|
3295
986
|
diff,
|
|
3296
|
-
slideWidth / 2 +
|
|
987
|
+
slideWidth / 2 + util.dimensions(slides[util.getIndex(+index + i, slides)]).width / 2 - (left - listHalf)
|
|
3297
988
|
);
|
|
3298
989
|
}
|
|
3299
|
-
if (diff >
|
|
990
|
+
if (diff > util.sumBy(
|
|
3300
991
|
slides.filter((slide2) => !slidesInView.has(slide2)),
|
|
3301
|
-
(slide2) =>
|
|
992
|
+
(slide2) => util.dimensions(slide2).width
|
|
3302
993
|
)) {
|
|
3303
994
|
return true;
|
|
3304
995
|
}
|
|
@@ -3306,7 +997,7 @@
|
|
|
3306
997
|
return false;
|
|
3307
998
|
}
|
|
3308
999
|
function getMaxElWidth(list) {
|
|
3309
|
-
return Math.max(0, ...
|
|
1000
|
+
return Math.max(0, ...util.children(list).map((el) => util.dimensions(el).width));
|
|
3310
1001
|
}
|
|
3311
1002
|
|
|
3312
1003
|
if (typeof window !== "undefined" && window.UIkit) {
|