uikit 3.11.2-dev.44c622843 → 3.11.2-dev.536e1a374
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 +40 -19
- package/dist/css/uikit-core-rtl.css +97 -190
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +97 -190
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +99 -196
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +99 -196
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +24 -51
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +6 -8
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +30 -69
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +31 -71
- 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 +117 -80
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +117 -80
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +87 -58
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +117 -80
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +43 -29
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +5 -7
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +3 -3
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +2 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +600 -508
- 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 +857 -764
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/component.js +2 -11
- package/src/js/api/hooks.js +3 -3
- package/src/js/api/state.js +173 -140
- package/src/js/components/countdown.js +24 -51
- package/src/js/components/filter.js +2 -3
- package/src/js/components/internal/lightbox-animations.js +4 -3
- package/src/js/components/internal/slider-preload.js +9 -0
- package/src/js/components/internal/slideshow-animations.js +4 -3
- package/src/js/components/lightbox-panel.js +34 -58
- package/src/js/components/lightbox.js +1 -2
- package/src/js/components/slider.js +60 -43
- package/src/js/components/slideshow.js +8 -1
- package/src/js/components/sortable.js +1 -1
- package/src/js/components/upload.js +2 -1
- package/src/js/core/accordion.js +6 -1
- package/src/js/core/alert.js +1 -2
- package/src/js/core/core.js +2 -75
- package/src/js/core/cover.js +5 -1
- package/src/js/core/drop.js +3 -1
- package/src/js/core/form-custom.js +2 -2
- package/src/js/core/height-viewport.js +3 -0
- package/src/js/core/icon.js +13 -6
- package/src/js/core/img.js +131 -122
- package/src/js/core/modal.js +1 -2
- package/src/js/core/navbar.js +3 -3
- package/src/js/core/offcanvas.js +2 -1
- package/src/js/core/sticky.js +51 -57
- package/src/js/core/svg.js +10 -6
- package/src/js/core/switcher.js +11 -3
- package/src/js/core/toggle.js +5 -2
- package/src/js/core/video.js +13 -1
- package/src/js/mixin/internal/animate-slide.js +9 -12
- package/src/js/mixin/lazyload.js +20 -0
- package/src/js/mixin/parallax.js +118 -81
- package/src/js/mixin/slider.js +8 -22
- package/src/js/mixin/slideshow.js +2 -6
- package/src/js/mixin/swipe.js +72 -0
- package/src/js/mixin/togglable.js +2 -3
- package/src/js/util/ajax.js +15 -14
- package/src/js/util/animation.js +7 -12
- package/src/js/util/dimensions.js +4 -4
- package/src/js/util/dom.js +22 -33
- package/src/js/util/filter.js +1 -2
- package/src/js/util/index.js +1 -0
- package/src/js/util/lang.js +7 -6
- package/src/js/util/observer.js +36 -0
- package/src/js/util/options.js +2 -11
- package/src/js/util/player.js +5 -4
- package/src/js/util/selector.js +12 -18
- package/src/js/util/style.js +4 -4
- package/src/less/components/base.less +10 -33
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/height.less +3 -0
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +0 -3
- package/src/less/components/slideshow.less +0 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +6 -3
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +0 -1
- package/src/scss/components/height.scss +3 -0
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/slider.scss +0 -3
- package/src/scss/components/slideshow.scss +0 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +6 -3
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +3 -3
- package/src/scss/variables.scss +3 -3
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/countdown.html +10 -8
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -64
- package/tests/images/image-type.avif +0 -0
- package/tests/images/image-type.jpeg +0 -0
- package/tests/images/image-type.webp +0 -0
- package/tests/index.html +8 -8
- package/tests/lightbox.html +10 -10
- package/tests/marker.html +2 -2
- package/tests/modal.html +8 -9
- package/tests/navbar.html +2 -2
- package/tests/overlay.html +7 -7
- package/tests/parallax.html +16 -7
- package/tests/position.html +12 -12
- package/tests/slidenav.html +12 -12
- package/tests/slider.html +20 -20
- package/tests/sortable.html +1 -1
- package/tests/sticky-parallax.html +56 -71
- package/tests/svg.html +6 -6
- package/tests/table.html +11 -11
- package/tests/thumbnav.html +12 -12
- package/tests/transition.html +30 -30
- package/tests/utility.html +50 -33
- package/tests/video.html +1 -1
- package/tests/width.html +1 -1
- package/src/js/util/promise.js +0 -0
- package/tests/images/animated.gif +0 -0
package/src/js/util/ajax.js
CHANGED
|
@@ -2,18 +2,15 @@ import { on } from './event';
|
|
|
2
2
|
import { assign, noop } from './lang';
|
|
3
3
|
|
|
4
4
|
export function ajax(url, options) {
|
|
5
|
-
const env =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
options
|
|
15
|
-
);
|
|
16
|
-
|
|
5
|
+
const env = {
|
|
6
|
+
data: null,
|
|
7
|
+
method: 'GET',
|
|
8
|
+
headers: {},
|
|
9
|
+
xhr: new XMLHttpRequest(),
|
|
10
|
+
beforeSend: noop,
|
|
11
|
+
responseType: '',
|
|
12
|
+
...options,
|
|
13
|
+
};
|
|
17
14
|
return Promise.resolve()
|
|
18
15
|
.then(() => env.beforeSend(env))
|
|
19
16
|
.then(() => send(url, env));
|
|
@@ -63,8 +60,12 @@ export function getImage(src, srcset, sizes) {
|
|
|
63
60
|
return new Promise((resolve, reject) => {
|
|
64
61
|
const img = new Image();
|
|
65
62
|
|
|
66
|
-
img.onerror = (e) =>
|
|
67
|
-
|
|
63
|
+
img.onerror = (e) => {
|
|
64
|
+
reject(e);
|
|
65
|
+
};
|
|
66
|
+
img.onload = () => {
|
|
67
|
+
resolve(img);
|
|
68
|
+
};
|
|
68
69
|
|
|
69
70
|
sizes && (img.sizes = sizes);
|
|
70
71
|
srcset && (img.srcset = srcset);
|
package/src/js/util/animation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { attr } from './attr';
|
|
2
2
|
import { once, trigger } from './event';
|
|
3
3
|
import { css, propName } from './style';
|
|
4
|
-
import {
|
|
4
|
+
import { startsWith, toNodes } from './lang';
|
|
5
5
|
import { addClass, hasClass, removeClass, removeClasses } from './class';
|
|
6
6
|
|
|
7
7
|
export function transition(element, props, duration = 400, timing = 'linear') {
|
|
@@ -35,17 +35,12 @@ export function transition(element, props, duration = 400, timing = 'linear') {
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
addClass(element, 'uk-transition');
|
|
38
|
-
css(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
transitionTimingFunction: timing,
|
|
45
|
-
},
|
|
46
|
-
props
|
|
47
|
-
)
|
|
48
|
-
);
|
|
38
|
+
css(element, {
|
|
39
|
+
transitionProperty: Object.keys(props).map(propName).join(','),
|
|
40
|
+
transitionDuration: `${duration}ms`,
|
|
41
|
+
transitionTimingFunction: timing,
|
|
42
|
+
...props,
|
|
43
|
+
});
|
|
49
44
|
})
|
|
50
45
|
)
|
|
51
46
|
);
|
|
@@ -37,8 +37,8 @@ export function offset(element, coordinates) {
|
|
|
37
37
|
const currentOffset = dimensions(element);
|
|
38
38
|
|
|
39
39
|
if (element) {
|
|
40
|
-
const {
|
|
41
|
-
const offsetBy = { height:
|
|
40
|
+
const { scrollY, scrollX } = toWindow(element);
|
|
41
|
+
const offsetBy = { height: scrollY, width: scrollX };
|
|
42
42
|
|
|
43
43
|
for (const dir in dirs) {
|
|
44
44
|
for (const i in dirs[dir]) {
|
|
@@ -104,8 +104,8 @@ export function offsetPosition(element) {
|
|
|
104
104
|
|
|
105
105
|
if (css(element, 'position') === 'fixed') {
|
|
106
106
|
const win = toWindow(element);
|
|
107
|
-
offset[0] += win.
|
|
108
|
-
offset[1] += win.
|
|
107
|
+
offset[0] += win.scrollY;
|
|
108
|
+
offset[1] += win.scrollX;
|
|
109
109
|
return offset;
|
|
110
110
|
}
|
|
111
111
|
} while ((element = element.offsetParent));
|
package/src/js/util/dom.js
CHANGED
|
@@ -12,6 +12,10 @@ export function ready(fn) {
|
|
|
12
12
|
once(document, 'DOMContentLoaded', fn);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export function isTag(element, tagName) {
|
|
16
|
+
return element?.tagName?.toLowerCase() === tagName.toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
export function empty(element) {
|
|
16
20
|
return replaceChildren(element, '');
|
|
17
21
|
}
|
|
@@ -20,34 +24,18 @@ export function html(parent, html) {
|
|
|
20
24
|
return isUndefined(html) ? $(parent).innerHTML : replaceChildren(parent, html);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export function prepend(parent, element) {
|
|
30
|
-
const nodes = $$(element);
|
|
31
|
-
$(parent).prepend(...nodes);
|
|
32
|
-
return nodes;
|
|
33
|
-
}
|
|
27
|
+
export const replaceChildren = applyFn('replaceChildren');
|
|
28
|
+
export const prepend = applyFn('prepend');
|
|
29
|
+
export const append = applyFn('append');
|
|
30
|
+
export const before = applyFn('before');
|
|
31
|
+
export const after = applyFn('after');
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export function before(ref, element) {
|
|
42
|
-
const nodes = $$(element);
|
|
43
|
-
$(ref).before(...nodes);
|
|
44
|
-
return nodes;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function after(ref, element) {
|
|
48
|
-
const nodes = $$(element);
|
|
49
|
-
$(ref).after(...nodes);
|
|
50
|
-
return nodes;
|
|
33
|
+
function applyFn(fn) {
|
|
34
|
+
return function (ref, element) {
|
|
35
|
+
const nodes = toNodes(isString(element) ? fragment(element) : element);
|
|
36
|
+
$(ref)?.[fn](...nodes);
|
|
37
|
+
return unwrapSingle(nodes);
|
|
38
|
+
};
|
|
51
39
|
}
|
|
52
40
|
|
|
53
41
|
export function remove(element) {
|
|
@@ -69,7 +57,7 @@ export function wrapAll(element, structure) {
|
|
|
69
57
|
export function wrapInner(element, structure) {
|
|
70
58
|
return toNodes(
|
|
71
59
|
toNodes(element).map((element) =>
|
|
72
|
-
element.hasChildNodes
|
|
60
|
+
element.hasChildNodes()
|
|
73
61
|
? wrapAll(toNodes(element.childNodes), structure)
|
|
74
62
|
: append(element, structure)
|
|
75
63
|
)
|
|
@@ -80,10 +68,7 @@ export function unwrap(element) {
|
|
|
80
68
|
toNodes(element)
|
|
81
69
|
.map(parent)
|
|
82
70
|
.filter((value, index, self) => self.indexOf(value) === index)
|
|
83
|
-
.forEach((parent) =>
|
|
84
|
-
before(parent, parent.childNodes);
|
|
85
|
-
remove(parent);
|
|
86
|
-
});
|
|
71
|
+
.forEach((parent) => parent.replaceWith(...parent.childNodes));
|
|
87
72
|
}
|
|
88
73
|
|
|
89
74
|
const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
|
|
@@ -102,7 +87,11 @@ export function fragment(html) {
|
|
|
102
87
|
container.textContent = html;
|
|
103
88
|
}
|
|
104
89
|
|
|
105
|
-
return
|
|
90
|
+
return unwrapSingle(container.childNodes);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function unwrapSingle(nodes) {
|
|
94
|
+
return nodes.length > 1 ? nodes : nodes[0];
|
|
106
95
|
}
|
|
107
96
|
|
|
108
97
|
export function apply(node, fn) {
|
package/src/js/util/filter.js
CHANGED
|
@@ -39,8 +39,7 @@ export function isFocusable(element) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export function parent(element) {
|
|
42
|
-
|
|
43
|
-
return element && isElement(element.parentNode) && element.parentNode;
|
|
42
|
+
return toNode(element)?.parentElement;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
export function filter(element, selector) {
|
package/src/js/util/index.js
CHANGED
package/src/js/util/lang.js
CHANGED
|
@@ -21,19 +21,19 @@ function toUpper(_, c) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function startsWith(str, search) {
|
|
24
|
-
return str
|
|
24
|
+
return str?.startsWith?.(search);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function endsWith(str, search) {
|
|
28
|
-
return str
|
|
28
|
+
return str?.endsWith?.(search);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function includes(obj, search) {
|
|
32
|
-
return obj
|
|
32
|
+
return obj?.includes?.(search);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function findIndex(array, predicate) {
|
|
36
|
-
return array
|
|
36
|
+
return array?.findIndex?.(predicate);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const { isArray, from: toArray } = Array;
|
|
@@ -128,8 +128,9 @@ export function toWindow(element) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
element = toNode(element);
|
|
131
|
+
const document = isDocument(element) ? element : element?.ownerDocument;
|
|
131
132
|
|
|
132
|
-
return
|
|
133
|
+
return document?.defaultView || window;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
export function toMs(time) {
|
|
@@ -216,7 +217,7 @@ export const Dimensions = {
|
|
|
216
217
|
},
|
|
217
218
|
|
|
218
219
|
contain(dimensions, maxDimensions) {
|
|
219
|
-
dimensions =
|
|
220
|
+
dimensions = { ...dimensions };
|
|
220
221
|
|
|
221
222
|
each(
|
|
222
223
|
dimensions,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { toNodes } from './lang';
|
|
2
|
+
|
|
3
|
+
// Old chromium based browsers (UC Browser) did not implement `isIntersecting`
|
|
4
|
+
export const hasIntersectionObserver =
|
|
5
|
+
window.IntersectionObserver && 'isIntersecting' in IntersectionObserverEntry.prototype;
|
|
6
|
+
export function observeIntersection(targets, cb, options, intersecting = true) {
|
|
7
|
+
if (!hasIntersectionObserver) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const observer = new IntersectionObserver((entries, observer) => {
|
|
12
|
+
if (!intersecting || entries.some((entry) => entry.isIntersecting)) {
|
|
13
|
+
cb(entries, observer);
|
|
14
|
+
}
|
|
15
|
+
}, options);
|
|
16
|
+
for (const el of toNodes(targets)) {
|
|
17
|
+
observer.observe(el);
|
|
18
|
+
}
|
|
19
|
+
return observer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const hasResizeObserver = window.ResizeObserver;
|
|
23
|
+
export function observeResize(targets, cb, options = { box: 'border-box' }) {
|
|
24
|
+
if (!hasResizeObserver) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const observer = new ResizeObserver((entries, observer) => {
|
|
29
|
+
cb(entries, observer);
|
|
30
|
+
});
|
|
31
|
+
for (const el of toNodes(targets)) {
|
|
32
|
+
observer.observe(el, options);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return observer;
|
|
36
|
+
}
|
package/src/js/util/options.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assign,
|
|
3
|
-
hasOwn,
|
|
4
|
-
includes,
|
|
5
|
-
isArray,
|
|
6
|
-
isFunction,
|
|
7
|
-
isUndefined,
|
|
8
|
-
sortBy,
|
|
9
|
-
startsWith,
|
|
10
|
-
} from './lang';
|
|
1
|
+
import { hasOwn, includes, isArray, isFunction, isUndefined, sortBy, startsWith } from './lang';
|
|
11
2
|
|
|
12
3
|
const strats = {};
|
|
13
4
|
|
|
@@ -48,7 +39,7 @@ strats.props = function (parentVal, childVal) {
|
|
|
48
39
|
|
|
49
40
|
// extend strategy
|
|
50
41
|
strats.computed = strats.methods = function (parentVal, childVal) {
|
|
51
|
-
return childVal ? (parentVal ?
|
|
42
|
+
return childVal ? (parentVal ? { ...parentVal, ...childVal } : childVal) : parentVal;
|
|
52
43
|
};
|
|
53
44
|
|
|
54
45
|
// data strategy
|
package/src/js/util/player.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { isTag } from './dom';
|
|
1
2
|
import { once } from './event';
|
|
2
|
-
import {
|
|
3
|
+
import { includes, noop } from './lang';
|
|
3
4
|
|
|
4
5
|
export function play(el) {
|
|
5
6
|
if (isIFrame(el)) {
|
|
@@ -40,11 +41,11 @@ export function isVideo(el) {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
function isHTML5(el) {
|
|
43
|
-
return el
|
|
44
|
+
return isTag(el, 'video');
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
function isIFrame(el) {
|
|
47
|
-
return el
|
|
48
|
+
return isTag(el, 'iframe') && (isYoutube(el) || isVimeo(el));
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
function isYoutube(el) {
|
|
@@ -64,7 +65,7 @@ async function call(el, cmd) {
|
|
|
64
65
|
|
|
65
66
|
function post(el, cmd) {
|
|
66
67
|
try {
|
|
67
|
-
el.contentWindow.postMessage(JSON.stringify(
|
|
68
|
+
el.contentWindow.postMessage(JSON.stringify({ event: 'command', ...cmd }), '*');
|
|
68
69
|
} catch (e) {
|
|
69
70
|
// noop
|
|
70
71
|
}
|
package/src/js/util/selector.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { attr } from './attr';
|
|
2
|
-
import { inBrowser } from './env';
|
|
3
2
|
import { closest, index, matches, parent } from './filter';
|
|
4
3
|
import { isDocument, isString, memoize, toNode, toNodes } from './lang';
|
|
5
4
|
|
|
@@ -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,6 +18,17 @@ export function findAll(selector, context) {
|
|
|
25
18
|
return toNodes(_query(selector, context, 'querySelectorAll'));
|
|
26
19
|
}
|
|
27
20
|
|
|
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
|
+
|
|
30
|
+
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
31
|
+
|
|
28
32
|
function _query(selector, context = document, queryFn) {
|
|
29
33
|
if (!selector || !isString(selector)) {
|
|
30
34
|
return selector;
|
|
@@ -69,11 +73,6 @@ function _query(selector, context = document, queryFn) {
|
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
73
|
-
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
74
|
-
|
|
75
|
-
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
76
|
-
|
|
77
76
|
const selectorRe = /.*?[^\\](?:,|$)/g;
|
|
78
77
|
|
|
79
78
|
const splitSelector = memoize((selector) =>
|
|
@@ -99,11 +98,6 @@ function domPath(element) {
|
|
|
99
98
|
return names.join(' > ');
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
const escapeFn =
|
|
103
|
-
(inBrowser && window.CSS && CSS.escape) ||
|
|
104
|
-
function (css) {
|
|
105
|
-
return css.replace(/([^\x7f-\uFFFF\w-])/g, (match) => `\\${match}`);
|
|
106
|
-
};
|
|
107
101
|
export function escape(css) {
|
|
108
|
-
return isString(css) ?
|
|
102
|
+
return isString(css) ? CSS.escape(css) : '';
|
|
109
103
|
}
|
package/src/js/util/style.js
CHANGED
|
@@ -31,7 +31,8 @@ const cssNumber = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export function css(element, property, value, priority = '') {
|
|
34
|
-
|
|
34
|
+
const elements = toNodes(element);
|
|
35
|
+
for (const element of elements) {
|
|
35
36
|
if (isString(property)) {
|
|
36
37
|
property = propName(property);
|
|
37
38
|
|
|
@@ -57,9 +58,8 @@ export function css(element, property, value, priority = '') {
|
|
|
57
58
|
priority = value;
|
|
58
59
|
each(property, (value, property) => css(element, property, value, priority));
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})[0];
|
|
61
|
+
}
|
|
62
|
+
return elements[0];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function getStyles(element, pseudoElt) {
|
|
@@ -91,7 +91,6 @@
|
|
|
91
91
|
|
|
92
92
|
/*
|
|
93
93
|
* 1. Set `font-size` to support `rem` units
|
|
94
|
-
* Not using `font` property because a leading hyphen (e.g. -apple-system) causes the font to break in IE11 and Edge
|
|
95
94
|
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
|
96
95
|
* 3. Style
|
|
97
96
|
*/
|
|
@@ -239,7 +238,7 @@ sub { bottom: -0.25em; }
|
|
|
239
238
|
========================================================================== */
|
|
240
239
|
|
|
241
240
|
/*
|
|
242
|
-
* Remove the gap between
|
|
241
|
+
* Remove the gap between the element and the bottom of its parent container.
|
|
243
242
|
*/
|
|
244
243
|
|
|
245
244
|
audio,
|
|
@@ -250,14 +249,14 @@ svg,
|
|
|
250
249
|
video { vertical-align: middle; }
|
|
251
250
|
|
|
252
251
|
/*
|
|
253
|
-
* 1.
|
|
254
|
-
* 2.
|
|
255
|
-
* 3.
|
|
256
|
-
* 4. Exclude SVGs for IE11 because they don't preserve their aspect ratio.
|
|
252
|
+
* 1. Constrain the element to its parent width.
|
|
253
|
+
* 2. Preserve the intrinsic aspect ratio and auto-scale the height of an image if the `height` attribute is present.
|
|
254
|
+
* 3. Take border and padding into account.
|
|
257
255
|
*/
|
|
258
256
|
|
|
259
257
|
canvas,
|
|
260
258
|
img,
|
|
259
|
+
svg,
|
|
261
260
|
video {
|
|
262
261
|
/* 1 */
|
|
263
262
|
max-width: 100%;
|
|
@@ -267,34 +266,17 @@ video {
|
|
|
267
266
|
box-sizing: border-box;
|
|
268
267
|
}
|
|
269
268
|
|
|
270
|
-
/* 4 */
|
|
271
|
-
@supports (display: block) {
|
|
272
|
-
|
|
273
|
-
svg {
|
|
274
|
-
max-width: 100%;
|
|
275
|
-
height: auto;
|
|
276
|
-
box-sizing: border-box;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/*
|
|
282
|
-
* Hide the overflow in IE.
|
|
283
|
-
*/
|
|
284
|
-
|
|
285
|
-
svg:not(:root) { overflow: hidden; }
|
|
286
|
-
|
|
287
269
|
/*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
270
|
+
* Deprecated: only needed for `img` elements with `uk-img`
|
|
271
|
+
* 1. Hide `alt` text for lazy load images.
|
|
272
|
+
* 2. Fix lazy loading images if parent element is set to `display: inline` and has `overflow: hidden`.
|
|
291
273
|
*/
|
|
292
274
|
|
|
293
275
|
img:not([src]) {
|
|
294
276
|
/* 1 */
|
|
295
|
-
min-width: 1px;
|
|
296
|
-
/* 2 */
|
|
297
277
|
visibility: hidden;
|
|
278
|
+
/* 2 */
|
|
279
|
+
min-width: 1px;
|
|
298
280
|
}
|
|
299
281
|
|
|
300
282
|
/*
|
|
@@ -589,11 +571,6 @@ template { display: none; }
|
|
|
589
571
|
* Breakpoints
|
|
590
572
|
*/
|
|
591
573
|
|
|
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
574
|
:root {
|
|
598
575
|
--uk-breakpoint-s: @breakpoint-small;
|
|
599
576
|
--uk-breakpoint-m: @breakpoint-medium;
|