uikit 3.16.4 → 3.16.5-dev.dda1f1b31
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/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 +1 -1
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +2 -2
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +2 -2
- 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 +5 -6
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +52 -60
- 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 +52 -60
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/observables.js +59 -6
- package/src/js/core/offcanvas.js +6 -2
- package/src/js/core/switcher.js +8 -8
- package/src/js/mixin/swipe.js +0 -74
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.5-dev.dda1f1b31",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
$$,
|
|
3
|
+
getEventPos,
|
|
3
4
|
isFunction,
|
|
5
|
+
isTouch,
|
|
6
|
+
noop,
|
|
4
7
|
observeIntersection,
|
|
5
8
|
observeMutation,
|
|
6
9
|
observeResize,
|
|
7
10
|
on,
|
|
11
|
+
once,
|
|
12
|
+
parent,
|
|
13
|
+
pointerCancel,
|
|
14
|
+
pointerDown,
|
|
15
|
+
pointerUp,
|
|
8
16
|
removeAttr,
|
|
9
17
|
toNodes,
|
|
18
|
+
trigger,
|
|
10
19
|
} from '../util';
|
|
11
20
|
|
|
12
21
|
export function resize(options) {
|
|
@@ -44,13 +53,11 @@ export function lazyload(options = {}) {
|
|
|
44
53
|
export function scroll(options) {
|
|
45
54
|
return observe(
|
|
46
55
|
function (target, handler) {
|
|
47
|
-
const off = on(target, 'scroll', handler, {
|
|
48
|
-
passive: true,
|
|
49
|
-
capture: true,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
56
|
return {
|
|
53
|
-
disconnect:
|
|
57
|
+
disconnect: on(target, 'scroll', handler, {
|
|
58
|
+
passive: true,
|
|
59
|
+
capture: true,
|
|
60
|
+
}),
|
|
54
61
|
};
|
|
55
62
|
},
|
|
56
63
|
{
|
|
@@ -61,6 +68,42 @@ export function scroll(options) {
|
|
|
61
68
|
);
|
|
62
69
|
}
|
|
63
70
|
|
|
71
|
+
export function swipe(options) {
|
|
72
|
+
return {
|
|
73
|
+
observe(target, handler) {
|
|
74
|
+
return {
|
|
75
|
+
observe: noop,
|
|
76
|
+
unobserve: noop,
|
|
77
|
+
disconnect: on(target, pointerDown, handler, { passive: true }),
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
handler(e) {
|
|
81
|
+
if (!isTouch(e)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Handle Swipe Gesture
|
|
86
|
+
const pos = getEventPos(e);
|
|
87
|
+
const target = 'tagName' in e.target ? e.target : parent(e.target);
|
|
88
|
+
once(document, `${pointerUp} ${pointerCancel} scroll`, (e) => {
|
|
89
|
+
const { x, y } = getEventPos(e);
|
|
90
|
+
|
|
91
|
+
// swipe
|
|
92
|
+
if (
|
|
93
|
+
(e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100) ||
|
|
94
|
+
(y && Math.abs(pos.y - y) > 100)
|
|
95
|
+
) {
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
trigger(target, 'swipe');
|
|
98
|
+
trigger(target, `swipe${swipeDirection(pos.x, pos.y, x, y)}`);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
...options,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
64
107
|
function observe(observe, options, emit) {
|
|
65
108
|
return {
|
|
66
109
|
observe,
|
|
@@ -70,3 +113,13 @@ function observe(observe, options, emit) {
|
|
|
70
113
|
...options,
|
|
71
114
|
};
|
|
72
115
|
}
|
|
116
|
+
|
|
117
|
+
function swipeDirection(x1, y1, x2, y2) {
|
|
118
|
+
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
|
|
119
|
+
? x1 - x2 > 0
|
|
120
|
+
? 'Left'
|
|
121
|
+
: 'Right'
|
|
122
|
+
: y1 - y2 > 0
|
|
123
|
+
? 'Up'
|
|
124
|
+
: 'Down';
|
|
125
|
+
}
|
package/src/js/core/offcanvas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Modal from '../mixin/modal';
|
|
2
|
-
import
|
|
2
|
+
import { swipe } from '../api/observables';
|
|
3
3
|
import {
|
|
4
4
|
$,
|
|
5
5
|
addClass,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from 'uikit-util';
|
|
17
17
|
|
|
18
18
|
export default {
|
|
19
|
-
mixins: [Modal
|
|
19
|
+
mixins: [Modal],
|
|
20
20
|
|
|
21
21
|
args: 'mode',
|
|
22
22
|
|
|
@@ -24,6 +24,7 @@ export default {
|
|
|
24
24
|
mode: String,
|
|
25
25
|
flip: Boolean,
|
|
26
26
|
overlay: Boolean,
|
|
27
|
+
swiping: Boolean,
|
|
27
28
|
},
|
|
28
29
|
|
|
29
30
|
data: {
|
|
@@ -40,6 +41,7 @@ export default {
|
|
|
40
41
|
clsOverlay: 'uk-offcanvas-overlay',
|
|
41
42
|
selClose: '.uk-offcanvas-close',
|
|
42
43
|
container: false,
|
|
44
|
+
swiping: true,
|
|
43
45
|
},
|
|
44
46
|
|
|
45
47
|
computed: {
|
|
@@ -68,6 +70,8 @@ export default {
|
|
|
68
70
|
},
|
|
69
71
|
},
|
|
70
72
|
|
|
73
|
+
observe: swipe({ filter: ({ swiping }) => swiping }),
|
|
74
|
+
|
|
71
75
|
update: {
|
|
72
76
|
read() {
|
|
73
77
|
if (this.isToggled() && !isVisible(this.$el)) {
|
package/src/js/core/switcher.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import Swipe from '../mixin/swipe';
|
|
2
1
|
import Togglable from '../mixin/togglable';
|
|
3
2
|
import { keyMap } from '../util/keys';
|
|
4
3
|
import { generateId } from '../api/instance';
|
|
5
|
-
import { lazyload } from '../api/observables';
|
|
4
|
+
import { lazyload, swipe } from '../api/observables';
|
|
6
5
|
import {
|
|
7
6
|
$$,
|
|
8
7
|
attr,
|
|
@@ -26,7 +25,7 @@ import {
|
|
|
26
25
|
const selDisabled = '.uk-disabled *, .uk-disabled, [disabled]';
|
|
27
26
|
|
|
28
27
|
export default {
|
|
29
|
-
mixins: [
|
|
28
|
+
mixins: [Togglable],
|
|
30
29
|
|
|
31
30
|
args: 'connect',
|
|
32
31
|
|
|
@@ -36,6 +35,7 @@ export default {
|
|
|
36
35
|
itemNav: String,
|
|
37
36
|
active: Number,
|
|
38
37
|
followFocus: Boolean,
|
|
38
|
+
swiping: Boolean,
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
data: {
|
|
@@ -47,6 +47,7 @@ export default {
|
|
|
47
47
|
attrItem: 'uk-switcher-item',
|
|
48
48
|
selVertical: '.uk-nav',
|
|
49
49
|
followFocus: false,
|
|
50
|
+
swiping: true,
|
|
50
51
|
},
|
|
51
52
|
|
|
52
53
|
computed: {
|
|
@@ -101,17 +102,16 @@ export default {
|
|
|
101
102
|
this.toggles.some((toggle) => within(toggle, child))
|
|
102
103
|
);
|
|
103
104
|
},
|
|
104
|
-
|
|
105
|
-
swipeTarget() {
|
|
106
|
-
return this.connects;
|
|
107
|
-
},
|
|
108
105
|
},
|
|
109
106
|
|
|
110
107
|
connected() {
|
|
111
108
|
attr(this.$el, 'role', 'tablist');
|
|
112
109
|
},
|
|
113
110
|
|
|
114
|
-
observe:
|
|
111
|
+
observe: [
|
|
112
|
+
lazyload({ targets: ({ connectChildren }) => connectChildren }),
|
|
113
|
+
swipe({ target: ({ connects }) => connects, filter: ({ swiping }) => swiping }),
|
|
114
|
+
],
|
|
115
115
|
|
|
116
116
|
events: [
|
|
117
117
|
{
|
package/src/js/mixin/swipe.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEventPos,
|
|
3
|
-
isTouch,
|
|
4
|
-
once,
|
|
5
|
-
parent,
|
|
6
|
-
pointerCancel,
|
|
7
|
-
pointerDown,
|
|
8
|
-
pointerUp,
|
|
9
|
-
trigger,
|
|
10
|
-
} from 'uikit-util';
|
|
11
|
-
|
|
12
|
-
// TODO
|
|
13
|
-
import { registerEvent } from '../api/events';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
props: {
|
|
17
|
-
swiping: Boolean,
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
data: {
|
|
21
|
-
swiping: true,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
computed: {
|
|
25
|
-
swipeTarget(props, $el) {
|
|
26
|
-
return $el;
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
connected() {
|
|
31
|
-
if (!this.swiping) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
registerEvent(this, {
|
|
36
|
-
el: this.swipeTarget,
|
|
37
|
-
name: pointerDown,
|
|
38
|
-
passive: true,
|
|
39
|
-
handler(e) {
|
|
40
|
-
if (!isTouch(e)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Handle Swipe Gesture
|
|
45
|
-
const pos = getEventPos(e);
|
|
46
|
-
const target = 'tagName' in e.target ? e.target : parent(e.target);
|
|
47
|
-
once(document, `${pointerUp} ${pointerCancel} scroll`, (e) => {
|
|
48
|
-
const { x, y } = getEventPos(e);
|
|
49
|
-
|
|
50
|
-
// swipe
|
|
51
|
-
if (
|
|
52
|
-
(e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100) ||
|
|
53
|
-
(y && Math.abs(pos.y - y) > 100)
|
|
54
|
-
) {
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
trigger(target, 'swipe');
|
|
57
|
-
trigger(target, `swipe${swipeDirection(pos.x, pos.y, x, y)}`);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
function swipeDirection(x1, y1, x2, y2) {
|
|
67
|
-
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
|
|
68
|
-
? x1 - x2 > 0
|
|
69
|
-
? 'Left'
|
|
70
|
-
: 'Right'
|
|
71
|
-
: y1 - y2 > 0
|
|
72
|
-
? 'Up'
|
|
73
|
-
: 'Down';
|
|
74
|
-
}
|