uikit 3.13.8-dev.598ad9a8b → 3.13.8-dev.6e328ba86

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 (83) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/dist/css/uikit-core-rtl.css +41 -5
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +41 -5
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +41 -3
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +41 -3
  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 +5 -2
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +5 -2
  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 +13 -10
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +13 -10
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +1 -1
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +13 -10
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +1 -1
  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 +41 -49
  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 +107 -146
  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 +147 -150
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +5 -5
  43. package/src/js/api/hooks.js +1 -1
  44. package/src/js/components/lightbox-panel.js +4 -1
  45. package/src/js/components/tooltip.js +38 -3
  46. package/src/js/core/accordion.js +1 -1
  47. package/src/js/core/drop.js +10 -6
  48. package/src/js/core/height-match.js +7 -16
  49. package/src/js/core/navbar.js +18 -8
  50. package/src/js/core/scrollspy.js +45 -26
  51. package/src/js/core/sticky.js +2 -2
  52. package/src/js/core/toggle.js +1 -1
  53. package/src/js/mixin/media.js +12 -9
  54. package/src/js/mixin/position.js +4 -43
  55. package/src/js/uikit-core.js +0 -4
  56. package/src/js/util/position.js +4 -1
  57. package/src/less/components/dropdown.less +11 -1
  58. package/src/less/components/icon.less +3 -0
  59. package/src/less/components/nav.less +22 -0
  60. package/src/less/components/navbar.less +26 -2
  61. package/src/less/components/search.less +2 -0
  62. package/src/less/theme/dropdown.less +4 -0
  63. package/src/less/theme/nav.less +6 -0
  64. package/src/less/theme/navbar.less +4 -0
  65. package/src/less/theme/search.less +6 -0
  66. package/src/scss/components/dropdown.scss +11 -1
  67. package/src/scss/components/icon.scss +3 -0
  68. package/src/scss/components/nav.scss +22 -0
  69. package/src/scss/components/navbar.scss +26 -2
  70. package/src/scss/components/search.scss +2 -0
  71. package/src/scss/mixins-theme.scss +5 -0
  72. package/src/scss/mixins.scss +5 -0
  73. package/src/scss/theme/dropdown.scss +4 -0
  74. package/src/scss/theme/nav.scss +6 -0
  75. package/src/scss/theme/navbar.scss +4 -0
  76. package/src/scss/theme/search.scss +6 -0
  77. package/src/scss/variables-theme.scss +5 -1
  78. package/src/scss/variables.scss +5 -1
  79. package/tests/drop.html +0 -6
  80. package/tests/dropdown.html +18 -10
  81. package/tests/nav.html +27 -0
  82. package/tests/navbar.html +55 -4
  83. package/src/js/core/core.js +0 -25
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.13.8-dev.598ad9a8b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.13.8-dev.6e328ba86 | 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() :
@@ -1740,11 +1740,11 @@
1740
1740
  }
1741
1741
  }
1742
1742
 
1743
- const stateKey$1 = '_ukPlayer';
1743
+ const stateKey = '_ukPlayer';
1744
1744
  let counter = 0;
