uikit 3.16.6-dev.7e4b0cb00 → 3.16.7-dev.248cd00b6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -0
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +2 -2
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +2 -2
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +5 -414
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +196 -2021
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +207 -2018
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +3 -248
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +144 -2453
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +98 -2407
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +3 -408
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +81 -2367
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +90 -80
- 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 +100 -113
- 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 +2 -2
- package/src/js/api/computed.js +1 -1
- package/src/js/api/events.js +1 -1
- package/src/js/api/global.js +43 -43
- package/src/js/api/index.js +5 -5
- package/src/js/api/instance.js +42 -41
- package/src/js/api/observables.js +1 -1
- package/src/js/api/observer.js +9 -1
- package/src/js/api/options.js +1 -1
- package/src/js/api/props.js +1 -1
- package/src/js/api/state.js +1 -1
- package/src/js/api/update.js +1 -1
- package/src/js/api/watch.js +1 -1
- package/src/js/core/accordion.js +4 -0
- package/src/js/mixin/slider-autoplay.js +13 -42
- package/src/js/mixin/slider-nav.js +4 -1
- package/src/js/util/scroll.js +2 -1
- package/src/less/components/dropdown.less +1 -1
- package/src/less/theme/dropdown.less +2 -0
- package/src/scss/components/dropdown.scss +1 -1
- package/src/scss/theme/dropdown.scss +2 -0
- package/src/scss/variables-theme.scss +2 -2
- package/src/scss/variables.scss +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! UIkit 3.16.
|
|
1
|
+
/*! UIkit 3.16.7-dev.248cd00b6 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define('uikitlightbox', ['uikit-util'], factory) :
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitLightbox = factory(global.UIkit.util));
|
|
7
|
-
})(this, (function (
|
|
7
|
+
})(this, (function (util) { 'use strict';
|
|
8
8
|
|
|
9
9
|
var Animations$1 = {
|
|
10
10
|
slide: {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
function translated(el) {
|
|
26
|
-
return Math.abs(
|
|
26
|
+
return Math.abs(util.css(el, "transform").split(",")[4] / el.offsetWidth) || 0;
|
|
27
27
|
}
|
|
28
28
|
function translate(value = 0, unit = "%") {
|
|
29
29
|
value += value ? unit : "";
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
return [{ opacity: 0 }, { opacity: 1 }];
|
|
41
41
|
},
|
|
42
42
|
percent(current) {
|
|
43
|
-
return 1 -
|
|
43
|
+
return 1 - util.css(current, "opacity");
|
|
44
44
|
},
|
|
45
45
|
translate(percent) {
|
|
46
46
|
return [{ opacity: 1 - percent }, { opacity: percent }];
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
];
|
|
55
55
|
},
|
|
56
56
|
percent(current) {
|
|
57
|
-
return 1 -
|
|
57
|
+
return 1 - util.css(current, "opacity");
|
|
58
58
|
},
|
|
59
59
|
translate(percent) {
|
|
60
60
|
return [
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
var Class = {
|
|
69
69
|
connected() {
|
|
70
|
-
|
|
70
|
+
util.addClass(this.$el, this.$options.id);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
computed: {
|
|
82
82
|
container({ container }) {
|
|
83
|
-
return container === true && this.$container || container &&
|
|
83
|
+
return container === true && this.$container || container && util.$(container);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
};
|
|
@@ -109,37 +109,37 @@
|
|
|
109
109
|
return !!animation[0];
|
|
110
110
|
},
|
|
111
111
|
hasTransition({ animation }) {
|
|
112
|
-
return ["slide", "reveal"].some((transition) =>
|
|
112
|
+
return ["slide", "reveal"].some((transition) => util.startsWith(animation[0], transition));
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
methods: {
|
|
116
116
|
toggleElement(targets, toggle, animate) {
|
|
117
117
|
return new Promise(
|
|
118
118
|
(resolve) => Promise.all(
|
|
119
|
-
|
|
120
|
-
const show =
|
|
121
|
-
if (!
|
|
119
|
+
util.toNodes(targets).map((el) => {
|
|
120
|
+
const show = util.isBoolean(toggle) ? toggle : !this.isToggled(el);
|
|
121
|
+
if (!util.trigger(el, `before${show ? "show" : "hide"}`, [this])) {
|
|
122
122
|
return Promise.reject();
|
|
123
123
|
}
|
|
124
|
-
const promise = (
|
|
124
|
+
const promise = (util.isFunction(animate) ? animate : animate === false || !this.hasAnimation ? toggleInstant : this.hasTransition ? toggleTransition : toggleAnimation)(el, show, this);
|
|
125
125
|
const cls = show ? this.clsEnter : this.clsLeave;
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
util.addClass(el, cls);
|
|
127
|
+
util.trigger(el, show ? "show" : "hide", [this]);
|
|
128
128
|
const done = () => {
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
util.removeClass(el, cls);
|
|
130
|
+
util.trigger(el, show ? "shown" : "hidden", [this]);
|
|
131
131
|
};
|
|
132
132
|
return promise ? promise.then(done, () => {
|
|
133
|
-
|
|
133
|
+
util.removeClass(el, cls);
|
|
134
134
|
return Promise.reject();
|
|
135
135
|
}) : done();
|
|
136
136
|
})
|
|
137
|
-
).then(resolve,
|
|
137
|
+
).then(resolve, util.noop)
|
|
138
138
|
);
|
|
139
139
|
},
|
|
140
140
|
isToggled(el = this.$el) {
|
|
141
|
-
[el] =
|
|
142
|
-
return
|
|
141
|
+
[el] = util.toNodes(el);
|
|
142
|
+
return util.hasClass(el, this.clsEnter) ? true : util.hasClass(el, this.clsLeave) ? false : this.cls ? util.hasClass(el, this.cls.split(" ")[0]) : util.isVisible(el);
|
|
143
143
|
},
|
|
144
144
|
_toggle(el, toggled) {
|
|
145
145
|
if (!el) {
|
|
@@ -148,22 +148,22 @@
|
|
|
148
148
|
toggled = Boolean(toggled);
|
|
149
149
|
let changed;
|
|
150
150
|
if (this.cls) {
|
|
151
|
-
changed =
|
|
152
|
-
changed &&
|
|
151
|
+
changed = util.includes(this.cls, " ") || toggled !== util.hasClass(el, this.cls);
|
|
152
|
+
changed && util.toggleClass(el, this.cls, util.includes(this.cls, " ") ? void 0 : toggled);
|
|
153
153
|
} else {
|
|
154
154
|
changed = toggled === el.hidden;
|
|
155
155
|
changed && (el.hidden = !toggled);
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
util.$$("[autofocus]", el).some((el2) => util.isVisible(el2) ? el2.focus() || true : el2.blur());
|
|
158
158
|
if (changed) {
|
|
159
|
-
|
|
159
|
+
util.trigger(el, "toggled", [toggled, this]);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
function toggleInstant(el, show, { _toggle }) {
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
util.Animation.cancel(el);
|
|
166
|
+
util.Transition.cancel(el);
|
|
167
167
|
return _toggle(el, show);
|
|
168
168
|
}
|
|
169
169
|
async function toggleTransition(el, show, { animation, duration, velocity, transition, _toggle }) {
|
|
@@ -173,15 +173,15 @@
|
|
|
173
173
|
["left", "right"],
|
|
174
174
|
["top", "bottom"]
|
|
175
175
|
];
|
|
176
|
-
const dir = dirs[
|
|
176
|
+
const dir = dirs[util.includes(dirs[0], startProp) ? 0 : 1];
|
|
177
177
|
const end = dir[1] === startProp;
|
|
178
178
|
const props = ["width", "height"];
|
|
179
179
|
const dimProp = props[dirs.indexOf(dir)];
|
|
180
180
|
const marginProp = `margin-${dir[0]}`;
|
|
181
181
|
const marginStartProp = `margin-${startProp}`;
|
|
182
|
-
let currentDim =
|
|
183
|
-
const inProgress =
|
|
184
|
-
await
|
|
182
|
+
let currentDim = util.dimensions(el)[dimProp];
|
|
183
|
+
const inProgress = util.Transition.inProgress(el);
|
|
184
|
+
await util.Transition.cancel(el);
|
|
185
185
|
if (show) {
|
|
186
186
|
_toggle(el, true);
|
|
187
187
|
}
|
|
@@ -199,19 +199,19 @@
|
|
|
199
199
|
marginStartProp
|
|
200
200
|
].map((key) => [key, el.style[key]])
|
|
201
201
|
);
|
|
202
|
-
const dim =
|
|
203
|
-
const currentMargin =
|
|
204
|
-
const marginStart =
|
|
202
|
+
const dim = util.dimensions(el);
|
|
203
|
+
const currentMargin = util.toFloat(util.css(el, marginProp));
|
|
204
|
+
const marginStart = util.toFloat(util.css(el, marginStartProp));
|
|
205
205
|
const endDim = dim[dimProp] + marginStart;
|
|
206
206
|
if (!inProgress && !show) {
|
|
207
207
|
currentDim += marginStart;
|
|
208
208
|
}
|
|
209
|
-
const [wrapper] =
|
|
210
|
-
|
|
209
|
+
const [wrapper] = util.wrapInner(el, "<div>");
|
|
210
|
+
util.css(wrapper, {
|
|
211
211
|
boxSizing: "border-box",
|
|
212
212
|
height: dim.height,
|
|
213
213
|
width: dim.width,
|
|
214
|
-
...
|
|
214
|
+
...util.css(el, [
|
|
215
215
|
"overflow",
|
|
216
216
|
"padding",
|
|
217
217
|
"borderTop",
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
marginStartProp
|
|
223
223
|
])
|
|
224
224
|
});
|
|
225
|
-
|
|
225
|
+
util.css(el, {
|
|
226
226
|
padding: 0,
|
|
227
227
|
border: 0,
|
|
228
228
|
minWidth: 0,
|
|
@@ -237,54 +237,42 @@
|
|
|
237
237
|
duration = (velocity * endDim + duration) * (show ? 1 - percent : percent);
|
|
238
238
|
const endProps = { [dimProp]: show ? endDim : 0 };
|
|
239
239
|
if (end) {
|
|
240
|
-
|
|
240
|
+
util.css(el, marginProp, endDim - currentDim + currentMargin);
|
|
241
241
|
endProps[marginProp] = show ? currentMargin : endDim + currentMargin;
|
|
242
242
|
}
|
|
243
243
|
if (!end ^ mode === "reveal") {
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
util.css(wrapper, marginProp, -endDim + currentDim);
|
|
245
|
+
util.Transition.start(wrapper, { [marginProp]: show ? 0 : -endDim }, duration, transition);
|
|
246
246
|
}
|
|
247
247
|
try {
|
|
248
|
-
await
|
|
248
|
+
await util.Transition.start(el, endProps, duration, transition);
|
|
249
249
|
} finally {
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
util.css(el, prevProps);
|
|
251
|
+
util.unwrap(wrapper.firstChild);
|
|
252
252
|
if (!show) {
|
|
253
253
|
_toggle(el, false);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
function toggleAnimation(el, show, cmp) {
|
|
258
|
-
|
|
258
|
+
util.Animation.cancel(el);
|
|
259
259
|
const { animation, duration, _toggle } = cmp;
|
|
260
260
|
if (show) {
|
|
261
261
|
_toggle(el, true);
|
|
262
|
-
return
|
|
262
|
+
return util.Animation.in(el, animation[0], duration, cmp.origin);
|
|
263
263
|
}
|
|
264
|
-
return
|
|
264
|
+
return util.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(
|
|
265
265
|
() => _toggle(el, false)
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
const { hasOwnProperty, toString } = Object.prototype;
|
|
270
|
-
function hasOwn(obj, key) {
|
|
271
|
-
return hasOwnProperty.call(obj, key);
|
|
272
|
-
}
|
|
273
269
|
const hyphenateRe = /\B([A-Z])/g;
|
|
274
270
|
const hyphenate = memoize((str) => str.replace(hyphenateRe, "-$1").toLowerCase());
|
|
275
|
-
const camelizeRe = /-(\w)/g;
|
|
276
|
-
const camelize = memoize(
|
|
277
|
-
(str) => (str.charAt(0).toLowerCase() + str.slice(1)).replace(camelizeRe, (_, c) => c.toUpperCase())
|
|
278
|
-
);
|
|
279
271
|
const ucfirst = memoize((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
280
272
|
function startsWith(str, search) {
|
|
281
273
|
var _a;
|
|
282
274
|
return (_a = str == null ? void 0 : str.startsWith) == null ? void 0 : _a.call(str, search);
|
|
283
275
|
}
|
|
284
|
-
function endsWith(str, search) {
|
|
285
|
-
var _a;
|
|
286
|
-
return (_a = str == null ? void 0 : str.endsWith) == null ? void 0 : _a.call(str, search);
|
|
287
|
-
}
|
|
288
276
|
function includes(obj, search) {
|
|
289
277
|
var _a;
|
|
290
278
|
return (_a = obj == null ? void 0 : obj.includes) == null ? void 0 : _a.call(obj, search);
|
|
@@ -294,16 +282,12 @@
|
|
|
294
282
|
return (_a = array == null ? void 0 : array.findIndex) == null ? void 0 : _a.call(array, predicate);
|
|
295
283
|
}
|
|
296
284
|
const { isArray, from: toArray } = Array;
|
|
297
|
-
const { assign } = Object;
|
|
298
285
|
function isFunction(obj) {
|
|
299
286
|
return typeof obj === "function";
|
|
300
287
|
}
|
|
301
288
|
function isObject(obj) {
|
|
302
289
|
return obj !== null && typeof obj === "object";
|
|
303
290
|
}
|
|
304
|
-
function isPlainObject(obj) {
|
|
305
|
-
return toString.call(obj) === "[object Object]";
|
|
306
|
-
}
|
|
307
291
|
function isWindow(obj) {
|
|
308
292
|
return isObject(obj) && obj === obj.window;
|
|
309
293
|
}
|
|
@@ -319,9 +303,6 @@
|
|
|
319
303
|
function nodeType(obj) {
|
|
320
304
|
return !isWindow(obj) && isObject(obj) && obj.nodeType;
|
|
321
305
|
}
|
|
322
|
-
function isBoolean(value) {
|
|
323
|
-
return typeof value === "boolean";
|
|
324
|
-
}
|
|
325
306
|
function isString(value) {
|
|
326
307
|
return typeof value === "string";
|
|
327
308
|
}
|
|
@@ -331,19 +312,9 @@
|
|
|
331
312
|
function isNumeric(value) {
|
|
332
313
|
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
|
|
333
314
|
}
|
|
334
|
-
function isEmpty(obj) {
|
|
335
|
-
return !(isArray(obj) ? obj.length : isObject(obj) ? Object.keys(obj).length : false);
|
|
336
|
-
}
|
|
337
315
|
function isUndefined(value) {
|
|
338
316
|
return value === void 0;
|
|
339
317
|
}
|
|
340
|
-
function toBoolean(value) {
|
|
341
|
-
return isBoolean(value) ? value : value === "true" || value === "1" || value === "" ? true : value === "false" || value === "0" ? false : value;
|
|
342
|
-
}
|
|
343
|
-
function toNumber(value) {
|
|
344
|
-
const number = Number(value);
|
|
345
|
-
return isNaN(number) ? false : number;
|
|
346
|
-
}
|
|
347
318
|
function toFloat(value) {
|
|
348
319
|
return parseFloat(value) || 0;
|
|
349
320
|
}
|
|
@@ -361,15 +332,6 @@
|
|
|
361
332
|
const document = isDocument(element) ? element : element == null ? void 0 : element.ownerDocument;
|
|
362
333
|
return (document == null ? void 0 : document.defaultView) || window;
|
|
363
334
|
}
|
|
364
|
-
function isEqual(value, other) {
|
|
365
|
-
return value === other || isObject(value) && isObject(other) && Object.keys(value).length === Object.keys(other).length && each(value, (val, key) => val === other[key]);
|
|
366
|
-
}
|
|
367
|
-
function swap(value, a, b) {
|
|
368
|
-
return value.replace(new RegExp(`${a}|${b}`, "g"), (match) => match === a ? b : a);
|
|
369
|
-
}
|
|
370
|
-
function last(array) {
|
|
371
|
-
return array[array.length - 1];
|
|
372
|
-
}
|
|
373
335
|
function each(obj, cb) {
|
|
374
336
|
for (const key in obj) {
|
|
375
337
|
if (false === cb(obj[key], key)) {
|
|
@@ -378,87 +340,16 @@
|
|
|
378
340
|
}
|
|
379
341
|
return true;
|
|
380
342
|
}
|
|
381
|
-
function sortBy(array, prop) {
|
|
382
|
-
return array.slice().sort(
|
|
383
|
-
({ [prop]: propA = 0 }, { [prop]: propB = 0 }) => propA > propB ? 1 : propB > propA ? -1 : 0
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
343
|
function sumBy(array, iteratee) {
|
|
387
344
|
return array.reduce(
|
|
388
345
|
(sum, item) => sum + toFloat(isFunction(iteratee) ? iteratee(item) : item[iteratee]),
|
|
389
346
|
0
|
|
390
347
|
);
|
|
391
348
|
}
|
|
392
|
-
function uniqueBy(array, prop) {
|
|
393
|
-
const seen = /* @__PURE__ */ new Set();
|
|
394
|
-
return array.filter(({ [prop]: check }) => seen.has(check) ? false : seen.add(check));
|
|
395
|
-
}
|
|
396
|
-
function pick(obj, props) {
|
|
397
|
-
return props.reduce((res, prop) => ({ ...res, [prop]: obj[prop] }), {});
|
|
398
|
-
}
|
|
399
|
-
function clamp(number, min = 0, max = 1) {
|
|
400
|
-
return Math.min(Math.max(toNumber(number) || 0, min), max);
|
|
401
|
-
}
|
|
402
|
-
function noop() {
|
|
403
|
-
}
|
|
404
|
-
function intersectRect(...rects) {
|
|
405
|
-
return [
|
|
406
|
-
["bottom", "top"],
|
|
407
|
-
["right", "left"]
|
|
408
|
-
].every(
|
|
409
|
-
([minProp, maxProp]) => Math.min(...rects.map(({ [minProp]: min }) => min)) - Math.max(...rects.map(({ [maxProp]: max }) => max)) > 0
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
function pointInRect(point, rect) {
|
|
413
|
-
return point.x <= rect.right && point.x >= rect.left && point.y <= rect.bottom && point.y >= rect.top;
|
|
414
|
-
}
|
|
415
|
-
function ratio(dimensions, prop, value) {
|
|
416
|
-
const aProp = prop === "width" ? "height" : "width";
|
|
417
|
-
return {
|
|
418
|
-
[aProp]: dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp],
|
|
419
|
-
[prop]: value
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
function contain(dimensions, maxDimensions) {
|
|
423
|
-
dimensions = { ...dimensions };
|
|
424
|
-
for (const prop in dimensions) {
|
|
425
|
-
dimensions = dimensions[prop] > maxDimensions[prop] ? ratio(dimensions, prop, maxDimensions[prop]) : dimensions;
|
|
426
|
-
}
|
|
427
|
-
return dimensions;
|
|
428
|
-
}
|
|
429
|
-
function cover(dimensions, maxDimensions) {
|
|
430
|
-
dimensions = contain(dimensions, maxDimensions);
|
|
431
|
-
for (const prop in dimensions) {
|
|
432
|
-
dimensions = dimensions[prop] < maxDimensions[prop] ? ratio(dimensions, prop, maxDimensions[prop]) : dimensions;
|
|
433
|
-
}
|
|
434
|
-
return dimensions;
|
|
435
|
-
}
|
|
436
|
-
const Dimensions = { ratio, contain, cover };
|
|
437
|
-
function getIndex(i, elements, current = 0, finite = false) {
|
|
438
|
-
elements = toNodes(elements);
|
|
439
|
-
const { length } = elements;
|
|
440
|
-
if (!length) {
|
|
441
|
-
return -1;
|
|
442
|
-
}
|
|
443
|
-
i = isNumeric(i) ? toNumber(i) : i === "next" ? current + 1 : i === "previous" ? current - 1 : i === "last" ? length - 1 : elements.indexOf(toNode(i));
|
|
444
|
-
if (finite) {
|
|
445
|
-
return clamp(i, 0, length - 1);
|
|
446
|
-
}
|
|
447
|
-
i %= length;
|
|
448
|
-
return i < 0 ? i + length : i;
|
|
449
|
-
}
|
|
450
349
|
function memoize(fn) {
|
|
451
350
|
const cache = /* @__PURE__ */ Object.create(null);
|
|
452
351
|
return (key) => cache[key] || (cache[key] = fn(key));
|
|
453
352
|
}
|
|
454
|
-
class Deferred {
|
|
455
|
-
constructor() {
|
|
456
|
-
this.promise = new Promise((resolve, reject) => {
|
|
457
|
-
this.reject = reject;
|
|
458
|
-
this.resolve = resolve;
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
353
|
|
|
463
354
|
function attr(element, name, value) {
|
|
464
355
|
var _a;
|
|
@@ -483,53 +374,10 @@
|
|
|
483
374
|
}
|
|
484
375
|
}
|
|
485
376
|
}
|
|
486
|
-
function hasAttr(element, name) {
|
|
487
|
-
return toNodes(element).some((element2) => element2.hasAttribute(name));
|
|
488
|
-
}
|
|
489
377
|
function removeAttr(element, name) {
|
|
490
378
|
toNodes(element).forEach((element2) => element2.removeAttribute(name));
|
|
491
379
|
}
|
|
492
|
-
function data(element, attribute) {
|
|
493
|
-
for (const name of [attribute, `data-${attribute}`]) {
|
|
494
|
-
if (hasAttr(element, name)) {
|
|
495
|
-
return attr(element, name);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
380
|
|
|
500
|
-
const voidElements = {
|
|
501
|
-
area: true,
|
|
502
|
-
base: true,
|
|
503
|
-
br: true,
|
|
504
|
-
col: true,
|
|
505
|
-
embed: true,
|
|
506
|
-
hr: true,
|
|
507
|
-
img: true,
|
|
508
|
-
input: true,
|
|
509
|
-
keygen: true,
|
|
510
|
-
link: true,
|
|
511
|
-
meta: true,
|
|
512
|
-
param: true,
|
|
513
|
-
source: true,
|
|
514
|
-
track: true,
|
|
515
|
-
wbr: true
|
|
516
|
-
};
|
|
517
|
-
function isVoidElement(element) {
|
|
518
|
-
return toNodes(element).some((element2) => voidElements[element2.tagName.toLowerCase()]);
|
|
519
|
-
}
|
|
520
|
-
function isVisible(element) {
|
|
521
|
-
return toNodes(element).some(
|
|
522
|
-
(element2) => element2.offsetWidth || element2.offsetHeight || element2.getClientRects().length
|
|
523
|
-
);
|
|
524
|
-
}
|
|
525
|
-
const selInput = "input,select,textarea,button";
|
|
526
|
-
function isInput(element) {
|
|
527
|
-
return toNodes(element).some((element2) => matches(element2, selInput));
|
|
528
|
-
}
|
|
529
|
-
const selFocusable = `${selInput},a[href],[tabindex]`;
|
|
530
|
-
function isFocusable(element) {
|
|
531
|
-
return matches(element, selFocusable);
|
|
532
|
-
}
|
|
533
381
|
function parent(element) {
|
|
534
382
|
var _a;
|
|
535
383
|
return (_a = toNode(element)) == null ? void 0 : _a.parentElement;
|
|
@@ -563,35 +411,12 @@
|
|
|
563
411
|
function index(element, ref) {
|
|
564
412
|
return ref ? toNodes(element).indexOf(toNode(ref)) : children(parent(element)).indexOf(element);
|
|
565
413
|
}
|
|
566
|
-
function isSameSiteAnchor(el) {
|
|
567
|
-
el = toNode(el);
|
|
568
|
-
return el && ["origin", "pathname", "search"].every((part) => el[part] === location[part]);
|
|
569
|
-
}
|
|
570
|
-
function getTargetedElement(el) {
|
|
571
|
-
if (isSameSiteAnchor(el)) {
|
|
572
|
-
el = toNode(el);
|
|
573
|
-
const id = decodeURIComponent(el.hash).substring(1);
|
|
574
|
-
return document.getElementById(id) || document.getElementsByName(id)[0];
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
414
|
|
|
578
|
-
function query(selector, context) {
|
|
579
|
-
return find(selector, getContext(selector, context));
|
|
580
|
-
}
|
|
581
|
-
function queryAll(selector, context) {
|
|
582
|
-
return findAll(selector, getContext(selector, context));
|
|
583
|
-
}
|
|
584
|
-
function find(selector, context) {
|
|
585
|
-
return toNode(_query(selector, toNode(context), "querySelector"));
|
|
586
|
-
}
|
|
587
415
|
function findAll(selector, context) {
|
|
588
416
|
return toNodes(_query(selector, toNode(context), "querySelectorAll"));
|
|
589
417
|
}
|
|
590
418
|
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
591
419
|
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
592
|
-
function getContext(selector, context = document) {
|
|
593
|
-
return isString(selector) && isContextSelector(selector) || isDocument(context) ? context : context.ownerDocument;
|
|
594
|
-
}
|
|
595
420
|
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
596
421
|
const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, "$1 *"));
|
|
597
422
|
function _query(selector, context = document, queryFn) {
|
|
@@ -682,34 +507,6 @@
|
|
|
682
507
|
}
|
|
683
508
|
}
|
|
684
509
|
}
|
|
685
|
-
function once(...args) {
|
|
686
|
-
const [element, types, selector, listener, useCapture = false, condition] = getArgs(args);
|
|
687
|
-
const off2 = on(
|
|
688
|
-
element,
|
|
689
|
-
types,
|
|
690
|
-
selector,
|
|
691
|
-
(e) => {
|
|
692
|
-
const result = !condition || condition(e);
|
|
693
|
-
if (result) {
|
|
694
|
-
off2();
|
|
695
|
-
listener(e, result);
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
useCapture
|
|
699
|
-
);
|
|
700
|
-
return off2;
|
|
701
|
-
}
|
|
702
|
-
function trigger(targets, event, detail2) {
|
|
703
|
-
return toEventTargets(targets).every(
|
|
704
|
-
(target) => target.dispatchEvent(createEvent(event, true, true, detail2))
|
|
705
|
-
);
|
|
706
|
-
}
|
|
707
|
-
function createEvent(e, bubbles = true, cancelable = false, detail2) {
|
|
708
|
-
if (isString(e)) {
|
|
709
|
-
e = new CustomEvent(e, { bubbles, cancelable, detail: detail2 });
|
|
710
|
-
}
|
|
711
|
-
return e;
|
|
712
|
-
}
|
|
713
510
|
function getArgs(args) {
|
|
714
511
|
args[0] = toEventTargets(args[0]);
|
|
715
512
|
if (isString(args[1])) {
|
|
@@ -749,14 +546,6 @@
|
|
|
749
546
|
function toEventTargets(target) {
|
|
750
547
|
return isArray(target) ? target.map(toEventTarget).filter(Boolean) : isString(target) ? findAll(target) : isEventTarget(target) ? [target] : toNodes(target);
|
|
751
548
|
}
|
|
752
|
-
function isTouch(e) {
|
|
753
|
-
return e.pointerType === "touch" || !!e.touches;
|
|
754
|
-
}
|
|
755
|
-
function getEventPos(e) {
|
|
756
|
-
var _a, _b;
|
|
757
|
-
const { clientX: x, clientY: y } = ((_a = e.touches) == null ? void 0 : _a[0]) || ((_b = e.changedTouches) == null ? void 0 : _b[0]) || e;
|
|
758
|
-
return { x, y };
|
|
759
|
-
}
|
|
760
549
|
|
|
761
550
|
const cssNumber = {
|
|
762
551
|
"animation-iteration-count": true,
|
|
@@ -820,101 +609,7 @@
|
|
|
820
609
|
}
|
|
821
610
|
}
|
|
822
611
|
|
|
823
|
-
|
|
824
|
-
if (document.readyState !== "loading") {
|
|
825
|
-
fn();
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
once(document, "DOMContentLoaded", fn);
|
|
829
|
-
}
|
|
830
|
-
function isTag(element, ...tagNames) {
|
|
831
|
-
return tagNames.some((tagName) => {
|
|
832
|
-
var _a;
|
|
833
|
-
return ((_a = element == null ? void 0 : element.tagName) == null ? void 0 : _a.toLowerCase()) === tagName.toLowerCase();
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
function empty(element) {
|
|
837
|
-
element = $(element);
|
|
838
|
-
element.innerHTML = "";
|
|
839
|
-
return element;
|
|
840
|
-
}
|
|
841
|
-
function html(parent2, html2) {
|
|
842
|
-
return isUndefined(html2) ? $(parent2).innerHTML : append(empty(parent2), html2);
|
|
843
|
-
}
|
|
844
|
-
const prepend = applyFn("prepend");
|
|
845
|
-
const append = applyFn("append");
|
|
846
|
-
const before = applyFn("before");
|
|
847
|
-
const after = applyFn("after");
|
|
848
|
-
function applyFn(fn) {
|
|
849
|
-
return function(ref, element) {
|
|
850
|
-
var _a;
|
|
851
|
-
const nodes = toNodes(isString(element) ? fragment(element) : element);
|
|
852
|
-
(_a = $(ref)) == null ? void 0 : _a[fn](...nodes);
|
|
853
|
-
return unwrapSingle(nodes);
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
function remove$1(element) {
|
|
857
|
-
toNodes(element).forEach((element2) => element2.remove());
|
|
858
|
-
}
|
|
859
|
-
function wrapAll(element, structure) {
|
|
860
|
-
structure = toNode(before(element, structure));
|
|
861
|
-
while (structure.firstChild) {
|
|
862
|
-
structure = structure.firstChild;
|
|
863
|
-
}
|
|
864
|
-
append(structure, element);
|
|
865
|
-
return structure;
|
|
866
|
-
}
|
|
867
|
-
function wrapInner(element, structure) {
|
|
868
|
-
return toNodes(
|
|
869
|
-
toNodes(element).map(
|
|
870
|
-
(element2) => element2.hasChildNodes() ? wrapAll(toNodes(element2.childNodes), structure) : append(element2, structure)
|
|
871
|
-
)
|
|
872
|
-
);
|
|
873
|
-
}
|
|
874
|
-
function unwrap(element) {
|
|
875
|
-
toNodes(element).map(parent).filter((value, index, self) => self.indexOf(value) === index).forEach((parent2) => parent2.replaceWith(...parent2.childNodes));
|
|
876
|
-
}
|
|
877
|
-
const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
|
|
878
|
-
const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
|
|
879
|
-
function fragment(html2) {
|
|
880
|
-
const matches = singleTagRe.exec(html2);
|
|
881
|
-
if (matches) {
|
|
882
|
-
return document.createElement(matches[1]);
|
|
883
|
-
}
|
|
884
|
-
const container = document.createElement("div");
|
|
885
|
-
if (fragmentRe.test(html2)) {
|
|
886
|
-
container.insertAdjacentHTML("beforeend", html2.trim());
|
|
887
|
-
} else {
|
|
888
|
-
container.textContent = html2;
|
|
889
|
-
}
|
|
890
|
-
return unwrapSingle(container.childNodes);
|
|
891
|
-
}
|
|
892
|
-
function unwrapSingle(nodes) {
|
|
893
|
-
return nodes.length > 1 ? nodes : nodes[0];
|
|
894
|
-
}
|
|
895
|
-
function apply$1(node, fn) {
|
|
896
|
-
if (!isElement(node)) {
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
fn(node);
|
|
900
|
-
node = node.firstElementChild;
|
|
901
|
-
while (node) {
|
|
902
|
-
const next = node.nextElementSibling;
|
|
903
|
-
apply$1(node, fn);
|
|
904
|
-
node = next;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function $(selector, context) {
|
|
908
|
-
return isHtml(selector) ? toNode(fragment(selector)) : find(selector, context);
|
|
909
|
-
}
|
|
910
|
-
function $$(selector, context) {
|
|
911
|
-
return isHtml(selector) ? toNodes(fragment(selector)) : findAll(selector, context);
|
|
912
|
-
}
|
|
913
|
-
function isHtml(str) {
|
|
914
|
-
return isString(str) && startsWith(str.trim(), "<");
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
const dirs$1 = {
|
|
612
|
+
const dirs = {
|
|
918
613
|
width: ["left", "right"],
|
|
919
614
|
height: ["top", "bottom"]
|
|
920
615
|
};
|
|
@@ -934,8 +629,8 @@
|
|
|
934
629
|
if (element) {
|
|
935
630
|
const { scrollY, scrollX } = toWindow(element);
|
|
936
631
|
const offsetBy = { height: scrollY, width: scrollX };
|
|
937
|
-
for (const dir in dirs
|
|
938
|
-
for (const prop of dirs
|
|
632
|
+
for (const dir in dirs) {
|
|
633
|
+
for (const prop of dirs[dir]) {
|
|
939
634
|
currentOffset[prop] += offsetBy[dir];
|
|
940
635
|
}
|
|
941
636
|
}
|
|
@@ -973,21 +668,6 @@
|
|
|
973
668
|
left: left - toFloat(css(element, "marginLeft"))
|
|
974
669
|
};
|
|
975
670
|
}
|
|
976
|
-
function offsetPosition(element) {
|
|
977
|
-
element = toNode(element);
|
|
978
|
-
const offset2 = [element.offsetTop, element.offsetLeft];
|
|
979
|
-
while (element = element.offsetParent) {
|
|
980
|
-
offset2[0] += element.offsetTop + toFloat(css(element, `borderTopWidth`));
|
|
981
|
-
offset2[1] += element.offsetLeft + toFloat(css(element, `borderLeftWidth`));
|
|
982
|
-
if (css(element, "position") === "fixed") {
|
|
983
|
-
const win = toWindow(element);
|
|
984
|
-
offset2[0] += win.scrollY;
|
|
985
|
-
offset2[1] += win.scrollX;
|
|
986
|
-
return offset2;
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
return offset2;
|
|
990
|
-
}
|
|
991
671
|
const height = dimension("height");
|
|
992
672
|
const width = dimension("width");
|
|
993
673
|
function dimension(prop) {
|
|
@@ -1016,136 +696,11 @@
|
|
|
1016
696
|
}
|
|
1017
697
|
function boxModelAdjust(element, prop, sizing = "border-box") {
|
|
1018
698
|
return css(element, "boxSizing") === sizing ? sumBy(
|
|
1019
|
-
dirs
|
|
699
|
+
dirs[prop].map(ucfirst),
|
|
1020
700
|
(prop2) => toFloat(css(element, `padding${prop2}`)) + toFloat(css(element, `border${prop2}Width`))
|
|
1021
701
|
) : 0;
|
|
1022
702
|
}
|
|
1023
|
-
function flipPosition(pos) {
|
|
1024
|
-
for (const dir in dirs$1) {
|
|
1025
|
-
for (const i in dirs$1[dir]) {
|
|
1026
|
-
if (dirs$1[dir][i] === pos) {
|
|
1027
|
-
return dirs$1[dir][1 - i];
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
return pos;
|
|
1032
|
-
}
|
|
1033
|
-
function toPx(value, property = "width", element = window, offsetDim = false) {
|
|
1034
|
-
if (!isString(value)) {
|
|
1035
|
-
return toFloat(value);
|
|
1036
|
-
}
|
|
1037
|
-
return sumBy(parseCalc(value), (value2) => {
|
|
1038
|
-
const unit = parseUnit(value2);
|
|
1039
|
-
return unit ? percent(
|
|
1040
|
-
unit === "vh" ? getViewportHeight() : unit === "vw" ? width(toWindow(element)) : offsetDim ? element[`offset${ucfirst(property)}`] : dimensions(element)[property],
|
|
1041
|
-
value2
|
|
1042
|
-
) : value2;
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
|
|
1046
|
-
const parseCalc = memoize((calc) => calc.toString().replace(/\s/g, "").match(calcRe) || []);
|
|
1047
|
-
const unitRe = /(?:v[hw]|%)$/;
|
|
1048
|
-
const parseUnit = memoize((str) => (str.match(unitRe) || [])[0]);
|
|
1049
|
-
function percent(base, value) {
|
|
1050
|
-
return base * toFloat(value) / 100;
|
|
1051
|
-
}
|
|
1052
|
-
let vh;
|
|
1053
|
-
let vhEl;
|
|
1054
|
-
function getViewportHeight() {
|
|
1055
|
-
if (vh) {
|
|
1056
|
-
return vh;
|
|
1057
|
-
}
|
|
1058
|
-
if (!vhEl) {
|
|
1059
|
-
vhEl = $("<div>");
|
|
1060
|
-
css(vhEl, {
|
|
1061
|
-
height: "100vh",
|
|
1062
|
-
position: "fixed"
|
|
1063
|
-
});
|
|
1064
|
-
on(window, "resize", () => vh = null);
|
|
1065
|
-
}
|
|
1066
|
-
append(document.body, vhEl);
|
|
1067
|
-
vh = vhEl.clientHeight;
|
|
1068
|
-
remove$1(vhEl);
|
|
1069
|
-
return vh;
|
|
1070
|
-
}
|
|
1071
703
|
|
|
1072
|
-
function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
1073
|
-
if (!isVisible(element)) {
|
|
1074
|
-
return false;
|
|
1075
|
-
}
|
|
1076
|
-
return intersectRect(
|
|
1077
|
-
...overflowParents(element).map((parent) => {
|
|
1078
|
-
const { top, left, bottom, right } = offsetViewport(parent);
|
|
1079
|
-
return {
|
|
1080
|
-
top: top - offsetTop,
|
|
1081
|
-
left: left - offsetLeft,
|
|
1082
|
-
bottom: bottom + offsetTop,
|
|
1083
|
-
right: right + offsetLeft
|
|
1084
|
-
};
|
|
1085
|
-
}).concat(offset(element))
|
|
1086
|
-
);
|
|
1087
|
-
}
|
|
1088
|
-
function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
1089
|
-
const parents2 = isVisible(element) ? scrollParents(element, false, ["hidden"]) : [];
|
|
1090
|
-
return parents2.reduce(
|
|
1091
|
-
(fn, scrollElement, i) => {
|
|
1092
|
-
const { scrollTop, scrollHeight, offsetHeight } = scrollElement;
|
|
1093
|
-
const viewport = offsetViewport(scrollElement);
|
|
1094
|
-
const maxScroll = scrollHeight - viewport.height;
|
|
1095
|
-
const { height: elHeight, top: elTop } = parents2[i - 1] ? offsetViewport(parents2[i - 1]) : offset(element);
|
|
1096
|
-
let top = Math.ceil(elTop - viewport.top - offsetBy + scrollTop);
|
|
1097
|
-
if (offsetBy > 0 && offsetHeight < elHeight + offsetBy) {
|
|
1098
|
-
top += offsetBy;
|
|
1099
|
-
} else {
|
|
1100
|
-
offsetBy = 0;
|
|
1101
|
-
}
|
|
1102
|
-
if (top > maxScroll) {
|
|
1103
|
-
offsetBy -= top - maxScroll;
|
|
1104
|
-
top = maxScroll;
|
|
1105
|
-
} else if (top < 0) {
|
|
1106
|
-
offsetBy -= top;
|
|
1107
|
-
top = 0;
|
|
1108
|
-
}
|
|
1109
|
-
return () => scrollTo(scrollElement, top - scrollTop).then(fn);
|
|
1110
|
-
},
|
|
1111
|
-
() => Promise.resolve()
|
|
1112
|
-
)();
|
|
1113
|
-
function scrollTo(element2, top) {
|
|
1114
|
-
return new Promise((resolve) => {
|
|
1115
|
-
const scroll = element2.scrollTop;
|
|
1116
|
-
const duration = getDuration(Math.abs(top));
|
|
1117
|
-
const start = Date.now();
|
|
1118
|
-
(function step() {
|
|
1119
|
-
const percent = ease(clamp((Date.now() - start) / duration));
|
|
1120
|
-
element2.scrollTop = scroll + top * percent;
|
|
1121
|
-
if (percent === 1) {
|
|
1122
|
-
resolve();
|
|
1123
|
-
} else {
|
|
1124
|
-
requestAnimationFrame(step);
|
|
1125
|
-
}
|
|
1126
|
-
})();
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
function getDuration(dist) {
|
|
1130
|
-
return 40 * Math.pow(dist, 0.375);
|
|
1131
|
-
}
|
|
1132
|
-
function ease(k) {
|
|
1133
|
-
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
function scrolledOver(element, startOffset = 0, endOffset = 0) {
|
|
1137
|
-
if (!isVisible(element)) {
|
|
1138
|
-
return 0;
|
|
1139
|
-
}
|
|
1140
|
-
const [scrollElement] = scrollParents(element, true);
|
|
1141
|
-
const { scrollHeight, scrollTop } = scrollElement;
|
|
1142
|
-
const { height: viewportHeight } = offsetViewport(scrollElement);
|
|
1143
|
-
const maxScroll = scrollHeight - viewportHeight;
|
|
1144
|
-
const elementOffsetTop = offsetPosition(element)[0] - offsetPosition(scrollElement)[0];
|
|
1145
|
-
const start = Math.max(0, elementOffsetTop - viewportHeight + startOffset);
|
|
1146
|
-
const end = Math.min(maxScroll, elementOffsetTop + element.offsetHeight - endOffset);
|
|
1147
|
-
return clamp((scrollTop - start) / (end - start));
|
|
1148
|
-
}
|
|
1149
704
|
function scrollParents(element, scrollable = false, props = []) {
|
|
1150
705
|
const scrollEl = scrollingElement(element);
|
|
1151
706
|
let ancestors = parents(element).reverse();
|
|
@@ -1160,9 +715,6 @@
|
|
|
1160
715
|
)
|
|
1161
716
|
).reverse();
|
|
1162
717
|
}
|
|
1163
|
-
function overflowParents(element) {
|
|
1164
|
-
return scrollParents(element, false, ["hidden", "clip"]);
|
|
1165
|
-
}
|
|
1166
718
|
function offsetViewport(scrollElement) {
|
|
1167
719
|
const window = toWindow(scrollElement);
|
|
1168
720
|
const {
|
|
@@ -1204,7 +756,7 @@
|
|
|
1204
756
|
el,
|
|
1205
757
|
"touchmove",
|
|
1206
758
|
(e) => {
|
|
1207
|
-
if (e.targetTouches.length !== 1) {
|
|
759
|
+
if (e.targetTouches.length !== 1 || matches(e.target, 'input[type="range"')) {
|
|
1208
760
|
return;
|
|
1209
761
|
}
|
|
1210
762
|
let [{ scrollHeight, clientHeight }] = scrollParents(e.target);
|
|
@@ -1252,7 +804,7 @@
|
|
|
1252
804
|
},
|
|
1253
805
|
computed: {
|
|
1254
806
|
panel({ selPanel }, $el) {
|
|
1255
|
-
return
|
|
807
|
+
return util.$(selPanel, $el);
|
|
1256
808
|
},
|
|
1257
809
|
transitionElement() {
|
|
1258
810
|
return this.panel;
|
|
@@ -1262,13 +814,13 @@
|
|
|
1262
814
|
}
|
|
1263
815
|
},
|
|
1264
816
|
connected() {
|
|
1265
|
-
|
|
817
|
+
util.attr(this.panel || this.$el, "role", this.role);
|
|
1266
818
|
if (this.overlay) {
|
|
1267
|
-
|
|
819
|
+
util.attr(this.panel || this.$el, "aria-modal", true);
|
|
1268
820
|
}
|
|
1269
821
|
},
|
|
1270
822
|
beforeDisconnect() {
|
|
1271
|
-
if (
|
|
823
|
+
if (util.includes(active, this)) {
|
|
1272
824
|
this.toggleElement(this.$el, false, false);
|
|
1273
825
|
}
|
|
1274
826
|
},
|
|
@@ -1281,9 +833,9 @@
|
|
|
1281
833
|
handler(e) {
|
|
1282
834
|
const { current, defaultPrevented } = e;
|
|
1283
835
|
const { hash } = current;
|
|
1284
|
-
if (!defaultPrevented && hash &&
|
|
836
|
+
if (!defaultPrevented && hash && util.isSameSiteAnchor(current) && !util.within(hash, this.$el) && util.$(hash, document.body)) {
|
|
1285
837
|
this.hide();
|
|
1286
|
-
} else if (
|
|
838
|
+
} else if (util.matches(current, this.selClose)) {
|
|
1287
839
|
e.preventDefault();
|
|
1288
840
|
this.hide();
|
|
1289
841
|
}
|
|
@@ -1297,7 +849,7 @@
|
|
|
1297
849
|
return;
|
|
1298
850
|
}
|
|
1299
851
|
e.preventDefault();
|
|
1300
|
-
if (this.isToggled() ===
|
|
852
|
+
if (this.isToggled() === util.includes(active, this)) {
|
|
1301
853
|
this.toggle();
|
|
1302
854
|
}
|
|
1303
855
|
}
|
|
@@ -1306,7 +858,7 @@
|
|
|
1306
858
|
name: "beforeshow",
|
|
1307
859
|
self: true,
|
|
1308
860
|
handler(e) {
|
|
1309
|
-
if (
|
|
861
|
+
if (util.includes(active, this)) {
|
|
1310
862
|
return false;
|
|
1311
863
|
}
|
|
1312
864
|
if (!this.stack && active.length) {
|
|
@@ -1322,7 +874,7 @@
|
|
|
1322
874
|
self: true,
|
|
1323
875
|
handler() {
|
|
1324
876
|
if (this.stack) {
|
|
1325
|
-
|
|
877
|
+
util.css(this.$el, "zIndex", util.toFloat(util.css(this.$el, "zIndex")) + active.length);
|
|
1326
878
|
}
|
|
1327
879
|
const handlers = [
|
|
1328
880
|
this.overlay && preventBackgroundFocus(this),
|
|
@@ -1330,23 +882,23 @@
|
|
|
1330
882
|
this.bgClose && listenForBackgroundClose(this),
|
|
1331
883
|
this.escClose && listenForEscClose(this)
|
|
1332
884
|
];
|
|
1333
|
-
|
|
885
|
+
util.once(
|
|
1334
886
|
this.$el,
|
|
1335
887
|
"hidden",
|
|
1336
888
|
() => handlers.forEach((handler) => handler && handler()),
|
|
1337
889
|
{ self: true }
|
|
1338
890
|
);
|
|
1339
|
-
|
|
891
|
+
util.addClass(document.documentElement, this.clsPage);
|
|
1340
892
|
}
|
|
1341
893
|
},
|
|
1342
894
|
{
|
|
1343
895
|
name: "shown",
|
|
1344
896
|
self: true,
|
|
1345
897
|
handler() {
|
|
1346
|
-
if (!
|
|
1347
|
-
|
|
898
|
+
if (!util.isFocusable(this.$el)) {
|
|
899
|
+
util.attr(this.$el, "tabindex", "-1");
|
|
1348
900
|
}
|
|
1349
|
-
if (!
|
|
901
|
+
if (!util.matches(this.$el, ":focus-within")) {
|
|
1350
902
|
this.$el.focus();
|
|
1351
903
|
}
|
|
1352
904
|
}
|
|
@@ -1355,12 +907,12 @@
|
|
|
1355
907
|
name: "hidden",
|
|
1356
908
|
self: true,
|
|
1357
909
|
handler() {
|
|
1358
|
-
if (
|
|
910
|
+
if (util.includes(active, this)) {
|
|
1359
911
|
active.splice(active.indexOf(this), 1);
|
|
1360
912
|
}
|
|
1361
|
-
|
|
913
|
+
util.css(this.$el, "zIndex", "");
|
|
1362
914
|
if (!active.some((modal) => modal.clsPage === this.clsPage)) {
|
|
1363
|
-
|
|
915
|
+
util.removeClass(document.documentElement, this.clsPage);
|
|
1364
916
|
}
|
|
1365
917
|
}
|
|
1366
918
|
}
|
|
@@ -1370,31 +922,31 @@
|
|
|
1370
922
|
return this.isToggled() ? this.hide() : this.show();
|
|
1371
923
|
},
|
|
1372
924
|
show() {
|
|
1373
|
-
if (this.container &&
|
|
1374
|
-
|
|
925
|
+
if (this.container && util.parent(this.$el) !== this.container) {
|
|
926
|
+
util.append(this.container, this.$el);
|
|
1375
927
|
return new Promise(
|
|
1376
928
|
(resolve) => requestAnimationFrame(() => this.show().then(resolve))
|
|
1377
929
|
);
|
|
1378
930
|
}
|
|
1379
|
-
return this.toggleElement(this.$el, true, animate
|
|
931
|
+
return this.toggleElement(this.$el, true, animate);
|
|
1380
932
|
},
|
|
1381
933
|
hide() {
|
|
1382
|
-
return this.toggleElement(this.$el, false, animate
|
|
934
|
+
return this.toggleElement(this.$el, false, animate);
|
|
1383
935
|
}
|
|
1384
936
|
}
|
|
1385
937
|
};
|
|
1386
|
-
function animate
|
|
938
|
+
function animate(el, show, { transitionElement, _toggle }) {
|
|
1387
939
|
return new Promise(
|
|
1388
|
-
(resolve, reject) =>
|
|
940
|
+
(resolve, reject) => util.once(el, "show hide", () => {
|
|
1389
941
|
var _a;
|
|
1390
942
|
(_a = el._reject) == null ? void 0 : _a.call(el);
|
|
1391
943
|
el._reject = reject;
|
|
1392
944
|
_toggle(el, show);
|
|
1393
|
-
const off =
|
|
945
|
+
const off = util.once(
|
|
1394
946
|
transitionElement,
|
|
1395
947
|
"transitionstart",
|
|
1396
948
|
() => {
|
|
1397
|
-
|
|
949
|
+
util.once(transitionElement, "transitionend transitioncancel", resolve, {
|
|
1398
950
|
self: true
|
|
1399
951
|
});
|
|
1400
952
|
clearTimeout(timer);
|
|
@@ -1404,30 +956,30 @@
|
|
|
1404
956
|
const timer = setTimeout(() => {
|
|
1405
957
|
off();
|
|
1406
958
|
resolve();
|
|
1407
|
-
}, toMs(
|
|
959
|
+
}, toMs(util.css(transitionElement, "transitionDuration")));
|
|
1408
960
|
})
|
|
1409
961
|
).then(() => delete el._reject);
|
|
1410
962
|
}
|
|
1411
963
|
function toMs(time) {
|
|
1412
|
-
return time ?
|
|
964
|
+
return time ? util.endsWith(time, "ms") ? util.toFloat(time) : util.toFloat(time) * 1e3 : 0;
|
|
1413
965
|
}
|
|
1414
966
|
function preventBackgroundFocus(modal) {
|
|
1415
|
-
return
|
|
1416
|
-
if (
|
|
967
|
+
return util.on(document, "focusin", (e) => {
|
|
968
|
+
if (util.last(active) === modal && !util.within(e.target, modal.$el)) {
|
|
1417
969
|
modal.$el.focus();
|
|
1418
970
|
}
|
|
1419
971
|
});
|
|
1420
972
|
}
|
|
1421
973
|
function listenForBackgroundClose(modal) {
|
|
1422
|
-
return
|
|
1423
|
-
if (
|
|
974
|
+
return util.on(document, util.pointerDown, ({ target }) => {
|
|
975
|
+
if (util.last(active) !== modal || modal.overlay && !util.within(target, modal.$el) || util.within(target, modal.panel)) {
|
|
1424
976
|
return;
|
|
1425
977
|
}
|
|
1426
|
-
|
|
978
|
+
util.once(
|
|
1427
979
|
document,
|
|
1428
|
-
`${
|
|
980
|
+
`${util.pointerUp} ${util.pointerCancel} scroll`,
|
|
1429
981
|
({ defaultPrevented, type, target: newTarget }) => {
|
|
1430
|
-
if (!defaultPrevented && type ===
|
|
982
|
+
if (!defaultPrevented && type === util.pointerUp && target === newTarget) {
|
|
1431
983
|
modal.hide();
|
|
1432
984
|
}
|
|
1433
985
|
},
|
|
@@ -1436,51 +988,51 @@
|
|
|
1436
988
|
});
|
|
1437
989
|
}
|
|
1438
990
|
function listenForEscClose(modal) {
|
|
1439
|
-
return
|
|
1440
|
-
if (e.keyCode === 27 &&
|
|
991
|
+
return util.on(document, "keydown", (e) => {
|
|
992
|
+
if (e.keyCode === 27 && util.last(active) === modal) {
|
|
1441
993
|
modal.hide();
|
|
1442
994
|
}
|
|
1443
995
|
});
|
|
1444
996
|
}
|
|
1445
997
|
|
|
1446
998
|
function Transitioner(prev, next, dir, { animation, easing }) {
|
|
1447
|
-
const { percent, translate, show =
|
|
999
|
+
const { percent, translate, show = util.noop } = animation;
|
|
1448
1000
|
const props = show(dir);
|
|
1449
|
-
const deferred = new
|
|
1001
|
+
const deferred = new util.Deferred();
|
|
1450
1002
|
return {
|
|
1451
1003
|
dir,
|
|
1452
1004
|
show(duration, percent2 = 0, linear) {
|
|
1453
1005
|
const timing = linear ? "linear" : easing;
|
|
1454
|
-
duration -= Math.round(duration *
|
|
1006
|
+
duration -= Math.round(duration * util.clamp(percent2, -1, 1));
|
|
1455
1007
|
this.translate(percent2);
|
|
1456
1008
|
triggerUpdate(next, "itemin", { percent: percent2, duration, timing, dir });
|
|
1457
1009
|
triggerUpdate(prev, "itemout", { percent: 1 - percent2, duration, timing, dir });
|
|
1458
1010
|
Promise.all([
|
|
1459
|
-
|
|
1460
|
-
|
|
1011
|
+
util.Transition.start(next, props[1], duration, timing),
|
|
1012
|
+
util.Transition.start(prev, props[0], duration, timing)
|
|
1461
1013
|
]).then(() => {
|
|
1462
1014
|
this.reset();
|
|
1463
1015
|
deferred.resolve();
|
|
1464
|
-
},
|
|
1016
|
+
}, util.noop);
|
|
1465
1017
|
return deferred.promise;
|
|
1466
1018
|
},
|
|
1467
1019
|
cancel() {
|
|
1468
|
-
|
|
1020
|
+
util.Transition.cancel([next, prev]);
|
|
1469
1021
|
},
|
|
1470
1022
|
reset() {
|
|
1471
1023
|
for (const prop in props[0]) {
|
|
1472
|
-
|
|
1024
|
+
util.css([next, prev], prop, "");
|
|
1473
1025
|
}
|
|
1474
1026
|
},
|
|
1475
1027
|
forward(duration, percent2 = this.percent()) {
|
|
1476
|
-
|
|
1028
|
+
util.Transition.cancel([next, prev]);
|
|
1477
1029
|
return this.show(duration, percent2, true);
|
|
1478
1030
|
},
|
|
1479
1031
|
translate(percent2) {
|
|
1480
1032
|
this.reset();
|
|
1481
1033
|
const props2 = translate(percent2, dir);
|
|
1482
|
-
|
|
1483
|
-
|
|
1034
|
+
util.css(next, props2[1]);
|
|
1035
|
+
util.css(prev, props2[0]);
|
|
1484
1036
|
triggerUpdate(next, "itemtranslatein", { percent: percent2, dir });
|
|
1485
1037
|
triggerUpdate(prev, "itemtranslateout", { percent: 1 - percent2, dir });
|
|
1486
1038
|
},
|
|
@@ -1493,7 +1045,7 @@
|
|
|
1493
1045
|
};
|
|
1494
1046
|
}
|
|
1495
1047
|
function triggerUpdate(el, type, data) {
|
|
1496
|
-
|
|
1048
|
+
util.trigger(el, util.createEvent(type, false, false, data));
|
|
1497
1049
|
}
|
|
1498
1050
|
|
|
1499
1051
|
var I18n = {
|
|
@@ -1527,999 +1079,11 @@
|
|
|
1527
1079
|
DOWN: 40
|
|
1528
1080
|
};
|
|
1529
1081
|
|
|
1530
|
-
function addClass(element, ...args) {
|
|
1531
|
-
apply(element, args, "add");
|
|
1532
|
-
}
|
|
1533
|
-
function removeClass(element, ...args) {
|
|
1534
|
-
apply(element, args, "remove");
|
|
1535
|
-
}
|
|
1536
|
-
function removeClasses(element, cls) {
|
|
1537
|
-
attr(
|
|
1538
|
-
element,
|
|
1539
|
-
"class",
|
|
1540
|
-
(value) => (value || "").replace(new RegExp(`\\b${cls}\\b\\s?`, "g"), "")
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
function replaceClass(element, ...args) {
|
|
1544
|
-
args[0] && removeClass(element, args[0]);
|
|
1545
|
-
args[1] && addClass(element, args[1]);
|
|
1546
|
-
}
|
|
1547
|
-
function hasClass(element, cls) {
|
|
1548
|
-
[cls] = getClasses(cls);
|
|
1549
|
-
return !!cls && toNodes(element).some((node) => node.classList.contains(cls));
|
|
1550
|
-
}
|
|
1551
|
-
function toggleClass(element, cls, force) {
|
|
1552
|
-
const classes = getClasses(cls);
|
|
1553
|
-
if (!isUndefined(force)) {
|
|
1554
|
-
force = !!force;
|
|
1555
|
-
}
|
|
1556
|
-
for (const node of toNodes(element)) {
|
|
1557
|
-
for (const cls2 of classes) {
|
|
1558
|
-
node.classList.toggle(cls2, force);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
function apply(element, args, fn) {
|
|
1563
|
-
args = args.reduce((args2, arg) => args2.concat(getClasses(arg)), []);
|
|
1564
|
-
for (const node of toNodes(element)) {
|
|
1565
|
-
node.classList[fn](...args);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
function getClasses(str) {
|
|
1569
|
-
return String(str).split(/[ ,]/).filter(Boolean);
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
function transition(element, props, duration = 400, timing = "linear") {
|
|
1573
|
-
duration = Math.round(duration);
|
|
1574
|
-
return Promise.all(
|
|
1575
|
-
toNodes(element).map(
|
|
1576
|
-
(element2) => new Promise((resolve, reject) => {
|
|
1577
|
-
for (const name in props) {
|
|
1578
|
-
const value = css(element2, name);
|
|
1579
|
-
if (value === "") {
|
|
1580
|
-
css(element2, name, value);
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
const timer = setTimeout(() => trigger(element2, "transitionend"), duration);
|
|
1584
|
-
once(
|
|
1585
|
-
element2,
|
|
1586
|
-
"transitionend transitioncanceled",
|
|
1587
|
-
({ type }) => {
|
|
1588
|
-
clearTimeout(timer);
|
|
1589
|
-
removeClass(element2, "uk-transition");
|
|
1590
|
-
css(element2, {
|
|
1591
|
-
transitionProperty: "",
|
|
1592
|
-
transitionDuration: "",
|
|
1593
|
-
transitionTimingFunction: ""
|
|
1594
|
-
});
|
|
1595
|
-
type === "transitioncanceled" ? reject() : resolve(element2);
|
|
1596
|
-
},
|
|
1597
|
-
{ self: true }
|
|
1598
|
-
);
|
|
1599
|
-
addClass(element2, "uk-transition");
|
|
1600
|
-
css(element2, {
|
|
1601
|
-
transitionProperty: Object.keys(props).map(propName).join(","),
|
|
1602
|
-
transitionDuration: `${duration}ms`,
|
|
1603
|
-
transitionTimingFunction: timing,
|
|
1604
|
-
...props
|
|
1605
|
-
});
|
|
1606
|
-
})
|
|
1607
|
-
)
|
|
1608
|
-
);
|
|
1609
|
-
}
|
|
1610
|
-
const Transition = {
|
|
1611
|
-
start: transition,
|
|
1612
|
-
async stop(element) {
|
|
1613
|
-
trigger(element, "transitionend");
|
|
1614
|
-
await Promise.resolve();
|
|
1615
|
-
},
|
|
1616
|
-
async cancel(element) {
|
|
1617
|
-
trigger(element, "transitioncanceled");
|
|
1618
|
-
await Promise.resolve();
|
|
1619
|
-
},
|
|
1620
|
-
inProgress(element) {
|
|
1621
|
-
return hasClass(element, "uk-transition");
|
|
1622
|
-
}
|
|
1623
|
-
};
|
|
1624
|
-
const animationPrefix = "uk-animation-";
|
|
1625
|
-
function animate(element, animation, duration = 200, origin, out) {
|
|
1626
|
-
return Promise.all(
|
|
1627
|
-
toNodes(element).map(
|
|
1628
|
-
(element2) => new Promise((resolve, reject) => {
|
|
1629
|
-
trigger(element2, "animationcanceled");
|
|
1630
|
-
const timer = setTimeout(() => trigger(element2, "animationend"), duration);
|
|
1631
|
-
once(
|
|
1632
|
-
element2,
|
|
1633
|
-
"animationend animationcanceled",
|
|
1634
|
-
({ type }) => {
|
|
1635
|
-
clearTimeout(timer);
|
|
1636
|
-
type === "animationcanceled" ? reject() : resolve(element2);
|
|
1637
|
-
css(element2, "animationDuration", "");
|
|
1638
|
-
removeClasses(element2, `${animationPrefix}\\S*`);
|
|
1639
|
-
},
|
|
1640
|
-
{ self: true }
|
|
1641
|
-
);
|
|
1642
|
-
css(element2, "animationDuration", `${duration}ms`);
|
|
1643
|
-
addClass(element2, animation, animationPrefix + (out ? "leave" : "enter"));
|
|
1644
|
-
if (startsWith(animation, animationPrefix)) {
|
|
1645
|
-
origin && addClass(element2, `uk-transform-origin-${origin}`);
|
|
1646
|
-
out && addClass(element2, `${animationPrefix}reverse`);
|
|
1647
|
-
}
|
|
1648
|
-
})
|
|
1649
|
-
)
|
|
1650
|
-
);
|
|
1651
|
-
}
|
|
1652
|
-
const inProgressRe = new RegExp(`${animationPrefix}(enter|leave)`);
|
|
1653
|
-
const Animation = {
|
|
1654
|
-
in: animate,
|
|
1655
|
-
out(element, animation, duration, origin) {
|
|
1656
|
-
return animate(element, animation, duration, origin, true);
|
|
1657
|
-
},
|
|
1658
|
-
inProgress(element) {
|
|
1659
|
-
return inProgressRe.test(attr(element, "class"));
|
|
1660
|
-
},
|
|
1661
|
-
cancel(element) {
|
|
1662
|
-
trigger(element, "animationcanceled");
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
|
|
1666
|
-
const inBrowser = typeof window !== "undefined";
|
|
1667
|
-
const isRtl = inBrowser && document.dir === "rtl";
|
|
1668
|
-
const hasTouch = inBrowser && "ontouchstart" in window;
|
|
1669
|
-
const hasPointerEvents = inBrowser && window.PointerEvent;
|
|
1670
|
-
const pointerDown$1 = hasPointerEvents ? "pointerdown" : hasTouch ? "touchstart" : "mousedown";
|
|
1671
|
-
const pointerMove$1 = hasPointerEvents ? "pointermove" : hasTouch ? "touchmove" : "mousemove";
|
|
1672
|
-
const pointerUp$1 = hasPointerEvents ? "pointerup" : hasTouch ? "touchend" : "mouseup";
|
|
1673
|
-
const pointerEnter = hasPointerEvents ? "pointerenter" : hasTouch ? "" : "mouseenter";
|
|
1674
|
-
const pointerLeave = hasPointerEvents ? "pointerleave" : hasTouch ? "" : "mouseleave";
|
|
1675
|
-
const pointerCancel = hasPointerEvents ? "pointercancel" : "touchcancel";
|
|
1676
|
-
|
|
1677
|
-
const fastdom = {
|
|
1678
|
-
reads: [],
|
|
1679
|
-
writes: [],
|
|
1680
|
-
read(task) {
|
|
1681
|
-
this.reads.push(task);
|
|
1682
|
-
scheduleFlush();
|
|
1683
|
-
return task;
|
|
1684
|
-
},
|
|
1685
|
-
write(task) {
|
|
1686
|
-
this.writes.push(task);
|
|
1687
|
-
scheduleFlush();
|
|
1688
|
-
return task;
|
|
1689
|
-
},
|
|
1690
|
-
clear(task) {
|
|
1691
|
-
remove(this.reads, task);
|
|
1692
|
-
remove(this.writes, task);
|
|
1693
|
-
},
|
|
1694
|
-
flush
|
|
1695
|
-
};
|
|
1696
|
-
function flush(recursion) {
|
|
1697
|
-
runTasks(fastdom.reads);
|
|
1698
|
-
runTasks(fastdom.writes.splice(0));
|
|
1699
|
-
fastdom.scheduled = false;
|
|
1700
|
-
if (fastdom.reads.length || fastdom.writes.length) {
|
|
1701
|
-
scheduleFlush(recursion + 1);
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
const RECURSION_LIMIT = 4;
|
|
1705
|
-
function scheduleFlush(recursion) {
|
|
1706
|
-
if (fastdom.scheduled) {
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
fastdom.scheduled = true;
|
|
1710
|
-
if (recursion && recursion < RECURSION_LIMIT) {
|
|
1711
|
-
Promise.resolve().then(() => flush(recursion));
|
|
1712
|
-
} else {
|
|
1713
|
-
requestAnimationFrame(() => flush(1));
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
function runTasks(tasks) {
|
|
1717
|
-
let task;
|
|
1718
|
-
while (task = tasks.shift()) {
|
|
1719
|
-
try {
|
|
1720
|
-
task();
|
|
1721
|
-
} catch (e) {
|
|
1722
|
-
console.error(e);
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
function remove(array, item) {
|
|
1727
|
-
const index = array.indexOf(item);
|
|
1728
|
-
return ~index && array.splice(index, 1);
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
function MouseTracker() {
|
|
1732
|
-
}
|
|
1733
|
-
MouseTracker.prototype = {
|
|
1734
|
-
positions: [],
|
|
1735
|
-
init() {
|
|
1736
|
-
this.positions = [];
|
|
1737
|
-
let position;
|
|
1738
|
-
this.unbind = on(document, "mousemove", (e) => position = getEventPos(e));
|
|
1739
|
-
this.interval = setInterval(() => {
|
|
1740
|
-
if (!position) {
|
|
1741
|
-
return;
|
|
1742
|
-
}
|
|
1743
|
-
this.positions.push(position);
|
|
1744
|
-
if (this.positions.length > 5) {
|
|
1745
|
-
this.positions.shift();
|
|
1746
|
-
}
|
|
1747
|
-
}, 50);
|
|
1748
|
-
},
|
|
1749
|
-
cancel() {
|
|
1750
|
-
var _a;
|
|
1751
|
-
(_a = this.unbind) == null ? void 0 : _a.call(this);
|
|
1752
|
-
clearInterval(this.interval);
|
|
1753
|
-
},
|
|
1754
|
-
movesTo(target) {
|
|
1755
|
-
if (this.positions.length < 2) {
|
|
1756
|
-
return false;
|
|
1757
|
-
}
|
|
1758
|
-
const p = target.getBoundingClientRect();
|
|
1759
|
-
const { left, right, top, bottom } = p;
|
|
1760
|
-
const [prevPosition] = this.positions;
|
|
1761
|
-
const position = last(this.positions);
|
|
1762
|
-
const path = [prevPosition, position];
|
|
1763
|
-
if (pointInRect(position, p)) {
|
|
1764
|
-
return false;
|
|
1765
|
-
}
|
|
1766
|
-
const diagonals = [
|
|
1767
|
-
[
|
|
1768
|
-
{ x: left, y: top },
|
|
1769
|
-
{ x: right, y: bottom }
|
|
1770
|
-
],
|
|
1771
|
-
[
|
|
1772
|
-
{ x: left, y: bottom },
|
|
1773
|
-
{ x: right, y: top }
|
|
1774
|
-
]
|
|
1775
|
-
];
|
|
1776
|
-
return diagonals.some((diagonal) => {
|
|
1777
|
-
const intersection = intersect(path, diagonal);
|
|
1778
|
-
return intersection && pointInRect(intersection, p);
|
|
1779
|
-
});
|
|
1780
|
-
}
|
|
1781
|
-
};
|
|
1782
|
-
function intersect([{ x: x1, y: y1 }, { x: x2, y: y2 }], [{ x: x3, y: y3 }, { x: x4, y: y4 }]) {
|
|
1783
|
-
const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
|
|
1784
|
-
if (denominator === 0) {
|
|
1785
|
-
return false;
|
|
1786
|
-
}
|
|
1787
|
-
const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
|
|
1788
|
-
if (ua < 0) {
|
|
1789
|
-
return false;
|
|
1790
|
-
}
|
|
1791
|
-
return { x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1) };
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
function observeIntersection(targets, cb, options = {}, intersecting = true) {
|
|
1795
|
-
const observer = new IntersectionObserver(
|
|
1796
|
-
intersecting ? (entries, observer2) => {
|
|
1797
|
-
if (entries.some((entry) => entry.isIntersecting)) {
|
|
1798
|
-
cb(entries, observer2);
|
|
1799
|
-
}
|
|
1800
|
-
} : cb,
|
|
1801
|
-
options
|
|
1802
|
-
);
|
|
1803
|
-
for (const el of toNodes(targets)) {
|
|
1804
|
-
observer.observe(el);
|
|
1805
|
-
}
|
|
1806
|
-
return observer;
|
|
1807
|
-
}
|
|
1808
|
-
const hasResizeObserver = inBrowser && window.ResizeObserver;
|
|
1809
|
-
function observeResize(targets, cb, options = { box: "border-box" }) {
|
|
1810
|
-
if (hasResizeObserver) {
|
|
1811
|
-
return observe$1(ResizeObserver, targets, cb, options);
|
|
1812
|
-
}
|
|
1813
|
-
initResizeListener();
|
|
1814
|
-
listeners.add(cb);
|
|
1815
|
-
return {
|
|
1816
|
-
observe: noop,
|
|
1817
|
-
unobserve: noop,
|
|
1818
|
-
disconnect() {
|
|
1819
|
-
listeners.delete(cb);
|
|
1820
|
-
}
|
|
1821
|
-
};
|
|
1822
|
-
}
|
|
1823
|
-
let listeners;
|
|
1824
|
-
function initResizeListener() {
|
|
1825
|
-
if (listeners) {
|
|
1826
|
-
return;
|
|
1827
|
-
}
|
|
1828
|
-
listeners = /* @__PURE__ */ new Set();
|
|
1829
|
-
let pendingResize;
|
|
1830
|
-
const handleResize = () => {
|
|
1831
|
-
if (pendingResize) {
|
|
1832
|
-
return;
|
|
1833
|
-
}
|
|
1834
|
-
pendingResize = true;
|
|
1835
|
-
requestAnimationFrame(() => pendingResize = false);
|
|
1836
|
-
for (const listener of listeners) {
|
|
1837
|
-
listener();
|
|
1838
|
-
}
|
|
1839
|
-
};
|
|
1840
|
-
on(window, "load resize", handleResize);
|
|
1841
|
-
on(document, "loadedmetadata load", handleResize, true);
|
|
1842
|
-
}
|
|
1843
|
-
function observeMutation(targets, cb, options) {
|
|
1844
|
-
return observe$1(MutationObserver, targets, cb, options);
|
|
1845
|
-
}
|
|
1846
|
-
function observe$1(Observer, targets, cb, options) {
|
|
1847
|
-
const observer = new Observer(cb);
|
|
1848
|
-
for (const el of toNodes(targets)) {
|
|
1849
|
-
observer.observe(el, options);
|
|
1850
|
-
}
|
|
1851
|
-
return observer;
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
function play(el) {
|
|
1855
|
-
if (isIFrame(el)) {
|
|
1856
|
-
call(el, { func: "playVideo", method: "play" });
|
|
1857
|
-
}
|
|
1858
|
-
if (isHTML5(el)) {
|
|
1859
|
-
try {
|
|
1860
|
-
el.play().catch(noop);
|
|
1861
|
-
} catch (e) {
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
function pause(el) {
|
|
1866
|
-
if (isIFrame(el)) {
|
|
1867
|
-
call(el, { func: "pauseVideo", method: "pause" });
|
|
1868
|
-
}
|
|
1869
|
-
if (isHTML5(el)) {
|
|
1870
|
-
el.pause();
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
function mute(el) {
|
|
1874
|
-
if (isIFrame(el)) {
|
|
1875
|
-
call(el, { func: "mute", method: "setVolume", value: 0 });
|
|
1876
|
-
}
|
|
1877
|
-
if (isHTML5(el)) {
|
|
1878
|
-
el.muted = true;
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
function isVideo(el) {
|
|
1882
|
-
return isHTML5(el) || isIFrame(el);
|
|
1883
|
-
}
|
|
1884
|
-
function isHTML5(el) {
|
|
1885
|
-
return isTag(el, "video");
|
|
1886
|
-
}
|
|
1887
|
-
function isIFrame(el) {
|
|
1888
|
-
return isTag(el, "iframe") && (isYoutube(el) || isVimeo(el));
|
|
1889
|
-
}
|
|
1890
|
-
function isYoutube(el) {
|
|
1891
|
-
return !!el.src.match(
|
|
1892
|
-
/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/
|
|
1893
|
-
);
|
|
1894
|
-
}
|
|
1895
|
-
function isVimeo(el) {
|
|
1896
|
-
return !!el.src.match(/vimeo\.com\/video\/.*/);
|
|
1897
|
-
}
|
|
1898
|
-
async function call(el, cmd) {
|
|
1899
|
-
await enableApi(el);
|
|
1900
|
-
post(el, cmd);
|
|
1901
|
-
}
|
|
1902
|
-
function post(el, cmd) {
|
|
1903
|
-
try {
|
|
1904
|
-
el.contentWindow.postMessage(JSON.stringify({ event: "command", ...cmd }), "*");
|
|
1905
|
-
} catch (e) {
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
const stateKey = "_ukPlayer";
|
|
1909
|
-
let counter = 0;
|
|
1910
|
-
function enableApi(el) {
|
|
1911
|
-
if (el[stateKey]) {
|
|
1912
|
-
return el[stateKey];
|
|
1913
|
-
}
|
|
1914
|
-
const youtube = isYoutube(el);
|
|
1915
|
-
const vimeo = isVimeo(el);
|
|
1916
|
-
const id = ++counter;
|
|
1917
|
-
let poller;
|
|
1918
|
-
return el[stateKey] = new Promise((resolve) => {
|
|
1919
|
-
youtube && once(el, "load", () => {
|
|
1920
|
-
const listener = () => post(el, { event: "listening", id });
|
|
1921
|
-
poller = setInterval(listener, 100);
|
|
1922
|
-
listener();
|
|
1923
|
-
});
|
|
1924
|
-
once(window, "message", resolve, false, ({ data }) => {
|
|
1925
|
-
try {
|
|
1926
|
-
data = JSON.parse(data);
|
|
1927
|
-
return youtube && (data == null ? void 0 : data.id) === id && data.event === "onReady" || vimeo && Number(data == null ? void 0 : data.player_id) === id;
|
|
1928
|
-
} catch (e) {
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
1931
|
-
el.src = `${el.src}${includes(el.src, "?") ? "&" : "?"}${youtube ? "enablejsapi=1" : `api=1&player_id=${id}`}`;
|
|
1932
|
-
}).then(() => clearInterval(poller));
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
const dirs = [
|
|
1936
|
-
["width", "x", "left", "right"],
|
|
1937
|
-
["height", "y", "top", "bottom"]
|
|
1938
|
-
];
|
|
1939
|
-
function positionAt(element, target, options) {
|
|
1940
|
-
options = {
|
|
1941
|
-
attach: {
|
|
1942
|
-
element: ["left", "top"],
|
|
1943
|
-
target: ["left", "top"],
|
|
1944
|
-
...options.attach
|
|
1945
|
-
},
|
|
1946
|
-
offset: [0, 0],
|
|
1947
|
-
placement: [],
|
|
1948
|
-
...options
|
|
1949
|
-
};
|
|
1950
|
-
if (!isArray(target)) {
|
|
1951
|
-
target = [target, target];
|
|
1952
|
-
}
|
|
1953
|
-
offset(element, getPosition(element, target, options));
|
|
1954
|
-
}
|
|
1955
|
-
function getPosition(element, target, options) {
|
|
1956
|
-
const position = attachTo(element, target, options);
|
|
1957
|
-
const { boundary, viewportOffset = 0, placement } = options;
|
|
1958
|
-
let offsetPosition = position;
|
|
1959
|
-
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
1960
|
-
const viewport = getViewport(element, target[i], viewportOffset, boundary, i);
|
|
1961
|
-
if (isWithin(position, viewport, i)) {
|
|
1962
|
-
continue;
|
|
1963
|
-
}
|
|
1964
|
-
let offsetBy = 0;
|
|
1965
|
-
if (placement[i] === "flip") {
|
|
1966
|
-
const attach = options.attach.target[i];
|
|
1967
|
-
if (attach === end && position[end] <= viewport[end] || attach === start && position[start] >= viewport[start]) {
|
|
1968
|
-
continue;
|
|
1969
|
-
}
|
|
1970
|
-
offsetBy = flip(element, target, options, i)[start] - position[start];
|
|
1971
|
-
const scrollArea = getScrollArea(element, target[i], viewportOffset, i);
|
|
1972
|
-
if (!isWithin(applyOffset(position, offsetBy, i), scrollArea, i)) {
|
|
1973
|
-
if (isWithin(position, scrollArea, i)) {
|
|
1974
|
-
continue;
|
|
1975
|
-
}
|
|
1976
|
-
if (options.recursion) {
|
|
1977
|
-
return false;
|
|
1978
|
-
}
|
|
1979
|
-
const newPos = flipAxis(element, target, options);
|
|
1980
|
-
if (newPos && isWithin(newPos, scrollArea, 1 - i)) {
|
|
1981
|
-
return newPos;
|
|
1982
|
-
}
|
|
1983
|
-
continue;
|
|
1984
|
-
}
|
|
1985
|
-
} else if (placement[i] === "shift") {
|
|
1986
|
-
const targetDim = offset(target[i]);
|
|
1987
|
-
const { offset: elOffset } = options;
|
|
1988
|
-
offsetBy = clamp(
|
|
1989
|
-
clamp(position[start], viewport[start], viewport[end] - position[prop]),
|
|
1990
|
-
targetDim[start] - position[prop] + elOffset[i],
|
|
1991
|
-
targetDim[end] - elOffset[i]
|
|
1992
|
-
) - position[start];
|
|
1993
|
-
}
|
|
1994
|
-
offsetPosition = applyOffset(offsetPosition, offsetBy, i);
|
|
1995
|
-
}
|
|
1996
|
-
return offsetPosition;
|
|
1997
|
-
}
|
|
1998
|
-
function attachTo(element, target, options) {
|
|
1999
|
-
let { attach, offset: offsetBy } = {
|
|
2000
|
-
attach: {
|
|
2001
|
-
element: ["left", "top"],
|
|
2002
|
-
target: ["left", "top"],
|
|
2003
|
-
...options.attach
|
|
2004
|
-
},
|
|
2005
|
-
offset: [0, 0],
|
|
2006
|
-
...options
|
|
2007
|
-
};
|
|
2008
|
-
let elOffset = offset(element);
|
|
2009
|
-
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
2010
|
-
const targetOffset = attach.target[i] === attach.element[i] ? offsetViewport(target[i]) : offset(target[i]);
|
|
2011
|
-
elOffset = applyOffset(
|
|
2012
|
-
elOffset,
|
|
2013
|
-
targetOffset[start] - elOffset[start] + moveBy(attach.target[i], end, targetOffset[prop]) - moveBy(attach.element[i], end, elOffset[prop]) + +offsetBy[i],
|
|
2014
|
-
i
|
|
2015
|
-
);
|
|
2016
|
-
}
|
|
2017
|
-
return elOffset;
|
|
2018
|
-
}
|
|
2019
|
-
function applyOffset(position, offset2, i) {
|
|
2020
|
-
const [, dir, start, end] = dirs[i];
|
|
2021
|
-
const newPos = { ...position };
|
|
2022
|
-
newPos[start] = position[dir] = position[start] + offset2;
|
|
2023
|
-
newPos[end] += offset2;
|
|
2024
|
-
return newPos;
|
|
2025
|
-
}
|
|
2026
|
-
function moveBy(attach, end, dim) {
|
|
2027
|
-
return attach === "center" ? dim / 2 : attach === end ? dim : 0;
|
|
2028
|
-
}
|
|
2029
|
-
function getViewport(element, target, viewportOffset, boundary, i) {
|
|
2030
|
-
let viewport = getIntersectionArea(...commonScrollParents(element, target).map(offsetViewport));
|
|
2031
|
-
if (viewportOffset) {
|
|
2032
|
-
viewport[dirs[i][2]] += viewportOffset;
|
|
2033
|
-
viewport[dirs[i][3]] -= viewportOffset;
|
|
2034
|
-
}
|
|
2035
|
-
if (boundary) {
|
|
2036
|
-
viewport = getIntersectionArea(
|
|
2037
|
-
viewport,
|
|
2038
|
-
offset(isArray(boundary) ? boundary[i] : boundary)
|
|
2039
|
-
);
|
|
2040
|
-
}
|
|
2041
|
-
return viewport;
|
|
2042
|
-
}
|
|
2043
|
-
function getScrollArea(element, target, viewportOffset, i) {
|
|
2044
|
-
const [prop, axis, start, end] = dirs[i];
|
|
2045
|
-
const [scrollElement] = commonScrollParents(element, target);
|
|
2046
|
-
const viewport = offsetViewport(scrollElement);
|
|
2047
|
-
if (["auto", "scroll"].includes(css(scrollElement, `overflow-${axis}`))) {
|
|
2048
|
-
viewport[start] -= scrollElement[`scroll${ucfirst(start)}`];
|
|
2049
|
-
viewport[end] = viewport[start] + scrollElement[`scroll${ucfirst(prop)}`];
|
|
2050
|
-
}
|
|
2051
|
-
viewport[start] += viewportOffset;
|
|
2052
|
-
viewport[end] -= viewportOffset;
|
|
2053
|
-
return viewport;
|
|
2054
|
-
}
|
|
2055
|
-
function commonScrollParents(element, target) {
|
|
2056
|
-
return overflowParents(target).filter((parent) => within(element, parent));
|
|
2057
|
-
}
|
|
2058
|
-
function getIntersectionArea(...rects) {
|
|
2059
|
-
let area = {};
|
|
2060
|
-
for (const rect of rects) {
|
|
2061
|
-
for (const [, , start, end] of dirs) {
|
|
2062
|
-
area[start] = Math.max(area[start] || 0, rect[start]);
|
|
2063
|
-
area[end] = Math.min(...[area[end], rect[end]].filter(Boolean));
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
return area;
|
|
2067
|
-
}
|
|
2068
|
-
function isWithin(positionA, positionB, i) {
|
|
2069
|
-
const [, , start, end] = dirs[i];
|
|
2070
|
-
return positionA[start] >= positionB[start] && positionA[end] <= positionB[end];
|
|
2071
|
-
}
|
|
2072
|
-
function flip(element, target, { offset: offset2, attach }, i) {
|
|
2073
|
-
return attachTo(element, target, {
|
|
2074
|
-
attach: {
|
|
2075
|
-
element: flipAttach(attach.element, i),
|
|
2076
|
-
target: flipAttach(attach.target, i)
|
|
2077
|
-
},
|
|
2078
|
-
offset: flipOffset(offset2, i)
|
|
2079
|
-
});
|
|
2080
|
-
}
|
|
2081
|
-
function flipAxis(element, target, options) {
|
|
2082
|
-
return getPosition(element, target, {
|
|
2083
|
-
...options,
|
|
2084
|
-
attach: {
|
|
2085
|
-
element: options.attach.element.map(flipAttachAxis).reverse(),
|
|
2086
|
-
target: options.attach.target.map(flipAttachAxis).reverse()
|
|
2087
|
-
},
|
|
2088
|
-
offset: options.offset.reverse(),
|
|
2089
|
-
placement: options.placement.reverse(),
|
|
2090
|
-
recursion: true
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
function flipAttach(attach, i) {
|
|
2094
|
-
const newAttach = [...attach];
|
|
2095
|
-
const index = dirs[i].indexOf(attach[i]);
|
|
2096
|
-
if (~index) {
|
|
2097
|
-
newAttach[i] = dirs[i][1 - index % 2 + 2];
|
|
2098
|
-
}
|
|
2099
|
-
return newAttach;
|
|
2100
|
-
}
|
|
2101
|
-
function flipAttachAxis(prop) {
|
|
2102
|
-
for (let i = 0; i < dirs.length; i++) {
|
|
2103
|
-
const index = dirs[i].indexOf(prop);
|
|
2104
|
-
if (~index) {
|
|
2105
|
-
return dirs[1 - i][index % 2 + 2];
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
function flipOffset(offset2, i) {
|
|
2110
|
-
offset2 = [...offset2];
|
|
2111
|
-
offset2[i] *= -1;
|
|
2112
|
-
return offset2;
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
|
-
var util = /*#__PURE__*/Object.freeze({
|
|
2116
|
-
__proto__: null,
|
|
2117
|
-
$: $,
|
|
2118
|
-
$$: $$,
|
|
2119
|
-
Animation: Animation,
|
|
2120
|
-
Deferred: Deferred,
|
|
2121
|
-
Dimensions: Dimensions,
|
|
2122
|
-
MouseTracker: MouseTracker,
|
|
2123
|
-
Transition: Transition,
|
|
2124
|
-
addClass: addClass,
|
|
2125
|
-
after: after,
|
|
2126
|
-
append: append,
|
|
2127
|
-
apply: apply$1,
|
|
2128
|
-
assign: assign,
|
|
2129
|
-
attr: attr,
|
|
2130
|
-
before: before,
|
|
2131
|
-
boxModelAdjust: boxModelAdjust,
|
|
2132
|
-
camelize: camelize,
|
|
2133
|
-
children: children,
|
|
2134
|
-
clamp: clamp,
|
|
2135
|
-
closest: closest,
|
|
2136
|
-
createEvent: createEvent,
|
|
2137
|
-
css: css,
|
|
2138
|
-
data: data,
|
|
2139
|
-
dimensions: dimensions,
|
|
2140
|
-
each: each,
|
|
2141
|
-
empty: empty,
|
|
2142
|
-
endsWith: endsWith,
|
|
2143
|
-
escape: escape,
|
|
2144
|
-
fastdom: fastdom,
|
|
2145
|
-
filter: filter,
|
|
2146
|
-
find: find,
|
|
2147
|
-
findAll: findAll,
|
|
2148
|
-
findIndex: findIndex,
|
|
2149
|
-
flipPosition: flipPosition,
|
|
2150
|
-
fragment: fragment,
|
|
2151
|
-
getEventPos: getEventPos,
|
|
2152
|
-
getIndex: getIndex,
|
|
2153
|
-
getTargetedElement: getTargetedElement,
|
|
2154
|
-
hasAttr: hasAttr,
|
|
2155
|
-
hasClass: hasClass,
|
|
2156
|
-
hasOwn: hasOwn,
|
|
2157
|
-
hasTouch: hasTouch,
|
|
2158
|
-
height: height,
|
|
2159
|
-
html: html,
|
|
2160
|
-
hyphenate: hyphenate,
|
|
2161
|
-
inBrowser: inBrowser,
|
|
2162
|
-
includes: includes,
|
|
2163
|
-
index: index,
|
|
2164
|
-
intersectRect: intersectRect,
|
|
2165
|
-
isArray: isArray,
|
|
2166
|
-
isBoolean: isBoolean,
|
|
2167
|
-
isDocument: isDocument,
|
|
2168
|
-
isElement: isElement,
|
|
2169
|
-
isEmpty: isEmpty,
|
|
2170
|
-
isEqual: isEqual,
|
|
2171
|
-
isFocusable: isFocusable,
|
|
2172
|
-
isFunction: isFunction,
|
|
2173
|
-
isInView: isInView,
|
|
2174
|
-
isInput: isInput,
|
|
2175
|
-
isNode: isNode,
|
|
2176
|
-
isNumber: isNumber,
|
|
2177
|
-
isNumeric: isNumeric,
|
|
2178
|
-
isObject: isObject,
|
|
2179
|
-
isPlainObject: isPlainObject,
|
|
2180
|
-
isRtl: isRtl,
|
|
2181
|
-
isSameSiteAnchor: isSameSiteAnchor,
|
|
2182
|
-
isString: isString,
|
|
2183
|
-
isTag: isTag,
|
|
2184
|
-
isTouch: isTouch,
|
|
2185
|
-
isUndefined: isUndefined,
|
|
2186
|
-
isVideo: isVideo,
|
|
2187
|
-
isVisible: isVisible,
|
|
2188
|
-
isVoidElement: isVoidElement,
|
|
2189
|
-
isWindow: isWindow,
|
|
2190
|
-
last: last,
|
|
2191
|
-
matches: matches,
|
|
2192
|
-
memoize: memoize,
|
|
2193
|
-
mute: mute,
|
|
2194
|
-
noop: noop,
|
|
2195
|
-
observeIntersection: observeIntersection,
|
|
2196
|
-
observeMutation: observeMutation,
|
|
2197
|
-
observeResize: observeResize,
|
|
2198
|
-
off: off,
|
|
2199
|
-
offset: offset,
|
|
2200
|
-
offsetPosition: offsetPosition,
|
|
2201
|
-
offsetViewport: offsetViewport,
|
|
2202
|
-
on: on,
|
|
2203
|
-
once: once,
|
|
2204
|
-
overflowParents: overflowParents,
|
|
2205
|
-
parent: parent,
|
|
2206
|
-
parents: parents,
|
|
2207
|
-
pause: pause,
|
|
2208
|
-
pick: pick,
|
|
2209
|
-
play: play,
|
|
2210
|
-
pointInRect: pointInRect,
|
|
2211
|
-
pointerCancel: pointerCancel,
|
|
2212
|
-
pointerDown: pointerDown$1,
|
|
2213
|
-
pointerEnter: pointerEnter,
|
|
2214
|
-
pointerLeave: pointerLeave,
|
|
2215
|
-
pointerMove: pointerMove$1,
|
|
2216
|
-
pointerUp: pointerUp$1,
|
|
2217
|
-
position: position,
|
|
2218
|
-
positionAt: positionAt,
|
|
2219
|
-
prepend: prepend,
|
|
2220
|
-
propName: propName,
|
|
2221
|
-
query: query,
|
|
2222
|
-
queryAll: queryAll,
|
|
2223
|
-
ready: ready,
|
|
2224
|
-
remove: remove$1,
|
|
2225
|
-
removeAttr: removeAttr,
|
|
2226
|
-
removeClass: removeClass,
|
|
2227
|
-
removeClasses: removeClasses,
|
|
2228
|
-
replaceClass: replaceClass,
|
|
2229
|
-
scrollIntoView: scrollIntoView,
|
|
2230
|
-
scrollParents: scrollParents,
|
|
2231
|
-
scrolledOver: scrolledOver,
|
|
2232
|
-
selFocusable: selFocusable,
|
|
2233
|
-
selInput: selInput,
|
|
2234
|
-
sortBy: sortBy,
|
|
2235
|
-
startsWith: startsWith,
|
|
2236
|
-
sumBy: sumBy,
|
|
2237
|
-
swap: swap,
|
|
2238
|
-
toArray: toArray,
|
|
2239
|
-
toBoolean: toBoolean,
|
|
2240
|
-
toEventTargets: toEventTargets,
|
|
2241
|
-
toFloat: toFloat,
|
|
2242
|
-
toNode: toNode,
|
|
2243
|
-
toNodes: toNodes,
|
|
2244
|
-
toNumber: toNumber,
|
|
2245
|
-
toPx: toPx,
|
|
2246
|
-
toWindow: toWindow,
|
|
2247
|
-
toggleClass: toggleClass,
|
|
2248
|
-
trigger: trigger,
|
|
2249
|
-
ucfirst: ucfirst,
|
|
2250
|
-
uniqueBy: uniqueBy,
|
|
2251
|
-
unwrap: unwrap,
|
|
2252
|
-
width: width,
|
|
2253
|
-
within: within,
|
|
2254
|
-
wrapAll: wrapAll,
|
|
2255
|
-
wrapInner: wrapInner
|
|
2256
|
-
});
|
|
2257
|
-
|
|
2258
|
-
function initObservers(instance) {
|
|
2259
|
-
instance._observers = [];
|
|
2260
|
-
instance._observerUpdates = /* @__PURE__ */ new Map();
|
|
2261
|
-
for (const observer of instance.$options.observe || []) {
|
|
2262
|
-
if (hasOwn(observer, "handler")) {
|
|
2263
|
-
registerObservable(instance, observer);
|
|
2264
|
-
} else {
|
|
2265
|
-
for (const key in observer) {
|
|
2266
|
-
registerObservable(instance, observer[key], key);
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
function registerObserver(instance, ...observer) {
|
|
2272
|
-
instance._observers.push(...observer);
|
|
2273
|
-
}
|
|
2274
|
-
function disconnectObservers(instance) {
|
|
2275
|
-
for (const observer of instance._observers) {
|
|
2276
|
-
observer == null ? void 0 : observer.disconnect();
|
|
2277
|
-
instance._observerUpdates.delete(observer);
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
function callObserverUpdates(instance) {
|
|
2281
|
-
for (const [observer, update] of instance._observerUpdates) {
|
|
2282
|
-
update(observer);
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
function registerObservable(instance, observable, key) {
|
|
2286
|
-
let {
|
|
2287
|
-
observe,
|
|
2288
|
-
target = instance.$el,
|
|
2289
|
-
handler,
|
|
2290
|
-
options,
|
|
2291
|
-
filter,
|
|
2292
|
-
args
|
|
2293
|
-
} = isPlainObject(observable) ? observable : { type: key, handler: observable };
|
|
2294
|
-
if (filter && !filter.call(instance, instance)) {
|
|
2295
|
-
return;
|
|
2296
|
-
}
|
|
2297
|
-
const targets = isFunction(target) ? target.call(instance, instance) : target;
|
|
2298
|
-
handler = isString(handler) ? instance[handler] : handler.bind(instance);
|
|
2299
|
-
if (isFunction(options)) {
|
|
2300
|
-
options = options.call(instance, instance);
|
|
2301
|
-
}
|
|
2302
|
-
const observer = observe(targets, handler, options, args);
|
|
2303
|
-
if (isFunction(target) && isArray(targets) && observer.unobserve) {
|
|
2304
|
-
instance._observerUpdates.set(observer, watchChange(instance, target, targets));
|
|
2305
|
-
}
|
|
2306
|
-
registerObserver(instance, observer);
|
|
2307
|
-
}
|
|
2308
|
-
function watchChange(instance, targetFn, targets) {
|
|
2309
|
-
return (observer) => {
|
|
2310
|
-
const newTargets = targetFn.call(instance, instance);
|
|
2311
|
-
if (isEqual(targets, newTargets)) {
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
targets.forEach((target) => !includes(newTargets, target) && observer.unobserve(target));
|
|
2315
|
-
newTargets.forEach((target) => !includes(targets, target) && observer.observe(target));
|
|
2316
|
-
targets.splice(0, targets.length, ...newTargets);
|
|
2317
|
-
};
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
function callWatches(instance) {
|
|
2321
|
-
if (instance._watch) {
|
|
2322
|
-
return;
|
|
2323
|
-
}
|
|
2324
|
-
const initial = !hasOwn(instance, "_watch");
|
|
2325
|
-
instance._watch = fastdom.read(() => {
|
|
2326
|
-
if (instance._connected) {
|
|
2327
|
-
runWatches(instance, initial);
|
|
2328
|
-
}
|
|
2329
|
-
instance._watch = null;
|
|
2330
|
-
});
|
|
2331
|
-
}
|
|
2332
|
-
function runWatches(instance, initial) {
|
|
2333
|
-
const values = { ...instance._computed };
|
|
2334
|
-
instance._computed = {};
|
|
2335
|
-
for (const [key, { watch, immediate }] of Object.entries(instance.$options.computed || {})) {
|
|
2336
|
-
if (watch && (initial && immediate || hasOwn(values, key) && !isEqual(values[key], instance[key]))) {
|
|
2337
|
-
watch.call(instance, instance[key], initial ? void 0 : values[key]);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
callObserverUpdates(instance);
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
function callUpdate(instance, e = "update") {
|
|
2344
|
-
if (!instance._connected) {
|
|
2345
|
-
return;
|
|
2346
|
-
}
|
|
2347
|
-
if (e === "update" || e === "resize") {
|
|
2348
|
-
callWatches(instance);
|
|
2349
|
-
}
|
|
2350
|
-
if (!instance.$options.update) {
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
if (!instance._updates) {
|
|
2354
|
-
instance._updates = /* @__PURE__ */ new Set();
|
|
2355
|
-
fastdom.read(() => {
|
|
2356
|
-
if (instance._connected) {
|
|
2357
|
-
runUpdates(instance, instance._updates);
|
|
2358
|
-
}
|
|
2359
|
-
delete instance._updates;
|
|
2360
|
-
});
|
|
2361
|
-
}
|
|
2362
|
-
instance._updates.add(e.type || e);
|
|
2363
|
-
}
|
|
2364
|
-
function runUpdates(instance, types) {
|
|
2365
|
-
for (const { read, write, events = [] } of instance.$options.update) {
|
|
2366
|
-
if (!types.has("update") && !events.some((type) => types.has(type))) {
|
|
2367
|
-
continue;
|
|
2368
|
-
}
|
|
2369
|
-
let result;
|
|
2370
|
-
if (read) {
|
|
2371
|
-
result = read.call(instance, instance._data, types);
|
|
2372
|
-
if (result && isPlainObject(result)) {
|
|
2373
|
-
assign(instance._data, result);
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
if (write && result !== false) {
|
|
2377
|
-
fastdom.write(() => {
|
|
2378
|
-
if (instance._connected) {
|
|
2379
|
-
write.call(instance, instance._data, types);
|
|
2380
|
-
}
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
function initUpdateObserver(instance) {
|
|
2386
|
-
let { el, computed, observe } = instance.$options;
|
|
2387
|
-
if (!computed && !(observe == null ? void 0 : observe.some((options) => isFunction(options.target)))) {
|
|
2388
|
-
return;
|
|
2389
|
-
}
|
|
2390
|
-
for (const key in computed || {}) {
|
|
2391
|
-
if (computed[key].document) {
|
|
2392
|
-
el = el.ownerDocument;
|
|
2393
|
-
break;
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
const observer = new MutationObserver(() => callWatches(instance));
|
|
2397
|
-
observer.observe(el, {
|
|
2398
|
-
childList: true,
|
|
2399
|
-
subtree: true
|
|
2400
|
-
});
|
|
2401
|
-
registerObserver(instance, observer);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
function initEvents(instance) {
|
|
2405
|
-
instance._events = [];
|
|
2406
|
-
for (const event of instance.$options.events || []) {
|
|
2407
|
-
if (hasOwn(event, "handler")) {
|
|
2408
|
-
registerEvent(instance, event);
|
|
2409
|
-
} else {
|
|
2410
|
-
for (const key in event) {
|
|
2411
|
-
registerEvent(instance, event[key], key);
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
function unbindEvents(instance) {
|
|
2417
|
-
instance._events.forEach((unbind) => unbind());
|
|
2418
|
-
delete instance._events;
|
|
2419
|
-
}
|
|
2420
|
-
function registerEvent(instance, event, key) {
|
|
2421
|
-
let { name, el, handler, capture, passive, delegate, filter, self } = isPlainObject(event) ? event : { name: key, handler: event };
|
|
2422
|
-
el = isFunction(el) ? el.call(instance, instance) : el || instance.$el;
|
|
2423
|
-
if (isArray(el)) {
|
|
2424
|
-
el.forEach((el2) => registerEvent(instance, { ...event, el: el2 }, key));
|
|
2425
|
-
return;
|
|
2426
|
-
}
|
|
2427
|
-
if (!el || filter && !filter.call(instance)) {
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
instance._events.push(
|
|
2431
|
-
on(
|
|
2432
|
-
el,
|
|
2433
|
-
name,
|
|
2434
|
-
delegate ? isString(delegate) ? delegate : delegate.call(instance, instance) : null,
|
|
2435
|
-
isString(handler) ? instance[handler] : handler.bind(instance),
|
|
2436
|
-
{ passive, capture, self }
|
|
2437
|
-
)
|
|
2438
|
-
);
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
const strats = {};
|
|
2442
|
-
strats.events = strats.observe = strats.created = strats.beforeConnect = strats.connected = strats.beforeDisconnect = strats.disconnected = strats.destroy = concatStrat;
|
|
2443
|
-
strats.args = function(parentVal, childVal) {
|
|
2444
|
-
return childVal !== false && concatStrat(childVal || parentVal);
|
|
2445
|
-
};
|
|
2446
|
-
strats.update = function(parentVal, childVal) {
|
|
2447
|
-
return sortBy(
|
|
2448
|
-
concatStrat(parentVal, isFunction(childVal) ? { read: childVal } : childVal),
|
|
2449
|
-
"order"
|
|
2450
|
-
);
|
|
2451
|
-
};
|
|
2452
|
-
strats.props = function(parentVal, childVal) {
|
|
2453
|
-
if (isArray(childVal)) {
|
|
2454
|
-
const value = {};
|
|
2455
|
-
for (const key of childVal) {
|
|
2456
|
-
value[key] = String;
|
|
2457
|
-
}
|
|
2458
|
-
childVal = value;
|
|
2459
|
-
}
|
|
2460
|
-
return strats.methods(parentVal, childVal);
|
|
2461
|
-
};
|
|
2462
|
-
strats.computed = strats.methods = function(parentVal, childVal) {
|
|
2463
|
-
return childVal ? parentVal ? { ...parentVal, ...childVal } : childVal : parentVal;
|
|
2464
|
-
};
|
|
2465
|
-
strats.i18n = strats.data = function(parentVal, childVal, vm) {
|
|
2466
|
-
if (!vm) {
|
|
2467
|
-
if (!childVal) {
|
|
2468
|
-
return parentVal;
|
|
2469
|
-
}
|
|
2470
|
-
if (!parentVal) {
|
|
2471
|
-
return childVal;
|
|
2472
|
-
}
|
|
2473
|
-
return function(vm2) {
|
|
2474
|
-
return mergeFnData(parentVal, childVal, vm2);
|
|
2475
|
-
};
|
|
2476
|
-
}
|
|
2477
|
-
return mergeFnData(parentVal, childVal, vm);
|
|
2478
|
-
};
|
|
2479
|
-
function mergeFnData(parentVal, childVal, vm) {
|
|
2480
|
-
return strats.computed(
|
|
2481
|
-
isFunction(parentVal) ? parentVal.call(vm, vm) : parentVal,
|
|
2482
|
-
isFunction(childVal) ? childVal.call(vm, vm) : childVal
|
|
2483
|
-
);
|
|
2484
|
-
}
|
|
2485
|
-
function concatStrat(parentVal, childVal) {
|
|
2486
|
-
parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
|
|
2487
|
-
return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
|
|
2488
|
-
}
|
|
2489
|
-
function defaultStrat(parentVal, childVal) {
|
|
2490
|
-
return isUndefined(childVal) ? parentVal : childVal;
|
|
2491
|
-
}
|
|
2492
|
-
function mergeOptions(parent, child, vm) {
|
|
2493
|
-
const options = {};
|
|
2494
|
-
if (isFunction(child)) {
|
|
2495
|
-
child = child.options;
|
|
2496
|
-
}
|
|
2497
|
-
if (child.extends) {
|
|
2498
|
-
parent = mergeOptions(parent, child.extends, vm);
|
|
2499
|
-
}
|
|
2500
|
-
if (child.mixins) {
|
|
2501
|
-
for (const mixin of child.mixins) {
|
|
2502
|
-
parent = mergeOptions(parent, mixin, vm);
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
for (const key in parent) {
|
|
2506
|
-
mergeKey(key);
|
|
2507
|
-
}
|
|
2508
|
-
for (const key in child) {
|
|
2509
|
-
if (!hasOwn(parent, key)) {
|
|
2510
|
-
mergeKey(key);
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
function mergeKey(key) {
|
|
2514
|
-
options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
|
|
2515
|
-
}
|
|
2516
|
-
return options;
|
|
2517
|
-
}
|
|
2518
1082
|
function parseOptions(options, args = []) {
|
|
2519
1083
|
try {
|
|
2520
|
-
return options ? startsWith(options, "{") ? JSON.parse(options) : args.length && !includes(options, ":") ? { [args[0]]: options } : options.split(";").reduce((options2, option) => {
|
|
1084
|
+
return options ? util.startsWith(options, "{") ? JSON.parse(options) : args.length && !util.includes(options, ":") ? { [args[0]]: options } : options.split(";").reduce((options2, option) => {
|
|
2521
1085
|
const [key, value] = option.split(/:(.*)/);
|
|
2522
|
-
if (key && !isUndefined(value)) {
|
|
1086
|
+
if (key && !util.isUndefined(value)) {
|
|
2523
1087
|
options2[key.trim()] = value.trim();
|
|
2524
1088
|
}
|
|
2525
1089
|
return options2;
|
|
@@ -2528,365 +1092,13 @@
|
|
|
2528
1092
|
return {};
|
|
2529
1093
|
}
|
|
2530
1094
|
}
|
|
2531
|
-
function coerce(type, value) {
|
|
2532
|
-
if (type === Boolean) {
|
|
2533
|
-
return toBoolean(value);
|
|
2534
|
-
} else if (type === Number) {
|
|
2535
|
-
return toNumber(value);
|
|
2536
|
-
} else if (type === "list") {
|
|
2537
|
-
return toList(value);
|
|
2538
|
-
} else if (type === Object && isString(value)) {
|
|
2539
|
-
return parseOptions(value);
|
|
2540
|
-
}
|
|
2541
|
-
return type ? type(value) : value;
|
|
2542
|
-
}
|
|
2543
|
-
function toList(value) {
|
|
2544
|
-
return isArray(value) ? value : isString(value) ? value.split(/,(?![^(]*\))/).map((value2) => isNumeric(value2) ? toNumber(value2) : toBoolean(value2.trim())) : [value];
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
function initProps(instance) {
|
|
2548
|
-
const props = getProps(instance.$options);
|
|
2549
|
-
for (let key in props) {
|
|
2550
|
-
if (!isUndefined(props[key])) {
|
|
2551
|
-
instance.$props[key] = props[key];
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
const exclude = [instance.$options.computed, instance.$options.methods];
|
|
2555
|
-
for (let key in instance.$props) {
|
|
2556
|
-
if (key in props && notIn(exclude, key)) {
|
|
2557
|
-
instance[key] = instance.$props[key];
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
function getProps(opts) {
|
|
2562
|
-
const data$1 = {};
|
|
2563
|
-
const { args = [], props = {}, el, id } = opts;
|
|
2564
|
-
if (!props) {
|
|
2565
|
-
return data$1;
|
|
2566
|
-
}
|
|
2567
|
-
for (const key in props) {
|
|
2568
|
-
const prop = hyphenate(key);
|
|
2569
|
-
let value = data(el, prop);
|
|
2570
|
-
if (isUndefined(value)) {
|
|
2571
|
-
continue;
|
|
2572
|
-
}
|
|
2573
|
-
value = props[key] === Boolean && value === "" ? true : coerce(props[key], value);
|
|
2574
|
-
if (prop === "target" && startsWith(value, "_")) {
|
|
2575
|
-
continue;
|
|
2576
|
-
}
|
|
2577
|
-
data$1[key] = value;
|
|
2578
|
-
}
|
|
2579
|
-
const options = parseOptions(data(el, id), args);
|
|
2580
|
-
for (const key in options) {
|
|
2581
|
-
const prop = camelize(key);
|
|
2582
|
-
if (!isUndefined(props[prop])) {
|
|
2583
|
-
data$1[prop] = coerce(props[prop], options[key]);
|
|
2584
|
-
}
|
|
2585
|
-
}
|
|
2586
|
-
return data$1;
|
|
2587
|
-
}
|
|
2588
|
-
function notIn(options, key) {
|
|
2589
|
-
return options.every((arr) => !arr || !hasOwn(arr, key));
|
|
2590
|
-
}
|
|
2591
|
-
function initPropsObserver(instance) {
|
|
2592
|
-
const { $options, $props } = instance;
|
|
2593
|
-
const { id, attrs, props, el } = $options;
|
|
2594
|
-
if (!props || attrs === false) {
|
|
2595
|
-
return;
|
|
2596
|
-
}
|
|
2597
|
-
const attributes = isArray(attrs) ? attrs : Object.keys(props);
|
|
2598
|
-
const filter = attributes.map((key) => hyphenate(key)).concat(id);
|
|
2599
|
-
const observer = new MutationObserver((records) => {
|
|
2600
|
-
const data = getProps($options);
|
|
2601
|
-
if (records.some(({ attributeName }) => {
|
|
2602
|
-
const prop = attributeName.replace("data-", "");
|
|
2603
|
-
return (prop === id ? attributes : [camelize(prop), camelize(attributeName)]).some(
|
|
2604
|
-
(prop2) => !isUndefined(data[prop2]) && data[prop2] !== $props[prop2]
|
|
2605
|
-
);
|
|
2606
|
-
})) {
|
|
2607
|
-
instance.$reset();
|
|
2608
|
-
}
|
|
2609
|
-
});
|
|
2610
|
-
observer.observe(el, {
|
|
2611
|
-
attributes: true,
|
|
2612
|
-
attributeFilter: filter.concat(filter.map((key) => `data-${key}`))
|
|
2613
|
-
});
|
|
2614
|
-
registerObserver(instance, observer);
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
function callHook(instance, hook) {
|
|
2618
|
-
var _a;
|
|
2619
|
-
(_a = instance.$options[hook]) == null ? void 0 : _a.forEach((handler) => handler.call(instance));
|
|
2620
|
-
}
|
|
2621
|
-
function callConnected(instance) {
|
|
2622
|
-
if (instance._connected) {
|
|
2623
|
-
return;
|
|
2624
|
-
}
|
|
2625
|
-
instance._data = {};
|
|
2626
|
-
instance._computed = {};
|
|
2627
|
-
initProps(instance);
|
|
2628
|
-
callHook(instance, "beforeConnect");
|
|
2629
|
-
instance._connected = true;
|
|
2630
|
-
initEvents(instance);
|
|
2631
|
-
initObservers(instance);
|
|
2632
|
-
initPropsObserver(instance);
|
|
2633
|
-
initUpdateObserver(instance);
|
|
2634
|
-
callHook(instance, "connected");
|
|
2635
|
-
callUpdate(instance);
|
|
2636
|
-
}
|
|
2637
|
-
function callDisconnected(instance) {
|
|
2638
|
-
if (!instance._connected) {
|
|
2639
|
-
return;
|
|
2640
|
-
}
|
|
2641
|
-
callHook(instance, "beforeDisconnect");
|
|
2642
|
-
disconnectObservers(instance);
|
|
2643
|
-
unbindEvents(instance);
|
|
2644
|
-
callHook(instance, "disconnected");
|
|
2645
|
-
instance._connected = false;
|
|
2646
|
-
delete instance._watch;
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
function initComputed(instance) {
|
|
2650
|
-
const { computed } = instance.$options;
|
|
2651
|
-
instance._computed = {};
|
|
2652
|
-
if (computed) {
|
|
2653
|
-
for (const key in computed) {
|
|
2654
|
-
registerComputed(instance, key, computed[key]);
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
function registerComputed(instance, key, cb) {
|
|
2659
|
-
Object.defineProperty(instance, key, {
|
|
2660
|
-
enumerable: true,
|
|
2661
|
-
get() {
|
|
2662
|
-
const { _computed, $props, $el } = instance;
|
|
2663
|
-
if (!hasOwn(_computed, key)) {
|
|
2664
|
-
_computed[key] = (cb.get || cb).call(instance, $props, $el);
|
|
2665
|
-
}
|
|
2666
|
-
return _computed[key];
|
|
2667
|
-
},
|
|
2668
|
-
set(value) {
|
|
2669
|
-
const { _computed } = instance;
|
|
2670
|
-
_computed[key] = cb.set ? cb.set.call(instance, value) : value;
|
|
2671
|
-
if (isUndefined(_computed[key])) {
|
|
2672
|
-
delete _computed[key];
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
});
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
let uid = 0;
|
|
2679
|
-
function init(instance, options = {}) {
|
|
2680
|
-
options.data = normalizeData(options, instance.constructor.options);
|
|
2681
|
-
instance.$options = mergeOptions(instance.constructor.options, options, instance);
|
|
2682
|
-
instance.$props = {};
|
|
2683
|
-
instance._uid = uid++;
|
|
2684
|
-
initData(instance);
|
|
2685
|
-
initMethods(instance);
|
|
2686
|
-
initComputed(instance);
|
|
2687
|
-
callHook(instance, "created");
|
|
2688
|
-
if (options.el) {
|
|
2689
|
-
instance.$mount(options.el);
|
|
2690
|
-
}
|
|
2691
|
-
}
|
|
2692
|
-
function initData(instance) {
|
|
2693
|
-
const { data = {} } = instance.$options;
|
|
2694
|
-
for (const key in data) {
|
|
2695
|
-
instance.$props[key] = instance[key] = data[key];
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
function initMethods(instance) {
|
|
2699
|
-
const { methods } = instance.$options;
|
|
2700
|
-
if (methods) {
|
|
2701
|
-
for (const key in methods) {
|
|
2702
|
-
instance[key] = methods[key].bind(instance);
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
function normalizeData({ data = {} }, { args = [], props = {} }) {
|
|
2707
|
-
if (isArray(data)) {
|
|
2708
|
-
data = data.slice(0, args.length).reduce((data2, value, index) => {
|
|
2709
|
-
if (isPlainObject(value)) {
|
|
2710
|
-
assign(data2, value);
|
|
2711
|
-
} else {
|
|
2712
|
-
data2[args[index]] = value;
|
|
2713
|
-
}
|
|
2714
|
-
return data2;
|
|
2715
|
-
}, {});
|
|
2716
|
-
}
|
|
2717
|
-
for (const key in data) {
|
|
2718
|
-
if (isUndefined(data[key])) {
|
|
2719
|
-
delete data[key];
|
|
2720
|
-
} else if (props[key]) {
|
|
2721
|
-
data[key] = coerce(props[key], data[key]);
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
return data;
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
const App = function(options) {
|
|
2728
|
-
init(this, options);
|
|
2729
|
-
};
|
|
2730
|
-
App.util = util;
|
|
2731
|
-
App.options = {};
|
|
2732
|
-
App.version = "3.16.6-dev.7e4b0cb00";
|
|
2733
|
-
|
|
2734
|
-
const PREFIX = "uk-";
|
|
2735
|
-
const DATA = "__uikit__";
|
|
2736
|
-
const components = {};
|
|
2737
|
-
function component(name, options) {
|
|
2738
|
-
var _a;
|
|
2739
|
-
const id = PREFIX + hyphenate(name);
|
|
2740
|
-
if (!options) {
|
|
2741
|
-
if (isPlainObject(components[id])) {
|
|
2742
|
-
components[id] = App.extend(components[id]);
|
|
2743
|
-
}
|
|
2744
|
-
return components[id];
|
|
2745
|
-
}
|
|
2746
|
-
name = camelize(name);
|
|
2747
|
-
App[name] = (element, data) => createComponent(name, element, data);
|
|
2748
|
-
const opt = isPlainObject(options) ? { ...options } : options.options;
|
|
2749
|
-
opt.id = id;
|
|
2750
|
-
opt.name = name;
|
|
2751
|
-
(_a = opt.install) == null ? void 0 : _a.call(opt, App, opt, name);
|
|
2752
|
-
if (App._initialized && !opt.functional) {
|
|
2753
|
-
requestAnimationFrame(() => createComponent(name, `[${id}],[data-${id}]`));
|
|
2754
|
-
}
|
|
2755
|
-
return components[id] = opt;
|
|
2756
|
-
}
|
|
2757
|
-
function createComponent(name, element, data, ...args) {
|
|
2758
|
-
const Component = component(name);
|
|
2759
|
-
return Component.options.functional ? new Component({ data: isPlainObject(element) ? element : [element, data, ...args] }) : element ? $$(element).map(init)[0] : init();
|
|
2760
|
-
function init(element2) {
|
|
2761
|
-
const instance = getComponent(element2, name);
|
|
2762
|
-
if (instance) {
|
|
2763
|
-
if (data) {
|
|
2764
|
-
instance.$destroy();
|
|
2765
|
-
} else {
|
|
2766
|
-
return instance;
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
return new Component({ el: element2, data });
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
function getComponents(element) {
|
|
2773
|
-
return element[DATA] || {};
|
|
2774
|
-
}
|
|
2775
|
-
function getComponent(element, name) {
|
|
2776
|
-
return getComponents(element)[name];
|
|
2777
|
-
}
|
|
2778
|
-
function attachToElement(element, instance) {
|
|
2779
|
-
if (!element[DATA]) {
|
|
2780
|
-
element[DATA] = {};
|
|
2781
|
-
}
|
|
2782
|
-
element[DATA][instance.$options.name] = instance;
|
|
2783
|
-
}
|
|
2784
|
-
function detachFromElement(element, instance) {
|
|
2785
|
-
var _a;
|
|
2786
|
-
(_a = element[DATA]) == null ? true : delete _a[instance.$options.name];
|
|
2787
|
-
if (!isEmpty(element[DATA])) {
|
|
2788
|
-
delete element[DATA];
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
1095
|
|
|
2792
|
-
App.component = component;
|
|
2793
|
-
App.getComponents = getComponents;
|
|
2794
|
-
App.getComponent = getComponent;
|
|
2795
|
-
App.use = function(plugin) {
|
|
2796
|
-
if (plugin.installed) {
|
|
2797
|
-
return;
|
|
2798
|
-
}
|
|
2799
|
-
plugin.call(null, this);
|
|
2800
|
-
plugin.installed = true;
|
|
2801
|
-
return this;
|
|
2802
|
-
};
|
|
2803
|
-
App.mixin = function(mixin, component2) {
|
|
2804
|
-
component2 = (isString(component2) ? this.component(component2) : component2) || this;
|
|
2805
|
-
component2.options = mergeOptions(component2.options, mixin);
|
|
2806
|
-
};
|
|
2807
|
-
App.extend = function(options) {
|
|
2808
|
-
options = options || {};
|
|
2809
|
-
const Super = this;
|
|
2810
|
-
const Sub = function UIkitComponent(options2) {
|
|
2811
|
-
init(this, options2);
|
|
2812
|
-
};
|
|
2813
|
-
Sub.prototype = Object.create(Super.prototype);
|
|
2814
|
-
Sub.prototype.constructor = Sub;
|
|
2815
|
-
Sub.options = mergeOptions(Super.options, options);
|
|
2816
|
-
Sub.super = Super;
|
|
2817
|
-
Sub.extend = Super.extend;
|
|
2818
|
-
return Sub;
|
|
2819
|
-
};
|
|
2820
|
-
function update(element, e) {
|
|
2821
|
-
element = element ? toNode(element) : document.body;
|
|
2822
|
-
for (const parentEl of parents(element).reverse()) {
|
|
2823
|
-
updateElement(parentEl, e);
|
|
2824
|
-
}
|
|
2825
|
-
apply$1(element, (element2) => updateElement(element2, e));
|
|
2826
|
-
}
|
|
2827
|
-
App.update = update;
|
|
2828
|
-
function updateElement(element, e) {
|
|
2829
|
-
const components = getComponents(element);
|
|
2830
|
-
for (const name in components) {
|
|
2831
|
-
callUpdate(components[name], e);
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
let container;
|
|
2835
|
-
Object.defineProperty(App, "container", {
|
|
2836
|
-
get() {
|
|
2837
|
-
return container || document.body;
|
|
2838
|
-
},
|
|
2839
|
-
set(element) {
|
|
2840
|
-
container = $(element);
|
|
2841
|
-
}
|
|
2842
|
-
});
|
|
2843
|
-
|
|
2844
|
-
App.prototype.$mount = function(el) {
|
|
2845
|
-
const instance = this;
|
|
2846
|
-
attachToElement(el, instance);
|
|
2847
|
-
instance.$options.el = el;
|
|
2848
|
-
if (within(el, document)) {
|
|
2849
|
-
callConnected(instance);
|
|
2850
|
-
}
|
|
2851
|
-
};
|
|
2852
|
-
App.prototype.$destroy = function(removeEl = false) {
|
|
2853
|
-
const instance = this;
|
|
2854
|
-
const { el } = instance.$options;
|
|
2855
|
-
if (el) {
|
|
2856
|
-
callDisconnected(instance);
|
|
2857
|
-
}
|
|
2858
|
-
callHook(instance, "destroy");
|
|
2859
|
-
detachFromElement(el, instance);
|
|
2860
|
-
if (removeEl) {
|
|
2861
|
-
remove$1(instance.$el);
|
|
2862
|
-
}
|
|
2863
|
-
};
|
|
2864
|
-
App.prototype.$create = createComponent;
|
|
2865
|
-
App.prototype.$emit = function(e) {
|
|
2866
|
-
callUpdate(this, e);
|
|
2867
|
-
};
|
|
2868
|
-
App.prototype.$update = function(element = this.$el, e) {
|
|
2869
|
-
update(element, e);
|
|
2870
|
-
};
|
|
2871
|
-
App.prototype.$reset = function() {
|
|
2872
|
-
callDisconnected(this);
|
|
2873
|
-
callConnected(this);
|
|
2874
|
-
};
|
|
2875
|
-
App.prototype.$getComponent = getComponent;
|
|
2876
|
-
Object.defineProperties(App.prototype, {
|
|
2877
|
-
$el: {
|
|
2878
|
-
get() {
|
|
2879
|
-
return this.$options.el;
|
|
2880
|
-
}
|
|
2881
|
-
},
|
|
2882
|
-
$container: Object.getOwnPropertyDescriptor(App, "container")
|
|
2883
|
-
});
|
|
2884
1096
|
function generateId(instance, el = instance.$el, postfix = "") {
|
|
2885
1097
|
if (el.id) {
|
|
2886
1098
|
return el.id;
|
|
2887
1099
|
}
|
|
2888
1100
|
let id = `${instance.$options.id}-${instance._uid}${postfix}`;
|
|
2889
|
-
if (
|
|
1101
|
+
if (util.$(`#${id}`)) {
|
|
2890
1102
|
id = generateId(instance, el, `${postfix}-2`);
|
|
2891
1103
|
}
|
|
2892
1104
|
return id;
|
|
@@ -2905,10 +1117,10 @@
|
|
|
2905
1117
|
computed: {
|
|
2906
1118
|
nav: {
|
|
2907
1119
|
get({ selNav }, $el) {
|
|
2908
|
-
return
|
|
1120
|
+
return util.$(selNav, $el);
|
|
2909
1121
|
},
|
|
2910
1122
|
watch(nav, prev) {
|
|
2911
|
-
|
|
1123
|
+
util.attr(nav, "role", "tablist");
|
|
2912
1124
|
if (prev) {
|
|
2913
1125
|
this.$emit();
|
|
2914
1126
|
}
|
|
@@ -2920,7 +1132,7 @@
|
|
|
2920
1132
|
},
|
|
2921
1133
|
navItems: {
|
|
2922
1134
|
get(_, $el) {
|
|
2923
|
-
return
|
|
1135
|
+
return util.$$(this.selNavItem, $el);
|
|
2924
1136
|
},
|
|
2925
1137
|
watch() {
|
|
2926
1138
|
this.$emit();
|
|
@@ -2928,32 +1140,35 @@
|
|
|
2928
1140
|
}
|
|
2929
1141
|
},
|
|
2930
1142
|
connected() {
|
|
2931
|
-
|
|
1143
|
+
util.attr(this.$el, {
|
|
1144
|
+
role: "region",
|
|
1145
|
+
ariaRoleDescription: "carousel"
|
|
1146
|
+
});
|
|
2932
1147
|
},
|
|
2933
1148
|
update: [
|
|
2934
1149
|
{
|
|
2935
1150
|
write() {
|
|
2936
1151
|
this.slides.forEach(
|
|
2937
|
-
(slide, i) =>
|
|
1152
|
+
(slide, i) => util.attr(slide, {
|
|
2938
1153
|
role: this.nav ? "tabpanel" : "group",
|
|
2939
1154
|
"aria-label": this.t("slideLabel", i + 1, this.length),
|
|
2940
1155
|
"aria-roledescription": this.nav ? null : "slide"
|
|
2941
1156
|
})
|
|
2942
1157
|
);
|
|
2943
1158
|
if (this.nav && this.length !== this.nav.children.length) {
|
|
2944
|
-
|
|
1159
|
+
util.html(
|
|
2945
1160
|
this.nav,
|
|
2946
1161
|
this.slides.map((_, i) => `<li ${this.attrItem}="${i}"><a href></a></li>`).join("")
|
|
2947
1162
|
);
|
|
2948
1163
|
}
|
|
2949
|
-
|
|
1164
|
+
util.attr(util.children(this.nav).concat(this.list), "role", "presentation");
|
|
2950
1165
|
for (const el of this.navItems) {
|
|
2951
|
-
const cmd =
|
|
2952
|
-
const button =
|
|
1166
|
+
const cmd = util.data(el, this.attrItem);
|
|
1167
|
+
const button = util.$("a,button", el) || el;
|
|
2953
1168
|
let ariaLabel;
|
|
2954
1169
|
let ariaControls = null;
|
|
2955
|
-
if (
|
|
2956
|
-
const item =
|
|
1170
|
+
if (util.isNumeric(cmd)) {
|
|
1171
|
+
const item = util.toNumber(cmd);
|
|
2957
1172
|
const slide = this.slides[item];
|
|
2958
1173
|
if (slide) {
|
|
2959
1174
|
if (!slide.id) {
|
|
@@ -2961,8 +1176,8 @@
|
|
|
2961
1176
|
}
|
|
2962
1177
|
ariaControls = slide.id;
|
|
2963
1178
|
}
|
|
2964
|
-
ariaLabel = this.t("slideX",
|
|
2965
|
-
|
|
1179
|
+
ariaLabel = this.t("slideX", util.toFloat(cmd) + 1);
|
|
1180
|
+
util.attr(button, "role", "tab");
|
|
2966
1181
|
} else {
|
|
2967
1182
|
if (this.list) {
|
|
2968
1183
|
if (!this.list.id) {
|
|
@@ -2972,9 +1187,9 @@
|
|
|
2972
1187
|
}
|
|
2973
1188
|
ariaLabel = this.t(cmd);
|
|
2974
1189
|
}
|
|
2975
|
-
|
|
1190
|
+
util.attr(button, {
|
|
2976
1191
|
"aria-controls": ariaControls,
|
|
2977
|
-
"aria-label":
|
|
1192
|
+
"aria-label": util.attr(button, "aria-label") || ariaLabel
|
|
2978
1193
|
});
|
|
2979
1194
|
}
|
|
2980
1195
|
}
|
|
@@ -2994,9 +1209,9 @@
|
|
|
2994
1209
|
return this.selNavItem;
|
|
2995
1210
|
},
|
|
2996
1211
|
handler(e) {
|
|
2997
|
-
if (
|
|
1212
|
+
if (util.closest(e.target, "a,button") && (e.type === "click" || e.keyCode === keyMap.SPACE)) {
|
|
2998
1213
|
e.preventDefault();
|
|
2999
|
-
this.show(
|
|
1214
|
+
this.show(util.data(e.current, this.attrItem));
|
|
3000
1215
|
}
|
|
3001
1216
|
}
|
|
3002
1217
|
},
|
|
@@ -3011,8 +1226,8 @@
|
|
|
3011
1226
|
},
|
|
3012
1227
|
handler(e) {
|
|
3013
1228
|
const { current, keyCode } = e;
|
|
3014
|
-
const cmd =
|
|
3015
|
-
if (!
|
|
1229
|
+
const cmd = util.data(current, this.attrItem);
|
|
1230
|
+
if (!util.isNumeric(cmd)) {
|
|
3016
1231
|
return;
|
|
3017
1232
|
}
|
|
3018
1233
|
let i = keyCode === keyMap.HOME ? 0 : keyCode === keyMap.END ? "last" : keyCode === keyMap.LEFT ? "previous" : keyCode === keyMap.RIGHT ? "next" : -1;
|
|
@@ -3029,22 +1244,22 @@
|
|
|
3029
1244
|
let focus;
|
|
3030
1245
|
let focusEl;
|
|
3031
1246
|
for (const el of this.navItems) {
|
|
3032
|
-
const cmd =
|
|
3033
|
-
const button =
|
|
3034
|
-
if (
|
|
3035
|
-
const item =
|
|
1247
|
+
const cmd = util.data(el, this.attrItem);
|
|
1248
|
+
const button = util.$("a,button", el) || el;
|
|
1249
|
+
if (util.isNumeric(cmd)) {
|
|
1250
|
+
const item = util.toNumber(cmd);
|
|
3036
1251
|
const active = item === index;
|
|
3037
|
-
|
|
3038
|
-
|
|
1252
|
+
util.toggleClass(el, this.clsActive, active);
|
|
1253
|
+
util.attr(button, {
|
|
3039
1254
|
"aria-selected": active,
|
|
3040
1255
|
tabindex: active ? null : -1
|
|
3041
1256
|
});
|
|
3042
1257
|
if (active) {
|
|
3043
1258
|
focusEl = button;
|
|
3044
1259
|
}
|
|
3045
|
-
focus = focus ||
|
|
1260
|
+
focus = focus || util.matches(button, ":focus");
|
|
3046
1261
|
} else {
|
|
3047
|
-
|
|
1262
|
+
util.toggleClass(
|
|
3048
1263
|
el,
|
|
3049
1264
|
"uk-invisible",
|
|
3050
1265
|
this.finite && (cmd === "previous" && index === 0 || cmd === "next" && index >= this.maxIndex)
|
|
@@ -3075,7 +1290,7 @@
|
|
|
3075
1290
|
for (const key of ["start", "move", "end"]) {
|
|
3076
1291
|
const fn = this[key];
|
|
3077
1292
|
this[key] = (e) => {
|
|
3078
|
-
const pos =
|
|
1293
|
+
const pos = util.getEventPos(e).x * (util.isRtl ? -1 : 1);
|
|
3079
1294
|
this.prevPos = pos === this.pos ? this.prevPos : this.pos;
|
|
3080
1295
|
this.pos = pos;
|
|
3081
1296
|
fn(e);
|
|
@@ -3090,7 +1305,7 @@
|
|
|
3090
1305
|
return `${this.selList} > *`;
|
|
3091
1306
|
},
|
|
3092
1307
|
handler(e) {
|
|
3093
|
-
if (!this.draggable || !
|
|
1308
|
+
if (!this.draggable || !util.isTouch(e) && hasSelectableText(e.target) || util.closest(e.target, util.selInput) || e.button > 0 || this.length < 2) {
|
|
3094
1309
|
return;
|
|
3095
1310
|
}
|
|
3096
1311
|
this.start(e);
|
|
@@ -3108,7 +1323,7 @@
|
|
|
3108
1323
|
el() {
|
|
3109
1324
|
return this.list;
|
|
3110
1325
|
},
|
|
3111
|
-
handler:
|
|
1326
|
+
handler: util.noop,
|
|
3112
1327
|
...pointerOptions
|
|
3113
1328
|
}
|
|
3114
1329
|
],
|
|
@@ -3125,16 +1340,16 @@
|
|
|
3125
1340
|
} else {
|
|
3126
1341
|
this.prevIndex = this.index;
|
|
3127
1342
|
}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
1343
|
+
util.on(document, pointerMove, this.move, pointerOptions);
|
|
1344
|
+
util.on(document, pointerUp, this.end, pointerUpOptions);
|
|
1345
|
+
util.css(this.list, "userSelect", "none");
|
|
3131
1346
|
},
|
|
3132
1347
|
move(e) {
|
|
3133
1348
|
const distance = this.pos - this.drag;
|
|
3134
1349
|
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
|
|
3135
1350
|
return;
|
|
3136
1351
|
}
|
|
3137
|
-
|
|
1352
|
+
util.css(this.list, "pointerEvents", "none");
|
|
3138
1353
|
e.cancelable && e.preventDefault();
|
|
3139
1354
|
this.dragging = true;
|
|
3140
1355
|
this.dir = distance < 0 ? 1 : -1;
|
|
@@ -3156,31 +1371,31 @@
|
|
|
3156
1371
|
const changed = this.index !== nextIndex;
|
|
3157
1372
|
const edge = prevIndex === nextIndex;
|
|
3158
1373
|
let itemShown;
|
|
3159
|
-
[this.index, this.prevIndex].filter((i) => !
|
|
3160
|
-
|
|
1374
|
+
[this.index, this.prevIndex].filter((i) => !util.includes([nextIndex, prevIndex], i)).forEach((i) => {
|
|
1375
|
+
util.trigger(slides[i], "itemhidden", [this]);
|
|
3161
1376
|
if (edge) {
|
|
3162
1377
|
itemShown = true;
|
|
3163
1378
|
this.prevIndex = prevIndex;
|
|
3164
1379
|
}
|
|
3165
1380
|
});
|
|
3166
1381
|
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
|
|
3167
|
-
|
|
1382
|
+
util.trigger(slides[this.index], "itemshown", [this]);
|
|
3168
1383
|
}
|
|
3169
1384
|
if (changed) {
|
|
3170
1385
|
this.prevIndex = prevIndex;
|
|
3171
1386
|
this.index = nextIndex;
|
|
3172
|
-
!edge &&
|
|
3173
|
-
|
|
1387
|
+
!edge && util.trigger(prev, "beforeitemhide", [this]);
|
|
1388
|
+
util.trigger(next, "beforeitemshow", [this]);
|
|
3174
1389
|
}
|
|
3175
1390
|
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
|
|
3176
1391
|
if (changed) {
|
|
3177
|
-
!edge &&
|
|
3178
|
-
|
|
1392
|
+
!edge && util.trigger(prev, "itemhide", [this]);
|
|
1393
|
+
util.trigger(next, "itemshow", [this]);
|
|
3179
1394
|
}
|
|
3180
1395
|
},
|
|
3181
1396
|
end() {
|
|
3182
|
-
|
|
3183
|
-
|
|
1397
|
+
util.off(document, pointerMove, this.move, pointerOptions);
|
|
1398
|
+
util.off(document, pointerUp, this.end, pointerUpOptions);
|
|
3184
1399
|
if (this.dragging) {
|
|
3185
1400
|
this.dragging = null;
|
|
3186
1401
|
if (this.index === this.prevIndex) {
|
|
@@ -3189,7 +1404,7 @@
|
|
|
3189
1404
|
this._show(false, this.index, true);
|
|
3190
1405
|
this._transitioner = null;
|
|
3191
1406
|
} else {
|
|
3192
|
-
const dirChange = (
|
|
1407
|
+
const dirChange = (util.isRtl ? this.dir * (util.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
|
|
3193
1408
|
this.index = dirChange ? this.index : this.prevIndex;
|
|
3194
1409
|
if (dirChange) {
|
|
3195
1410
|
this.percent = 1 - this.percent;
|
|
@@ -3200,13 +1415,13 @@
|
|
|
3200
1415
|
);
|
|
3201
1416
|
}
|
|
3202
1417
|
}
|
|
3203
|
-
|
|
1418
|
+
util.css(this.list, { userSelect: "", pointerEvents: "" });
|
|
3204
1419
|
this.drag = this.percent = null;
|
|
3205
1420
|
}
|
|
3206
1421
|
}
|
|
3207
1422
|
};
|
|
3208
1423
|
function hasSelectableText(el) {
|
|
3209
|
-
return
|
|
1424
|
+
return util.css(el, "userSelect") !== "none" && util.toNodes(el.childNodes).some((el2) => el2.nodeType === 3 && el2.textContent.trim());
|
|
3210
1425
|
}
|
|
3211
1426
|
|
|
3212
1427
|
var SliderAutoplay = {
|
|
@@ -3221,14 +1436,14 @@
|
|
|
3221
1436
|
pauseOnHover: true
|
|
3222
1437
|
},
|
|
3223
1438
|
connected() {
|
|
3224
|
-
|
|
1439
|
+
util.attr(this.list, "aria-live", this.autoplay ? "off" : "polite");
|
|
3225
1440
|
this.autoplay && this.startAutoplay();
|
|
3226
1441
|
},
|
|
3227
1442
|
disconnected() {
|
|
3228
1443
|
this.stopAutoplay();
|
|
3229
1444
|
},
|
|
3230
1445
|
update() {
|
|
3231
|
-
|
|
1446
|
+
util.attr(this.slides, "tabindex", "-1");
|
|
3232
1447
|
},
|
|
3233
1448
|
events: [
|
|
3234
1449
|
{
|
|
@@ -3246,51 +1461,25 @@
|
|
|
3246
1461
|
this.startAutoplay();
|
|
3247
1462
|
}
|
|
3248
1463
|
}
|
|
3249
|
-
},
|
|
3250
|
-
{
|
|
3251
|
-
name: `${uikitUtil.pointerEnter} focusin`,
|
|
3252
|
-
filter() {
|
|
3253
|
-
return this.autoplay;
|
|
3254
|
-
},
|
|
3255
|
-
handler(e) {
|
|
3256
|
-
if (e.type !== uikitUtil.pointerEnter || this.pauseOnHover) {
|
|
3257
|
-
this.stopAutoplay();
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3260
|
-
},
|
|
3261
|
-
{
|
|
3262
|
-
name: `${uikitUtil.pointerLeave} focusout`,
|
|
3263
|
-
filter() {
|
|
3264
|
-
return this.autoplay;
|
|
3265
|
-
},
|
|
3266
|
-
handler(e) {
|
|
3267
|
-
if (e.type !== uikitUtil.pointerLeave || this.pauseOnHover) {
|
|
3268
|
-
this.startAutoplay();
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
1464
|
}
|
|
3272
1465
|
],
|
|
3273
1466
|
methods: {
|
|
3274
1467
|
startAutoplay() {
|
|
3275
|
-
if (this.draggable && uikitUtil.matches(this.$el, ":focus-within") || this.pauseOnHover && uikitUtil.matches(this.$el, ":hover")) {
|
|
3276
|
-
return;
|
|
3277
|
-
}
|
|
3278
1468
|
this.stopAutoplay();
|
|
3279
|
-
this.interval = setInterval(
|
|
3280
|
-
(
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
1469
|
+
this.interval = setInterval(() => {
|
|
1470
|
+
if (!(this.stack.length || this.draggable && util.matches(this.$el, ":focus-within") || this.pauseOnHover && util.matches(this.$el, ":hover"))) {
|
|
1471
|
+
this.show("next");
|
|
1472
|
+
}
|
|
1473
|
+
}, this.autoplayInterval);
|
|
3284
1474
|
},
|
|
3285
1475
|
stopAutoplay() {
|
|
3286
1476
|
clearInterval(this.interval);
|
|
3287
|
-
uikitUtil.attr(this.list, "aria-live", "polite");
|
|
3288
1477
|
}
|
|
3289
1478
|
}
|
|
3290
1479
|
};
|
|
3291
1480
|
|
|
3292
1481
|
function resize(options) {
|
|
3293
|
-
return observe(observeResize, options, "resize");
|
|
1482
|
+
return observe(util.observeResize, options, "resize");
|
|
3294
1483
|
}
|
|
3295
1484
|
function observe(observe2, options, emit) {
|
|
3296
1485
|
return {
|
|
@@ -3330,21 +1519,21 @@
|
|
|
3330
1519
|
this.stack = [];
|
|
3331
1520
|
},
|
|
3332
1521
|
disconnected() {
|
|
3333
|
-
|
|
1522
|
+
util.removeClass(this.slides, this.clsActive);
|
|
3334
1523
|
},
|
|
3335
1524
|
computed: {
|
|
3336
1525
|
duration({ velocity }, $el) {
|
|
3337
1526
|
return speedUp($el.offsetWidth / velocity);
|
|
3338
1527
|
},
|
|
3339
1528
|
list({ selList }, $el) {
|
|
3340
|
-
return
|
|
1529
|
+
return util.$(selList, $el);
|
|
3341
1530
|
},
|
|
3342
1531
|
maxIndex() {
|
|
3343
1532
|
return this.length - 1;
|
|
3344
1533
|
},
|
|
3345
1534
|
slides: {
|
|
3346
1535
|
get() {
|
|
3347
|
-
return
|
|
1536
|
+
return util.children(this.list);
|
|
3348
1537
|
},
|
|
3349
1538
|
watch() {
|
|
3350
1539
|
this.$emit();
|
|
@@ -3377,7 +1566,7 @@
|
|
|
3377
1566
|
return;
|
|
3378
1567
|
}
|
|
3379
1568
|
const prevIndex = this.getIndex(this.index);
|
|
3380
|
-
const prev =
|
|
1569
|
+
const prev = util.hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
|
|
3381
1570
|
const nextIndex = this.getIndex(index, this.index);
|
|
3382
1571
|
const next = this.slides[nextIndex];
|
|
3383
1572
|
if (prev === next) {
|
|
@@ -3387,25 +1576,25 @@
|
|
|
3387
1576
|
this.dir = getDirection(index, prevIndex);
|
|
3388
1577
|
this.prevIndex = prevIndex;
|
|
3389
1578
|
this.index = nextIndex;
|
|
3390
|
-
if (prev && !
|
|
1579
|
+
if (prev && !util.trigger(prev, "beforeitemhide", [this]) || !util.trigger(next, "beforeitemshow", [this, prev])) {
|
|
3391
1580
|
this.index = this.prevIndex;
|
|
3392
1581
|
reset();
|
|
3393
1582
|
return;
|
|
3394
1583
|
}
|
|
3395
1584
|
const promise = this._show(prev, next, force).then(() => {
|
|
3396
|
-
prev &&
|
|
3397
|
-
|
|
1585
|
+
prev && util.trigger(prev, "itemhidden", [this]);
|
|
1586
|
+
util.trigger(next, "itemshown", [this]);
|
|
3398
1587
|
stack.shift();
|
|
3399
1588
|
this._transitioner = null;
|
|
3400
1589
|
requestAnimationFrame(() => stack.length && this.show(stack.shift(), true));
|
|
3401
1590
|
});
|
|
3402
|
-
prev &&
|
|
3403
|
-
|
|
1591
|
+
prev && util.trigger(prev, "itemhide", [this]);
|
|
1592
|
+
util.trigger(next, "itemshow", [this]);
|
|
3404
1593
|
return promise;
|
|
3405
1594
|
},
|
|
3406
1595
|
getIndex(index = this.index, prev = this.index) {
|
|
3407
|
-
return
|
|
3408
|
-
|
|
1596
|
+
return util.clamp(
|
|
1597
|
+
util.getIndex(index, this.slides, prev, this.finite),
|
|
3409
1598
|
0,
|
|
3410
1599
|
Math.max(0, this.maxIndex)
|
|
3411
1600
|
);
|
|
@@ -3438,9 +1627,9 @@
|
|
|
3438
1627
|
},
|
|
3439
1628
|
_getTransitioner(prev = this.prevIndex, next = this.index, dir = this.dir || 1, options = this.transitionOptions) {
|
|
3440
1629
|
return new this.Transitioner(
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
dir * (
|
|
1630
|
+
util.isNumber(prev) ? this.slides[prev] : prev,
|
|
1631
|
+
util.isNumber(next) ? this.slides[next] : next,
|
|
1632
|
+
dir * (util.isRtl ? -1 : 1),
|
|
3444
1633
|
options
|
|
3445
1634
|
);
|
|
3446
1635
|
}
|
|
@@ -3474,13 +1663,13 @@
|
|
|
3474
1663
|
},
|
|
3475
1664
|
events: {
|
|
3476
1665
|
beforeitemshow({ target }) {
|
|
3477
|
-
|
|
1666
|
+
util.addClass(target, this.clsActive);
|
|
3478
1667
|
},
|
|
3479
1668
|
itemshown({ target }) {
|
|
3480
|
-
|
|
1669
|
+
util.addClass(target, this.clsActivated);
|
|
3481
1670
|
},
|
|
3482
1671
|
itemhidden({ target }) {
|
|
3483
|
-
|
|
1672
|
+
util.removeClass(target, this.clsActive, this.clsActivated);
|
|
3484
1673
|
}
|
|
3485
1674
|
}
|
|
3486
1675
|
};
|
|
@@ -3511,24 +1700,24 @@
|
|
|
3511
1700
|
template: `<div class="uk-lightbox uk-overflow-hidden"> <ul class="uk-lightbox-items"></ul> <div class="uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque"> <button class="uk-lightbox-toolbar-icon uk-close-large" type="button" uk-close></button> </div> <a class="uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade" href uk-slidenav-previous uk-lightbox-item="previous"></a> <a class="uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade" href uk-slidenav-next uk-lightbox-item="next"></a> <div class="uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div> </div>`
|
|
3512
1701
|
}),
|
|
3513
1702
|
created() {
|
|
3514
|
-
const $el =
|
|
3515
|
-
const list =
|
|
3516
|
-
this.items.forEach(() =>
|
|
3517
|
-
const close =
|
|
1703
|
+
const $el = util.$(this.template);
|
|
1704
|
+
const list = util.$(this.selList, $el);
|
|
1705
|
+
this.items.forEach(() => util.append(list, "<li>"));
|
|
1706
|
+
const close = util.$("[uk-close]", $el);
|
|
3518
1707
|
const closeLabel = this.t("close");
|
|
3519
1708
|
if (close && closeLabel) {
|
|
3520
1709
|
close.dataset.i18n = JSON.stringify({ label: closeLabel });
|
|
3521
1710
|
}
|
|
3522
|
-
this.$mount(
|
|
1711
|
+
this.$mount(util.append(this.container, $el));
|
|
3523
1712
|
},
|
|
3524
1713
|
computed: {
|
|
3525
1714
|
caption({ selCaption }, $el) {
|
|
3526
|
-
return
|
|
1715
|
+
return util.$(selCaption, $el);
|
|
3527
1716
|
}
|
|
3528
1717
|
},
|
|
3529
1718
|
events: [
|
|
3530
1719
|
{
|
|
3531
|
-
name: `${
|
|
1720
|
+
name: `${util.pointerMove} ${util.pointerDown} keydown`,
|
|
3532
1721
|
handler: "showControls"
|
|
3533
1722
|
},
|
|
3534
1723
|
{
|
|
@@ -3555,8 +1744,8 @@
|
|
|
3555
1744
|
self: true,
|
|
3556
1745
|
handler() {
|
|
3557
1746
|
this.hideControls();
|
|
3558
|
-
|
|
3559
|
-
|
|
1747
|
+
util.removeClass(this.slides, this.clsActive);
|
|
1748
|
+
util.Transition.stop(this.slides);
|
|
3560
1749
|
}
|
|
3561
1750
|
},
|
|
3562
1751
|
{
|
|
@@ -3600,14 +1789,14 @@
|
|
|
3600
1789
|
e.preventDefault();
|
|
3601
1790
|
this.toggleElement(this.$el, true, false);
|
|
3602
1791
|
this.animation = Animations["scale"];
|
|
3603
|
-
|
|
1792
|
+
util.removeClass(e.target, this.clsActive);
|
|
3604
1793
|
this.stack.splice(1, 0, this.index);
|
|
3605
1794
|
}
|
|
3606
1795
|
},
|
|
3607
1796
|
{
|
|
3608
1797
|
name: "itemshow",
|
|
3609
1798
|
handler() {
|
|
3610
|
-
|
|
1799
|
+
util.html(this.caption, this.getItem().caption || "");
|
|
3611
1800
|
for (let j = -this.preload; j <= this.preload; j++) {
|
|
3612
1801
|
this.loadItem(this.index + j);
|
|
3613
1802
|
}
|
|
@@ -3636,8 +1825,8 @@
|
|
|
3636
1825
|
};
|
|
3637
1826
|
if (type === "image" || src.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i)) {
|
|
3638
1827
|
const img = createEl("img", { src, alt, ...attrs });
|
|
3639
|
-
|
|
3640
|
-
|
|
1828
|
+
util.on(img, "load", () => this.setItem(item, img));
|
|
1829
|
+
util.on(img, "error", () => this.setError(item));
|
|
3641
1830
|
} else if (type === "video" || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
|
|
3642
1831
|
const video = createEl("video", {
|
|
3643
1832
|
src,
|
|
@@ -3647,8 +1836,8 @@
|
|
|
3647
1836
|
"uk-video": `${this.videoAutoplay}`,
|
|
3648
1837
|
...attrs
|
|
3649
1838
|
});
|
|
3650
|
-
|
|
3651
|
-
|
|
1839
|
+
util.on(video, "loadedmetadata", () => this.setItem(item, video));
|
|
1840
|
+
util.on(video, "error", () => this.setError(item));
|
|
3652
1841
|
} else if (type === "iframe" || src.match(/\.(html|php)($|\?)/i)) {
|
|
3653
1842
|
this.setItem(
|
|
3654
1843
|
item,
|
|
@@ -3701,14 +1890,14 @@
|
|
|
3701
1890
|
loadItem(index = this.index) {
|
|
3702
1891
|
const item = this.getItem(index);
|
|
3703
1892
|
if (!this.getSlide(item).childElementCount) {
|
|
3704
|
-
|
|
1893
|
+
util.trigger(this.$el, "itemload", [item]);
|
|
3705
1894
|
}
|
|
3706
1895
|
},
|
|
3707
1896
|
getItem(index = this.index) {
|
|
3708
|
-
return this.items[
|
|
1897
|
+
return this.items[util.getIndex(index, this.slides)];
|
|
3709
1898
|
},
|
|
3710
1899
|
setItem(item, content) {
|
|
3711
|
-
|
|
1900
|
+
util.trigger(this.$el, "itemloaded", [this, util.html(this.getSlide(item), content)]);
|
|
3712
1901
|
},
|
|
3713
1902
|
getSlide(item) {
|
|
3714
1903
|
return this.slides[this.items.indexOf(item)];
|
|
@@ -3719,16 +1908,16 @@
|
|
|
3719
1908
|
showControls() {
|
|
3720
1909
|
clearTimeout(this.controlsTimer);
|
|
3721
1910
|
this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
|
|
3722
|
-
|
|
1911
|
+
util.addClass(this.$el, "uk-active", "uk-transition-active");
|
|
3723
1912
|
},
|
|
3724
1913
|
hideControls() {
|
|
3725
|
-
|
|
1914
|
+
util.removeClass(this.$el, "uk-active", "uk-transition-active");
|
|
3726
1915
|
}
|
|
3727
1916
|
}
|
|
3728
1917
|
};
|
|
3729
1918
|
function createEl(tag, attrs) {
|
|
3730
|
-
const el =
|
|
3731
|
-
|
|
1919
|
+
const el = util.fragment(`<${tag}>`);
|
|
1920
|
+
util.attr(el, attrs);
|
|
3732
1921
|
return el;
|
|
3733
1922
|
}
|
|
3734
1923
|
|
|
@@ -3739,13 +1928,13 @@
|
|
|
3739
1928
|
computed: {
|
|
3740
1929
|
toggles: {
|
|
3741
1930
|
get({ toggle }, $el) {
|
|
3742
|
-
return
|
|
1931
|
+
return util.$$(toggle, $el);
|
|
3743
1932
|
},
|
|
3744
1933
|
watch(toggles) {
|
|
3745
1934
|
this.hide();
|
|
3746
1935
|
for (const toggle of toggles) {
|
|
3747
|
-
if (
|
|
3748
|
-
|
|
1936
|
+
if (util.isTag(toggle, "a")) {
|
|
1937
|
+
util.attr(toggle, "role", "button");
|
|
3749
1938
|
}
|
|
3750
1939
|
}
|
|
3751
1940
|
},
|
|
@@ -3767,13 +1956,13 @@
|
|
|
3767
1956
|
},
|
|
3768
1957
|
methods: {
|
|
3769
1958
|
show(index) {
|
|
3770
|
-
const items =
|
|
3771
|
-
if (
|
|
1959
|
+
const items = util.uniqueBy(this.toggles.map(toItem), "source");
|
|
1960
|
+
if (util.isElement(index)) {
|
|
3772
1961
|
const { source } = toItem(index);
|
|
3773
|
-
index =
|
|
1962
|
+
index = util.findIndex(items, ({ source: src }) => source === src);
|
|
3774
1963
|
}
|
|
3775
1964
|
this.panel = this.panel || this.$create("lightboxPanel", { ...this.$props, items });
|
|
3776
|
-
|
|
1965
|
+
util.on(this.panel.$el, "hidden", () => this.panel = null);
|
|
3777
1966
|
return this.panel.show(index);
|
|
3778
1967
|
},
|
|
3779
1968
|
hide() {
|
|
@@ -3786,12 +1975,12 @@
|
|
|
3786
1975
|
if (!UIkit.lightboxPanel) {
|
|
3787
1976
|
UIkit.component("lightboxPanel", LightboxPanel);
|
|
3788
1977
|
}
|
|
3789
|
-
|
|
1978
|
+
util.assign(Lightbox.props, UIkit.component("lightboxPanel").options.props);
|
|
3790
1979
|
}
|
|
3791
1980
|
function toItem(el) {
|
|
3792
1981
|
const item = {};
|
|
3793
1982
|
for (const attr2 of ["href", "caption", "type", "poster", "alt", "attrs"]) {
|
|
3794
|
-
item[attr2 === "href" ? "source" : attr2] =
|
|
1983
|
+
item[attr2 === "href" ? "source" : attr2] = util.data(el, attr2);
|
|
3795
1984
|
}
|
|
3796
1985
|
item.attrs = parseOptions(item.attrs);
|
|
3797
1986
|
return item;
|