uikit 3.16.16-dev.eede5abfb → 3.16.17-dev.8404b30b4
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 +15 -0
- package/build/release.js +1 -1
- 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 +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- 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 +3 -3
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +34 -30
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +34 -30
- 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 +2 -2
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +2 -2
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +26 -25
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +2 -2
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +26 -25
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +16 -12
- 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 +44 -50
- 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 +93 -95
- package/dist/js/uikit.min.js +1 -1
- package/package.json +9 -9
- package/src/js/api/global.js +1 -1
- package/src/js/components/filter.js +2 -2
- package/src/js/components/internal/slider-transitioner.js +15 -15
- package/src/js/components/slider.js +2 -1
- package/src/js/components/tooltip.js +7 -6
- package/src/js/core/accordion.js +2 -2
- package/src/js/core/drop.js +2 -2
- package/src/js/core/modal.js +19 -21
- package/src/js/core/switcher.js +5 -5
- package/src/js/core/toggle.js +8 -7
- package/src/js/core/video.js +1 -1
- package/src/js/mixin/internal/slideshow-transitioner.js +16 -14
- package/src/js/mixin/parallax.js +2 -1
- package/src/js/mixin/slider-drag.js +12 -6
- package/src/js/mixin/slider-nav.js +1 -1
- package/src/js/mixin/slider.js +3 -17
- package/src/js/mixin/togglable.js +8 -6
- package/src/js/util/lang.js +0 -9
- package/tests/modal.html +16 -15
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "uikit",
|
|
3
3
|
"title": "UIkit",
|
|
4
4
|
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
-
"version": "3.16.
|
|
5
|
+
"version": "3.16.17-dev.8404b30b4",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"camelcase": "^7.0.1",
|
|
28
28
|
"clean-css": "^5.3.2",
|
|
29
29
|
"dateformat": "^5.0.3",
|
|
30
|
-
"esbuild": "^0.17.
|
|
31
|
-
"eslint": "^8.
|
|
30
|
+
"esbuild": "^0.17.18",
|
|
31
|
+
"eslint": "^8.40.0",
|
|
32
32
|
"eslint-config-prettier": "^8.8.0",
|
|
33
33
|
"fs-extra": "^11.1.1",
|
|
34
|
-
"glob": "^10.
|
|
35
|
-
"inquirer": "^9.
|
|
34
|
+
"glob": "^10.2.2",
|
|
35
|
+
"inquirer": "^9.2.2",
|
|
36
36
|
"less": "^4.1.3",
|
|
37
37
|
"minimist": "^1.2.8",
|
|
38
38
|
"number-precision": "^1.6.0",
|
|
39
39
|
"p-limit": "^4.0.0",
|
|
40
|
-
"prettier": "^2.8.
|
|
41
|
-
"rollup": "^3.
|
|
40
|
+
"prettier": "^2.8.8",
|
|
41
|
+
"rollup": "^3.21.5",
|
|
42
42
|
"rollup-plugin-esbuild": "^5.0.0",
|
|
43
43
|
"rollup-plugin-modify": "^3.0.0",
|
|
44
|
-
"rtlcss": "^4.
|
|
45
|
-
"semver": "^7.
|
|
44
|
+
"rtlcss": "^4.1.0",
|
|
45
|
+
"semver": "^7.5.0",
|
|
46
46
|
"svgo": "^3.0.2",
|
|
47
47
|
"watch-run": "^1.2.5"
|
|
48
48
|
},
|
package/src/js/api/global.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
clamp,
|
|
5
5
|
createEvent,
|
|
6
6
|
css,
|
|
7
|
-
Deferred,
|
|
8
7
|
dimensions,
|
|
9
8
|
findIndex,
|
|
10
9
|
includes,
|
|
@@ -17,8 +16,6 @@ import {
|
|
|
17
16
|
} from 'uikit-util';
|
|
18
17
|
|
|
19
18
|
export default function (prev, next, dir, { center, easing, list }) {
|
|
20
|
-
const deferred = new Deferred();
|
|
21
|
-
|
|
22
19
|
const from = prev
|
|
23
20
|
? getLeft(prev, list, center)
|
|
24
21
|
: getLeft(next, list, center) + dimensions(next).width * dir;
|
|
@@ -26,6 +23,8 @@ export default function (prev, next, dir, { center, easing, list }) {
|
|
|
26
23
|
? getLeft(next, list, center)
|
|
27
24
|
: from + dimensions(prev).width * dir * (isRtl ? -1 : 1);
|
|
28
25
|
|
|
26
|
+
let resolve;
|
|
27
|
+
|
|
29
28
|
return {
|
|
30
29
|
dir,
|
|
31
30
|
|
|
@@ -45,26 +44,27 @@ export default function (prev, next, dir, { center, easing, list }) {
|
|
|
45
44
|
dir,
|
|
46
45
|
});
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
return new Promise((res) => {
|
|
48
|
+
resolve ||= res;
|
|
49
|
+
Transition.start(
|
|
50
|
+
list,
|
|
51
|
+
{ transform: translate(-to * (isRtl ? -1 : 1), 'px') },
|
|
52
|
+
duration,
|
|
53
|
+
timing
|
|
54
|
+
).then(resolve, noop);
|
|
55
|
+
});
|
|
56
56
|
},
|
|
57
57
|
|
|
58
58
|
cancel() {
|
|
59
|
-
Transition.cancel(list);
|
|
59
|
+
return Transition.cancel(list);
|
|
60
60
|
},
|
|
61
61
|
|
|
62
62
|
reset() {
|
|
63
63
|
css(list, 'transform', '');
|
|
64
64
|
},
|
|
65
65
|
|
|
66
|
-
forward(duration, percent = this.percent()) {
|
|
67
|
-
|
|
66
|
+
async forward(duration, percent = this.percent()) {
|
|
67
|
+
await this.cancel();
|
|
68
68
|
return this.show(duration, percent, true);
|
|
69
69
|
},
|
|
70
70
|
|
|
@@ -155,7 +155,7 @@ function centerEl(el, list) {
|
|
|
155
155
|
return dimensions(list).width / 2 - dimensions(el).width / 2;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
function getElLeft(el, list) {
|
|
159
159
|
return (
|
|
160
160
|
(el &&
|
|
161
161
|
(position(el).left + (isRtl ? dimensions(el).width - dimensions(list).width : 0)) *
|
|
@@ -93,7 +93,8 @@ export default {
|
|
|
93
93
|
if (this.center) {
|
|
94
94
|
if (
|
|
95
95
|
left < width / 2 &&
|
|
96
|
-
left + slideWidth + dimensions(
|
|
96
|
+
left + slideWidth + dimensions(getIndex(+i + 1, this.slides)).width / 2 >
|
|
97
|
+
width / 2
|
|
97
98
|
) {
|
|
98
99
|
sets.push(+i);
|
|
99
100
|
left = width / 2 - slideWidth / 2;
|
|
@@ -43,7 +43,7 @@ export default {
|
|
|
43
43
|
},
|
|
44
44
|
|
|
45
45
|
beforeConnect() {
|
|
46
|
-
this.id = generateId(this);
|
|
46
|
+
this.id = generateId(this, {});
|
|
47
47
|
this._hasTitle = hasAttr(this.$el, 'title');
|
|
48
48
|
attr(this.$el, {
|
|
49
49
|
title: '',
|
|
@@ -77,16 +77,15 @@ export default {
|
|
|
77
77
|
|
|
78
78
|
clearTimeout(this.showTimer);
|
|
79
79
|
|
|
80
|
-
if (
|
|
81
|
-
|
|
80
|
+
if (this.isToggled(this.tooltip || null)) {
|
|
81
|
+
await this.toggleElement(this.tooltip, false, false);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
await this.toggleElement(this.tooltip, false, false);
|
|
85
84
|
remove(this.tooltip);
|
|
86
85
|
this.tooltip = null;
|
|
87
86
|
},
|
|
88
87
|
|
|
89
|
-
_show() {
|
|
88
|
+
async _show() {
|
|
90
89
|
this.tooltip = append(
|
|
91
90
|
this.container,
|
|
92
91
|
`<div id="${this.id}" class="uk-${this.$options.name}" role="tooltip">
|
|
@@ -128,7 +127,9 @@ export default {
|
|
|
128
127
|
});
|
|
129
128
|
});
|
|
130
129
|
|
|
131
|
-
this.toggleElement(this.tooltip, true)
|
|
130
|
+
if (!(await this.toggleElement(this.tooltip, true))) {
|
|
131
|
+
this.hide();
|
|
132
|
+
}
|
|
132
133
|
},
|
|
133
134
|
},
|
|
134
135
|
|
package/src/js/core/accordion.js
CHANGED
|
@@ -166,7 +166,7 @@ export default {
|
|
|
166
166
|
},
|
|
167
167
|
|
|
168
168
|
methods: {
|
|
169
|
-
|
|
169
|
+
toggle(item, animate) {
|
|
170
170
|
item = this.items[getIndex(item, this.items)];
|
|
171
171
|
let items = [item];
|
|
172
172
|
const activeItems = filter(this.items, `.${this.clsOpen}`);
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
return Promise.all(
|
|
183
183
|
items.map((el) =>
|
|
184
184
|
this.toggleElement(el, !includes(activeItems, el), (el, show) => {
|
|
185
185
|
toggleClass(el, this.clsOpen, show);
|
package/src/js/core/drop.js
CHANGED
|
@@ -89,8 +89,8 @@ export default {
|
|
|
89
89
|
},
|
|
90
90
|
|
|
91
91
|
target({ target, targetX, targetY }, $el) {
|
|
92
|
-
targetX
|
|
93
|
-
targetY
|
|
92
|
+
targetX ||= target || this.targetEl;
|
|
93
|
+
targetY ||= target || this.targetEl;
|
|
94
94
|
|
|
95
95
|
return [
|
|
96
96
|
targetX === true ? window : query(targetX, $el),
|
package/src/js/core/modal.js
CHANGED
|
@@ -2,12 +2,13 @@ import Modal from '../mixin/modal';
|
|
|
2
2
|
import {
|
|
3
3
|
$,
|
|
4
4
|
addClass,
|
|
5
|
+
assign,
|
|
5
6
|
css,
|
|
6
|
-
Deferred,
|
|
7
7
|
hasClass,
|
|
8
8
|
height,
|
|
9
9
|
html,
|
|
10
10
|
isString,
|
|
11
|
+
noop,
|
|
11
12
|
on,
|
|
12
13
|
removeClass,
|
|
13
14
|
} from 'uikit-util';
|
|
@@ -88,8 +89,7 @@ function install({ modal }) {
|
|
|
88
89
|
i18n.ok
|
|
89
90
|
}</button>
|
|
90
91
|
</div>`,
|
|
91
|
-
options
|
|
92
|
-
(deferred) => deferred.resolve()
|
|
92
|
+
options
|
|
93
93
|
);
|
|
94
94
|
};
|
|
95
95
|
|
|
@@ -105,7 +105,7 @@ function install({ modal }) {
|
|
|
105
105
|
</div>
|
|
106
106
|
</form>`,
|
|
107
107
|
options,
|
|
108
|
-
(
|
|
108
|
+
() => Promise.reject()
|
|
109
109
|
);
|
|
110
110
|
};
|
|
111
111
|
|
|
@@ -124,7 +124,7 @@ function install({ modal }) {
|
|
|
124
124
|
</div>
|
|
125
125
|
</form>`,
|
|
126
126
|
options,
|
|
127
|
-
(
|
|
127
|
+
() => null,
|
|
128
128
|
(dialog) => $('input', dialog.$el).value
|
|
129
129
|
);
|
|
130
130
|
};
|
|
@@ -134,7 +134,7 @@ function install({ modal }) {
|
|
|
134
134
|
cancel: 'Cancel',
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
function openDialog(tmpl, options, hideFn, submitFn) {
|
|
137
|
+
function openDialog(tmpl, options, hideFn = noop, submitFn = noop) {
|
|
138
138
|
options = {
|
|
139
139
|
bgClose: false,
|
|
140
140
|
escClose: true,
|
|
@@ -144,21 +144,19 @@ function install({ modal }) {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
const dialog = modal.dialog(tmpl(options), options);
|
|
147
|
-
const deferred = new Deferred();
|
|
148
|
-
|
|
149
|
-
let resolved = false;
|
|
150
|
-
|
|
151
|
-
on(dialog.$el, 'submit', 'form', (e) => {
|
|
152
|
-
e.preventDefault();
|
|
153
|
-
deferred.resolve(submitFn?.(dialog));
|
|
154
|
-
resolved = true;
|
|
155
|
-
dialog.hide();
|
|
156
|
-
});
|
|
157
147
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
return assign(
|
|
149
|
+
new Promise((resolve) => {
|
|
150
|
+
const off = on(dialog.$el, 'hide', () => resolve(hideFn()));
|
|
151
|
+
|
|
152
|
+
on(dialog.$el, 'submit', 'form', (e) => {
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
resolve(submitFn(dialog));
|
|
155
|
+
off();
|
|
156
|
+
dialog.hide();
|
|
157
|
+
});
|
|
158
|
+
}),
|
|
159
|
+
{ dialog }
|
|
160
|
+
);
|
|
163
161
|
}
|
|
164
162
|
}
|
package/src/js/core/switcher.js
CHANGED
|
@@ -79,7 +79,7 @@ export default {
|
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
connectChildren() {
|
|
82
|
-
|
|
82
|
+
let index = Math.max(0, this.index());
|
|
83
83
|
for (const el of this.connects) {
|
|
84
84
|
children(el).forEach((child, i) => toggleClass(child, this.cls, i === index));
|
|
85
85
|
}
|
|
@@ -241,11 +241,11 @@ export default {
|
|
|
241
241
|
|
|
242
242
|
const animate = prev >= 0 && prev !== next;
|
|
243
243
|
this.connects.forEach(async ({ children }) => {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
false,
|
|
247
|
-
animate
|
|
244
|
+
const actives = toArray(children).filter(
|
|
245
|
+
(child, i) => i !== active && hasClass(child, this.cls)
|
|
248
246
|
);
|
|
247
|
+
|
|
248
|
+
await this.toggleElement(actives, false, animate);
|
|
249
249
|
await this.toggleElement(children[active], true, animate);
|
|
250
250
|
});
|
|
251
251
|
},
|
package/src/js/core/toggle.js
CHANGED
|
@@ -42,8 +42,8 @@ export default {
|
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
computed: {
|
|
45
|
-
target({
|
|
46
|
-
target = queryAll(target ||
|
|
45
|
+
target({ target }, $el) {
|
|
46
|
+
target = queryAll(target || $el.hash, $el);
|
|
47
47
|
return (target.length && target) || [$el];
|
|
48
48
|
},
|
|
49
49
|
},
|
|
@@ -217,11 +217,12 @@ export default {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
const toggled = this.target.filter(this.isToggled);
|
|
220
|
-
await this.toggleElement(toggled, false)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
if (await this.toggleElement(toggled, false)) {
|
|
221
|
+
await this.toggleElement(
|
|
222
|
+
this.target.filter((el) => !includes(toggled, el)),
|
|
223
|
+
true
|
|
224
|
+
);
|
|
225
|
+
}
|
|
225
226
|
},
|
|
226
227
|
},
|
|
227
228
|
};
|
package/src/js/core/video.js
CHANGED
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
write({ prev, visible, inView }) {
|
|
49
49
|
if (!visible || (this.inView && !inView)) {
|
|
50
50
|
pause(this.$el);
|
|
51
|
-
} else if ((this.autoplay === true && !prev) ||
|
|
51
|
+
} else if ((this.autoplay === true && !prev) || inView) {
|
|
52
52
|
play(this.$el);
|
|
53
53
|
}
|
|
54
54
|
},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { clamp, createEvent, css,
|
|
1
|
+
import { clamp, createEvent, css, noop, Transition, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function Transitioner(prev, next, dir, { animation, easing }) {
|
|
4
4
|
const { percent, translate, show = noop } = animation;
|
|
5
5
|
const props = show(dir);
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
let resolve;
|
|
7
8
|
|
|
8
9
|
return {
|
|
9
10
|
dir,
|
|
@@ -17,19 +18,20 @@ export default function Transitioner(prev, next, dir, { animation, easing }) {
|
|
|
17
18
|
triggerUpdate(next, 'itemin', { percent, duration, timing, dir });
|
|
18
19
|
triggerUpdate(prev, 'itemout', { percent: 1 - percent, duration, timing, dir });
|
|
19
20
|
|
|
20
|
-
Promise
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
return new Promise((res) => {
|
|
22
|
+
resolve ||= res;
|
|
23
|
+
Promise.all([
|
|
24
|
+
Transition.start(next, props[1], duration, timing),
|
|
25
|
+
Transition.start(prev, props[0], duration, timing),
|
|
26
|
+
]).then(() => {
|
|
27
|
+
this.reset();
|
|
28
|
+
resolve();
|
|
29
|
+
}, noop);
|
|
30
|
+
});
|
|
29
31
|
},
|
|
30
32
|
|
|
31
33
|
cancel() {
|
|
32
|
-
Transition.cancel([next, prev]);
|
|
34
|
+
return Transition.cancel([next, prev]);
|
|
33
35
|
},
|
|
34
36
|
|
|
35
37
|
reset() {
|
|
@@ -38,8 +40,8 @@ export default function Transitioner(prev, next, dir, { animation, easing }) {
|
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
|
|
41
|
-
forward(duration, percent = this.percent()) {
|
|
42
|
-
|
|
43
|
+
async forward(duration, percent = this.percent()) {
|
|
44
|
+
await this.cancel();
|
|
43
45
|
return this.show(duration, percent, true);
|
|
44
46
|
},
|
|
45
47
|
|
package/src/js/mixin/parallax.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Media from '../mixin/media';
|
|
2
2
|
import { getMaxPathLength } from '../util/svg';
|
|
3
3
|
import {
|
|
4
|
+
clamp,
|
|
4
5
|
createEvent,
|
|
5
6
|
css,
|
|
6
7
|
Dimensions,
|
|
@@ -78,7 +79,7 @@ export default {
|
|
|
78
79
|
getCss(percent) {
|
|
79
80
|
const css = { transform: '', filter: '' };
|
|
80
81
|
for (const prop in this.props) {
|
|
81
|
-
this.props[prop](css, percent);
|
|
82
|
+
this.props[prop](css, clamp(percent));
|
|
82
83
|
}
|
|
83
84
|
css.willChange = Object.keys(css)
|
|
84
85
|
.filter((key) => css[key] !== '')
|
|
@@ -132,19 +132,18 @@ export default {
|
|
|
132
132
|
this.dragging = true;
|
|
133
133
|
this.dir = distance < 0 ? 1 : -1;
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
let { prevIndex } = this;
|
|
135
|
+
let { slides, prevIndex } = this;
|
|
137
136
|
let dis = Math.abs(distance);
|
|
138
|
-
let nextIndex = this.getIndex(prevIndex + this.dir
|
|
139
|
-
let width = this._getDistance(prevIndex, nextIndex)
|
|
137
|
+
let nextIndex = this.getIndex(prevIndex + this.dir);
|
|
138
|
+
let width = this._getDistance(prevIndex, nextIndex);
|
|
140
139
|
|
|
141
140
|
while (nextIndex !== prevIndex && dis > width) {
|
|
142
141
|
this.drag -= width * this.dir;
|
|
143
142
|
|
|
144
143
|
prevIndex = nextIndex;
|
|
145
144
|
dis -= width;
|
|
146
|
-
nextIndex = this.getIndex(prevIndex + this.dir
|
|
147
|
-
width = this._getDistance(prevIndex, nextIndex)
|
|
145
|
+
nextIndex = this.getIndex(prevIndex + this.dir);
|
|
146
|
+
width = this._getDistance(prevIndex, nextIndex);
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
this.percent = dis / width;
|
|
@@ -222,6 +221,13 @@ export default {
|
|
|
222
221
|
|
|
223
222
|
this.drag = this.percent = null;
|
|
224
223
|
},
|
|
224
|
+
|
|
225
|
+
_getDistance(prev, next) {
|
|
226
|
+
return (
|
|
227
|
+
this._getTransitioner(prev, prev !== next && next).getDistance() ||
|
|
228
|
+
this.slides[prev].offsetWidth
|
|
229
|
+
);
|
|
230
|
+
},
|
|
225
231
|
},
|
|
226
232
|
};
|
|
227
233
|
|
package/src/js/mixin/slider.js
CHANGED
|
@@ -3,17 +3,7 @@ import SliderNav from './slider-nav';
|
|
|
3
3
|
import SliderDrag from './slider-drag';
|
|
4
4
|
import SliderAutoplay from './slider-autoplay';
|
|
5
5
|
import { resize } from '../api/observables';
|
|
6
|
-
import {
|
|
7
|
-
$,
|
|
8
|
-
children,
|
|
9
|
-
clamp,
|
|
10
|
-
getIndex,
|
|
11
|
-
hasClass,
|
|
12
|
-
isNumber,
|
|
13
|
-
isRtl,
|
|
14
|
-
removeClass,
|
|
15
|
-
trigger,
|
|
16
|
-
} from 'uikit-util';
|
|
6
|
+
import { $, children, clamp, getIndex, hasClass, isRtl, removeClass, trigger } from 'uikit-util';
|
|
17
7
|
|
|
18
8
|
export default {
|
|
19
9
|
mixins: [SliderAutoplay, SliderDrag, SliderNav, I18n],
|
|
@@ -181,10 +171,6 @@ export default {
|
|
|
181
171
|
);
|
|
182
172
|
},
|
|
183
173
|
|
|
184
|
-
_getDistance(prev, next) {
|
|
185
|
-
return this._getTransitioner(prev, prev !== next && next).getDistance();
|
|
186
|
-
},
|
|
187
|
-
|
|
188
174
|
_translate(percent, prev = this.prevIndex, next = this.index) {
|
|
189
175
|
const transitioner = this._getTransitioner(prev === next ? false : prev, next);
|
|
190
176
|
transitioner.translate(percent);
|
|
@@ -198,8 +184,8 @@ export default {
|
|
|
198
184
|
options = this.transitionOptions
|
|
199
185
|
) {
|
|
200
186
|
return new this.Transitioner(
|
|
201
|
-
|
|
202
|
-
|
|
187
|
+
this.slides[prev] || prev,
|
|
188
|
+
this.slides[next] || next,
|
|
203
189
|
dir * (isRtl ? -1 : 1),
|
|
204
190
|
options
|
|
205
191
|
);
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
isBoolean,
|
|
10
10
|
isFunction,
|
|
11
11
|
isVisible,
|
|
12
|
-
noop,
|
|
13
12
|
removeClass,
|
|
14
13
|
startsWith,
|
|
15
14
|
toFloat,
|
|
@@ -54,9 +53,9 @@ export default {
|
|
|
54
53
|
},
|
|
55
54
|
|
|
56
55
|
methods: {
|
|
57
|
-
toggleElement(targets, toggle, animate) {
|
|
58
|
-
|
|
59
|
-
Promise.all(
|
|
56
|
+
async toggleElement(targets, toggle, animate) {
|
|
57
|
+
try {
|
|
58
|
+
await Promise.all(
|
|
60
59
|
toNodes(targets).map((el) => {
|
|
61
60
|
const show = isBoolean(toggle) ? toggle : !this.isToggled(el);
|
|
62
61
|
|
|
@@ -92,8 +91,11 @@ export default {
|
|
|
92
91
|
})
|
|
93
92
|
: done();
|
|
94
93
|
})
|
|
95
|
-
)
|
|
96
|
-
|
|
94
|
+
);
|
|
95
|
+
return true;
|
|
96
|
+
} catch (e) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
97
99
|
},
|
|
98
100
|
|
|
99
101
|
isToggled(el = this.$el) {
|
package/src/js/util/lang.js
CHANGED
|
@@ -278,12 +278,3 @@ export function memoize(fn) {
|
|
|
278
278
|
const cache = Object.create(null);
|
|
279
279
|
return (key) => cache[key] || (cache[key] = fn(key));
|
|
280
280
|
}
|
|
281
|
-
|
|
282
|
-
export class Deferred {
|
|
283
|
-
constructor() {
|
|
284
|
-
this.promise = new Promise((resolve, reject) => {
|
|
285
|
-
this.reject = reject;
|
|
286
|
-
this.resolve = resolve;
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}
|
package/tests/modal.html
CHANGED
|
@@ -457,37 +457,38 @@
|
|
|
457
457
|
</div>
|
|
458
458
|
|
|
459
459
|
<script>
|
|
460
|
-
const {on} = UIkit
|
|
460
|
+
const { modal, util: { on } } = UIkit;
|
|
461
461
|
|
|
462
462
|
on('#js-modal-dialog', 'click', e => {
|
|
463
463
|
e.preventDefault();
|
|
464
464
|
e.target.blur();
|
|
465
|
-
|
|
465
|
+
modal.dialog('<p class="uk-modal-body">UIkit dialog!</p>');
|
|
466
466
|
});
|
|
467
467
|
|
|
468
|
-
on('#js-modal-alert', 'click', e => {
|
|
468
|
+
on('#js-modal-alert', 'click', async e => {
|
|
469
469
|
e.preventDefault();
|
|
470
470
|
e.target.blur();
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
);
|
|
471
|
+
await modal.alert('UIkit alert!');
|
|
472
|
+
console.log('Alert closed.');
|
|
474
473
|
});
|
|
475
474
|
|
|
476
|
-
on('#js-modal-confirm', 'click', e => {
|
|
475
|
+
on('#js-modal-confirm', 'click', async e => {
|
|
477
476
|
e.preventDefault();
|
|
478
477
|
e.target.blur();
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
478
|
+
|
|
479
|
+
try {
|
|
480
|
+
await modal.confirm('UIkit confirm!');
|
|
481
|
+
console.log('Confirmed.');
|
|
482
|
+
} catch (e) {
|
|
483
|
+
console.log('Rejected.')
|
|
484
|
+
}
|
|
483
485
|
});
|
|
484
486
|
|
|
485
|
-
on('#js-modal-prompt', 'click', e => {
|
|
487
|
+
on('#js-modal-prompt', 'click', async e => {
|
|
486
488
|
e.preventDefault();
|
|
487
489
|
e.target.blur();
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
);
|
|
490
|
+
const name = await modal.prompt('Name:', 'Your name');
|
|
491
|
+
console.log('Prompted:', name);
|
|
491
492
|
});
|
|
492
493
|
|
|
493
494
|
</script>
|