uikit 3.16.6 → 3.16.7-dev.fcb5a4616
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 +6 -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 +194 -1996
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +205 -1993
- 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 +143 -2429
- 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 +97 -2383
- 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 +85 -78
- 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 +85 -78
- 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/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.fcb5a4616 | 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,32 @@
|
|
|
2406
120
|
}
|
|
2407
121
|
},
|
|
2408
122
|
connected() {
|
|
2409
|
-
|
|
123
|
+
util.attr(this.$el, "aria-roledescription", "carousel");
|
|
2410
124
|
},
|
|
2411
125
|
update: [
|
|
2412
126
|
{
|
|
2413
127
|
write() {
|
|
2414
128
|
this.slides.forEach(
|
|
2415
|
-
(slide, i) =>
|
|
129
|
+
(slide, i) => util.attr(slide, {
|
|
2416
130
|
role: this.nav ? "tabpanel" : "group",
|
|
2417
131
|
"aria-label": this.t("slideLabel", i + 1, this.length),
|
|
2418
132
|
"aria-roledescription": this.nav ? null : "slide"
|
|
2419
133
|
})
|
|
2420
134
|
);
|
|
2421
135
|
if (this.nav && this.length !== this.nav.children.length) {
|
|
2422
|
-
|
|
136
|
+
util.html(
|
|
2423
137
|
this.nav,
|
|
2424
138
|
this.slides.map((_, i) => `<li ${this.attrItem}="${i}"><a href></a></li>`).join("")
|
|
2425
139
|
);
|
|
2426
140
|
}
|
|
2427
|
-
|
|
141
|
+
util.attr(util.children(this.nav).concat(this.list), "role", "presentation");
|
|
2428
142
|
for (const el of this.navItems) {
|
|
2429
|
-
const cmd =
|
|
2430
|
-
const button =
|
|
143
|
+
const cmd = util.data(el, this.attrItem);
|
|
144
|
+
const button = util.$("a,button", el) || el;
|
|
2431
145
|
let ariaLabel;
|
|
2432
146
|
let ariaControls = null;
|
|
2433
|
-
if (
|
|
2434
|
-
const item =
|
|
147
|
+
if (util.isNumeric(cmd)) {
|
|
148
|
+
const item = util.toNumber(cmd);
|
|
2435
149
|
const slide = this.slides[item];
|
|
2436
150
|
if (slide) {
|
|
2437
151
|
if (!slide.id) {
|
|
@@ -2439,8 +153,8 @@
|
|
|
2439
153
|
}
|
|
2440
154
|
ariaControls = slide.id;
|
|
2441
155
|
}
|
|
2442
|
-
ariaLabel = this.t("slideX",
|
|
2443
|
-
|
|
156
|
+
ariaLabel = this.t("slideX", util.toFloat(cmd) + 1);
|
|
157
|
+
util.attr(button, "role", "tab");
|
|
2444
158
|
} else {
|
|
2445
159
|
if (this.list) {
|
|
2446
160
|
if (!this.list.id) {
|
|
@@ -2450,9 +164,9 @@
|
|
|
2450
164
|
}
|
|
2451
165
|
ariaLabel = this.t(cmd);
|
|
2452
166
|
}
|
|
2453
|
-
|
|
167
|
+
util.attr(button, {
|
|
2454
168
|
"aria-controls": ariaControls,
|
|
2455
|
-
"aria-label":
|
|
169
|
+
"aria-label": util.attr(button, "aria-label") || ariaLabel
|
|
2456
170
|
});
|
|
2457
171
|
}
|
|
2458
172
|
}
|
|
@@ -2472,9 +186,9 @@
|
|
|
2472
186
|
return this.selNavItem;
|
|
2473
187
|
},
|
|
2474
188
|
handler(e) {
|
|
2475
|
-
if (
|
|
189
|
+
if (util.closest(e.target, "a,button") && (e.type === "click" || e.keyCode === keyMap.SPACE)) {
|
|
2476
190
|
e.preventDefault();
|
|
2477
|
-
this.show(
|
|
191
|
+
this.show(util.data(e.current, this.attrItem));
|
|
2478
192
|
}
|
|
2479
193
|
}
|
|
2480
194
|
},
|
|
@@ -2489,8 +203,8 @@
|
|
|
2489
203
|
},
|
|
2490
204
|
handler(e) {
|
|
2491
205
|
const { current, keyCode } = e;
|
|
2492
|
-
const cmd =
|
|
2493
|
-
if (!
|
|
206
|
+
const cmd = util.data(current, this.attrItem);
|
|
207
|
+
if (!util.isNumeric(cmd)) {
|
|
2494
208
|
return;
|
|
2495
209
|
}
|
|
2496
210
|
let i = keyCode === keyMap.HOME ? 0 : keyCode === keyMap.END ? "last" : keyCode === keyMap.LEFT ? "previous" : keyCode === keyMap.RIGHT ? "next" : -1;
|
|
@@ -2507,22 +221,22 @@
|
|
|
2507
221
|
let focus;
|
|
2508
222
|
let focusEl;
|
|
2509
223
|
for (const el of this.navItems) {
|
|
2510
|
-
const cmd =
|
|
2511
|
-
const button =
|
|
2512
|
-
if (
|
|
2513
|
-
const item =
|
|
224
|
+
const cmd = util.data(el, this.attrItem);
|
|
225
|
+
const button = util.$("a,button", el) || el;
|
|
226
|
+
if (util.isNumeric(cmd)) {
|
|
227
|
+
const item = util.toNumber(cmd);
|
|
2514
228
|
const active = item === index;
|
|
2515
|
-
|
|
2516
|
-
|
|
229
|
+
util.toggleClass(el, this.clsActive, active);
|
|
230
|
+
util.attr(button, {
|
|
2517
231
|
"aria-selected": active,
|
|
2518
232
|
tabindex: active ? null : -1
|
|
2519
233
|
});
|
|
2520
234
|
if (active) {
|
|
2521
235
|
focusEl = button;
|
|
2522
236
|
}
|
|
2523
|
-
focus = focus ||
|
|
237
|
+
focus = focus || util.matches(button, ":focus");
|
|
2524
238
|
} else {
|
|
2525
|
-
|
|
239
|
+
util.toggleClass(
|
|
2526
240
|
el,
|
|
2527
241
|
"uk-invisible",
|
|
2528
242
|
this.finite && (cmd === "previous" && index === 0 || cmd === "next" && index >= this.maxIndex)
|
|
@@ -2553,7 +267,7 @@
|
|
|
2553
267
|
for (const key of ["start", "move", "end"]) {
|
|
2554
268
|
const fn = this[key];
|
|
2555
269
|
this[key] = (e) => {
|
|
2556
|
-
const pos =
|
|
270
|
+
const pos = util.getEventPos(e).x * (util.isRtl ? -1 : 1);
|
|
2557
271
|
this.prevPos = pos === this.pos ? this.prevPos : this.pos;
|
|
2558
272
|
this.pos = pos;
|
|
2559
273
|
fn(e);
|
|
@@ -2568,7 +282,7 @@
|
|
|
2568
282
|
return `${this.selList} > *`;
|
|
2569
283
|
},
|
|
2570
284
|
handler(e) {
|
|
2571
|
-
if (!this.draggable || !
|
|
285
|
+
if (!this.draggable || !util.isTouch(e) && hasSelectableText(e.target) || util.closest(e.target, util.selInput) || e.button > 0 || this.length < 2) {
|
|
2572
286
|
return;
|
|
2573
287
|
}
|
|
2574
288
|
this.start(e);
|
|
@@ -2586,7 +300,7 @@
|
|
|
2586
300
|
el() {
|
|
2587
301
|
return this.list;
|
|
2588
302
|
},
|
|
2589
|
-
handler:
|
|
303
|
+
handler: util.noop,
|
|
2590
304
|
...pointerOptions
|
|
2591
305
|
}
|
|
2592
306
|
],
|
|
@@ -2603,16 +317,16 @@
|
|
|
2603
317
|
} else {
|
|
2604
318
|
this.prevIndex = this.index;
|
|
2605
319
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
320
|
+
util.on(document, pointerMove, this.move, pointerOptions);
|
|
321
|
+
util.on(document, pointerUp, this.end, pointerUpOptions);
|
|
322
|
+
util.css(this.list, "userSelect", "none");
|
|
2609
323
|
},
|
|
2610
324
|
move(e) {
|
|
2611
325
|
const distance = this.pos - this.drag;
|
|
2612
326
|
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
|
|
2613
327
|
return;
|
|
2614
328
|
}
|
|
2615
|
-
|
|
329
|
+
util.css(this.list, "pointerEvents", "none");
|
|
2616
330
|
e.cancelable && e.preventDefault();
|
|
2617
331
|
this.dragging = true;
|
|
2618
332
|
this.dir = distance < 0 ? 1 : -1;
|
|
@@ -2634,31 +348,31 @@
|
|
|
2634
348
|
const changed = this.index !== nextIndex;
|
|
2635
349
|
const edge = prevIndex === nextIndex;
|
|
2636
350
|
let itemShown;
|
|
2637
|
-
[this.index, this.prevIndex].filter((i) => !
|
|
2638
|
-
|
|
351
|
+
[this.index, this.prevIndex].filter((i) => !util.includes([nextIndex, prevIndex], i)).forEach((i) => {
|
|
352
|
+
util.trigger(slides[i], "itemhidden", [this]);
|
|
2639
353
|
if (edge) {
|
|
2640
354
|
itemShown = true;
|
|
2641
355
|
this.prevIndex = prevIndex;
|
|
2642
356
|
}
|
|
2643
357
|
});
|
|
2644
358
|
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
|
|
2645
|
-
|
|
359
|
+
util.trigger(slides[this.index], "itemshown", [this]);
|
|
2646
360
|
}
|
|
2647
361
|
if (changed) {
|
|
2648
362
|
this.prevIndex = prevIndex;
|
|
2649
363
|
this.index = nextIndex;
|
|
2650
|
-
!edge &&
|
|
2651
|
-
|
|
364
|
+
!edge && util.trigger(prev, "beforeitemhide", [this]);
|
|
365
|
+
util.trigger(next, "beforeitemshow", [this]);
|
|
2652
366
|
}
|
|
2653
367
|
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
|
|
2654
368
|
if (changed) {
|
|
2655
|
-
!edge &&
|
|
2656
|
-
|
|
369
|
+
!edge && util.trigger(prev, "itemhide", [this]);
|
|
370
|
+
util.trigger(next, "itemshow", [this]);
|
|
2657
371
|
}
|
|
2658
372
|
},
|
|
2659
373
|
end() {
|
|
2660
|
-
|
|
2661
|
-
|
|
374
|
+
util.off(document, pointerMove, this.move, pointerOptions);
|
|
375
|
+
util.off(document, pointerUp, this.end, pointerUpOptions);
|
|
2662
376
|
if (this.dragging) {
|
|
2663
377
|
this.dragging = null;
|
|
2664
378
|
if (this.index === this.prevIndex) {
|
|
@@ -2667,7 +381,7 @@
|
|
|
2667
381
|
this._show(false, this.index, true);
|
|
2668
382
|
this._transitioner = null;
|
|
2669
383
|
} else {
|
|
2670
|
-
const dirChange = (
|
|
384
|
+
const dirChange = (util.isRtl ? this.dir * (util.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
|
|
2671
385
|
this.index = dirChange ? this.index : this.prevIndex;
|
|
2672
386
|
if (dirChange) {
|
|
2673
387
|
this.percent = 1 - this.percent;
|
|
@@ -2678,13 +392,13 @@
|
|
|
2678
392
|
);
|
|
2679
393
|
}
|
|
2680
394
|
}
|
|
2681
|
-
|
|
395
|
+
util.css(this.list, { userSelect: "", pointerEvents: "" });
|
|
2682
396
|
this.drag = this.percent = null;
|
|
2683
397
|
}
|
|
2684
398
|
}
|
|
2685
399
|
};
|
|
2686
400
|
function hasSelectableText(el) {
|
|
2687
|
-
return
|
|
401
|
+
return util.css(el, "userSelect") !== "none" && util.toNodes(el.childNodes).some((el2) => el2.nodeType === 3 && el2.textContent.trim());
|
|
2688
402
|
}
|
|
2689
403
|
|
|
2690
404
|
var SliderAutoplay = {
|
|
@@ -2699,14 +413,14 @@
|
|
|
2699
413
|
pauseOnHover: true
|
|
2700
414
|
},
|
|
2701
415
|
connected() {
|
|
2702
|
-
|
|
416
|
+
util.attr(this.list, "aria-live", "polite");
|
|
2703
417
|
this.autoplay && this.startAutoplay();
|
|
2704
418
|
},
|
|
2705
419
|
disconnected() {
|
|
2706
420
|
this.stopAutoplay();
|
|
2707
421
|
},
|
|
2708
422
|
update() {
|
|
2709
|
-
|
|
423
|
+
util.attr(this.slides, "tabindex", "-1");
|
|
2710
424
|
},
|
|
2711
425
|
events: [
|
|
2712
426
|
{
|
|
@@ -2726,23 +440,23 @@
|
|
|
2726
440
|
}
|
|
2727
441
|
},
|
|
2728
442
|
{
|
|
2729
|
-
name: `${
|
|
443
|
+
name: `${util.pointerEnter} focusin`,
|
|
2730
444
|
filter() {
|
|
2731
445
|
return this.autoplay;
|
|
2732
446
|
},
|
|
2733
447
|
handler(e) {
|
|
2734
|
-
if (e.type !==
|
|
448
|
+
if (e.type !== util.pointerEnter || this.pauseOnHover) {
|
|
2735
449
|
this.stopAutoplay();
|
|
2736
450
|
}
|
|
2737
451
|
}
|
|
2738
452
|
},
|
|
2739
453
|
{
|
|
2740
|
-
name: `${
|
|
454
|
+
name: `${util.pointerLeave} focusout`,
|
|
2741
455
|
filter() {
|
|
2742
456
|
return this.autoplay;
|
|
2743
457
|
},
|
|
2744
458
|
handler(e) {
|
|
2745
|
-
if (e.type !==
|
|
459
|
+
if (e.type !== util.pointerLeave || this.pauseOnHover) {
|
|
2746
460
|
this.startAutoplay();
|
|
2747
461
|
}
|
|
2748
462
|
}
|
|
@@ -2750,7 +464,7 @@
|
|
|
2750
464
|
],
|
|
2751
465
|
methods: {
|
|
2752
466
|
startAutoplay() {
|
|
2753
|
-
if (this.draggable &&
|
|
467
|
+
if (this.draggable && util.matches(this.$el, ":focus-within") || this.pauseOnHover && util.matches(this.$el, ":hover")) {
|
|
2754
468
|
return;
|
|
2755
469
|
}
|
|
2756
470
|
this.stopAutoplay();
|
|
@@ -2758,11 +472,11 @@
|
|
|
2758
472
|
() => !this.stack.length && this.show("next"),
|
|
2759
473
|
this.autoplayInterval
|
|
2760
474
|
);
|
|
2761
|
-
|
|
475
|
+
util.attr(this.list, "aria-live", "off");
|
|
2762
476
|
},
|
|
2763
477
|
stopAutoplay() {
|
|
2764
478
|
clearInterval(this.interval);
|
|
2765
|
-
|
|
479
|
+
util.attr(this.list, "aria-live", "polite");
|
|
2766
480
|
}
|
|
2767
481
|
}
|
|
2768
482
|
};
|
|
@@ -2795,21 +509,21 @@
|
|
|
2795
509
|
this.stack = [];
|
|
2796
510
|
},
|
|
2797
511
|
disconnected() {
|
|
2798
|
-
|
|
512
|
+
util.removeClass(this.slides, this.clsActive);
|
|
2799
513
|
},
|
|
2800
514
|
computed: {
|
|
2801
515
|
duration({ velocity }, $el) {
|
|
2802
516
|
return speedUp($el.offsetWidth / velocity);
|
|
2803
517
|
},
|
|
2804
518
|
list({ selList }, $el) {
|
|
2805
|
-
return
|
|
519
|
+
return util.$(selList, $el);
|
|
2806
520
|
},
|
|
2807
521
|
maxIndex() {
|
|
2808
522
|
return this.length - 1;
|
|
2809
523
|
},
|
|
2810
524
|
slides: {
|
|
2811
525
|
get() {
|
|
2812
|
-
return
|
|
526
|
+
return util.children(this.list);
|
|
2813
527
|
},
|
|
2814
528
|
watch() {
|
|
2815
529
|
this.$emit();
|
|
@@ -2842,7 +556,7 @@
|
|
|
2842
556
|
return;
|
|
2843
557
|
}
|
|
2844
558
|
const prevIndex = this.getIndex(this.index);
|
|
2845
|
-
const prev =
|
|
559
|
+
const prev = util.hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
|
|
2846
560
|
const nextIndex = this.getIndex(index, this.index);
|
|
2847
561
|
const next = this.slides[nextIndex];
|
|
2848
562
|
if (prev === next) {
|
|
@@ -2852,25 +566,25 @@
|
|
|
2852
566
|
this.dir = getDirection(index, prevIndex);
|
|
2853
567
|
this.prevIndex = prevIndex;
|
|
2854
568
|
this.index = nextIndex;
|
|
2855
|
-
if (prev && !
|
|
569
|
+
if (prev && !util.trigger(prev, "beforeitemhide", [this]) || !util.trigger(next, "beforeitemshow", [this, prev])) {
|
|
2856
570
|
this.index = this.prevIndex;
|
|
2857
571
|
reset();
|
|
2858
572
|
return;
|
|
2859
573
|
}
|
|
2860
574
|
const promise = this._show(prev, next, force).then(() => {
|
|
2861
|
-
prev &&
|
|
2862
|
-
|
|
575
|
+
prev && util.trigger(prev, "itemhidden", [this]);
|
|
576
|
+
util.trigger(next, "itemshown", [this]);
|
|
2863
577
|
stack.shift();
|
|
2864
578
|
this._transitioner = null;
|
|
2865
579
|
requestAnimationFrame(() => stack.length && this.show(stack.shift(), true));
|
|
2866
580
|
});
|
|
2867
|
-
prev &&
|
|
2868
|
-
|
|
581
|
+
prev && util.trigger(prev, "itemhide", [this]);
|
|
582
|
+
util.trigger(next, "itemshow", [this]);
|
|
2869
583
|
return promise;
|
|
2870
584
|
},
|
|
2871
585
|
getIndex(index = this.index, prev = this.index) {
|
|
2872
|
-
return
|
|
2873
|
-
|
|
586
|
+
return util.clamp(
|
|
587
|
+
util.getIndex(index, this.slides, prev, this.finite),
|
|
2874
588
|
0,
|
|
2875
589
|
Math.max(0, this.maxIndex)
|
|
2876
590
|
);
|
|
@@ -2903,9 +617,9 @@
|
|
|
2903
617
|
},
|
|
2904
618
|
_getTransitioner(prev = this.prevIndex, next = this.index, dir = this.dir || 1, options = this.transitionOptions) {
|
|
2905
619
|
return new this.Transitioner(
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
dir * (
|
|
620
|
+
util.isNumber(prev) ? this.slides[prev] : prev,
|
|
621
|
+
util.isNumber(next) ? this.slides[next] : next,
|
|
622
|
+
dir * (util.isRtl ? -1 : 1),
|
|
2909
623
|
options
|
|
2910
624
|
);
|
|
2911
625
|
}
|
|
@@ -2948,16 +662,16 @@
|
|
|
2948
662
|
}
|
|
2949
663
|
|
|
2950
664
|
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 +
|
|
665
|
+
const deferred = new util.Deferred();
|
|
666
|
+
const from = prev ? getLeft(prev, list, center) : getLeft(next, list, center) + util.dimensions(next).width * dir;
|
|
667
|
+
const to = next ? getLeft(next, list, center) : from + util.dimensions(prev).width * dir * (util.isRtl ? -1 : 1);
|
|
2954
668
|
return {
|
|
2955
669
|
dir,
|
|
2956
670
|
show(duration, percent = 0, linear) {
|
|
2957
671
|
const timing = linear ? "linear" : easing;
|
|
2958
|
-
duration -= Math.round(duration *
|
|
672
|
+
duration -= Math.round(duration * util.clamp(percent, -1, 1));
|
|
2959
673
|
this.translate(percent);
|
|
2960
|
-
percent = prev ? percent :
|
|
674
|
+
percent = prev ? percent : util.clamp(percent, 0, 1);
|
|
2961
675
|
triggerUpdate(this.getItemIn(), "itemin", { percent, duration, timing, dir });
|
|
2962
676
|
prev && triggerUpdate(this.getItemIn(true), "itemout", {
|
|
2963
677
|
percent: 1 - percent,
|
|
@@ -2965,47 +679,47 @@
|
|
|
2965
679
|
timing,
|
|
2966
680
|
dir
|
|
2967
681
|
});
|
|
2968
|
-
|
|
682
|
+
util.Transition.start(
|
|
2969
683
|
list,
|
|
2970
|
-
{ transform: translate(-to * (
|
|
684
|
+
{ transform: translate(-to * (util.isRtl ? -1 : 1), "px") },
|
|
2971
685
|
duration,
|
|
2972
686
|
timing
|
|
2973
|
-
).then(deferred.resolve,
|
|
687
|
+
).then(deferred.resolve, util.noop);
|
|
2974
688
|
return deferred.promise;
|
|
2975
689
|
},
|
|
2976
690
|
cancel() {
|
|
2977
|
-
|
|
691
|
+
util.Transition.cancel(list);
|
|
2978
692
|
},
|
|
2979
693
|
reset() {
|
|
2980
|
-
|
|
694
|
+
util.css(list, "transform", "");
|
|
2981
695
|
},
|
|
2982
696
|
forward(duration, percent = this.percent()) {
|
|
2983
|
-
|
|
697
|
+
util.Transition.cancel(list);
|
|
2984
698
|
return this.show(duration, percent, true);
|
|
2985
699
|
},
|
|
2986
700
|
translate(percent) {
|
|
2987
|
-
const distance = this.getDistance() * dir * (
|
|
2988
|
-
|
|
701
|
+
const distance = this.getDistance() * dir * (util.isRtl ? -1 : 1);
|
|
702
|
+
util.css(
|
|
2989
703
|
list,
|
|
2990
704
|
"transform",
|
|
2991
705
|
translate(
|
|
2992
|
-
|
|
706
|
+
util.clamp(
|
|
2993
707
|
-to + (distance - distance * percent),
|
|
2994
708
|
-getWidth(list),
|
|
2995
|
-
|
|
2996
|
-
) * (
|
|
709
|
+
util.dimensions(list).width
|
|
710
|
+
) * (util.isRtl ? -1 : 1),
|
|
2997
711
|
"px"
|
|
2998
712
|
)
|
|
2999
713
|
);
|
|
3000
714
|
const actives = this.getActives();
|
|
3001
715
|
const itemIn = this.getItemIn();
|
|
3002
716
|
const itemOut = this.getItemIn(true);
|
|
3003
|
-
percent = prev ?
|
|
3004
|
-
for (const slide of
|
|
3005
|
-
const isActive =
|
|
717
|
+
percent = prev ? util.clamp(percent, -1, 1) : 0;
|
|
718
|
+
for (const slide of util.children(list)) {
|
|
719
|
+
const isActive = util.includes(actives, slide);
|
|
3006
720
|
const isIn = slide === itemIn;
|
|
3007
721
|
const isOut = slide === itemOut;
|
|
3008
|
-
const translateIn = isIn || !isOut && (isActive || dir * (
|
|
722
|
+
const translateIn = isIn || !isOut && (isActive || dir * (util.isRtl ? -1 : 1) === -1 ^ getElLeft(slide, list) > getElLeft(prev || next));
|
|
3009
723
|
triggerUpdate(slide, `itemtranslate${translateIn ? "in" : "out"}`, {
|
|
3010
724
|
dir,
|
|
3011
725
|
percent: isOut ? 1 - percent : isIn ? percent : isActive ? 1 : 0
|
|
@@ -3014,7 +728,7 @@
|
|
|
3014
728
|
},
|
|
3015
729
|
percent() {
|
|
3016
730
|
return Math.abs(
|
|
3017
|
-
(
|
|
731
|
+
(util.css(list, "transform").split(",")[4] * (util.isRtl ? -1 : 1) + from) / (to - from)
|
|
3018
732
|
);
|
|
3019
733
|
},
|
|
3020
734
|
getDistance() {
|
|
@@ -3028,7 +742,7 @@
|
|
|
3028
742
|
actives = nextActives;
|
|
3029
743
|
nextActives = temp;
|
|
3030
744
|
}
|
|
3031
|
-
return nextActives[
|
|
745
|
+
return nextActives[util.findIndex(nextActives, (el) => !util.includes(actives, el))];
|
|
3032
746
|
},
|
|
3033
747
|
getActives() {
|
|
3034
748
|
return inView(list, getLeft(prev || next, list, center));
|
|
@@ -3040,29 +754,29 @@
|
|
|
3040
754
|
return center ? left - centerEl(el, list) : Math.min(left, getMax(list));
|
|
3041
755
|
}
|
|
3042
756
|
function getMax(list) {
|
|
3043
|
-
return Math.max(0, getWidth(list) -
|
|
757
|
+
return Math.max(0, getWidth(list) - util.dimensions(list).width);
|
|
3044
758
|
}
|
|
3045
759
|
function getWidth(list) {
|
|
3046
|
-
return
|
|
760
|
+
return util.sumBy(util.children(list), (el) => util.dimensions(el).width);
|
|
3047
761
|
}
|
|
3048
762
|
function centerEl(el, list) {
|
|
3049
|
-
return
|
|
763
|
+
return util.dimensions(list).width / 2 - util.dimensions(el).width / 2;
|
|
3050
764
|
}
|
|
3051
765
|
function getElLeft(el, list) {
|
|
3052
|
-
return el && (
|
|
766
|
+
return el && (util.position(el).left + (util.isRtl ? util.dimensions(el).width - util.dimensions(list).width : 0)) * (util.isRtl ? -1 : 1) || 0;
|
|
3053
767
|
}
|
|
3054
768
|
function inView(list, listLeft) {
|
|
3055
769
|
listLeft -= 1;
|
|
3056
|
-
const listWidth =
|
|
770
|
+
const listWidth = util.dimensions(list).width;
|
|
3057
771
|
const listRight = listLeft + listWidth + 2;
|
|
3058
|
-
return
|
|
772
|
+
return util.children(list).filter((slide) => {
|
|
3059
773
|
const slideLeft = getElLeft(slide, list);
|
|
3060
|
-
const slideRight = slideLeft + Math.min(
|
|
774
|
+
const slideRight = slideLeft + Math.min(util.dimensions(slide).width, listWidth);
|
|
3061
775
|
return slideLeft >= listLeft && slideRight <= listRight;
|
|
3062
776
|
});
|
|
3063
777
|
}
|
|
3064
778
|
function triggerUpdate(el, type, data) {
|
|
3065
|
-
|
|
779
|
+
util.trigger(el, util.createEvent(type, false, false, data));
|
|
3066
780
|
}
|
|
3067
781
|
|
|
3068
782
|
var Component = {
|
|
@@ -3092,15 +806,15 @@
|
|
|
3092
806
|
return this.length - 1;
|
|
3093
807
|
}
|
|
3094
808
|
if (this.center) {
|
|
3095
|
-
return
|
|
809
|
+
return util.last(this.sets);
|
|
3096
810
|
}
|
|
3097
811
|
let lft = 0;
|
|
3098
812
|
const max = getMax(this.list);
|
|
3099
|
-
const index =
|
|
813
|
+
const index = util.findIndex(this.slides, (el) => {
|
|
3100
814
|
if (lft >= max) {
|
|
3101
815
|
return true;
|
|
3102
816
|
}
|
|
3103
|
-
lft +=
|
|
817
|
+
lft += util.dimensions(el).width;
|
|
3104
818
|
});
|
|
3105
819
|
return ~index ? index : this.length - 1;
|
|
3106
820
|
},
|
|
@@ -3110,14 +824,14 @@
|
|
|
3110
824
|
}
|
|
3111
825
|
let left = 0;
|
|
3112
826
|
const sets = [];
|
|
3113
|
-
const width =
|
|
827
|
+
const width = util.dimensions(this.list).width;
|
|
3114
828
|
for (let i = 0; i < this.length; i++) {
|
|
3115
|
-
const slideWidth =
|
|
829
|
+
const slideWidth = util.dimensions(this.slides[i]).width;
|
|
3116
830
|
if (left + slideWidth > width) {
|
|
3117
831
|
left = 0;
|
|
3118
832
|
}
|
|
3119
833
|
if (this.center) {
|
|
3120
|
-
if (left < width / 2 && left + slideWidth +
|
|
834
|
+
if (left < width / 2 && left + slideWidth + util.dimensions(this.slides[+i + 1]).width / 2 > width / 2) {
|
|
3121
835
|
sets.push(+i);
|
|
3122
836
|
left = width / 2 - slideWidth / 2;
|
|
3123
837
|
}
|
|
@@ -3137,11 +851,11 @@
|
|
|
3137
851
|
};
|
|
3138
852
|
},
|
|
3139
853
|
slides() {
|
|
3140
|
-
return
|
|
854
|
+
return util.children(this.list).filter(util.isVisible);
|
|
3141
855
|
}
|
|
3142
856
|
},
|
|
3143
857
|
connected() {
|
|
3144
|
-
|
|
858
|
+
util.toggleClass(this.$el, this.clsContainer, !util.$(`.${this.clsContainer}`, this.$el));
|
|
3145
859
|
},
|
|
3146
860
|
observe: resize({
|
|
3147
861
|
target: ({ slides }) => slides
|
|
@@ -3149,9 +863,9 @@
|
|
|
3149
863
|
update: {
|
|
3150
864
|
write() {
|
|
3151
865
|
for (const el of this.navItems) {
|
|
3152
|
-
const index =
|
|
866
|
+
const index = util.toNumber(util.data(el, this.attrItem));
|
|
3153
867
|
if (index !== false) {
|
|
3154
|
-
el.hidden = !this.maxIndex || index > this.maxIndex || this.sets && !
|
|
868
|
+
el.hidden = !this.maxIndex || index > this.maxIndex || this.sets && !util.includes(this.sets, index);
|
|
3155
869
|
}
|
|
3156
870
|
}
|
|
3157
871
|
if (this.length && !this.dragging && !this.stack.length) {
|
|
@@ -3164,7 +878,7 @@
|
|
|
3164
878
|
},
|
|
3165
879
|
events: {
|
|
3166
880
|
beforeitemshow(e) {
|
|
3167
|
-
if (!this.dragging && this.sets && this.stack.length < 2 && !
|
|
881
|
+
if (!this.dragging && this.sets && this.stack.length < 2 && !util.includes(this.sets, this.index)) {
|
|
3168
882
|
this.index = this.getValidIndex();
|
|
3169
883
|
}
|
|
3170
884
|
const diff = Math.abs(
|
|
@@ -3178,12 +892,12 @@
|
|
|
3178
892
|
return;
|
|
3179
893
|
}
|
|
3180
894
|
const index = this.dir < 0 || !this.slides[this.prevIndex] ? this.index : this.prevIndex;
|
|
3181
|
-
this.duration = speedUp(this.avgWidth / this.velocity) * (
|
|
895
|
+
this.duration = speedUp(this.avgWidth / this.velocity) * (util.dimensions(this.slides[index]).width / this.avgWidth);
|
|
3182
896
|
this.reorder();
|
|
3183
897
|
},
|
|
3184
898
|
itemshow() {
|
|
3185
899
|
if (~this.prevIndex) {
|
|
3186
|
-
|
|
900
|
+
util.addClass(this._getTransitioner().getItemIn(), this.clsActive);
|
|
3187
901
|
}
|
|
3188
902
|
},
|
|
3189
903
|
itemshown() {
|
|
@@ -3193,12 +907,12 @@
|
|
|
3193
907
|
methods: {
|
|
3194
908
|
reorder() {
|
|
3195
909
|
if (this.finite) {
|
|
3196
|
-
|
|
910
|
+
util.css(this.slides, "order", "");
|
|
3197
911
|
return;
|
|
3198
912
|
}
|
|
3199
913
|
const index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
|
|
3200
914
|
this.slides.forEach(
|
|
3201
|
-
(slide, i) =>
|
|
915
|
+
(slide, i) => util.css(
|
|
3202
916
|
slide,
|
|
3203
917
|
"order",
|
|
3204
918
|
this.dir > 0 && i < index ? 1 : this.dir < 0 && i >= this.index ? -1 : ""
|
|
@@ -3208,26 +922,26 @@
|
|
|
3208
922
|
return;
|
|
3209
923
|
}
|
|
3210
924
|
const next = this.slides[index];
|
|
3211
|
-
let width =
|
|
925
|
+
let width = util.dimensions(this.list).width / 2 - util.dimensions(next).width / 2;
|
|
3212
926
|
let j = 0;
|
|
3213
927
|
while (width > 0) {
|
|
3214
928
|
const slideIndex = this.getIndex(--j + index, index);
|
|
3215
929
|
const slide = this.slides[slideIndex];
|
|
3216
|
-
|
|
3217
|
-
width -=
|
|
930
|
+
util.css(slide, "order", slideIndex > index ? -2 : -1);
|
|
931
|
+
width -= util.dimensions(slide).width;
|
|
3218
932
|
}
|
|
3219
933
|
},
|
|
3220
934
|
updateActiveClasses() {
|
|
3221
935
|
const actives = this._getTransitioner(this.index).getActives();
|
|
3222
936
|
const activeClasses = [
|
|
3223
937
|
this.clsActive,
|
|
3224
|
-
(!this.sets ||
|
|
938
|
+
(!this.sets || util.includes(this.sets, util.toFloat(this.index))) && this.clsActivated || ""
|
|
3225
939
|
];
|
|
3226
940
|
for (const slide of this.slides) {
|
|
3227
|
-
const active =
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
941
|
+
const active = util.includes(actives, slide);
|
|
942
|
+
util.toggleClass(slide, activeClasses, active);
|
|
943
|
+
util.attr(slide, "aria-hidden", !active);
|
|
944
|
+
util.attr(util.$$(util.selFocusable, slide), "tabindex", active ? null : -1);
|
|
3231
945
|
}
|
|
3232
946
|
},
|
|
3233
947
|
getValidIndex(index = this.index, prevIndex = this.prevIndex) {
|
|
@@ -3237,7 +951,7 @@
|
|
|
3237
951
|
}
|
|
3238
952
|
let prev;
|
|
3239
953
|
do {
|
|
3240
|
-
if (
|
|
954
|
+
if (util.includes(this.sets, index)) {
|
|
3241
955
|
return index;
|
|
3242
956
|
}
|
|
3243
957
|
prev = index;
|
|
@@ -3246,10 +960,10 @@
|
|
|
3246
960
|
return index;
|
|
3247
961
|
},
|
|
3248
962
|
getAdjacentSlides() {
|
|
3249
|
-
const { width } =
|
|
963
|
+
const { width } = util.dimensions(this.list);
|
|
3250
964
|
const left = -width;
|
|
3251
965
|
const right = width * 2;
|
|
3252
|
-
const slideWidth =
|
|
966
|
+
const slideWidth = util.dimensions(this.slides[this.index]).width;
|
|
3253
967
|
const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
|
|
3254
968
|
const slides = /* @__PURE__ */ new Set();
|
|
3255
969
|
for (const i of [-1, 1]) {
|
|
@@ -3257,7 +971,7 @@
|
|
|
3257
971
|
let j = 0;
|
|
3258
972
|
do {
|
|
3259
973
|
const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
|
|
3260
|
-
currentLeft +=
|
|
974
|
+
currentLeft += util.dimensions(slide).width * i;
|
|
3261
975
|
slides.add(slide);
|
|
3262
976
|
} while (this.length > j && currentLeft > left && currentLeft < right);
|
|
3263
977
|
}
|
|
@@ -3269,36 +983,36 @@
|
|
|
3269
983
|
if (!list || list.length < 2) {
|
|
3270
984
|
return true;
|
|
3271
985
|
}
|
|
3272
|
-
const { width: listWidth } =
|
|
986
|
+
const { width: listWidth } = util.dimensions(list);
|
|
3273
987
|
if (!center) {
|
|
3274
988
|
return Math.ceil(getWidth(list)) < Math.trunc(listWidth + getMaxElWidth(list));
|
|
3275
989
|
}
|
|
3276
|
-
const slides =
|
|
990
|
+
const slides = util.children(list);
|
|
3277
991
|
const listHalf = Math.trunc(listWidth / 2);
|
|
3278
992
|
for (const index in slides) {
|
|
3279
993
|
const slide = slides[index];
|
|
3280
|
-
const slideWidth =
|
|
994
|
+
const slideWidth = util.dimensions(slide).width;
|
|
3281
995
|
const slidesInView = /* @__PURE__ */ new Set([slide]);
|
|
3282
996
|
let diff = 0;
|
|
3283
997
|
for (const i of [-1, 1]) {
|
|
3284
998
|
let left = slideWidth / 2;
|
|
3285
999
|
let j = 0;
|
|
3286
1000
|
while (left < listHalf) {
|
|
3287
|
-
const nextSlide = slides[
|
|
1001
|
+
const nextSlide = slides[util.getIndex(+index + i + j++ * i, slides)];
|
|
3288
1002
|
if (slidesInView.has(nextSlide)) {
|
|
3289
1003
|
return true;
|
|
3290
1004
|
}
|
|
3291
|
-
left +=
|
|
1005
|
+
left += util.dimensions(nextSlide).width;
|
|
3292
1006
|
slidesInView.add(nextSlide);
|
|
3293
1007
|
}
|
|
3294
1008
|
diff = Math.max(
|
|
3295
1009
|
diff,
|
|
3296
|
-
slideWidth / 2 +
|
|
1010
|
+
slideWidth / 2 + util.dimensions(slides[util.getIndex(+index + i, slides)]).width / 2 - (left - listHalf)
|
|
3297
1011
|
);
|
|
3298
1012
|
}
|
|
3299
|
-
if (diff >
|
|
1013
|
+
if (diff > util.sumBy(
|
|
3300
1014
|
slides.filter((slide2) => !slidesInView.has(slide2)),
|
|
3301
|
-
(slide2) =>
|
|
1015
|
+
(slide2) => util.dimensions(slide2).width
|
|
3302
1016
|
)) {
|
|
3303
1017
|
return true;
|
|
3304
1018
|
}
|
|
@@ -3306,7 +1020,7 @@
|
|
|
3306
1020
|
return false;
|
|
3307
1021
|
}
|
|
3308
1022
|
function getMaxElWidth(list) {
|
|
3309
|
-
return Math.max(0, ...
|
|
1023
|
+
return Math.max(0, ...util.children(list).map((el) => util.dimensions(el).width));
|
|
3310
1024
|
}
|
|
3311
1025
|
|
|
3312
1026
|
if (typeof window !== "undefined" && window.UIkit) {
|