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/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.11.2-dev.
|
|
5
|
+
"version": "3.11.2-dev.536e1a374",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
package/src/js/api/component.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
$$,
|
|
3
|
-
assign,
|
|
4
|
-
camelize,
|
|
5
|
-
fastdom,
|
|
6
|
-
hyphenate,
|
|
7
|
-
isPlainObject,
|
|
8
|
-
memoize,
|
|
9
|
-
startsWith,
|
|
10
|
-
} from 'uikit-util';
|
|
1
|
+
import { $$, camelize, fastdom, hyphenate, isPlainObject, memoize, startsWith } from 'uikit-util';
|
|
11
2
|
|
|
12
3
|
export default function (UIkit) {
|
|
13
4
|
const DATA = UIkit.data;
|
|
@@ -51,7 +42,7 @@ export default function (UIkit) {
|
|
|
51
42
|
}
|
|
52
43
|
};
|
|
53
44
|
|
|
54
|
-
const opt = isPlainObject(options) ?
|
|
45
|
+
const opt = isPlainObject(options) ? { ...options } : options.options;
|
|
55
46
|
|
|
56
47
|
opt.name = name;
|
|
57
48
|
|
package/src/js/api/hooks.js
CHANGED
|
@@ -81,8 +81,8 @@ export default function (UIkit) {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
function runUpdates(types) {
|
|
84
|
-
for (const { read, write, events } of this.$options.update) {
|
|
85
|
-
if (!types.has('update') &&
|
|
84
|
+
for (const { read, write, events = [] } of this.$options.update) {
|
|
85
|
+
if (!types.has('update') && !events.some((type) => types.has(type))) {
|
|
86
86
|
continue;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -105,7 +105,7 @@ export default function (UIkit) {
|
|
|
105
105
|
const {
|
|
106
106
|
$options: { computed },
|
|
107
107
|
} = this;
|
|
108
|
-
const values =
|
|
108
|
+
const values = { ...this._computeds };
|
|
109
109
|
this._computeds = {};
|
|
110
110
|
|
|
111
111
|
for (const key in computed) {
|
package/src/js/api/state.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
data as getData,
|
|
5
5
|
hasOwn,
|
|
6
6
|
hyphenate,
|
|
7
|
+
includes,
|
|
7
8
|
isArray,
|
|
8
9
|
isFunction,
|
|
9
10
|
isNumeric,
|
|
@@ -100,203 +101,235 @@ export default function (UIkit) {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
for (const { events = [] } of this.$options.update || []) {
|
|
105
|
+
if (includes(events, 'scroll')) {
|
|
106
|
+
registerScrollListener(this._uid, () => this.$emit('scroll'));
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
103
110
|
};
|
|
104
111
|
|
|
105
112
|
UIkit.prototype._unbindEvents = function () {
|
|
106
113
|
this._events.forEach((unbind) => unbind());
|
|
107
114
|
delete this._events;
|
|
115
|
+
unregisterScrollListener(this._uid);
|
|
108
116
|
};
|
|
109
117
|
|
|
110
118
|
UIkit.prototype._initObservers = function () {
|
|
111
119
|
this._observers = [initChildListObserver(this), initPropsObserver(this)];
|
|
112
120
|
};
|
|
113
121
|
|
|
122
|
+
UIkit.prototype.registerObserver = function (observer) {
|
|
123
|
+
this._observers.push(observer);
|
|
124
|
+
};
|
|
125
|
+
|
|
114
126
|
UIkit.prototype._disconnectObservers = function () {
|
|
115
127
|
this._observers.forEach((observer) => observer?.disconnect());
|
|
116
128
|
};
|
|
129
|
+
}
|
|
117
130
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (!props) {
|
|
123
|
-
return data;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
for (const key in props) {
|
|
127
|
-
const prop = hyphenate(key);
|
|
128
|
-
let value = getData(el, prop);
|
|
129
|
-
|
|
130
|
-
if (isUndefined(value)) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
131
|
+
function getProps(opts, name) {
|
|
132
|
+
const data = {};
|
|
133
|
+
const { args = [], props = {}, el } = opts;
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
if (!props) {
|
|
136
|
+
return data;
|
|
137
|
+
}
|
|
135
138
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
for (const key in props) {
|
|
140
|
+
const prop = hyphenate(key);
|
|
141
|
+
let value = getData(el, prop);
|
|
139
142
|
|
|
140
|
-
|
|
143
|
+
if (isUndefined(value)) {
|
|
144
|
+
continue;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
value = props[key] === Boolean && value === '' ? true : coerce(props[key], value);
|
|
144
148
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (props[prop] !== undefined) {
|
|
148
|
-
data[prop] = coerce(props[prop], options[key]);
|
|
149
|
-
}
|
|
149
|
+
if (prop === 'target' && (!value || startsWith(value, '_'))) {
|
|
150
|
+
continue;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
data[key] = value;
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
Object.defineProperty(component, key, {
|
|
157
|
-
enumerable: true,
|
|
156
|
+
const options = parseOptions(getData(el, name), args);
|
|
158
157
|
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
for (const key in options) {
|
|
159
|
+
const prop = camelize(key);
|
|
160
|
+
if (props[prop] !== undefined) {
|
|
161
|
+
data[prop] = coerce(props[prop], options[key]);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
161
164
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
+
return data;
|
|
166
|
+
}
|
|
165
167
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
function registerComputed(component, key, cb) {
|
|
169
|
+
Object.defineProperty(component, key, {
|
|
170
|
+
enumerable: true,
|
|
168
171
|
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
get() {
|
|
173
|
+
const { _computeds, $props, $el } = component;
|
|
171
174
|
|
|
172
|
-
|
|
175
|
+
if (!hasOwn(_computeds, key)) {
|
|
176
|
+
_computeds[key] = (cb.get || cb).call(component, $props, $el);
|
|
177
|
+
}
|
|
173
178
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
}
|
|
179
|
+
return _computeds[key];
|
|
180
|
+
},
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
event = { name: key, handler: event };
|
|
184
|
-
}
|
|
182
|
+
set(value) {
|
|
183
|
+
const { _computeds } = component;
|
|
185
184
|
|
|
186
|
-
|
|
187
|
-
el = isFunction(el) ? el.call(component) : el || component.$el;
|
|
185
|
+
_computeds[key] = cb.set ? cb.set.call(component, value) : value;
|
|
188
186
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
187
|
+
if (isUndefined(_computeds[key])) {
|
|
188
|
+
delete _computeds[key];
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
194
|
+
export function registerEvent(component, event, key) {
|
|
195
|
+
if (!isPlainObject(event)) {
|
|
196
|
+
event = { name: key, handler: event };
|
|
197
|
+
}
|
|
197
198
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
{ passive, capture, self }
|
|
205
|
-
)
|
|
206
|
-
);
|
|
199
|
+
let { name, el, handler, capture, passive, delegate, filter, self } = event;
|
|
200
|
+
el = isFunction(el) ? el.call(component) : el || component.$el;
|
|
201
|
+
|
|
202
|
+
if (isArray(el)) {
|
|
203
|
+
el.forEach((el) => registerEvent(component, { ...event, el }, key));
|
|
204
|
+
return;
|
|
207
205
|
}
|
|
208
206
|
|
|
209
|
-
|
|
210
|
-
return
|
|
207
|
+
if (!el || (filter && !filter.call(component))) {
|
|
208
|
+
return;
|
|
211
209
|
}
|
|
212
210
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
component._events.push(
|
|
212
|
+
on(
|
|
213
|
+
el,
|
|
214
|
+
name,
|
|
215
|
+
delegate ? (isString(delegate) ? delegate : delegate.call(component)) : null,
|
|
216
|
+
isString(handler) ? component[handler] : handler.bind(component),
|
|
217
|
+
{ passive, capture, self }
|
|
218
|
+
)
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
function notIn(options, key) {
|
|
223
|
+
return options.every((arr) => !arr || !hasOwn(arr, key));
|
|
224
|
+
}
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
: [value];
|
|
226
|
+
function coerce(type, value) {
|
|
227
|
+
if (type === Boolean) {
|
|
228
|
+
return toBoolean(value);
|
|
229
|
+
} else if (type === Number) {
|
|
230
|
+
return toNumber(value);
|
|
231
|
+
} else if (type === 'list') {
|
|
232
|
+
return toList(value);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
data = data.slice(0, args.length).reduce((data, value, index) => {
|
|
238
|
-
if (isPlainObject(value)) {
|
|
239
|
-
assign(data, value);
|
|
240
|
-
} else {
|
|
241
|
-
data[args[index]] = value;
|
|
242
|
-
}
|
|
243
|
-
return data;
|
|
244
|
-
}, {});
|
|
245
|
-
}
|
|
235
|
+
return type ? type(value) : value;
|
|
236
|
+
}
|
|
246
237
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
238
|
+
function toList(value) {
|
|
239
|
+
return isArray(value)
|
|
240
|
+
? value
|
|
241
|
+
: isString(value)
|
|
242
|
+
? value
|
|
243
|
+
.split(/,(?![^(]*\))/)
|
|
244
|
+
.map((value) => (isNumeric(value) ? toNumber(value) : toBoolean(value.trim())))
|
|
245
|
+
: [value];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function normalizeData({ data = {} }, { args = [], props = {} }) {
|
|
249
|
+
if (isArray(data)) {
|
|
250
|
+
data = data.slice(0, args.length).reduce((data, value, index) => {
|
|
251
|
+
if (isPlainObject(value)) {
|
|
252
|
+
assign(data, value);
|
|
253
|
+
} else {
|
|
254
|
+
data[args[index]] = value;
|
|
252
255
|
}
|
|
253
|
-
|
|
256
|
+
return data;
|
|
257
|
+
}, {});
|
|
258
|
+
}
|
|
254
259
|
|
|
255
|
-
|
|
260
|
+
for (const key in data) {
|
|
261
|
+
if (isUndefined(data[key])) {
|
|
262
|
+
delete data[key];
|
|
263
|
+
} else if (props[key]) {
|
|
264
|
+
data[key] = coerce(props[key], data[key]);
|
|
265
|
+
}
|
|
256
266
|
}
|
|
257
267
|
|
|
258
|
-
|
|
259
|
-
|
|
268
|
+
return data;
|
|
269
|
+
}
|
|
260
270
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
childList: true,
|
|
264
|
-
subtree: true,
|
|
265
|
-
});
|
|
271
|
+
function initChildListObserver(component) {
|
|
272
|
+
const { el } = component.$options;
|
|
266
273
|
|
|
267
|
-
|
|
268
|
-
|
|
274
|
+
const observer = new MutationObserver(() => component.$emit());
|
|
275
|
+
observer.observe(el, {
|
|
276
|
+
childList: true,
|
|
277
|
+
subtree: true,
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
return observer;
|
|
281
|
+
}
|
|
269
282
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
283
|
+
function initPropsObserver(component) {
|
|
284
|
+
const { $name, $options, $props } = component;
|
|
285
|
+
const { attrs, props, el } = $options;
|
|
273
286
|
|
|
274
|
-
|
|
275
|
-
|
|
287
|
+
if (!props || attrs === false) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const attributes = isArray(attrs) ? attrs : Object.keys(props);
|
|
292
|
+
const filter = attributes.map((key) => hyphenate(key)).concat($name);
|
|
293
|
+
|
|
294
|
+
const observer = new MutationObserver((records) => {
|
|
295
|
+
const data = getProps($options, $name);
|
|
296
|
+
if (
|
|
297
|
+
records.some(({ attributeName }) => {
|
|
298
|
+
const prop = attributeName.replace('data-', '');
|
|
299
|
+
return (
|
|
300
|
+
prop === $name ? attributes : [camelize(prop), camelize(attributeName)]
|
|
301
|
+
).some((prop) => !isUndefined(data[prop]) && data[prop] !== $props[prop]);
|
|
302
|
+
})
|
|
303
|
+
) {
|
|
304
|
+
component.$reset();
|
|
276
305
|
}
|
|
306
|
+
});
|
|
277
307
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const data = getProps($options, $name);
|
|
283
|
-
if (
|
|
284
|
-
records.some(({ attributeName }) => {
|
|
285
|
-
const prop = attributeName.replace('data-', '');
|
|
286
|
-
return (
|
|
287
|
-
prop === $name ? attributes : [camelize(prop), camelize(attributeName)]
|
|
288
|
-
).some((prop) => !isUndefined(data[prop]) && data[prop] !== $props[prop]);
|
|
289
|
-
})
|
|
290
|
-
) {
|
|
291
|
-
component.$reset();
|
|
292
|
-
}
|
|
293
|
-
});
|
|
308
|
+
observer.observe(el, {
|
|
309
|
+
attributes: true,
|
|
310
|
+
attributeFilter: filter.concat(filter.map((key) => `data-${key}`)),
|
|
311
|
+
});
|
|
294
312
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
313
|
+
return observer;
|
|
314
|
+
}
|
|
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,
|
|
298
324
|
});
|
|
299
325
|
|
|
300
|
-
|
|
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;
|
|
301
334
|
}
|
|
302
335
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
-
import { $,
|
|
2
|
+
import { $, html } from 'uikit-util';
|
|
3
|
+
|
|
4
|
+
const units = ['days', 'hours', 'minutes', 'seconds'];
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
7
|
mixins: [Class],
|
|
@@ -14,39 +16,13 @@ export default {
|
|
|
14
16
|
clsWrapper: '.uk-countdown-%unit%',
|
|
15
17
|
},
|
|
16
18
|
|
|
17
|
-
computed: {
|
|
18
|
-
date({ date }) {
|
|
19
|
-
return Date.parse(date);
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
days({ clsWrapper }, $el) {
|
|
23
|
-
return $(clsWrapper.replace('%unit%', 'days'), $el);
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
hours({ clsWrapper }, $el) {
|
|
27
|
-
return $(clsWrapper.replace('%unit%', 'hours'), $el);
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
minutes({ clsWrapper }, $el) {
|
|
31
|
-
return $(clsWrapper.replace('%unit%', 'minutes'), $el);
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
seconds({ clsWrapper }, $el) {
|
|
35
|
-
return $(clsWrapper.replace('%unit%', 'seconds'), $el);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
units() {
|
|
39
|
-
return ['days', 'hours', 'minutes', 'seconds'].filter((unit) => this[unit]);
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
|
|
43
19
|
connected() {
|
|
20
|
+
this.date = Date.parse(this.date);
|
|
44
21
|
this.start();
|
|
45
22
|
},
|
|
46
23
|
|
|
47
24
|
disconnected() {
|
|
48
25
|
this.stop();
|
|
49
|
-
this.units.forEach((unit) => empty(this[unit]));
|
|
50
26
|
},
|
|
51
27
|
|
|
52
28
|
events: [
|
|
@@ -67,22 +43,37 @@ export default {
|
|
|
67
43
|
},
|
|
68
44
|
],
|
|
69
45
|
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
methods: {
|
|
47
|
+
start() {
|
|
48
|
+
this.stop();
|
|
49
|
+
this.update();
|
|
50
|
+
this.timer = setInterval(this.update, 1000);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
stop() {
|
|
54
|
+
clearInterval(this.timer);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
update() {
|
|
72
58
|
const timespan = getTimeSpan(this.date);
|
|
73
59
|
|
|
74
|
-
if (timespan.total <= 0) {
|
|
60
|
+
if (!this.date || timespan.total <= 0) {
|
|
75
61
|
this.stop();
|
|
76
62
|
|
|
77
63
|
timespan.days = timespan.hours = timespan.minutes = timespan.seconds = 0;
|
|
78
64
|
}
|
|
79
65
|
|
|
80
|
-
for (const unit of
|
|
66
|
+
for (const unit of units) {
|
|
67
|
+
const el = $(this.clsWrapper.replace('%unit%', unit), this.$el);
|
|
68
|
+
|
|
69
|
+
if (!el) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
81
73
|
let digits = String(Math.floor(timespan[unit]));
|
|
82
74
|
|
|
83
75
|
digits = digits.length < 2 ? `0${digits}` : digits;
|
|
84
76
|
|
|
85
|
-
const el = this[unit];
|
|
86
77
|
if (el.textContent !== digits) {
|
|
87
78
|
digits = digits.split('');
|
|
88
79
|
|
|
@@ -95,24 +86,6 @@ export default {
|
|
|
95
86
|
}
|
|
96
87
|
},
|
|
97
88
|
},
|
|
98
|
-
|
|
99
|
-
methods: {
|
|
100
|
-
start() {
|
|
101
|
-
this.stop();
|
|
102
|
-
|
|
103
|
-
if (this.date && this.units.length) {
|
|
104
|
-
this.$update();
|
|
105
|
-
this.timer = setInterval(this.$update, 1000);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
stop() {
|
|
110
|
-
if (this.timer) {
|
|
111
|
-
clearInterval(this.timer);
|
|
112
|
-
this.timer = null;
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
89
|
};
|
|
117
90
|
|
|
118
91
|
function getTimeSpan(date) {
|
|
@@ -2,7 +2,6 @@ import Animate from '../mixin/animate';
|
|
|
2
2
|
import {
|
|
3
3
|
$$,
|
|
4
4
|
append,
|
|
5
|
-
assign,
|
|
6
5
|
css,
|
|
7
6
|
data,
|
|
8
7
|
each,
|
|
@@ -105,7 +104,7 @@ export default {
|
|
|
105
104
|
},
|
|
106
105
|
|
|
107
106
|
setState(state, animate = true) {
|
|
108
|
-
state =
|
|
107
|
+
state = { filter: { '': '' }, sort: [], ...state };
|
|
109
108
|
|
|
110
109
|
trigger(this.$el, 'beforeFilter', [this, state]);
|
|
111
110
|
|
|
@@ -205,7 +204,7 @@ function getSelector({ filter }) {
|
|
|
205
204
|
}
|
|
206
205
|
|
|
207
206
|
function sortItems(nodes, sort, order) {
|
|
208
|
-
return
|
|
207
|
+
return [...nodes].sort(
|
|
209
208
|
(a, b) =>
|
|
210
209
|
data(a, sort).localeCompare(data(b, sort), undefined, { numeric: true }) *
|
|
211
210
|
(order === 'asc' || -1)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Animations, { scale3d } from '../../mixin/internal/slideshow-animations';
|
|
2
|
-
import {
|
|
2
|
+
import { css } from 'uikit-util';
|
|
3
3
|
|
|
4
|
-
export default
|
|
4
|
+
export default {
|
|
5
|
+
...Animations,
|
|
5
6
|
fade: {
|
|
6
7
|
show() {
|
|
7
8
|
return [{ opacity: 0 }, { opacity: 1 }];
|
|
@@ -35,4 +36,4 @@ export default assign({}, Animations, {
|
|
|
35
36
|
];
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
|
-
}
|
|
39
|
+
};
|
|
@@ -3,9 +3,10 @@ import Animations, {
|
|
|
3
3
|
translate,
|
|
4
4
|
translated,
|
|
5
5
|
} from '../../mixin/internal/slideshow-animations';
|
|
6
|
-
import {
|
|
6
|
+
import { css } from 'uikit-util';
|
|
7
7
|
|
|
8
|
-
export default
|
|
8
|
+
export default {
|
|
9
|
+
...Animations,
|
|
9
10
|
fade: {
|
|
10
11
|
show() {
|
|
11
12
|
return [{ opacity: 0, zIndex: 0 }, { zIndex: -1 }];
|
|
@@ -96,4 +97,4 @@ export default assign({}, Animations, {
|
|
|
96
97
|
];
|
|
97
98
|
},
|
|
98
99
|
},
|
|
99
|
-
}
|
|
100
|
+
};
|