uikit 3.16.16-dev.eede5abfb → 3.16.17-dev.8404b30b4

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 (62) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/release.js +1 -1
  3. package/dist/css/uikit-core-rtl.css +1 -1
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +1 -1
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +1 -1
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +1 -1
  10. package/dist/css/uikit.min.css +1 -1
  11. package/dist/js/components/countdown.js +1 -1
  12. package/dist/js/components/countdown.min.js +1 -1
  13. package/dist/js/components/filter.js +3 -3
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +34 -30
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +34 -30
  18. package/dist/js/components/lightbox.min.js +1 -1
  19. package/dist/js/components/notification.js +1 -1
  20. package/dist/js/components/notification.min.js +1 -1
  21. package/dist/js/components/parallax.js +2 -2
  22. package/dist/js/components/parallax.min.js +1 -1
  23. package/dist/js/components/slider-parallax.js +2 -2
  24. package/dist/js/components/slider-parallax.min.js +1 -1
  25. package/dist/js/components/slider.js +26 -25
  26. package/dist/js/components/slider.min.js +1 -1
  27. package/dist/js/components/slideshow-parallax.js +2 -2
  28. package/dist/js/components/slideshow-parallax.min.js +1 -1
  29. package/dist/js/components/slideshow.js +26 -25
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +1 -1
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +16 -12
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +1 -1
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +44 -50
  38. package/dist/js/uikit-core.min.js +1 -1
  39. package/dist/js/uikit-icons.js +1 -1
  40. package/dist/js/uikit-icons.min.js +1 -1
  41. package/dist/js/uikit.js +93 -95
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +9 -9
  44. package/src/js/api/global.js +1 -1
  45. package/src/js/components/filter.js +2 -2
  46. package/src/js/components/internal/slider-transitioner.js +15 -15
  47. package/src/js/components/slider.js +2 -1
  48. package/src/js/components/tooltip.js +7 -6
  49. package/src/js/core/accordion.js +2 -2
  50. package/src/js/core/drop.js +2 -2
  51. package/src/js/core/modal.js +19 -21
  52. package/src/js/core/switcher.js +5 -5
  53. package/src/js/core/toggle.js +8 -7
  54. package/src/js/core/video.js +1 -1
  55. package/src/js/mixin/internal/slideshow-transitioner.js +16 -14
  56. package/src/js/mixin/parallax.js +2 -1
  57. package/src/js/mixin/slider-drag.js +12 -6
  58. package/src/js/mixin/slider-nav.js +1 -1
  59. package/src/js/mixin/slider.js +3 -17
  60. package/src/js/mixin/togglable.js +8 -6
  61. package/src/js/util/lang.js +0 -9
  62. package/tests/modal.html +16 -15
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.16.16-dev.eede5abfb | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
1
+ /*! UIkit 3.16.17-dev.8404b30b4 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -191,14 +191,6 @@
191
191
  const cache = /* @__PURE__ */ Object.create(null);
192
192
  return (key) => cache[key] || (cache[key] = fn(key));
193
193
  }
194
- class Deferred {
195
- constructor() {
196
- this.promise = new Promise((resolve, reject) => {
197
- this.reject = reject;
198
- this.resolve = resolve;
199
- });
200
- }
201
- }
202
194
 
203
195
  function attr(element, name, value) {
204
196
  var _a;
@@ -1529,7 +1521,6 @@
1529
1521
  $: $,
1530
1522
  $$: $$,
1531
1523
  Animation: Animation,
1532
- Deferred: Deferred,
1533
1524
  Dimensions: Dimensions,
1534
1525
  MouseTracker: MouseTracker,
1535
1526
  Transition: Transition,
@@ -2159,7 +2150,7 @@
2159
2150
  };
2160
2151
  App.util = util;
2161
2152
  App.options = {};
2162
- App.version = "3.16.16-dev.eede5abfb";
2153
+ App.version = "3.16.17-dev.8404b30b4";
2163
2154
 
2164
2155
  const PREFIX = "uk-";
2165
2156
  const DATA = "__uikit__";
@@ -2237,7 +2228,7 @@
2237
2228
  component2.options = mergeOptions(component2.options, mixin);
2238
2229
  };
2239
2230
  App.extend = function(options) {
2240
- options = options || {};
2231
+ options || (options = {});
2241
2232
  const Super = this;
2242
2233
  const Sub = function UIkitComponent(options2) {
2243
2234
  init$1(this, options2);
@@ -2435,9 +2426,9 @@
2435
2426
  }
2436
2427
  },
