uikit 3.11.2-dev.f2970ffaa → 3.11.2-dev.f3ade19c4
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 +54 -18
- 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 +133 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +133 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +135 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +135 -207
- 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 +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 -372
- 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 +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5326 -6526
- 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 +8031 -9659
- 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 +26 -52
- 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 +21 -46
- 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 +52 -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 +175 -123
- 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 +78 -49
- package/src/js/util/dom.js +39 -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 +17 -34
- 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/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 +0 -3
- package/src/less/components/slideshow.less +0 -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/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 +0 -3
- package/src/scss/components/slideshow.scss +0 -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/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 +87 -99
- package/tests/sticky.html +56 -24
- 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
|
@@ -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,10 +1,24 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import Lazyload from '../mixin/lazyload';
|
|
3
|
+
import { default as Togglable, toggleHeight } from '../mixin/togglable';
|
|
4
|
+
import {
|
|
5
|
+
$,
|
|
6
|
+
$$,
|
|
7
|
+
attr,
|
|
8
|
+
filter,
|
|
9
|
+
getIndex,
|
|
10
|
+
hasClass,
|
|
11
|
+
includes,
|
|
12
|
+
index,
|
|
13
|
+
isInView,
|
|
14
|
+
scrollIntoView,
|
|
15
|
+
toggleClass,
|
|
16
|
+
unwrap,
|
|
17
|
+
wrapAll,
|
|
18
|
+
} from 'uikit-util';
|
|
4
19
|
|
|
5
20
|
export default {
|
|
6
|
-
|
|
7
|
-
mixins: [Class, Togglable],
|
|
21
|
+
mixins: [Class, Lazyload, Togglable],
|
|
8
22
|
|
|
9
23
|
props: {
|
|
10
24
|
targets: String,
|
|
@@ -14,7 +28,7 @@ export default {
|
|
|
14
28
|
toggle: String,
|
|
15
29
|
content: String,
|
|
16
30
|
transition: String,
|
|
17
|
-
offset: Number
|
|
31
|
+
offset: Number,
|
|
18
32
|
},
|
|
19
33
|
|
|
20
34
|
data: {
|
|
@@ -27,48 +41,45 @@ export default {
|
|
|
27
41
|
toggle: '> .uk-accordion-title',
|
|
28
42
|
content: '> .uk-accordion-content',
|
|
29
43
|
transition: 'ease',
|
|
30
|
-
offset: 0
|
|
44
|
+
offset: 0,
|
|
31
45
|
},
|
|
32
46
|
|
|
33
47
|
computed: {
|
|
34
|
-
|
|
35
48
|
items: {
|
|
36
|
-
|
|
37
|
-
get({targets}, $el) {
|
|
49
|
+
get({ targets }, $el) {
|
|
38
50
|
return $$(targets, $el);
|
|
39
51
|
},
|
|
40
52
|
|
|
41
53
|
watch(items, prev) {
|
|
42
|
-
|
|
43
|
-
items.forEach(el => hide($(this.content, el), !hasClass(el, this.clsOpen)));
|
|
54
|
+
items.forEach((el) => hide($(this.content, el), !hasClass(el, this.clsOpen)));
|
|
44
55
|
|
|
45
56
|
if (prev || hasClass(items, this.clsOpen)) {
|
|
46
57
|
return;
|
|
47
58
|
}
|
|
48
59
|
|
|
49
|
-
const active =
|
|
50
|
-
|
|
60
|
+
const active =
|
|
61
|
+
(this.active !== false && items[Number(this.active)]) ||
|
|
62
|
+
(!this.collapsible && items[0]);
|
|
51
63
|
|
|
52
64
|
if (active) {
|
|
53
65
|
this.toggle(active, false);
|
|
54
66
|
}
|
|
55
|
-
|
|
56
67
|
},
|
|
57
68
|
|
|
58
|
-
immediate: true
|
|
59
|
-
|
|
69
|
+
immediate: true,
|
|
60
70
|
},
|
|
61
71
|
|
|
62
|
-
toggles({toggle}) {
|
|
63
|
-
return this.items.map(item => $(toggle, item));
|
|
64
|
-
}
|
|
72
|
+
toggles({ toggle }) {
|
|
73
|
+
return this.items.map((item) => $(toggle, item));
|
|
74
|
+
},
|
|
75
|
+
},
|
|
65
76
|
|
|
77
|
+
connected() {
|
|
78
|
+
this.lazyload();
|
|
66
79
|
},
|
|
67
80
|
|
|
68
81
|
events: [
|
|
69
|
-
|
|
70
82
|
{
|
|
71
|
-
|
|
72
83
|
name: 'click',
|
|
73
84
|
|
|
74
85
|
delegate() {
|
|
@@ -78,16 +89,12 @@ export default {
|
|
|
78
89
|
handler(e) {
|
|
79
90
|
e.preventDefault();
|
|
80
91
|
this.toggle(index(this.toggles, e.current));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
92
|
+
},
|
|
93
|
+
},
|
|
85
94
|
],
|
|
86
95
|
|
|
87
96
|
methods: {
|
|
88
|
-
|
|
89
97
|
toggle(item, animate) {
|
|
90
|
-
|
|
91
98
|
let items = [this.items[getIndex(item, this.items)]];
|
|
92
99
|
const activeItems = filter(this.items, `.${this.clsOpen}`);
|
|
93
100
|
|
|
@@ -95,44 +102,47 @@ export default {
|
|
|
95
102
|
items = items.concat(activeItems);
|
|
96
103
|
}
|
|
97
104
|
|
|
98
|
-
if (
|
|
105
|
+
if (
|
|
106
|
+
!this.collapsible &&
|
|
107
|
+
activeItems.length < 2 &&
|
|
108
|
+
!filter(items, `:not(.${this.clsOpen})`).length
|
|
109
|
+
) {
|
|
99
110
|
return;
|
|
100
111
|
}
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
for (const el of items) {
|
|
114
|
+
this.toggleElement(el, !hasClass(el, this.clsOpen), async (el, show) => {
|
|
115
|
+
toggleClass(el, this.clsOpen, show);
|
|
116
|
+
attr($(this.$props.toggle, el), 'aria-expanded', show);
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
attr($(this.$props.toggle, el), 'aria-expanded', show);
|
|
118
|
+
const content = $(`${el._wrapper ? '> * ' : ''}${this.content}`, el);
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
120
|
+
if (animate === false || !this.hasTransition) {
|
|
121
|
+
hide(content, !show);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
113
124
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
if (!el._wrapper) {
|
|
126
|
+
el._wrapper = wrapAll(content, `<div${show ? ' hidden' : ''}>`);
|
|
127
|
+
}
|
|
117
128
|
|
|
118
|
-
|
|
119
|
-
|
|
129
|
+
hide(content, false);
|
|
130
|
+
await toggleHeight(this)(el._wrapper, show);
|
|
120
131
|
hide(content, !show);
|
|
132
|
+
|
|
121
133
|
delete el._wrapper;
|
|
122
134
|
unwrap(content);
|
|
123
135
|
|
|
124
136
|
if (show) {
|
|
125
137
|
const toggle = $(this.$props.toggle, el);
|
|
126
138
|
if (!isInView(toggle)) {
|
|
127
|
-
scrollIntoView(toggle, {offset: this.offset});
|
|
139
|
+
scrollIntoView(toggle, { offset: this.offset });
|
|
128
140
|
}
|
|
129
141
|
}
|
|
130
142
|
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
},
|
|
136
146
|
};
|
|
137
147
|
|
|
138
148
|
function hide(el, hide) {
|
package/src/js/core/alert.js
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Togglable from '../mixin/togglable';
|
|
3
|
-
import {assign} from 'uikit-util';
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
|
-
|
|
7
5
|
mixins: [Class, Togglable],
|
|
8
6
|
|
|
9
7
|
args: 'animation',
|
|
10
8
|
|
|
11
9
|
props: {
|
|
12
|
-
close: String
|
|
10
|
+
close: String,
|
|
13
11
|
},
|
|
14
12
|
|
|
15
13
|
data: {
|
|
16
14
|
animation: [true],
|
|
17
15
|
selClose: '.uk-alert-close',
|
|
18
16
|
duration: 150,
|
|
19
|
-
hideProps:
|
|
17
|
+
hideProps: { opacity: 0, ...Togglable.data.hideProps },
|
|
20
18
|
},
|
|
21
19
|
|
|
22
20
|
events: [
|
|
23
|
-
|
|
24
21
|
{
|
|
25
|
-
|
|
26
22
|
name: 'click',
|
|
27
23
|
|
|
28
24
|
delegate() {
|
|
@@ -32,18 +28,14 @@ export default {
|
|
|
32
28
|
handler(e) {
|
|
33
29
|
e.preventDefault();
|
|
34
30
|
this.close();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
31
|
+
},
|
|
32
|
+
},
|
|
39
33
|
],
|
|
40
34
|
|
|
41
35
|
methods: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
36
|
+
async close() {
|
|
37
|
+
await this.toggleElement(this.$el);
|
|
38
|
+
this.$destroy(true);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
49
41
|
};
|
package/src/js/core/core.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {css, fastdom,
|
|
1
|
+
import { css, fastdom, inBrowser, observeResize, on, toMs } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function (UIkit) {
|
|
4
|
-
|
|
5
4
|
if (!inBrowser) {
|
|
6
5
|
return;
|
|
7
6
|
}
|
|
@@ -13,80 +12,29 @@ export default function (UIkit) {
|
|
|
13
12
|
return;
|
|
14
13
|
}
|
|
15
14
|
pendingResize = true;
|
|
16
|
-
fastdom.read(() => pendingResize = false);
|
|
15
|
+
fastdom.read(() => (pendingResize = false));
|
|
17
16
|
UIkit.update(null, 'resize');
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
on(window, 'load resize', handleResize);
|
|
21
|
-
on(document, 'loadedmetadata load', handleResize, true);
|
|
22
|
-
|
|
23
|
-
if ('ResizeObserver' in window) {
|
|
24
|
-
(new ResizeObserver(handleResize)).observe(document.documentElement);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
|
|
28
|
-
let pending;
|
|
29
|
-
on(window, 'scroll', e => {
|
|
30
|
-
|
|
31
|
-
if (pending) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
pending = true;
|
|
35
|
-
fastdom.read(() => pending = false);
|
|
36
|
-
|
|
37
|
-
UIkit.update(null, e.type);
|
|
38
20
|
|
|
39
|
-
|
|
21
|
+
observeResize(document.documentElement, handleResize);
|
|
40
22
|
|
|
41
23
|
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
|
-
|
|
24
|
+
on(
|
|
25
|
+
document,
|
|
26
|
+
'animationstart',
|
|
27
|
+
({ target }) => {
|
|
28
|
+
if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
|
|
29
|
+
started++;
|
|
30
|
+
css(document.documentElement, 'overflowX', 'hidden');
|
|
71
31
|
setTimeout(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
32
|
+
if (!--started) {
|
|
33
|
+
css(document.documentElement, 'overflowX', '');
|
|
34
|
+
}
|
|
35
|
+
}, toMs(css(target, 'animationDuration')) + 100);
|
|
76
36
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, {passive: true});
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function swipeDirection(x1, y1, x2, y2) {
|
|
85
|
-
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
|
|
86
|
-
? x1 - x2 > 0
|
|
87
|
-
? 'Left'
|
|
88
|
-
: 'Right'
|
|
89
|
-
: y1 - y2 > 0
|
|
90
|
-
? 'Up'
|
|
91
|
-
: 'Down';
|
|
37
|
+
},
|
|
38
|
+
true
|
|
39
|
+
);
|
|
92
40
|
}
|
package/src/js/core/cover.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import Video from './video';
|
|
2
|
-
import {css, Dimensions, parent} from 'uikit-util';
|
|
2
|
+
import { css, Dimensions, observeResize, 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
|
+
connected() {
|
|
17
|
+
this.registerObserver(observeResize(this.$el, () => this.$emit('resize')));
|
|
18
|
+
},
|
|
18
19
|
|
|
20
|
+
update: {
|
|
19
21
|
read() {
|
|
20
|
-
|
|
21
22
|
const el = this.$el;
|
|
22
|
-
const {offsetHeight: height, offsetWidth: width} =
|
|
23
|
+
const { offsetHeight: height, offsetWidth: width } =
|
|
24
|
+
getPositionedParent(el) || parent(el);
|
|
23
25
|
const dim = Dimensions.cover(
|
|
24
26
|
{
|
|
25
27
|
width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
|
|
26
|
-
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight
|
|
28
|
+
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight,
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
31
|
width: width + (width % 2 ? 1 : 0),
|
|
30
|
-
height: height + (height % 2 ? 1 : 0)
|
|
32
|
+
height: height + (height % 2 ? 1 : 0),
|
|
31
33
|
}
|
|
32
34
|
);
|
|
33
35
|
|
|
@@ -38,14 +40,12 @@ export default {
|
|
|
38
40
|
return dim;
|
|
39
41
|
},
|
|
40
42
|
|
|
41
|
-
write({height, width}) {
|
|
42
|
-
css(this.$el, {height, width});
|
|
43
|
+
write({ height, width }) {
|
|
44
|
+
css(this.$el, { height, width });
|
|
43
45
|
},
|
|
44
46
|
|
|
45
|
-
events: ['resize']
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
events: ['resize'],
|
|
48
|
+
},
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
function getPositionedParent(el) {
|