uikit 3.19.5-dev.9d6b5103b → 3.19.5-dev.ac3a5fd02

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 (55) hide show
  1. package/CHANGELOG.md +4 -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 +1 -1
  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 +1 -1
  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 +112 -73
  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 +114 -75
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/boot.js +6 -7
  44. package/src/js/api/component.js +4 -4
  45. package/src/js/api/observer.js +17 -5
  46. package/src/js/components/slider.js +1 -1
  47. package/src/js/core/drop.js +0 -6
  48. package/src/js/core/img.js +1 -1
  49. package/src/js/core/inverse.js +18 -5
  50. package/src/js/mixin/slider.js +0 -3
  51. package/src/js/mixin/slideshow.js +3 -0
  52. package/src/js/util/lang.js +1 -1
  53. package/src/js/util/selector.js +66 -38
  54. package/src/js/util/svg.js +1 -12
  55. package/tests/modal.html +2 -2
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.19.5-dev.9d6b5103b | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */
1
+ /*! UIkit 3.19.5-dev.ac3a5fd02 | 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) {
@@ -3362,18 +3389,30 @@
3362
3389
  }
3363
3390
  const targets = hasOwn(instance, key) ? instance[key] : target;
3364
3391
  const observer = observe(targets, handler, options, args);
3365
- if (isFunction(target) && isArray(instance[key]) && observer.unobserve) {
3366
- 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
+ );
3367
3398
  }
3368
3399
  registerObserver(instance, observer);
3369
3400
  }
3370
- function updateTargets(observer) {
3401
+ function updateTargets(observer, options) {
3371
3402
  return (targets, prev) => {
3372
3403
  for (const target of prev) {
3373
- !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
+ }
3374
3411
  }
3375
3412
  for (const target of targets) {
3376
- !includes(prev, target) && observer.observe(target);
3413
+ if (!includes(prev, target) || !observer.unobserve) {
3414
+ observer.observe(target, options);
3415
+ }
3377
3416
  }
3378
3417
  };
3379
3418
  }
@@ -3533,26 +3572,26 @@
3533
3572
  };
3534
3573
  App.util = util;
3535
3574
  App.options = {};
3536
- App.version = "3.19.5-dev.9d6b5103b";
3575
+ App.version = "3.19.5-dev.ac3a5fd02";
3537
3576
 
3538
3577
  const PREFIX = "uk-";
3539
3578
  const DATA = "__uikit__";
3540
3579
  const components$2 = {};
3541
3580
  function component(name, options) {
3542
- var _a;
3581
+ var _a, _b;
3543
3582
  const id = PREFIX + hyphenate(name);
3544
3583
  if (!options) {
3545
- if (isPlainObject(components$2[id])) {
3584
+ if (!components$2[id].options) {
3546
3585
  components$2[id] = App.extend(components$2[id]);
3547
3586
  }
3548
3587
  return components$2[id];
3549
3588
  }
3550
3589
  name = camelize(name);
3551
3590
  App[name] = (element, data) => createComponent(name, element, data);
3552
- const opt = isPlainObject(options) ? { ...options } : options.options;
3591
+ const opt = (_a = options.options) != null ? _a : { ...options };
3553
3592
  opt.id = id;
3554
3593
  opt.name = name;
3555
- (_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);
3556
3595
  if (App._initialized && !opt.functional) {
3557
3596
  requestAnimationFrame(() => createComponent(name, `[${id}],[data-${id}]`));
3558
3597
  }
@@ -3560,7 +3599,7 @@
3560
3599
  }
3561
3600
  function createComponent(name, element, data, ...args) {
3562
3601
  const Component = component(name);
3563
- 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();
3564
3603
  function init(element2) {
3565
3604
  const instance = getComponent(element2, name);
3566
3605
  if (instance) {
@@ -3922,7 +3961,6 @@
3922
3961
  }
3923
3962
  }
3924
3963
  },
3925
- observe: resize(),
3926
3964
  events: {
3927
3965
  itemshow({ target }) {
3928
3966
  addClass(target, this.clsEnter, this.clsSlideActive);
@@ -4051,6 +4089,7 @@
4051
4089
  return { animation: this.animation };
4052
4090
  }
4053
4091
  },
4092
+ observe: resize(),
4054
4093
  events: {
4055
4094
  beforeitemshow({ target }) {
4056
4095
  addClass(target, this.clsActive);
@@ -4533,18 +4572,10 @@
4533
4572
  }
4534
4573
 
4535
4574
  function getMaxPathLength(el) {
4536
- return Math.ceil(
4537
- Math.max(
4538
- 0,
4539
- ...$$("[stroke]", el).map((stroke) => {
4540
- try {
4541
- return stroke.getTotalLength();
4542
- } catch (e) {
4543
- return 0;
4544
- }
4545
- })
4546
- )
4547
- );
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
+ })));
4548
4579
  }
4549
4580
 
4550
4581
  const props = {
@@ -5251,7 +5282,7 @@
5251
5282
  toggleClass(this.$el, this.clsContainer, !$(`.${this.clsContainer}`, this.$el));
5252
5283
  },
5253
5284
  observe: resize({
5254
- target: ({ slides }) => slides
5285
+ target: ({ slides, $el }) => [$el, ...slides]
5255
5286
  }),
5256
5287
  update: {
5257
5288
  write() {
@@ -6376,14 +6407,14 @@
6376
6407
  if (name) {
6377
6408
  if (hasAttr(target, attributeName)) {
6378
6409
  createComponent(name, target);
6379
- return;
6410
+ } else {
6411
+ (_a = getComponent(target, name)) == null ? void 0 : _a.$destroy();
6380
6412
  }
6381
- (_a = getComponent(target, name)) == null ? void 0 : _a.$destroy();
6382
6413
  }
6383
6414
  }
6384
6415
  function connect(node) {
6385
6416
  const components2 = getComponents(node);
6386
- for (const name in getComponents(node)) {
6417
+ for (const name in components2) {
6387
6418
  callConnected(components2[name]);
6388
6419
  }
6389
6420
  for (const attributeName of node.getAttributeNames()) {
@@ -6393,7 +6424,7 @@
6393
6424
  }
6394
6425
  function disconnect(node) {
6395
6426
  const components2 = getComponents(node);
6396
- for (const name in getComponents(node)) {
6427
+ for (const name in components2) {
6397
6428
  callDisconnected(components2[name]);
6398
6429
  }
6399
6430
  }
@@ -6402,7 +6433,7 @@
6402
6433
  attribute = attribute.slice(5);
6403
6434
  }
6404
6435
  const cmp = components$2[attribute];
6405
- return cmp && (isPlainObject(cmp) ? cmp : cmp.options).name;
6436
+ return cmp && (cmp.options || cmp).name;
6406
6437
  }
6407
6438
 
6408
6439
  globalApi(App);
@@ -6855,10 +6886,6 @@
6855
6886
  }
6856
6887
  css(this.$el, this._style);
6857
6888
  },
6858
- observe: lazyload({
6859
- target: ({ toggle, $el }) => query(toggle, $el),
6860
- targets: ({ $el }) => $el
6861
- }),
6862
6889
  events: [
6863
6890
  {
6864
6891
  name: "click",
@@ -8159,13 +8186,13 @@
8159
8186
  delete this.img;
8160
8187
  },
8161
8188
  observe: intersection({
8162
- target: ({ $el, $props }) => [$el, ...queryAll($props.target, $el)],
8163
8189
  handler(entries, observer) {
8164
8190
  this.load();
8165
8191
  observer.disconnect();
8166
8192
  },
8167
8193
  options: ({ margin }) => ({ rootMargin: margin }),
8168
- filter: ({ loading }) => loading === "lazy"
8194
+ filter: ({ loading }) => loading === "lazy",
8195
+ target: ({ $el, $props }) => $props.target ? [$el, ...queryAll($props.target, $el)] : $el
8169
8196
  }),
8170
8197
  methods: {
8171
8198
  load() {
@@ -8255,9 +8282,15 @@
8255
8282
  selActive: false
8256
8283
  },
8257
8284
  computed: {
8258
- target: ({ target }, $el) => target ? $$(target, $el) : [$el]
8285
+ target: ({ target }, $el) => target ? $$(target, $el) : $el
8259
8286
  },
8260
8287
  observe: [
8288
+ intersection({
8289
+ handler([{ isIntersecting }]) {
8290
+ this.isIntersecting = isIntersecting;
8291
+ },
8292
+ args: { intersecting: false }
8293
+ }),
8261
8294
  mutation({
8262
8295
  target: ({ target }) => target,
8263
8296
  options: { attributes: true, attributeFilter: ["class"], attributeOldValue: true }
@@ -8265,7 +8298,10 @@
8265
8298
  {
8266
8299
  target: ({ target }) => target,
8267
8300
  observe: (target, handler) => {
8268
- const observer = observeResize([...target, document.documentElement], handler);
8301
+ const observer = observeResize(
8302
+ [...toNodes(target), document.documentElement],
8303
+ handler
8304
+ );
8269
8305
  const listener = [
8270
8306
  on(document, "scroll itemshown itemhidden", handler, {
8271
8307
  passive: true,
@@ -8294,7 +8330,10 @@
8294
8330
  ],
8295
8331
  update: {
8296
8332
  read() {
8297
- for (const target of this.target) {
8333
+ if (!this.isIntersecting) {
8334
+ return false;
8335
+ }
8336
+ for (const target of toNodes(this.target)) {
8298
8337
  replaceClass(
8299
8338
  target,
8300
8339
  "uk-light,uk-dark",