uikit 3.11.2-dev.31cd2ba38 → 3.11.2-dev.3dfa2c50b
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 +7 -11
- 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 +5266 -6572
- 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 +8126 -9876
- 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 +106 -92
- 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 +130 -105
- 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 +42 -47
- package/src/js/util/player.js +40 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/promise.js +0 -191
- package/src/js/util/selector.js +39 -48
- 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/image.html +38 -22
- package/tests/js/index.js +114 -85
- package/src/js/mixin/flex-bug.js +0 -56
- package/tests/images/test.avif +0 -0
- package/tests/images/test.webp +0 -0
package/src/js/core/grid.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import Margin from './margin';
|
|
2
2
|
import Class from '../mixin/class';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
addClass,
|
|
5
|
+
children,
|
|
6
|
+
css,
|
|
7
|
+
hasClass,
|
|
8
|
+
scrolledOver,
|
|
9
|
+
sortBy,
|
|
10
|
+
toFloat,
|
|
11
|
+
toggleClass,
|
|
12
|
+
} from 'uikit-util';
|
|
4
13
|
|
|
5
14
|
export default {
|
|
6
|
-
|
|
7
15
|
extends: Margin,
|
|
8
16
|
|
|
9
17
|
mixins: [Class],
|
|
@@ -12,14 +20,14 @@ export default {
|
|
|
12
20
|
|
|
13
21
|
props: {
|
|
14
22
|
masonry: Boolean,
|
|
15
|
-
parallax: Number
|
|
23
|
+
parallax: Number,
|
|
16
24
|
},
|
|
17
25
|
|
|
18
26
|
data: {
|
|
19
27
|
margin: 'uk-grid-margin',
|
|
20
28
|
clsStack: 'uk-grid-stack',
|
|
21
29
|
masonry: false,
|
|
22
|
-
parallax: 0
|
|
30
|
+
parallax: 0,
|
|
23
31
|
},
|
|
24
32
|
|
|
25
33
|
connected() {
|
|
@@ -27,25 +35,24 @@ export default {
|
|
|
27
35
|
},
|
|
28
36
|
|
|
29
37
|
update: [
|
|
30
|
-
|
|
31
38
|
{
|
|
32
|
-
|
|
33
|
-
write({columns}) {
|
|
39
|
+
write({ columns }) {
|
|
34
40
|
toggleClass(this.$el, this.clsStack, columns.length < 2);
|
|
35
41
|
},
|
|
36
42
|
|
|
37
|
-
events: ['resize']
|
|
38
|
-
|
|
43
|
+
events: ['resize'],
|
|
39
44
|
},
|
|
40
45
|
|
|
41
46
|
{
|
|
42
|
-
|
|
43
47
|
read(data) {
|
|
44
|
-
|
|
45
|
-
let {columns, rows} = data;
|
|
48
|
+
let { columns, rows } = data;
|
|
46
49
|
|
|
47
50
|
// Filter component makes elements positioned absolute
|
|
48
|
-
if (
|
|
51
|
+
if (
|
|
52
|
+
!columns.length ||
|
|
53
|
+
(!this.masonry && !this.parallax) ||
|
|
54
|
+
positionedAbsolute(this.$el)
|
|
55
|
+
) {
|
|
49
56
|
data.translates = false;
|
|
50
57
|
return false;
|
|
51
58
|
}
|
|
@@ -58,36 +65,35 @@ export default {
|
|
|
58
65
|
const elHeight = Math.max(...columnHeights) + margin;
|
|
59
66
|
|
|
60
67
|
if (this.masonry) {
|
|
61
|
-
columns = columns.map(column => sortBy(column, 'offsetTop'));
|
|
68
|
+
columns = columns.map((column) => sortBy(column, 'offsetTop'));
|
|
62
69
|
translates = getTranslates(rows, columns);
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
let padding = Math.abs(this.parallax);
|
|
66
73
|
if (padding) {
|
|
67
|
-
padding = columnHeights.reduce(
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
padding = columnHeights.reduce(
|
|
75
|
+
(newPadding, hgt, i) =>
|
|
76
|
+
Math.max(
|
|
77
|
+
newPadding,
|
|
78
|
+
hgt + margin + (i % 2 ? padding : padding / 8) - elHeight
|
|
79
|
+
),
|
|
80
|
+
0
|
|
81
|
+
);
|
|
70
82
|
}
|
|
71
83
|
|
|
72
|
-
return {padding, columns, translates, height: translates ? elHeight : ''};
|
|
73
|
-
|
|
84
|
+
return { padding, columns, translates, height: translates ? elHeight : '' };
|
|
74
85
|
},
|
|
75
86
|
|
|
76
|
-
write({height, padding}) {
|
|
77
|
-
|
|
87
|
+
write({ height, padding }) {
|
|
78
88
|
css(this.$el, 'paddingBottom', padding || '');
|
|
79
89
|
height !== false && css(this.$el, 'height', height);
|
|
80
|
-
|
|
81
90
|
},
|
|
82
91
|
|
|
83
|
-
events: ['resize']
|
|
84
|
-
|
|
92
|
+
events: ['resize'],
|
|
85
93
|
},
|
|
86
94
|
|
|
87
95
|
{
|
|
88
|
-
|
|
89
|
-
read({height}) {
|
|
90
|
-
|
|
96
|
+
read() {
|
|
91
97
|
if (positionedAbsolute(this.$el)) {
|
|
92
98
|
return false;
|
|
93
99
|
}
|
|
@@ -95,65 +101,58 @@ export default {
|
|
|
95
101
|
return {
|
|
96
102
|
scrolled: this.parallax
|
|
97
103
|
? scrolledOver(this.$el) * Math.abs(this.parallax)
|
|
98
|
-
: false
|
|
104
|
+
: false,
|
|
99
105
|
};
|
|
100
106
|
},
|
|
101
107
|
|
|
102
|
-
write({columns, scrolled, translates}) {
|
|
103
|
-
|
|
108
|
+
write({ columns, scrolled, translates }) {
|
|
104
109
|
if (scrolled === false && !translates) {
|
|
105
110
|
return;
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
columns.forEach((column, i) =>
|
|
109
114
|
column.forEach((el, j) =>
|
|
110
|
-
css(
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
css(
|
|
116
|
+
el,
|
|
117
|
+
'transform',
|
|
118
|
+
!scrolled && !translates
|
|
119
|
+
? ''
|
|
120
|
+
: `translateY(${
|
|
121
|
+
(translates && -translates[i][j]) +
|
|
122
|
+
(scrolled ? (i % 2 ? scrolled : scrolled / 8) : 0)
|
|
123
|
+
}px)`
|
|
124
|
+
)
|
|
113
125
|
)
|
|
114
126
|
);
|
|
115
|
-
|
|
116
127
|
},
|
|
117
128
|
|
|
118
|
-
events: ['scroll', 'resize']
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
]
|
|
123
|
-
|
|
129
|
+
events: ['scroll', 'resize'],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
124
132
|
};
|
|
125
133
|
|
|
126
134
|
function positionedAbsolute(el) {
|
|
127
|
-
return children(el).some(el => css(el, 'position') === 'absolute');
|
|
135
|
+
return children(el).some((el) => css(el, 'position') === 'absolute');
|
|
128
136
|
}
|
|
129
137
|
|
|
130
138
|
function getTranslates(rows, columns) {
|
|
139
|
+
const rowHeights = rows.map((row) => Math.max(...row.map((el) => el.offsetHeight)));
|
|
131
140
|
|
|
132
|
-
|
|
133
|
-
Math.max(...row.map(el => el.offsetHeight))
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
return columns.map(elements => {
|
|
141
|
+
return columns.map((elements) => {
|
|
137
142
|
let prev = 0;
|
|
138
|
-
return elements.map(
|
|
139
|
-
|
|
140
|
-
? rowHeights[row - 1] - elements[row - 1].offsetHeight
|
|
141
|
-
: 0
|
|
143
|
+
return elements.map(
|
|
144
|
+
(element, row) =>
|
|
145
|
+
(prev += row ? rowHeights[row - 1] - elements[row - 1].offsetHeight : 0)
|
|
142
146
|
);
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
function getMarginTop(nodes, cls) {
|
|
151
|
+
const [node] = nodes.filter((el) => hasClass(el, cls));
|
|
147
152
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return toFloat(node
|
|
151
|
-
? css(node, 'marginTop')
|
|
152
|
-
: css(nodes[0], 'paddingLeft'));
|
|
153
|
+
return toFloat(node ? css(node, 'marginTop') : css(nodes[0], 'paddingLeft'));
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
function getColumnHeights(columns) {
|
|
156
|
-
return columns.map(column =>
|
|
157
|
-
column.reduce((sum, el) => sum + el.offsetHeight, 0)
|
|
158
|
-
);
|
|
157
|
+
return columns.map((column) => column.reduce((sum, el) => sum + el.offsetHeight, 0));
|
|
159
158
|
}
|
|
@@ -1,63 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {$$, boxModelAdjust, css, dimensions, isVisible, toFloat} from 'uikit-util';
|
|
1
|
+
import { getRows } from './margin';
|
|
2
|
+
import { $$, boxModelAdjust, css, dimensions, isVisible, toFloat } from 'uikit-util';
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
|
-
|
|
7
|
-
mixins: [FlexBug],
|
|
8
|
-
|
|
9
5
|
args: 'target',
|
|
10
6
|
|
|
11
7
|
props: {
|
|
12
8
|
target: String,
|
|
13
|
-
row: Boolean
|
|
9
|
+
row: Boolean,
|
|
14
10
|
},
|
|
15
11
|
|
|
16
12
|
data: {
|
|
17
13
|
target: '> *',
|
|
18
14
|
row: true,
|
|
19
|
-
forceHeight: true
|
|
15
|
+
forceHeight: true,
|
|
20
16
|
},
|
|
21
17
|
|
|
22
18
|
computed: {
|
|
23
|
-
|
|
24
|
-
elements({target}, $el) {
|
|
19
|
+
elements({ target }, $el) {
|
|
25
20
|
return $$(target, $el);
|
|
26
|
-
}
|
|
27
|
-
|
|
21
|
+
},
|
|
28
22
|
},
|
|
29
23
|
|
|
30
24
|
update: {
|
|
31
|
-
|
|
32
25
|
read() {
|
|
33
26
|
return {
|
|
34
|
-
rows: (this.row ? getRows(this.elements) : [this.elements]).map(match)
|
|
27
|
+
rows: (this.row ? getRows(this.elements) : [this.elements]).map(match),
|
|
35
28
|
};
|
|
36
29
|
},
|
|
37
30
|
|
|
38
|
-
write({rows}) {
|
|
39
|
-
|
|
40
|
-
elements.forEach((el, i) =>
|
|
41
|
-
|
|
42
|
-
)
|
|
43
|
-
);
|
|
31
|
+
write({ rows }) {
|
|
32
|
+
for (const { heights, elements } of rows) {
|
|
33
|
+
elements.forEach((el, i) => css(el, 'minHeight', heights[i]));
|
|
34
|
+
}
|
|
44
35
|
},
|
|
45
36
|
|
|
46
|
-
events: ['resize']
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
37
|
+
events: ['resize'],
|
|
38
|
+
},
|
|
50
39
|
};
|
|
51
40
|
|
|
52
41
|
function match(elements) {
|
|
53
|
-
|
|
54
42
|
if (elements.length < 2) {
|
|
55
|
-
return {heights: [''], elements};
|
|
43
|
+
return { heights: [''], elements };
|
|
56
44
|
}
|
|
57
45
|
|
|
58
46
|
let heights = elements.map(getHeight);
|
|
59
47
|
let max = Math.max(...heights);
|
|
60
|
-
const hasMinHeight = elements.some(el => el.style.minHeight);
|
|
48
|
+
const hasMinHeight = elements.some((el) => el.style.minHeight);
|
|
61
49
|
const hasShrunk = elements.some((el, i) => !el.style.minHeight && heights[i] < max);
|
|
62
50
|
|
|
63
51
|
if (hasMinHeight && hasShrunk) {
|
|
@@ -70,11 +58,10 @@ function match(elements) {
|
|
|
70
58
|
heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max
|
|
71
59
|
);
|
|
72
60
|
|
|
73
|
-
return {heights, elements};
|
|
61
|
+
return { heights, elements };
|
|
74
62
|
}
|
|
75
63
|
|
|
76
64
|
function getHeight(element) {
|
|
77
|
-
|
|
78
65
|
let style = false;
|
|
79
66
|
if (!isVisible(element)) {
|
|
80
67
|
style = element.style.display;
|
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
boxModelAdjust,
|
|
3
|
+
css,
|
|
4
|
+
dimensions,
|
|
5
|
+
endsWith,
|
|
6
|
+
height,
|
|
7
|
+
isNumeric,
|
|
8
|
+
isString,
|
|
9
|
+
isVisible,
|
|
10
|
+
offset,
|
|
11
|
+
query,
|
|
12
|
+
toFloat,
|
|
13
|
+
trigger,
|
|
14
|
+
} from 'uikit-util';
|
|
3
15
|
|
|
4
16
|
export default {
|
|
5
|
-
|
|
6
|
-
mixins: [FlexBug],
|
|
7
|
-
|
|
8
17
|
props: {
|
|
9
18
|
expand: Boolean,
|
|
10
19
|
offsetTop: Boolean,
|
|
11
20
|
offsetBottom: Boolean,
|
|
12
|
-
minHeight: Number
|
|
21
|
+
minHeight: Number,
|
|
13
22
|
},
|
|
14
23
|
|
|
15
24
|
data: {
|
|
16
25
|
expand: false,
|
|
17
26
|
offsetTop: false,
|
|
18
27
|
offsetBottom: false,
|
|
19
|
-
minHeight: 0
|
|
28
|
+
minHeight: 0,
|
|
20
29
|
},
|
|
21
30
|
|
|
22
31
|
update: {
|
|
23
|
-
|
|
24
|
-
read({minHeight: prev}) {
|
|
25
|
-
|
|
32
|
+
read({ minHeight: prev }) {
|
|
26
33
|
if (!isVisible(this.$el)) {
|
|
27
34
|
return false;
|
|
28
35
|
}
|
|
@@ -31,49 +38,38 @@ export default {
|
|
|
31
38
|
const box = boxModelAdjust(this.$el, 'height', 'content-box');
|
|
32
39
|
|
|
33
40
|
if (this.expand) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
minHeight =
|
|
42
|
+
height(window) -
|
|
43
|
+
(dimensions(document.documentElement).height -
|
|
44
|
+
dimensions(this.$el).height) -
|
|
45
|
+
box || '';
|
|
37
46
|
} else {
|
|
38
|
-
|
|
39
47
|
// on mobile devices (iOS and Android) window.innerHeight !== 100vh
|
|
40
48
|
minHeight = 'calc(100vh';
|
|
41
49
|
|
|
42
50
|
if (this.offsetTop) {
|
|
43
|
-
|
|
44
|
-
const {top} = offset(this.$el);
|
|
51
|
+
const { top } = offset(this.$el);
|
|
45
52
|
minHeight += top > 0 && top < height(window) / 2 ? ` - ${top}px` : '';
|
|
46
|
-
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
if (this.offsetBottom === true) {
|
|
50
|
-
|
|
51
56
|
minHeight += ` - ${dimensions(this.$el.nextElementSibling).height}px`;
|
|
52
|
-
|
|
53
57
|
} else if (isNumeric(this.offsetBottom)) {
|
|
54
|
-
|
|
55
58
|
minHeight += ` - ${this.offsetBottom}vh`;
|
|
56
|
-
|
|
57
59
|
} else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) {
|
|
58
|
-
|
|
59
60
|
minHeight += ` - ${toFloat(this.offsetBottom)}px`;
|
|
60
|
-
|
|
61
61
|
} else if (isString(this.offsetBottom)) {
|
|
62
|
-
|
|
63
62
|
minHeight += ` - ${dimensions(query(this.offsetBottom, this.$el)).height}px`;
|
|
64
|
-
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
minHeight += `${box ? ` - ${box}px` : ''})`;
|
|
68
|
-
|
|
69
66
|
}
|
|
70
67
|
|
|
71
|
-
return {minHeight, prev};
|
|
68
|
+
return { minHeight, prev };
|
|
72
69
|
},
|
|
73
70
|
|
|
74
|
-
write({minHeight, prev}) {
|
|
75
|
-
|
|
76
|
-
css(this.$el, {minHeight});
|
|
71
|
+
write({ minHeight, prev }) {
|
|
72
|
+
css(this.$el, { minHeight });
|
|
77
73
|
|
|
78
74
|
if (minHeight !== prev) {
|
|
79
75
|
trigger(this.$el, 'resize');
|
|
@@ -82,11 +78,8 @@ export default {
|
|
|
82
78
|
if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
|
|
83
79
|
css(this.$el, 'minHeight', this.minHeight);
|
|
84
80
|
}
|
|
85
|
-
|
|
86
81
|
},
|
|
87
82
|
|
|
88
|
-
events: ['resize']
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
83
|
+
events: ['resize'],
|
|
84
|
+
},
|
|
92
85
|
};
|
package/src/js/core/icon.js
CHANGED
|
@@ -15,7 +15,19 @@ import slidenavPrevious from '../../images/components/slidenav-previous.svg';
|
|
|
15
15
|
import slidenavPreviousLarge from '../../images/components/slidenav-previous-large.svg';
|
|
16
16
|
import spinner from '../../images/components/spinner.svg';
|
|
17
17
|
import totop from '../../images/components/totop.svg';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
$,
|
|
20
|
+
addClass,
|
|
21
|
+
apply,
|
|
22
|
+
css,
|
|
23
|
+
each,
|
|
24
|
+
hasClass,
|
|
25
|
+
hyphenate,
|
|
26
|
+
isRtl,
|
|
27
|
+
isString,
|
|
28
|
+
parents,
|
|
29
|
+
swap,
|
|
30
|
+
} from 'uikit-util';
|
|
19
31
|
|
|
20
32
|
const icons = {
|
|
21
33
|
spinner,
|
|
@@ -33,11 +45,10 @@ const icons = {
|
|
|
33
45
|
'slidenav-next': slidenavNext,
|
|
34
46
|
'slidenav-next-large': slidenavNextLarge,
|
|
35
47
|
'slidenav-previous': slidenavPrevious,
|
|
36
|
-
'slidenav-previous-large': slidenavPreviousLarge
|
|
48
|
+
'slidenav-previous-large': slidenavPreviousLarge,
|
|
37
49
|
};
|
|
38
50
|
|
|
39
51
|
const Icon = {
|
|
40
|
-
|
|
41
52
|
install,
|
|
42
53
|
|
|
43
54
|
extends: SVG,
|
|
@@ -47,7 +58,7 @@ const Icon = {
|
|
|
47
58
|
props: ['icon'],
|
|
48
59
|
|
|
49
60
|
data: {
|
|
50
|
-
include: ['focusable']
|
|
61
|
+
include: ['focusable'],
|
|
51
62
|
},
|
|
52
63
|
|
|
53
64
|
isIcon: true,
|
|
@@ -57,9 +68,7 @@ const Icon = {
|
|
|
57
68
|
},
|
|
58
69
|
|
|
59
70
|
methods: {
|
|
60
|
-
|
|
61
71
|
getSvg() {
|
|
62
|
-
|
|
63
72
|
const icon = getIcon(this.icon);
|
|
64
73
|
|
|
65
74
|
if (!icon) {
|
|
@@ -67,32 +76,27 @@ const Icon = {
|
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
return Promise.resolve(icon);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
79
|
+
},
|
|
80
|
+
},
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
export default Icon;
|
|
77
84
|
|
|
78
85
|
export const IconComponent = {
|
|
79
|
-
|
|
80
86
|
args: false,
|
|
81
87
|
|
|
82
88
|
extends: Icon,
|
|
83
89
|
|
|
84
|
-
data: vm => ({
|
|
85
|
-
icon: hyphenate(vm.constructor.options.name)
|
|
90
|
+
data: (vm) => ({
|
|
91
|
+
icon: hyphenate(vm.constructor.options.name),
|
|
86
92
|
}),
|
|
87
93
|
|
|
88
94
|
beforeConnect() {
|
|
89
95
|
addClass(this.$el, this.$name);
|
|
90
|
-
}
|
|
91
|
-
|
|
96
|
+
},
|
|
92
97
|
};
|
|
93
98
|
|
|
94
99
|
export const Slidenav = {
|
|
95
|
-
|
|
96
100
|
extends: IconComponent,
|
|
97
101
|
|
|
98
102
|
beforeConnect() {
|
|
@@ -100,72 +104,57 @@ export const Slidenav = {
|
|
|
100
104
|
},
|
|
101
105
|
|
|
102
106
|
computed: {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
: icon;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
107
|
+
icon({ icon }, $el) {
|
|
108
|
+
return hasClass($el, 'uk-slidenav-large') ? `${icon}-large` : icon;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
112
111
|
};
|
|
113
112
|
|
|
114
113
|
export const Search = {
|
|
115
|
-
|
|
116
114
|
extends: IconComponent,
|
|
117
115
|
|
|
118
116
|
computed: {
|
|
119
|
-
|
|
120
|
-
icon({icon}, $el) {
|
|
117
|
+
icon({ icon }, $el) {
|
|
121
118
|
return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
|
|
122
119
|
? 'search-large'
|
|
123
120
|
: parents($el, '.uk-search-navbar').length
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
121
|
+
? 'search-navbar'
|
|
122
|
+
: icon;
|
|
123
|
+
},
|
|
124
|
+
},
|
|
130
125
|
};
|
|
131
126
|
|
|
132
127
|
export const Close = {
|
|
133
|
-
|
|
134
128
|
extends: IconComponent,
|
|
135
129
|
|
|
136
130
|
computed: {
|
|
137
|
-
|
|
138
131
|
icon() {
|
|
139
132
|
return `close-${hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'}`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
133
|
+
},
|
|
134
|
+
},
|
|
144
135
|
};
|
|
145
136
|
|
|
146
137
|
export const Spinner = {
|
|
147
|
-
|
|
148
138
|
extends: IconComponent,
|
|
149
139
|
|
|
150
|
-
connected() {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
140
|
+
async connected() {
|
|
141
|
+
const svg = await this.svg;
|
|
142
|
+
svg && this.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this.ratio);
|
|
143
|
+
},
|
|
154
144
|
};
|
|
155
145
|
|
|
156
146
|
const parsed = {};
|
|
157
147
|
function install(UIkit) {
|
|
158
148
|
UIkit.icon.add = (name, svg) => {
|
|
159
|
-
|
|
160
|
-
const added = isString(name) ? ({[name]: svg}) : name;
|
|
149
|
+
const added = isString(name) ? { [name]: svg } : name;
|
|
161
150
|
each(added, (svg, name) => {
|
|
162
151
|
icons[name] = svg;
|
|
163
152
|
delete parsed[name];
|
|
164
153
|
});
|
|
165
154
|
|
|
166
155
|
if (UIkit._initialized) {
|
|
167
|
-
apply(document.body, el =>
|
|
168
|
-
each(UIkit.getComponents(el), cmp => {
|
|
156
|
+
apply(document.body, (el) =>
|
|
157
|
+
each(UIkit.getComponents(el), (cmp) => {
|
|
169
158
|
cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
|
|
170
159
|
})
|
|
171
160
|
);
|
|
@@ -174,7 +163,6 @@ function install(UIkit) {
|
|
|
174
163
|
}
|
|
175
164
|
|
|
176
165
|
function getIcon(icon) {
|
|
177
|
-
|
|
178
166
|
if (!icons[icon]) {
|
|
179
167
|
return null;
|
|
180
168
|
}
|