uikit 3.19.5-dev.57ec46163 → 3.19.5-dev.5db24934f
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 +8 -0
- package/dist/css/uikit-core-rtl.css +2 -2
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +2 -2
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +2 -2
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +2 -2
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +2 -2
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +55 -55
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +55 -55
- 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 +73 -48
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +74 -49
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +75 -51
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +74 -49
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +74 -49
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +2 -2
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +1 -1
- 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 +170 -112
- 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 +179 -119
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/boot.js +6 -7
- package/src/js/api/component.js +4 -4
- package/src/js/api/computed.js +24 -23
- package/src/js/api/observer.js +17 -5
- package/src/js/components/slider-parallax.js +2 -2
- package/src/js/components/slider.js +1 -1
- package/src/js/core/drop.js +1 -2
- package/src/js/core/height-placeholder.js +5 -2
- package/src/js/core/height-viewport.js +1 -1
- package/src/js/core/icon.js +2 -3
- package/src/js/core/img.js +1 -1
- package/src/js/core/inverse.js +22 -5
- package/src/js/core/modal.js +5 -6
- package/src/js/core/sticky.js +1 -1
- package/src/js/core/switcher.js +5 -1
- package/src/js/core/toggle.js +7 -3
- package/src/js/mixin/internal/animate-fade.js +1 -3
- package/src/js/mixin/parallax.js +7 -3
- package/src/js/mixin/slider.js +0 -3
- package/src/js/mixin/slideshow.js +3 -0
- package/src/js/util/filter.js +7 -14
- package/src/js/util/lang.js +1 -1
- package/src/js/util/selector.js +71 -38
- package/src/js/util/svg.js +1 -12
- package/src/less/components/utility.less +1 -1
- package/src/scss/components/utility.scss +1 -1
- package/tests/js/index.js +12 -10
- package/tests/modal.html +2 -2
package/src/js/util/selector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attr } from './attr';
|
|
2
|
-
import { index, matches
|
|
2
|
+
import { index, matches } from './filter';
|
|
3
3
|
import { isDocument, isString, memoize, toNode, toNodes } from './lang';
|
|
4
4
|
|
|
5
5
|
export function query(selector, context) {
|
|
@@ -18,57 +18,96 @@ export function findAll(selector, context) {
|
|
|
18
18
|
return toNodes(_query(selector, toNode(context), 'querySelectorAll'));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
22
|
-
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
23
|
-
|
|
24
21
|
function getContext(selector, context = document) {
|
|
25
|
-
return (isString(selector) &&
|
|
22
|
+
return (isString(selector) && parseSelector(selector).isContextSelector) || isDocument(context)
|
|
26
23
|
? context
|
|
27
24
|
: context.ownerDocument;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
const
|
|
31
|
-
const
|
|
27
|
+
const addStarRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
28
|
+
const splitSelectorRe = /.*?[^\\](?![^(]*\))(?:,|$)/g;
|
|
29
|
+
const trailingCommaRe = /\s*,$/;
|
|
30
|
+
|
|
31
|
+
const parseSelector = memoize((selector) => {
|
|
32
|
+
selector = selector.replace(addStarRe, '$1 *');
|
|
33
|
+
let isContextSelector = false;
|
|
34
|
+
|
|
35
|
+
const selectors = [];
|
|
36
|
+
for (let sel of selector.match(splitSelectorRe) ?? []) {
|
|
37
|
+
sel = sel.replace(trailingCommaRe, '').trim();
|
|
38
|
+
if (sel[0] === '>') {
|
|
39
|
+
sel = `:scope ${sel}`;
|
|
40
|
+
}
|
|
41
|
+
isContextSelector ||= ['!', '+', '~', '-'].includes(sel[0]);
|
|
42
|
+
selectors.push(sel);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
selector: selectors.join(','),
|
|
47
|
+
selectors,
|
|
48
|
+
isContextSelector,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const parsePositionSelector = memoize((selector) => {
|
|
53
|
+
selector = selector.substr(1).trim();
|
|
54
|
+
const index = selector.indexOf(' ');
|
|
55
|
+
return ~index ? [selector.substring(0, index), selector.substring(index + 1)] : [selector, ''];
|
|
56
|
+
});
|
|
32
57
|
|
|
33
58
|
function _query(selector, context = document, queryFn) {
|
|
34
59
|
if (!selector || !isString(selector)) {
|
|
35
60
|
return selector;
|
|
36
61
|
}
|
|
37
62
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (isContextSelector(selector)) {
|
|
41
|
-
const split = splitSelector(selector);
|
|
42
|
-
selector = '';
|
|
43
|
-
for (let sel of split) {
|
|
44
|
-
let ctx = context;
|
|
45
|
-
|
|
46
|
-
if (sel[0] === '!') {
|
|
47
|
-
const selectors = sel.substr(1).trim().split(' ');
|
|
48
|
-
ctx = parent(context).closest(selectors[0]);
|
|
49
|
-
sel = selectors.slice(1).join(' ').trim();
|
|
50
|
-
if (!sel.length && split.length === 1) {
|
|
51
|
-
return ctx;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
63
|
+
const parsed = parseSelector(selector);
|
|
54
64
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
if (!parsed.isContextSelector) {
|
|
66
|
+
return _doQuery(context, queryFn, parsed.selector);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
selector = '';
|
|
70
|
+
const isSingle = parsed.selectors.length === 1;
|
|
71
|
+
for (let sel of parsed.selectors) {
|
|
72
|
+
let positionSel;
|
|
73
|
+
let ctx = context;
|
|
74
|
+
|
|
75
|
+
if (sel[0] === '!') {
|
|
76
|
+
[positionSel, sel] = parsePositionSelector(sel);
|
|
77
|
+
ctx = context.parentElement.closest(positionSel);
|
|
78
|
+
if (!sel && isSingle) {
|
|
79
|
+
return ctx;
|
|
60
80
|
}
|
|
81
|
+
}
|
|
61
82
|
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
if (ctx && sel[0] === '-') {
|
|
84
|
+
[positionSel, sel] = parsePositionSelector(sel);
|
|
85
|
+
ctx = ctx.previousElementSibling;
|
|
86
|
+
ctx = matches(ctx, positionSel) ? ctx : null;
|
|
87
|
+
if (!sel && isSingle) {
|
|
88
|
+
return ctx;
|
|
64
89
|
}
|
|
90
|
+
} else if (sel[0] === '~' || (sel[0] === '+' && isSingle)) {
|
|
91
|
+
return _doQuery(
|
|
92
|
+
ctx.parentElement,
|
|
93
|
+
queryFn,
|
|
94
|
+
`:scope :nth-child(${index(ctx) + 1}) ${sel}`,
|
|
95
|
+
);
|
|
65
96
|
}
|
|
66
97
|
|
|
67
|
-
if (
|
|
68
|
-
|
|
98
|
+
if (ctx) {
|
|
99
|
+
selector += `${selector ? ',' : ''}${domPath(ctx)} ${sel}`;
|
|
69
100
|
}
|
|
70
101
|
}
|
|
71
102
|
|
|
103
|
+
if (!isDocument(context)) {
|
|
104
|
+
context = context.ownerDocument;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return _doQuery(context, queryFn, selector);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function _doQuery(context, queryFn, selector) {
|
|
72
111
|
try {
|
|
73
112
|
return context[queryFn](selector);
|
|
74
113
|
} catch (e) {
|
|
@@ -76,12 +115,6 @@ function _query(selector, context = document, queryFn) {
|
|
|
76
115
|
}
|
|
77
116
|
}
|
|
78
117
|
|
|
79
|
-
const selectorRe = /.*?[^\\](?![^(]*\))(?:,|$)/g;
|
|
80
|
-
|
|
81
|
-
const splitSelector = memoize((selector) =>
|
|
82
|
-
selector.match(selectorRe).map((selector) => selector.replace(/,$/, '').trim()),
|
|
83
|
-
);
|
|
84
|
-
|
|
85
118
|
function domPath(element) {
|
|
86
119
|
const names = [];
|
|
87
120
|
while (element.parentNode) {
|
package/src/js/util/svg.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { $$ } from './dom';
|
|
2
2
|
|
|
3
3
|
export function getMaxPathLength(el) {
|
|
4
|
-
return Math.ceil(
|
|
5
|
-
Math.max(
|
|
6
|
-
0,
|
|
7
|
-
...$$('[stroke]', el).map((stroke) => {
|
|
8
|
-
try {
|
|
9
|
-
return stroke.getTotalLength();
|
|
10
|
-
} catch (e) {
|
|
11
|
-
return 0;
|
|
12
|
-
}
|
|
13
|
-
}),
|
|
14
|
-
),
|
|
15
|
-
);
|
|
4
|
+
return Math.ceil(Math.max(0, ...$$('[stroke]', el).map((stroke) => stroke.getTotalLength?.())));
|
|
16
5
|
}
|
package/tests/js/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const tests = TESTS;
|
|
|
5
5
|
const storage = window.sessionStorage;
|
|
6
6
|
const key = '_uikit_style';
|
|
7
7
|
const keyinverse = '_uikit_inverse';
|
|
8
|
-
const docEl = document.documentElement;
|
|
9
8
|
|
|
10
9
|
// try to load themes.json
|
|
11
10
|
const request = new XMLHttpRequest();
|
|
@@ -39,7 +38,7 @@ storage[keyinverse] = storage[keyinverse] || '';
|
|
|
39
38
|
const dir = storage._uikit_dir || 'ltr';
|
|
40
39
|
|
|
41
40
|
// set dir
|
|
42
|
-
|
|
41
|
+
document.documentElement.dir = dir;
|
|
43
42
|
|
|
44
43
|
const style = styles[storage[key]] || styles.theme;
|
|
45
44
|
|
|
@@ -50,6 +49,10 @@ document.writeln(
|
|
|
50
49
|
}">`,
|
|
51
50
|
);
|
|
52
51
|
|
|
52
|
+
document.writeln(
|
|
53
|
+
`<style>body:not(:has([aria-label="Component switcher"])) {padding-top: 80px}</style>`,
|
|
54
|
+
);
|
|
55
|
+
|
|
53
56
|
// add javascript
|
|
54
57
|
document.writeln('<script src="../dist/js/uikit.js"></script>');
|
|
55
58
|
document.writeln(
|
|
@@ -60,9 +63,8 @@ on(window, 'load', () =>
|
|
|
60
63
|
setTimeout(
|
|
61
64
|
() =>
|
|
62
65
|
requestAnimationFrame(() => {
|
|
63
|
-
const $body = document.body;
|
|
64
66
|
const $container = prepend(
|
|
65
|
-
|
|
67
|
+
document.body,
|
|
66
68
|
`
|
|
67
69
|
<div class="uk-container">
|
|
68
70
|
<select class="uk-select uk-form-width-small" style="margin: 20px 20px 20px 0" aria-label="Component switcher">
|
|
@@ -144,8 +146,12 @@ on(window, 'load', () =>
|
|
|
144
146
|
|
|
145
147
|
addClass($$('.uk-navbar-container'), 'uk-navbar-transparent');
|
|
146
148
|
|
|
147
|
-
css(
|
|
148
|
-
|
|
149
|
+
css(
|
|
150
|
+
document.documentElement,
|
|
151
|
+
'background',
|
|
152
|
+
$inverse.value === 'dark' ? '#fff' : '#222',
|
|
153
|
+
);
|
|
154
|
+
addClass(document.body, `uk-${$inverse.value}`);
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
on($inverse, 'change', () => {
|
|
@@ -161,15 +167,11 @@ on(window, 'load', () =>
|
|
|
161
167
|
location.reload();
|
|
162
168
|
});
|
|
163
169
|
$rtl.firstElementChild.checked = dir === 'rtl';
|
|
164
|
-
|
|
165
|
-
css(docEl, 'paddingTop', '');
|
|
166
170
|
}),
|
|
167
171
|
100,
|
|
168
172
|
),
|
|
169
173
|
);
|
|
170
174
|
|
|
171
|
-
css(docEl, 'paddingTop', '80px');
|
|
172
|
-
|
|
173
175
|
function getParam(name) {
|
|
174
176
|
const match = new RegExp(`[?&]${name}=([^&]*)`).exec(window.location.search);
|
|
175
177
|
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
package/tests/modal.html
CHANGED
|
@@ -382,14 +382,14 @@
|
|
|
382
382
|
<div id="modal-media-youtube" uk-modal>
|
|
383
383
|
<div class="uk-modal-dialog uk-width-auto uk-margin-auto-vertical">
|
|
384
384
|
<button class="uk-modal-close-outside" type="button" uk-close></button>
|
|
385
|
-
<iframe src="https://www.youtube-nocookie.com/embed/c2pz2mlSfXA" width="1920" height="1080" uk-responsive uk-video></iframe>
|
|
385
|
+
<iframe src="https://www.youtube-nocookie.com/embed/c2pz2mlSfXA" width="1920" height="1080" loading="lazy" uk-responsive uk-video></iframe>
|
|
386
386
|
</div>
|
|
387
387
|
</div>
|
|
388
388
|
|
|
389
389
|
<div id="modal-media-vimeo" uk-modal>
|
|
390
390
|
<div class="uk-modal-dialog uk-width-auto uk-margin-auto-vertical">
|
|
391
391
|
<button class="uk-modal-close-outside" type="button" uk-close></button>
|
|
392
|
-
<iframe src="https://player.vimeo.com/video/1084537" width="500" height="281" uk-responsive uk-video></iframe>
|
|
392
|
+
<iframe src="https://player.vimeo.com/video/1084537" width="500" height="281" loading="lazy" uk-responsive uk-video></iframe>
|
|
393
393
|
</div>
|
|
394
394
|
</div>
|
|
395
395
|
|