uikit 3.11.2-dev.57792c7e7 → 3.11.2-dev.72dbb9a19
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 +21 -0
- 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 -32
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +42 -32
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +42 -32
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +42 -32
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1098 -1316
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1144 -1393
- 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 +297 -352
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +295 -340
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +722 -852
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +295 -340
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +612 -802
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -621
- 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 +5370 -6659
- 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 +7904 -9673
- package/dist/js/uikit.min.js +1 -1
- package/jsconfig.json +1 -1
- package/package.json +64 -60
- package/src/js/api/boot.js +25 -32
- package/src/js/api/component.js +15 -28
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +14 -33
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +79 -100
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +70 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +14 -25
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +46 -64
- package/src/js/components/lightbox-panel.js +107 -105
- package/src/js/components/lightbox.js +17 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +21 -46
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +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 +126 -108
- 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 +9 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +107 -93
- 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 +29 -36
- package/src/js/core/icon.js +38 -50
- package/src/js/core/img.js +59 -58
- package/src/js/core/index.js +39 -39
- package/src/js/core/leader.js +9 -18
- package/src/js/core/margin.js +21 -37
- package/src/js/core/modal.js +49 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +113 -85
- package/src/js/core/offcanvas.js +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 +187 -116
- 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 +58 -41
- package/src/js/mixin/internal/slideshow-animations.js +7 -14
- package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +80 -64
- 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 +48 -55
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +89 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +20 -39
- package/src/js/util/animation.js +77 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +76 -47
- 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 +3 -8
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +81 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +35 -49
- package/src/js/util/player.js +40 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +36 -46
- package/src/js/util/viewport.js +81 -66
- package/src/less/components/base.less +0 -5
- package/src/less/components/flex.less +0 -9
- package/src/less/components/leader.less +0 -1
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/base.scss +0 -5
- 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/leader.scss +0 -1
- 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/js/index.js +114 -85
- package/tests/sticky-parallax.html +44 -41
- package/tests/sticky.html +56 -24
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
package/src/js/util/selector.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {attr} from './attr';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {isDocument, isString, memoize, toNode, toNodes} from './lang';
|
|
1
|
+
import { attr } from './attr';
|
|
2
|
+
import { closest, index, matches, parent } from './filter';
|
|
3
|
+
import { isDocument, isString, memoize, toNode, toNodes } from './lang';
|
|
5
4
|
|
|
6
5
|
export function query(selector, context) {
|
|
7
6
|
return find(selector, getContext(selector, context));
|
|
@@ -11,12 +10,6 @@ export function queryAll(selector, context) {
|
|
|
11
10
|
return findAll(selector, getContext(selector, context));
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function getContext(selector, context = document) {
|
|
15
|
-
return isString(selector) && isContextSelector(selector) || isDocument(context)
|
|
16
|
-
? context
|
|
17
|
-
: context.ownerDocument;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
13
|
export function find(selector, context) {
|
|
21
14
|
return toNode(_query(selector, context, 'querySelector'));
|
|
22
15
|
}
|
|
@@ -25,8 +18,18 @@ export function findAll(selector, context) {
|
|
|
25
18
|
return toNodes(_query(selector, context, 'querySelectorAll'));
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
22
|
+
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
23
|
+
|
|
24
|
+
function getContext(selector, context = document) {
|
|
25
|
+
return (isString(selector) && isContextSelector(selector)) || isDocument(context)
|
|
26
|
+
? context
|
|
27
|
+
: context.ownerDocument;
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
+
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
31
|
+
|
|
32
|
+
function _query(selector, context = document, queryFn) {
|
|
30
33
|
if (!selector || !isString(selector)) {
|
|
31
34
|
return selector;
|
|
32
35
|
}
|
|
@@ -34,63 +37,46 @@ function _query(selector, context = document, queryFn) {
|
|
|
34
37
|
selector = selector.replace(contextSanitizeRe, '$1 *');
|
|
35
38
|
|
|
36
39
|
if (isContextSelector(selector)) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return `${domPath(ctx)} ${selector}`;
|
|
64
|
-
|
|
65
|
-
}).filter(Boolean).join(',');
|
|
40
|
+
selector = splitSelector(selector)
|
|
41
|
+
.map((selector) => {
|
|
42
|
+
let ctx = context;
|
|
43
|
+
|
|
44
|
+
if (selector[0] === '!') {
|
|
45
|
+
const selectors = selector.substr(1).trim().split(' ');
|
|
46
|
+
ctx = closest(parent(context), selectors[0]);
|
|
47
|
+
selector = selectors.slice(1).join(' ').trim();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (selector[0] === '-') {
|
|
51
|
+
const selectors = selector.substr(1).trim().split(' ');
|
|
52
|
+
const prev = (ctx || context).previousElementSibling;
|
|
53
|
+
ctx = matches(prev, selector.substr(1)) ? prev : null;
|
|
54
|
+
selector = selectors.slice(1).join(' ');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!ctx) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return `${domPath(ctx)} ${selector}`;
|
|
62
|
+
})
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.join(',');
|
|
66
65
|
|
|
67
66
|
context = document;
|
|
68
|
-
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
try {
|
|
72
|
-
|
|
73
70
|
return context[queryFn](selector);
|
|
74
|
-
|
|
75
71
|
} catch (e) {
|
|
76
|
-
|
|
77
72
|
return null;
|
|
78
|
-
|
|
79
73
|
}
|
|
80
|
-
|
|
81
74
|
}
|
|
82
75
|
|
|
83
|
-
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
84
|
-
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
85
|
-
|
|
86
|
-
const isContextSelector = memoize(selector => selector.match(contextSelectorRe));
|
|
87
|
-
|
|
88
76
|
const selectorRe = /.*?[^\\](?:,|$)/g;
|
|
89
77
|
|
|
90
|
-
const splitSelector = memoize(selector =>
|
|
91
|
-
selector.match(selectorRe).map(selector =>
|
|
92
|
-
selector.replace(/,$/, '').trim()
|
|
93
|
-
)
|
|
78
|
+
const splitSelector = memoize((selector) =>
|
|
79
|
+
selector.match(selectorRe).map((selector) => selector.replace(/,$/, '').trim())
|
|
94
80
|
);
|
|
95
81
|
|
|
96
82
|
function domPath(element) {
|
|
@@ -101,7 +87,7 @@ function domPath(element) {
|
|
|
101
87
|
names.unshift(`#${escape(id)}`);
|
|
102
88
|
break;
|
|
103
89
|
} else {
|
|
104
|
-
let {tagName} = element;
|
|
90
|
+
let { tagName } = element;
|
|
105
91
|
if (tagName !== 'HTML') {
|
|
106
92
|
tagName += `:nth-child(${index(element) + 1})`;
|
|
107
93
|
}
|
|
@@ -112,7 +98,6 @@ function domPath(element) {
|
|
|
112
98
|
return names.join(' > ');
|
|
113
99
|
}
|
|
114
100
|
|
|
115
|
-
const escapeFn = inBrowser && window.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, match => `\\${match}`); };
|
|
116
101
|
export function escape(css) {
|
|
117
|
-
return isString(css) ?
|
|
102
|
+
return isString(css) ? CSS.escape(css) : '';
|
|
118
103
|
}
|
package/src/js/util/style.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
each,
|
|
3
|
+
hyphenate,
|
|
4
|
+
isArray,
|
|
5
|
+
isNumber,
|
|
6
|
+
isNumeric,
|
|
7
|
+
isObject,
|
|
8
|
+
isString,
|
|
9
|
+
isUndefined,
|
|
10
|
+
memoize,
|
|
11
|
+
toNodes,
|
|
12
|
+
toWindow,
|
|
13
|
+
} from './lang';
|
|
5
14
|
|
|
6
15
|
const cssNumber = {
|
|
7
16
|
'animation-iteration-count': true,
|
|
@@ -11,22 +20,19 @@ const cssNumber = {
|
|
|
11
20
|
'flex-shrink': true,
|
|
12
21
|
'font-weight': true,
|
|
13
22
|
'line-height': true,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
opacity: true,
|
|
24
|
+
order: true,
|
|
25
|
+
orphans: true,
|
|
17
26
|
'stroke-dasharray': true,
|
|
18
27
|
'stroke-dashoffset': true,
|
|
19
|
-
|
|
28
|
+
widows: true,
|
|
20
29
|
'z-index': true,
|
|
21
|
-
|
|
30
|
+
zoom: true,
|
|
22
31
|
};
|
|
23
32
|
|
|
24
33
|
export function css(element, property, value, priority = '') {
|
|
25
|
-
|
|
26
|
-
return toNodes(element).map(element => {
|
|
27
|
-
|
|
34
|
+
return toNodes(element).map((element) => {
|
|
28
35
|
if (isString(property)) {
|
|
29
|
-
|
|
30
36
|
property = propName(property);
|
|
31
37
|
|
|
32
38
|
if (isUndefined(value)) {
|
|
@@ -34,27 +40,26 @@ export function css(element, property, value, priority = '') {
|
|
|
34
40
|
} else if (!value && !isNumber(value)) {
|
|
35
41
|
element.style.removeProperty(property);
|
|
36
42
|
} else {
|
|
37
|
-
element.style.setProperty(
|
|
43
|
+
element.style.setProperty(
|
|
44
|
+
property,
|
|
45
|
+
isNumeric(value) && !cssNumber[property] ? `${value}px` : value,
|
|
46
|
+
priority
|
|
47
|
+
);
|
|
38
48
|
}
|
|
39
|
-
|
|
40
49
|
} else if (isArray(property)) {
|
|
41
|
-
|
|
42
50
|
const styles = getStyles(element);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
props[
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
const props = {};
|
|
52
|
+
for (const prop of property) {
|
|
53
|
+
props[prop] = styles[propName(prop)];
|
|
54
|
+
}
|
|
55
|
+
return props;
|
|
49
56
|
} else if (isObject(property)) {
|
|
50
57
|
priority = value;
|
|
51
58
|
each(property, (value, property) => css(element, property, value, priority));
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
return element;
|
|
55
|
-
|
|
56
62
|
})[0];
|
|
57
|
-
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
function getStyles(element, pseudoElt) {
|
|
@@ -65,44 +70,29 @@ function getStyle(element, property, pseudoElt) {
|
|
|
65
70
|
return getStyles(element, pseudoElt)[property];
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
const parseCssVar = memoize(name => {
|
|
69
|
-
/* usage in css: .uk-name:before { content:"xyz" } */
|
|
70
|
-
|
|
71
|
-
const element = append(document.documentElement, fragment('<div>'));
|
|
72
|
-
|
|
73
|
-
addClass(element, `uk-${name}`);
|
|
74
|
-
|
|
75
|
-
const value = getStyle(element, 'content', ':before');
|
|
76
|
-
|
|
77
|
-
remove(element);
|
|
78
|
-
|
|
79
|
-
return value;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
73
|
const propertyRe = /^\s*(["'])?(.*?)\1\s*$/;
|
|
83
74
|
export function getCssVar(name) {
|
|
84
|
-
return (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
).replace(propertyRe, '$2');
|
|
75
|
+
return getStyles(document.documentElement)
|
|
76
|
+
.getPropertyValue(`--uk-${name}`)
|
|
77
|
+
.replace(propertyRe, '$2');
|
|
88
78
|
}
|
|
89
79
|
|
|
90
80
|
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty
|
|
91
|
-
export const propName = memoize(name => vendorPropName(name));
|
|
81
|
+
export const propName = memoize((name) => vendorPropName(name));
|
|
92
82
|
|
|
93
83
|
const cssPrefixes = ['webkit', 'moz', 'ms'];
|
|
94
84
|
|
|
95
85
|
function vendorPropName(name) {
|
|
96
|
-
|
|
97
86
|
name = hyphenate(name);
|
|
98
87
|
|
|
99
|
-
const {style} = document.documentElement;
|
|
88
|
+
const { style } = document.documentElement;
|
|
100
89
|
|
|
101
90
|
if (name in style) {
|
|
102
91
|
return name;
|
|
103
92
|
}
|
|
104
93
|
|
|
105
|
-
let i = cssPrefixes.length,
|
|
94
|
+
let i = cssPrefixes.length,
|
|
95
|
+
prefixedName;
|
|
106
96
|
|
|
107
97
|
while (i--) {
|
|
108
98
|
prefixedName = `-${cssPrefixes[i]}-${name}`;
|
package/src/js/util/viewport.js
CHANGED
|
@@ -1,82 +1,90 @@
|
|
|
1
|
-
import {css} from './style';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { css } from './style';
|
|
2
|
+
import { isVisible, parents } from './filter';
|
|
3
|
+
import { offset, offsetPosition } from './dimensions';
|
|
4
|
+
import {
|
|
5
|
+
clamp,
|
|
6
|
+
findIndex,
|
|
7
|
+
intersectRect,
|
|
8
|
+
isDocument,
|
|
9
|
+
isUndefined,
|
|
10
|
+
isWindow,
|
|
11
|
+
toNode,
|
|
12
|
+
toWindow,
|
|
13
|
+
} from './lang';
|
|
6
14
|
|
|
7
15
|
export function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
8
|
-
|
|
9
16
|
if (!isVisible(element)) {
|
|
10
17
|
return false;
|
|
11
18
|
}
|
|
12
19
|
|
|
13
|
-
return intersectRect(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
return intersectRect(
|
|
21
|
+
...scrollParents(element)
|
|
22
|
+
.map((parent) => {
|
|
23
|
+
const { top, left, bottom, right } = offset(getViewport(parent));
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
top: top - offsetTop,
|
|
27
|
+
left: left - offsetLeft,
|
|
28
|
+
bottom: bottom + offsetTop,
|
|
29
|
+
right: right + offsetLeft,
|
|
30
|
+
};
|
|
31
|
+
})
|
|
32
|
+
.concat(offset(element))
|
|
33
|
+
);
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
export function scrollTop(element, top) {
|
|
27
|
-
|
|
28
37
|
if (isWindow(element) || isDocument(element)) {
|
|
29
38
|
element = getScrollingElement(element);
|
|
30
39
|
} else {
|
|
31
40
|
element = toNode(element);
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
if (isUndefined(top)) {
|
|
44
|
+
return element.scrollTop;
|
|
45
|
+
} else {
|
|
46
|
+
element.scrollTop = top;
|
|
47
|
+
}
|
|
35
48
|
}
|
|
36
49
|
|
|
37
|
-
export function scrollIntoView(element, {offset: offsetBy = 0} = {}) {
|
|
38
|
-
|
|
50
|
+
export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
39
51
|
const parents = isVisible(element) ? scrollParents(element) : [];
|
|
40
|
-
return parents.reduce(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
+
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
top
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, () => Promise.resolve())();
|
|
52
|
+
return parents.reduce(
|
|
53
|
+
(fn, scrollElement, i) => {
|
|
54
|
+
const { scrollTop, scrollHeight, offsetHeight } = scrollElement;
|
|
55
|
+
const maxScroll = scrollHeight - getViewportClientHeight(scrollElement);
|
|
56
|
+
const { height: elHeight, top: elTop } = offset(parents[i - 1] || element);
|
|
57
|
+
|
|
58
|
+
let top = Math.ceil(
|
|
59
|
+
elTop - offset(getViewport(scrollElement)).top - offsetBy + scrollTop
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (offsetBy > 0 && offsetHeight < elHeight + offsetBy) {
|
|
63
|
+
top += offsetBy;
|
|
64
|
+
} else {
|
|
65
|
+
offsetBy = 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (top > maxScroll) {
|
|
69
|
+
offsetBy -= top - maxScroll;
|
|
70
|
+
top = maxScroll;
|
|
71
|
+
} else if (top < 0) {
|
|
72
|
+
offsetBy -= top;
|
|
73
|
+
top = 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return () => scrollTo(scrollElement, top - scrollTop).then(fn);
|
|
77
|
+
},
|
|
78
|
+
() => Promise.resolve()
|
|
79
|
+
)();
|
|
70
80
|
|
|
71
81
|
function scrollTo(element, top) {
|
|
72
|
-
return new Promise(resolve => {
|
|
73
|
-
|
|
82
|
+
return new Promise((resolve) => {
|
|
74
83
|
const scroll = element.scrollTop;
|
|
75
84
|
const duration = getDuration(Math.abs(top));
|
|
76
85
|
const start = Date.now();
|
|
77
86
|
|
|
78
87
|
(function step() {
|
|
79
|
-
|
|
80
88
|
const percent = ease(clamp((Date.now() - start) / duration));
|
|
81
89
|
|
|
82
90
|
scrollTop(element, scroll + top * percent);
|
|
@@ -87,29 +95,26 @@ export function scrollIntoView(element, {offset: offsetBy = 0} = {}) {
|
|
|
87
95
|
} else {
|
|
88
96
|
requestAnimationFrame(step);
|
|
89
97
|
}
|
|
90
|
-
|
|
91
98
|
})();
|
|
92
99
|
});
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
function getDuration(dist) {
|
|
96
|
-
return 40 * Math.pow(dist, .375);
|
|
103
|
+
return 40 * Math.pow(dist, 0.375);
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
function ease(k) {
|
|
100
107
|
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
101
108
|
}
|
|
102
|
-
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
export function scrolledOver(element, startOffset = 0, endOffset = 0) {
|
|
106
|
-
|
|
107
112
|
if (!isVisible(element)) {
|
|
108
113
|
return 0;
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
const [scrollElement] = scrollParents(element, /auto|scroll/, true);
|
|
112
|
-
const {scrollHeight, scrollTop} = scrollElement;
|
|
117
|
+
const { scrollHeight, scrollTop } = scrollElement;
|
|
113
118
|
const viewportHeight = getViewportClientHeight(scrollElement);
|
|
114
119
|
const maxScroll = scrollHeight - viewportHeight;
|
|
115
120
|
const elementOffsetTop = offsetPosition(element)[0] - offsetPosition(scrollElement)[0];
|
|
@@ -126,14 +131,20 @@ export function scrollParents(element, overflowRe = /auto|scroll|hidden/, scroll
|
|
|
126
131
|
let ancestors = parents(element).reverse();
|
|
127
132
|
ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
|
|
128
133
|
|
|
129
|
-
const fixedIndex = findIndex(ancestors, el => css(el, 'position') === 'fixed');
|
|
134
|
+
const fixedIndex = findIndex(ancestors, (el) => css(el, 'position') === 'fixed');
|
|
130
135
|
if (~fixedIndex) {
|
|
131
136
|
ancestors = ancestors.slice(fixedIndex);
|
|
132
137
|
}
|
|
133
138
|
|
|
134
|
-
return [scrollEl]
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
return [scrollEl]
|
|
140
|
+
.concat(
|
|
141
|
+
ancestors.filter(
|
|
142
|
+
(parent) =>
|
|
143
|
+
overflowRe.test(css(parent, 'overflow')) &&
|
|
144
|
+
(!scrollable || parent.scrollHeight > getViewportClientHeight(parent))
|
|
145
|
+
)
|
|
146
|
+
)
|
|
147
|
+
.reverse();
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
export function getViewport(scrollElement) {
|
|
@@ -142,10 +153,14 @@ export function getViewport(scrollElement) {
|
|
|
142
153
|
|
|
143
154
|
// iOS 12 returns <body> as scrollingElement
|
|
144
155
|
export function getViewportClientHeight(scrollElement) {
|
|
145
|
-
return (
|
|
156
|
+
return (
|
|
157
|
+
scrollElement === getScrollingElement(scrollElement)
|
|
158
|
+
? document.documentElement
|
|
159
|
+
: scrollElement
|
|
160
|
+
).clientHeight;
|
|
146
161
|
}
|
|
147
162
|
|
|
148
|
-
function getScrollingElement(element) {
|
|
149
|
-
const {document} = toWindow(element);
|
|
163
|
+
export function getScrollingElement(element) {
|
|
164
|
+
const { document } = toWindow(element);
|
|
150
165
|
return document.scrollingElement || document.documentElement;
|
|
151
166
|
}
|
|
@@ -589,11 +589,6 @@ template { display: none; }
|
|
|
589
589
|
* Breakpoints
|
|
590
590
|
*/
|
|
591
591
|
|
|
592
|
-
.uk-breakpoint-s::before { content: '@{breakpoint-small}'; }
|
|
593
|
-
.uk-breakpoint-m::before { content: '@{breakpoint-medium}'; }
|
|
594
|
-
.uk-breakpoint-l::before { content: '@{breakpoint-large}'; }
|
|
595
|
-
.uk-breakpoint-xl::before { content: '@{breakpoint-xlarge}'; }
|
|
596
|
-
|
|
597
592
|
:root {
|
|
598
593
|
--uk-breakpoint-s: @breakpoint-small;
|
|
599
594
|
--uk-breakpoint-m: @breakpoint-medium;
|
|
@@ -13,15 +13,6 @@
|
|
|
13
13
|
.uk-flex { display: flex; }
|
|
14
14
|
.uk-flex-inline { display: inline-flex; }
|
|
15
15
|
|
|
16
|
-
/*
|
|
17
|
-
* Remove pseudo elements created by micro clearfix as precaution
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
.uk-flex::before,
|
|
21
|
-
.uk-flex::after,
|
|
22
|
-
.uk-flex-inline::before,
|
|
23
|
-
.uk-flex-inline::after { display: none; }
|
|
24
|
-
|
|
25
16
|
|
|
26
17
|
/* Alignment
|
|
27
18
|
========================================================================== */
|
|
@@ -109,13 +109,6 @@
|
|
|
109
109
|
.uk-navbar-container:not(.uk-navbar-transparent):extend(.uk-light all) when (@navbar-color-mode = light) {}
|
|
110
110
|
.uk-navbar-container:not(.uk-navbar-transparent):extend(.uk-dark all) when (@navbar-color-mode = dark) {}
|
|
111
111
|
|
|
112
|
-
/*
|
|
113
|
-
* Remove pseudo elements created by micro clearfix as precaution (if Container component is used)
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
.uk-navbar-container > ::before,
|
|
117
|
-
.uk-navbar-container > ::after { display: none !important; }
|
|
118
|
-
|
|
119
112
|
|
|
120
113
|
/* Groups
|
|
121
114
|
========================================================================== */
|
|
@@ -251,6 +251,28 @@
|
|
|
251
251
|
[data-uk-responsive] { max-width: 100%; }
|
|
252
252
|
|
|
253
253
|
|
|
254
|
+
/* Object
|
|
255
|
+
========================================================================== */
|
|
256
|
+
|
|
257
|
+
.uk-object-fit-none { object-fit: none; }
|
|
258
|
+
.uk-object-fit-cover { object-fit: cover; }
|
|
259
|
+
.uk-object-fit-contain { object-fit: contain; }
|
|
260
|
+
|
|
261
|
+
/*
|
|
262
|
+
* Position
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
.uk-object-top-left { object-position: 0 0; }
|
|
266
|
+
.uk-object-top-center { object-position: 50% 0; }
|
|
267
|
+
.uk-object-top-right { object-position: 100% 0; }
|
|
268
|
+
.uk-object-center-left { object-position: 0 50%; }
|
|
269
|
+
.uk-object-center-center { object-position: 50% 50%; }
|
|
270
|
+
.uk-object-center-right { object-position: 100% 50%; }
|
|
271
|
+
.uk-object-bottom-left { object-position: 0 100%; }
|
|
272
|
+
.uk-object-bottom-center { object-position: 50% 100%; }
|
|
273
|
+
.uk-object-bottom-right { object-position: 100% 100%; }
|
|
274
|
+
|
|
275
|
+
|
|
254
276
|
/* Border
|
|
255
277
|
========================================================================== */
|
|
256
278
|
|
|
@@ -589,11 +589,6 @@ template { display: none; }
|
|
|
589
589
|
* Breakpoints
|
|
590
590
|
*/
|
|
591
591
|
|
|
592
|
-
.uk-breakpoint-s::before { content: '#{$breakpoint-small}'; }
|
|
593
|
-
.uk-breakpoint-m::before { content: '#{$breakpoint-medium}'; }
|
|
594
|
-
.uk-breakpoint-l::before { content: '#{$breakpoint-large}'; }
|
|
595
|
-
.uk-breakpoint-xl::before { content: '#{$breakpoint-xlarge}'; }
|
|
596
|
-
|
|
597
592
|
:root {
|
|
598
593
|
--uk-breakpoint-s: #{$breakpoint-small};
|
|
599
594
|
--uk-breakpoint-m: #{$breakpoint-medium};
|
|
@@ -13,15 +13,6 @@
|
|
|
13
13
|
.uk-flex { display: flex; }
|
|
14
14
|
.uk-flex-inline { display: inline-flex; }
|
|
15
15
|
|
|
16
|
-
/*
|
|
17
|
-
* Remove pseudo elements created by micro clearfix as precaution
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
.uk-flex::before,
|
|
21
|
-
.uk-flex::after,
|
|
22
|
-
.uk-flex-inline::before,
|
|
23
|
-
.uk-flex-inline::after { display: none; }
|
|
24
|
-
|
|
25
16
|
|
|
26
17
|
/* Alignment
|
|
27
18
|
========================================================================== */
|
|
@@ -780,7 +780,7 @@ select.uk-form-width-xsmall { width: ($form-width-xsmall + 25px); }
|
|
|
780
780
|
|
|
781
781
|
$inverse-form-background: $inverse-global-muted-background !default;
|
|
782
782
|
$inverse-form-color: $inverse-global-color !default;
|
|
783
|
-
$inverse-form-focus-background:
|
|
783
|
+
$inverse-form-focus-background: fade-in($inverse-form-background, 0.05) !default;
|
|
784
784
|
$inverse-form-focus-color: $inverse-global-color !default;
|
|
785
785
|
$inverse-form-placeholder-color: $inverse-global-muted-color !default;
|
|
786
786
|
|
|
@@ -790,12 +790,12 @@ $inverse-form-datalist-icon-color: $inverse-global-color !default;
|
|
|
790
790
|
|
|
791
791
|
$inverse-form-radio-background: $inverse-global-muted-background !default;
|
|
792
792
|
|
|
793
|
-
$inverse-form-radio-focus-background:
|
|
793
|
+
$inverse-form-radio-focus-background: fade-in($inverse-form-radio-background, 0.05) !default;
|
|
794
794
|
|
|
795
795
|
$inverse-form-radio-checked-background: $inverse-global-primary-background !default;
|
|
796
796
|
$inverse-form-radio-checked-icon-color: $inverse-global-inverse-color !default;
|
|
797
797
|
|
|
798
|
-
$inverse-form-radio-checked-focus-background:
|
|
798
|
+
$inverse-form-radio-checked-focus-background: fade-in($inverse-global-primary-background, 0.1) !default;
|
|
799
799
|
|
|
800
800
|
$inverse-form-icon-color: $inverse-global-muted-color !default;
|
|
801
801
|
$inverse-form-icon-hover-color: $inverse-global-color !default;
|
|
@@ -201,9 +201,9 @@ $inverse-icon-link-hover-color: $inverse-global-color !default;
|
|
|
201
201
|
$inverse-icon-link-active-color: $inverse-global-color !default;
|
|
202
202
|
$inverse-icon-button-background: $inverse-global-muted-background !default;
|
|
203
203
|
$inverse-icon-button-color: $inverse-global-muted-color !default;
|
|
204
|
-
$inverse-icon-button-hover-background:
|
|
204
|
+
$inverse-icon-button-hover-background: fade-in($inverse-icon-button-background, 0.05) !default;
|
|
205
205
|
$inverse-icon-button-hover-color: $inverse-global-color !default;
|
|
206
|
-
$inverse-icon-button-active-background:
|
|
206
|
+
$inverse-icon-button-active-background: fade-in($inverse-icon-button-background, 0.1) !default;
|
|
207
207
|
$inverse-icon-button-active-color: $inverse-global-color !default;
|
|
208
208
|
|
|
209
209
|
|