2437
2428
  methods: {
2438
- toggleElement(targets, toggle, animate) {
2439
- return new Promise(
2440
- (resolve) => Promise.all(
2429
+ async toggleElement(targets, toggle, animate) {
2430
+ try {
2431
+ await Promise.all(
2441
2432
  toNodes(targets).map((el) => {
2442
2433
  const show = isBoolean(toggle) ? toggle : !this.isToggled(el);
2443
2434
  if (!trigger(el, `before${show ? "show" : "hide"}`, [this])) {
@@ -2456,8 +2447,11 @@
2456
2447
  return Promise.reject();
2457
2448
  }) : done();
2458
2449
  })
2459
- ).then(resolve, noop)
2460
- );
2450
+ );
2451
+ return true;
2452
+ } catch (e) {
2453
+ return false;
2454
+ }
2461
2455
  },
2462
2456
  isToggled(el = this.$el) {
2463
2457
  el = toNode(el);
@@ -2796,7 +2790,7 @@
2796
2790
  }
2797
2791
  },
2798
2792
  methods: {
2799
- async toggle(item, animate) {
2793
+ toggle(item, animate) {
2800
2794
  item = this.items[getIndex(item, this.items)];
2801
2795
  let items = [item];
2802
2796
  const activeItems = filter$1(this.items, `.${this.clsOpen}`);
@@ -2806,7 +2800,7 @@
2806
2800
  if (!this.collapsible && activeItems.length < 2 && includes(activeItems, item)) {
2807
2801
  return;
2808
2802
  }
2809
- await Promise.all(
2803
+ return Promise.all(
2810
2804
  items.map(
2811
2805
  (el) => this.toggleElement(el, !includes(activeItems, el), (el2, show) => {
2812
2806
  toggleClass(el2, this.clsOpen, show);
@@ -2947,7 +2941,7 @@
2947
2941
  write({ prev, visible, inView }) {
2948
2942
  if (!visible || this.inView && !inView) {
2949
2943
  pause(this.$el);
2950
- } else if (this.autoplay === true && !prev || this.inView && inView) {
2944
+ } else if (this.autoplay === true && !prev || inView) {
2951
2945
  play(this.$el);
2952
2946
  }
2953
2947
  },
@@ -3186,8 +3180,8 @@
3186
3180
  ];
3187
3181
  },
3188
3182
  target({ target, targetX, targetY }, $el) {
3189
- targetX = targetX || target || this.targetEl;
3190
- targetY = targetY || target || this.targetEl;
3183
+ targetX || (targetX = target || this.targetEl);
3184
+ targetY || (targetY = target || this.targetEl);
3191
3185
  return [
3192
3186
  targetX === true ? window : query(targetX, $el),
3193
3187
  targetY === true ? window : query(targetY, $el)
@@ -4968,22 +4962,21 @@
4968
4962
  modal.alert = function(message, options) {
4969
4963
  return openDialog(
4970
4964
  ({ i18n }) => `<div class="uk-modal-body">${isString(message) ? message : html(message)}</div> <div class="uk-modal-footer uk-text-right"> <button class="uk-button uk-button-primary uk-modal-close" autofocus>${i18n.ok}</button> </div>`,
4971
- options,
4972
- (deferred) => deferred.resolve()
4965
+ options
4973
4966
  );
4974
4967
  };
4975
4968
  modal.confirm = function(message, options) {
4976
4969
  return openDialog(
4977
4970
  ({ i18n }) => `<form> <div class="uk-modal-body">${isString(message) ? message : html(message)}</div> <div class="uk-modal-footer uk-text-right"> <button class="uk-button uk-button-default uk-modal-close" type="button">${i18n.cancel}</button> <button class="uk-button uk-button-primary" autofocus>${i18n.ok}</button> </div> </form>`,
4978
4971
  options,
4979
- (deferred) => deferred.reject()
4972
+ () => Promise.reject()
4980
4973
  );
4981
4974
  };
4982
4975
  modal.prompt = function(message, value, options) {
4983
4976
  return openDialog(
4984
4977
  ({ i18n }) => `<form class="uk-form-stacked"> <div class="uk-modal-body"> <label>${isString(message) ? message : html(message)}</label> <input class="uk-input" value="${value || ""}" autofocus> </div> <div class="uk-modal-footer uk-text-right"> <button class="uk-button uk-button-default uk-modal-close" type="button">${i18n.cancel}</button> <button class="uk-button uk-button-primary">${i18n.ok}</button> </div> </form>`,
4985
4978
  options,
4986
- (deferred) => deferred.resolve(null),
4979
+ () => null,
4987
4980
  (dialog) => $("input", dialog.$el).value
4988
4981
  );
4989
4982
  };
@@ -4991,7 +4984,7 @@
4991
4984
  ok: "Ok",
4992
4985
  cancel: "Cancel"
4993
4986
  };
4994
- function openDialog(tmpl, options, hideFn, submitFn) {
4987
+ function openDialog(tmpl, options, hideFn = noop, submitFn = noop) {
4995
4988
  options = {
4996
4989
  bgClose: false,
4997
4990
  escClose: true,
@@ -5000,17 +4993,18 @@
5000
4993
  i18n: { ...modal.i18n, ...options == null ? void 0 : options.i18n }
5001
4994
  };
5002
4995
  const dialog = modal.dialog(tmpl(options), options);
5003
- const deferred = new Deferred();
5004
- let resolved = false;
5005
- on(dialog.$el, "submit", "form", (e) => {
5006
- e.preventDefault();
5007
- deferred.resolve(submitFn == null ? void 0 : submitFn(dialog));
5008
- resolved = true;
5009
- dialog.hide();
5010
- });
5011
- on(dialog.$el, "hide", () => !resolved && hideFn(deferred));
5012
- deferred.promise.dialog = dialog;
5013
- return deferred.promise;
4996
+ return assign(
4997
+ new Promise((resolve) => {
4998
+ const off = on(dialog.$el, "hide", () => resolve(hideFn()));
4999
+ on(dialog.$el, "submit", "form", (e) => {
5000
+ e.preventDefault();
5001
+ resolve(submitFn(dialog));
5002
+ off();
5003
+ dialog.hide();
5004
+ });
5005
+ }),
5006
+ { dialog }
5007
+ );
5014
5008
  }
5015
5009
  }
5016
5010
 
@@ -6004,7 +5998,7 @@
6004
5998
  this.$emit();
6005
5999
  },
6006
6000
  connectChildren() {
6007
- const index = this.index();
6001
+ let index = Math.max(0, this.index());
6008
6002
  for (const el of this.connects) {
6009
6003
  children(el).forEach((child, i) => toggleClass(child, this.cls, i === index));
6010
6004
  }
@@ -6124,11 +6118,10 @@
6124
6118
  });
6125
6119
  const animate = prev >= 0 && prev !== next;
6126
6120
  this.connects.forEach(async ({ children: children2 }) => {
6127
- await this.toggleElement(
6128
- toArray(children2).filter((child) => hasClass(child, this.cls)),
6129
- false,
6130
- animate
6121
+ const actives = toArray(children2).filter(
6122
+ (child, i) => i !== active && hasClass(child, this.cls)
6131
6123
  );
6124
+ await this.toggleElement(actives, false, animate);
6132
6125
  await this.toggleElement(children2[active], true, animate);
6133
6126
  });
6134
6127
  }
@@ -6171,8 +6164,8 @@
6171
6164
  queued: true
6172
6165
  },
6173
6166
  computed: {
6174
- target({ href, target }, $el) {
6175
- target = queryAll(target || href, $el);
6167
+ target({ target }, $el) {
6168
+ target = queryAll(target || $el.hash, $el);
6176
6169
  return target.length && target || [$el];
6177
6170
  }
6178
6171
  },
@@ -6297,11 +6290,12 @@
6297
6290
  return;
6298
6291
  }
6299
6292
  const toggled = this.target.filter(this.isToggled);
6300
- await this.toggleElement(toggled, false);
6301
- await this.toggleElement(
6302
- this.target.filter((el) => !includes(toggled, el)),
6303
- true
6304
- );
6293
+ if (await this.toggleElement(toggled, false)) {
6294
+ await this.toggleElement(
6295
+ this.target.filter((el) => !includes(toggled, el)),
6296
+ true
6297
+ );
6298
+ }
6305
6299
  }
6306
6300
  }
6307
6301
  };
@@ -6648,11 +6642,11 @@
6648
6642
  mixins: [Animate],
6649
6643
  args: "target",
6650
6644
  props: {
6651
- target: Boolean,
6645
+ target: String,
6652
6646
  selActive: Boolean
6653
6647
  },
6654
6648
  data: {
6655
- target: null,
6649
+ target: "",
6656
6650
  selActive: false,
6657
6651
  attrItem: "uk-filter-control",
6658
6652
  cls: "uk-active",
@@ -6856,7 +6850,7 @@
6856
6850
  function Transitioner$1(prev, next, dir, { animation, easing }) {
6857
6851
  const { percent, translate, show = noop } = animation;
6858
6852
  const props = show(dir);
6859
- const deferred = new Deferred();
6853
+ let resolve;
6860
6854
  return {
6861
6855
  dir,
6862
6856
  show(duration, percent2 = 0, linear) {
@@ -6865,25 +6859,27 @@
6865
6859
  this.translate(percent2);
6866
6860
  triggerUpdate$1(next, "itemin", { percent: percent2, duration, timing, dir });
6867
6861
  triggerUpdate$1(prev, "itemout", { percent: 1 - percent2, duration, timing, dir });
6868
- Promise.all([
6869
- Transition.start(next, props[1], duration, timing),
6870
- Transition.start(prev, props[0], duration, timing)
6871
- ]).then(() => {
6872
- this.reset();
6873
- deferred.resolve();
6874
- }, noop);
6875
- return deferred.promise;
6862
+ return new Promise((res) => {
6863
+ resolve || (resolve = res);
6864
+ Promise.all([
6865
+ Transition.start(next, props[1], duration, timing),
6866
+ Transition.start(prev, props[0], duration, timing)
6867
+ ]).then(() => {
6868
+ this.reset();
6869
+ resolve();
6870
+ }, noop);
6871
+ });
6876
6872
  },
6877
6873
  cancel() {
6878
- Transition.cancel([next, prev]);
6874
+ return Transition.cancel([next, prev]);
6879
6875
  },
6880
6876
  reset() {
6881
6877
  for (const prop in props[0]) {
6882
6878
  css([next, prev], prop, "");
6883
6879
  }
6884
6880
  },
6885
- forward(duration, percent2 = this.percent()) {
6886
- Transition.cancel([next, prev]);
6881
+ async forward(duration, percent2 = this.percent()) {
6882
+ await this.cancel();
6887
6883
  return this.show(duration, percent2, true);
6888
6884
  },
6889
6885
  translate(percent2) {
@@ -7066,7 +7062,7 @@
7066
7062
  if (active) {
7067
7063
  focusEl = button;
7068
7064
  }
7069
- focus = focus || matches(button, ":focus");
7065
+ focus || (focus = matches(button, ":focus"));
7070
7066
  } else {
7071
7067
  toggleClass(
7072
7068
  el,
@@ -7162,17 +7158,16 @@
7162
7158
  e.cancelable && e.preventDefault();
7163
7159
  this.dragging = true;
7164
7160
  this.dir = distance < 0 ? 1 : -1;
7165
- const { slides } = this;
7166
- let { prevIndex } = this;
7161
+ let { slides, prevIndex } = this;
7167
7162
  let dis = Math.abs(distance);
7168
- let nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
7169
- let width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
7163
+ let nextIndex = this.getIndex(prevIndex + this.dir);
7164
+ let width = this._getDistance(prevIndex, nextIndex);
7170
7165
  while (nextIndex !== prevIndex && dis > width) {
7171
7166
  this.drag -= width * this.dir;
7172
7167
  prevIndex = nextIndex;
7173
7168
  dis -= width;
7174
- nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
7175
- width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
7169
+ nextIndex = this.getIndex(prevIndex + this.dir);
7170
+ width = this._getDistance(prevIndex, nextIndex);
7176
7171
  }
7177
7172
  this.percent = dis / width;
7178
7173
  const prev = slides[prevIndex];
@@ -7228,6 +7223,9 @@
7228
7223
  }
7229
7224
  css(this.list, { userSelect: "", pointerEvents: "" });
7230
7225
  this.drag = this.percent = null;
7226
+ },
7227
+ _getDistance(prev, next) {
7228
+ return this._getTransitioner(prev, prev !== next && next).getDistance() || this.slides[prev].offsetWidth;
7231
7229
  }
7232
7230
  }
7233
7231
  };
@@ -7417,9 +7415,6 @@
7417
7415
  this.percent
7418
7416
  );
7419
7417
  },
7420
- _getDistance(prev, next) {
7421
- return this._getTransitioner(prev, prev !== next && next).getDistance();
7422
- },
7423
7418
  _translate(percent, prev = this.prevIndex, next = this.index) {
7424
7419
  const transitioner = this._getTransitioner(prev === next ? false : prev, next);
7425
7420
  transitioner.translate(percent);
@@ -7427,8 +7422,8 @@
7427
7422
  },
7428
7423
  _getTransitioner(prev = this.prevIndex, next = this.index, dir = this.dir || 1, options = this.transitionOptions) {
7429
7424
  return new this.Transitioner(
7430
- isNumber(prev) ? this.slides[prev] : prev,
7431
- isNumber(next) ? this.slides[next] : next,
7425
+ this.slides[prev] || prev,
7426
+ this.slides[next] || next,
7432
7427
  dir * (isRtl ? -1 : 1),
7433
7428
  options
7434
7429
  );
@@ -7933,7 +7928,7 @@
7933
7928
  getCss(percent) {
7934
7929
  const css2 = { transform: "", filter: "" };
7935
7930
  for (const prop in this.props) {
7936
- this.props[prop](css2, percent);
7931
+ this.props[prop](css2, clamp(percent));
7937
7932
  }
7938
7933
  css2.willChange = Object.keys(css2).filter((key) => css2[key] !== "").map(propName).join(",");
7939
7934
  return css2;
@@ -8273,9 +8268,9 @@
8273
8268
  };
8274
8269
 
8275
8270
  function Transitioner(prev, next, dir, { center, easing, list }) {
8276
- const deferred = new Deferred();
8277
8271
  const from = prev ? getLeft(prev, list, center) : getLeft(next, list, center) + dimensions$1(next).width * dir;
8278
8272
  const to = next ? getLeft(next, list, center) : from + dimensions$1(prev).width * dir * (isRtl ? -1 : 1);
8273
+ let resolve;
8279
8274
  return {
8280
8275
  dir,
8281
8276
  show(duration, percent = 0, linear) {
@@ -8290,22 +8285,24 @@
8290
8285
  timing,
8291
8286
  dir
8292
8287
  });
8293
- Transition.start(
8294
- list,
8295
- { transform: translate(-to * (isRtl ? -1 : 1), "px") },
8296
- duration,
8297
- timing
8298
- ).then(deferred.resolve, noop);
8299
- return deferred.promise;
8288
+ return new Promise((res) => {
8289
+ resolve || (resolve = res);
8290
+ Transition.start(
8291
+ list,
8292
+ { transform: translate(-to * (isRtl ? -1 : 1), "px") },
8293
+ duration,
8294
+ timing
8295
+ ).then(resolve, noop);
8296
+ });
8300
8297
  },
8301
8298
  cancel() {
8302
- Transition.cancel(list);
8299
+ return Transition.cancel(list);
8303
8300
  },
8304
8301
  reset() {
8305
8302
  css(list, "transform", "");
8306
8303
  },
8307
- forward(duration, percent = this.percent()) {
8308
- Transition.cancel(list);
8304
+ async forward(duration, percent = this.percent()) {
8305
+ await this.cancel();
8309
8306
  return this.show(duration, percent, true);
8310
8307
  },
8311
8308
  translate(percent) {
@@ -8442,7 +8439,7 @@
8442
8439
  left = 0;
8443
8440
  }
8444
8441
  if (this.center) {
8445
- if (left < width / 2 && left + slideWidth + dimensions$1(this.slides[+i + 1]).width / 2 > width / 2) {
8442
+ if (left < width / 2 && left + slideWidth + dimensions$1(getIndex(+i + 1, this.slides)).width / 2 > width / 2) {
8446
8443
  sets.push(+i);
8447
8444
  left = width / 2 - slideWidth / 2;
8448
8445
  }
@@ -9148,7 +9145,7 @@
9148
9145
  cls: "uk-active"
9149
9146
  },
9150
9147
  beforeConnect() {
9151
- this.id = generateId(this);
9148
+ this.id = generateId(this, {});
9152
9149
  this._hasTitle = hasAttr(this.$el, "title");
9153
9150
  attr(this.$el, {
9154
9151
  title: "",
@@ -9175,14 +9172,13 @@
9175
9172
  return;
9176
9173
  }
9177
9174
  clearTimeout(this.showTimer);
9178
- if (!this.isToggled(this.tooltip || null)) {
9179
- return;
9175
+ if (this.isToggled(this.tooltip || null)) {
9176
+ await this.toggleElement(this.tooltip, false, false);
9180
9177
  }
9181
- await this.toggleElement(this.tooltip, false, false);
9182
9178
  remove$1(this.tooltip);
9183
9179
  this.tooltip = null;
9184
9180
  },
9185
- _show() {
9181
+ async _show() {
9186
9182
  this.tooltip = append(
9187
9183
  this.container,
9188
9184
  `<div id="${this.id}" class="uk-${this.$options.name}" role="tooltip"> <div class="uk-${this.$options.name}-inner">${this.title}</div> </div>`
@@ -9211,7 +9207,9 @@
9211
9207
  self: true
9212
9208
  });
9213
9209
  });
9214
- this.toggleElement(this.tooltip, true);
9210
+ if (!await this.toggleElement(this.tooltip, true)) {
9211
+ this.hide();
9212
+ }
9215
9213
  }
9216
9214
  },
9217
9215
  events: {