uikit 3.14.4-dev.6a00f7fe6 → 3.14.4-dev.7db3661de
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/CHANGELOG.md +24 -0
- package/dist/css/uikit-core-rtl.css +146 -77
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +146 -77
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +143 -78
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +143 -78
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +7 -5
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +115 -24
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +115 -24
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +4 -5
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +4 -5
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +22 -7
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +4 -5
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +22 -7
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +3 -3
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +26 -19
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +765 -647
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +1593 -1458
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/images/{backgrounds/nav-parent-open.svg → components/nav-parent-icon-large.svg} +0 -0
- package/src/images/components/nav-parent-icon.svg +3 -0
- package/src/images/components/navbar-parent-icon.svg +3 -0
- package/src/js/components/filter.js +5 -3
- package/src/js/components/sortable.js +2 -3
- package/src/js/core/drop.js +7 -0
- package/src/js/core/height-viewport.js +14 -6
- package/src/js/core/icon.js +16 -0
- package/src/js/core/index.js +2 -0
- package/src/js/core/leader.js +2 -2
- package/src/js/core/navbar.js +44 -15
- package/src/js/core/offcanvas.js +1 -47
- package/src/js/core/scroll.js +37 -10
- package/src/js/core/sticky.js +8 -9
- package/src/js/mixin/media.js +4 -5
- package/src/js/mixin/modal.js +90 -4
- package/src/js/mixin/position.js +27 -11
- package/src/js/mixin/slider-drag.js +20 -8
- package/src/js/mixin/togglable.js +8 -17
- package/src/js/util/dimensions.js +6 -6
- package/src/js/util/position.js +1 -0
- package/src/js/util/style.js +4 -13
- package/src/js/util/viewport.js +20 -36
- package/src/less/components/dropdown.less +14 -0
- package/src/less/components/leader.less +1 -1
- package/src/less/components/nav.less +37 -44
- package/src/less/components/navbar.less +108 -24
- package/src/less/components/utility.less +21 -4
- package/src/less/theme/nav.less +3 -15
- package/src/less/theme/navbar.less +7 -7
- package/src/scss/components/dropdown.scss +14 -0
- package/src/scss/components/leader.scss +1 -1
- package/src/scss/components/nav.scss +36 -32
- package/src/scss/components/navbar.scss +96 -24
- package/src/scss/components/utility.scss +19 -3
- package/src/scss/mixins-theme.scss +18 -20
- package/src/scss/mixins.scss +16 -15
- package/src/scss/theme/nav.scss +3 -15
- package/src/scss/theme/navbar.scss +6 -3
- package/src/scss/variables-theme.scss +27 -15
- package/src/scss/variables.scss +27 -13
- package/tests/drop.html +72 -16
- package/tests/dropdown.html +103 -16
- package/tests/index.html +3 -3
- package/tests/nav.html +20 -87
- package/tests/navbar.html +2128 -1133
- package/tests/offcanvas.html +8 -8
- package/tests/utility.html +19 -0
- package/src/images/backgrounds/nav-parent-close.svg +0 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "uikit",
|
|
3
3
|
"title": "UIkit",
|
|
4
4
|
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
-
"version": "3.14.4-dev.
|
|
5
|
+
"version": "3.14.4-dev.7db3661de",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
File without changes
|
|
@@ -103,7 +103,7 @@ export default {
|
|
|
103
103
|
});
|
|
104
104
|
},
|
|
105
105
|
|
|
106
|
-
setState(state, animate = true) {
|
|
106
|
+
async setState(state, animate = true) {
|
|
107
107
|
state = { filter: { '': '' }, sort: [], ...state };
|
|
108
108
|
|
|
109
109
|
trigger(this.$el, 'beforeFilter', [this, state]);
|
|
@@ -112,7 +112,7 @@ export default {
|
|
|
112
112
|
toggleClass(el, this.cls, !!matchFilter(el, this.attrItem, state))
|
|
113
113
|
);
|
|
114
114
|
|
|
115
|
-
Promise.all(
|
|
115
|
+
await Promise.all(
|
|
116
116
|
$$(this.target, this.$el).map((target) => {
|
|
117
117
|
const filterFn = () => {
|
|
118
118
|
applyState(state, target, getChildren(target));
|
|
@@ -120,7 +120,9 @@ export default {
|
|
|
120
120
|
};
|
|
121
121
|
return animate ? this.animate(filterFn, target) : filterFn();
|
|
122
122
|
})
|
|
123
|
-
)
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
trigger(this.$el, 'afterFilter', [this]);
|
|
124
126
|
},
|
|
125
127
|
|
|
126
128
|
updateState() {
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
remove,
|
|
27
27
|
removeClass,
|
|
28
28
|
scrollParents,
|
|
29
|
-
scrollTop,
|
|
30
29
|
toggleClass,
|
|
31
30
|
Transition,
|
|
32
31
|
trigger,
|
|
@@ -313,7 +312,7 @@ function trackScroll(pos) {
|
|
|
313
312
|
let last = Date.now();
|
|
314
313
|
trackTimer = setInterval(() => {
|
|
315
314
|
let { x, y } = pos;
|
|
316
|
-
y += scrollTop
|
|
315
|
+
y += document.scrollingElement.scrollTop;
|
|
317
316
|
|
|
318
317
|
const dist = (Date.now() - last) * 0.3;
|
|
319
318
|
last = Date.now();
|
|
@@ -334,7 +333,7 @@ function trackScroll(pos) {
|
|
|
334
333
|
}
|
|
335
334
|
|
|
336
335
|
if (scroll > 0 && scroll < scrollHeight - height) {
|
|
337
|
-
scrollTop
|
|
336
|
+
scrollEl.scrollTop = scroll;
|
|
338
337
|
return true;
|
|
339
338
|
}
|
|
340
339
|
});
|
package/src/js/core/drop.js
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
toggleClass,
|
|
31
31
|
within,
|
|
32
32
|
} from 'uikit-util';
|
|
33
|
+
import { preventBackgroundScroll, preventOverscroll } from '../mixin/modal';
|
|
33
34
|
|
|
34
35
|
export let active;
|
|
35
36
|
|
|
@@ -48,6 +49,7 @@ export default {
|
|
|
48
49
|
display: String,
|
|
49
50
|
clsDrop: String,
|
|
50
51
|
animateOut: Boolean,
|
|
52
|
+
bgScroll: Boolean,
|
|
51
53
|
},
|
|
52
54
|
|
|
53
55
|
data: {
|
|
@@ -63,6 +65,7 @@ export default {
|
|
|
63
65
|
cls: 'uk-open',
|
|
64
66
|
container: false,
|
|
65
67
|
animateOut: false,
|
|
68
|
+
bgScroll: true,
|
|
66
69
|
},
|
|
67
70
|
|
|
68
71
|
created() {
|
|
@@ -250,6 +253,10 @@ export default {
|
|
|
250
253
|
}
|
|
251
254
|
}),
|
|
252
255
|
|
|
256
|
+
...(this.bgScroll
|
|
257
|
+
? []
|
|
258
|
+
: [preventOverscroll(this.$el), preventBackgroundScroll()]),
|
|
259
|
+
|
|
253
260
|
...(this.display === 'static' && this.align !== 'stretch'
|
|
254
261
|
? []
|
|
255
262
|
: (() => {
|
|
@@ -45,8 +45,11 @@ export default {
|
|
|
45
45
|
let minHeight = '';
|
|
46
46
|
const box = boxModelAdjust(this.$el, 'height', 'content-box');
|
|
47
47
|
|
|
48
|
+
const { body, scrollingElement } = document;
|
|
48
49
|
const [scrollElement] = scrollParents(this.$el, /auto|scroll/);
|
|
49
|
-
const { height: viewportHeight } = offsetViewport(
|
|
50
|
+
const { height: viewportHeight } = offsetViewport(
|
|
51
|
+
scrollElement === body ? scrollingElement : scrollElement
|
|
52
|
+
);
|
|
50
53
|
|
|
51
54
|
if (this.expand) {
|
|
52
55
|
minHeight = Math.max(
|
|
@@ -56,14 +59,19 @@ export default {
|
|
|
56
59
|
0
|
|
57
60
|
);
|
|
58
61
|
} else {
|
|
62
|
+
const isScrollingElement =
|
|
63
|
+
scrollingElement === scrollElement || body === scrollElement;
|
|
64
|
+
|
|
59
65
|
// on mobile devices (iOS and Android) window.innerHeight !== 100vh
|
|
60
|
-
minHeight = `calc(${
|
|
61
|
-
document.scrollingElement === scrollElement ? '100vh' : `${viewportHeight}px`
|
|
62
|
-
}`;
|
|
66
|
+
minHeight = `calc(${isScrollingElement ? '100vh' : `${viewportHeight}px`}`;
|
|
63
67
|
|
|
64
68
|
if (this.offsetTop) {
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
if (isScrollingElement) {
|
|
70
|
+
const top = offsetPosition(this.$el)[0] - offsetPosition(scrollElement)[0];
|
|
71
|
+
minHeight += top > 0 && top < viewportHeight / 2 ? ` - ${top}px` : '';
|
|
72
|
+
} else {
|
|
73
|
+
minHeight += ` - ${css(scrollElement, 'paddingTop')}`;
|
|
74
|
+
}
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
if (this.offsetBottom === true) {
|
package/src/js/core/icon.js
CHANGED
|
@@ -2,6 +2,9 @@ import SVG from './svg';
|
|
|
2
2
|
import closeIcon from '../../images/components/close-icon.svg';
|
|
3
3
|
import closeLarge from '../../images/components/close-large.svg';
|
|
4
4
|
import marker from '../../images/components/marker.svg';
|
|
5
|
+
import navParentIcon from '../../images/components/nav-parent-icon.svg';
|
|
6
|
+
import navParentIconLarge from '../../images/components/nav-parent-icon-large.svg';
|
|
7
|
+
import navbarParentIcon from '../../images/components/navbar-parent-icon.svg';
|
|
5
8
|
import navbarToggleIcon from '../../images/components/navbar-toggle-icon.svg';
|
|
6
9
|
import overlayIcon from '../../images/components/overlay-icon.svg';
|
|
7
10
|
import paginationNext from '../../images/components/pagination-next.svg';
|
|
@@ -19,6 +22,7 @@ import {
|
|
|
19
22
|
$,
|
|
20
23
|
addClass,
|
|
21
24
|
apply,
|
|
25
|
+
closest,
|
|
22
26
|
css,
|
|
23
27
|
each,
|
|
24
28
|
hasClass,
|
|
@@ -35,6 +39,9 @@ const icons = {
|
|
|
35
39
|
marker,
|
|
36
40
|
'close-icon': closeIcon,
|
|
37
41
|
'close-large': closeLarge,
|
|
42
|
+
'nav-parent-icon': navParentIcon,
|
|
43
|
+
'nav-parent-icon-large': navParentIconLarge,
|
|
44
|
+
'navbar-parent-icon': navbarParentIcon,
|
|
38
45
|
'navbar-toggle-icon': navbarToggleIcon,
|
|
39
46
|
'overlay-icon': overlayIcon,
|
|
40
47
|
'pagination-next': paginationNext,
|
|
@@ -96,6 +103,15 @@ export const IconComponent = {
|
|
|
96
103
|
},
|
|
97
104
|
};
|
|
98
105
|
|
|
106
|
+
export const NavParentIcon = {
|
|
107
|
+
extends: IconComponent,
|
|
108
|
+
|
|
109
|
+
beforeConnect() {
|
|
110
|
+
const icon = this.$props.icon;
|
|
111
|
+
this.icon = closest(this.$el, '.uk-nav-primary') ? `${icon}-large` : icon;
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
99
115
|
export const Slidenav = {
|
|
100
116
|
extends: IconComponent,
|
|
101
117
|
|
package/src/js/core/index.js
CHANGED
|
@@ -29,10 +29,12 @@ export { default as Video } from './video';
|
|
|
29
29
|
// Icon components
|
|
30
30
|
export { Close } from './icon';
|
|
31
31
|
export { Spinner } from './icon';
|
|
32
|
+
export { NavParentIcon } from './icon';
|
|
32
33
|
export { Slidenav as SlidenavNext } from './icon';
|
|
33
34
|
export { Slidenav as SlidenavPrevious } from './icon';
|
|
34
35
|
export { Search as SearchIcon } from './icon';
|
|
35
36
|
export { IconComponent as Marker } from './icon';
|
|
37
|
+
export { IconComponent as NavbarParentIcon } from './icon';
|
|
36
38
|
export { IconComponent as NavbarToggleIcon } from './icon';
|
|
37
39
|
export { IconComponent as OverlayIcon } from './icon';
|
|
38
40
|
export { IconComponent as PaginationNext } from './icon';
|
package/src/js/core/leader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Media from '../mixin/media';
|
|
3
|
-
import { attr,
|
|
3
|
+
import { attr, css, toggleClass, unwrap, wrapInner } from 'uikit-util';
|
|
4
4
|
import Resize from '../mixin/resize';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
|
|
20
20
|
computed: {
|
|
21
21
|
fill({ fill }) {
|
|
22
|
-
return fill ||
|
|
22
|
+
return fill || css(this.$el, '--uk-leader-fill-content');
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
|
package/src/js/core/navbar.js
CHANGED
|
@@ -124,7 +124,6 @@ export default {
|
|
|
124
124
|
...this.$props,
|
|
125
125
|
boundary: this.boundary,
|
|
126
126
|
pos: this.pos,
|
|
127
|
-
offset: this.dropbar || this.offset,
|
|
128
127
|
}
|
|
129
128
|
);
|
|
130
129
|
},
|
|
@@ -285,8 +284,8 @@ export default {
|
|
|
285
284
|
return this.dropbar;
|
|
286
285
|
},
|
|
287
286
|
|
|
288
|
-
handler(
|
|
289
|
-
if (!
|
|
287
|
+
handler({ target }) {
|
|
288
|
+
if (!this.isDropbarDrop(target)) {
|
|
290
289
|
return;
|
|
291
290
|
}
|
|
292
291
|
|
|
@@ -294,7 +293,7 @@ export default {
|
|
|
294
293
|
after(this.dropbarAnchor || this.$el, this.dropbar);
|
|
295
294
|
}
|
|
296
295
|
|
|
297
|
-
addClass(
|
|
296
|
+
addClass(target, `${this.clsDrop}-dropbar`);
|
|
298
297
|
},
|
|
299
298
|
},
|
|
300
299
|
|
|
@@ -309,22 +308,47 @@ export default {
|
|
|
309
308
|
return this.dropbar;
|
|
310
309
|
},
|
|
311
310
|
|
|
312
|
-
handler(
|
|
313
|
-
if (!
|
|
311
|
+
handler({ target }) {
|
|
312
|
+
if (!this.isDropbarDrop(target)) {
|
|
314
313
|
return;
|
|
315
314
|
}
|
|
316
315
|
|
|
317
|
-
this._observer = observeResize(
|
|
316
|
+
this._observer = observeResize(target, () =>
|
|
318
317
|
this.transitionTo(
|
|
319
|
-
offset(
|
|
318
|
+
offset(target).bottom -
|
|
320
319
|
offset(this.dropbar).top +
|
|
321
|
-
toFloat(css(
|
|
322
|
-
|
|
320
|
+
toFloat(css(target, 'marginBottom')),
|
|
321
|
+
target
|
|
323
322
|
)
|
|
324
323
|
);
|
|
325
324
|
},
|
|
326
325
|
},
|
|
327
326
|
|
|
327
|
+
{
|
|
328
|
+
name: 'beforeposition',
|
|
329
|
+
|
|
330
|
+
el() {
|
|
331
|
+
return this.dropContainer;
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
filter() {
|
|
335
|
+
return this.dropbar;
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
handler(e, element, target, options) {
|
|
339
|
+
if (!this.isDropbarDrop(element)) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const dropbarOffset = offset(this.dropbar);
|
|
344
|
+
|
|
345
|
+
css(element, 'maxWidth', dropbarOffset.width - options.viewportOffset * 2);
|
|
346
|
+
|
|
347
|
+
options.offset[1] = dropbarOffset.top - offset(target).bottom;
|
|
348
|
+
options.viewportOffset += dropbarOffset.left;
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
|
|
328
352
|
{
|
|
329
353
|
name: 'beforehide',
|
|
330
354
|
|
|
@@ -336,12 +360,12 @@ export default {
|
|
|
336
360
|
return this.dropbar;
|
|
337
361
|
},
|
|
338
362
|
|
|
339
|
-
handler(e
|
|
363
|
+
handler(e) {
|
|
340
364
|
const active = this.getActive();
|
|
341
365
|
|
|
342
366
|
if (
|
|
343
367
|
matches(this.dropbar, ':hover') &&
|
|
344
|
-
active?.$el ===
|
|
368
|
+
active?.$el === e.target &&
|
|
345
369
|
!this.toggles.some((el) => active.target !== el && matches(el, ':focus'))
|
|
346
370
|
) {
|
|
347
371
|
e.preventDefault();
|
|
@@ -360,8 +384,8 @@ export default {
|
|
|
360
384
|
return this.dropbar;
|
|
361
385
|
},
|
|
362
386
|
|
|
363
|
-
handler(
|
|
364
|
-
if (!
|
|
387
|
+
handler({ target }) {
|
|
388
|
+
if (!this.isDropbarDrop(target)) {
|
|
365
389
|
return;
|
|
366
390
|
}
|
|
367
391
|
|
|
@@ -369,7 +393,7 @@ export default {
|
|
|
369
393
|
|
|
370
394
|
const active = this.getActive();
|
|
371
395
|
|
|
372
|
-
if (!active || active?.$el ===
|
|
396
|
+
if (!active || active?.$el === target) {
|
|
373
397
|
this.transitionTo(0);
|
|
374
398
|
}
|
|
375
399
|
},
|
|
@@ -409,6 +433,11 @@ export default {
|
|
|
409
433
|
getDropdown(el) {
|
|
410
434
|
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
|
|
411
435
|
},
|
|
436
|
+
|
|
437
|
+
isDropbarDrop(el) {
|
|
438
|
+
const drop = this.getDropdown(el);
|
|
439
|
+
return drop && hasClass(el, this.clsDrop) && drop.align !== 'stretch';
|
|
440
|
+
},
|
|
412
441
|
},
|
|
413
442
|
};
|
|
414
443
|
|
package/src/js/core/offcanvas.js
CHANGED
|
@@ -93,22 +93,6 @@ export default {
|
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
95
|
|
|
96
|
-
{
|
|
97
|
-
name: 'touchstart',
|
|
98
|
-
|
|
99
|
-
passive: true,
|
|
100
|
-
|
|
101
|
-
el() {
|
|
102
|
-
return this.panel;
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
handler({ targetTouches }) {
|
|
106
|
-
if (targetTouches.length === 1) {
|
|
107
|
-
this.clientY = targetTouches[0].clientY;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
|
|
112
96
|
{
|
|
113
97
|
name: 'touchmove',
|
|
114
98
|
|
|
@@ -124,33 +108,6 @@ export default {
|
|
|
124
108
|
},
|
|
125
109
|
},
|
|
126
110
|
|
|
127
|
-
{
|
|
128
|
-
name: 'touchmove',
|
|
129
|
-
|
|
130
|
-
passive: false,
|
|
131
|
-
|
|
132
|
-
el() {
|
|
133
|
-
return this.panel;
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
handler(e) {
|
|
137
|
-
if (e.targetTouches.length !== 1) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const clientY = e.targetTouches[0].clientY - this.clientY;
|
|
142
|
-
const { scrollTop, scrollHeight, clientHeight } = this.panel;
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
clientHeight >= scrollHeight ||
|
|
146
|
-
(scrollTop === 0 && clientY > 0) ||
|
|
147
|
-
(scrollHeight - scrollTop <= clientHeight && clientY < 0)
|
|
148
|
-
) {
|
|
149
|
-
e.cancelable && e.preventDefault();
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
|
|
154
111
|
{
|
|
155
112
|
name: 'show',
|
|
156
113
|
|
|
@@ -162,7 +119,6 @@ export default {
|
|
|
162
119
|
addClass(parent(this.panel), this.clsMode);
|
|
163
120
|
}
|
|
164
121
|
|
|
165
|
-
css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : '');
|
|
166
122
|
addClass(document.body, this.clsContainer, this.clsFlip);
|
|
167
123
|
css(document.body, 'touch-action', 'pan-y pinch-zoom');
|
|
168
124
|
css(this.$el, 'display', 'block');
|
|
@@ -170,7 +126,7 @@ export default {
|
|
|
170
126
|
addClass(
|
|
171
127
|
this.panel,
|
|
172
128
|
this.clsSidebarAnimation,
|
|
173
|
-
this.mode
|
|
129
|
+
this.mode === 'reveal' ? '' : this.clsMode
|
|
174
130
|
);
|
|
175
131
|
|
|
176
132
|
height(document.body); // force reflow
|
|
@@ -207,8 +163,6 @@ export default {
|
|
|
207
163
|
removeClass(this.$el, this.clsOverlay);
|
|
208
164
|
css(this.$el, 'display', '');
|
|
209
165
|
removeClass(document.body, this.clsContainer, this.clsFlip);
|
|
210
|
-
|
|
211
|
-
css(document.documentElement, 'overflowY', '');
|
|
212
166
|
},
|
|
213
167
|
},
|
|
214
168
|
|
package/src/js/core/scroll.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, scrollIntoView, trigger } from 'uikit-util';
|
|
1
|
+
import { $, off, on, scrollIntoView, trigger, within } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
props: {
|
|
@@ -9,6 +9,14 @@ export default {
|
|
|
9
9
|
offset: 0,
|
|
10
10
|
},
|
|
11
11
|
|
|
12
|
+
connected() {
|
|
13
|
+
registerClick(this);
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
disconnected() {
|
|
17
|
+
unregisterClick(this);
|
|
18
|
+
},
|
|
19
|
+
|
|
12
20
|
methods: {
|
|
13
21
|
async scrollTo(el) {
|
|
14
22
|
el = (el && $(el)) || document.body;
|
|
@@ -19,18 +27,37 @@ export default {
|
|
|
19
27
|
}
|
|
20
28
|
},
|
|
21
29
|
},
|
|
30
|
+
};
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
const components = new Set();
|
|
33
|
+
function registerClick(cmp) {
|
|
34
|
+
if (!components.size) {
|
|
35
|
+
on(document, 'click', clickHandler);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
components.add(cmp);
|
|
39
|
+
}
|
|
28
40
|
|
|
41
|
+
function unregisterClick(cmp) {
|
|
42
|
+
components.delete(cmp);
|
|
43
|
+
|
|
44
|
+
if (!components.length) {
|
|
45
|
+
off(document, 'click', clickHandler);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function clickHandler(e) {
|
|
50
|
+
if (e.defaultPrevented) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const component of components) {
|
|
55
|
+
if (within(component.$el, e.target)) {
|
|
29
56
|
e.preventDefault();
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
57
|
+
component.scrollTo(getTargetElement(component.$el));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
34
61
|
|
|
35
62
|
export function getTargetElement(el) {
|
|
36
63
|
return document.getElementById(decodeURIComponent(el.hash).substring(1));
|
package/src/js/core/sticky.js
CHANGED
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
remove,
|
|
24
24
|
removeClass,
|
|
25
25
|
replaceClass,
|
|
26
|
-
scrollTop,
|
|
27
26
|
toFloat,
|
|
28
27
|
toggleClass,
|
|
29
28
|
toPx,
|
|
@@ -125,7 +124,9 @@ export default {
|
|
|
125
124
|
},
|
|
126
125
|
|
|
127
126
|
handler() {
|
|
128
|
-
|
|
127
|
+
const { scrollingElement } = document;
|
|
128
|
+
|
|
129
|
+
if (!location.hash || scrollingElement.scrollTop === 0) {
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -134,13 +135,11 @@ export default {
|
|
|
134
135
|
const elOffset = getOffset(this.$el);
|
|
135
136
|
|
|
136
137
|
if (this.isFixed && intersectRect(targetOffset, elOffset)) {
|
|
137
|
-
scrollTop
|
|
138
|
-
window,
|
|
138
|
+
scrollingElement.scrollTop =
|
|
139
139
|
targetOffset.top -
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
);
|
|
140
|
+
elOffset.height -
|
|
141
|
+
toPx(this.targetOffset, 'height', this.placeholder) -
|
|
142
|
+
toPx(this.offset, 'height', this.placeholder);
|
|
144
143
|
}
|
|
145
144
|
});
|
|
146
145
|
},
|
|
@@ -238,7 +237,7 @@ export default {
|
|
|
238
237
|
start,
|
|
239
238
|
end,
|
|
240
239
|
}) {
|
|
241
|
-
const scroll = scrollTop
|
|
240
|
+
const scroll = document.scrollingElement.scrollTop;
|
|
242
241
|
const dir = prevScroll <= scroll ? 'down' : 'up';
|
|
243
242
|
|
|
244
243
|
return {
|
package/src/js/mixin/media.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEvent,
|
|
3
|
-
|
|
3
|
+
css,
|
|
4
4
|
isNumeric,
|
|
5
5
|
isString,
|
|
6
6
|
on,
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
connected() {
|
|
22
|
-
const media = toMedia(this.media);
|
|
22
|
+
const media = toMedia(this.media, this.$el);
|
|
23
23
|
this.matchMedia = true;
|
|
24
24
|
if (media) {
|
|
25
25
|
this.mediaObj = window.matchMedia(media);
|
|
@@ -40,11 +40,10 @@ export default {
|
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
function toMedia(value) {
|
|
43
|
+
function toMedia(value, element) {
|
|
44
44
|
if (isString(value)) {
|
|
45
45
|
if (startsWith(value, '@')) {
|
|
46
|
-
|
|
47
|
-
value = toFloat(getCssVar(name));
|
|
46
|
+
value = toFloat(css(element, `--uk-breakpoint-${value.substr(1)}`));
|
|
48
47
|
} else if (isNaN(value)) {
|
|
49
48
|
return value;
|
|
50
49
|
}
|