uikit 3.15.6-dev.fb448ac28 → 3.15.7-dev.3ec9925a1

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 +13 -1
  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 +2 -2
  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 +36 -10
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +36 -10
  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 +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +7 -6
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +7 -6
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +2 -2
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +3 -4
  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 +121 -104
  37. package/dist/js/uikit-core.min.js +2 -2
  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 -111
  41. package/dist/js/uikit.min.js +2 -2
  42. package/package.json +2 -2
  43. package/src/js/api/boot.js +6 -8
  44. package/src/js/api/component.js +18 -21
  45. package/src/js/api/instance.js +6 -11
  46. package/src/js/api/state.js +11 -11
  47. package/src/js/components/tooltip.js +2 -3
  48. package/src/js/core/accordion.js +41 -33
  49. package/src/js/core/drop.js +10 -4
  50. package/src/js/core/icon.js +1 -1
  51. package/src/js/core/offcanvas.js +0 -14
  52. package/src/js/core/scrollspy-nav.js +2 -1
  53. package/src/js/mixin/class.js +2 -2
  54. package/src/js/mixin/modal.js +25 -0
  55. package/src/js/mixin/slider-drag.js +5 -4
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.15.6-dev.fb448ac28 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.15.7-dev.3ec9925a1 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2536,7 +2536,7 @@
2536
2536
  UIkit.prototype._initProps = function (props) {
2537
2537
  let key;
2538
2538
 
2539
- props = props || getProps(this.$options, this.$name);
2539
+ props = props || getProps(this.$options);
2540
2540
 
2541
2541
  for (key in props) {
2542
2542
  if (!isUndefined(props[key])) {
@@ -2587,9 +2587,9 @@
2587
2587
  };
2588
2588
  }
2589
2589
 
2590
- function getProps(opts, name) {
2590
+ function getProps(opts) {
2591
2591
  const data$1 = {};
2592
- const { args = [], props = {}, el } = opts;
2592
+ const { args = [], props = {}, el, id } = opts;
2593
2593
 
2594
2594
  if (!props) {
2595
2595
  return data$1;
@@ -2612,7 +2612,7 @@
2612
2612
  data$1[key] = value;
2613
2613
  }
2614
2614
 
2615
- const options = parseOptions(data(el, name), args);
2615
+ const options = parseOptions(data(el, id), args);
2616
2616
 
2617
2617
  for (const key in options) {
2618
2618
  const prop = camelize(key);
@@ -2740,24 +2740,24 @@
2740
2740
  }
2741
2741
 
2742
2742
  function initPropsObserver(component) {
2743
- const { $name, $options, $props } = component;
2744
- const { attrs, props, el } = $options;
2743
+ const { $options, $props } = component;
2744
+ const { id, attrs, props, el } = $options;
2745
2745
 
2746
2746
  if (!props || attrs === false) {
2747
2747
  return;
2748
2748
  }
2749
2749
 
2750
2750
  const attributes = isArray(attrs) ? attrs : Object.keys(props);
2751
- const filter = attributes.map((key) => hyphenate(key)).concat($name);
2751
+ const filter = attributes.map((key) => hyphenate(key)).concat(id);
2752
2752
 
2753
2753
  const observer = new MutationObserver((records) => {
2754
- const data = getProps($options, $name);
2754
+ const data = getProps($options);
2755
2755
  if (
2756
2756
  records.some((_ref3) => {let { attributeName } = _ref3;
2757
2757
  const prop = attributeName.replace('data-', '');
2758
- return (
2759
- prop === $name ? attributes : [camelize(prop), camelize(attributeName)]).
2760
- some((prop) => !isUndefined(data[prop]) && data[prop] !== $props[prop]);
2758
+ return (prop === id ? attributes : [camelize(prop), camelize(attributeName)]).some(
2759
+ (prop) => !isUndefined(data[prop]) && data[prop] !== $props[prop]);
2760
+
2761
2761
  }))
2762
2762
  {
2763
2763
  component.$reset();
@@ -2838,36 +2838,31 @@
2838
2838
 
2839
2839
  UIkit.prototype.$getComponent = UIkit.getComponent;
2840
2840
 
2841
- const componentName = memoize((name) => UIkit.prefix + hyphenate(name));
2842
- Object.defineProperties(UIkit.prototype, {
2843
- $container: Object.getOwnPropertyDescriptor(UIkit, 'container'),
2844
-
2845
- $name: {
2846
- get() {
2847
- return componentName(this.$options.name);
2848
- } } });
2849
-
2841
+ Object.defineProperty(
2842
+ UIkit.prototype,
2843
+ '$container',
2844
+ Object.getOwnPropertyDescriptor(UIkit, 'container'));
2850
2845
 
2851
2846
  }
2852
2847
 
2848
+ const components$2 = {};
2853
2849
  function componentAPI (UIkit) {
2854
- const DATA = UIkit.data;
2855
-
2856
- const components = {};
2850
+ const { data: DATA, prefix: PREFIX } = UIkit;
2857
2851
 
2858
2852
  UIkit.component = function (name, options) {
2859
- const id = hyphenate(name);
2860
-
2861
- name = camelize(id);
2853
+ name = hyphenate(name);
2854
+ const id = PREFIX + name;
2862
2855
 
2863
2856
  if (!options) {
2864
- if (isPlainObject(components[name])) {
2865
- components[name] = UIkit.extend(components[name]);
2857
+ if (isPlainObject(components$2[id])) {
2858
+ components$2[id] = components$2["data-" + id] = UIkit.extend(components$2[id]);
2866
2859
  }
2867
2860
 
2868
- return components[name];
2861
+ return components$2[id];
2869
2862
  }
2870
2863
 
2864
+ name = camelize(name);
2865
+
2871
2866
  UIkit[name] = function (element, data) {
2872
2867
  const component = UIkit.component(name);
2873
2868
 
@@ -2894,15 +2889,16 @@
2894
2889
 
2895
2890
  const opt = isPlainObject(options) ? { ...options } : options.options;
2896
2891
 
2892
+ opt.id = id;
2897
2893
  opt.name = name;
2898
2894
 
2899
2895
  opt.install == null ? void 0 : opt.install(UIkit, opt, name);
2900
2896
 
2901
2897
  if (UIkit._initialized && !opt.functional) {
2902
- requestAnimationFrame(() => UIkit[name]("[uk-" + id + "],[data-uk-" + id + "]"));
2898
+ requestAnimationFrame(() => UIkit[name]("[" + id + "],[data-" + id + "]"));
2903
2899
  }
2904
2900
 
2905
- return components[name] = isPlainObject(options) ? opt : options;
2901
+ return components$2[id] = components$2["data-" + id] = isPlainObject(options) ? opt : options;
2906
2902
  };
2907
2903
 
2908
2904
  UIkit.getComponents = (element) => (element == null ? void 0 : element[DATA]) || {};
@@ -2917,10 +2913,7 @@
2917
2913
 
2918
2914
  for (const attribute of node.attributes) {
2919
2915
  const name = getComponentName(attribute.name);
2920
-
2921
- if (name && name in components) {
2922
- UIkit[name](node);
2923
- }
2916
+ name && UIkit[name](node);
2924
2917
  }
2925
2918
  };
2926
2919
 
@@ -2931,11 +2924,10 @@
2931
2924
  };
2932
2925
  }
2933
2926
 
2934
- const getComponentName = memoize((attribute) => {
2935
- return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-') ?
2936
- camelize(attribute.replace('data-uk-', '').replace('uk-', '')) :
2937
- false;
2938
- });
2927
+ function getComponentName(attribute) {
2928
+ const cmp = components$2[attribute];
2929
+ return cmp && (isPlainObject(cmp) ? cmp : cmp.options).name;
2930
+ }
2939
2931
 
2940
2932
  const UIkit = function (options) {
2941
2933
  this._init(options);
@@ -2945,7 +2937,7 @@
2945
2937
  UIkit.data = '__uikit__';
2946
2938
  UIkit.prefix = 'uk-';
2947
2939
  UIkit.options = {};
2948
- UIkit.version = '3.15.6-dev.fb448ac28';
2940
+ UIkit.version = '3.15.7-dev.3ec9925a1';
2949
2941
 
2950
2942
  globalAPI(UIkit);
2951
2943
  hooksAPI(UIkit);
@@ -2994,25 +2986,23 @@
2994
2986
  }
2995
2987
  }
2996
2988
 
2997
- function applyAttributeMutation(_ref2) {var _UIkit$getComponent;let { target, attributeName } = _ref2;
2989
+ function applyAttributeMutation(_ref2) {let { target, attributeName } = _ref2;
2998
2990
  const name = getComponentName(attributeName);
2999
2991
 
3000
- if (!name || !(name in UIkit)) {
3001
- return;
3002
- }
2992
+ if (name) {var _UIkit$getComponent;
2993
+ if (hasAttr(target, attributeName)) {
2994
+ UIkit[name](target);
2995
+ return;
2996
+ }
3003
2997
 
3004
- if (hasAttr(target, attributeName)) {
3005
- UIkit[name](target);
3006
- return;
2998
+ (_UIkit$getComponent = UIkit.getComponent(target, name)) == null ? void 0 : _UIkit$getComponent.$destroy();
3007
2999
  }
3008
-
3009
- (_UIkit$getComponent = UIkit.getComponent(target, name)) == null ? void 0 : _UIkit$getComponent.$destroy();
3010
3000
  }
3011
3001
  }
3012
3002
 
3013
3003
  var Class = {
3014
3004
  connected() {
3015
- !hasClass(this.$el, this.$name) && addClass(this.$el, this.$name);
3005
+ addClass(this.$el, this.$options.id);
3016
3006
  } };
3017
3007
 
3018
3008
  var Lazyload = {
@@ -3362,52 +3352,46 @@
3362
3352
  return this.targets + " " + this.$props.toggle;
3363
3353
  },
3364
3354
 
3365
- handler(e) {
3355
+ async handler(e) {var _this$_off;
3366
3356
  e.preventDefault();
3367
- this.toggle(index(this.toggles, e.current));
3357
+
3358
+ (_this$_off = this._off) == null ? void 0 : _this$_off.call(this);
3359
+ this._off = keepScrollPosition(e.target);
3360
+ await this.toggle(index(this.toggles, e.current));
3361
+ this._off();
3368
3362
  } }],
3369
3363
 
3370
3364
 
3371
3365
 
3372
3366
  methods: {
3373
- toggle(item, animate) {
3374
- let items = [this.items[getIndex(item, this.items)]];
3367
+ async toggle(item, animate) {
3368
+ item = this.items[getIndex(item, this.items)];
3369
+ let items = [item];
3375
3370
  const activeItems = filter(this.items, "." + this.clsOpen);
3376
3371
 
3377
3372
  if (!this.multiple && !includes(activeItems, items[0])) {
3378
3373
  items = items.concat(activeItems);
3379
3374
  }
3380
3375
 
3381
- if (
3382
- !this.collapsible &&
3383
- activeItems.length < 2 &&
3384
- !filter(items, ":not(." + this.clsOpen + ")").length)
3385
- {
3376
+ if (!this.collapsible && activeItems.length < 2 && includes(activeItems, item)) {
3386
3377
  return;
3387
3378
  }
3388
3379
 
3389
- for (const el of items) {
3390
- this.toggleElement(el, !hasClass(el, this.clsOpen), (el, show) => {
3391
- toggleClass(el, this.clsOpen, show);
3392
- attr($(this.$props.toggle, el), 'aria-expanded', show);
3380
+ await Promise.all(
3381
+ items.map((el) =>
3382
+ this.toggleElement(el, !includes(activeItems, el), (el, show) => {
3383
+ toggleClass(el, this.clsOpen, show);
3384
+ attr($(this.$props.toggle, el), 'aria-expanded', show);
3385
+
3386
+ if (animate === false || !this.animation) {
3387
+ hide($(this.content, el), !show);
3388
+ return;
3389
+ }
3390
+
3391
+ return transition(el, show, this);
3392
+ })));
3393
3393
 
3394
- if (animate === false || !this.animation) {
3395
- hide($(this.content, el), !show);
3396
- return;
3397
- }
3398
3394
 
3399
- return transition(el, show, this).then(() => {
3400
- if (show) {
3401
- const toggle = $(this.$props.toggle, el);
3402
- requestAnimationFrame(() => {
3403
- if (!isInView(toggle)) {
3404
- scrollIntoView(toggle, { offset: this.offset });
3405
- }
3406
- });
3407
- }
3408
- }, noop);
3409
- });
3410
- }
3411
3395
  } } };
3412
3396
 
3413
3397
 
@@ -3448,6 +3432,22 @@
3448
3432
  }
3449
3433
  }
3450
3434
 
3435
+ function keepScrollPosition(el) {
3436
+ const scrollParent = scrollParents(el)[0];
3437
+ let frame;
3438
+ (function scroll() {
3439
+ frame = requestAnimationFrame(() => {
3440
+ const { top } = el.getBoundingClientRect();
3441
+ if (top < 0) {
3442
+ scrollParent.scrollTop += top;
3443
+ }
3444
+ scroll();
3445
+ });
3446
+ })();
3447
+
3448
+ return () => requestAnimationFrame(() => cancelAnimationFrame(frame));
3449
+ }
3450
+
3451
3451
  var alert = {
3452
3452
  mixins: [Class, Togglable],
3453
3453
 
@@ -3804,6 +3804,27 @@
3804
3804
  } },
3805
3805
 
3806
3806
 
3807
+ {
3808
+ name: 'click',
3809
+
3810
+ delegate() {
3811
+ return 'a[href*="#"]';
3812
+ },
3813
+
3814
+ handler(_ref3) {let { current, defaultPrevented } = _ref3;
3815
+ const { hash } = current;
3816
+ if (
3817
+ !defaultPrevented &&
3818
+ hash &&
3819
+ isSameSiteAnchor(current) &&
3820
+ !within(hash, this.$el) &&
3821
+ $(hash, document.body))
3822
+ {
3823
+ this.hide();
3824
+ }
3825
+ } },
3826
+
3827
+
3807
3828
  {
3808
3829
  name: 'toggle',
3809
3830
 
@@ -3872,7 +3893,7 @@
3872
3893
  once(
3873
3894
  this.$el,
3874
3895
  'hide',
3875
- on(document, pointerDown, (_ref3) => {let { target } = _ref3;
3896
+ on(document, pointerDown, (_ref4) => {let { target } = _ref4;
3876
3897
  if (
3877
3898
  last(active$1) !== this ||
3878
3899
  this.overlay && !within(target, this.$el) ||
@@ -3884,7 +3905,7 @@
3884
3905
  once(
3885
3906
  document,
3886
3907
  pointerUp + " " + pointerCancel + " scroll",
3887
- (_ref4) => {let { defaultPrevented, type, target: newTarget } = _ref4;
3908
+ (_ref5) => {let { defaultPrevented, type, target: newTarget } = _ref5;
3888
3909
  if (
3889
3910
  !defaultPrevented &&
3890
3911
  type === pointerUp &&
@@ -3972,7 +3993,7 @@
3972
3993
 
3973
3994
 
3974
3995
 
3975
- function animate(el, show, _ref5) {let { transitionElement, _toggle } = _ref5;
3996
+ function animate(el, show, _ref6) {let { transitionElement, _toggle } = _ref6;
3976
3997
  return new Promise((resolve, reject) =>
3977
3998
  once(el, 'show hide', () => {
3978
3999
  el._reject == null ? void 0 : el._reject();
@@ -4017,7 +4038,7 @@
4017
4038
  on(
4018
4039
  el,
4019
4040
  'touchstart',
4020
- (_ref6) => {let { targetTouches } = _ref6;
4041
+ (_ref7) => {let { targetTouches } = _ref7;
4021
4042
  if (targetTouches.length === 1) {
4022
4043
  startClientY = targetTouches[0].clientY;
4023
4044
  }
@@ -4085,6 +4106,10 @@
4085
4106
  return children;
4086
4107
  }
4087
4108
 
4109
+ function isSameSiteAnchor(a) {
4110
+ return ['origin', 'pathname', 'search'].every((part) => a[part] === location[part]);
4111
+ }
4112
+
4088
4113
  let active;
4089
4114
 
4090
4115
  var drop = {
@@ -4196,11 +4221,17 @@
4196
4221
  name: 'click',
4197
4222
 
4198
4223
  delegate() {
4199
- return 'a[href^="#"]';
4224
+ return 'a[href*="#"]';
4200
4225
  },
4201
4226
 
4202
- handler(_ref3) {let { defaultPrevented, current: { hash } } = _ref3;
4203
- if (!defaultPrevented && hash && !within(hash, this.$el)) {
4227
+ handler(_ref3) {let { defaultPrevented, current } = _ref3;
4228
+ const { hash } = current;
4229
+ if (
4230
+ !defaultPrevented &&
4231
+ hash &&
4232
+ isSameSiteAnchor(current) &&
4233
+ !within(hash, this.$el))
4234
+ {
4204
4235
  this.hide(false);
4205
4236
  }
4206
4237
  } },
@@ -5396,7 +5427,7 @@
5396
5427
 
5397
5428
 
5398
5429
  beforeConnect() {
5399
- addClass(this.$el, this.$name);
5430
+ addClass(this.$el, this.$options.id);
5400
5431
  } };
5401
5432
 
5402
5433
 
@@ -6450,20 +6481,6 @@
6450
6481
 
6451
6482
 
6452
6483
  events: [
6453
- {
6454
- name: 'click',
6455
-
6456
- delegate() {
6457
- return 'a[href^="#"]';
6458
- },
6459
-
6460
- handler(_ref7) {let { current: { hash }, defaultPrevented } = _ref7;
6461
- if (!defaultPrevented && hash && $(hash, document.body)) {
6462
- this.hide();
6463
- }
6464
- } },
6465
-
6466
-
6467
6484
  {
6468
6485
  name: 'touchmove',
6469
6486
 
@@ -6880,7 +6897,7 @@
6880
6897
  computed: {
6881
6898
  links: {
6882
6899
  get(_, $el) {
6883
- return $$('a[href^="#"]', $el).filter((el) => el.hash);
6900
+ return $$('a[href*="#"]', $el).filter((el) => el.hash && isSameSiteAnchor(el));
6884
6901
  },
6885
6902
 
6886
6903
  watch(links) {