uikit 3.16.4-dev.fd2458e3b → 3.16.5-dev.dda1f1b31
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 +1 -0
- package/CHANGELOG.md +9 -1
- package/build/build.js +5 -4
- package/build/icons.js +2 -1
- package/build/less.js +2 -11
- package/build/prefix.js +2 -1
- package/build/release.js +4 -3
- package/build/scope.js +2 -1
- package/build/scss.js +2 -1
- package/build/util.js +3 -3
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +12 -14
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +506 -22
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +2601 -310
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +2612 -323
- 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 +466 -43
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +184 -2
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +2345 -49
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +184 -2
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +2339 -49
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +472 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +2298 -11
- 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 +951 -931
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +153 -152
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +979 -954
- package/dist/js/uikit.min.js +1 -1
- package/package.json +2 -2
- package/src/images/icons/mastodon.svg +3 -0
- package/src/js/api/app.js +12 -0
- package/src/js/api/boot.js +64 -43
- package/src/js/api/component.js +60 -61
- package/src/js/api/computed.js +39 -0
- package/src/js/api/events.js +45 -0
- package/src/js/api/global.js +58 -56
- package/src/js/api/hooks.js +35 -114
- package/src/js/api/index.js +8 -24
- package/src/js/api/instance.js +55 -55
- package/src/js/api/log.js +10 -0
- package/src/js/api/observables.js +125 -0
- package/src/js/api/observer.js +76 -0
- package/src/js/{util → api}/options.js +38 -1
- package/src/js/api/props.js +102 -0
- package/src/js/api/state.js +26 -280
- package/src/js/api/update.js +77 -0
- package/src/js/api/watch.js +34 -0
- package/src/js/components/countdown.js +14 -16
- package/src/js/components/filter.js +18 -24
- package/src/js/components/internal/slider-preload.js +5 -6
- package/src/js/components/lightbox-panel.js +1 -1
- package/src/js/components/lightbox.js +11 -23
- package/src/js/components/parallax.js +8 -6
- package/src/js/components/slider.js +10 -0
- package/src/js/components/tooltip.js +2 -1
- package/src/js/core/accordion.js +5 -6
- package/src/js/core/cover.js +9 -9
- package/src/js/core/drop.js +13 -6
- package/src/js/core/dropnav.js +1 -1
- package/src/js/core/grid.js +2 -5
- package/src/js/core/height-match.js +9 -16
- package/src/js/core/height-viewport.js +5 -7
- package/src/js/core/img.js +12 -19
- package/src/js/core/leader.js +4 -2
- package/src/js/core/margin.js +11 -21
- package/src/js/core/modal.js +1 -1
- package/src/js/core/offcanvas.js +6 -2
- package/src/js/core/overflow-auto.js +5 -5
- package/src/js/core/responsive.js +5 -7
- package/src/js/core/scroll.js +19 -10
- package/src/js/core/scrollspy-nav.js +6 -5
- package/src/js/core/scrollspy.js +27 -36
- package/src/js/core/sticky.js +12 -10
- package/src/js/core/svg.js +4 -2
- package/src/js/core/switcher.js +11 -9
- package/src/js/core/toggle.js +4 -4
- package/src/js/core/video.js +6 -14
- package/src/js/mixin/modal.js +2 -1
- package/src/js/mixin/parallax.js +1 -1
- package/src/js/mixin/slider-nav.js +2 -1
- package/src/js/mixin/slider.js +9 -3
- package/src/js/util/filter.js +13 -0
- package/src/js/util/index.js +0 -1
- package/src/js/util/keys.js +11 -0
- package/src/js/util/lang.js +7 -7
- package/src/js/util/observer.js +4 -2
- package/src/js/util/scroll.js +42 -0
- package/src/js/util/svg.js +16 -0
- package/src/js/util/viewport.js +1 -1
- package/src/scss/mixins-theme.scss +1640 -1596
- package/src/scss/mixins.scss +1370 -1370
- package/src/scss/variables-theme.scss +1255 -1255
- package/src/scss/variables.scss +1113 -1113
- package/src/js/mixin/lazyload.js +0 -27
- package/src/js/mixin/resize.js +0 -11
- package/src/js/mixin/scroll.js +0 -32
- package/src/js/mixin/swipe.js +0 -72
- package/src/js/mixin/utils.js +0 -91
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
remove,
|
|
21
21
|
within,
|
|
22
22
|
} from 'uikit-util';
|
|
23
|
-
import {
|
|
23
|
+
import { keyMap } from '../util/keys';
|
|
24
|
+
import { generateId } from '../api/instance';
|
|
24
25
|
|
|
25
26
|
export default {
|
|
26
27
|
mixins: [Container, Togglable, Position],
|
package/src/js/core/accordion.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import Lazyload from '../mixin/lazyload';
|
|
3
2
|
import Togglable from '../mixin/togglable';
|
|
4
|
-
import {
|
|
3
|
+
import { keyMap } from '../util/keys';
|
|
4
|
+
import { generateId } from '../api/instance';
|
|
5
|
+
import { lazyload } from '../api/observables';
|
|
5
6
|
import {
|
|
6
7
|
$,
|
|
7
8
|
$$,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
} from 'uikit-util';
|
|
26
27
|
|
|
27
28
|
export default {
|
|
28
|
-
mixins: [Class,
|
|
29
|
+
mixins: [Class, Togglable],
|
|
29
30
|
|
|
30
31
|
props: {
|
|
31
32
|
animation: Boolean,
|
|
@@ -109,9 +110,7 @@ export default {
|
|
|
109
110
|
},
|
|
110
111
|
},
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
this.lazyload();
|
|
114
|
-
},
|
|
113
|
+
observe: lazyload(),
|
|
115
114
|
|
|
116
115
|
events: [
|
|
117
116
|
{
|
package/src/js/core/cover.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { resize } from '../api/observables';
|
|
1
2
|
import Video from './video';
|
|
2
3
|
import { css, Dimensions, parent } from 'uikit-util';
|
|
3
|
-
import Resize from '../mixin/resize';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
mixins: [
|
|
6
|
+
mixins: [Video],
|
|
7
7
|
|
|
8
8
|
props: {
|
|
9
9
|
width: Number,
|
|
@@ -20,9 +20,9 @@ export default {
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
23
|
+
observe: resize({
|
|
24
|
+
target: ({ $el }) => [$el, getPositionedParent($el) || parent($el)],
|
|
25
|
+
}),
|
|
26
26
|
|
|
27
27
|
update: {
|
|
28
28
|
read() {
|
|
@@ -31,16 +31,16 @@ export default {
|
|
|
31
31
|
|
|
32
32
|
let dim = { width, height };
|
|
33
33
|
|
|
34
|
-
if (!
|
|
34
|
+
if (!width || !height) {
|
|
35
35
|
const intrinsic = {
|
|
36
36
|
width: $el.naturalWidth || $el.videoWidth || $el.clientWidth,
|
|
37
37
|
height: $el.naturalHeight || $el.videoHeight || $el.clientHeight,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
if (
|
|
41
|
-
dim = ratio(intrinsic, 'width',
|
|
40
|
+
if (width) {
|
|
41
|
+
dim = ratio(intrinsic, 'width', width);
|
|
42
42
|
} else if (height) {
|
|
43
|
-
dim = ratio(intrinsic, 'height',
|
|
43
|
+
dim = ratio(intrinsic, 'height', height);
|
|
44
44
|
} else {
|
|
45
45
|
dim = intrinsic;
|
|
46
46
|
}
|
package/src/js/core/drop.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Lazyload from '../mixin/lazyload';
|
|
1
|
+
import { lazyload } from '../api/observables';
|
|
3
2
|
import Position from '../mixin/position';
|
|
3
|
+
import Container from '../mixin/container';
|
|
4
4
|
import Togglable from '../mixin/togglable';
|
|
5
|
+
import { keyMap } from '../util/keys';
|
|
6
|
+
import { preventBackgroundScroll } from '../util/scroll';
|
|
5
7
|
import {
|
|
6
8
|
addClass,
|
|
7
9
|
append,
|
|
@@ -10,6 +12,7 @@ import {
|
|
|
10
12
|
css,
|
|
11
13
|
hasClass,
|
|
12
14
|
includes,
|
|
15
|
+
isSameSiteAnchor,
|
|
13
16
|
isTouch,
|
|
14
17
|
matches,
|
|
15
18
|
MouseTracker,
|
|
@@ -20,6 +23,7 @@ import {
|
|
|
20
23
|
once,
|
|
21
24
|
overflowParents,
|
|
22
25
|
parent,
|
|
26
|
+
pick,
|
|
23
27
|
pointerCancel,
|
|
24
28
|
pointerDown,
|
|
25
29
|
pointerEnter,
|
|
@@ -29,12 +33,11 @@ import {
|
|
|
29
33
|
removeClass,
|
|
30
34
|
within,
|
|
31
35
|
} from 'uikit-util';
|
|
32
|
-
import { isSameSiteAnchor, keyMap, preventBackgroundScroll } from '../mixin/utils';
|
|
33
36
|
|
|
34
37
|
export let active;
|
|
35
38
|
|
|
36
39
|
export default {
|
|
37
|
-
mixins: [Container,
|
|
40
|
+
mixins: [Container, Position, Togglable],
|
|
38
41
|
|
|
39
42
|
args: 'pos',
|
|
40
43
|
|
|
@@ -111,7 +114,7 @@ export default {
|
|
|
111
114
|
this.targetEl = createToggleComponent(this);
|
|
112
115
|
}
|
|
113
116
|
|
|
114
|
-
this._style = (
|
|
117
|
+
this._style = pick(this.$el.style, ['width', 'height']);
|
|
115
118
|
},
|
|
116
119
|
|
|
117
120
|
disconnected() {
|
|
@@ -122,6 +125,11 @@ export default {
|
|
|
122
125
|
css(this.$el, this._style);
|
|
123
126
|
},
|
|
124
127
|
|
|
128
|
+
observe: lazyload({
|
|
129
|
+
target: ({ toggle, $el }) => query(toggle, $el),
|
|
130
|
+
targets: ({ $el }) => $el,
|
|
131
|
+
}),
|
|
132
|
+
|
|
125
133
|
events: [
|
|
126
134
|
{
|
|
127
135
|
name: 'click',
|
|
@@ -461,7 +469,6 @@ function createToggleComponent(drop) {
|
|
|
461
469
|
mode: drop.mode,
|
|
462
470
|
});
|
|
463
471
|
attr($el, 'aria-haspopup', true);
|
|
464
|
-
drop.lazyload($el);
|
|
465
472
|
|
|
466
473
|
return $el;
|
|
467
474
|
}
|
package/src/js/core/dropnav.js
CHANGED
package/src/js/core/grid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { scroll } from '../api/observables';
|
|
1
2
|
import Margin from './margin';
|
|
2
3
|
import Class from '../mixin/class';
|
|
3
|
-
import { registerScrollListener, unregisterScrollListener } from '../mixin/scroll';
|
|
4
4
|
import {
|
|
5
5
|
addClass,
|
|
6
6
|
children,
|
|
@@ -34,12 +34,9 @@ export default {
|
|
|
34
34
|
|
|
35
35
|
connected() {
|
|
36
36
|
this.masonry && addClass(this.$el, 'uk-flex-top uk-flex-wrap-top');
|
|
37
|
-
this.parallax && registerScrollListener(this._uid, () => this.$emit('scroll'));
|
|
38
37
|
},
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
unregisterScrollListener(this._uid);
|
|
42
|
-
},
|
|
39
|
+
observe: scroll({ filter: ({ parallax }) => parallax }),
|
|
43
40
|
|
|
44
41
|
update: [
|
|
45
42
|
{
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import Resize from '../mixin/resize';
|
|
2
1
|
import { getRows } from './margin';
|
|
3
|
-
import {
|
|
2
|
+
import { resize } from '../api/observables';
|
|
3
|
+
import { $$, boxModelAdjust, css, dimensions, isVisible, pick } from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
mixins: [Resize],
|
|
7
|
-
|
|
8
6
|
args: 'target',
|
|
9
7
|
|
|
10
8
|
props: {
|
|
@@ -29,9 +27,9 @@ export default {
|
|
|
29
27
|
},
|
|
30
28
|
},
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
30
|
+
observe: resize({
|
|
31
|
+
target: ({ $el, elements }) => [$el, ...elements],
|
|
32
|
+
}),
|
|
35
33
|
|
|
36
34
|
update: {
|
|
37
35
|
read() {
|
|
@@ -55,7 +53,6 @@ function match(elements) {
|
|
|
55
53
|
return { heights: [''], elements };
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
css(elements, 'minHeight', '');
|
|
59
56
|
let heights = elements.map(getHeight);
|
|
60
57
|
const max = Math.max(...heights);
|
|
61
58
|
|
|
@@ -66,17 +63,13 @@ function match(elements) {
|
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
function getHeight(element) {
|
|
69
|
-
|
|
66
|
+
const style = pick(element.style, ['display', 'minHeight']);
|
|
67
|
+
|
|
70
68
|
if (!isVisible(element)) {
|
|
71
|
-
style = element.style.display;
|
|
72
69
|
css(element, 'display', 'block', 'important');
|
|
73
70
|
}
|
|
74
|
-
|
|
71
|
+
css(element, 'minHeight', '');
|
|
75
72
|
const height = dimensions(element).height - boxModelAdjust(element, 'height', 'content-box');
|
|
76
|
-
|
|
77
|
-
if (style !== false) {
|
|
78
|
-
css(element, 'display', style);
|
|
79
|
-
}
|
|
80
|
-
|
|
73
|
+
css(element, style);
|
|
81
74
|
return height;
|
|
82
75
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Resize from '../mixin/resize';
|
|
2
1
|
import {
|
|
3
2
|
boxModelAdjust,
|
|
4
3
|
css,
|
|
@@ -13,10 +12,9 @@ import {
|
|
|
13
12
|
scrollParents,
|
|
14
13
|
toFloat,
|
|
15
14
|
} from 'uikit-util';
|
|
15
|
+
import { resize } from '../api/observables';
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
|
-
mixins: [Resize],
|
|
19
|
-
|
|
20
18
|
props: {
|
|
21
19
|
expand: Boolean,
|
|
22
20
|
offsetTop: Boolean,
|
|
@@ -31,10 +29,10 @@ export default {
|
|
|
31
29
|
minHeight: 0,
|
|
32
30
|
},
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
32
|
+
// check for offsetTop change
|
|
33
|
+
observe: resize({
|
|
34
|
+
target: ({ $el }) => [$el, ...scrollParents($el)],
|
|
35
|
+
}),
|
|
38
36
|
|
|
39
37
|
update: {
|
|
40
38
|
read({ minHeight: prev }) {
|
package/src/js/core/img.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { parseOptions } from '../api/options';
|
|
2
|
+
import { intersection } from '../api/observables';
|
|
1
3
|
import {
|
|
2
4
|
append,
|
|
3
5
|
attr,
|
|
@@ -13,9 +15,7 @@ import {
|
|
|
13
15
|
isArray,
|
|
14
16
|
isEmpty,
|
|
15
17
|
isTag,
|
|
16
|
-
observeIntersection,
|
|
17
18
|
parent,
|
|
18
|
-
parseOptions,
|
|
19
19
|
queryAll,
|
|
20
20
|
removeAttr,
|
|
21
21
|
startsWith,
|
|
@@ -49,29 +49,12 @@ export default {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const target = [this.$el, ...queryAll(this.$props.target, this.$el)];
|
|
53
|
-
|
|
54
52
|
if (nativeLazyLoad && isImg(this.$el)) {
|
|
55
53
|
this.$el.loading = 'lazy';
|
|
56
54
|
setSrcAttrs(this.$el);
|
|
57
|
-
|
|
58
|
-
if (target.length === 1) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
55
|
}
|
|
62
56
|
|
|
63
57
|
ensureSrcAttribute(this.$el);
|
|
64
|
-
|
|
65
|
-
this.registerObserver(
|
|
66
|
-
observeIntersection(
|
|
67
|
-
target,
|
|
68
|
-
(entries, observer) => {
|
|
69
|
-
this.load();
|
|
70
|
-
observer.disconnect();
|
|
71
|
-
},
|
|
72
|
-
{ rootMargin: this.margin }
|
|
73
|
-
)
|
|
74
|
-
);
|
|
75
58
|
},
|
|
76
59
|
|
|
77
60
|
disconnected() {
|
|
@@ -80,6 +63,16 @@ export default {
|
|
|
80
63
|
}
|
|
81
64
|
},
|
|
82
65
|
|
|
66
|
+
observe: intersection({
|
|
67
|
+
target: ({ $el, $props }) => [$el, ...queryAll($props.target, $el)],
|
|
68
|
+
handler(entries, observer) {
|
|
69
|
+
this.load();
|
|
70
|
+
observer.disconnect();
|
|
71
|
+
},
|
|
72
|
+
options: ({ margin }) => ({ rootMargin: margin }),
|
|
73
|
+
filter: ({ loading }) => loading === 'lazy',
|
|
74
|
+
}),
|
|
75
|
+
|
|
83
76
|
methods: {
|
|
84
77
|
load() {
|
|
85
78
|
if (this._data.image) {
|
package/src/js/core/leader.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Media from '../mixin/media';
|
|
3
|
+
import { resize } from '../api/observables';
|
|
3
4
|
import { attr, css, toggleClass, unwrap, wrapInner } from 'uikit-util';
|
|
4
|
-
import Resize from '../mixin/resize';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
mixins: [Class, Media
|
|
7
|
+
mixins: [Class, Media],
|
|
8
8
|
|
|
9
9
|
props: {
|
|
10
10
|
fill: String,
|
|
@@ -31,6 +31,8 @@ export default {
|
|
|
31
31
|
unwrap(this.wrapper.childNodes);
|
|
32
32
|
},
|
|
33
33
|
|
|
34
|
+
observe: resize(),
|
|
35
|
+
|
|
34
36
|
update: {
|
|
35
37
|
read() {
|
|
36
38
|
const width = Math.trunc(this.$el.offsetWidth / 2);
|
package/src/js/core/margin.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
isRtl,
|
|
4
|
-
isVisible,
|
|
5
|
-
observeMutation,
|
|
6
|
-
offsetPosition,
|
|
7
|
-
toArray,
|
|
8
|
-
toggleClass,
|
|
9
|
-
} from 'uikit-util';
|
|
1
|
+
import { isRtl, isVisible, offsetPosition, toArray, toggleClass } from 'uikit-util';
|
|
2
|
+
import { mutation, resize } from '../api/observables';
|
|
10
3
|
|
|
11
4
|
export default {
|
|
12
|
-
mixins: [Resize],
|
|
13
|
-
|
|
14
5
|
props: {
|
|
15
6
|
margin: String,
|
|
16
7
|
firstColumn: Boolean,
|
|
@@ -21,19 +12,18 @@ export default {
|
|
|
21
12
|
firstColumn: 'uk-first-column',
|
|
22
13
|
},
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
connected() {
|
|
29
|
-
this.registerObserver(
|
|
30
|
-
observeMutation(this.$el, () => this.$reset(), {
|
|
15
|
+
observe: [
|
|
16
|
+
mutation({
|
|
17
|
+
options: {
|
|
31
18
|
childList: true,
|
|
32
19
|
attributes: true,
|
|
33
20
|
attributeFilter: ['style'],
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
resize({
|
|
24
|
+
target: ({ $el }) => [$el, ...toArray($el.children)],
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
37
27
|
|
|
38
28
|
update: {
|
|
39
29
|
read() {
|
package/src/js/core/modal.js
CHANGED
package/src/js/core/offcanvas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Modal from '../mixin/modal';
|
|
2
|
-
import
|
|
2
|
+
import { swipe } from '../api/observables';
|
|
3
3
|
import {
|
|
4
4
|
$,
|
|
5
5
|
addClass,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from 'uikit-util';
|
|
17
17
|
|
|
18
18
|
export default {
|
|
19
|
-
mixins: [Modal
|
|
19
|
+
mixins: [Modal],
|
|
20
20
|
|
|
21
21
|
args: 'mode',
|
|
22
22
|
|
|
@@ -24,6 +24,7 @@ export default {
|
|
|
24
24
|
mode: String,
|
|
25
25
|
flip: Boolean,
|
|
26
26
|
overlay: Boolean,
|
|
27
|
+
swiping: Boolean,
|
|
27
28
|
},
|
|
28
29
|
|
|
29
30
|
data: {
|
|
@@ -40,6 +41,7 @@ export default {
|
|
|
40
41
|
clsOverlay: 'uk-offcanvas-overlay',
|
|
41
42
|
selClose: '.uk-offcanvas-close',
|
|
42
43
|
container: false,
|
|
44
|
+
swiping: true,
|
|
43
45
|
},
|
|
44
46
|
|
|
45
47
|
computed: {
|
|
@@ -68,6 +70,8 @@ export default {
|
|
|
68
70
|
},
|
|
69
71
|
},
|
|
70
72
|
|
|
73
|
+
observe: swipe({ filter: ({ swiping }) => swiping }),
|
|
74
|
+
|
|
71
75
|
update: {
|
|
72
76
|
read() {
|
|
73
77
|
if (this.isToggled() && !isVisible(this.$el)) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import
|
|
2
|
+
import { resize } from '../api/observables';
|
|
3
3
|
import { closest, css, dimensions, height, isVisible } from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
mixins: [Class
|
|
6
|
+
mixins: [Class],
|
|
7
7
|
|
|
8
8
|
props: {
|
|
9
9
|
selContainer: String,
|
|
@@ -27,9 +27,9 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
30
|
+
observe: resize({
|
|
31
|
+
target: ({ container, content }) => [container, content],
|
|
32
|
+
}),
|
|
33
33
|
|
|
34
34
|
update: {
|
|
35
35
|
read() {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { resize } from '../api/observables';
|
|
2
2
|
import { addClass, Dimensions, height, isVisible, parent, width } from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
mixins: [Resize],
|
|
6
|
-
|
|
7
5
|
props: ['width', 'height'],
|
|
8
6
|
|
|
9
|
-
resizeTargets() {
|
|
10
|
-
return [this.$el, parent(this.$el)];
|
|
11
|
-
},
|
|
12
|
-
|
|
13
7
|
connected() {
|
|
14
8
|
addClass(this.$el, 'uk-responsive-width');
|
|
15
9
|
},
|
|
16
10
|
|
|
11
|
+
observe: resize({
|
|
12
|
+
target: ({ $el }) => [$el, parent($el)],
|
|
13
|
+
}),
|
|
14
|
+
|
|
17
15
|
update: {
|
|
18
16
|
read() {
|
|
19
17
|
return isVisible(this.$el) && this.width && this.height
|
package/src/js/core/scroll.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
$,
|
|
3
|
+
getTargetedElement,
|
|
4
|
+
isSameSiteAnchor,
|
|
5
|
+
off,
|
|
6
|
+
on,
|
|
7
|
+
scrollIntoView,
|
|
8
|
+
trigger,
|
|
9
|
+
within,
|
|
10
|
+
} from 'uikit-util';
|
|
3
11
|
|
|
4
12
|
export default {
|
|
5
13
|
props: {
|
|
@@ -30,19 +38,19 @@ export default {
|
|
|
30
38
|
},
|
|
31
39
|
};
|
|
32
40
|
|
|
33
|
-
const
|
|
41
|
+
const instances = new Set();
|
|
34
42
|
function registerClick(cmp) {
|
|
35
|
-
if (!
|
|
43
|
+
if (!instances.size) {
|
|
36
44
|
on(document, 'click', clickHandler);
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
instances.add(cmp);
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
function unregisterClick(cmp) {
|
|
43
|
-
|
|
51
|
+
instances.delete(cmp);
|
|
44
52
|
|
|
45
|
-
if (!
|
|
53
|
+
if (!instances.size) {
|
|
46
54
|
off(document, 'click', clickHandler);
|
|
47
55
|
}
|
|
48
56
|
}
|
|
@@ -52,10 +60,11 @@ function clickHandler(e) {
|
|
|
52
60
|
return;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
for (const
|
|
56
|
-
if (within(e.target,
|
|
63
|
+
for (const instance of instances) {
|
|
64
|
+
if (within(e.target, instance.$el) && isSameSiteAnchor(instance.$el)) {
|
|
57
65
|
e.preventDefault();
|
|
58
|
-
|
|
66
|
+
window.history.pushState({}, '', instance.$el.href);
|
|
67
|
+
instance.scrollTo(getTargetedElement(instance.$el));
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { scroll } from '../api/observables';
|
|
2
2
|
import {
|
|
3
3
|
$$,
|
|
4
4
|
closest,
|
|
5
|
+
getTargetedElement,
|
|
5
6
|
hasClass,
|
|
7
|
+
isSameSiteAnchor,
|
|
6
8
|
isVisible,
|
|
7
9
|
offset,
|
|
8
10
|
offsetViewport,
|
|
@@ -10,11 +12,8 @@ import {
|
|
|
10
12
|
toggleClass,
|
|
11
13
|
trigger,
|
|
12
14
|
} from 'uikit-util';
|
|
13
|
-
import { getTargetElement, isSameSiteAnchor } from '../mixin/utils';
|
|
14
15
|
|
|
15
16
|
export default {
|
|
16
|
-
mixins: [Scroll],
|
|
17
|
-
|
|
18
17
|
props: {
|
|
19
18
|
cls: String,
|
|
20
19
|
closest: String,
|
|
@@ -51,10 +50,12 @@ export default {
|
|
|
51
50
|
},
|
|
52
51
|
},
|
|
53
52
|
|
|
53
|
+
observe: scroll(),
|
|
54
|
+
|
|
54
55
|
update: [
|
|
55
56
|
{
|
|
56
57
|
read() {
|
|
57
|
-
const targets = this.links.map(
|
|
58
|
+
const targets = this.links.map(getTargetedElement).filter(Boolean);
|
|
58
59
|
|
|
59
60
|
const { length } = targets;
|
|
60
61
|
|