uikit 3.12.1 → 3.12.3-dev.3c9ee4dfd
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 +30 -2
- package/build/scss.js +9 -17
- package/dist/css/uikit-core-rtl.css +15 -81
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +15 -81
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +15 -81
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +15 -81
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +3 -3
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +1 -1
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +13 -2
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +15 -4
- 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 +65 -8
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +30 -13
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +14 -3
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +30 -13
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +13 -2
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +12 -20
- 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 +281 -224
- 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 +296 -237
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/hooks.js +3 -3
- package/src/js/api/state.js +14 -39
- package/src/js/components/countdown.js +2 -2
- package/src/js/components/lightbox.js +1 -1
- package/src/js/components/parallax.js +3 -1
- package/src/js/components/slider-parallax.js +6 -4
- package/src/js/components/slider.js +1 -1
- package/src/js/core/core.js +2 -17
- package/src/js/core/cover.js +3 -6
- package/src/js/core/drop.js +5 -10
- package/src/js/core/form-custom.js +6 -7
- package/src/js/core/gif.js +5 -3
- package/src/js/core/grid.js +2 -1
- package/src/js/core/height-match.js +21 -1
- package/src/js/core/height-viewport.js +10 -7
- package/src/js/core/img.js +1 -2
- package/src/js/core/leader.js +7 -13
- package/src/js/core/margin.js +18 -1
- package/src/js/core/overflow-auto.js +8 -7
- package/src/js/core/scroll.js +6 -2
- package/src/js/core/scrollspy-nav.js +19 -16
- package/src/js/core/scrollspy.js +12 -15
- package/src/js/core/sticky.js +8 -3
- package/src/js/core/svg.js +16 -14
- package/src/js/core/toggle.js +16 -13
- package/src/js/core/video.js +2 -8
- package/src/js/mixin/media.js +29 -5
- package/src/js/mixin/position.js +10 -18
- package/src/js/mixin/resize.js +13 -0
- package/src/js/mixin/scroll.js +32 -0
- package/src/js/mixin/slider.js +2 -1
- package/src/js/util/class.js +1 -6
- package/src/js/util/mouse.js +1 -1
- package/src/js/util/observer.js +57 -20
- package/src/js/util/style.js +1 -1
- package/src/less/components/base.less +0 -19
- package/src/less/components/form.less +1 -9
- package/src/less/components/icon.less +6 -0
- package/src/less/components/list.less +1 -0
- package/src/less/components/search.less +0 -3
- package/src/less/components/slider.less +3 -0
- package/src/less/components/slideshow.less +3 -0
- package/src/less/components/utility.less +0 -9
- package/src/scss/components/base.scss +0 -19
- package/src/scss/components/form.scss +1 -7
- package/src/scss/components/icon.scss +6 -0
- package/src/scss/components/list.scss +1 -0
- package/src/scss/components/search.scss +0 -1
- package/src/scss/components/slider.scss +3 -0
- package/src/scss/components/slideshow.scss +3 -0
- package/src/scss/components/utility.scss +0 -9
- package/src/scss/mixins-theme.scss +0 -4
- package/src/scss/mixins.scss +0 -4
- package/tests/js/index.js +1 -1
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.12.
|
|
5
|
+
"version": "3.12.3-dev.3c9ee4dfd",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
package/src/js/api/hooks.js
CHANGED
|
@@ -11,7 +11,7 @@ export default function (UIkit) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
this._data = {};
|
|
14
|
-
this.
|
|
14
|
+
this._computed = {};
|
|
15
15
|
|
|
16
16
|
this._initProps();
|
|
17
17
|
|
|
@@ -105,8 +105,8 @@ export default function (UIkit) {
|
|
|
105
105
|
const {
|
|
106
106
|
$options: { computed },
|
|
107
107
|
} = this;
|
|
108
|
-
const values = { ...this.
|
|
109
|
-
this.
|
|
108
|
+
const values = { ...this._computed };
|
|
109
|
+
this._computed = {};
|
|
110
110
|
|
|
111
111
|
for (const key in computed) {
|
|
112
112
|
const { watch, immediate } = computed[key];
|
package/src/js/api/state.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
data as getData,
|
|
5
5
|
hasOwn,
|
|
6
6
|
hyphenate,
|
|
7
|
-
includes,
|
|
8
7
|
isArray,
|
|
9
8
|
isFunction,
|
|
10
9
|
isNumeric,
|
|
@@ -62,7 +61,7 @@ export default function (UIkit) {
|
|
|
62
61
|
UIkit.prototype._initComputeds = function () {
|
|
63
62
|
const { computed } = this.$options;
|
|
64
63
|
|
|
65
|
-
this.
|
|
64
|
+
this._computed = {};
|
|
66
65
|
|
|
67
66
|
if (computed) {
|
|
68
67
|
for (const key in computed) {
|
|
@@ -101,22 +100,19 @@ export default function (UIkit) {
|
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
|
-
for (const { events = [] } of this.$options.update || []) {
|
|
105
|
-
if (includes(events, 'scroll')) {
|
|
106
|
-
registerScrollListener(this._uid, () => this.$emit('scroll'));
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
103
|
};
|
|
111
104
|
|
|
112
105
|
UIkit.prototype._unbindEvents = function () {
|
|
113
106
|
this._events.forEach((unbind) => unbind());
|
|
114
107
|
delete this._events;
|
|
115
|
-
unregisterScrollListener(this._uid);
|
|
116
108
|
};
|
|
117
109
|
|
|
118
110
|
UIkit.prototype._initObservers = function () {
|
|
119
|
-
this._observers = [
|
|
111
|
+
this._observers = [initPropsObserver(this)];
|
|
112
|
+
|
|
113
|
+
if (this.$options.computed) {
|
|
114
|
+
this.registerObserver(initChildListObserver(this));
|
|
115
|
+
}
|
|
120
116
|
};
|
|
121
117
|
|
|
122
118
|
UIkit.prototype.registerObserver = function (observer) {
|
|
@@ -170,22 +166,22 @@ function registerComputed(component, key, cb) {
|
|
|
170
166
|
enumerable: true,
|
|
171
167
|
|
|
172
168
|
get() {
|
|
173
|
-
const {
|
|
169
|
+
const { _computed, $props, $el } = component;
|
|
174
170
|
|
|
175
|
-
if (!hasOwn(
|
|
176
|
-
|
|
171
|
+
if (!hasOwn(_computed, key)) {
|
|
172
|
+
_computed[key] = (cb.get || cb).call(component, $props, $el);
|
|
177
173
|
}
|
|
178
174
|
|
|
179
|
-
return
|
|
175
|
+
return _computed[key];
|
|
180
176
|
},
|
|
181
177
|
|
|
182
178
|
set(value) {
|
|
183
|
-
const {
|
|
179
|
+
const { _computed } = component;
|
|
184
180
|
|
|
185
|
-
|
|
181
|
+
_computed[key] = cb.set ? cb.set.call(component, value) : value;
|
|
186
182
|
|
|
187
|
-
if (isUndefined(
|
|
188
|
-
delete
|
|
183
|
+
if (isUndefined(_computed[key])) {
|
|
184
|
+
delete _computed[key];
|
|
189
185
|
}
|
|
190
186
|
},
|
|
191
187
|
});
|
|
@@ -312,24 +308,3 @@ function initPropsObserver(component) {
|
|
|
312
308
|
|
|
313
309
|
return observer;
|
|
314
310
|
}
|
|
315
|
-
|
|
316
|
-
const scrollListeners = new Map();
|
|
317
|
-
let unbindScrollListener;
|
|
318
|
-
function registerScrollListener(id, listener) {
|
|
319
|
-
unbindScrollListener =
|
|
320
|
-
unbindScrollListener ||
|
|
321
|
-
on(window, 'scroll', () => scrollListeners.forEach((listener) => listener()), {
|
|
322
|
-
passive: true,
|
|
323
|
-
capture: true,
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
scrollListeners.set(id, listener);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function unregisterScrollListener(id) {
|
|
330
|
-
scrollListeners.delete(id);
|
|
331
|
-
if (unbindScrollListener && !scrollListeners.size) {
|
|
332
|
-
unbindScrollListener();
|
|
333
|
-
unbindScrollListener = null;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
connected() {
|
|
20
|
-
this.date = Date.parse(this.date);
|
|
20
|
+
this.date = Date.parse(this.$props.date);
|
|
21
21
|
this.start();
|
|
22
22
|
},
|
|
23
23
|
|
|
@@ -70,7 +70,7 @@ export default {
|
|
|
70
70
|
continue;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
let digits = String(Math.
|
|
73
|
+
let digits = String(Math.trunc(timespan[unit]));
|
|
74
74
|
|
|
75
75
|
digits = digits.length < 2 ? `0${digits}` : digits;
|
|
76
76
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import Resize from '../mixin/resize';
|
|
2
|
+
import Scroll from '../mixin/scroll';
|
|
1
3
|
import Parallax from '../mixin/parallax';
|
|
2
4
|
import { css, parent, query, scrolledOver, toPx } from 'uikit-util';
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
|
-
mixins: [Parallax],
|
|
7
|
+
mixins: [Parallax, Resize, Scroll],
|
|
6
8
|
|
|
7
9
|
props: {
|
|
8
10
|
target: String,
|
|
@@ -8,10 +8,12 @@ export default {
|
|
|
8
8
|
selItem: '!li',
|
|
9
9
|
},
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
item(
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
connected() {
|
|
12
|
+
this.item = query(this.selItem, this.$el);
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
disconnected() {
|
|
16
|
+
this.item = null;
|
|
15
17
|
},
|
|
16
18
|
|
|
17
19
|
events: [
|
|
@@ -45,7 +45,7 @@ export default {
|
|
|
45
45
|
return (
|
|
46
46
|
finite ||
|
|
47
47
|
Math.ceil(getWidth(this.list)) <
|
|
48
|
-
Math.
|
|
48
|
+
Math.trunc(dimensions(this.list).width + getMaxElWidth(this.list) + this.center)
|
|
49
49
|
);
|
|
50
50
|
},
|
|
51
51
|
|
package/src/js/core/core.js
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { css,
|
|
1
|
+
import { css, inBrowser, on, toMs } from 'uikit-util';
|
|
2
2
|
|
|
3
|
-
export default function (
|
|
3
|
+
export default function () {
|
|
4
4
|
if (!inBrowser) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
// throttle 'resize'
|
|
9
|
-
let pendingResize;
|
|
10
|
-
const handleResize = () => {
|
|
11
|
-
if (pendingResize) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
pendingResize = true;
|
|
15
|
-
fastdom.read(() => (pendingResize = false));
|
|
16
|
-
UIkit.update(null, 'resize');
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
on(window, 'load resize', handleResize);
|
|
20
|
-
on(document, 'loadedmetadata load', handleResize, true);
|
|
21
|
-
observeResize(document.documentElement, handleResize);
|
|
22
|
-
|
|
23
8
|
let started = 0;
|
|
24
9
|
on(
|
|
25
10
|
document,
|
package/src/js/core/cover.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Video from './video';
|
|
2
|
-
import { css, Dimensions,
|
|
2
|
+
import { css, Dimensions, parent } from 'uikit-util';
|
|
3
|
+
import Resize from '../mixin/resize';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
|
-
mixins: [Video],
|
|
6
|
+
mixins: [Resize, Video],
|
|
6
7
|
|
|
7
8
|
props: {
|
|
8
9
|
width: Number,
|
|
@@ -13,10 +14,6 @@ export default {
|
|
|
13
14
|
automute: true,
|
|
14
15
|
},
|
|
15
16
|
|
|
16
|
-
connected() {
|
|
17
|
-
this.registerObserver(observeResize(this.$el, () => this.$emit('resize')));
|
|
18
|
-
},
|
|
19
|
-
|
|
20
17
|
update: {
|
|
21
18
|
read() {
|
|
22
19
|
const el = this.$el;
|
package/src/js/core/drop.js
CHANGED
|
@@ -224,9 +224,7 @@ export default {
|
|
|
224
224
|
|
|
225
225
|
this.tracker.init();
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
this.$el,
|
|
229
|
-
'hide',
|
|
227
|
+
for (const handler of [
|
|
230
228
|
on(
|
|
231
229
|
document,
|
|
232
230
|
pointerDown,
|
|
@@ -248,19 +246,16 @@ export default {
|
|
|
248
246
|
true
|
|
249
247
|
)
|
|
250
248
|
),
|
|
251
|
-
{ self: true }
|
|
252
|
-
);
|
|
253
249
|
|
|
254
|
-
once(
|
|
255
|
-
this.$el,
|
|
256
|
-
'hide',
|
|
257
250
|
on(document, 'keydown', (e) => {
|
|
258
251
|
if (e.keyCode === 27) {
|
|
259
252
|
this.hide(false);
|
|
260
253
|
}
|
|
261
254
|
}),
|
|
262
|
-
|
|
263
|
-
)
|
|
255
|
+
on(window, 'resize', () => this.$emit('resize')),
|
|
256
|
+
]) {
|
|
257
|
+
once(this.$el, 'hide', handler, { self: true });
|
|
258
|
+
}
|
|
264
259
|
},
|
|
265
260
|
},
|
|
266
261
|
|
|
@@ -42,13 +42,12 @@ export default {
|
|
|
42
42
|
let option;
|
|
43
43
|
const prop = isInput(target) ? 'value' : 'textContent';
|
|
44
44
|
const prev = target[prop];
|
|
45
|
-
const value =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
: input.value;
|
|
45
|
+
const value = input.files?.[0]
|
|
46
|
+
? input.files[0].name
|
|
47
|
+
: matches(input, 'select') &&
|
|
48
|
+
(option = $$('option', input).filter((el) => el.selected)[0]) // eslint-disable-line prefer-destructuring
|
|
49
|
+
? option.textContent
|
|
50
|
+
: input.value;
|
|
52
51
|
|
|
53
52
|
if (prev !== value) {
|
|
54
53
|
target[prop] = value;
|
package/src/js/core/gif.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { isInView } from 'uikit-util';
|
|
1
|
+
import { isInView, observeIntersection } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
// Deprecated
|
|
4
4
|
export default {
|
|
5
|
+
connected() {
|
|
6
|
+
this.registerObserver(observeIntersection(this.$el, () => this.$emit()));
|
|
7
|
+
},
|
|
8
|
+
|
|
5
9
|
update: {
|
|
6
10
|
read(data) {
|
|
7
11
|
const inview = isInView(this.$el);
|
|
@@ -16,7 +20,5 @@ export default {
|
|
|
16
20
|
write() {
|
|
17
21
|
this.$el.src = '' + this.$el.src; // force self-assign
|
|
18
22
|
},
|
|
19
|
-
|
|
20
|
-
events: ['scroll', 'resize'],
|
|
21
23
|
},
|
|
22
24
|
};
|
package/src/js/core/grid.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Margin from './margin';
|
|
2
2
|
import Class from '../mixin/class';
|
|
3
|
+
import Scroll from '../mixin/scroll';
|
|
3
4
|
import {
|
|
4
5
|
addClass,
|
|
5
6
|
children,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
export default {
|
|
15
16
|
extends: Margin,
|
|
16
17
|
|
|
17
|
-
mixins: [Class],
|
|
18
|
+
mixins: [Class, Scroll],
|
|
18
19
|
|
|
19
20
|
name: 'grid',
|
|
20
21
|
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { getRows } from './margin';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
$$,
|
|
4
|
+
boxModelAdjust,
|
|
5
|
+
css,
|
|
6
|
+
dimensions,
|
|
7
|
+
isVisible,
|
|
8
|
+
observeMutation,
|
|
9
|
+
toFloat,
|
|
10
|
+
} from 'uikit-util';
|
|
3
11
|
|
|
4
12
|
export default {
|
|
5
13
|
args: 'target',
|
|
@@ -19,6 +27,18 @@ export default {
|
|
|
19
27
|
elements({ target }, $el) {
|
|
20
28
|
return $$(target, $el);
|
|
21
29
|
},
|
|
30
|
+
|
|
31
|
+
resizeTargets() {
|
|
32
|
+
this.$el.children;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
connected() {
|
|
37
|
+
this.registerObserver(
|
|
38
|
+
observeMutation(this.$el, () => this.$reset(), {
|
|
39
|
+
childList: true,
|
|
40
|
+
})
|
|
41
|
+
);
|
|
22
42
|
},
|
|
23
43
|
|
|
24
44
|
update: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
+
import Resize from '../mixin/resize';
|
|
2
3
|
import {
|
|
3
4
|
boxModelAdjust,
|
|
4
5
|
css,
|
|
@@ -11,11 +12,10 @@ import {
|
|
|
11
12
|
offset,
|
|
12
13
|
query,
|
|
13
14
|
toFloat,
|
|
14
|
-
trigger,
|
|
15
15
|
} from 'uikit-util';
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
|
-
mixins: [Class],
|
|
18
|
+
mixins: [Class, Resize],
|
|
19
19
|
|
|
20
20
|
props: {
|
|
21
21
|
expand: Boolean,
|
|
@@ -31,6 +31,13 @@ export default {
|
|
|
31
31
|
minHeight: 0,
|
|
32
32
|
},
|
|
33
33
|
|
|
34
|
+
computed: {
|
|
35
|
+
resizeTargets() {
|
|
36
|
+
// check for offsetTop change
|
|
37
|
+
return [this.$el, document.documentElement];
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
34
41
|
update: {
|
|
35
42
|
read({ minHeight: prev }) {
|
|
36
43
|
if (!isVisible(this.$el)) {
|
|
@@ -71,13 +78,9 @@ export default {
|
|
|
71
78
|
return { minHeight, prev };
|
|
72
79
|
},
|
|
73
80
|
|
|
74
|
-
write({ minHeight
|
|
81
|
+
write({ minHeight }) {
|
|
75
82
|
css(this.$el, { minHeight });
|
|
76
83
|
|
|
77
|
-
if (minHeight !== prev) {
|
|
78
|
-
trigger(this.$el, 'resize');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
84
|
if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
|
|
82
85
|
css(this.$el, 'minHeight', this.minHeight);
|
|
83
86
|
}
|
package/src/js/core/img.js
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
escape,
|
|
9
9
|
fragment,
|
|
10
10
|
hasAttr,
|
|
11
|
-
hasIntersectionObserver,
|
|
12
11
|
includes,
|
|
13
12
|
isArray,
|
|
14
13
|
isEmpty,
|
|
@@ -60,7 +59,7 @@ export default {
|
|
|
60
59
|
},
|
|
61
60
|
|
|
62
61
|
connected() {
|
|
63
|
-
if (this.loading !== 'lazy'
|
|
62
|
+
if (this.loading !== 'lazy') {
|
|
64
63
|
this.load();
|
|
65
64
|
return;
|
|
66
65
|
}
|
package/src/js/core/leader.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Media from '../mixin/media';
|
|
3
3
|
import { attr, getCssVar, toggleClass, unwrap, wrapInner } from 'uikit-util';
|
|
4
|
+
import Resize from '../mixin/resize';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
|
-
mixins: [Class, Media],
|
|
7
|
+
mixins: [Class, Media, Resize],
|
|
7
8
|
|
|
8
9
|
props: {
|
|
9
10
|
fill: String,
|
|
@@ -31,26 +32,19 @@ export default {
|
|
|
31
32
|
},
|
|
32
33
|
|
|
33
34
|
update: {
|
|
34
|
-
read(
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
width = Math.floor(this.$el.offsetWidth / 2);
|
|
35
|
+
read() {
|
|
36
|
+
const width = Math.trunc(this.$el.offsetWidth / 2);
|
|
38
37
|
|
|
39
38
|
return {
|
|
40
39
|
width,
|
|
41
40
|
fill: this.fill,
|
|
42
|
-
changed: changed || prev !== width,
|
|
43
41
|
hide: !this.matchMedia,
|
|
44
42
|
};
|
|
45
43
|
},
|
|
46
44
|
|
|
47
|
-
write(
|
|
48
|
-
toggleClass(this.wrapper, this.clsHide,
|
|
49
|
-
|
|
50
|
-
if (data.changed) {
|
|
51
|
-
data.changed = false;
|
|
52
|
-
attr(this.wrapper, this.attrFill, new Array(data.width).join(data.fill));
|
|
53
|
-
}
|
|
45
|
+
write({ width, fill, hide }) {
|
|
46
|
+
toggleClass(this.wrapper, this.clsHide, hide);
|
|
47
|
+
attr(this.wrapper, this.attrFill, new Array(width).join(fill));
|
|
54
48
|
},
|
|
55
49
|
|
|
56
50
|
events: ['resize'],
|
package/src/js/core/margin.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isRtl,
|
|
3
|
+
isVisible,
|
|
4
|
+
observeMutation,
|
|
5
|
+
observeResize,
|
|
6
|
+
offsetPosition,
|
|
7
|
+
toggleClass,
|
|
8
|
+
} from 'uikit-util';
|
|
2
9
|
|
|
3
10
|
export default {
|
|
4
11
|
props: {
|
|
@@ -11,6 +18,16 @@ export default {
|
|
|
11
18
|
firstColumn: 'uk-first-column',
|
|
12
19
|
},
|
|
13
20
|
|
|
21
|
+
connected() {
|
|
22
|
+
this.registerObserver(
|
|
23
|
+
observeMutation(this.$el, () => this.$reset(), {
|
|
24
|
+
childList: true,
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
this.registerObserver(observeResize(this.$el.children, () => this.$emit('resize')));
|
|
29
|
+
},
|
|
30
|
+
|
|
14
31
|
update: {
|
|
15
32
|
read() {
|
|
16
33
|
const rows = getRows(this.$el.children);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import
|
|
2
|
+
import Resize from '../mixin/resize';
|
|
3
|
+
import { closest, css, dimensions, height, isVisible } from 'uikit-util';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
|
-
mixins: [Class],
|
|
6
|
+
mixins: [Class, Resize],
|
|
6
7
|
|
|
7
8
|
props: {
|
|
8
9
|
selContainer: String,
|
|
@@ -24,6 +25,10 @@ export default {
|
|
|
24
25
|
content({ selContent }, $el) {
|
|
25
26
|
return closest($el, selContent);
|
|
26
27
|
},
|
|
28
|
+
|
|
29
|
+
resizeTargets() {
|
|
30
|
+
return [this.container, this.content];
|
|
31
|
+
},
|
|
27
32
|
},
|
|
28
33
|
|
|
29
34
|
connected() {
|
|
@@ -37,7 +42,6 @@ export default {
|
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
return {
|
|
40
|
-
current: toFloat(css(this.$el, 'maxHeight')),
|
|
41
45
|
max: Math.max(
|
|
42
46
|
this.minHeight,
|
|
43
47
|
height(this.container) - (dimensions(this.content).height - height(this.$el))
|
|
@@ -45,11 +49,8 @@ export default {
|
|
|
45
49
|
};
|
|
46
50
|
},
|
|
47
51
|
|
|
48
|
-
write({
|
|
52
|
+
write({ max }) {
|
|
49
53
|
css(this.$el, 'maxHeight', max);
|
|
50
|
-
if (Math.round(current) !== Math.round(max)) {
|
|
51
|
-
trigger(this.$el, 'resize');
|
|
52
|
-
}
|
|
53
54
|
},
|
|
54
55
|
|
|
55
56
|
events: ['resize'],
|
package/src/js/core/scroll.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $,
|
|
1
|
+
import { $, scrollIntoView, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
props: {
|
|
@@ -27,7 +27,11 @@ export default {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
e.preventDefault();
|
|
30
|
-
this.scrollTo(
|
|
30
|
+
this.scrollTo(getTargetElement(this.$el));
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
export function getTargetElement(el) {
|
|
36
|
+
return document.getElementById(decodeURIComponent(el.hash).substring(1));
|
|
37
|
+
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import Scroll from '../mixin/scroll';
|
|
1
2
|
import {
|
|
2
3
|
$$,
|
|
3
|
-
addClass,
|
|
4
4
|
closest,
|
|
5
|
-
escape,
|
|
6
5
|
getViewport,
|
|
7
6
|
getViewportClientHeight,
|
|
8
7
|
hasClass,
|
|
9
8
|
isVisible,
|
|
10
9
|
offset,
|
|
11
|
-
removeClass,
|
|
12
10
|
scrollParents,
|
|
11
|
+
toggleClass,
|
|
13
12
|
trigger,
|
|
14
13
|
} from 'uikit-util';
|
|
14
|
+
import { getTargetElement } from './scroll';
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
+
mixins: [Scroll],
|
|
18
|
+
|
|
17
19
|
props: {
|
|
18
20
|
cls: String,
|
|
19
21
|
closest: String,
|
|
@@ -45,10 +47,6 @@ export default {
|
|
|
45
47
|
immediate: true,
|
|
46
48
|
},
|
|
47
49
|
|
|
48
|
-
targets() {
|
|
49
|
-
return $$(this.links.map((el) => escape(el.hash).substr(1)).join(','));
|
|
50
|
-
},
|
|
51
|
-
|
|
52
50
|
elements({ closest: selector }) {
|
|
53
51
|
return closest(this.links, selector || '*');
|
|
54
52
|
},
|
|
@@ -57,13 +55,15 @@ export default {
|
|
|
57
55
|
update: [
|
|
58
56
|
{
|
|
59
57
|
read() {
|
|
60
|
-
const
|
|
58
|
+
const targets = this.links.map(getTargetElement).filter(Boolean);
|
|
59
|
+
|
|
60
|
+
const { length } = targets;
|
|
61
61
|
|
|
62
62
|
if (!length || !isVisible(this.$el)) {
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const [scrollElement] = scrollParents(
|
|
66
|
+
const [scrollElement] = scrollParents(targets, /auto|scroll/, true);
|
|
67
67
|
const { scrollTop, scrollHeight } = scrollElement;
|
|
68
68
|
const max = scrollHeight - getViewportClientHeight(scrollElement);
|
|
69
69
|
let active = false;
|
|
@@ -71,15 +71,17 @@ export default {
|
|
|
71
71
|
if (scrollTop === max) {
|
|
72
72
|
active = length - 1;
|
|
73
73
|
} else {
|
|
74
|
-
|
|
74
|
+
for (const i in targets) {
|
|
75
75
|
if (
|
|
76
|
-
offset(
|
|
76
|
+
offset(targets[i]).top -
|
|
77
|
+
offset(getViewport(scrollElement)).top -
|
|
78
|
+
this.offset >
|
|
77
79
|
0
|
|
78
80
|
) {
|
|
79
|
-
|
|
80
|
-
return true;
|
|
81
|
+
break;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
active = +i;
|
|
84
|
+
}
|
|
83
85
|
|
|
84
86
|
if (active === false && this.overflow) {
|
|
85
87
|
active = 0;
|
|
@@ -93,8 +95,9 @@ export default {
|
|
|
93
95
|
const changed = active !== false && !hasClass(this.elements[active], this.cls);
|
|
94
96
|
|
|
95
97
|
this.links.forEach((el) => el.blur());
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
for (const i in this.elements) {
|
|
99
|
+
toggleClass(this.elements[i], this.cls, +i === active);
|
|
100
|
+
}
|
|
98
101
|
|
|
99
102
|
if (changed) {
|
|
100
103
|
trigger(this.$el, 'active', [active, this.elements[active]]);
|