uikit 3.19.4 → 3.19.5-dev.520984f53

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -1
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +7 -8
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +55 -55
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +55 -55
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +64 -45
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +64 -45
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +66 -48
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +64 -45
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +65 -46
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +3 -3
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +122 -77
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +128 -84
  41. package/dist/js/uikit.min.js +1 -1
  42. package/eslint.config.js +8 -5
  43. package/package.json +3 -4
  44. package/src/js/api/boot.js +6 -7
  45. package/src/js/api/component.js +4 -4
  46. package/src/js/api/observer.js +17 -5
  47. package/src/js/components/filter.js +4 -5
  48. package/src/js/components/slider.js +1 -1
  49. package/src/js/core/drop.js +0 -6
  50. package/src/js/core/img.js +1 -1
  51. package/src/js/core/inverse.js +20 -5
  52. package/src/js/core/margin.js +1 -1
  53. package/src/js/core/switcher.js +6 -1
  54. package/src/js/core/toggle.js +1 -1
  55. package/src/js/mixin/slider.js +0 -3
  56. package/src/js/mixin/slideshow.js +3 -0
  57. package/src/js/util/lang.js +1 -1
  58. package/src/js/util/selector.js +66 -38
  59. package/src/js/util/svg.js +1 -12
  60. package/tests/modal.html +2 -2
  61. package/build/package.json +0 -4
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.19.4 | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */
1
+ /*! UIkit 3.19.5-dev.520984f53 | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -88,7 +88,7 @@
88
88
  return parseFloat(value) || 0;
89
89
  }
90
90
  function toNode(element) {
91
- return toNodes(element)[0];
91
+ return element && toNodes(element)[0];
92
92
  }
93
93
  function toNodes(element) {
94
94
  return isNode(element) ? [element] : Array.from(element || []).filter(isNode);
@@ -367,55 +367,82 @@
367
367
  function findAll(selector, context) {
368
368
  return toNodes(_query(selector, toNode(context), "querySelectorAll"));
369
369
  }
370
- const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
371
- const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
372
370
  function getContext(selector, context = document) {
373
- return isString(selector) && isContextSelector(selector) || isDocument(context) ? context : context.ownerDocument;
371
+ return isString(selector) && parseSelector(selector).isContextSelector || isDocument(context) ? context : context.ownerDocument;
374
372
  }
375
- const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
376
- const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, "$1 *"));
373
+ const addStarRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
374
+ const splitSelectorRe = /.*?[^\\](?![^(]*\))(?:,|$)/g;
375
+ const trailingCommaRe = /\s*,$/;
376
+ const parseSelector = memoize((selector) => {
377
+ var _a;
378
+ selector = selector.replace(addStarRe, "$1 *");
379
+ let isContextSelector = false;
380
+ const selectors = [];
381
+ for (let sel of (_a = selector.match(splitSelectorRe)) != null ? _a : []) {
382
+ sel = sel.replace(trailingCommaRe, "").trim();
383
+ if (sel[0] === ">") {
384
+ sel = `:scope ${sel}`;
385
+ }
386
+ isContextSelector || (isContextSelector = ["!", "+", "~", "-"].includes(sel[0]));
387
+ selectors.push(sel);
388
+ }
389
+ return {
390
+ selector: selectors.join(","),
391
+ selectors,
392
+ isContextSelector
393
+ };
394
+ });
377
395
  function _query(selector, context = document, queryFn) {
378
396
  if (!selector || !isString(selector)) {
379
397
  return selector;
380
398
  }
381
- selector = sanatize(selector);
382
- if (isContextSelector(selector)) {
383
- const split = splitSelector(selector);
384
- selector = "";
385
- for (let sel of split) {
386
- let ctx = context;
387
- if (sel[0] === "!") {
388
- const selectors = sel.substr(1).trim().split(" ");
389
- ctx = parent(context).closest(selectors[0]);
390
- sel = selectors.slice(1).join(" ").trim();
391
- if (!sel.length && split.length === 1) {
392
- return ctx;
393
- }
394
- }
395
- if (sel[0] === "-") {
396
- const selectors = sel.substr(1).trim().split(" ");
397
- const prev = (ctx || context).previousElementSibling;
398
- ctx = matches(prev, sel.substr(1)) ? prev : null;
399
- sel = selectors.slice(1).join(" ");
400
- }
401
- if (ctx) {
402
- selector += `${selector ? "," : ""}${domPath(ctx)} ${sel}`;
403
- }
399
+ const parsed = parseSelector(selector);
400
+ if (!parsed.isContextSelector) {
401
+ return _doQuery(context, queryFn, parsed.selector);
402
+ }
403
+ selector = "";
404
+ const isSingle = parsed.selectors.length === 1;
405
+ for (let sel of parsed.selectors) {
406
+ let ctx = context;
407
+ if (sel[0] === "!") {
408
+ const selectors = sel.substr(1).trim().split(" ");
409
+ ctx = context.parentElement.closest(selectors[0]);
410
+ sel = selectors.slice(1).join(" ").trim();
411
+ if (!sel.length && isSingle) {
412
+ return ctx;
413
+ }
414
+ }
415
+ if (sel[0] === "-") {
416
+ const selectors = sel.substr(1).trim().split(" ");
417
+ const prev = (ctx || context).previousElementSibling;
418
+ ctx = matches(prev, sel.substr(1)) ? prev : null;
419
+ sel = selectors.slice(1).join(" ");
420
+ if (!sel.length && isSingle) {
421
+ return ctx;
422
+ }
423
+ } else if (sel[0] === "~" || sel[0] === "+" && isSingle) {
424
+ return _doQuery(
425
+ ctx.parentElement,
426
+ queryFn,
427
+ `:scope :nth-child(${index(ctx) + 1}) ${sel}`
428
+ );
404
429
  }
405
- if (!isDocument(context)) {
406
- context = context.ownerDocument;
430
+ if (ctx) {
431
+ selector += `${selector ? "," : ""}${domPath(ctx)} ${sel}`;
407
432
  }
408
433
  }
434
+ if (!isDocument(context)) {
435
+ context = context.ownerDocument;
436
+ }
437
+ return _doQuery(context, queryFn, selector);
438
+ }
439
+ function _doQuery(context, queryFn, selector) {
409
440
  try {
410
441
  return context[queryFn](selector);
411
442
  } catch (e) {
412
443
  return null;
413
444
  }
414
445
  }
415
- const selectorRe = /.*?[^\\](?![^(]*\))(?:,|$)/g;
416
- const splitSelector = memoize(
417
- (selector) => selector.match(selectorRe).map((selector2) => selector2.replace(/,$/, "").trim())
418
- );
419
446
  function domPath(element) {
420
447
  const names = [];
421
448
  while (element.parentNode) {
@@ -2011,10 +2038,10 @@
2011
2038
  observe: [
2012
2039
  mutation({
2013
2040
  options: {
2014
- childList: true,
2015
2041
  attributes: true,
2016
2042
  attributeFilter: ["style"]
2017
- }
2043
+ },
2044
+ target: ({ $el }) => [$el, ...children($el)]
2018
2045
  }),
2019
2046
  resize({
2020
2047
  target: ({ $el }) => [$el, ...children($el)]
@@ -2368,10 +2395,7 @@
2368
2395
  }
2369
2396
  await Promise.all(
2370
2397
  $$(this.target, this.$el).map((target) => {
2371
- const filterFn = () => {
2372
- applyState(state, target, children(target));
2373
- this.$update(this.$el);
2374
- };
2398
+ const filterFn = () => applyState(state, target, children(target));
2375
2399
  return animate ? this.animate(filterFn, target) : filterFn();
2376
2400
  })
2377
2401
  );
@@ -2390,7 +2414,9 @@
2390
2414
  }
2391
2415
  function applyState(state, target, children) {
2392
2416
  const selector = getSelector(state);
2393
- children.forEach((el) => css(el, "display", selector && !matches(el, selector) ? "none" : ""));
2417
+ for (const el of children) {
2418
+ css(el, "display", selector && !matches(el, selector) ? "none" : "");
2419
+ }
2394
2420
  const [sort, order] = state.sort;
2395
2421
  if (sort) {
2396
2422
  const sorted = sortItems(children, sort, order);
@@ -3363,18 +3389,30 @@
3363
3389
  }
3364
3390
  const targets = hasOwn(instance, key) ? instance[key] : target;
3365
3391
  const observer = observe(targets, handler, options, args);
3366
- if (isFunction(target) && isArray(instance[key]) && observer.unobserve) {
3367
- registerWatch(instance, { handler: updateTargets(observer), immediate: false }, key);
3392
+ if (isFunction(target) && isArray(instance[key])) {
3393
+ registerWatch(
3394
+ instance,
3395
+ { handler: updateTargets(observer, options), immediate: false },
3396
+ key
3397
+ );
3368
3398
  }
3369
3399
  registerObserver(instance, observer);
3370
3400
  }
3371
- function updateTargets(observer) {
3401
+ function updateTargets(observer, options) {
3372
3402
  return (targets, prev) => {
3373
3403
  for (const target of prev) {
3374
- !includes(targets, target) && observer.unobserve(target);
3404
+ if (!includes(targets, target)) {
3405
+ if (observer.unobserve) {
3406
+ observer.unobserve(target);
3407
+ } else {
3408
+ observer.disconnect();
3409
+ }
3410
+ }
3375
3411
  }
3376
3412
  for (const target of targets) {
3377
- !includes(prev, target) && observer.observe(target);
3413
+ if (!includes(prev, target) || !observer.unobserve) {
3414
+ observer.observe(target, options);
3415
+ }
3378
3416
  }
3379
3417
  };
3380
3418
  }
@@ -3534,26 +3572,26 @@
3534
3572
  };
3535
3573
  App.util = util;
3536
3574
  App.options = {};
3537
- App.version = "3.19.4";
3575
+ App.version = "3.19.5-dev.520984f53";
3538
3576
 
3539
3577
  const PREFIX = "uk-";
3540
3578
  const DATA = "__uikit__";
3541
3579
  const components$2 = {};
3542
3580
  function component(name, options) {
3543
- var _a;
3581
+ var _a, _b;
3544
3582
  const id = PREFIX + hyphenate(name);
3545
3583
  if (!options) {
3546
- if (isPlainObject(components$2[id])) {
3584
+ if (!components$2[id].options) {
3547
3585
  components$2[id] = App.extend(components$2[id]);
3548
3586
  }
3549
3587
  return components$2[id];
3550
3588
  }
3551
3589
  name = camelize(name);
3552
3590
  App[name] = (element, data) => createComponent(name, element, data);
3553
- const opt = isPlainObject(options) ? { ...options } : options.options;
3591
+ const opt = (_a = options.options) != null ? _a : { ...options };
3554
3592
  opt.id = id;
3555
3593
  opt.name = name;
3556
- (_a = opt.install) == null ? void 0 : _a.call(opt, App, opt, name);
3594
+ (_b = opt.install) == null ? void 0 : _b.call(opt, App, opt, name);
3557
3595
  if (App._initialized && !opt.functional) {
3558
3596
  requestAnimationFrame(() => createComponent(name, `[${id}],[data-${id}]`));
3559
3597
  }
@@ -3561,7 +3599,7 @@
3561
3599
  }
3562
3600
  function createComponent(name, element, data, ...args) {
3563
3601
  const Component = component(name);
3564
- return Component.options.functional ? new Component({ data: isPlainObject(element) ? element : [element, data, ...args] }) : element ? $$(element).map(init)[0] : init();
3602
+ return Component.options.functional ? new Component({ data: isPlainObject(element) ? element : [element, data, ...args] }) : element ? findAll(element).map(init)[0] : init();
3565
3603
  function init(element2) {
3566
3604
  const instance = getComponent(element2, name);
3567
3605
  if (instance) {
@@ -3923,7 +3961,6 @@
3923
3961
  }
3924
3962
  }
3925
3963
  },
3926
- observe: resize(),
3927
3964
  events: {
3928
3965
  itemshow({ target }) {
3929
3966
  addClass(target, this.clsEnter, this.clsSlideActive);
@@ -4052,6 +4089,7 @@
4052
4089
  return { animation: this.animation };
4053
4090
  }
4054
4091
  },
4092
+ observe: resize(),
4055
4093
  events: {
4056
4094
  beforeitemshow({ target }) {
4057
4095
  addClass(target, this.clsActive);
@@ -4534,18 +4572,10 @@
4534
4572
  }
4535
4573
 
4536
4574
  function getMaxPathLength(el) {
4537
- return Math.ceil(
4538
- Math.max(
4539
- 0,
4540
- ...$$("[stroke]", el).map((stroke) => {
4541
- try {
4542
- return stroke.getTotalLength();
4543
- } catch (e) {
4544
- return 0;
4545
- }
4546
- })
4547
- )
4548
- );
4575
+ return Math.ceil(Math.max(0, ...$$("[stroke]", el).map((stroke) => {
4576
+ var _a;
4577
+ return (_a = stroke.getTotalLength) == null ? void 0 : _a.call(stroke);
4578
+ })));
4549
4579
  }
4550
4580
 
4551
4581
  const props = {
@@ -5252,7 +5282,7 @@
5252
5282
  toggleClass(this.$el, this.clsContainer, !$(`.${this.clsContainer}`, this.$el));
5253
5283
  },
5254
5284
  observe: resize({
5255
- target: ({ slides }) => slides
5285
+ target: ({ slides, $el }) => [$el, ...slides]
5256
5286
  }),
5257
5287
  update: {
5258
5288
  write() {
@@ -6377,14 +6407,14 @@
6377
6407
  if (name) {
6378
6408
  if (hasAttr(target, attributeName)) {
6379
6409
  createComponent(name, target);
6380
- return;
6410
+ } else {
6411
+ (_a = getComponent(target, name)) == null ? void 0 : _a.$destroy();
6381
6412
  }
6382
- (_a = getComponent(target, name)) == null ? void 0 : _a.$destroy();
6383
6413
  }
6384
6414
  }
6385
6415
  function connect(node) {
6386
6416
  const components2 = getComponents(node);
6387
- for (const name in getComponents(node)) {
6417
+ for (const name in components2) {
6388
6418
  callConnected(components2[name]);
6389
6419
  }
6390
6420
  for (const attributeName of node.getAttributeNames()) {
@@ -6394,7 +6424,7 @@
6394
6424
  }
6395
6425
  function disconnect(node) {
6396
6426
  const components2 = getComponents(node);
6397
- for (const name in getComponents(node)) {
6427
+ for (const name in components2) {
6398
6428
  callDisconnected(components2[name]);
6399
6429
  }
6400
6430
  }
@@ -6403,7 +6433,7 @@
6403
6433
  attribute = attribute.slice(5);
6404
6434
  }
6405
6435
  const cmp = components$2[attribute];
6406
- return cmp && (isPlainObject(cmp) ? cmp : cmp.options).name;
6436
+ return cmp && (cmp.options || cmp).name;
6407
6437
  }
6408
6438
 
6409
6439
  globalApi(App);
@@ -6856,10 +6886,6 @@
6856
6886
  }
6857
6887
  css(this.$el, this._style);
6858
6888
  },
6859
- observe: lazyload({
6860
- target: ({ toggle, $el }) => query(toggle, $el),
6861
- targets: ({ $el }) => $el
6862
- }),
6863
6889
  events: [
6864
6890
  {
6865
6891
  name: "click",
@@ -8160,13 +8186,13 @@
8160
8186
  delete this.img;
8161
8187
  },
8162
8188
  observe: intersection({
8163
- target: ({ $el, $props }) => [$el, ...queryAll($props.target, $el)],
8164
8189
  handler(entries, observer) {
8165
8190
  this.load();
8166
8191
  observer.disconnect();
8167
8192
  },
8168
8193
  options: ({ margin }) => ({ rootMargin: margin }),
8169
- filter: ({ loading }) => loading === "lazy"
8194
+ filter: ({ loading }) => loading === "lazy",
8195
+ target: ({ $el, $props }) => $props.target ? [$el, ...queryAll($props.target, $el)] : $el
8170
8196
  }),
8171
8197
  methods: {
8172
8198
  load() {
@@ -8256,9 +8282,17 @@
8256
8282
  selActive: false
8257
8283
  },
8258
8284
  computed: {
8259
- target: ({ target }, $el) => target ? $$(target, $el) : [$el]
8285
+ target: ({ target }, $el) => target ? $$(target, $el) : $el
8260
8286
  },
8261
8287
  observe: [
8288
+ intersection({
8289
+ handler(entries) {
8290
+ this.isIntersecting = entries.some(({ isIntersecting }) => isIntersecting);
8291
+ this.$emit();
8292
+ },
8293
+ target: ({ target }) => target,
8294
+ args: { intersecting: false }
8295
+ }),
8262
8296
  mutation({
8263
8297
  target: ({ target }) => target,
8264
8298
  options: { attributes: true, attributeFilter: ["class"], attributeOldValue: true }
@@ -8266,7 +8300,10 @@
8266
8300
  {
8267
8301
  target: ({ target }) => target,
8268
8302
  observe: (target, handler) => {
8269
- const observer = observeResize([...target, document.documentElement], handler);
8303
+ const observer = observeResize(
8304
+ [...toNodes(target), document.documentElement],
8305
+ handler
8306
+ );
8270
8307
  const listener = [
8271
8308
  on(document, "scroll itemshown itemhidden", handler, {
8272
8309
  passive: true,
@@ -8295,7 +8332,10 @@
8295
8332
  ],
8296
8333
  update: {
8297
8334
  read() {
8298
- for (const target of this.target) {
8335
+ if (!this.isIntersecting) {
8336
+ return false;
8337
+ }
8338
+ for (const target of toNodes(this.target)) {
8299
8339
  replaceClass(
8300
8340
  target,
8301
8341
  "uk-light,uk-dark",
@@ -9546,7 +9586,11 @@
9546
9586
  ],
9547
9587
  update() {
9548
9588
  var _a;
9549
- attr(this.connects, "role", "presentation");
9589
+ for (const el of this.connects) {
9590
+ if (isTag(el, "ul")) {
9591
+ attr(el, "role", "presentation");
9592
+ }
9593
+ }
9550
9594
  attr(children(this.$el), "role", "presentation");
9551
9595
  for (const index in this.toggles) {
9552
9596
  const toggle = this.toggles[index];
@@ -9645,7 +9689,7 @@
9645
9689
  }
9646
9690
  }
9647
9691
  },
9648
- observe: lazyload({ target: ({ target }) => target }),
9692
+ observe: lazyload({ targets: ({ target }) => target }),
9649
9693
  events: [
9650
9694
  {
9651
9695
  name: pointerDown$1,