uikit 3.11.2-dev.fb043abc2 → 3.12.2
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 +63 -20
- 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 +144 -202
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +144 -202
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +146 -208
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +146 -208
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +66 -138
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1091 -1319
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1137 -1396
- 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 +347 -361
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +345 -360
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +749 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +345 -360
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +628 -798
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -620
- 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 +156 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5317 -6554
- 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 +8018 -9698
- 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 +15 -28
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +14 -33
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +199 -187
- package/src/js/components/countdown.js +32 -85
- package/src/js/components/filter.js +70 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +14 -25
- package/src/js/components/internal/slider-preload.js +9 -0
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +46 -64
- package/src/js/components/lightbox-panel.js +107 -105
- package/src/js/components/lightbox.js +17 -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 +117 -89
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -13
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +53 -63
- package/src/js/core/accordion.js +58 -48
- package/src/js/core/alert.js +9 -17
- package/src/js/core/core.js +17 -69
- package/src/js/core/cover.js +15 -15
- package/src/js/core/drop.js +110 -94
- package/src/js/core/form-custom.js +22 -27
- 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 +30 -34
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +153 -143
- 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 +49 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +113 -85
- package/src/js/core/offcanvas.js +51 -54
- 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 +161 -128
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +56 -47
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +69 -68
- package/src/js/core/video.js +22 -21
- 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 +58 -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/lazyload.js +20 -0
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +149 -107
- 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 +47 -60
- package/src/js/mixin/slideshow.js +12 -22
- package/src/js/mixin/swipe.js +72 -0
- package/src/js/mixin/togglable.js +89 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +25 -40
- package/src/js/util/animation.js +77 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +58 -45
- package/src/js/util/dom.js +37 -66
- 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 +18 -36
- package/src/js/util/index.js +1 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/observer.js +36 -0
- package/src/js/util/options.js +35 -49
- package/src/js/util/player.js +41 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +39 -49
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/base.less +10 -33
- package/src/less/components/flex.less +0 -9
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/height.less +3 -0
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/list.less +5 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +3 -3
- package/src/less/components/slideshow.less +3 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +25 -0
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +3 -4
- package/src/scss/components/height.scss +3 -0
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/list.scss +5 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/slider.scss +3 -3
- package/src/scss/components/slideshow.scss +3 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +25 -0
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +9 -9
- package/src/scss/variables.scss +9 -9
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/countdown.html +10 -8
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -64
- package/tests/images/image-type.avif +0 -0
- package/tests/images/image-type.jpeg +0 -0
- package/tests/images/image-type.webp +0 -0
- package/tests/index.html +8 -8
- package/tests/js/index.js +114 -85
- package/tests/lightbox.html +10 -10
- package/tests/marker.html +2 -2
- package/tests/modal.html +8 -9
- package/tests/navbar.html +2 -2
- package/tests/overlay.html +7 -7
- package/tests/parallax.html +16 -7
- package/tests/position.html +12 -12
- package/tests/slidenav.html +12 -12
- package/tests/slider.html +20 -20
- package/tests/sortable.html +1 -1
- package/tests/sticky-parallax.html +57 -72
- package/tests/sticky.html +14 -3
- package/tests/svg.html +6 -6
- package/tests/table.html +11 -11
- package/tests/thumbnav.html +12 -12
- package/tests/transition.html +30 -30
- package/tests/utility.html +50 -33
- package/tests/video.html +1 -1
- package/tests/width.html +1 -1
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
- package/tests/images/animated.gif +0 -0
package/src/js/core/offcanvas.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import Modal from '../mixin/modal';
|
|
2
|
-
import
|
|
2
|
+
import Swipe from '../mixin/swipe';
|
|
3
|
+
import {
|
|
4
|
+
$,
|
|
5
|
+
addClass,
|
|
6
|
+
append,
|
|
7
|
+
css,
|
|
8
|
+
endsWith,
|
|
9
|
+
hasClass,
|
|
10
|
+
height,
|
|
11
|
+
isVisible,
|
|
12
|
+
parent,
|
|
13
|
+
removeClass,
|
|
14
|
+
unwrap,
|
|
15
|
+
wrapAll,
|
|
16
|
+
} from 'uikit-util';
|
|
3
17
|
|
|
4
18
|
export default {
|
|
5
|
-
|
|
6
|
-
mixins: [Modal],
|
|
19
|
+
mixins: [Modal, Swipe],
|
|
7
20
|
|
|
8
21
|
args: 'mode',
|
|
9
22
|
|
|
10
23
|
props: {
|
|
11
24
|
mode: String,
|
|
12
25
|
flip: Boolean,
|
|
13
|
-
overlay: Boolean
|
|
26
|
+
overlay: Boolean,
|
|
14
27
|
},
|
|
15
28
|
|
|
16
29
|
data: {
|
|
@@ -26,65 +39,58 @@ export default {
|
|
|
26
39
|
clsMode: 'uk-offcanvas',
|
|
27
40
|
clsOverlay: 'uk-offcanvas-overlay',
|
|
28
41
|
selClose: '.uk-offcanvas-close',
|
|
29
|
-
container: false
|
|
42
|
+
container: false,
|
|
30
43
|
},
|
|
31
44
|
|
|
32
45
|
computed: {
|
|
33
|
-
|
|
34
|
-
clsFlip({flip, clsFlip}) {
|
|
46
|
+
clsFlip({ flip, clsFlip }) {
|
|
35
47
|
return flip ? clsFlip : '';
|
|
36
48
|
},
|
|
37
49
|
|
|
38
|
-
clsOverlay({overlay, clsOverlay}) {
|
|
50
|
+
clsOverlay({ overlay, clsOverlay }) {
|
|
39
51
|
return overlay ? clsOverlay : '';
|
|
40
52
|
},
|
|
41
53
|
|
|
42
|
-
clsMode({mode, clsMode}) {
|
|
54
|
+
clsMode({ mode, clsMode }) {
|
|
43
55
|
return `${clsMode}-${mode}`;
|
|
44
56
|
},
|
|
45
57
|
|
|
46
|
-
clsSidebarAnimation({mode, clsSidebarAnimation}) {
|
|
58
|
+
clsSidebarAnimation({ mode, clsSidebarAnimation }) {
|
|
47
59
|
return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
|
|
48
60
|
},
|
|
49
61
|
|
|
50
|
-
clsContainerAnimation({mode, clsContainerAnimation}) {
|
|
62
|
+
clsContainerAnimation({ mode, clsContainerAnimation }) {
|
|
51
63
|
return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation;
|
|
52
64
|
},
|
|
53
65
|
|
|
54
|
-
transitionElement({mode}) {
|
|
66
|
+
transitionElement({ mode }) {
|
|
55
67
|
return mode === 'reveal' ? parent(this.panel) : this.panel;
|
|
56
|
-
}
|
|
57
|
-
|
|
68
|
+
},
|
|
58
69
|
},
|
|
59
70
|
|
|
60
71
|
update: {
|
|
61
|
-
|
|
62
72
|
read() {
|
|
63
73
|
if (this.isToggled() && !isVisible(this.$el)) {
|
|
64
74
|
this.hide();
|
|
65
75
|
}
|
|
66
76
|
},
|
|
67
77
|
|
|
68
|
-
events: ['resize']
|
|
69
|
-
|
|
78
|
+
events: ['resize'],
|
|
70
79
|
},
|
|
71
80
|
|
|
72
81
|
events: [
|
|
73
|
-
|
|
74
82
|
{
|
|
75
|
-
|
|
76
83
|
name: 'click',
|
|
77
84
|
|
|
78
85
|
delegate() {
|
|
79
86
|
return 'a[href^="#"]';
|
|
80
87
|
},
|
|
81
88
|
|
|
82
|
-
handler({current: {hash}, defaultPrevented}) {
|
|
89
|
+
handler({ current: { hash }, defaultPrevented }) {
|
|
83
90
|
if (!defaultPrevented && hash && $(hash, document.body)) {
|
|
84
91
|
this.hide();
|
|
85
92
|
}
|
|
86
|
-
}
|
|
87
|
-
|
|
93
|
+
},
|
|
88
94
|
},
|
|
89
95
|
|
|
90
96
|
{
|
|
@@ -96,14 +102,11 @@ export default {
|
|
|
96
102
|
return this.panel;
|
|
97
103
|
},
|
|
98
104
|
|
|
99
|
-
handler({targetTouches}) {
|
|
100
|
-
|
|
105
|
+
handler({ targetTouches }) {
|
|
101
106
|
if (targetTouches.length === 1) {
|
|
102
107
|
this.clientY = targetTouches[0].clientY;
|
|
103
108
|
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
109
|
+
},
|
|
107
110
|
},
|
|
108
111
|
|
|
109
112
|
{
|
|
@@ -118,8 +121,7 @@ export default {
|
|
|
118
121
|
|
|
119
122
|
handler(e) {
|
|
120
123
|
e.cancelable && e.preventDefault();
|
|
121
|
-
}
|
|
122
|
-
|
|
124
|
+
},
|
|
123
125
|
},
|
|
124
126
|
|
|
125
127
|
{
|
|
@@ -132,23 +134,21 @@ export default {
|
|
|
132
134
|
},
|
|
133
135
|
|
|
134
136
|
handler(e) {
|
|
135
|
-
|
|
136
137
|
if (e.targetTouches.length !== 1) {
|
|
137
138
|
return;
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
const clientY = e.targetTouches[0].clientY - this.clientY;
|
|
141
|
-
const {scrollTop, scrollHeight, clientHeight} = this.panel;
|
|
142
|
+
const { scrollTop, scrollHeight, clientHeight } = this.panel;
|
|
142
143
|
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
if (
|
|
145
|
+
clientHeight >= scrollHeight ||
|
|
146
|
+
(scrollTop === 0 && clientY > 0) ||
|
|
147
|
+
(scrollHeight - scrollTop <= clientHeight && clientY < 0)
|
|
146
148
|
) {
|
|
147
149
|
e.cancelable && e.preventDefault();
|
|
148
150
|
}
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
151
|
+
},
|
|
152
152
|
},
|
|
153
153
|
|
|
154
154
|
{
|
|
@@ -157,7 +157,6 @@ export default {
|
|
|
157
157
|
self: true,
|
|
158
158
|
|
|
159
159
|
handler() {
|
|
160
|
-
|
|
161
160
|
if (this.mode === 'reveal' && !hasClass(parent(this.panel), this.clsMode)) {
|
|
162
161
|
wrapAll(this.panel, '<div>');
|
|
163
162
|
addClass(parent(this.panel), this.clsMode);
|
|
@@ -168,15 +167,17 @@ export default {
|
|
|
168
167
|
css(document.body, 'touch-action', 'pan-y pinch-zoom');
|
|
169
168
|
css(this.$el, 'display', 'block');
|
|
170
169
|
addClass(this.$el, this.clsOverlay);
|
|
171
|
-
addClass(
|
|
170
|
+
addClass(
|
|
171
|
+
this.panel,
|
|
172
|
+
this.clsSidebarAnimation,
|
|
173
|
+
this.mode !== 'reveal' ? this.clsMode : ''
|
|
174
|
+
);
|
|
172
175
|
|
|
173
176
|
height(document.body); // force reflow
|
|
174
177
|
addClass(document.body, this.clsContainerAnimation);
|
|
175
178
|
|
|
176
179
|
this.clsContainerAnimation && suppressUserScale();
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
+
},
|
|
180
181
|
},
|
|
181
182
|
|
|
182
183
|
{
|
|
@@ -187,7 +188,7 @@ export default {
|
|
|
187
188
|
handler() {
|
|
188
189
|
removeClass(document.body, this.clsContainerAnimation);
|
|
189
190
|
css(document.body, 'touch-action', '');
|
|
190
|
-
}
|
|
191
|
+
},
|
|
191
192
|
},
|
|
192
193
|
|
|
193
194
|
{
|
|
@@ -196,7 +197,6 @@ export default {
|
|
|
196
197
|
self: true,
|
|
197
198
|
|
|
198
199
|
handler() {
|
|
199
|
-
|
|
200
200
|
this.clsContainerAnimation && resumeUserScale();
|
|
201
201
|
|
|
202
202
|
if (this.mode === 'reveal') {
|
|
@@ -209,24 +209,19 @@ export default {
|
|
|
209
209
|
removeClass(document.body, this.clsContainer, this.clsFlip);
|
|
210
210
|
|
|
211
211
|
css(document.documentElement, 'overflowY', '');
|
|
212
|
-
|
|
213
|
-
}
|
|
212
|
+
},
|
|
214
213
|
},
|
|
215
214
|
|
|
216
215
|
{
|
|
217
216
|
name: 'swipeLeft swipeRight',
|
|
218
217
|
|
|
219
218
|
handler(e) {
|
|
220
|
-
|
|
221
219
|
if (this.isToggled() && endsWith(e.type, 'Left') ^ this.flip) {
|
|
222
220
|
this.hide();
|
|
223
221
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
]
|
|
229
|
-
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
],
|
|
230
225
|
};
|
|
231
226
|
|
|
232
227
|
// Chrome in responsive mode zooms page upon opening offcanvas
|
|
@@ -240,5 +235,7 @@ function resumeUserScale() {
|
|
|
240
235
|
}
|
|
241
236
|
|
|
242
237
|
function getViewport() {
|
|
243
|
-
return
|
|
238
|
+
return (
|
|
239
|
+
$('meta[name="viewport"]', document.head) || append(document.head, '<meta name="viewport">')
|
|
240
|
+
);
|
|
244
241
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import {closest, css, dimensions, height, isVisible, toFloat, trigger} from 'uikit-util';
|
|
2
|
+
import { closest, css, dimensions, height, isVisible, toFloat, trigger } from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
5
|
mixins: [Class],
|
|
7
6
|
|
|
8
7
|
props: {
|
|
9
8
|
selContainer: String,
|
|
10
9
|
selContent: String,
|
|
11
|
-
minHeight: Number
|
|
10
|
+
minHeight: Number,
|
|
12
11
|
},
|
|
13
12
|
|
|
14
13
|
data: {
|
|
15
14
|
selContainer: '.uk-modal',
|
|
16
15
|
selContent: '.uk-modal-dialog',
|
|
17
|
-
minHeight: 150
|
|
16
|
+
minHeight: 150,
|
|
18
17
|
},
|
|
19
18
|
|
|
20
19
|
computed: {
|
|
21
|
-
|
|
22
|
-
container({selContainer}, $el) {
|
|
20
|
+
container({ selContainer }, $el) {
|
|
23
21
|
return closest($el, selContainer);
|
|
24
22
|
},
|
|
25
23
|
|
|
26
|
-
content({selContent}, $el) {
|
|
24
|
+
content({ selContent }, $el) {
|
|
27
25
|
return closest($el, selContent);
|
|
28
|
-
}
|
|
29
|
-
|
|
26
|
+
},
|
|
30
27
|
},
|
|
31
28
|
|
|
32
29
|
connected() {
|
|
@@ -34,28 +31,27 @@ export default {
|
|
|
34
31
|
},
|
|
35
32
|
|
|
36
33
|
update: {
|
|
37
|
-
|
|
38
34
|
read() {
|
|
39
|
-
|
|
40
35
|
if (!this.content || !this.container || !isVisible(this.$el)) {
|
|
41
36
|
return false;
|
|
42
37
|
}
|
|
43
38
|
|
|
44
39
|
return {
|
|
45
40
|
current: toFloat(css(this.$el, 'maxHeight')),
|
|
46
|
-
max: Math.max(
|
|
41
|
+
max: Math.max(
|
|
42
|
+
this.minHeight,
|
|
43
|
+
height(this.container) - (dimensions(this.content).height - height(this.$el))
|
|
44
|
+
),
|
|
47
45
|
};
|
|
48
46
|
},
|
|
49
47
|
|
|
50
|
-
write({current, max}) {
|
|
48
|
+
write({ current, max }) {
|
|
51
49
|
css(this.$el, 'maxHeight', max);
|
|
52
50
|
if (Math.round(current) !== Math.round(max)) {
|
|
53
51
|
trigger(this.$el, 'resize');
|
|
54
52
|
}
|
|
55
53
|
},
|
|
56
54
|
|
|
57
|
-
events: ['resize']
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
55
|
+
events: ['resize'],
|
|
56
|
+
},
|
|
61
57
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {addClass, Dimensions, height, isVisible, parent, width} from 'uikit-util';
|
|
1
|
+
import { addClass, Dimensions, height, isVisible, parent, width } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
props: ['width', 'height'],
|
|
6
5
|
|
|
7
6
|
connected() {
|
|
@@ -9,22 +8,25 @@ export default {
|
|
|
9
8
|
},
|
|
10
9
|
|
|
11
10
|
update: {
|
|
12
|
-
|
|
13
11
|
read() {
|
|
14
12
|
return isVisible(this.$el) && this.width && this.height
|
|
15
|
-
? {width: width(parent(this.$el)), height: this.height}
|
|
13
|
+
? { width: width(parent(this.$el)), height: this.height }
|
|
16
14
|
: false;
|
|
17
15
|
},
|
|
18
16
|
|
|
19
17
|
write(dim) {
|
|
20
|
-
height(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
height(
|
|
19
|
+
this.$el,
|
|
20
|
+
Dimensions.contain(
|
|
21
|
+
{
|
|
22
|
+
height: this.height,
|
|
23
|
+
width: this.width,
|
|
24
|
+
},
|
|
25
|
+
dim
|
|
26
|
+
).height
|
|
27
|
+
);
|
|
24
28
|
},
|
|
25
29
|
|
|
26
|
-
events: ['resize']
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
+
events: ['resize'],
|
|
31
|
+
},
|
|
30
32
|
};
|
package/src/js/core/scroll.js
CHANGED
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
import {$, escape, scrollIntoView, trigger} from 'uikit-util';
|
|
1
|
+
import { $, escape, scrollIntoView, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
props: {
|
|
6
|
-
offset: Number
|
|
5
|
+
offset: Number,
|
|
7
6
|
},
|
|
8
7
|
|
|
9
8
|
data: {
|
|
10
|
-
offset: 0
|
|
9
|
+
offset: 0,
|
|
11
10
|
},
|
|
12
11
|
|
|
13
12
|
methods: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
el = el && $(el) || document.body;
|
|
13
|
+
async scrollTo(el) {
|
|
14
|
+
el = (el && $(el)) || document.body;
|
|
18
15
|
|
|
19
16
|
if (trigger(this.$el, 'beforescroll', [this, el])) {
|
|
20
|
-
scrollIntoView(el, {offset: this.offset})
|
|
21
|
-
|
|
22
|
-
);
|
|
17
|
+
await scrollIntoView(el, { offset: this.offset });
|
|
18
|
+
trigger(this.$el, 'scrolled', [this, el]);
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
20
|
+
},
|
|
27
21
|
},
|
|
28
22
|
|
|
29
23
|
events: {
|
|
30
|
-
|
|
31
24
|
click(e) {
|
|
32
|
-
|
|
33
25
|
if (e.defaultPrevented) {
|
|
34
26
|
return;
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
e.preventDefault();
|
|
38
30
|
this.scrollTo(`#${escape(decodeURIComponent((this.$el.hash || '').substr(1)))}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
31
|
+
},
|
|
32
|
+
},
|
|
43
33
|
};
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
$$,
|
|
3
|
+
addClass,
|
|
4
|
+
closest,
|
|
5
|
+
escape,
|
|
6
|
+
getViewport,
|
|
7
|
+
getViewportClientHeight,
|
|
8
|
+
hasClass,
|
|
9
|
+
isVisible,
|
|
10
|
+
offset,
|
|
11
|
+
removeClass,
|
|
12
|
+
scrollParents,
|
|
13
|
+
trigger,
|
|
14
|
+
} from 'uikit-util';
|
|
2
15
|
|
|
3
16
|
export default {
|
|
4
|
-
|
|
5
17
|
props: {
|
|
6
18
|
cls: String,
|
|
7
19
|
closest: String,
|
|
8
20
|
scroll: Boolean,
|
|
9
21
|
overflow: Boolean,
|
|
10
|
-
offset: Number
|
|
22
|
+
offset: Number,
|
|
11
23
|
},
|
|
12
24
|
|
|
13
25
|
data: {
|
|
@@ -15,60 +27,55 @@ export default {
|
|
|
15
27
|
closest: false,
|
|
16
28
|
scroll: false,
|
|
17
29
|
overflow: true,
|
|
18
|
-
offset: 0
|
|
30
|
+
offset: 0,
|
|
19
31
|
},
|
|
20
32
|
|
|
21
33
|
computed: {
|
|
22
|
-
|
|
23
34
|
links: {
|
|
24
|
-
|
|
25
35
|
get(_, $el) {
|
|
26
|
-
return $$('a[href^="#"]', $el).filter(el => el.hash);
|
|
36
|
+
return $$('a[href^="#"]', $el).filter((el) => el.hash);
|
|
27
37
|
},
|
|
28
38
|
|
|
29
39
|
watch(links) {
|
|
30
40
|
if (this.scroll) {
|
|
31
|
-
this.$create('scroll', links, {offset: this.offset || 0});
|
|
41
|
+
this.$create('scroll', links, { offset: this.offset || 0 });
|
|
32
42
|
}
|
|
33
43
|
},
|
|
34
44
|
|
|
35
|
-
immediate: true
|
|
36
|
-
|
|
45
|
+
immediate: true,
|
|
37
46
|
},
|
|
38
47
|
|
|
39
48
|
targets() {
|
|
40
|
-
return $$(this.links.map(el => escape(el.hash).substr(1)).join(','));
|
|
49
|
+
return $$(this.links.map((el) => escape(el.hash).substr(1)).join(','));
|
|
41
50
|
},
|
|
42
51
|
|
|
43
|
-
elements({closest: selector}) {
|
|
52
|
+
elements({ closest: selector }) {
|
|
44
53
|
return closest(this.links, selector || '*');
|
|
45
|
-
}
|
|
46
|
-
|
|
54
|
+
},
|
|
47
55
|
},
|
|
48
56
|
|
|
49
57
|
update: [
|
|
50
|
-
|
|
51
58
|
{
|
|
52
|
-
|
|
53
59
|
read() {
|
|
54
|
-
|
|
55
|
-
const {length} = this.targets;
|
|
60
|
+
const { length } = this.targets;
|
|
56
61
|
|
|
57
62
|
if (!length || !isVisible(this.$el)) {
|
|
58
63
|
return false;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
const [scrollElement] = scrollParents(this.targets, /auto|scroll/, true);
|
|
62
|
-
const {scrollTop, scrollHeight} = scrollElement;
|
|
67
|
+
const { scrollTop, scrollHeight } = scrollElement;
|
|
63
68
|
const max = scrollHeight - getViewportClientHeight(scrollElement);
|
|
64
69
|
let active = false;
|
|
65
70
|
|
|
66
71
|
if (scrollTop === max) {
|
|
67
72
|
active = length - 1;
|
|
68
73
|
} else {
|
|
69
|
-
|
|
70
74
|
this.targets.every((el, i) => {
|
|
71
|
-
if (
|
|
75
|
+
if (
|
|
76
|
+
offset(el).top - offset(getViewport(scrollElement)).top - this.offset <=
|
|
77
|
+
0
|
|
78
|
+
) {
|
|
72
79
|
active = i;
|
|
73
80
|
return true;
|
|
74
81
|
}
|
|
@@ -79,14 +86,13 @@ export default {
|
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
return {active};
|
|
89
|
+
return { active };
|
|
83
90
|
},
|
|
84
91
|
|
|
85
|
-
write({active}) {
|
|
86
|
-
|
|
92
|
+
write({ active }) {
|
|
87
93
|
const changed = active !== false && !hasClass(this.elements[active], this.cls);
|
|
88
94
|
|
|
89
|
-
this.links.forEach(el => el.blur());
|
|
95
|
+
this.links.forEach((el) => el.blur());
|
|
90
96
|
removeClass(this.elements, this.cls);
|
|
91
97
|
addClass(this.elements[active], this.cls);
|
|
92
98
|
|
|
@@ -95,10 +101,7 @@ export default {
|
|
|
95
101
|
}
|
|
96
102
|
},
|
|
97
103
|
|
|
98
|
-
events: ['scroll', 'resize']
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]
|
|
103
|
-
|
|
104
|
+
events: ['scroll', 'resize'],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
104
107
|
};
|