vue-tippy 6.0.0-alpha.9 → 6.0.0-beta.0

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.
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * vue-tippy v6.0.0-alpha.8
3
- * (c) 2020 Georges KABBOUCHI
2
+ * vue-tippy v6.0.0-beta.0
3
+ * (c) 2022
4
4
  * @license MIT
5
5
  */
6
- import { ref, getCurrentInstance, onMounted, onUnmounted, isRef, isReactive, watch, isVue2, isVNode, render as render$1, h, defineComponent } from 'vue-demi';
6
+ import { getCurrentInstance, ref, onMounted, onUnmounted, isRef, isReactive, watch, isVNode, render as render$1, h, defineComponent, nextTick, unref, reactive } from 'vue';
7
7
 
8
8
  var top = 'top';
9
9
  var bottom = 'bottom';
@@ -41,10 +41,11 @@ function getNodeName(element) {
41
41
  return element ? (element.nodeName || '').toLowerCase() : null;
42
42
  }
43
43
 
44
- /*:: import type { Window } from '../types'; */
45
-
46
- /*:: declare function getWindow(node: Node | Window): Window; */
47
44
  function getWindow(node) {
45
+ if (node == null) {
46
+ return window;
47
+ }
48
+
48
49
  if (node.toString() !== '[object Window]') {
49
50
  var ownerDocument = node.ownerDocument;
50
51
  return ownerDocument ? ownerDocument.defaultView || window : window;
@@ -53,26 +54,22 @@ function getWindow(node) {
53
54
  return node;
54
55
  }
55
56
 
56
- /*:: declare function isElement(node: mixed): boolean %checks(node instanceof
57
- Element); */
58
-
59
57
  function isElement(node) {
60
58
  var OwnElement = getWindow(node).Element;
61
59
  return node instanceof OwnElement || node instanceof Element;
62
60
  }
63
- /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
64
- HTMLElement); */
65
-
66
61
 
67
62
  function isHTMLElement(node) {
68
63
  var OwnElement = getWindow(node).HTMLElement;
69
64
  return node instanceof OwnElement || node instanceof HTMLElement;
70
65
  }
71
- /*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
72
- ShadowRoot); */
73
-
74
66
 
75
67
  function isShadowRoot(node) {
68
+ // IE 11 has no ShadowRoot
69
+ if (typeof ShadowRoot === 'undefined') {
70
+ return false;
71
+ }
72
+
76
73
  var OwnElement = getWindow(node).ShadowRoot;
77
74
  return node instanceof OwnElement || node instanceof ShadowRoot;
78
75
  }
@@ -121,6 +118,7 @@ function effect(_ref2) {
121
118
  reference: {}
122
119
  };
123
120
  Object.assign(state.elements.popper.style, initialStyles.popper);
121
+ state.styles = initialStyles;
124
122
 
125
123
  if (state.elements.arrow) {
126
124
  Object.assign(state.elements.arrow.style, initialStyles.arrow);
@@ -163,14 +161,67 @@ function getBasePlacement(placement) {
163
161
  return placement.split('-')[0];
164
162
  }
165
163
 
166
- // Returns the layout rect of an element relative to its offsetParent. Layout
164
+ var max = Math.max;
165
+ var min = Math.min;
166
+ var round = Math.round;
167
+
168
+ function getBoundingClientRect(element, includeScale) {
169
+ if (includeScale === void 0) {
170
+ includeScale = false;
171
+ }
172
+
173
+ var rect = element.getBoundingClientRect();
174
+ var scaleX = 1;
175
+ var scaleY = 1;
176
+
177
+ if (isHTMLElement(element) && includeScale) {
178
+ var offsetHeight = element.offsetHeight;
179
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
180
+ // Fallback to 1 in case both values are `0`
181
+
182
+ if (offsetWidth > 0) {
183
+ scaleX = round(rect.width) / offsetWidth || 1;
184
+ }
185
+
186
+ if (offsetHeight > 0) {
187
+ scaleY = round(rect.height) / offsetHeight || 1;
188
+ }
189
+ }
190
+
191
+ return {
192
+ width: rect.width / scaleX,
193
+ height: rect.height / scaleY,
194
+ top: rect.top / scaleY,
195
+ right: rect.right / scaleX,
196
+ bottom: rect.bottom / scaleY,
197
+ left: rect.left / scaleX,
198
+ x: rect.left / scaleX,
199
+ y: rect.top / scaleY
200
+ };
201
+ }
202
+
167
203
  // means it doesn't take into account transforms.
204
+
168
205
  function getLayoutRect(element) {
206
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
207
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
208
+
209
+ var width = element.offsetWidth;
210
+ var height = element.offsetHeight;
211
+
212
+ if (Math.abs(clientRect.width - width) <= 1) {
213
+ width = clientRect.width;
214
+ }
215
+
216
+ if (Math.abs(clientRect.height - height) <= 1) {
217
+ height = clientRect.height;
218
+ }
219
+
169
220
  return {
170
221
  x: element.offsetLeft,
171
222
  y: element.offsetTop,
172
- width: element.offsetWidth,
173
- height: element.offsetHeight
223
+ width: width,
224
+ height: height
174
225
  };
175
226
  }
176
227
 
@@ -220,9 +271,8 @@ function getParentNode(element) {
220
271
  // $FlowFixMe[incompatible-return]
221
272
  // $FlowFixMe[prop-missing]
222
273
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
223
- element.parentNode || // DOM Element detected
224
- // $FlowFixMe[incompatible-return]: need a better way to handle this...
225
- element.host || // ShadowRoot detected
274
+ element.parentNode || ( // DOM Element detected
275
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
226
276
  // $FlowFixMe[incompatible-call]: HTMLElement is a Node
227
277
  getDocumentElement(element) // fallback
228
278
 
@@ -235,29 +285,32 @@ function getTrueOffsetParent(element) {
235
285
  return null;
236
286
  }
237
287
 
238
- var offsetParent = element.offsetParent;
239
-
240
- if (offsetParent) {
241
- var html = getDocumentElement(offsetParent);
242
-
243
- if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
244
- return html;
245
- }
246
- }
247
-
248
- return offsetParent;
288
+ return element.offsetParent;
249
289
  } // `.offsetParent` reports `null` for fixed elements, while absolute elements
250
290
  // return the containing block
251
291
 
252
292
 
253
293
  function getContainingBlock(element) {
294
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
295
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
296
+
297
+ if (isIE && isHTMLElement(element)) {
298
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
299
+ var elementCss = getComputedStyle(element);
300
+
301
+ if (elementCss.position === 'fixed') {
302
+ return null;
303
+ }
304
+ }
305
+
254
306
  var currentNode = getParentNode(element);
255
307
 
256
308
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
257
309
  var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
258
310
  // create a containing block.
311
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
259
312
 
260
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
313
+ if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
261
314
  return currentNode;
262
315
  } else {
263
316
  currentNode = currentNode.parentNode;
@@ -277,7 +330,7 @@ function getOffsetParent(element) {
277
330
  offsetParent = getTrueOffsetParent(offsetParent);
278
331
  }
279
332
 
280
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
333
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
281
334
  return window;
282
335
  }
283
336
 
@@ -288,8 +341,12 @@ function getMainAxisFromPlacement(placement) {
288
341
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
289
342
  }
290
343
 
291
- function within(min, value, max) {
292
- return Math.max(min, Math.min(value, max));
344
+ function within(min$1, value, max$1) {
345
+ return max(min$1, min(value, max$1));
346
+ }
347
+ function withinMaxClamp(min, value, max) {
348
+ var v = within(min, value, max);
349
+ return v > max ? max : v;
293
350
  }
294
351
 
295
352
  function getFreshSideObject() {
@@ -302,7 +359,7 @@ function getFreshSideObject() {
302
359
  }
303
360
 
304
361
  function mergePaddingObject(paddingObject) {
305
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
362
+ return Object.assign({}, getFreshSideObject(), paddingObject);
306
363
  }
307
364
 
308
365
  function expandToHashMap(value, keys) {
@@ -312,11 +369,19 @@ function expandToHashMap(value, keys) {
312
369
  }, {});
313
370
  }
314
371
 
372
+ var toPaddingObject = function toPaddingObject(padding, state) {
373
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
374
+ placement: state.placement
375
+ })) : padding;
376
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
377
+ };
378
+
315
379
  function arrow(_ref) {
316
380
  var _state$modifiersData$;
317
381
 
318
382
  var state = _ref.state,
319
- name = _ref.name;
383
+ name = _ref.name,
384
+ options = _ref.options;
320
385
  var arrowElement = state.elements.arrow;
321
386
  var popperOffsets = state.modifiersData.popperOffsets;
322
387
  var basePlacement = getBasePlacement(state.placement);
@@ -328,7 +393,7 @@ function arrow(_ref) {
328
393
  return;
329
394
  }
330
395
 
331
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
396
+ var paddingObject = toPaddingObject(options.padding, state);
332
397
  var arrowRect = getLayoutRect(arrowElement);
333
398
  var minProp = axis === 'y' ? top : left;
334
399
  var maxProp = axis === 'y' ? bottom : right;
@@ -350,12 +415,9 @@ function arrow(_ref) {
350
415
 
351
416
  function effect$1(_ref2) {
352
417
  var state = _ref2.state,
353
- options = _ref2.options,
354
- name = _ref2.name;
418
+ options = _ref2.options;
355
419
  var _options$element = options.element,
356
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
357
- _options$padding = options.padding,
358
- padding = _options$padding === void 0 ? 0 : _options$padding;
420
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
359
421
 
360
422
  if (arrowElement == null) {
361
423
  return;
@@ -376,9 +438,6 @@ function effect$1(_ref2) {
376
438
  }
377
439
 
378
440
  state.elements.arrow = arrowElement;
379
- state.modifiersData[name + "#persistent"] = {
380
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
381
- };
382
441
  } // eslint-disable-next-line import/no-unused-modules
383
442
 
384
443
 
@@ -392,6 +451,10 @@ var arrow$1 = {
392
451
  requiresIfExists: ['preventOverflow']
393
452
  };
394
453
 
454
+ function getVariation(placement) {
455
+ return placement.split('-')[1];
456
+ }
457
+
395
458
  var unsetSides = {
396
459
  top: 'auto',
397
460
  right: 'auto',
@@ -407,8 +470,8 @@ function roundOffsetsByDPR(_ref) {
407
470
  var win = window;
408
471
  var dpr = win.devicePixelRatio || 1;
409
472
  return {
410
- x: Math.round(x * dpr) / dpr || 0,
411
- y: Math.round(y * dpr) / dpr || 0
473
+ x: round(x * dpr) / dpr || 0,
474
+ y: round(y * dpr) / dpr || 0
412
475
  };
413
476
  }
414
477
 
@@ -418,13 +481,15 @@ function mapToStyles(_ref2) {
418
481
  var popper = _ref2.popper,
419
482
  popperRect = _ref2.popperRect,
420
483
  placement = _ref2.placement,
484
+ variation = _ref2.variation,
421
485
  offsets = _ref2.offsets,
422
486
  position = _ref2.position,
423
487
  gpuAcceleration = _ref2.gpuAcceleration,
424
488
  adaptive = _ref2.adaptive,
425
- roundOffsets = _ref2.roundOffsets;
489
+ roundOffsets = _ref2.roundOffsets,
490
+ isFixed = _ref2.isFixed;
426
491
 
427
- var _ref3 = roundOffsets ? roundOffsetsByDPR(offsets) : offsets,
492
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
428
493
  _ref3$x = _ref3.x,
429
494
  x = _ref3$x === void 0 ? 0 : _ref3$x,
430
495
  _ref3$y = _ref3.y,
@@ -438,23 +503,34 @@ function mapToStyles(_ref2) {
438
503
 
439
504
  if (adaptive) {
440
505
  var offsetParent = getOffsetParent(popper);
506
+ var heightProp = 'clientHeight';
507
+ var widthProp = 'clientWidth';
441
508
 
442
509
  if (offsetParent === getWindow(popper)) {
443
510
  offsetParent = getDocumentElement(popper);
511
+
512
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
513
+ heightProp = 'scrollHeight';
514
+ widthProp = 'scrollWidth';
515
+ }
444
516
  } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
445
517
 
446
- /*:: offsetParent = (offsetParent: Element); */
447
518
 
519
+ offsetParent = offsetParent;
448
520
 
449
- if (placement === top) {
521
+ if (placement === top || (placement === left || placement === right) && variation === end) {
450
522
  sideY = bottom;
451
- y -= offsetParent.clientHeight - popperRect.height;
523
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
524
+ offsetParent[heightProp];
525
+ y -= offsetY - popperRect.height;
452
526
  y *= gpuAcceleration ? 1 : -1;
453
527
  }
454
528
 
455
- if (placement === left) {
529
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
456
530
  sideX = right;
457
- x -= offsetParent.clientWidth - popperRect.width;
531
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
532
+ offsetParent[widthProp];
533
+ x -= offsetX - popperRect.width;
458
534
  x *= gpuAcceleration ? 1 : -1;
459
535
  }
460
536
  }
@@ -466,10 +542,10 @@ function mapToStyles(_ref2) {
466
542
  if (gpuAcceleration) {
467
543
  var _Object$assign;
468
544
 
469
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
545
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
470
546
  }
471
547
 
472
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
548
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
473
549
  }
474
550
 
475
551
  function computeStyles(_ref4) {
@@ -484,13 +560,15 @@ function computeStyles(_ref4) {
484
560
 
485
561
  var commonStyles = {
486
562
  placement: getBasePlacement(state.placement),
563
+ variation: getVariation(state.placement),
487
564
  popper: state.elements.popper,
488
565
  popperRect: state.rects.popper,
489
- gpuAcceleration: gpuAcceleration
566
+ gpuAcceleration: gpuAcceleration,
567
+ isFixed: state.options.strategy === 'fixed'
490
568
  };
491
569
 
492
570
  if (state.modifiersData.popperOffsets != null) {
493
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
571
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
494
572
  offsets: state.modifiersData.popperOffsets,
495
573
  position: state.options.strategy,
496
574
  adaptive: adaptive,
@@ -499,7 +577,7 @@ function computeStyles(_ref4) {
499
577
  }
500
578
 
501
579
  if (state.modifiersData.arrow != null) {
502
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
580
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
503
581
  offsets: state.modifiersData.arrow,
504
582
  position: 'absolute',
505
583
  adaptive: false,
@@ -507,7 +585,7 @@ function computeStyles(_ref4) {
507
585
  })));
508
586
  }
509
587
 
510
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
588
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
511
589
  'data-popper-placement': state.placement
512
590
  });
513
591
  } // eslint-disable-next-line import/no-unused-modules
@@ -591,20 +669,6 @@ function getOppositeVariationPlacement(placement) {
591
669
  });
592
670
  }
593
671
 
594
- function getBoundingClientRect(element) {
595
- var rect = element.getBoundingClientRect();
596
- return {
597
- width: rect.width,
598
- height: rect.height,
599
- top: rect.top,
600
- right: rect.right,
601
- bottom: rect.bottom,
602
- left: rect.left,
603
- x: rect.left,
604
- y: rect.top
605
- };
606
- }
607
-
608
672
  function getWindowScroll(node) {
609
673
  var win = getWindow(node);
610
674
  var scrollLeft = win.pageXOffset;
@@ -667,16 +731,18 @@ function getViewportRect(element) {
667
731
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable
668
732
 
669
733
  function getDocumentRect(element) {
734
+ var _element$ownerDocumen;
735
+
670
736
  var html = getDocumentElement(element);
671
737
  var winScroll = getWindowScroll(element);
672
- var body = element.ownerDocument.body;
673
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
674
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
738
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
739
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
740
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
675
741
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
676
742
  var y = -winScroll.scrollTop;
677
743
 
678
744
  if (getComputedStyle(body || html).direction === 'rtl') {
679
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
745
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
680
746
  }
681
747
 
682
748
  return {
@@ -718,12 +784,14 @@ reference element's position.
718
784
  */
719
785
 
720
786
  function listScrollParents(element, list) {
787
+ var _element$ownerDocumen;
788
+
721
789
  if (list === void 0) {
722
790
  list = [];
723
791
  }
724
792
 
725
793
  var scrollParent = getScrollParent(element);
726
- var isBody = getNodeName(scrollParent) === 'body';
794
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
727
795
  var win = getWindow(scrollParent);
728
796
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
729
797
  var updatedList = list.concat(target);
@@ -732,7 +800,7 @@ function listScrollParents(element, list) {
732
800
  }
733
801
 
734
802
  function rectToClientRect(rect) {
735
- return Object.assign(Object.assign({}, rect), {}, {
803
+ return Object.assign({}, rect, {
736
804
  left: rect.x,
737
805
  top: rect.y,
738
806
  right: rect.x + rect.width,
@@ -754,7 +822,7 @@ function getInnerBoundingClientRect(element) {
754
822
  }
755
823
 
756
824
  function getClientRectFromMixedType(element, clippingParent) {
757
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
825
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
758
826
  } // A "clipping parent" is an overflowable container with the characteristic of
759
827
  // clipping (or hiding) overflowing elements with a position different from
760
828
  // `initial`
@@ -771,7 +839,7 @@ function getClippingParents(element) {
771
839
 
772
840
 
773
841
  return clippingParents.filter(function (clippingParent) {
774
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
842
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
775
843
  });
776
844
  } // Gets the maximum area that the element is visible in due to any number of
777
845
  // clipping parents
@@ -783,10 +851,10 @@ function getClippingRect(element, boundary, rootBoundary) {
783
851
  var firstClippingParent = clippingParents[0];
784
852
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
785
853
  var rect = getClientRectFromMixedType(element, clippingParent);
786
- accRect.top = Math.max(rect.top, accRect.top);
787
- accRect.right = Math.min(rect.right, accRect.right);
788
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
789
- accRect.left = Math.max(rect.left, accRect.left);
854
+ accRect.top = max(rect.top, accRect.top);
855
+ accRect.right = min(rect.right, accRect.right);
856
+ accRect.bottom = min(rect.bottom, accRect.bottom);
857
+ accRect.left = max(rect.left, accRect.left);
790
858
  return accRect;
791
859
  }, getClientRectFromMixedType(element, firstClippingParent));
792
860
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -796,10 +864,6 @@ function getClippingRect(element, boundary, rootBoundary) {
796
864
  return clippingRect;
797
865
  }
798
866
 
799
- function getVariation(placement) {
800
- return placement.split('-')[1];
801
- }
802
-
803
867
  function computeOffsets(_ref) {
804
868
  var reference = _ref.reference,
805
869
  element = _ref.element,
@@ -885,18 +949,17 @@ function detectOverflow(state, options) {
885
949
  padding = _options$padding === void 0 ? 0 : _options$padding;
886
950
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
887
951
  var altContext = elementContext === popper ? reference : popper;
888
- var referenceElement = state.elements.reference;
889
952
  var popperRect = state.rects.popper;
890
953
  var element = state.elements[altBoundary ? altContext : elementContext];
891
954
  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
892
- var referenceClientRect = getBoundingClientRect(referenceElement);
955
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
893
956
  var popperOffsets = computeOffsets({
894
957
  reference: referenceClientRect,
895
958
  element: popperRect,
896
959
  strategy: 'absolute',
897
960
  placement: placement
898
961
  });
899
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
962
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
900
963
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
901
964
  // 0 or negative = within the clipping rect
902
965
 
@@ -920,9 +983,6 @@ function detectOverflow(state, options) {
920
983
  return overflowOffsets;
921
984
  }
922
985
 
923
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
924
-
925
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
926
986
  function computeAutoPlacement(state, options) {
927
987
  if (options === void 0) {
928
988
  options = {};
@@ -1147,7 +1207,7 @@ function hide(_ref) {
1147
1207
  isReferenceHidden: isReferenceHidden,
1148
1208
  hasPopperEscaped: hasPopperEscaped
1149
1209
  };
1150
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1210
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1151
1211
  'data-popper-reference-hidden': isReferenceHidden,
1152
1212
  'data-popper-escaped': hasPopperEscaped
1153
1213
  });
@@ -1166,7 +1226,7 @@ function distanceAndSkiddingToXY(placement, rects, offset) {
1166
1226
  var basePlacement = getBasePlacement(placement);
1167
1227
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1168
1228
 
1169
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1229
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1170
1230
  placement: placement
1171
1231
  })) : offset,
1172
1232
  skidding = _ref[0],
@@ -1272,9 +1332,17 @@ function preventOverflow(_ref) {
1272
1332
  var popperOffsets = state.modifiersData.popperOffsets;
1273
1333
  var referenceRect = state.rects.reference;
1274
1334
  var popperRect = state.rects.popper;
1275
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1335
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1276
1336
  placement: state.placement
1277
1337
  })) : tetherOffset;
1338
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1339
+ mainAxis: tetherOffsetValue,
1340
+ altAxis: tetherOffsetValue
1341
+ } : Object.assign({
1342
+ mainAxis: 0,
1343
+ altAxis: 0
1344
+ }, tetherOffsetValue);
1345
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1278
1346
  var data = {
1279
1347
  x: 0,
1280
1348
  y: 0
@@ -1285,12 +1353,14 @@ function preventOverflow(_ref) {
1285
1353
  }
1286
1354
 
1287
1355
  if (checkMainAxis) {
1356
+ var _offsetModifierState$;
1357
+
1288
1358
  var mainSide = mainAxis === 'y' ? top : left;
1289
1359
  var altSide = mainAxis === 'y' ? bottom : right;
1290
1360
  var len = mainAxis === 'y' ? 'height' : 'width';
1291
1361
  var offset = popperOffsets[mainAxis];
1292
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1293
- var max = popperOffsets[mainAxis] - overflow[altSide];
1362
+ var min$1 = offset + overflow[mainSide];
1363
+ var max$1 = offset - overflow[altSide];
1294
1364
  var additive = tether ? -popperRect[len] / 2 : 0;
1295
1365
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1296
1366
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -1310,30 +1380,42 @@ function preventOverflow(_ref) {
1310
1380
  // width or height)
1311
1381
 
1312
1382
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1313
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1314
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1383
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1384
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1315
1385
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1316
1386
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1317
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1318
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1319
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1320
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1387
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1388
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1389
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1390
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1321
1391
  popperOffsets[mainAxis] = preventedOffset;
1322
1392
  data[mainAxis] = preventedOffset - offset;
1323
1393
  }
1324
1394
 
1325
1395
  if (checkAltAxis) {
1396
+ var _offsetModifierState$2;
1397
+
1326
1398
  var _mainSide = mainAxis === 'x' ? top : left;
1327
1399
 
1328
1400
  var _altSide = mainAxis === 'x' ? bottom : right;
1329
1401
 
1330
1402
  var _offset = popperOffsets[altAxis];
1331
1403
 
1404
+ var _len = altAxis === 'y' ? 'height' : 'width';
1405
+
1332
1406
  var _min = _offset + overflow[_mainSide];
1333
1407
 
1334
1408
  var _max = _offset - overflow[_altSide];
1335
1409
 
1336
- var _preventedOffset = within(_min, _offset, _max);
1410
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1411
+
1412
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1413
+
1414
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1415
+
1416
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1417
+
1418
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1337
1419
 
1338
1420
  popperOffsets[altAxis] = _preventedOffset;
1339
1421
  data[altAxis] = _preventedOffset - _offset;
@@ -1366,16 +1448,24 @@ function getNodeScroll(node) {
1366
1448
  }
1367
1449
  }
1368
1450
 
1451
+ function isElementScaled(element) {
1452
+ var rect = element.getBoundingClientRect();
1453
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1454
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1455
+ return scaleX !== 1 || scaleY !== 1;
1456
+ } // Returns the composite rect of an element relative to its offsetParent.
1369
1457
  // Composite means it takes into account transforms as well as layout.
1370
1458
 
1459
+
1371
1460
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1372
1461
  if (isFixed === void 0) {
1373
1462
  isFixed = false;
1374
1463
  }
1375
1464
 
1376
- var documentElement = getDocumentElement(offsetParent);
1377
- var rect = getBoundingClientRect(elementOrVirtualElement);
1378
1465
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1466
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1467
+ var documentElement = getDocumentElement(offsetParent);
1468
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1379
1469
  var scroll = {
1380
1470
  scrollLeft: 0,
1381
1471
  scrollTop: 0
@@ -1392,7 +1482,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1392
1482
  }
1393
1483
 
1394
1484
  if (isHTMLElement(offsetParent)) {
1395
- offsets = getBoundingClientRect(offsetParent);
1485
+ offsets = getBoundingClientRect(offsetParent, true);
1396
1486
  offsets.x += offsetParent.clientLeft;
1397
1487
  offsets.y += offsetParent.clientTop;
1398
1488
  } else if (documentElement) {
@@ -1470,9 +1560,9 @@ function debounce(fn) {
1470
1560
  function mergeByName(modifiers) {
1471
1561
  var merged = modifiers.reduce(function (merged, current) {
1472
1562
  var existing = merged[current.name];
1473
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1474
- options: Object.assign(Object.assign({}, existing.options), current.options),
1475
- data: Object.assign(Object.assign({}, existing.data), current.data)
1563
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1564
+ options: Object.assign({}, existing.options, current.options),
1565
+ data: Object.assign({}, existing.data, current.data)
1476
1566
  }) : current;
1477
1567
  return merged;
1478
1568
  }, {}); // IE11 does not support Object.values
@@ -1516,7 +1606,7 @@ function popperGenerator(generatorOptions) {
1516
1606
  var state = {
1517
1607
  placement: 'bottom',
1518
1608
  orderedModifiers: [],
1519
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1609
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1520
1610
  modifiersData: {},
1521
1611
  elements: {
1522
1612
  reference: reference,
@@ -1529,9 +1619,10 @@ function popperGenerator(generatorOptions) {
1529
1619
  var isDestroyed = false;
1530
1620
  var instance = {
1531
1621
  state: state,
1532
- setOptions: function setOptions(options) {
1622
+ setOptions: function setOptions(setOptionsAction) {
1623
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1533
1624
  cleanupModifierEffects();
1534
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1625
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1535
1626
  state.scrollParents = {
1536
1627
  reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1537
1628
  popper: listScrollParents(popper)
@@ -1679,10 +1770,12 @@ var createPopper = /*#__PURE__*/popperGenerator({
1679
1770
  }); // eslint-disable-next-line import/no-unused-modules
1680
1771
 
1681
1772
  /**!
1682
- * tippy.js v6.2.7
1683
- * (c) 2017-2020 atomiks
1773
+ * tippy.js v6.3.7
1774
+ * (c) 2017-2021 atomiks
1684
1775
  * MIT License
1685
1776
  */
1777
+
1778
+ var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
1686
1779
  var BOX_CLASS = "tippy-box";
1687
1780
  var CONTENT_CLASS = "tippy-content";
1688
1781
  var BACKDROP_CLASS = "tippy-backdrop";
@@ -1692,6 +1785,9 @@ var TOUCH_OPTIONS = {
1692
1785
  passive: true,
1693
1786
  capture: true
1694
1787
  };
1788
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1789
+ return document.body;
1790
+ };
1695
1791
  function getValueAtIndexOrReturn(value, index, defaultValue) {
1696
1792
  if (Array.isArray(value)) {
1697
1793
  var v = value[index];
@@ -1807,10 +1903,13 @@ function setVisibilityState(els, state) {
1807
1903
  });
1808
1904
  }
1809
1905
  function getOwnerDocument(elementOrElements) {
1906
+ var _element$ownerDocumen;
1907
+
1810
1908
  var _normalizeToArray = normalizeToArray(elementOrElements),
1811
- element = _normalizeToArray[0];
1909
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
1812
1910
 
1813
- return element ? element.ownerDocument || document : document;
1911
+
1912
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1814
1913
  }
1815
1914
  function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1816
1915
  var clientX = event.clientX,
@@ -1846,6 +1945,26 @@ function updateTransitionEndListener(box, action, listener) {
1846
1945
  box[method](event, listener);
1847
1946
  });
1848
1947
  }
1948
+ /**
1949
+ * Compared to xxx.contains, this function works for dom structures with shadow
1950
+ * dom
1951
+ */
1952
+
1953
+ function actualContains(parent, child) {
1954
+ var target = child;
1955
+
1956
+ while (target) {
1957
+ var _target$getRootNode;
1958
+
1959
+ if (parent.contains(target)) {
1960
+ return true;
1961
+ }
1962
+
1963
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
1964
+ }
1965
+
1966
+ return false;
1967
+ }
1849
1968
 
1850
1969
  var currentInput = {
1851
1970
  isTouch: false
@@ -1909,8 +2028,8 @@ function bindGlobalEventListeners() {
1909
2028
  }
1910
2029
 
1911
2030
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1912
- var ua = isBrowser ? navigator.userAgent : '';
1913
- var isIE = /MSIE |Trident\//.test(ua);
2031
+ var isIE11 = isBrowser ? // @ts-ignore
2032
+ !!window.msCrypto : false;
1914
2033
 
1915
2034
  var pluginProps = {
1916
2035
  animateFill: false,
@@ -1930,9 +2049,7 @@ var renderProps = {
1930
2049
  zIndex: 9999
1931
2050
  };
1932
2051
  var defaultProps = Object.assign({
1933
- appendTo: function appendTo() {
1934
- return document.body;
1935
- },
2052
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
1936
2053
  aria: {
1937
2054
  content: 'auto',
1938
2055
  expanded: 'auto'
@@ -1967,7 +2084,7 @@ var defaultProps = Object.assign({
1967
2084
  touch: true,
1968
2085
  trigger: 'mouseenter focus',
1969
2086
  triggerTarget: null
1970
- }, pluginProps, {}, renderProps);
2087
+ }, pluginProps, renderProps);
1971
2088
  var defaultKeys = Object.keys(defaultProps);
1972
2089
  var setDefaultProps = function setDefaultProps(partialProps) {
1973
2090
 
@@ -1983,12 +2100,14 @@ function getExtendedPassedProps(passedProps) {
1983
2100
  defaultValue = plugin.defaultValue;
1984
2101
 
1985
2102
  if (name) {
1986
- acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
2103
+ var _name;
2104
+
2105
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
1987
2106
  }
1988
2107
 
1989
2108
  return acc;
1990
2109
  }, {});
1991
- return Object.assign({}, passedProps, {}, pluginProps);
2110
+ return Object.assign({}, passedProps, pluginProps);
1992
2111
  }
1993
2112
  function getDataAttributeProps(reference, plugins) {
1994
2113
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
@@ -2019,7 +2138,7 @@ function evaluateProps(reference, props) {
2019
2138
  var out = Object.assign({}, props, {
2020
2139
  content: invokeWithArgsOrReturn(props.content, [reference])
2021
2140
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2022
- out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
2141
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2023
2142
  out.aria = {
2024
2143
  expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2025
2144
  content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
@@ -2157,7 +2276,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
2157
2276
 
2158
2277
  var mountedInstances = [];
2159
2278
  function createTippy(reference, passedProps) {
2160
- var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2279
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2161
2280
  // 🔒 Private members
2162
2281
  // ===========================================================================
2163
2282
 
@@ -2254,10 +2373,9 @@ function createTippy(reference, passedProps) {
2254
2373
  instance.clearDelayTimeouts();
2255
2374
  }
2256
2375
  });
2257
- popper.addEventListener('mouseleave', function (event) {
2376
+ popper.addEventListener('mouseleave', function () {
2258
2377
  if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2259
2378
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2260
- debouncedOnMouseMove(event);
2261
2379
  }
2262
2380
  });
2263
2381
  return instance; // ===========================================================================
@@ -2277,7 +2395,7 @@ function createTippy(reference, passedProps) {
2277
2395
  var _instance$props$rende;
2278
2396
 
2279
2397
  // @ts-ignore
2280
- return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
2398
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2281
2399
  }
2282
2400
 
2283
2401
  function getCurrentTarget() {
@@ -2304,8 +2422,12 @@ function createTippy(reference, passedProps) {
2304
2422
  return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2305
2423
  }
2306
2424
 
2307
- function handleStyles() {
2308
- popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
2425
+ function handleStyles(fromHide) {
2426
+ if (fromHide === void 0) {
2427
+ fromHide = false;
2428
+ }
2429
+
2430
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2309
2431
  popper.style.zIndex = "" + instance.props.zIndex;
2310
2432
  }
2311
2433
 
@@ -2316,7 +2438,7 @@ function createTippy(reference, passedProps) {
2316
2438
 
2317
2439
  pluginsHooks.forEach(function (pluginHooks) {
2318
2440
  if (pluginHooks[hook]) {
2319
- pluginHooks[hook].apply(void 0, args);
2441
+ pluginHooks[hook].apply(pluginHooks, args);
2320
2442
  }
2321
2443
  });
2322
2444
 
@@ -2382,15 +2504,18 @@ function createTippy(reference, passedProps) {
2382
2504
  if (didTouchMove || event.type === 'mousedown') {
2383
2505
  return;
2384
2506
  }
2385
- } // Clicked on interactive popper
2507
+ }
2386
2508
 
2509
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2387
2510
 
2388
- if (instance.props.interactive && popper.contains(event.target)) {
2511
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2389
2512
  return;
2390
2513
  } // Clicked on the event listeners target
2391
2514
 
2392
2515
 
2393
- if (getCurrentTarget().contains(event.target)) {
2516
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2517
+ return actualContains(el, actualTarget);
2518
+ })) {
2394
2519
  if (currentInput.isTouch) {
2395
2520
  return;
2396
2521
  }
@@ -2518,7 +2643,7 @@ function createTippy(reference, passedProps) {
2518
2643
  break;
2519
2644
 
2520
2645
  case 'focus':
2521
- on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
2646
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2522
2647
  break;
2523
2648
 
2524
2649
  case 'focusin':
@@ -2744,7 +2869,7 @@ function createTippy(reference, passedProps) {
2744
2869
 
2745
2870
  var node = getCurrentTarget();
2746
2871
 
2747
- if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
2872
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2748
2873
  parentNode = node.parentNode;
2749
2874
  } else {
2750
2875
  parentNode = invokeWithArgsOrReturn(appendTo, [node]);
@@ -2756,6 +2881,7 @@ function createTippy(reference, passedProps) {
2756
2881
  parentNode.appendChild(popper);
2757
2882
  }
2758
2883
 
2884
+ instance.state.isMounted = true;
2759
2885
  createPopperInstance();
2760
2886
  }
2761
2887
 
@@ -2853,7 +2979,7 @@ function createTippy(reference, passedProps) {
2853
2979
  invokeHook('onBeforeUpdate', [instance, partialProps]);
2854
2980
  removeListeners();
2855
2981
  var prevProps = instance.props;
2856
- var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
2982
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
2857
2983
  ignoreAttributes: true
2858
2984
  }));
2859
2985
  instance.props = nextProps;
@@ -2952,6 +3078,8 @@ function createTippy(reference, passedProps) {
2952
3078
  }
2953
3079
 
2954
3080
  onFirstUpdate = function onFirstUpdate() {
3081
+ var _instance$popperInsta2;
3082
+
2955
3083
  if (!instance.state.isVisible || ignoreOnFirstUpdate) {
2956
3084
  return;
2957
3085
  }
@@ -2972,8 +3100,10 @@ function createTippy(reference, passedProps) {
2972
3100
 
2973
3101
  handleAriaContentAttribute();
2974
3102
  handleAriaExpandedAttribute();
2975
- pushIfUnique(mountedInstances, instance);
2976
- instance.state.isMounted = true;
3103
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3104
+ // popper has been positioned for the first time
3105
+
3106
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
2977
3107
  invokeHook('onMount', [instance]);
2978
3108
 
2979
3109
  if (instance.props.animation && getIsDefaultRenderFn()) {
@@ -3016,7 +3146,7 @@ function createTippy(reference, passedProps) {
3016
3146
 
3017
3147
  cleanupInteractiveMouseListeners();
3018
3148
  removeDocumentPress();
3019
- handleStyles();
3149
+ handleStyles(true);
3020
3150
 
3021
3151
  if (getIsDefaultRenderFn()) {
3022
3152
  var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
@@ -3121,16 +3251,58 @@ tippy.defaultProps = defaultProps;
3121
3251
  tippy.setDefaultProps = setDefaultProps;
3122
3252
  tippy.currentInput = currentInput;
3123
3253
 
3254
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3255
+ // and causing transitions to break for singletons when the console is open, but
3256
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3257
+
3258
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3259
+ effect: function effect(_ref) {
3260
+ var state = _ref.state;
3261
+ var initialStyles = {
3262
+ popper: {
3263
+ position: state.options.strategy,
3264
+ left: '0',
3265
+ top: '0',
3266
+ margin: '0'
3267
+ },
3268
+ arrow: {
3269
+ position: 'absolute'
3270
+ },
3271
+ reference: {}
3272
+ };
3273
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3274
+ state.styles = initialStyles;
3275
+
3276
+ if (state.elements.arrow) {
3277
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3278
+ } // intentionally return no cleanup function
3279
+ // return () => { ... }
3280
+
3281
+ }
3282
+ });
3283
+
3124
3284
  var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3285
+ var _optionalProps$popper;
3286
+
3125
3287
  if (optionalProps === void 0) {
3126
3288
  optionalProps = {};
3127
3289
  }
3128
3290
 
3129
3291
  var individualInstances = tippyInstances;
3130
3292
  var references = [];
3293
+ var triggerTargets = [];
3131
3294
  var currentTarget;
3132
3295
  var overrides = optionalProps.overrides;
3133
3296
  var interceptSetPropsCleanups = [];
3297
+ var shownOnCreate = false;
3298
+
3299
+ function setTriggerTargets() {
3300
+ triggerTargets = individualInstances.map(function (instance) {
3301
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3302
+ }).reduce(function (acc, item) {
3303
+ return acc.concat(item);
3304
+ }, []);
3305
+ }
3134
3306
 
3135
3307
  function setReferences() {
3136
3308
  references = individualInstances.map(function (instance) {
@@ -3164,42 +3336,123 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3164
3336
  instance.setProps = originalSetProps;
3165
3337
  };
3166
3338
  });
3339
+ } // have to pass singleton, as it maybe undefined on first call
3340
+
3341
+
3342
+ function prepareInstance(singleton, target) {
3343
+ var index = triggerTargets.indexOf(target); // bail-out
3344
+
3345
+ if (target === currentTarget) {
3346
+ return;
3347
+ }
3348
+
3349
+ currentTarget = target;
3350
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3351
+ acc[prop] = individualInstances[index].props[prop];
3352
+ return acc;
3353
+ }, {});
3354
+ singleton.setProps(Object.assign({}, overrideProps, {
3355
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3356
+ var _references$index;
3357
+
3358
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3359
+ }
3360
+ }));
3167
3361
  }
3168
3362
 
3169
3363
  enableInstances(false);
3170
3364
  setReferences();
3365
+ setTriggerTargets();
3171
3366
  var plugin = {
3172
3367
  fn: function fn() {
3173
3368
  return {
3174
3369
  onDestroy: function onDestroy() {
3175
3370
  enableInstances(true);
3176
3371
  },
3177
- onTrigger: function onTrigger(instance, event) {
3178
- var target = event.currentTarget;
3179
- var index = references.indexOf(target); // bail-out
3180
-
3181
- if (target === currentTarget) {
3182
- return;
3372
+ onHidden: function onHidden() {
3373
+ currentTarget = null;
3374
+ },
3375
+ onClickOutside: function onClickOutside(instance) {
3376
+ if (instance.props.showOnCreate && !shownOnCreate) {
3377
+ shownOnCreate = true;
3378
+ currentTarget = null;
3183
3379
  }
3184
-
3185
- currentTarget = target;
3186
- var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3187
- acc[prop] = individualInstances[index].props[prop];
3188
- return acc;
3189
- }, {});
3190
- instance.setProps(Object.assign({}, overrideProps, {
3191
- getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3192
- return target.getBoundingClientRect();
3193
- }
3194
- }));
3380
+ },
3381
+ onShow: function onShow(instance) {
3382
+ if (instance.props.showOnCreate && !shownOnCreate) {
3383
+ shownOnCreate = true;
3384
+ prepareInstance(instance, references[0]);
3385
+ }
3386
+ },
3387
+ onTrigger: function onTrigger(instance, event) {
3388
+ prepareInstance(instance, event.currentTarget);
3195
3389
  }
3196
3390
  };
3197
3391
  }
3198
3392
  };
3199
3393
  var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3200
3394
  plugins: [plugin].concat(optionalProps.plugins || []),
3201
- triggerTarget: references
3395
+ triggerTarget: triggerTargets,
3396
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3397
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3398
+ })
3202
3399
  }));
3400
+ var originalShow = singleton.show;
3401
+
3402
+ singleton.show = function (target) {
3403
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3404
+ // default to showing first instance
3405
+
3406
+ if (!currentTarget && target == null) {
3407
+ return prepareInstance(singleton, references[0]);
3408
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3409
+ // programmatic call with no params when already visible (do nothing again)
3410
+
3411
+
3412
+ if (currentTarget && target == null) {
3413
+ return;
3414
+ } // target is index of instance
3415
+
3416
+
3417
+ if (typeof target === 'number') {
3418
+ return references[target] && prepareInstance(singleton, references[target]);
3419
+ } // target is a child tippy instance
3420
+
3421
+
3422
+ if (individualInstances.indexOf(target) >= 0) {
3423
+ var ref = target.reference;
3424
+ return prepareInstance(singleton, ref);
3425
+ } // target is a ReferenceElement
3426
+
3427
+
3428
+ if (references.indexOf(target) >= 0) {
3429
+ return prepareInstance(singleton, target);
3430
+ }
3431
+ };
3432
+
3433
+ singleton.showNext = function () {
3434
+ var first = references[0];
3435
+
3436
+ if (!currentTarget) {
3437
+ return singleton.show(0);
3438
+ }
3439
+
3440
+ var index = references.indexOf(currentTarget);
3441
+ singleton.show(references[index + 1] || first);
3442
+ };
3443
+
3444
+ singleton.showPrevious = function () {
3445
+ var last = references[references.length - 1];
3446
+
3447
+ if (!currentTarget) {
3448
+ return singleton.show(last);
3449
+ }
3450
+
3451
+ var index = references.indexOf(currentTarget);
3452
+ var target = references[index - 1] || last;
3453
+ singleton.show(target);
3454
+ };
3455
+
3203
3456
  var originalSetProps = singleton.setProps;
3204
3457
 
3205
3458
  singleton.setProps = function (props) {
@@ -3215,9 +3468,10 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3215
3468
  individualInstances = nextInstances;
3216
3469
  enableInstances(false);
3217
3470
  setReferences();
3218
- interceptSetProps(singleton);
3471
+ setTriggerTargets();
3472
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3219
3473
  singleton.setProps({
3220
- triggerTarget: references
3474
+ triggerTarget: triggerTargets
3221
3475
  });
3222
3476
  };
3223
3477
 
@@ -3232,7 +3486,7 @@ var animateFill = {
3232
3486
  var _instance$props$rende;
3233
3487
 
3234
3488
  // @ts-ignore
3235
- if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
3489
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3236
3490
 
3237
3491
  return {};
3238
3492
  }
@@ -3354,6 +3608,7 @@ var followCursor = {
3354
3608
 
3355
3609
  if (isCursorOverReference || !instance.props.interactive) {
3356
3610
  instance.setProps({
3611
+ // @ts-ignore - unneeded DOMRect properties
3357
3612
  getReferenceClientRect: function getReferenceClientRect() {
3358
3613
  var rect = reference.getBoundingClientRect();
3359
3614
  var x = clientX;
@@ -3490,6 +3745,7 @@ var inlinePositioning = {
3490
3745
  var placement;
3491
3746
  var cursorRectIndex = -1;
3492
3747
  var isInternalUpdate = false;
3748
+ var triedPlacements = [];
3493
3749
  var modifier = {
3494
3750
  name: 'tippyInlinePositioning',
3495
3751
  enabled: true,
@@ -3498,8 +3754,14 @@ var inlinePositioning = {
3498
3754
  var state = _ref2.state;
3499
3755
 
3500
3756
  if (isEnabled()) {
3501
- if (placement !== state.placement) {
3757
+ if (triedPlacements.indexOf(state.placement) !== -1) {
3758
+ triedPlacements = [];
3759
+ }
3760
+
3761
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
3762
+ triedPlacements.push(state.placement);
3502
3763
  instance.setProps({
3764
+ // @ts-ignore - unneeded DOMRect properties
3503
3765
  getReferenceClientRect: function getReferenceClientRect() {
3504
3766
  return _getReferenceClientRect(state.placement);
3505
3767
  }
@@ -3536,10 +3798,11 @@ var inlinePositioning = {
3536
3798
  var cursorRect = rects.find(function (rect) {
3537
3799
  return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
3538
3800
  });
3539
- cursorRectIndex = rects.indexOf(cursorRect);
3801
+ var index = rects.indexOf(cursorRect);
3802
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
3540
3803
  }
3541
3804
  },
3542
- onUntrigger: function onUntrigger() {
3805
+ onHidden: function onHidden() {
3543
3806
  cursorRectIndex = -1;
3544
3807
  }
3545
3808
  };
@@ -3683,12 +3946,20 @@ tippy.setDefaultProps({
3683
3946
  },
3684
3947
  });
3685
3948
  function useTippy(el, opts = {}, settings = { mount: true }) {
3949
+ const vm = getCurrentInstance();
3686
3950
  const instance = ref();
3951
+ const state = ref({
3952
+ isEnabled: false,
3953
+ isVisible: false,
3954
+ isDestroyed: false,
3955
+ isMounted: false,
3956
+ isShown: false,
3957
+ });
3687
3958
  let container = null;
3688
3959
  const getContainer = () => {
3689
3960
  if (container)
3690
3961
  return container;
3691
- container = document.createElement('fragment');
3962
+ container = document.createDocumentFragment();
3692
3963
  return container;
3693
3964
  };
3694
3965
  const getContent = (content) => {
@@ -3696,29 +3967,30 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3696
3967
  let unwrappedContent = isRef(content)
3697
3968
  ? content.value
3698
3969
  : content;
3699
- if (isVue2) {
3700
- //@ts-ignore
3701
- newContent = unwrappedContent;
3702
- }
3703
- else {
3704
- if (isVNode(unwrappedContent)) {
3705
- render$1(unwrappedContent, getContainer());
3706
- newContent = () => getContainer();
3707
- }
3708
- else if (typeof unwrappedContent === 'object') {
3709
- render$1(h(unwrappedContent), getContainer());
3710
- newContent = () => getContainer();
3970
+ if (isVNode(unwrappedContent)) {
3971
+ if (vm) {
3972
+ unwrappedContent.appContext = vm.appContext;
3711
3973
  }
3712
- else {
3713
- newContent = unwrappedContent;
3974
+ render$1(unwrappedContent, getContainer());
3975
+ newContent = () => getContainer();
3976
+ }
3977
+ else if (typeof unwrappedContent === 'object') {
3978
+ let comp = h(unwrappedContent);
3979
+ if (vm) {
3980
+ comp.appContext = vm.appContext;
3714
3981
  }
3982
+ render$1(comp, getContainer());
3983
+ newContent = () => getContainer();
3984
+ }
3985
+ else {
3986
+ newContent = unwrappedContent;
3715
3987
  }
3716
3988
  return newContent;
3717
3989
  };
3718
3990
  const getProps = (opts) => {
3719
3991
  let options = {};
3720
3992
  if (isRef(opts)) {
3721
- options = opts.value;
3993
+ options = opts.value || {};
3722
3994
  }
3723
3995
  else if (isReactive(opts)) {
3724
3996
  options = { ...opts };
@@ -3726,8 +3998,51 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3726
3998
  else {
3727
3999
  options = { ...opts };
3728
4000
  }
3729
- if (options.content)
4001
+ if (options.content) {
3730
4002
  options.content = getContent(options.content);
4003
+ }
4004
+ if (options.triggerTarget) {
4005
+ options.triggerTarget = isRef(options.triggerTarget)
4006
+ ? options.triggerTarget.value
4007
+ : options.triggerTarget;
4008
+ }
4009
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4010
+ options.plugins = [];
4011
+ }
4012
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4013
+ options.plugins.push({
4014
+ name: 'vueTippyReactiveState',
4015
+ fn: () => {
4016
+ return {
4017
+ onCreate() {
4018
+ state.value.isEnabled = true;
4019
+ },
4020
+ onMount() {
4021
+ state.value.isMounted = true;
4022
+ },
4023
+ onShow() {
4024
+ state.value.isMounted = true;
4025
+ state.value.isVisible = true;
4026
+ },
4027
+ onShown() {
4028
+ state.value.isShown = true;
4029
+ },
4030
+ onHide() {
4031
+ state.value.isMounted = false;
4032
+ state.value.isVisible = false;
4033
+ },
4034
+ onHidden() {
4035
+ state.value.isShown = false;
4036
+ },
4037
+ onUnmounted() {
4038
+ state.value.isMounted = false;
4039
+ },
4040
+ onDestroy() {
4041
+ state.value.isDestroyed = true;
4042
+ },
4043
+ };
4044
+ }
4045
+ });
3731
4046
  return options;
3732
4047
  };
3733
4048
  const refresh = () => {
@@ -3766,10 +4081,12 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3766
4081
  const disable = () => {
3767
4082
  var _a;
3768
4083
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4084
+ state.value.isEnabled = false;
3769
4085
  };
3770
4086
  const enable = () => {
3771
4087
  var _a;
3772
4088
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4089
+ state.value.isEnabled = true;
3773
4090
  };
3774
4091
  const unmount = () => {
3775
4092
  var _a;
@@ -3800,9 +4117,9 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3800
4117
  enable,
3801
4118
  unmount,
3802
4119
  mount,
4120
+ state,
3803
4121
  };
3804
4122
  if (settings.mount) {
3805
- const vm = getCurrentInstance();
3806
4123
  if (vm) {
3807
4124
  if (vm.isMounted) {
3808
4125
  mount();
@@ -3827,12 +4144,170 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3827
4144
  return response;
3828
4145
  }
3829
4146
 
3830
- // const pluginProps = [
3831
- // 'animateFill',
3832
- // 'followCursor',
3833
- // 'inlinePositioning',
3834
- // 'sticky',
3835
- // ]
4147
+ function useTippyComponent(opts = {}, children) {
4148
+ const instance = ref();
4149
+ return {
4150
+ instance,
4151
+ TippyComponent: h(TippyComponent, {
4152
+ ...opts,
4153
+ onVnodeMounted: (vnode) => {
4154
+ //@ts-ignore
4155
+ instance.value = vnode.component.ctx;
4156
+ },
4157
+ }, children),
4158
+ };
4159
+ }
4160
+
4161
+ function useSingleton(instances, optionalProps) {
4162
+ const singleton = ref();
4163
+ onMounted(() => {
4164
+ const pendingTippyInstances = Array.isArray(instances)
4165
+ ? instances.map(i => i.value)
4166
+ : typeof instances === 'function'
4167
+ ? instances()
4168
+ : instances.value;
4169
+ const tippyInstances = pendingTippyInstances
4170
+ .map((instance) => {
4171
+ if (instance instanceof Element) {
4172
+ //@ts-ignore
4173
+ return instance._tippy;
4174
+ }
4175
+ return instance;
4176
+ })
4177
+ .filter(Boolean);
4178
+ singleton.value = createSingleton(tippyInstances, optionalProps
4179
+ ? { allowHTML: true, ...optionalProps }
4180
+ : { allowHTML: true });
4181
+ });
4182
+ return {
4183
+ singleton,
4184
+ };
4185
+ }
4186
+
4187
+ const TippyComponent = defineComponent({
4188
+ props: {
4189
+ to: {
4190
+ type: [String, Function],
4191
+ },
4192
+ tag: {
4193
+ type: String,
4194
+ default: 'span'
4195
+ },
4196
+ contentTag: {
4197
+ type: String,
4198
+ default: 'span'
4199
+ },
4200
+ contentClass: {
4201
+ type: String,
4202
+ default: null
4203
+ },
4204
+ appendTo: { default: () => tippy.defaultProps['appendTo'] },
4205
+ aria: { default: () => tippy.defaultProps['aria'] },
4206
+ delay: { default: () => tippy.defaultProps['delay'] },
4207
+ duration: { default: () => tippy.defaultProps['duration'] },
4208
+ getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
4209
+ hideOnClick: { type: [Boolean, String], default: () => tippy.defaultProps['hideOnClick'] },
4210
+ ignoreAttributes: { type: Boolean, default: () => tippy.defaultProps['ignoreAttributes'] },
4211
+ interactive: { type: Boolean, default: () => tippy.defaultProps['interactive'] },
4212
+ interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
4213
+ interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
4214
+ moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
4215
+ offset: { default: () => tippy.defaultProps['offset'] },
4216
+ onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
4217
+ onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
4218
+ onCreate: { default: () => tippy.defaultProps['onCreate'] },
4219
+ onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
4220
+ onHidden: { default: () => tippy.defaultProps['onHidden'] },
4221
+ onHide: { default: () => tippy.defaultProps['onHide'] },
4222
+ onMount: { default: () => tippy.defaultProps['onMount'] },
4223
+ onShow: { default: () => tippy.defaultProps['onShow'] },
4224
+ onShown: { default: () => tippy.defaultProps['onShown'] },
4225
+ onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
4226
+ onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
4227
+ onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
4228
+ placement: { default: () => tippy.defaultProps['placement'] },
4229
+ plugins: { default: () => tippy.defaultProps['plugins'] },
4230
+ popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
4231
+ render: { default: () => tippy.defaultProps['render'] },
4232
+ showOnCreate: { type: Boolean, default: () => tippy.defaultProps['showOnCreate'] },
4233
+ touch: { type: [Boolean, String, Array], default: () => tippy.defaultProps['touch'] },
4234
+ trigger: { default: () => tippy.defaultProps['trigger'] },
4235
+ triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
4236
+ animateFill: { type: Boolean, default: () => tippy.defaultProps['animateFill'] },
4237
+ followCursor: { type: [Boolean, String], default: () => tippy.defaultProps['followCursor'] },
4238
+ inlinePositioning: { type: Boolean, default: () => tippy.defaultProps['inlinePositioning'] },
4239
+ sticky: { type: [Boolean, String], default: () => tippy.defaultProps['sticky'] },
4240
+ allowHTML: { type: Boolean, default: () => tippy.defaultProps['allowHTML'] },
4241
+ animation: { default: () => tippy.defaultProps['animation'] },
4242
+ arrow: { default: () => tippy.defaultProps['arrow'] },
4243
+ content: { default: () => tippy.defaultProps['content'] },
4244
+ inertia: { default: () => tippy.defaultProps['inertia'] },
4245
+ maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
4246
+ role: { default: () => tippy.defaultProps['role'] },
4247
+ theme: { default: () => tippy.defaultProps['theme'] },
4248
+ zIndex: { default: () => tippy.defaultProps['zIndex'] }
4249
+ },
4250
+ emits: ['state'],
4251
+ setup(props, { slots, emit, expose }) {
4252
+ const elem = ref();
4253
+ const contentElem = ref();
4254
+ const mounted = ref(false);
4255
+ const getOptions = () => {
4256
+ let options = { ...props };
4257
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4258
+ if (options.hasOwnProperty(prop)) {
4259
+ // @ts-ignore
4260
+ delete options[prop];
4261
+ }
4262
+ }
4263
+ return options;
4264
+ };
4265
+ let target = elem;
4266
+ if (props.to) {
4267
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4268
+ target = () => props.to;
4269
+ }
4270
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4271
+ target = () => document.querySelector(props.to);
4272
+ }
4273
+ }
4274
+ const tippy = useTippy(target, getOptions());
4275
+ onMounted(() => {
4276
+ mounted.value = true;
4277
+ nextTick(() => {
4278
+ if (slots.content)
4279
+ tippy.setContent(() => contentElem.value);
4280
+ });
4281
+ });
4282
+ watch(tippy.state, () => {
4283
+ emit('state', unref(tippy.state));
4284
+ }, { immediate: true, deep: true });
4285
+ watch(() => props, () => {
4286
+ tippy.setProps(getOptions());
4287
+ if (slots.content)
4288
+ tippy.setContent(() => contentElem.value);
4289
+ }, { deep: true });
4290
+ let exposed = reactive({
4291
+ elem,
4292
+ contentElem,
4293
+ mounted,
4294
+ ...tippy
4295
+ });
4296
+ expose(exposed);
4297
+ return () => {
4298
+ const slot = slots.default ? slots.default(exposed) : [];
4299
+ return h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4300
+ slot,
4301
+ h(props.contentTag, {
4302
+ ref: contentElem,
4303
+ style: { display: mounted.value ? 'inherit' : 'none' },
4304
+ class: props.contentClass
4305
+ }, slots.content(exposed)),
4306
+ ] : slot);
4307
+ };
4308
+ },
4309
+ });
4310
+
3836
4311
  const booleanProps = [
3837
4312
  'a11y',
3838
4313
  'allowHTML',
@@ -3867,22 +4342,40 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
3867
4342
  };
3868
4343
  }
3869
4344
  });
3870
- const TippyComponent = defineComponent({
4345
+ const TippySingleton = defineComponent({
3871
4346
  props,
3872
4347
  setup(props) {
3873
- const elem = ref();
3874
- const tippy = useTippy(elem, props);
3875
- return { elem, ...tippy };
4348
+ const instances = ref([]);
4349
+ const { singleton } = useSingleton(instances, props);
4350
+ return { instances, singleton };
4351
+ },
4352
+ mounted() {
4353
+ var _a;
4354
+ const parent = this.$el.parentElement;
4355
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4356
+ this.instances = Array.from(elements)
4357
+ .map((el) => el._tippy)
4358
+ .filter(Boolean);
4359
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
3876
4360
  },
3877
4361
  render() {
3878
4362
  let slot = this.$slots.default ? this.$slots.default() : [];
3879
- return h('span', { ref: 'elem' }, slot);
4363
+ return h(() => slot);
3880
4364
  },
3881
4365
  });
3882
4366
 
3883
4367
  const directive = {
3884
4368
  mounted(el, binding, vnode) {
3885
- const opts = binding.value || {};
4369
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4370
+ const modifiers = Object.keys(binding.modifiers || {});
4371
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4372
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4373
+ if (placement) {
4374
+ opts.placement = opts.placement || placement;
4375
+ }
4376
+ if (withArrow) {
4377
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4378
+ }
3886
4379
  if (vnode.props && vnode.props.onTippyShow) {
3887
4380
  opts.onShow = function (...args) {
3888
4381
  var _a;
@@ -3931,7 +4424,7 @@ const directive = {
3931
4424
  }
3932
4425
  },
3933
4426
  updated(el, binding) {
3934
- const opts = binding.value || {};
4427
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
3935
4428
  if (el.getAttribute('title') && !opts.content) {
3936
4429
  opts.content = el.getAttribute('title');
3937
4430
  el.removeAttribute('title');
@@ -3953,65 +4446,15 @@ const plugin = {
3953
4446
  tippy.setDefaultProps(options.defaultProps || {});
3954
4447
  app.directive(options.directive || 'tippy', directive);
3955
4448
  app.component(options.component || 'tippy', TippyComponent);
4449
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
3956
4450
  },
3957
4451
  };
3958
4452
 
3959
- function useSingleton(instances, optionalProps) {
3960
- const singleton = ref();
3961
- onMounted(() => {
3962
- const pendingTippyInstances = Array.isArray(instances)
3963
- ? instances.map(i => i.value)
3964
- : instances.value;
3965
- const tippyInstances = pendingTippyInstances
3966
- .map((instance) => {
3967
- if (instance instanceof Element) {
3968
- //@ts-ignore
3969
- return instance._tippy;
3970
- }
3971
- return instance;
3972
- })
3973
- .filter(Boolean);
3974
- singleton.value = createSingleton(tippyInstances, optionalProps);
3975
- });
3976
- return {
3977
- singleton,
3978
- };
3979
- }
3980
-
3981
- function styleInject(css, ref) {
3982
- if ( ref === void 0 ) ref = {};
3983
- var insertAt = ref.insertAt;
3984
-
3985
- if (!css || typeof document === 'undefined') { return; }
3986
-
3987
- var head = document.head || document.getElementsByTagName('head')[0];
3988
- var style = document.createElement('style');
3989
- style.type = 'text/css';
3990
-
3991
- if (insertAt === 'top') {
3992
- if (head.firstChild) {
3993
- head.insertBefore(style, head.firstChild);
3994
- } else {
3995
- head.appendChild(style);
3996
- }
3997
- } else {
3998
- head.appendChild(style);
3999
- }
4000
-
4001
- if (style.styleSheet) {
4002
- style.styleSheet.cssText = css;
4003
- } else {
4004
- style.appendChild(document.createTextNode(css));
4005
- }
4006
- }
4007
-
4008
- var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
4009
- styleInject(css_248z);
4010
-
4011
4453
  const setDefaultProps$1 = tippy.setDefaultProps;
4012
4454
  setDefaultProps$1({
4455
+ ignoreAttributes: true,
4013
4456
  plugins: [sticky, inlinePositioning, followCursor, animateFill],
4014
4457
  });
4015
4458
 
4016
4459
  export default plugin;
4017
- export { TippyComponent as Tippy, directive, setDefaultProps$1 as setDefaultProps, tippy, useSingleton, useTippy };
4460
+ export { TippyComponent as Tippy, TippySingleton, directive, plugin, ROUND_ARROW as roundArrow, setDefaultProps$1 as setDefaultProps, tippy, useSingleton, useTippy, useTippyComponent };