uikit 3.11.2-dev.bbaa4362f → 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 +8 -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 +42 -17
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +42 -17
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +42 -17
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +42 -17
- 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 -6709
- 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 -9913
- 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 +79 -100
- 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 +107 -93
- 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/src/less/components/flex.less +0 -9
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form.scss +3 -3
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/variables-theme.scss +6 -6
- package/src/scss/variables.scss +6 -6
- 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,7 +1,6 @@
|
|
|
1
|
-
import {addClass, ajax, matches, noop, on, removeClass, trigger} from 'uikit-util';
|
|
1
|
+
import { addClass, ajax, matches, noop, on, removeClass, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
props: {
|
|
6
5
|
allow: String,
|
|
7
6
|
clsDragover: String,
|
|
@@ -16,7 +15,7 @@ export default {
|
|
|
16
15
|
name: String,
|
|
17
16
|
params: Object,
|
|
18
17
|
type: String,
|
|
19
|
-
url: String
|
|
18
|
+
url: String,
|
|
20
19
|
},
|
|
21
20
|
|
|
22
21
|
data: {
|
|
@@ -44,13 +43,11 @@ export default {
|
|
|
44
43
|
load: noop,
|
|
45
44
|
loadEnd: noop,
|
|
46
45
|
loadStart: noop,
|
|
47
|
-
progress: noop
|
|
46
|
+
progress: noop,
|
|
48
47
|
},
|
|
49
48
|
|
|
50
49
|
events: {
|
|
51
|
-
|
|
52
50
|
change(e) {
|
|
53
|
-
|
|
54
51
|
if (!matches(e.target, 'input[type="file"]')) {
|
|
55
52
|
return;
|
|
56
53
|
}
|
|
@@ -69,7 +66,7 @@ export default {
|
|
|
69
66
|
|
|
70
67
|
const transfer = e.dataTransfer;
|
|
71
68
|
|
|
72
|
-
if (!transfer
|
|
69
|
+
if (!transfer?.files) {
|
|
73
70
|
return;
|
|
74
71
|
}
|
|
75
72
|
|
|
@@ -90,108 +87,100 @@ export default {
|
|
|
90
87
|
dragleave(e) {
|
|
91
88
|
stop(e);
|
|
92
89
|
removeClass(this.$el, this.clsDragover);
|
|
93
|
-
}
|
|
94
|
-
|
|
90
|
+
},
|
|
95
91
|
},
|
|
96
92
|
|
|
97
93
|
methods: {
|
|
98
|
-
|
|
99
|
-
upload(files) {
|
|
100
|
-
|
|
94
|
+
async upload(files) {
|
|
101
95
|
if (!files.length) {
|
|
102
96
|
return;
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
trigger(this.$el, 'upload', [files]);
|
|
106
100
|
|
|
107
|
-
for (
|
|
108
|
-
|
|
109
|
-
if (this.maxSize && this.maxSize * 1000 < files[i].size) {
|
|
101
|
+
for (const file of files) {
|
|
102
|
+
if (this.maxSize && this.maxSize * 1000 < file.size) {
|
|
110
103
|
this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
|
|
111
104
|
return;
|
|
112
105
|
}
|
|
113
106
|
|
|
114
|
-
if (this.allow && !match(this.allow,
|
|
107
|
+
if (this.allow && !match(this.allow, file.name)) {
|
|
115
108
|
this.fail(this.msgInvalidName.replace('%s', this.allow));
|
|
116
109
|
return;
|
|
117
110
|
}
|
|
118
111
|
|
|
119
|
-
if (this.mime && !match(this.mime,
|
|
112
|
+
if (this.mime && !match(this.mime, file.type)) {
|
|
120
113
|
this.fail(this.msgInvalidMime.replace('%s', this.mime));
|
|
121
114
|
return;
|
|
122
115
|
}
|
|
123
|
-
|
|
124
116
|
}
|
|
125
117
|
|
|
126
118
|
if (!this.multiple) {
|
|
127
|
-
files =
|
|
119
|
+
files = files.slice(0, 1);
|
|
128
120
|
}
|
|
129
121
|
|
|
130
122
|
this.beforeAll(this, files);
|
|
131
123
|
|
|
132
124
|
const chunks = chunk(files, this.concurrent);
|
|
133
|
-
const upload = files => {
|
|
134
|
-
|
|
125
|
+
const upload = async (files) => {
|
|
135
126
|
const data = new FormData();
|
|
136
127
|
|
|
137
|
-
files.forEach(file => data.append(this.name, file));
|
|
128
|
+
files.forEach((file) => data.append(this.name, file));
|
|
138
129
|
|
|
139
130
|
for (const key in this.params) {
|
|
140
131
|
data.append(key, this.params[key]);
|
|
141
132
|
}
|
|
142
133
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
134
|
+
try {
|
|
135
|
+
const xhr = await ajax(this.url, {
|
|
136
|
+
data,
|
|
137
|
+
method: this.method,
|
|
138
|
+
responseType: this.type,
|
|
139
|
+
beforeSend: (env) => {
|
|
140
|
+
const { xhr } = env;
|
|
141
|
+
xhr.upload && on(xhr.upload, 'progress', this.progress);
|
|
142
|
+
for (const type of ['loadStart', 'load', 'loadEnd', 'abort']) {
|
|
143
|
+
on(xhr, type.toLowerCase(), this[type]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return this.beforeSend(env);
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
this.complete(xhr);
|
|
151
|
+
|
|
152
|
+
if (chunks.length) {
|
|
153
|
+
await upload(chunks.shift());
|
|
154
|
+
} else {
|
|
155
|
+
this.completeAll(xhr);
|
|
157
156
|
}
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.complete(xhr);
|
|
162
|
-
|
|
163
|
-
if (chunks.length) {
|
|
164
|
-
upload(chunks.shift());
|
|
165
|
-
} else {
|
|
166
|
-
this.completeAll(xhr);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
e => this.error(e)
|
|
171
|
-
);
|
|
172
|
-
|
|
157
|
+
} catch (e) {
|
|
158
|
+
this.error(e);
|
|
159
|
+
}
|
|
173
160
|
};
|
|
174
161
|
|
|
175
|
-
upload(chunks.shift());
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
162
|
+
await upload(chunks.shift());
|
|
163
|
+
},
|
|
164
|
+
},
|
|
181
165
|
};
|
|
182
166
|
|
|
183
167
|
function match(pattern, path) {
|
|
184
|
-
return path.match(
|
|
168
|
+
return path.match(
|
|
169
|
+
new RegExp(
|
|
170
|
+
`^${pattern
|
|
171
|
+
.replace(/\//g, '\\/')
|
|
172
|
+
.replace(/\*\*/g, '(\\/[^\\/]+)*')
|
|
173
|
+
.replace(/\*/g, '[^\\/]+')
|
|
174
|
+
.replace(/((?!\\))\?/g, '$1.')}$`,
|
|
175
|
+
'i'
|
|
176
|
+
)
|
|
177
|
+
);
|
|
185
178
|
}
|
|
186
179
|
|
|
187
180
|
function chunk(files, size) {
|
|
188
181
|
const chunks = [];
|
|
189
182
|
for (let i = 0; i < files.length; i += size) {
|
|
190
|
-
|
|
191
|
-
for (let j = 0; j < size; j++) {
|
|
192
|
-
chunk.push(files[i + j]);
|
|
193
|
-
}
|
|
194
|
-
chunks.push(chunk);
|
|
183
|
+
chunks.push(files.slice(i, i + size));
|
|
195
184
|
}
|
|
196
185
|
return chunks;
|
|
197
186
|
}
|
package/src/js/core/accordion.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import {default as Togglable, toggleHeight} from '../mixin/togglable';
|
|
3
|
-
import {
|
|
2
|
+
import { default as Togglable, toggleHeight } from '../mixin/togglable';
|
|
3
|
+
import {
|
|
4
|
+
$,
|
|
5
|
+
$$,
|
|
6
|
+
attr,
|
|
7
|
+
filter,
|
|
8
|
+
getIndex,
|
|
9
|
+
hasClass,
|
|
10
|
+
includes,
|
|
11
|
+
index,
|
|
12
|
+
isInView,
|
|
13
|
+
scrollIntoView,
|
|
14
|
+
toggleClass,
|
|
15
|
+
unwrap,
|
|
16
|
+
wrapAll,
|
|
17
|
+
} from 'uikit-util';
|
|
4
18
|
|
|
5
19
|
export default {
|
|
6
|
-
|
|
7
20
|
mixins: [Class, Togglable],
|
|
8
21
|
|
|
9
22
|
props: {
|
|
@@ -14,7 +27,7 @@ export default {
|
|
|
14
27
|
toggle: String,
|
|
15
28
|
content: String,
|
|
16
29
|
transition: String,
|
|
17
|
-
offset: Number
|
|
30
|
+
offset: Number,
|
|
18
31
|
},
|
|
19
32
|
|
|
20
33
|
data: {
|
|
@@ -27,48 +40,41 @@ export default {
|
|
|
27
40
|
toggle: '> .uk-accordion-title',
|
|
28
41
|
content: '> .uk-accordion-content',
|
|
29
42
|
transition: 'ease',
|
|
30
|
-
offset: 0
|
|
43
|
+
offset: 0,
|
|
31
44
|
},
|
|
32
45
|
|
|
33
46
|
computed: {
|
|
34
|
-
|
|
35
47
|
items: {
|
|
36
|
-
|
|
37
|
-
get({targets}, $el) {
|
|
48
|
+
get({ targets }, $el) {
|
|
38
49
|
return $$(targets, $el);
|
|
39
50
|
},
|
|
40
51
|
|
|
41
52
|
watch(items, prev) {
|
|
42
|
-
|
|
43
|
-
items.forEach(el => hide($(this.content, el), !hasClass(el, this.clsOpen)));
|
|
53
|
+
items.forEach((el) => hide($(this.content, el), !hasClass(el, this.clsOpen)));
|
|
44
54
|
|
|
45
55
|
if (prev || hasClass(items, this.clsOpen)) {
|
|
46
56
|
return;
|
|
47
57
|
}
|
|
48
58
|
|
|
49
|
-
const active =
|
|
50
|
-
|
|
59
|
+
const active =
|
|
60
|
+
(this.active !== false && items[Number(this.active)]) ||
|
|
61
|
+
(!this.collapsible && items[0]);
|
|
51
62
|
|
|
52
63
|
if (active) {
|
|
53
64
|
this.toggle(active, false);
|
|
54
65
|
}
|
|
55
|
-
|
|
56
66
|
},
|
|
57
67
|
|
|
58
|
-
immediate: true
|
|
59
|
-
|
|
68
|
+
immediate: true,
|
|
60
69
|
},
|
|
61
70
|
|
|
62
|
-
toggles({toggle}) {
|
|
63
|
-
return this.items.map(item => $(toggle, item));
|
|
64
|
-
}
|
|
65
|
-
|
|
71
|
+
toggles({ toggle }) {
|
|
72
|
+
return this.items.map((item) => $(toggle, item));
|
|
73
|
+
},
|
|
66
74
|
},
|
|
67
75
|
|
|
68
76
|
events: [
|
|
69
|
-
|
|
70
77
|
{
|
|
71
|
-
|
|
72
78
|
name: 'click',
|
|
73
79
|
|
|
74
80
|
delegate() {
|
|
@@ -78,16 +84,12 @@ export default {
|
|
|
78
84
|
handler(e) {
|
|
79
85
|
e.preventDefault();
|
|
80
86
|
this.toggle(index(this.toggles, e.current));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
87
|
+
},
|
|
88
|
+
},
|
|
85
89
|
],
|
|
86
90
|
|
|
87
91
|
methods: {
|
|
88
|
-
|
|
89
92
|
toggle(item, animate) {
|
|
90
|
-
|
|
91
93
|
let items = [this.items[getIndex(item, this.items)]];
|
|
92
94
|
const activeItems = filter(this.items, `.${this.clsOpen}`);
|
|
93
95
|
|
|
@@ -95,44 +97,47 @@ export default {
|
|
|
95
97
|
items = items.concat(activeItems);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
if (
|
|
100
|
+
if (
|
|
101
|
+
!this.collapsible &&
|
|
102
|
+
activeItems.length < 2 &&
|
|
103
|
+
!filter(items, `:not(.${this.clsOpen})`).length
|
|
104
|
+
) {
|
|
99
105
|
return;
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
for (const el of items) {
|
|
109
|
+
this.toggleElement(el, !hasClass(el, this.clsOpen), async (el, show) => {
|
|
110
|
+
toggleClass(el, this.clsOpen, show);
|
|
111
|
+
attr($(this.$props.toggle, el), 'aria-expanded', show);
|
|
103
112
|
|
|
104
|
-
|
|
105
|
-
attr($(this.$props.toggle, el), 'aria-expanded', show);
|
|
113
|
+
const content = $(`${el._wrapper ? '> * ' : ''}${this.content}`, el);
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
115
|
+
if (animate === false || !this.hasTransition) {
|
|
116
|
+
hide(content, !show);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
113
119
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
if (!el._wrapper) {
|
|
121
|
+
el._wrapper = wrapAll(content, `<div${show ? ' hidden' : ''}>`);
|
|
122
|
+
}
|
|
117
123
|
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
hide(content, false);
|
|
125
|
+
await toggleHeight(this)(el._wrapper, show);
|
|
120
126
|
hide(content, !show);
|
|
127
|
+
|
|
121
128
|
delete el._wrapper;
|
|
122
129
|
unwrap(content);
|
|
123
130
|
|
|
124
131
|
if (show) {
|
|
125
132
|
const toggle = $(this.$props.toggle, el);
|
|
126
133
|
if (!isInView(toggle)) {
|
|
127
|
-
scrollIntoView(toggle, {offset: this.offset});
|
|
134
|
+
scrollIntoView(toggle, { offset: this.offset });
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
137
|
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
136
141
|
};
|
|
137
142
|
|
|
138
143
|
function hide(el, hide) {
|
package/src/js/core/alert.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Togglable from '../mixin/togglable';
|
|
3
|
-
import {assign} from 'uikit-util';
|
|
3
|
+
import { assign } from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
|
|
7
6
|
mixins: [Class, Togglable],
|
|
8
7
|
|
|
9
8
|
args: 'animation',
|
|
10
9
|
|
|
11
10
|
props: {
|
|
12
|
-
close: String
|
|
11
|
+
close: String,
|
|
13
12
|
},
|
|
14
13
|
|
|
15
14
|
data: {
|
|
16
15
|
animation: [true],
|
|
17
16
|
selClose: '.uk-alert-close',
|
|
18
17
|
duration: 150,
|
|
19
|
-
hideProps: assign({opacity: 0}, Togglable.data.hideProps)
|
|
18
|
+
hideProps: assign({ opacity: 0 }, Togglable.data.hideProps),
|
|
20
19
|
},
|
|
21
20
|
|
|
22
21
|
events: [
|
|
23
|
-
|
|
24
22
|
{
|
|
25
|
-
|
|
26
23
|
name: 'click',
|
|
27
24
|
|
|
28
25
|
delegate() {
|
|
@@ -32,18 +29,14 @@ export default {
|
|
|
32
29
|
handler(e) {
|
|
33
30
|
e.preventDefault();
|
|
34
31
|
this.close();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
32
|
+
},
|
|
33
|
+
},
|
|
39
34
|
],
|
|
40
35
|
|
|
41
36
|
methods: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
37
|
+
async close() {
|
|
38
|
+
await this.toggleElement(this.$el);
|
|
39
|
+
this.$destroy(true);
|
|
40
|
+
},
|
|
41
|
+
},
|
|
49
42
|
};
|
package/src/js/core/core.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
css,
|
|
3
|
+
fastdom,
|
|
4
|
+
getEventPos,
|
|
5
|
+
inBrowser,
|
|
6
|
+
isTouch,
|
|
7
|
+
on,
|
|
8
|
+
once,
|
|
9
|
+
parent,
|
|
10
|
+
pointerCancel,
|
|
11
|
+
pointerDown,
|
|
12
|
+
pointerUp,
|
|
13
|
+
toMs,
|
|
14
|
+
trigger,
|
|
15
|
+
} from 'uikit-util';
|
|
2
16
|
|
|
3
17
|
export default function (UIkit) {
|
|
4
|
-
|
|
5
18
|
if (!inBrowser) {
|
|
6
19
|
return;
|
|
7
20
|
}
|
|
@@ -13,7 +26,7 @@ export default function (UIkit) {
|
|
|
13
26
|
return;
|
|
14
27
|
}
|
|
15
28
|
pendingResize = true;
|
|
16
|
-
fastdom.read(() => pendingResize = false);
|
|
29
|
+
fastdom.read(() => (pendingResize = false));
|
|
17
30
|
UIkit.update(null, 'resize');
|
|
18
31
|
};
|
|
19
32
|
|
|
@@ -21,64 +34,72 @@ export default function (UIkit) {
|
|
|
21
34
|
on(document, 'loadedmetadata load', handleResize, true);
|
|
22
35
|
|
|
23
36
|
if ('ResizeObserver' in window) {
|
|
24
|
-
|
|
37
|
+
new ResizeObserver(handleResize).observe(document.documentElement);
|
|
25
38
|
}
|
|
26
39
|
|
|
27
40
|
// throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
|
|
28
41
|
let pending;
|
|
29
|
-
on(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
on(
|
|
43
|
+
window,
|
|
44
|
+
'scroll',
|
|
45
|
+
(e) => {
|
|
46
|
+
if (pending) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
pending = true;
|
|
50
|
+
fastdom.read(() => (pending = false));
|
|
38
51
|
|
|
39
|
-
|
|
52
|
+
UIkit.update(null, e.type);
|
|
53
|
+
},
|
|
54
|
+
{ passive: true, capture: true }
|
|
55
|
+
);
|
|
40
56
|
|
|
41
57
|
let started = 0;
|
|
42
|
-
on(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
css(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
css(document.documentElement, 'overflowX', '');
|
|
50
|
-
}
|
|
51
|
-
}, toMs(css(target, 'animationDuration')) + 100);
|
|
52
|
-
}
|
|
53
|
-
}, true);
|
|
54
|
-
|
|
55
|
-
on(document, pointerDown, e => {
|
|
56
|
-
|
|
57
|
-
if (!isTouch(e)) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Handle Swipe Gesture
|
|
62
|
-
const pos = getEventPos(e);
|
|
63
|
-
const target = 'tagName' in e.target ? e.target : parent(e.target);
|
|
64
|
-
once(document, `${pointerUp} ${pointerCancel} scroll`, e => {
|
|
65
|
-
|
|
66
|
-
const {x, y} = getEventPos(e);
|
|
67
|
-
|
|
68
|
-
// swipe
|
|
69
|
-
if (e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100 || y && Math.abs(pos.y - y) > 100) {
|
|
70
|
-
|
|
58
|
+
on(
|
|
59
|
+
document,
|
|
60
|
+
'animationstart',
|
|
61
|
+
({ target }) => {
|
|
62
|
+
if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
|
|
63
|
+
started++;
|
|
64
|
+
css(document.documentElement, 'overflowX', 'hidden');
|
|
71
65
|
setTimeout(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
if (!--started) {
|
|
67
|
+
css(document.documentElement, 'overflowX', '');
|
|
68
|
+
}
|
|
69
|
+
}, toMs(css(target, 'animationDuration')) + 100);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
true
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
on(
|
|
76
|
+
document,
|
|
77
|
+
pointerDown,
|
|
78
|
+
(e) => {
|
|
79
|
+
if (!isTouch(e)) {
|
|
80
|
+
return;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
// Handle Swipe Gesture
|
|
84
|
+
const pos = getEventPos(e);
|
|
85
|
+
const target = 'tagName' in e.target ? e.target : parent(e.target);
|
|
86
|
+
once(document, `${pointerUp} ${pointerCancel} scroll`, (e) => {
|
|
87
|
+
const { x, y } = getEventPos(e);
|
|
88
|
+
|
|
89
|
+
// swipe
|
|
90
|
+
if (
|
|
91
|
+
(e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100) ||
|
|
92
|
+
(y && Math.abs(pos.y - y) > 100)
|
|
93
|
+
) {
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
trigger(target, 'swipe');
|
|
96
|
+
trigger(target, `swipe${swipeDirection(pos.x, pos.y, x, y)}`);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
{ passive: true }
|
|
102
|
+
);
|
|
82
103
|
}
|
|
83
104
|
|
|
84
105
|
function swipeDirection(x1, y1, x2, y2) {
|
|
@@ -87,6 +108,6 @@ function swipeDirection(x1, y1, x2, y2) {
|
|
|
87
108
|
? 'Left'
|
|
88
109
|
: 'Right'
|
|
89
110
|
: y1 - y2 > 0
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
? 'Up'
|
|
112
|
+
: 'Down';
|
|
92
113
|
}
|
package/src/js/core/cover.js
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
import Video from './video';
|
|
2
|
-
import {css, Dimensions, parent} from 'uikit-util';
|
|
2
|
+
import { css, Dimensions, parent } from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
5
|
mixins: [Video],
|
|
7
6
|
|
|
8
7
|
props: {
|
|
9
8
|
width: Number,
|
|
10
|
-
height: Number
|
|
9
|
+
height: Number,
|
|
11
10
|
},
|
|
12
11
|
|
|
13
12
|
data: {
|
|
14
|
-
automute: true
|
|
13
|
+
automute: true,
|
|
15
14
|
},
|
|
16
15
|
|
|
17
16
|
update: {
|
|
18
|
-
|
|
19
17
|
read() {
|
|
20
|
-
|
|
21
18
|
const el = this.$el;
|
|
22
|
-
const {offsetHeight: height, offsetWidth: width} =
|
|
19
|
+
const { offsetHeight: height, offsetWidth: width } =
|
|
20
|
+
getPositionedParent(el) || parent(el);
|
|
23
21
|
const dim = Dimensions.cover(
|
|
24
22
|
{
|
|
25
23
|
width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
|
|
26
|
-
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight
|
|
24
|
+
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight,
|
|
27
25
|
},
|
|
28
26
|
{
|
|
29
27
|
width: width + (width % 2 ? 1 : 0),
|
|
30
|
-
height: height + (height % 2 ? 1 : 0)
|
|
28
|
+
height: height + (height % 2 ? 1 : 0),
|
|
31
29
|
}
|
|
32
30
|
);
|
|
33
31
|
|
|
@@ -38,14 +36,12 @@ export default {
|
|
|
38
36
|
return dim;
|
|
39
37
|
},
|
|
40
38
|
|
|
41
|
-
write({height, width}) {
|
|
42
|
-
css(this.$el, {height, width});
|
|
39
|
+
write({ height, width }) {
|
|
40
|
+
css(this.$el, { height, width });
|
|
43
41
|
},
|
|
44
42
|
|
|
45
|
-
events: ['resize']
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
43
|
+
events: ['resize'],
|
|
44
|
+
},
|
|
49
45
|
};
|
|
50
46
|
|
|
51
47
|
function getPositionedParent(el) {
|