uikit 3.11.2-dev.c2430c233 → 3.11.2-dev.c7ed3c19b
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/.eslintrc.json +4 -49
- package/.prettierignore +14 -0
- package/.prettierrc.json +13 -0
- package/.webstorm.js +3 -3
- package/CHANGELOG.md +5 -0
- package/build/.eslintrc.json +1 -3
- package/build/build.js +26 -28
- package/build/icons.js +7 -11
- package/build/less.js +48 -36
- package/build/package.json +2 -2
- package/build/prefix.js +21 -18
- package/build/publishDev.js +6 -8
- package/build/release.js +20 -17
- package/build/scope.js +21 -11
- package/build/scss.js +72 -39
- package/build/util.js +71 -62
- package/build/wrapper/icons.js +0 -2
- 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 +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +409 -438
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1116 -1305
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1164 -1383
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +94 -114
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +294 -345
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +292 -344
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +727 -850
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +292 -344
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +615 -799
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +588 -619
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +324 -356
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5356 -6705
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +7 -9
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +8116 -9909
- package/dist/js/uikit.min.js +1 -1
- package/jsconfig.json +1 -1
- package/package.json +64 -60
- package/src/js/api/boot.js +25 -32
- package/src/js/api/component.js +23 -27
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +13 -32
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +65 -82
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +71 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +11 -23
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +42 -61
- package/src/js/components/lightbox-panel.js +135 -109
- package/src/js/components/lightbox.js +18 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +16 -30
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +75 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +8 -13
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +52 -63
- package/src/js/core/accordion.js +53 -48
- package/src/js/core/alert.js +10 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +106 -92
- package/src/js/core/form-custom.js +20 -25
- package/src/js/core/gif.js +3 -7
- package/src/js/core/grid.js +57 -58
- package/src/js/core/height-match.js +16 -29
- package/src/js/core/height-viewport.js +28 -35
- package/src/js/core/icon.js +38 -50
- package/src/js/core/img.js +59 -58
- package/src/js/core/index.js +39 -39
- package/src/js/core/leader.js +9 -18
- package/src/js/core/margin.js +21 -37
- package/src/js/core/modal.js +50 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +112 -88
- package/src/js/core/offcanvas.js +49 -53
- package/src/js/core/overflow-auto.js +13 -17
- package/src/js/core/responsive.js +14 -12
- package/src/js/core/scroll.js +10 -20
- package/src/js/core/scrollspy-nav.js +34 -31
- package/src/js/core/scrollspy.js +37 -54
- package/src/js/core/sticky.js +130 -91
- package/src/js/core/svg.js +60 -79
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +64 -66
- package/src/js/core/video.js +11 -22
- package/src/js/mixin/animate.js +19 -20
- package/src/js/mixin/class.js +2 -4
- package/src/js/mixin/container.js +7 -11
- package/src/js/mixin/internal/animate-fade.js +73 -30
- package/src/js/mixin/internal/animate-slide.js +61 -41
- package/src/js/mixin/internal/slideshow-animations.js +7 -14
- package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +53 -48
- package/src/js/mixin/position.js +26 -20
- package/src/js/mixin/slider-autoplay.js +12 -21
- package/src/js/mixin/slider-drag.js +64 -65
- package/src/js/mixin/slider-nav.js +26 -35
- package/src/js/mixin/slider-reactive.js +2 -8
- package/src/js/mixin/slider.js +51 -50
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +90 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +27 -43
- package/src/js/util/animation.js +82 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +56 -43
- package/src/js/util/dom.js +40 -73
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +79 -119
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +44 -49
- package/src/js/util/player.js +40 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +34 -49
- package/src/js/util/style.js +36 -46
- package/src/js/util/viewport.js +75 -64
- package/tests/js/index.js +114 -85
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
|
@@ -1,49 +1,45 @@
|
|
|
1
|
-
import {$, $$, data, html, toggleClass, toNumber} from 'uikit-util';
|
|
1
|
+
import { $, $$, data, html, toggleClass, toNumber } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
data: {
|
|
6
|
-
selNav: false
|
|
5
|
+
selNav: false,
|
|
7
6
|
},
|
|
8
7
|
|
|
9
8
|
computed: {
|
|
10
|
-
|
|
11
|
-
nav({selNav}, $el) {
|
|
9
|
+
nav({ selNav }, $el) {
|
|
12
10
|
return $(selNav, $el);
|
|
13
11
|
},
|
|
14
12
|
|
|
15
|
-
selNavItem({attrItem}) {
|
|
13
|
+
selNavItem({ attrItem }) {
|
|
16
14
|
return `[${attrItem}],[data-${attrItem}]`;
|
|
17
15
|
},
|
|
18
16
|
|
|
19
17
|
navItems(_, $el) {
|
|
20
18
|
return $$(this.selNavItem, $el);
|
|
21
|
-
}
|
|
22
|
-
|
|
19
|
+
},
|
|
23
20
|
},
|
|
24
21
|
|
|
25
22
|
update: {
|
|
26
|
-
|
|
27
23
|
write() {
|
|
28
|
-
|
|
29
24
|
if (this.nav && this.length !== this.nav.children.length) {
|
|
30
|
-
html(
|
|
25
|
+
html(
|
|
26
|
+
this.nav,
|
|
27
|
+
this.slides
|
|
28
|
+
.map((_, i) => `<li ${this.attrItem}="${i}"><a href></a></li>`)
|
|
29
|
+
.join('')
|
|
30
|
+
);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
this.navItems.concat(this.nav).forEach(el => el && (el.hidden = !this.maxIndex));
|
|
33
|
+
this.navItems.concat(this.nav).forEach((el) => el && (el.hidden = !this.maxIndex));
|
|
34
34
|
|
|
35
35
|
this.updateNav();
|
|
36
|
-
|
|
37
36
|
},
|
|
38
37
|
|
|
39
|
-
events: ['resize']
|
|
40
|
-
|
|
38
|
+
events: ['resize'],
|
|
41
39
|
},
|
|
42
40
|
|
|
43
41
|
events: [
|
|
44
|
-
|
|
45
42
|
{
|
|
46
|
-
|
|
47
43
|
name: 'click',
|
|
48
44
|
|
|
49
45
|
delegate() {
|
|
@@ -53,34 +49,29 @@ export default {
|
|
|
53
49
|
handler(e) {
|
|
54
50
|
e.preventDefault();
|
|
55
51
|
this.show(data(e.current, this.attrItem));
|
|
56
|
-
}
|
|
57
|
-
|
|
52
|
+
},
|
|
58
53
|
},
|
|
59
54
|
|
|
60
55
|
{
|
|
61
|
-
|
|
62
56
|
name: 'itemshow',
|
|
63
|
-
handler: 'updateNav'
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
57
|
+
handler: 'updateNav',
|
|
58
|
+
},
|
|
67
59
|
],
|
|
68
60
|
|
|
69
61
|
methods: {
|
|
70
|
-
|
|
71
62
|
updateNav() {
|
|
72
|
-
|
|
73
63
|
const i = this.getValidIndex();
|
|
74
|
-
this.navItems
|
|
75
|
-
|
|
64
|
+
for (const el of this.navItems) {
|
|
76
65
|
const cmd = data(el, this.attrItem);
|
|
77
66
|
|
|
78
67
|
toggleClass(el, this.clsActive, toNumber(cmd) === i);
|
|
79
|
-
toggleClass(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
68
|
+
toggleClass(
|
|
69
|
+
el,
|
|
70
|
+
'uk-invisible',
|
|
71
|
+
this.finite &&
|
|
72
|
+
((cmd === 'previous' && i === 0) || (cmd === 'next' && i >= this.maxIndex))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
86
77
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
2
|
update: {
|
|
4
|
-
|
|
5
3
|
write() {
|
|
6
|
-
|
|
7
4
|
if (this.stack.length || this.dragging) {
|
|
8
5
|
return;
|
|
9
6
|
}
|
|
@@ -13,11 +10,8 @@ export default {
|
|
|
13
10
|
if (!~this.prevIndex || this.index !== index) {
|
|
14
11
|
this.show(index);
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
},
|
|
18
14
|
|
|
19
|
-
events: ['resize']
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
15
|
+
events: ['resize'],
|
|
16
|
+
},
|
|
23
17
|
};
|
package/src/js/mixin/slider.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import SliderAutoplay from './slider-autoplay';
|
|
2
2
|
import SliderDrag from './slider-drag';
|
|
3
3
|
import SliderNav from './slider-nav';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
$,
|
|
6
|
+
$$,
|
|
7
|
+
assign,
|
|
8
|
+
clamp,
|
|
9
|
+
fastdom,
|
|
10
|
+
getIndex,
|
|
11
|
+
hasClass,
|
|
12
|
+
isNumber,
|
|
13
|
+
isRtl,
|
|
14
|
+
removeClass,
|
|
15
|
+
trigger,
|
|
16
|
+
} from 'uikit-util';
|
|
5
17
|
|
|
6
18
|
export default {
|
|
7
|
-
|
|
8
19
|
mixins: [SliderAutoplay, SliderDrag, SliderNav],
|
|
9
20
|
|
|
10
21
|
props: {
|
|
@@ -13,7 +24,7 @@ export default {
|
|
|
13
24
|
index: Number,
|
|
14
25
|
finite: Boolean,
|
|
15
26
|
velocity: Number,
|
|
16
|
-
selSlides: String
|
|
27
|
+
selSlides: String,
|
|
17
28
|
},
|
|
18
29
|
|
|
19
30
|
data: () => ({
|
|
@@ -27,7 +38,7 @@ export default {
|
|
|
27
38
|
clsActive: 'uk-active',
|
|
28
39
|
clsActivated: false,
|
|
29
40
|
Transitioner: false,
|
|
30
|
-
transitionOptions: {}
|
|
41
|
+
transitionOptions: {},
|
|
31
42
|
}),
|
|
32
43
|
|
|
33
44
|
connected() {
|
|
@@ -41,12 +52,11 @@ export default {
|
|
|
41
52
|
},
|
|
42
53
|
|
|
43
54
|
computed: {
|
|
44
|
-
|
|
45
|
-
duration({velocity}, $el) {
|
|
55
|
+
duration({ velocity }, $el) {
|
|
46
56
|
return speedUp($el.offsetWidth / velocity);
|
|
47
57
|
},
|
|
48
58
|
|
|
49
|
-
list({selList}, $el) {
|
|
59
|
+
list({ selList }, $el) {
|
|
50
60
|
return $(selList, $el);
|
|
51
61
|
},
|
|
52
62
|
|
|
@@ -54,45 +64,38 @@ export default {
|
|
|
54
64
|
return this.length - 1;
|
|
55
65
|
},
|
|
56
66
|
|
|
57
|
-
selSlides({selList, selSlides}) {
|
|
67
|
+
selSlides({ selList, selSlides }) {
|
|
58
68
|
return `${selList} ${selSlides || '> *'}`;
|
|
59
69
|
},
|
|
60
70
|
|
|
61
71
|
slides: {
|
|
62
|
-
|
|
63
72
|
get() {
|
|
64
73
|
return $$(this.selSlides, this.$el);
|
|
65
74
|
},
|
|
66
75
|
|
|
67
76
|
watch() {
|
|
68
77
|
this.$reset();
|
|
69
|
-
}
|
|
70
|
-
|
|
78
|
+
},
|
|
71
79
|
},
|
|
72
80
|
|
|
73
81
|
length() {
|
|
74
82
|
return this.slides.length;
|
|
75
|
-
}
|
|
76
|
-
|
|
83
|
+
},
|
|
77
84
|
},
|
|
78
85
|
|
|
79
86
|
events: {
|
|
80
|
-
|
|
81
87
|
itemshown() {
|
|
82
88
|
this.$update(this.list);
|
|
83
|
-
}
|
|
84
|
-
|
|
89
|
+
},
|
|
85
90
|
},
|
|
86
91
|
|
|
87
92
|
methods: {
|
|
88
|
-
|
|
89
93
|
show(index, force = false) {
|
|
90
|
-
|
|
91
94
|
if (this.dragging || !this.length) {
|
|
92
95
|
return;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
const {stack} = this;
|
|
98
|
+
const { stack } = this;
|
|
96
99
|
const queueIndex = force ? 0 : stack.length;
|
|
97
100
|
const reset = () => {
|
|
98
101
|
stack.splice(queueIndex, 1);
|
|
@@ -105,7 +108,6 @@ export default {
|
|
|
105
108
|
stack[force ? 'unshift' : 'push'](index);
|
|
106
109
|
|
|
107
110
|
if (!force && stack.length > 1) {
|
|
108
|
-
|
|
109
111
|
if (stack.length === 2) {
|
|
110
112
|
this._transitioner.forward(Math.min(this.duration, 200));
|
|
111
113
|
}
|
|
@@ -127,8 +129,9 @@ export default {
|
|
|
127
129
|
this.prevIndex = prevIndex;
|
|
128
130
|
this.index = nextIndex;
|
|
129
131
|
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
+
if (
|
|
133
|
+
(prev && !trigger(prev, 'beforeitemhide', [this])) ||
|
|
134
|
+
!trigger(next, 'beforeitemshow', [this, prev])
|
|
132
135
|
) {
|
|
133
136
|
this.index = this.prevIndex;
|
|
134
137
|
reset();
|
|
@@ -136,11 +139,10 @@ export default {
|
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
const promise = this._show(prev, next, force).then(() => {
|
|
139
|
-
|
|
140
142
|
prev && trigger(prev, 'itemhidden', [this]);
|
|
141
143
|
trigger(next, 'itemshown', [this]);
|
|
142
144
|
|
|
143
|
-
return new Promise(resolve => {
|
|
145
|
+
return new Promise((resolve) => {
|
|
144
146
|
fastdom.write(() => {
|
|
145
147
|
stack.shift();
|
|
146
148
|
if (stack.length) {
|
|
@@ -151,14 +153,12 @@ export default {
|
|
|
151
153
|
resolve();
|
|
152
154
|
});
|
|
153
155
|
});
|
|
154
|
-
|
|
155
156
|
});
|
|
156
157
|
|
|
157
158
|
prev && trigger(prev, 'itemhide', [this]);
|
|
158
159
|
trigger(next, 'itemshow', [this]);
|
|
159
160
|
|
|
160
161
|
return promise;
|
|
161
|
-
|
|
162
162
|
},
|
|
163
163
|
|
|
164
164
|
getIndex(index = this.index, prev = this.index) {
|
|
@@ -170,18 +170,20 @@ export default {
|
|
|
170
170
|
},
|
|
171
171
|
|
|
172
172
|
_show(prev, next, force) {
|
|
173
|
-
|
|
174
173
|
this._transitioner = this._getTransitioner(
|
|
175
174
|
prev,
|
|
176
175
|
next,
|
|
177
176
|
this.dir,
|
|
178
|
-
assign(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
?
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
assign(
|
|
178
|
+
{
|
|
179
|
+
easing: force
|
|
180
|
+
? next.offsetWidth < 600
|
|
181
|
+
? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
|
|
182
|
+
: 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
|
|
183
|
+
: this.easing,
|
|
184
|
+
},
|
|
185
|
+
this.transitionOptions
|
|
186
|
+
)
|
|
185
187
|
);
|
|
186
188
|
|
|
187
189
|
if (!force && !prev) {
|
|
@@ -189,9 +191,11 @@ export default {
|
|
|
189
191
|
return Promise.resolve();
|
|
190
192
|
}
|
|
191
193
|
|
|
192
|
-
const {length} = this.stack;
|
|
193
|
-
return this._transitioner[length > 1 ? 'forward' : 'show'](
|
|
194
|
-
|
|
194
|
+
const { length } = this.stack;
|
|
195
|
+
return this._transitioner[length > 1 ? 'forward' : 'show'](
|
|
196
|
+
length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration,
|
|
197
|
+
this.percent
|
|
198
|
+
);
|
|
195
199
|
},
|
|
196
200
|
|
|
197
201
|
_getDistance(prev, next) {
|
|
@@ -204,29 +208,26 @@ export default {
|
|
|
204
208
|
return transitioner;
|
|
205
209
|
},
|
|
206
210
|
|
|
207
|
-
_getTransitioner(
|
|
211
|
+
_getTransitioner(
|
|
212
|
+
prev = this.prevIndex,
|
|
213
|
+
next = this.index,
|
|
214
|
+
dir = this.dir || 1,
|
|
215
|
+
options = this.transitionOptions
|
|
216
|
+
) {
|
|
208
217
|
return new this.Transitioner(
|
|
209
218
|
isNumber(prev) ? this.slides[prev] : prev,
|
|
210
219
|
isNumber(next) ? this.slides[next] : next,
|
|
211
220
|
dir * (isRtl ? -1 : 1),
|
|
212
221
|
options
|
|
213
222
|
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
223
|
+
},
|
|
224
|
+
},
|
|
218
225
|
};
|
|
219
226
|
|
|
220
227
|
function getDirection(index, prevIndex) {
|
|
221
|
-
return index === 'next'
|
|
222
|
-
? 1
|
|
223
|
-
: index === 'previous'
|
|
224
|
-
? -1
|
|
225
|
-
: index < prevIndex
|
|
226
|
-
? -1
|
|
227
|
-
: 1;
|
|
228
|
+
return index === 'next' ? 1 : index === 'previous' ? -1 : index < prevIndex ? -1 : 1;
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
export function speedUp(x) {
|
|
231
|
-
return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
|
|
232
|
+
return 0.5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
|
|
232
233
|
}
|
|
@@ -1,53 +1,47 @@
|
|
|
1
1
|
import Animations from './internal/slideshow-animations';
|
|
2
2
|
import Transitioner from './internal/slideshow-transitioner';
|
|
3
3
|
import Slider from './slider.js';
|
|
4
|
-
import {addClass, assign, removeClass} from 'uikit-util';
|
|
4
|
+
import { addClass, assign, removeClass } from 'uikit-util';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
|
|
8
7
|
mixins: [Slider],
|
|
9
8
|
|
|
10
9
|
props: {
|
|
11
|
-
animation: String
|
|
10
|
+
animation: String,
|
|
12
11
|
},
|
|
13
12
|
|
|
14
13
|
data: {
|
|
15
14
|
animation: 'slide',
|
|
16
15
|
clsActivated: 'uk-transition-active',
|
|
17
16
|
Animations,
|
|
18
|
-
Transitioner
|
|
17
|
+
Transitioner,
|
|
19
18
|
},
|
|
20
19
|
|
|
21
20
|
computed: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return assign(Animations[animation] || Animations.slide, {name: animation});
|
|
21
|
+
animation({ animation, Animations }) {
|
|
22
|
+
return assign(Animations[animation] || Animations.slide, { name: animation });
|
|
25
23
|
},
|
|
26
24
|
|
|
27
25
|
transitionOptions() {
|
|
28
|
-
return {animation: this.animation};
|
|
29
|
-
}
|
|
30
|
-
|
|
26
|
+
return { animation: this.animation };
|
|
27
|
+
},
|
|
31
28
|
},
|
|
32
29
|
|
|
33
30
|
events: {
|
|
34
|
-
|
|
35
|
-
'itemshow itemhide itemshown itemhidden'({target}) {
|
|
31
|
+
'itemshow itemhide itemshown itemhidden'({ target }) {
|
|
36
32
|
this.$update(target);
|
|
37
33
|
},
|
|
38
34
|
|
|
39
|
-
beforeitemshow({target}) {
|
|
35
|
+
beforeitemshow({ target }) {
|
|
40
36
|
addClass(target, this.clsActive);
|
|
41
37
|
},
|
|
42
38
|
|
|
43
|
-
itemshown({target}) {
|
|
39
|
+
itemshown({ target }) {
|
|
44
40
|
addClass(target, this.clsActivated);
|
|
45
41
|
},
|
|
46
42
|
|
|
47
|
-
itemhidden({target}) {
|
|
43
|
+
itemhidden({ target }) {
|
|
48
44
|
removeClass(target, this.clsActive, this.clsActivated);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
45
|
+
},
|
|
46
|
+
},
|
|
53
47
|
};
|
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
$$,
|
|
3
|
+
addClass,
|
|
4
|
+
Animation,
|
|
5
|
+
assign,
|
|
6
|
+
css,
|
|
7
|
+
fastdom,
|
|
8
|
+
hasClass,
|
|
9
|
+
height,
|
|
10
|
+
includes,
|
|
11
|
+
isBoolean,
|
|
12
|
+
isFunction,
|
|
13
|
+
isVisible,
|
|
14
|
+
noop,
|
|
15
|
+
removeClass,
|
|
16
|
+
toFloat,
|
|
17
|
+
toggleClass,
|
|
18
|
+
toNodes,
|
|
19
|
+
Transition,
|
|
20
|
+
trigger,
|
|
21
|
+
} from 'uikit-util';
|
|
2
22
|
|
|
3
23
|
export default {
|
|
4
|
-
|
|
5
24
|
props: {
|
|
6
25
|
cls: Boolean,
|
|
7
26
|
animation: 'list',
|
|
8
27
|
duration: Number,
|
|
9
28
|
origin: String,
|
|
10
|
-
transition: String
|
|
29
|
+
transition: String,
|
|
11
30
|
},
|
|
12
31
|
|
|
13
32
|
data: {
|
|
@@ -25,7 +44,7 @@ export default {
|
|
|
25
44
|
paddingTop: '',
|
|
26
45
|
paddingBottom: '',
|
|
27
46
|
marginTop: '',
|
|
28
|
-
marginBottom: ''
|
|
47
|
+
marginBottom: '',
|
|
29
48
|
},
|
|
30
49
|
|
|
31
50
|
hideProps: {
|
|
@@ -34,63 +53,61 @@ export default {
|
|
|
34
53
|
paddingTop: 0,
|
|
35
54
|
paddingBottom: 0,
|
|
36
55
|
marginTop: 0,
|
|
37
|
-
marginBottom: 0
|
|
38
|
-
}
|
|
39
|
-
|
|
56
|
+
marginBottom: 0,
|
|
57
|
+
},
|
|
40
58
|
},
|
|
41
59
|
|
|
42
60
|
computed: {
|
|
43
|
-
|
|
44
|
-
hasAnimation({animation}) {
|
|
61
|
+
hasAnimation({ animation }) {
|
|
45
62
|
return !!animation[0];
|
|
46
63
|
},
|
|
47
64
|
|
|
48
|
-
hasTransition({animation}) {
|
|
65
|
+
hasTransition({ animation }) {
|
|
49
66
|
return this.hasAnimation && animation[0] === true;
|
|
50
|
-
}
|
|
51
|
-
|
|
67
|
+
},
|
|
52
68
|
},
|
|
53
69
|
|
|
54
70
|
methods: {
|
|
55
|
-
|
|
56
71
|
toggleElement(targets, toggle, animate) {
|
|
57
|
-
return new Promise(resolve =>
|
|
58
|
-
Promise.all(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
return new Promise((resolve) =>
|
|
73
|
+
Promise.all(
|
|
74
|
+
toNodes(targets).map((el) => {
|
|
75
|
+
const show = isBoolean(toggle) ? toggle : !this.isToggled(el);
|
|
76
|
+
|
|
77
|
+
if (!trigger(el, `before${show ? 'show' : 'hide'}`, [this])) {
|
|
78
|
+
return Promise.reject();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const promise = (
|
|
82
|
+
isFunction(animate)
|
|
83
|
+
? animate
|
|
84
|
+
: animate === false || !this.hasAnimation
|
|
85
|
+
? this._toggle
|
|
86
|
+
: this.hasTransition
|
|
72
87
|
? toggleHeight(this)
|
|
73
88
|
: toggleAnimation(this)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const cls = show ? this.clsEnter : this.clsLeave;
|
|
89
|
+
)(el, show);
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
const cls = show ? this.clsEnter : this.clsLeave;
|
|
79
92
|
|
|
80
|
-
|
|
93
|
+
addClass(el, cls);
|
|
81
94
|
|
|
82
|
-
|
|
83
|
-
removeClass(el, cls);
|
|
84
|
-
trigger(el, show ? 'shown' : 'hidden', [this]);
|
|
85
|
-
this.$update(el);
|
|
86
|
-
};
|
|
95
|
+
trigger(el, show ? 'show' : 'hide', [this]);
|
|
87
96
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
const done = () => {
|
|
98
|
+
removeClass(el, cls);
|
|
99
|
+
trigger(el, show ? 'shown' : 'hidden', [this]);
|
|
100
|
+
this.$update(el);
|
|
101
|
+
};
|
|
92
102
|
|
|
93
|
-
|
|
103
|
+
return promise
|
|
104
|
+
? promise.then(done, () => {
|
|
105
|
+
removeClass(el, cls);
|
|
106
|
+
return Promise.reject();
|
|
107
|
+
})
|
|
108
|
+
: done();
|
|
109
|
+
})
|
|
110
|
+
).then(resolve, noop)
|
|
94
111
|
);
|
|
95
112
|
},
|
|
96
113
|
|
|
@@ -99,14 +116,13 @@ export default {
|
|
|
99
116
|
return hasClass(el, this.clsEnter)
|
|
100
117
|
? true
|
|
101
118
|
: hasClass(el, this.clsLeave)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
119
|
+
? false
|
|
120
|
+
: this.cls
|
|
121
|
+
? hasClass(el, this.cls.split(' ')[0])
|
|
122
|
+
: isVisible(el);
|
|
106
123
|
},
|
|
107
124
|
|
|
108
125
|
_toggle(el, toggled) {
|
|
109
|
-
|
|
110
126
|
if (!el) {
|
|
111
127
|
return;
|
|
112
128
|
}
|
|
@@ -122,23 +138,23 @@ export default {
|
|
|
122
138
|
changed && (el.hidden = !toggled);
|
|
123
139
|
}
|
|
124
140
|
|
|
125
|
-
$$('[autofocus]', el).some(el => isVisible(el) ? el.focus() || true : el.blur());
|
|
141
|
+
$$('[autofocus]', el).some((el) => (isVisible(el) ? el.focus() || true : el.blur()));
|
|
126
142
|
|
|
127
143
|
if (changed) {
|
|
128
144
|
trigger(el, 'toggled', [toggled, this]);
|
|
129
145
|
this.$update(el);
|
|
130
146
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
147
|
+
},
|
|
148
|
+
},
|
|
135
149
|
};
|
|
136
150
|
|
|
137
|
-
export function toggleHeight({isToggled, duration, initProps, hideProps, transition, _toggle}) {
|
|
151
|
+
export function toggleHeight({ isToggled, duration, initProps, hideProps, transition, _toggle }) {
|
|
138
152
|
return (el, show) => {
|
|
139
|
-
|
|
140
153
|
const inProgress = Transition.inProgress(el);
|
|
141
|
-
const inner = el.hasChildNodes
|
|
154
|
+
const inner = el.hasChildNodes
|
|
155
|
+
? toFloat(css(el.firstElementChild, 'marginTop')) +
|
|
156
|
+
toFloat(css(el.lastElementChild, 'marginBottom'))
|
|
157
|
+
: 0;
|
|
142
158
|
const currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
|
|
143
159
|
|
|
144
160
|
Transition.cancel(el);
|
|
@@ -155,26 +171,37 @@ export function toggleHeight({isToggled, duration, initProps, hideProps, transit
|
|
|
155
171
|
const endHeight = height(el) + (inProgress ? 0 : inner);
|
|
156
172
|
height(el, currentHeight);
|
|
157
173
|
|
|
158
|
-
return (
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
return (
|
|
175
|
+
show
|
|
176
|
+
? Transition.start(
|
|
177
|
+
el,
|
|
178
|
+
assign({}, initProps, { overflow: 'hidden', height: endHeight }),
|
|
179
|
+
Math.round(duration * (1 - currentHeight / endHeight)),
|
|
180
|
+
transition
|
|
181
|
+
)
|
|
182
|
+
: Transition.start(
|
|
183
|
+
el,
|
|
184
|
+
hideProps,
|
|
185
|
+
Math.round(duration * (currentHeight / endHeight)),
|
|
186
|
+
transition
|
|
187
|
+
).then(() => _toggle(el, false))
|
|
161
188
|
).then(() => css(el, initProps));
|
|
162
|
-
|
|
163
189
|
};
|
|
164
190
|
}
|
|
165
191
|
|
|
166
192
|
function toggleAnimation(cmp) {
|
|
167
193
|
return (el, show) => {
|
|
168
|
-
|
|
169
194
|
Animation.cancel(el);
|
|
170
195
|
|
|
171
|
-
const {animation, duration, _toggle} = cmp;
|
|
196
|
+
const { animation, duration, _toggle } = cmp;
|
|
172
197
|
|
|
173
198
|
if (show) {
|
|
174
199
|
_toggle(el, true);
|
|
175
200
|
return Animation.in(el, animation[0], duration, cmp.origin);
|
|
176
201
|
}
|
|
177
202
|
|
|
178
|
-
return Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(() =>
|
|
203
|
+
return Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(() =>
|
|
204
|
+
_toggle(el, false)
|
|
205
|
+
);
|
|
179
206
|
};
|
|
180
207
|
}
|
package/src/js/uikit-core.js
CHANGED
|
@@ -2,12 +2,10 @@ import UIkit from './api/index';
|
|
|
2
2
|
import Core from './core/core';
|
|
3
3
|
import boot from './api/boot';
|
|
4
4
|
import * as components from './core/index';
|
|
5
|
-
import {each} from 'uikit-util';
|
|
5
|
+
import { each } from 'uikit-util';
|
|
6
6
|
|
|
7
7
|
// register components
|
|
8
|
-
each(components, (component, name) =>
|
|
9
|
-
UIkit.component(name, component)
|
|
10
|
-
);
|
|
8
|
+
each(components, (component, name) => UIkit.component(name, component));
|
|
11
9
|
|
|
12
10
|
// core functionality
|
|
13
11
|
UIkit.use(Core);
|