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