1745
1745
  function enableApi(el) {
1746
- if (el[stateKey$1]) {
1747
- return el[stateKey$1];
1746
+ if (el[stateKey]) {
1747
+ return el[stateKey];
1748
1748
  }
1749
1749
 
1750
1750
  const youtube = isYoutube(el);
@@ -1753,7 +1753,7 @@
1753
1753
  const id = ++counter;
1754
1754
  let poller;
1755
1755
 
1756
- return el[stateKey$1] = new Promise((resolve) => {
1756
+ return el[stateKey] = new Promise((resolve) => {
1757
1757
  youtube &&
1758
1758
  once(el, 'load', () => {
1759
1759
  const listener = () => post(el, { event: 'listening', id });
@@ -2006,7 +2006,10 @@
2006
2006
  const willFlip =
2007
2007
  !intersectLine(position, targetDim, i) && intersectLine(position, targetDim, 1 - i);
2008
2008
 
2009
- viewport = getIntersectionArea(...viewports, willFlip ? null : boundary);
2009
+ viewport = getIntersectionArea(
2010
+ ...viewports,
2011
+ willFlip || position[prop] > offset(boundary)[prop] ? null : boundary);
2012
+
2010
2013
  const isInStartBoundary = position[start] >= viewport[start];
2011
2014
  const isInEndBoundary = position[end] <= viewport[end];
2012
2015
 
@@ -2408,7 +2411,7 @@
2408
2411
  const {
2409
2412
  $options: { computed } } =
2410
2413
  this;
2411
- const values = { ...this._computed };
2414
+ const values = { ...(initial ? {} : this._computed) };
2412
2415
  this._computed = {};
2413
2416
 
2414
2417
  for (const key in computed) {
@@ -2888,7 +2891,7 @@
2888
2891
  UIkit.data = '__uikit__';
2889
2892
  UIkit.prefix = 'uk-';
2890
2893
  UIkit.options = {};
2891
- UIkit.version = '3.13.8-dev.598ad9a8b';
2894
+ UIkit.version = '3.13.8-dev.6e328ba86';
2892
2895
 
2893
2896
  globalAPI(UIkit);
2894
2897
  hooksAPI(UIkit);
@@ -2896,30 +2899,6 @@
2896
2899
  componentAPI(UIkit);
2897
2900
  instanceAPI(UIkit);
2898
2901
 
2899
- function Core () {
2900
- if (!inBrowser) {
2901
- return;
2902
- }
2903
-
2904
- let started = 0;
2905
- on(
2906
- document,
2907
- 'animationstart',
2908
- (_ref) => {let { target } = _ref;
2909
- if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
2910
- started++;
2911
- css(document.documentElement, 'overflowX', 'hidden');
2912
- setTimeout(() => {
2913
- if (! --started) {
2914
- css(document.documentElement, 'overflowX', '');
2915
- }
2916
- }, toMs(css(target, 'animationDuration')) + 100);
2917
- }
2918
- },
2919
- true);
2920
-
2921
- }
2922
-
2923
2902
  function boot (UIkit) {
2924
2903
  const { connect, disconnect } = UIkit;
2925
2904
 
@@ -3215,7 +3194,7 @@
3215
3194
  computed: {
3216
3195
  items: {
3217
3196
  get(_ref, $el) {let { targets } = _ref;
3218
- return $$(targets, $el);
3197
+ return $$(targets, $el).filter((el) => $(this.content, el));
3219
3198
  },
3220
3199
 
3221
3200
  watch(items, prev) {
@@ -3502,21 +3481,19 @@
3502
3481
 
3503
3482
  connected() {
3504
3483
  this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
3505
- this.dir = this.pos[0];
3506
- this.align = this.pos[1];
3484
+ this.axis = includes(['top', 'bottom'], this.pos[0]) ? 'y' : 'x';
3507
3485
  },
3508
3486
 
3509
3487
  methods: {
3510
3488
  positionAt(element, target, boundary) {
3511
3489
  const [dir, align] = this.pos;
3512
- const axis = this.getAxis(dir);
3513
3490
 
3514
3491
  let { offset: offset$1 } = this;
3515
3492
  if (!isNumeric(offset$1)) {
3516
3493
  const node = $(offset$1);
3517
3494
  offset$1 = node ?
3518
- offset(node)[axis === 'x' ? 'left' : 'top'] -
3519
- offset(target)[axis === 'x' ? 'right' : 'bottom'] :
3495
+ offset(node)[this.axis === 'x' ? 'left' : 'top'] -
3496
+ offset(target)[this.axis === 'x' ? 'right' : 'bottom'] :
3520
3497
  0;
3521
3498
  }
3522
3499
  offset$1 = toPx(offset$1) + toPx(getCssVar('position-offset', element));
@@ -3527,7 +3504,7 @@
3527
3504
  target: [dir, align] };
3528
3505
 
3529
3506
 
3530
- if (axis === 'y') {
3507
+ if (this.axis === 'y') {
3531
3508
  for (const prop in attach) {
3532
3509
  attach[prop] = attach[prop].reverse();
3533
3510
  }
@@ -3540,47 +3517,8 @@
3540
3517
  boundary,
3541
3518
  flip: this.flip });
3542
3519
 
3543
-
3544
- [this.dir, this.align] = getAlignment(element, target, this.pos);
3545
- },
3546
-
3547
- getAxis(dir) {if (dir === void 0) {dir = this.dir;}
3548
- return includes(['top', 'bottom'], dir) ? 'y' : 'x';
3549
3520
  } } };
3550
3521
 
3551
-
3552
-
3553
- function getAlignment(el, target, _ref) {let [dir, align] = _ref;
3554
- const elOffset = offset(el);
3555
- const targetOffset = offset(target);
3556
- const properties = [
3557
- ['left', 'right'],
3558
- ['top', 'bottom']];
3559
-
3560
-
3561
- for (const props of properties) {
3562
- if (elOffset[props[0]] >= targetOffset[props[1]]) {
3563
- dir = props[1];
3564
- break;
3565
- }
3566
- if (elOffset[props[1]] <= targetOffset[props[0]]) {
3567
- dir = props[0];
3568
- break;
3569
- }
3570
- }
3571
-
3572
- const props = includes(properties[0], dir) ? properties[1] : properties[0];
3573
- if (elOffset[props[0]] === targetOffset[props[0]]) {
3574
- align = props[0];
3575
- } else if (elOffset[props[1]] === targetOffset[props[1]]) {
3576
- align = props[1];
3577
- } else {
3578
- align = 'center';
3579
- }
3580
-
3581
- return [dir, align];
3582
- }
3583
-
3584
3522
  let active$1;
3585
3523
 
3586
3524
  var drop = {
@@ -3615,8 +3553,11 @@
3615
3553
  this.tracker = new MouseTracker();
3616
3554
  },
3617
3555
 
3618
- connected() {
3556
+ beforeConnect() {
3619
3557
  this.clsDrop = this.$props.clsDrop || "uk-" + this.$options.name;
3558
+ },
3559
+
3560
+ connected() {
3620
3561
  addClass(this.$el, this.clsDrop);
3621
3562
 
3622
3563
  if (this.toggle && !this.target) {
@@ -3912,17 +3853,18 @@
3912
3853
  const boundaryOffset = offset(boundary);
3913
3854
  const targetOffset = offset(this.target);
3914
3855
  const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
3856
+ const prop = this.axis === 'y' ? 'width' : 'height';
3857
+
3858
+ css(this.$el, "max-" + prop, '');
3915
3859
 
3916
3860
  if (this.pos[1] === 'justify') {
3917
- const prop = this.getAxis() === 'y' ? 'width' : 'height';
3918
3861
  css(this.$el, prop, alignTo[prop]);
3919
- } else if (
3920
- this.$el.offsetWidth >
3921
- Math.max(boundaryOffset.right - alignTo.left, alignTo.right - boundaryOffset.left))
3922
- {
3862
+ } else if (this.$el.offsetWidth > boundaryOffset.width) {
3923
3863
  addClass(this.$el, this.clsDrop + "-stack");
3924
3864
  }
3925
3865
 
3866
+ css(this.$el, "max-" + prop, boundaryOffset[prop]);
3867
+
3926
3868
  this.positionAt(this.$el, this.boundaryAlign ? boundary : this.target, boundary);
3927
3869
  } } };
3928
3870
 
@@ -4322,8 +4264,7 @@
4322
4264
 
4323
4265
  data: {
4324
4266
  target: '> *',
4325
- row: true,
4326
- forceHeight: true },
4267
+ row: true },
4327
4268
 
4328
4269
 
4329
4270
  computed: {
@@ -4364,22 +4305,14 @@
4364
4305
  return { heights: [''], elements };
4365
4306
  }
4366
4307
 
4308
+ css(elements, 'minHeight', '');
4367
4309
  let heights = elements.map(getHeight);
4368
- let max = Math.max(...heights);
4369
- const hasMinHeight = elements.some((el) => el.style.minHeight);
4370
- const hasShrunk = elements.some((el, i) => !el.style.minHeight && heights[i] < max);
4371
-
4372
- if (hasMinHeight && hasShrunk) {
4373
- css(elements, 'minHeight', '');
4374
- heights = elements.map(getHeight);
4375
- max = Math.max(...heights);
4376
- }
4377
-
4378
- heights = elements.map((el, i) =>
4379
- heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max);
4310
+ const max = Math.max(...heights);
4380
4311
 
4312
+ return {
4313
+ heights: elements.map((el, i) => heights[i].toFixed(2) === max.toFixed(2) ? '' : max),
4314
+ elements };
4381
4315
 
4382
- return { heights, elements };
4383
4316
  }
4384
4317
 
4385
4318
  function getHeight(element) {
@@ -5036,16 +4969,19 @@
5036
4969
 
5037
4970
  connected() {
5038
4971
  const media = toMedia(this.media);
5039
- this.mediaObj = window.matchMedia(media);
5040
- const handler = () => {
5041
- this.matchMedia = this.mediaObj.matches;
5042
- trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
5043
- };
5044
- this.offMediaObj = on(this.mediaObj, 'change', () => {
4972
+ this.matchMedia = true;
4973
+ if (media) {
4974
+ this.mediaObj = window.matchMedia(media);
4975
+ const handler = () => {
4976
+ this.matchMedia = this.mediaObj.matches;
4977
+ trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
4978
+ };
4979
+ this.offMediaObj = on(this.mediaObj, 'change', () => {
4980
+ handler();
4981
+ this.$emit('resize');
4982
+ });
5045
4983
  handler();
5046
- this.$emit('resize');
5047
- });
5048
- handler();
4984
+ }
5049
4985
  },
5050
4986
 
5051
4987
  disconnected() {var _this$offMediaObj;
@@ -5512,8 +5448,6 @@
5512
5448
  toggle: '> a',
5513
5449
  content: '> ul' } };
5514
5450
 
5515
- const navItem = '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle';
5516
-
5517
5451
  var navbar = {
5518
5452
  mixins: [Class, Container],
5519
5453
 
@@ -5533,7 +5467,7 @@
5533
5467
 
5534
5468
 
5535
5469
  data: {
5536
- dropdown: navItem,
5470
+ dropdown: '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle',
5537
5471
  align: isRtl ? 'right' : 'left',
5538
5472
  clsDrop: 'uk-navbar-dropdown',
5539
5473
  mode: undefined,
@@ -5546,8 +5480,6 @@
5546
5480
  dropbar: false,
5547
5481
  dropbarAnchor: false,
5548
5482
  duration: 200,
5549
- forceHeight: true,
5550
- selMinHeight: navItem,
5551
5483
  container: false },
5552
5484
 
5553
5485
 
@@ -5621,9 +5553,23 @@
5621
5553
  immediate: true },
5622
5554
 
5623
5555
 
5624
- toggles(_ref6, $el) {let { dropdown } = _ref6;
5625
- return $$(dropdown, $el);
5626
- } },
5556
+ toggles: {
5557
+ get(_ref6, $el) {let { dropdown } = _ref6;
5558
+ return $$(dropdown, $el);
5559
+ },
5560
+
5561
+ watch() {
5562
+ const justify = hasClass(this.$el, 'uk-navbar-justify');
5563
+ for (const container of $$(
5564
+ '.uk-navbar-nav, .uk-navbar-left, .uk-navbar-right',
5565
+ this.$el))
5566
+ {
5567
+ css(container, 'flexGrow', justify ? $$(this.dropdown, container).length : '');
5568
+ }
5569
+ },
5570
+
5571
+ immediate: true } },
5572
+
5627
5573
 
5628
5574
 
5629
5575
  disconnected() {
@@ -5784,7 +5730,7 @@
5784
5730
  return this.dropbar;
5785
5731
  },
5786
5732
 
5787
- handler(_, _ref10) {let { $el, dir } = _ref10;
5733
+ handler(_, _ref10) {let { $el, pos: [dir] = [] } = _ref10;
5788
5734
  if (!hasClass($el, this.clsDrop)) {
5789
5735
  return;
5790
5736
  }
@@ -6329,7 +6275,6 @@
6329
6275
  return document.getElementById(decodeURIComponent(el.hash).substring(1));
6330
6276
  }
6331
6277
 
6332
- const stateKey = '_ukScrollspy';
6333
6278
  var scrollspy = {
6334
6279
  mixins: [Scroll],
6335
6280
 
@@ -6362,43 +6307,64 @@
6362
6307
  return target ? $$(target, $el) : [$el];
6363
6308
  },
6364
6309
 
6365
- watch(elements) {
6310
+ watch(elements, prev) {
6366
6311
  if (this.hidden) {
6367
6312
  css(filter$1(elements, ":not(." + this.inViewClass + ")"), 'visibility', 'hidden');
6368
6313
  }
6314
+
6315
+ if (prev) {
6316
+ this.$reset();
6317
+ }
6369
6318
  },
6370
6319
 
6371
6320
  immediate: true } },
6372
6321
 
6373
6322
 
6374
6323
 
6375
- disconnected() {
6376
- for (const el of this.elements) {var _el$stateKey;
6377
- removeClass(el, this.inViewClass, ((_el$stateKey = el[stateKey]) == null ? void 0 : _el$stateKey.cls) || '');
6378
- delete el[stateKey];
6379
- }
6380
- },
6324
+ connected() {
6325
+ this._data.elements = new Map();
6326
+ this.registerObserver(
6327
+ observeIntersection(
6328
+ this.elements,
6329
+ (records) => {
6330
+ const elements = this._data.elements;
6331
+ for (const { target: el, isIntersecting } of records) {
6332
+ if (!elements.has(el)) {
6333
+ elements.set(el, {
6334
+ cls: data(el, 'uk-scrollspy-class') || this.cls });
6381
6335
 
6382
- update: [
6383
- {
6384
- read() {
6385
- for (const el of this.elements) {
6386
- if (!el[stateKey]) {
6387
- el[stateKey] = { cls: data(el, 'uk-scrollspy-class') || this.cls };
6388
6336
  }
6389
6337
 
6390
- if (!this.repeat && el[stateKey].show) {
6338
+ const state = elements.get(el);
6339
+ if (!this.repeat && state.show) {
6391
6340
  continue;
6392
6341
  }
6393
6342
 
6394
- el[stateKey].show = isInView(el, this.offsetTop, this.offsetLeft);
6343
+ state.show = isIntersecting;
6395
6344
  }
6345
+
6346
+ this.$emit();
6396
6347
  },
6348
+ {
6349
+ rootMargin: toPx(this.offsetTop, 'height') - 1 + "px " + (
6350
+ toPx(this.offsetLeft, 'width') - 1) + "px" },
6397
6351
 
6398
- write(data) {
6399
- for (const el of this.elements) {
6400
- const state = el[stateKey];
6401
6352
 
6353
+ false));
6354
+
6355
+
6356
+ },
6357
+
6358
+ disconnected() {
6359
+ for (const [el, state] of this._data.elements.entries()) {
6360
+ removeClass(el, this.inViewClass, (state == null ? void 0 : state.cls) || '');
6361
+ }
6362
+ },
6363
+
6364
+ update: [
6365
+ {
6366
+ write(data) {
6367
+ for (const [el, state] of data.elements.entries()) {
6402
6368
  if (state.show && !state.inview && !state.queued) {
6403
6369
  state.queued = true;
6404
6370
 
@@ -6415,15 +6381,13 @@
6415
6381
  this.toggle(el, false);
6416
6382
  }
6417
6383
  }
6418
- },
6419
-
6420
- events: ['scroll', 'resize'] }],
6384
+ } }],
6421
6385
 
6422
6386
 
6423
6387
 
6424
6388
  methods: {
6425
6389
  toggle(el, inview) {
6426
- const state = el[stateKey];
6390
+ const state = this._data.elements.get(el);
6427
6391
 
6428
6392
  state.off == null ? void 0 : state.off();
6429
6393
 
@@ -6646,13 +6610,13 @@
6646
6610
  return false;
6647
6611
  }
6648
6612
 
6649
- const hide = this.isActive && types.has('resize');
6613
+ const hide = this.active && types.has('resize');
6650
6614
  if (hide) {
6651
6615
  css(this.selTarget, 'transition', '0s');
6652
6616
  this.hide();
6653
6617
  }
6654
6618
 
6655
- if (!this.isActive) {
6619
+ if (!this.active) {
6656
6620
  height$1 = offset(this.$el).height;
6657
6621
  margin = css(this.$el, 'margin');
6658
6622
  }
@@ -7174,7 +7138,7 @@
7174
7138
  }
7175
7139
 
7176
7140
  // Skip if state does not change e.g. hover + focus received
7177
- if (this._showState && show === (expanded !== this._showState)) {
7141
+ if (this._showState && show && expanded !== this._showState) {
7178
7142
  // Ensure reset if state has changed through click
7179
7143
  if (!show) {
7180
7144
  this._showState = null;
@@ -7350,9 +7314,6 @@
7350
7314
  // register components
7351
7315
  each(components$1, (component, name) => UIkit.component(name, component));
7352
7316
 
7353
- // core functionality
7354
- UIkit.use(Core);
7355
-
7356
7317
  boot(UIkit);
7357
7318
 
7358
7319
  const units = ['days', 'hours', 'minutes', 'seconds'];
@@ -8847,7 +8808,10 @@
8847
8808
 
8848
8809
 
8849
8810
  // Image
8850
- if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
8811
+ if (
8812
+ type === 'image' ||
8813
+ src.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i))
8814
+ {
8851
8815
  try {
8852
8816
  const { width, height } = await getImage(src, attrs.srcset, attrs.size);
8853
8817
  this.setItem(item, createEl('img', { src, width, height, alt, ...attrs }));
@@ -10766,10 +10730,12 @@
10766
10730
 
10767
10731
  this.positionAt(this.tooltip, this.$el);
10768
10732
 
10733
+ const [dir, align] = getAlignment(this.tooltip, this.$el, this.pos);
10734
+
10769
10735
  this.origin =
10770
- this.getAxis() === 'y' ?
10771
- flipPosition(this.dir) + "-" + this.align :
10772
- this.align + "-" + flipPosition(this.dir);
10736
+ this.axis === 'y' ?
10737
+ flipPosition(dir) + "-" + align :
10738
+ align + "-" + flipPosition(dir);
10773
10739
  });
10774
10740
 
10775
10741
  this.toggleElement(this.tooltip, true);
@@ -10806,6 +10772,37 @@
10806
10772
  }
10807
10773
  }
10808
10774
 
10775
+ function getAlignment(el, target, _ref) {let [dir, align] = _ref;
10776
+ const elOffset = offset(el);
10777
+ const targetOffset = offset(target);
10778
+ const properties = [
10779
+ ['left', 'right'],
10780
+ ['top', 'bottom']];
10781
+
10782
+
10783
+ for (const props of properties) {
10784
+ if (elOffset[props[0]] >= targetOffset[props[1]]) {
10785
+ dir = props[1];
10786
+ break;
10787
+ }
10788
+ if (elOffset[props[1]] <= targetOffset[props[0]]) {
10789
+ dir = props[0];
10790
+ break;
10791
+ }
10792
+ }
10793
+
10794
+ const props = includes(properties[0], dir) ? properties[1] : properties[0];
10795
+ if (elOffset[props[0]] === targetOffset[props[0]]) {
10796
+ align = props[0];
10797
+ } else if (elOffset[props[1]] === targetOffset[props[1]]) {
10798
+ align = props[1];
10799
+ } else {
10800
+ align = 'center';
10801
+ }
10802
+
10803
+ return [dir, align];
10804
+ }
10805
+
10809
10806
  var upload = {
10810
10807
  props: {
10811
10808
  allow: String,