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

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- var VueTippy = (function (exports, vueDemi) {
6
+ var VueTippy = (function (exports, vue) {
7
7
  'use strict';
8
8
 
9
9
  var top = 'top';
@@ -42,10 +42,11 @@ var VueTippy = (function (exports, vueDemi) {
42
42
  return element ? (element.nodeName || '').toLowerCase() : null;
43
43
  }
44
44
 
45
- /*:: import type { Window } from '../types'; */
46
-
47
- /*:: declare function getWindow(node: Node | Window): Window; */
48
45
  function getWindow(node) {
46
+ if (node == null) {
47
+ return window;
48
+ }
49
+
49
50
  if (node.toString() !== '[object Window]') {
50
51
  var ownerDocument = node.ownerDocument;
51
52
  return ownerDocument ? ownerDocument.defaultView || window : window;
@@ -54,26 +55,22 @@ var VueTippy = (function (exports, vueDemi) {
54
55
  return node;
55
56
  }
56
57
 
57
- /*:: declare function isElement(node: mixed): boolean %checks(node instanceof
58
- Element); */
59
-
60
58
  function isElement(node) {
61
59
  var OwnElement = getWindow(node).Element;
62
60
  return node instanceof OwnElement || node instanceof Element;
63
61
  }
64
- /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
65
- HTMLElement); */
66
-
67
62
 
68
63
  function isHTMLElement(node) {
69
64
  var OwnElement = getWindow(node).HTMLElement;
70
65
  return node instanceof OwnElement || node instanceof HTMLElement;
71
66
  }
72
- /*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
73
- ShadowRoot); */
74
-
75
67
 
76
68
  function isShadowRoot(node) {
69
+ // IE 11 has no ShadowRoot
70
+ if (typeof ShadowRoot === 'undefined') {
71
+ return false;
72
+ }
73
+
77
74
  var OwnElement = getWindow(node).ShadowRoot;
78
75
  return node instanceof OwnElement || node instanceof ShadowRoot;
79
76
  }
@@ -122,6 +119,7 @@ var VueTippy = (function (exports, vueDemi) {
122
119
  reference: {}
123
120
  };
124
121
  Object.assign(state.elements.popper.style, initialStyles.popper);
122
+ state.styles = initialStyles;
125
123
 
126
124
  if (state.elements.arrow) {
127
125
  Object.assign(state.elements.arrow.style, initialStyles.arrow);
@@ -164,14 +162,67 @@ var VueTippy = (function (exports, vueDemi) {
164
162
  return placement.split('-')[0];
165
163
  }
166
164
 
167
- // Returns the layout rect of an element relative to its offsetParent. Layout
165
+ var max = Math.max;
166
+ var min = Math.min;
167
+ var round = Math.round;
168
+
169
+ function getBoundingClientRect(element, includeScale) {
170
+ if (includeScale === void 0) {
171
+ includeScale = false;
172
+ }
173
+
174
+ var rect = element.getBoundingClientRect();
175
+ var scaleX = 1;
176
+ var scaleY = 1;
177
+
178
+ if (isHTMLElement(element) && includeScale) {
179
+ var offsetHeight = element.offsetHeight;
180
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
181
+ // Fallback to 1 in case both values are `0`
182
+
183
+ if (offsetWidth > 0) {
184
+ scaleX = round(rect.width) / offsetWidth || 1;
185
+ }
186
+
187
+ if (offsetHeight > 0) {
188
+ scaleY = round(rect.height) / offsetHeight || 1;
189
+ }
190
+ }
191
+
192
+ return {
193
+ width: rect.width / scaleX,
194
+ height: rect.height / scaleY,
195
+ top: rect.top / scaleY,
196
+ right: rect.right / scaleX,
197
+ bottom: rect.bottom / scaleY,
198
+ left: rect.left / scaleX,
199
+ x: rect.left / scaleX,
200
+ y: rect.top / scaleY
201
+ };
202
+ }
203
+
168
204
  // means it doesn't take into account transforms.
205
+
169
206
  function getLayoutRect(element) {
207
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
208
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
209
+
210
+ var width = element.offsetWidth;
211
+ var height = element.offsetHeight;
212
+
213
+ if (Math.abs(clientRect.width - width) <= 1) {
214
+ width = clientRect.width;
215
+ }
216
+
217
+ if (Math.abs(clientRect.height - height) <= 1) {
218
+ height = clientRect.height;
219
+ }
220
+
170
221
  return {
171
222
  x: element.offsetLeft,
172
223
  y: element.offsetTop,
173
- width: element.offsetWidth,
174
- height: element.offsetHeight
224
+ width: width,
225
+ height: height
175
226
  };
176
227
  }
177
228
 
@@ -221,9 +272,8 @@ var VueTippy = (function (exports, vueDemi) {
221
272
  // $FlowFixMe[incompatible-return]
222
273
  // $FlowFixMe[prop-missing]
223
274
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
224
- element.parentNode || // DOM Element detected
225
- // $FlowFixMe[incompatible-return]: need a better way to handle this...
226
- element.host || // ShadowRoot detected
275
+ element.parentNode || ( // DOM Element detected
276
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
227
277
  // $FlowFixMe[incompatible-call]: HTMLElement is a Node
228
278
  getDocumentElement(element) // fallback
229
279
 
@@ -236,29 +286,32 @@ var VueTippy = (function (exports, vueDemi) {
236
286
  return null;
237
287
  }
238
288
 
239
- var offsetParent = element.offsetParent;
240
-
241
- if (offsetParent) {
242
- var html = getDocumentElement(offsetParent);
243
-
244
- if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
245
- return html;
246
- }
247
- }
248
-
249
- return offsetParent;
289
+ return element.offsetParent;
250
290
  } // `.offsetParent` reports `null` for fixed elements, while absolute elements
251
291
  // return the containing block
252
292
 
253
293
 
254
294
  function getContainingBlock(element) {
295
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
296
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
297
+
298
+ if (isIE && isHTMLElement(element)) {
299
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
300
+ var elementCss = getComputedStyle(element);
301
+
302
+ if (elementCss.position === 'fixed') {
303
+ return null;
304
+ }
305
+ }
306
+
255
307
  var currentNode = getParentNode(element);
256
308
 
257
309
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
258
310
  var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
259
311
  // create a containing block.
312
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
260
313
 
261
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
314
+ 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') {
262
315
  return currentNode;
263
316
  } else {
264
317
  currentNode = currentNode.parentNode;
@@ -278,7 +331,7 @@ var VueTippy = (function (exports, vueDemi) {
278
331
  offsetParent = getTrueOffsetParent(offsetParent);
279
332
  }
280
333
 
281
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
334
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
282
335
  return window;
283
336
  }
284
337
 
@@ -289,8 +342,12 @@ var VueTippy = (function (exports, vueDemi) {
289
342
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
290
343
  }
291
344
 
292
- function within(min, value, max) {
293
- return Math.max(min, Math.min(value, max));
345
+ function within(min$1, value, max$1) {
346
+ return max(min$1, min(value, max$1));
347
+ }
348
+ function withinMaxClamp(min, value, max) {
349
+ var v = within(min, value, max);
350
+ return v > max ? max : v;
294
351
  }
295
352
 
296
353
  function getFreshSideObject() {
@@ -303,7 +360,7 @@ var VueTippy = (function (exports, vueDemi) {
303
360
  }
304
361
 
305
362
  function mergePaddingObject(paddingObject) {
306
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
363
+ return Object.assign({}, getFreshSideObject(), paddingObject);
307
364
  }
308
365
 
309
366
  function expandToHashMap(value, keys) {
@@ -313,11 +370,19 @@ var VueTippy = (function (exports, vueDemi) {
313
370
  }, {});
314
371
  }
315
372
 
373
+ var toPaddingObject = function toPaddingObject(padding, state) {
374
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
375
+ placement: state.placement
376
+ })) : padding;
377
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
378
+ };
379
+
316
380
  function arrow(_ref) {
317
381
  var _state$modifiersData$;
318
382
 
319
383
  var state = _ref.state,
320
- name = _ref.name;
384
+ name = _ref.name,
385
+ options = _ref.options;
321
386
  var arrowElement = state.elements.arrow;
322
387
  var popperOffsets = state.modifiersData.popperOffsets;
323
388
  var basePlacement = getBasePlacement(state.placement);
@@ -329,7 +394,7 @@ var VueTippy = (function (exports, vueDemi) {
329
394
  return;
330
395
  }
331
396
 
332
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
397
+ var paddingObject = toPaddingObject(options.padding, state);
333
398
  var arrowRect = getLayoutRect(arrowElement);
334
399
  var minProp = axis === 'y' ? top : left;
335
400
  var maxProp = axis === 'y' ? bottom : right;
@@ -351,12 +416,9 @@ var VueTippy = (function (exports, vueDemi) {
351
416
 
352
417
  function effect$1(_ref2) {
353
418
  var state = _ref2.state,
354
- options = _ref2.options,
355
- name = _ref2.name;
419
+ options = _ref2.options;
356
420
  var _options$element = options.element,
357
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
358
- _options$padding = options.padding,
359
- padding = _options$padding === void 0 ? 0 : _options$padding;
421
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
360
422
 
361
423
  if (arrowElement == null) {
362
424
  return;
@@ -371,15 +433,21 @@ var VueTippy = (function (exports, vueDemi) {
371
433
  }
372
434
  }
373
435
 
436
+ {
437
+ if (!isHTMLElement(arrowElement)) {
438
+ console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
439
+ }
440
+ }
441
+
374
442
  if (!contains(state.elements.popper, arrowElement)) {
443
+ {
444
+ console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
445
+ }
375
446
 
376
447
  return;
377
448
  }
378
449
 
379
450
  state.elements.arrow = arrowElement;
380
- state.modifiersData[name + "#persistent"] = {
381
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
382
- };
383
451
  } // eslint-disable-next-line import/no-unused-modules
384
452
 
385
453
 
@@ -393,6 +461,10 @@ var VueTippy = (function (exports, vueDemi) {
393
461
  requiresIfExists: ['preventOverflow']
394
462
  };
395
463
 
464
+ function getVariation(placement) {
465
+ return placement.split('-')[1];
466
+ }
467
+
396
468
  var unsetSides = {
397
469
  top: 'auto',
398
470
  right: 'auto',
@@ -408,8 +480,8 @@ var VueTippy = (function (exports, vueDemi) {
408
480
  var win = window;
409
481
  var dpr = win.devicePixelRatio || 1;
410
482
  return {
411
- x: Math.round(x * dpr) / dpr || 0,
412
- y: Math.round(y * dpr) / dpr || 0
483
+ x: round(x * dpr) / dpr || 0,
484
+ y: round(y * dpr) / dpr || 0
413
485
  };
414
486
  }
415
487
 
@@ -419,13 +491,15 @@ var VueTippy = (function (exports, vueDemi) {
419
491
  var popper = _ref2.popper,
420
492
  popperRect = _ref2.popperRect,
421
493
  placement = _ref2.placement,
494
+ variation = _ref2.variation,
422
495
  offsets = _ref2.offsets,
423
496
  position = _ref2.position,
424
497
  gpuAcceleration = _ref2.gpuAcceleration,
425
498
  adaptive = _ref2.adaptive,
426
- roundOffsets = _ref2.roundOffsets;
499
+ roundOffsets = _ref2.roundOffsets,
500
+ isFixed = _ref2.isFixed;
427
501
 
428
- var _ref3 = roundOffsets ? roundOffsetsByDPR(offsets) : offsets,
502
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
429
503
  _ref3$x = _ref3.x,
430
504
  x = _ref3$x === void 0 ? 0 : _ref3$x,
431
505
  _ref3$y = _ref3.y,
@@ -439,23 +513,34 @@ var VueTippy = (function (exports, vueDemi) {
439
513
 
440
514
  if (adaptive) {
441
515
  var offsetParent = getOffsetParent(popper);
516
+ var heightProp = 'clientHeight';
517
+ var widthProp = 'clientWidth';
442
518
 
443
519
  if (offsetParent === getWindow(popper)) {
444
520
  offsetParent = getDocumentElement(popper);
521
+
522
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
523
+ heightProp = 'scrollHeight';
524
+ widthProp = 'scrollWidth';
525
+ }
445
526
  } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
446
527
 
447
- /*:: offsetParent = (offsetParent: Element); */
448
528
 
529
+ offsetParent = offsetParent;
449
530
 
450
- if (placement === top) {
531
+ if (placement === top || (placement === left || placement === right) && variation === end) {
451
532
  sideY = bottom;
452
- y -= offsetParent.clientHeight - popperRect.height;
533
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
534
+ offsetParent[heightProp];
535
+ y -= offsetY - popperRect.height;
453
536
  y *= gpuAcceleration ? 1 : -1;
454
537
  }
455
538
 
456
- if (placement === left) {
539
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
457
540
  sideX = right;
458
- x -= offsetParent.clientWidth - popperRect.width;
541
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
542
+ offsetParent[widthProp];
543
+ x -= offsetX - popperRect.width;
459
544
  x *= gpuAcceleration ? 1 : -1;
460
545
  }
461
546
  }
@@ -467,10 +552,10 @@ var VueTippy = (function (exports, vueDemi) {
467
552
  if (gpuAcceleration) {
468
553
  var _Object$assign;
469
554
 
470
- 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));
555
+ 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));
471
556
  }
472
557
 
473
- 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));
558
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
474
559
  }
475
560
 
476
561
  function computeStyles(_ref4) {
@@ -483,15 +568,27 @@ var VueTippy = (function (exports, vueDemi) {
483
568
  _options$roundOffsets = options.roundOffsets,
484
569
  roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
485
570
 
571
+ {
572
+ var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
573
+
574
+ if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
575
+ return transitionProperty.indexOf(property) >= 0;
576
+ })) {
577
+ console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
578
+ }
579
+ }
580
+
486
581
  var commonStyles = {
487
582
  placement: getBasePlacement(state.placement),
583
+ variation: getVariation(state.placement),
488
584
  popper: state.elements.popper,
489
585
  popperRect: state.rects.popper,
490
- gpuAcceleration: gpuAcceleration
586
+ gpuAcceleration: gpuAcceleration,
587
+ isFixed: state.options.strategy === 'fixed'
491
588
  };
492
589
 
493
590
  if (state.modifiersData.popperOffsets != null) {
494
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
591
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
495
592
  offsets: state.modifiersData.popperOffsets,
496
593
  position: state.options.strategy,
497
594
  adaptive: adaptive,
@@ -500,7 +597,7 @@ var VueTippy = (function (exports, vueDemi) {
500
597
  }
501
598
 
502
599
  if (state.modifiersData.arrow != null) {
503
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
600
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
504
601
  offsets: state.modifiersData.arrow,
505
602
  position: 'absolute',
506
603
  adaptive: false,
@@ -508,7 +605,7 @@ var VueTippy = (function (exports, vueDemi) {
508
605
  })));
509
606
  }
510
607
 
511
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
608
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
512
609
  'data-popper-placement': state.placement
513
610
  });
514
611
  } // eslint-disable-next-line import/no-unused-modules
@@ -592,20 +689,6 @@ var VueTippy = (function (exports, vueDemi) {
592
689
  });
593
690
  }
594
691
 
595
- function getBoundingClientRect(element) {
596
- var rect = element.getBoundingClientRect();
597
- return {
598
- width: rect.width,
599
- height: rect.height,
600
- top: rect.top,
601
- right: rect.right,
602
- bottom: rect.bottom,
603
- left: rect.left,
604
- x: rect.left,
605
- y: rect.top
606
- };
607
- }
608
-
609
692
  function getWindowScroll(node) {
610
693
  var win = getWindow(node);
611
694
  var scrollLeft = win.pageXOffset;
@@ -668,16 +751,18 @@ var VueTippy = (function (exports, vueDemi) {
668
751
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable
669
752
 
670
753
  function getDocumentRect(element) {
754
+ var _element$ownerDocumen;
755
+
671
756
  var html = getDocumentElement(element);
672
757
  var winScroll = getWindowScroll(element);
673
- var body = element.ownerDocument.body;
674
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
675
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
758
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
759
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
760
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
676
761
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
677
762
  var y = -winScroll.scrollTop;
678
763
 
679
764
  if (getComputedStyle(body || html).direction === 'rtl') {
680
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
765
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
681
766
  }
682
767
 
683
768
  return {
@@ -719,12 +804,14 @@ var VueTippy = (function (exports, vueDemi) {
719
804
  */
720
805
 
721
806
  function listScrollParents(element, list) {
807
+ var _element$ownerDocumen;
808
+
722
809
  if (list === void 0) {
723
810
  list = [];
724
811
  }
725
812
 
726
813
  var scrollParent = getScrollParent(element);
727
- var isBody = getNodeName(scrollParent) === 'body';
814
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
728
815
  var win = getWindow(scrollParent);
729
816
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
730
817
  var updatedList = list.concat(target);
@@ -733,7 +820,7 @@ var VueTippy = (function (exports, vueDemi) {
733
820
  }
734
821
 
735
822
  function rectToClientRect(rect) {
736
- return Object.assign(Object.assign({}, rect), {}, {
823
+ return Object.assign({}, rect, {
737
824
  left: rect.x,
738
825
  top: rect.y,
739
826
  right: rect.x + rect.width,
@@ -755,7 +842,7 @@ var VueTippy = (function (exports, vueDemi) {
755
842
  }
756
843
 
757
844
  function getClientRectFromMixedType(element, clippingParent) {
758
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
845
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
759
846
  } // A "clipping parent" is an overflowable container with the characteristic of
760
847
  // clipping (or hiding) overflowing elements with a position different from
761
848
  // `initial`
@@ -772,7 +859,7 @@ var VueTippy = (function (exports, vueDemi) {
772
859
 
773
860
 
774
861
  return clippingParents.filter(function (clippingParent) {
775
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
862
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
776
863
  });
777
864
  } // Gets the maximum area that the element is visible in due to any number of
778
865
  // clipping parents
@@ -784,10 +871,10 @@ var VueTippy = (function (exports, vueDemi) {
784
871
  var firstClippingParent = clippingParents[0];
785
872
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
786
873
  var rect = getClientRectFromMixedType(element, clippingParent);
787
- accRect.top = Math.max(rect.top, accRect.top);
788
- accRect.right = Math.min(rect.right, accRect.right);
789
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
790
- accRect.left = Math.max(rect.left, accRect.left);
874
+ accRect.top = max(rect.top, accRect.top);
875
+ accRect.right = min(rect.right, accRect.right);
876
+ accRect.bottom = min(rect.bottom, accRect.bottom);
877
+ accRect.left = max(rect.left, accRect.left);
791
878
  return accRect;
792
879
  }, getClientRectFromMixedType(element, firstClippingParent));
793
880
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -797,10 +884,6 @@ var VueTippy = (function (exports, vueDemi) {
797
884
  return clippingRect;
798
885
  }
799
886
 
800
- function getVariation(placement) {
801
- return placement.split('-')[1];
802
- }
803
-
804
887
  function computeOffsets(_ref) {
805
888
  var reference = _ref.reference,
806
889
  element = _ref.element,
@@ -886,18 +969,17 @@ var VueTippy = (function (exports, vueDemi) {
886
969
  padding = _options$padding === void 0 ? 0 : _options$padding;
887
970
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
888
971
  var altContext = elementContext === popper ? reference : popper;
889
- var referenceElement = state.elements.reference;
890
972
  var popperRect = state.rects.popper;
891
973
  var element = state.elements[altBoundary ? altContext : elementContext];
892
974
  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
893
- var referenceClientRect = getBoundingClientRect(referenceElement);
975
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
894
976
  var popperOffsets = computeOffsets({
895
977
  reference: referenceClientRect,
896
978
  element: popperRect,
897
979
  strategy: 'absolute',
898
980
  placement: placement
899
981
  });
900
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
982
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
901
983
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
902
984
  // 0 or negative = within the clipping rect
903
985
 
@@ -921,9 +1003,6 @@ var VueTippy = (function (exports, vueDemi) {
921
1003
  return overflowOffsets;
922
1004
  }
923
1005
 
924
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
925
-
926
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
927
1006
  function computeAutoPlacement(state, options) {
928
1007
  if (options === void 0) {
929
1008
  options = {};
@@ -947,6 +1026,10 @@ var VueTippy = (function (exports, vueDemi) {
947
1026
 
948
1027
  if (allowedPlacements.length === 0) {
949
1028
  allowedPlacements = placements$1;
1029
+
1030
+ {
1031
+ console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
1032
+ }
950
1033
  } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
951
1034
 
952
1035
 
@@ -1148,7 +1231,7 @@ var VueTippy = (function (exports, vueDemi) {
1148
1231
  isReferenceHidden: isReferenceHidden,
1149
1232
  hasPopperEscaped: hasPopperEscaped
1150
1233
  };
1151
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1234
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1152
1235
  'data-popper-reference-hidden': isReferenceHidden,
1153
1236
  'data-popper-escaped': hasPopperEscaped
1154
1237
  });
@@ -1167,7 +1250,7 @@ var VueTippy = (function (exports, vueDemi) {
1167
1250
  var basePlacement = getBasePlacement(placement);
1168
1251
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1169
1252
 
1170
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1253
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1171
1254
  placement: placement
1172
1255
  })) : offset,
1173
1256
  skidding = _ref[0],
@@ -1273,9 +1356,17 @@ var VueTippy = (function (exports, vueDemi) {
1273
1356
  var popperOffsets = state.modifiersData.popperOffsets;
1274
1357
  var referenceRect = state.rects.reference;
1275
1358
  var popperRect = state.rects.popper;
1276
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1359
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1277
1360
  placement: state.placement
1278
1361
  })) : tetherOffset;
1362
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1363
+ mainAxis: tetherOffsetValue,
1364
+ altAxis: tetherOffsetValue
1365
+ } : Object.assign({
1366
+ mainAxis: 0,
1367
+ altAxis: 0
1368
+ }, tetherOffsetValue);
1369
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1279
1370
  var data = {
1280
1371
  x: 0,
1281
1372
  y: 0
@@ -1286,12 +1377,14 @@ var VueTippy = (function (exports, vueDemi) {
1286
1377
  }
1287
1378
 
1288
1379
  if (checkMainAxis) {
1380
+ var _offsetModifierState$;
1381
+
1289
1382
  var mainSide = mainAxis === 'y' ? top : left;
1290
1383
  var altSide = mainAxis === 'y' ? bottom : right;
1291
1384
  var len = mainAxis === 'y' ? 'height' : 'width';
1292
1385
  var offset = popperOffsets[mainAxis];
1293
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1294
- var max = popperOffsets[mainAxis] - overflow[altSide];
1386
+ var min$1 = offset + overflow[mainSide];
1387
+ var max$1 = offset - overflow[altSide];
1295
1388
  var additive = tether ? -popperRect[len] / 2 : 0;
1296
1389
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1297
1390
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -1311,30 +1404,42 @@ var VueTippy = (function (exports, vueDemi) {
1311
1404
  // width or height)
1312
1405
 
1313
1406
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1314
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1315
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1407
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1408
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1316
1409
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1317
1410
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1318
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1319
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1320
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1321
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1411
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1412
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1413
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1414
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1322
1415
  popperOffsets[mainAxis] = preventedOffset;
1323
1416
  data[mainAxis] = preventedOffset - offset;
1324
1417
  }
1325
1418
 
1326
1419
  if (checkAltAxis) {
1420
+ var _offsetModifierState$2;
1421
+
1327
1422
  var _mainSide = mainAxis === 'x' ? top : left;
1328
1423
 
1329
1424
  var _altSide = mainAxis === 'x' ? bottom : right;
1330
1425
 
1331
1426
  var _offset = popperOffsets[altAxis];
1332
1427
 
1428
+ var _len = altAxis === 'y' ? 'height' : 'width';
1429
+
1333
1430
  var _min = _offset + overflow[_mainSide];
1334
1431
 
1335
1432
  var _max = _offset - overflow[_altSide];
1336
1433
 
1337
- var _preventedOffset = within(_min, _offset, _max);
1434
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1435
+
1436
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1437
+
1438
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1439
+
1440
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1441
+
1442
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1338
1443
 
1339
1444
  popperOffsets[altAxis] = _preventedOffset;
1340
1445
  data[altAxis] = _preventedOffset - _offset;
@@ -1367,16 +1472,24 @@ var VueTippy = (function (exports, vueDemi) {
1367
1472
  }
1368
1473
  }
1369
1474
 
1475
+ function isElementScaled(element) {
1476
+ var rect = element.getBoundingClientRect();
1477
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1478
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1479
+ return scaleX !== 1 || scaleY !== 1;
1480
+ } // Returns the composite rect of an element relative to its offsetParent.
1370
1481
  // Composite means it takes into account transforms as well as layout.
1371
1482
 
1483
+
1372
1484
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1373
1485
  if (isFixed === void 0) {
1374
1486
  isFixed = false;
1375
1487
  }
1376
1488
 
1377
- var documentElement = getDocumentElement(offsetParent);
1378
- var rect = getBoundingClientRect(elementOrVirtualElement);
1379
1489
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1490
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1491
+ var documentElement = getDocumentElement(offsetParent);
1492
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1380
1493
  var scroll = {
1381
1494
  scrollLeft: 0,
1382
1495
  scrollTop: 0
@@ -1393,7 +1506,7 @@ var VueTippy = (function (exports, vueDemi) {
1393
1506
  }
1394
1507
 
1395
1508
  if (isHTMLElement(offsetParent)) {
1396
- offsets = getBoundingClientRect(offsetParent);
1509
+ offsets = getBoundingClientRect(offsetParent, true);
1397
1510
  offsets.x += offsetParent.clientLeft;
1398
1511
  offsets.y += offsetParent.clientTop;
1399
1512
  } else if (documentElement) {
@@ -1468,12 +1581,114 @@ var VueTippy = (function (exports, vueDemi) {
1468
1581
  };
1469
1582
  }
1470
1583
 
1584
+ function format(str) {
1585
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1586
+ args[_key - 1] = arguments[_key];
1587
+ }
1588
+
1589
+ return [].concat(args).reduce(function (p, c) {
1590
+ return p.replace(/%s/, c);
1591
+ }, str);
1592
+ }
1593
+
1594
+ var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
1595
+ var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
1596
+ var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
1597
+ function validateModifiers(modifiers) {
1598
+ modifiers.forEach(function (modifier) {
1599
+ [].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
1600
+ .filter(function (value, index, self) {
1601
+ return self.indexOf(value) === index;
1602
+ }).forEach(function (key) {
1603
+ switch (key) {
1604
+ case 'name':
1605
+ if (typeof modifier.name !== 'string') {
1606
+ console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
1607
+ }
1608
+
1609
+ break;
1610
+
1611
+ case 'enabled':
1612
+ if (typeof modifier.enabled !== 'boolean') {
1613
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
1614
+ }
1615
+
1616
+ break;
1617
+
1618
+ case 'phase':
1619
+ if (modifierPhases.indexOf(modifier.phase) < 0) {
1620
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
1621
+ }
1622
+
1623
+ break;
1624
+
1625
+ case 'fn':
1626
+ if (typeof modifier.fn !== 'function') {
1627
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
1628
+ }
1629
+
1630
+ break;
1631
+
1632
+ case 'effect':
1633
+ if (modifier.effect != null && typeof modifier.effect !== 'function') {
1634
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
1635
+ }
1636
+
1637
+ break;
1638
+
1639
+ case 'requires':
1640
+ if (modifier.requires != null && !Array.isArray(modifier.requires)) {
1641
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
1642
+ }
1643
+
1644
+ break;
1645
+
1646
+ case 'requiresIfExists':
1647
+ if (!Array.isArray(modifier.requiresIfExists)) {
1648
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
1649
+ }
1650
+
1651
+ break;
1652
+
1653
+ case 'options':
1654
+ case 'data':
1655
+ break;
1656
+
1657
+ default:
1658
+ console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
1659
+ return "\"" + s + "\"";
1660
+ }).join(', ') + "; but \"" + key + "\" was provided.");
1661
+ }
1662
+
1663
+ modifier.requires && modifier.requires.forEach(function (requirement) {
1664
+ if (modifiers.find(function (mod) {
1665
+ return mod.name === requirement;
1666
+ }) == null) {
1667
+ console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
1668
+ }
1669
+ });
1670
+ });
1671
+ });
1672
+ }
1673
+
1674
+ function uniqueBy(arr, fn) {
1675
+ var identifiers = new Set();
1676
+ return arr.filter(function (item) {
1677
+ var identifier = fn(item);
1678
+
1679
+ if (!identifiers.has(identifier)) {
1680
+ identifiers.add(identifier);
1681
+ return true;
1682
+ }
1683
+ });
1684
+ }
1685
+
1471
1686
  function mergeByName(modifiers) {
1472
1687
  var merged = modifiers.reduce(function (merged, current) {
1473
1688
  var existing = merged[current.name];
1474
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1475
- options: Object.assign(Object.assign({}, existing.options), current.options),
1476
- data: Object.assign(Object.assign({}, existing.data), current.data)
1689
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1690
+ options: Object.assign({}, existing.options, current.options),
1691
+ data: Object.assign({}, existing.data, current.data)
1477
1692
  }) : current;
1478
1693
  return merged;
1479
1694
  }, {}); // IE11 does not support Object.values
@@ -1483,6 +1698,8 @@ var VueTippy = (function (exports, vueDemi) {
1483
1698
  });
1484
1699
  }
1485
1700
 
1701
+ var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
1702
+ var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
1486
1703
  var DEFAULT_OPTIONS = {
1487
1704
  placement: 'bottom',
1488
1705
  modifiers: [],
@@ -1517,7 +1734,7 @@ var VueTippy = (function (exports, vueDemi) {
1517
1734
  var state = {
1518
1735
  placement: 'bottom',
1519
1736
  orderedModifiers: [],
1520
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1737
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1521
1738
  modifiersData: {},
1522
1739
  elements: {
1523
1740
  reference: reference,
@@ -1530,9 +1747,10 @@ var VueTippy = (function (exports, vueDemi) {
1530
1747
  var isDestroyed = false;
1531
1748
  var instance = {
1532
1749
  state: state,
1533
- setOptions: function setOptions(options) {
1750
+ setOptions: function setOptions(setOptionsAction) {
1751
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1534
1752
  cleanupModifierEffects();
1535
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1753
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1536
1754
  state.scrollParents = {
1537
1755
  reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1538
1756
  popper: listScrollParents(popper)
@@ -1544,6 +1762,40 @@ var VueTippy = (function (exports, vueDemi) {
1544
1762
  state.orderedModifiers = orderedModifiers.filter(function (m) {
1545
1763
  return m.enabled;
1546
1764
  }); // Validate the provided modifiers so that the consumer will get warned
1765
+ // if one of the modifiers is invalid for any reason
1766
+
1767
+ {
1768
+ var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
1769
+ var name = _ref.name;
1770
+ return name;
1771
+ });
1772
+ validateModifiers(modifiers);
1773
+
1774
+ if (getBasePlacement(state.options.placement) === auto) {
1775
+ var flipModifier = state.orderedModifiers.find(function (_ref2) {
1776
+ var name = _ref2.name;
1777
+ return name === 'flip';
1778
+ });
1779
+
1780
+ if (!flipModifier) {
1781
+ console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
1782
+ }
1783
+ }
1784
+
1785
+ var _getComputedStyle = getComputedStyle(popper),
1786
+ marginTop = _getComputedStyle.marginTop,
1787
+ marginRight = _getComputedStyle.marginRight,
1788
+ marginBottom = _getComputedStyle.marginBottom,
1789
+ marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
1790
+ // cause bugs with positioning, so we'll warn the consumer
1791
+
1792
+
1793
+ if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
1794
+ return parseFloat(margin);
1795
+ })) {
1796
+ console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
1797
+ }
1798
+ }
1547
1799
 
1548
1800
  runModifierEffects();
1549
1801
  return instance.update();
@@ -1564,6 +1816,9 @@ var VueTippy = (function (exports, vueDemi) {
1564
1816
  // anymore
1565
1817
 
1566
1818
  if (!areValidElements(reference, popper)) {
1819
+ {
1820
+ console.error(INVALID_ELEMENT_ERROR);
1821
+ }
1567
1822
 
1568
1823
  return;
1569
1824
  } // Store the reference and popper rects to be read by modifiers
@@ -1587,8 +1842,17 @@ var VueTippy = (function (exports, vueDemi) {
1587
1842
  state.orderedModifiers.forEach(function (modifier) {
1588
1843
  return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1589
1844
  });
1845
+ var __debug_loops__ = 0;
1590
1846
 
1591
1847
  for (var index = 0; index < state.orderedModifiers.length; index++) {
1848
+ {
1849
+ __debug_loops__ += 1;
1850
+
1851
+ if (__debug_loops__ > 100) {
1852
+ console.error(INFINITE_LOOP_ERROR);
1853
+ break;
1854
+ }
1855
+ }
1592
1856
 
1593
1857
  if (state.reset === true) {
1594
1858
  state.reset = false;
@@ -1627,6 +1891,9 @@ var VueTippy = (function (exports, vueDemi) {
1627
1891
  };
1628
1892
 
1629
1893
  if (!areValidElements(reference, popper)) {
1894
+ {
1895
+ console.error(INVALID_ELEMENT_ERROR);
1896
+ }
1630
1897
 
1631
1898
  return instance;
1632
1899
  }
@@ -1680,10 +1947,12 @@ var VueTippy = (function (exports, vueDemi) {
1680
1947
  }); // eslint-disable-next-line import/no-unused-modules
1681
1948
 
1682
1949
  /**!
1683
- * tippy.js v6.2.7
1684
- * (c) 2017-2020 atomiks
1950
+ * tippy.js v6.3.7
1951
+ * (c) 2017-2021 atomiks
1685
1952
  * MIT License
1686
1953
  */
1954
+
1955
+ 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>';
1687
1956
  var BOX_CLASS = "tippy-box";
1688
1957
  var CONTENT_CLASS = "tippy-content";
1689
1958
  var BACKDROP_CLASS = "tippy-backdrop";
@@ -1693,6 +1962,13 @@ var VueTippy = (function (exports, vueDemi) {
1693
1962
  passive: true,
1694
1963
  capture: true
1695
1964
  };
1965
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1966
+ return document.body;
1967
+ };
1968
+
1969
+ function hasOwnProperty(obj, key) {
1970
+ return {}.hasOwnProperty.call(obj, key);
1971
+ }
1696
1972
  function getValueAtIndexOrReturn(value, index, defaultValue) {
1697
1973
  if (Array.isArray(value)) {
1698
1974
  var v = value[index];
@@ -1808,10 +2084,13 @@ var VueTippy = (function (exports, vueDemi) {
1808
2084
  });
1809
2085
  }
1810
2086
  function getOwnerDocument(elementOrElements) {
2087
+ var _element$ownerDocumen;
2088
+
1811
2089
  var _normalizeToArray = normalizeToArray(elementOrElements),
1812
- element = _normalizeToArray[0];
2090
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
2091
+
1813
2092
 
1814
- return element ? element.ownerDocument || document : document;
2093
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1815
2094
  }
1816
2095
  function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1817
2096
  var clientX = event.clientX,
@@ -1847,6 +2126,26 @@ var VueTippy = (function (exports, vueDemi) {
1847
2126
  box[method](event, listener);
1848
2127
  });
1849
2128
  }
2129
+ /**
2130
+ * Compared to xxx.contains, this function works for dom structures with shadow
2131
+ * dom
2132
+ */
2133
+
2134
+ function actualContains(parent, child) {
2135
+ var target = child;
2136
+
2137
+ while (target) {
2138
+ var _target$getRootNode;
2139
+
2140
+ if (parent.contains(target)) {
2141
+ return true;
2142
+ }
2143
+
2144
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
2145
+ }
2146
+
2147
+ return false;
2148
+ }
1850
2149
 
1851
2150
  var currentInput = {
1852
2151
  isTouch: false
@@ -1910,8 +2209,63 @@ var VueTippy = (function (exports, vueDemi) {
1910
2209
  }
1911
2210
 
1912
2211
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1913
- var ua = isBrowser ? navigator.userAgent : '';
1914
- var isIE = /MSIE |Trident\//.test(ua);
2212
+ var isIE11 = isBrowser ? // @ts-ignore
2213
+ !!window.msCrypto : false;
2214
+
2215
+ function createMemoryLeakWarning(method) {
2216
+ var txt = method === 'destroy' ? 'n already-' : ' ';
2217
+ return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
2218
+ }
2219
+ function clean(value) {
2220
+ var spacesAndTabs = /[ \t]{2,}/g;
2221
+ var lineStartWithSpaces = /^[ \t]*/gm;
2222
+ return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
2223
+ }
2224
+
2225
+ function getDevMessage(message) {
2226
+ return clean("\n %ctippy.js\n\n %c" + clean(message) + "\n\n %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n ");
2227
+ }
2228
+
2229
+ function getFormattedMessage(message) {
2230
+ return [getDevMessage(message), // title
2231
+ 'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
2232
+ 'line-height: 1.5', // footer
2233
+ 'color: #a6a095;'];
2234
+ } // Assume warnings and errors never have the same message
2235
+
2236
+ var visitedMessages;
2237
+
2238
+ {
2239
+ resetVisitedMessages();
2240
+ }
2241
+
2242
+ function resetVisitedMessages() {
2243
+ visitedMessages = new Set();
2244
+ }
2245
+ function warnWhen(condition, message) {
2246
+ if (condition && !visitedMessages.has(message)) {
2247
+ var _console;
2248
+
2249
+ visitedMessages.add(message);
2250
+
2251
+ (_console = console).warn.apply(_console, getFormattedMessage(message));
2252
+ }
2253
+ }
2254
+ function errorWhen(condition, message) {
2255
+ if (condition && !visitedMessages.has(message)) {
2256
+ var _console2;
2257
+
2258
+ visitedMessages.add(message);
2259
+
2260
+ (_console2 = console).error.apply(_console2, getFormattedMessage(message));
2261
+ }
2262
+ }
2263
+ function validateTargets(targets) {
2264
+ var didPassFalsyValue = !targets;
2265
+ var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
2266
+ errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
2267
+ errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
2268
+ }
1915
2269
 
1916
2270
  var pluginProps = {
1917
2271
  animateFill: false,
@@ -1931,9 +2285,7 @@ var VueTippy = (function (exports, vueDemi) {
1931
2285
  zIndex: 9999
1932
2286
  };
1933
2287
  var defaultProps = Object.assign({
1934
- appendTo: function appendTo() {
1935
- return document.body;
1936
- },
2288
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
1937
2289
  aria: {
1938
2290
  content: 'auto',
1939
2291
  expanded: 'auto'
@@ -1968,9 +2320,13 @@ var VueTippy = (function (exports, vueDemi) {
1968
2320
  touch: true,
1969
2321
  trigger: 'mouseenter focus',
1970
2322
  triggerTarget: null
1971
- }, pluginProps, {}, renderProps);
2323
+ }, pluginProps, renderProps);
1972
2324
  var defaultKeys = Object.keys(defaultProps);
1973
2325
  var setDefaultProps = function setDefaultProps(partialProps) {
2326
+ /* istanbul ignore else */
2327
+ {
2328
+ validateProps(partialProps, []);
2329
+ }
1974
2330
 
1975
2331
  var keys = Object.keys(partialProps);
1976
2332
  keys.forEach(function (key) {
@@ -1984,12 +2340,14 @@ var VueTippy = (function (exports, vueDemi) {
1984
2340
  defaultValue = plugin.defaultValue;
1985
2341
 
1986
2342
  if (name) {
1987
- acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
2343
+ var _name;
2344
+
2345
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
1988
2346
  }
1989
2347
 
1990
2348
  return acc;
1991
2349
  }, {});
1992
- return Object.assign({}, passedProps, {}, pluginProps);
2350
+ return Object.assign({}, passedProps, pluginProps);
1993
2351
  }
1994
2352
  function getDataAttributeProps(reference, plugins) {
1995
2353
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
@@ -2020,13 +2378,36 @@ var VueTippy = (function (exports, vueDemi) {
2020
2378
  var out = Object.assign({}, props, {
2021
2379
  content: invokeWithArgsOrReturn(props.content, [reference])
2022
2380
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2023
- out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
2381
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2024
2382
  out.aria = {
2025
2383
  expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2026
2384
  content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
2027
2385
  };
2028
2386
  return out;
2029
2387
  }
2388
+ function validateProps(partialProps, plugins) {
2389
+ if (partialProps === void 0) {
2390
+ partialProps = {};
2391
+ }
2392
+
2393
+ if (plugins === void 0) {
2394
+ plugins = [];
2395
+ }
2396
+
2397
+ var keys = Object.keys(partialProps);
2398
+ keys.forEach(function (prop) {
2399
+ var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
2400
+ var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
2401
+
2402
+ if (didPassUnknownProp) {
2403
+ didPassUnknownProp = plugins.filter(function (plugin) {
2404
+ return plugin.name === prop;
2405
+ }).length === 0;
2406
+ }
2407
+
2408
+ warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' '));
2409
+ });
2410
+ }
2030
2411
 
2031
2412
  var innerHTML = function innerHTML() {
2032
2413
  return 'innerHTML';
@@ -2158,7 +2539,7 @@ var VueTippy = (function (exports, vueDemi) {
2158
2539
 
2159
2540
  var mountedInstances = [];
2160
2541
  function createTippy(reference, passedProps) {
2161
- var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2542
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2162
2543
  // 🔒 Private members
2163
2544
  // ===========================================================================
2164
2545
 
@@ -2219,6 +2600,9 @@ var VueTippy = (function (exports, vueDemi) {
2219
2600
  /* istanbul ignore if */
2220
2601
 
2221
2602
  if (!props.render) {
2603
+ {
2604
+ errorWhen(true, 'render() function has not been supplied.');
2605
+ }
2222
2606
 
2223
2607
  return instance;
2224
2608
  } // ===========================================================================
@@ -2255,10 +2639,9 @@ var VueTippy = (function (exports, vueDemi) {
2255
2639
  instance.clearDelayTimeouts();
2256
2640
  }
2257
2641
  });
2258
- popper.addEventListener('mouseleave', function (event) {
2642
+ popper.addEventListener('mouseleave', function () {
2259
2643
  if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2260
2644
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2261
- debouncedOnMouseMove(event);
2262
2645
  }
2263
2646
  });
2264
2647
  return instance; // ===========================================================================
@@ -2278,7 +2661,7 @@ var VueTippy = (function (exports, vueDemi) {
2278
2661
  var _instance$props$rende;
2279
2662
 
2280
2663
  // @ts-ignore
2281
- return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
2664
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2282
2665
  }
2283
2666
 
2284
2667
  function getCurrentTarget() {
@@ -2305,8 +2688,12 @@ var VueTippy = (function (exports, vueDemi) {
2305
2688
  return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2306
2689
  }
2307
2690
 
2308
- function handleStyles() {
2309
- popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
2691
+ function handleStyles(fromHide) {
2692
+ if (fromHide === void 0) {
2693
+ fromHide = false;
2694
+ }
2695
+
2696
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2310
2697
  popper.style.zIndex = "" + instance.props.zIndex;
2311
2698
  }
2312
2699
 
@@ -2317,7 +2704,7 @@ var VueTippy = (function (exports, vueDemi) {
2317
2704
 
2318
2705
  pluginsHooks.forEach(function (pluginHooks) {
2319
2706
  if (pluginHooks[hook]) {
2320
- pluginHooks[hook].apply(void 0, args);
2707
+ pluginHooks[hook].apply(pluginHooks, args);
2321
2708
  }
2322
2709
  });
2323
2710
 
@@ -2383,15 +2770,18 @@ var VueTippy = (function (exports, vueDemi) {
2383
2770
  if (didTouchMove || event.type === 'mousedown') {
2384
2771
  return;
2385
2772
  }
2386
- } // Clicked on interactive popper
2773
+ }
2387
2774
 
2775
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2388
2776
 
2389
- if (instance.props.interactive && popper.contains(event.target)) {
2777
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2390
2778
  return;
2391
2779
  } // Clicked on the event listeners target
2392
2780
 
2393
2781
 
2394
- if (getCurrentTarget().contains(event.target)) {
2782
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2783
+ return actualContains(el, actualTarget);
2784
+ })) {
2395
2785
  if (currentInput.isTouch) {
2396
2786
  return;
2397
2787
  }
@@ -2519,7 +2909,7 @@ var VueTippy = (function (exports, vueDemi) {
2519
2909
  break;
2520
2910
 
2521
2911
  case 'focus':
2522
- on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
2912
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2523
2913
  break;
2524
2914
 
2525
2915
  case 'focusin':
@@ -2745,7 +3135,7 @@ var VueTippy = (function (exports, vueDemi) {
2745
3135
 
2746
3136
  var node = getCurrentTarget();
2747
3137
 
2748
- if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
3138
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2749
3139
  parentNode = node.parentNode;
2750
3140
  } else {
2751
3141
  parentNode = invokeWithArgsOrReturn(appendTo, [node]);
@@ -2757,7 +3147,14 @@ var VueTippy = (function (exports, vueDemi) {
2757
3147
  parentNode.appendChild(popper);
2758
3148
  }
2759
3149
 
3150
+ instance.state.isMounted = true;
2760
3151
  createPopperInstance();
3152
+ /* istanbul ignore else */
3153
+
3154
+ {
3155
+ // Accessibility check
3156
+ warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper <div> or <span> tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' '));
3157
+ }
2761
3158
  }
2762
3159
 
2763
3160
  function getNestedPopperTree() {
@@ -2846,6 +3243,10 @@ var VueTippy = (function (exports, vueDemi) {
2846
3243
  }
2847
3244
 
2848
3245
  function setProps(partialProps) {
3246
+ /* istanbul ignore else */
3247
+ {
3248
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
3249
+ }
2849
3250
 
2850
3251
  if (instance.state.isDestroyed) {
2851
3252
  return;
@@ -2854,7 +3255,7 @@ var VueTippy = (function (exports, vueDemi) {
2854
3255
  invokeHook('onBeforeUpdate', [instance, partialProps]);
2855
3256
  removeListeners();
2856
3257
  var prevProps = instance.props;
2857
- var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
3258
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
2858
3259
  ignoreAttributes: true
2859
3260
  }));
2860
3261
  instance.props = nextProps;
@@ -2904,6 +3305,10 @@ var VueTippy = (function (exports, vueDemi) {
2904
3305
  }
2905
3306
 
2906
3307
  function show() {
3308
+ /* istanbul ignore else */
3309
+ {
3310
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
3311
+ } // Early bail-out
2907
3312
 
2908
3313
 
2909
3314
  var isAlreadyVisible = instance.state.isVisible;
@@ -2953,6 +3358,8 @@ var VueTippy = (function (exports, vueDemi) {
2953
3358
  }
2954
3359
 
2955
3360
  onFirstUpdate = function onFirstUpdate() {
3361
+ var _instance$popperInsta2;
3362
+
2956
3363
  if (!instance.state.isVisible || ignoreOnFirstUpdate) {
2957
3364
  return;
2958
3365
  }
@@ -2973,8 +3380,10 @@ var VueTippy = (function (exports, vueDemi) {
2973
3380
 
2974
3381
  handleAriaContentAttribute();
2975
3382
  handleAriaExpandedAttribute();
2976
- pushIfUnique(mountedInstances, instance);
2977
- instance.state.isMounted = true;
3383
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3384
+ // popper has been positioned for the first time
3385
+
3386
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
2978
3387
  invokeHook('onMount', [instance]);
2979
3388
 
2980
3389
  if (instance.props.animation && getIsDefaultRenderFn()) {
@@ -2989,6 +3398,10 @@ var VueTippy = (function (exports, vueDemi) {
2989
3398
  }
2990
3399
 
2991
3400
  function hide() {
3401
+ /* istanbul ignore else */
3402
+ {
3403
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
3404
+ } // Early bail-out
2992
3405
 
2993
3406
 
2994
3407
  var isAlreadyHidden = !instance.state.isVisible;
@@ -3017,7 +3430,7 @@ var VueTippy = (function (exports, vueDemi) {
3017
3430
 
3018
3431
  cleanupInteractiveMouseListeners();
3019
3432
  removeDocumentPress();
3020
- handleStyles();
3433
+ handleStyles(true);
3021
3434
 
3022
3435
  if (getIsDefaultRenderFn()) {
3023
3436
  var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
@@ -3043,6 +3456,10 @@ var VueTippy = (function (exports, vueDemi) {
3043
3456
  }
3044
3457
 
3045
3458
  function hideWithInteractivity(event) {
3459
+ /* istanbul ignore else */
3460
+ {
3461
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
3462
+ }
3046
3463
 
3047
3464
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
3048
3465
  pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
@@ -3050,6 +3467,10 @@ var VueTippy = (function (exports, vueDemi) {
3050
3467
  }
3051
3468
 
3052
3469
  function unmount() {
3470
+ /* istanbul ignore else */
3471
+ {
3472
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
3473
+ }
3053
3474
 
3054
3475
  if (instance.state.isVisible) {
3055
3476
  instance.hide();
@@ -3079,6 +3500,10 @@ var VueTippy = (function (exports, vueDemi) {
3079
3500
  }
3080
3501
 
3081
3502
  function destroy() {
3503
+ /* istanbul ignore else */
3504
+ {
3505
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
3506
+ }
3082
3507
 
3083
3508
  if (instance.state.isDestroyed) {
3084
3509
  return;
@@ -3099,12 +3524,25 @@ var VueTippy = (function (exports, vueDemi) {
3099
3524
  }
3100
3525
 
3101
3526
  var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
3527
+ /* istanbul ignore else */
3528
+
3529
+ {
3530
+ validateTargets(targets);
3531
+ validateProps(optionalProps, plugins);
3532
+ }
3102
3533
 
3103
3534
  bindGlobalEventListeners();
3104
3535
  var passedProps = Object.assign({}, optionalProps, {
3105
3536
  plugins: plugins
3106
3537
  });
3107
3538
  var elements = getArrayOfElements(targets);
3539
+ /* istanbul ignore else */
3540
+
3541
+ {
3542
+ var isSingleContentElement = isElement$1(passedProps.content);
3543
+ var isMoreThanOneReferenceElement = elements.length > 1;
3544
+ warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' '));
3545
+ }
3108
3546
 
3109
3547
  var instances = elements.reduce(function (acc, reference) {
3110
3548
  var instance = reference && createTippy(reference, passedProps);
@@ -3122,16 +3560,63 @@ var VueTippy = (function (exports, vueDemi) {
3122
3560
  tippy.setDefaultProps = setDefaultProps;
3123
3561
  tippy.currentInput = currentInput;
3124
3562
 
3563
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3564
+ // and causing transitions to break for singletons when the console is open, but
3565
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3566
+
3567
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3568
+ effect: function effect(_ref) {
3569
+ var state = _ref.state;
3570
+ var initialStyles = {
3571
+ popper: {
3572
+ position: state.options.strategy,
3573
+ left: '0',
3574
+ top: '0',
3575
+ margin: '0'
3576
+ },
3577
+ arrow: {
3578
+ position: 'absolute'
3579
+ },
3580
+ reference: {}
3581
+ };
3582
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3583
+ state.styles = initialStyles;
3584
+
3585
+ if (state.elements.arrow) {
3586
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3587
+ } // intentionally return no cleanup function
3588
+ // return () => { ... }
3589
+
3590
+ }
3591
+ });
3592
+
3125
3593
  var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3594
+ var _optionalProps$popper;
3595
+
3126
3596
  if (optionalProps === void 0) {
3127
3597
  optionalProps = {};
3128
3598
  }
3129
3599
 
3600
+ /* istanbul ignore else */
3601
+ {
3602
+ errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
3603
+ }
3604
+
3130
3605
  var individualInstances = tippyInstances;
3131
3606
  var references = [];
3607
+ var triggerTargets = [];
3132
3608
  var currentTarget;
3133
3609
  var overrides = optionalProps.overrides;
3134
3610
  var interceptSetPropsCleanups = [];
3611
+ var shownOnCreate = false;
3612
+
3613
+ function setTriggerTargets() {
3614
+ triggerTargets = individualInstances.map(function (instance) {
3615
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3616
+ }).reduce(function (acc, item) {
3617
+ return acc.concat(item);
3618
+ }, []);
3619
+ }
3135
3620
 
3136
3621
  function setReferences() {
3137
3622
  references = individualInstances.map(function (instance) {
@@ -3165,42 +3650,123 @@ var VueTippy = (function (exports, vueDemi) {
3165
3650
  instance.setProps = originalSetProps;
3166
3651
  };
3167
3652
  });
3653
+ } // have to pass singleton, as it maybe undefined on first call
3654
+
3655
+
3656
+ function prepareInstance(singleton, target) {
3657
+ var index = triggerTargets.indexOf(target); // bail-out
3658
+
3659
+ if (target === currentTarget) {
3660
+ return;
3661
+ }
3662
+
3663
+ currentTarget = target;
3664
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3665
+ acc[prop] = individualInstances[index].props[prop];
3666
+ return acc;
3667
+ }, {});
3668
+ singleton.setProps(Object.assign({}, overrideProps, {
3669
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3670
+ var _references$index;
3671
+
3672
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3673
+ }
3674
+ }));
3168
3675
  }
3169
3676
 
3170
3677
  enableInstances(false);
3171
3678
  setReferences();
3679
+ setTriggerTargets();
3172
3680
  var plugin = {
3173
3681
  fn: function fn() {
3174
3682
  return {
3175
3683
  onDestroy: function onDestroy() {
3176
3684
  enableInstances(true);
3177
3685
  },
3178
- onTrigger: function onTrigger(instance, event) {
3179
- var target = event.currentTarget;
3180
- var index = references.indexOf(target); // bail-out
3181
-
3182
- if (target === currentTarget) {
3183
- return;
3686
+ onHidden: function onHidden() {
3687
+ currentTarget = null;
3688
+ },
3689
+ onClickOutside: function onClickOutside(instance) {
3690
+ if (instance.props.showOnCreate && !shownOnCreate) {
3691
+ shownOnCreate = true;
3692
+ currentTarget = null;
3184
3693
  }
3185
-
3186
- currentTarget = target;
3187
- var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3188
- acc[prop] = individualInstances[index].props[prop];
3189
- return acc;
3190
- }, {});
3191
- instance.setProps(Object.assign({}, overrideProps, {
3192
- getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3193
- return target.getBoundingClientRect();
3194
- }
3195
- }));
3694
+ },
3695
+ onShow: function onShow(instance) {
3696
+ if (instance.props.showOnCreate && !shownOnCreate) {
3697
+ shownOnCreate = true;
3698
+ prepareInstance(instance, references[0]);
3699
+ }
3700
+ },
3701
+ onTrigger: function onTrigger(instance, event) {
3702
+ prepareInstance(instance, event.currentTarget);
3196
3703
  }
3197
3704
  };
3198
3705
  }
3199
3706
  };
3200
3707
  var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3201
3708
  plugins: [plugin].concat(optionalProps.plugins || []),
3202
- triggerTarget: references
3709
+ triggerTarget: triggerTargets,
3710
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3711
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3712
+ })
3203
3713
  }));
3714
+ var originalShow = singleton.show;
3715
+
3716
+ singleton.show = function (target) {
3717
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3718
+ // default to showing first instance
3719
+
3720
+ if (!currentTarget && target == null) {
3721
+ return prepareInstance(singleton, references[0]);
3722
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3723
+ // programmatic call with no params when already visible (do nothing again)
3724
+
3725
+
3726
+ if (currentTarget && target == null) {
3727
+ return;
3728
+ } // target is index of instance
3729
+
3730
+
3731
+ if (typeof target === 'number') {
3732
+ return references[target] && prepareInstance(singleton, references[target]);
3733
+ } // target is a child tippy instance
3734
+
3735
+
3736
+ if (individualInstances.indexOf(target) >= 0) {
3737
+ var ref = target.reference;
3738
+ return prepareInstance(singleton, ref);
3739
+ } // target is a ReferenceElement
3740
+
3741
+
3742
+ if (references.indexOf(target) >= 0) {
3743
+ return prepareInstance(singleton, target);
3744
+ }
3745
+ };
3746
+
3747
+ singleton.showNext = function () {
3748
+ var first = references[0];
3749
+
3750
+ if (!currentTarget) {
3751
+ return singleton.show(0);
3752
+ }
3753
+
3754
+ var index = references.indexOf(currentTarget);
3755
+ singleton.show(references[index + 1] || first);
3756
+ };
3757
+
3758
+ singleton.showPrevious = function () {
3759
+ var last = references[references.length - 1];
3760
+
3761
+ if (!currentTarget) {
3762
+ return singleton.show(last);
3763
+ }
3764
+
3765
+ var index = references.indexOf(currentTarget);
3766
+ var target = references[index - 1] || last;
3767
+ singleton.show(target);
3768
+ };
3769
+
3204
3770
  var originalSetProps = singleton.setProps;
3205
3771
 
3206
3772
  singleton.setProps = function (props) {
@@ -3216,9 +3782,10 @@ var VueTippy = (function (exports, vueDemi) {
3216
3782
  individualInstances = nextInstances;
3217
3783
  enableInstances(false);
3218
3784
  setReferences();
3219
- interceptSetProps(singleton);
3785
+ setTriggerTargets();
3786
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3220
3787
  singleton.setProps({
3221
- triggerTarget: references
3788
+ triggerTarget: triggerTargets
3222
3789
  });
3223
3790
  };
3224
3791
 
@@ -3233,7 +3800,10 @@ var VueTippy = (function (exports, vueDemi) {
3233
3800
  var _instance$props$rende;
3234
3801
 
3235
3802
  // @ts-ignore
3236
- if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
3803
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3804
+ {
3805
+ errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
3806
+ }
3237
3807
 
3238
3808
  return {};
3239
3809
  }
@@ -3355,6 +3925,7 @@ var VueTippy = (function (exports, vueDemi) {
3355
3925
 
3356
3926
  if (isCursorOverReference || !instance.props.interactive) {
3357
3927
  instance.setProps({
3928
+ // @ts-ignore - unneeded DOMRect properties
3358
3929
  getReferenceClientRect: function getReferenceClientRect() {
3359
3930
  var rect = reference.getBoundingClientRect();
3360
3931
  var x = clientX;
@@ -3491,6 +4062,7 @@ var VueTippy = (function (exports, vueDemi) {
3491
4062
  var placement;
3492
4063
  var cursorRectIndex = -1;
3493
4064
  var isInternalUpdate = false;
4065
+ var triedPlacements = [];
3494
4066
  var modifier = {
3495
4067
  name: 'tippyInlinePositioning',
3496
4068
  enabled: true,
@@ -3499,8 +4071,14 @@ var VueTippy = (function (exports, vueDemi) {
3499
4071
  var state = _ref2.state;
3500
4072
 
3501
4073
  if (isEnabled()) {
3502
- if (placement !== state.placement) {
4074
+ if (triedPlacements.indexOf(state.placement) !== -1) {
4075
+ triedPlacements = [];
4076
+ }
4077
+
4078
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
4079
+ triedPlacements.push(state.placement);
3503
4080
  instance.setProps({
4081
+ // @ts-ignore - unneeded DOMRect properties
3504
4082
  getReferenceClientRect: function getReferenceClientRect() {
3505
4083
  return _getReferenceClientRect(state.placement);
3506
4084
  }
@@ -3537,10 +4115,11 @@ var VueTippy = (function (exports, vueDemi) {
3537
4115
  var cursorRect = rects.find(function (rect) {
3538
4116
  return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
3539
4117
  });
3540
- cursorRectIndex = rects.indexOf(cursorRect);
4118
+ var index = rects.indexOf(cursorRect);
4119
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
3541
4120
  }
3542
4121
  },
3543
- onUntrigger: function onUntrigger() {
4122
+ onHidden: function onHidden() {
3544
4123
  cursorRectIndex = -1;
3545
4124
  }
3546
4125
  };
@@ -3684,51 +4263,103 @@ var VueTippy = (function (exports, vueDemi) {
3684
4263
  },
3685
4264
  });
3686
4265
  function useTippy(el, opts = {}, settings = { mount: true }) {
3687
- const instance = vueDemi.ref();
4266
+ const vm = vue.getCurrentInstance();
4267
+ const instance = vue.ref();
4268
+ const state = vue.ref({
4269
+ isEnabled: false,
4270
+ isVisible: false,
4271
+ isDestroyed: false,
4272
+ isMounted: false,
4273
+ isShown: false,
4274
+ });
3688
4275
  let container = null;
3689
4276
  const getContainer = () => {
3690
4277
  if (container)
3691
4278
  return container;
3692
- container = document.createElement('fragment');
4279
+ container = document.createDocumentFragment();
3693
4280
  return container;
3694
4281
  };
3695
4282
  const getContent = (content) => {
3696
4283
  let newContent;
3697
- let unwrappedContent = vueDemi.isRef(content)
4284
+ let unwrappedContent = vue.isRef(content)
3698
4285
  ? content.value
3699
4286
  : content;
3700
- if (vueDemi.isVue2) {
3701
- //@ts-ignore
3702
- newContent = unwrappedContent;
3703
- }
3704
- else {
3705
- if (vueDemi.isVNode(unwrappedContent)) {
3706
- vueDemi.render(unwrappedContent, getContainer());
3707
- newContent = () => getContainer();
3708
- }
3709
- else if (typeof unwrappedContent === 'object') {
3710
- vueDemi.render(vueDemi.h(unwrappedContent), getContainer());
3711
- newContent = () => getContainer();
4287
+ if (vue.isVNode(unwrappedContent)) {
4288
+ if (vm) {
4289
+ unwrappedContent.appContext = vm.appContext;
3712
4290
  }
3713
- else {
3714
- newContent = unwrappedContent;
4291
+ vue.render(unwrappedContent, getContainer());
4292
+ newContent = () => getContainer();
4293
+ }
4294
+ else if (typeof unwrappedContent === 'object') {
4295
+ let comp = vue.h(unwrappedContent);
4296
+ if (vm) {
4297
+ comp.appContext = vm.appContext;
3715
4298
  }
4299
+ vue.render(comp, getContainer());
4300
+ newContent = () => getContainer();
4301
+ }
4302
+ else {
4303
+ newContent = unwrappedContent;
3716
4304
  }
3717
4305
  return newContent;
3718
4306
  };
3719
4307
  const getProps = (opts) => {
3720
4308
  let options = {};
3721
- if (vueDemi.isRef(opts)) {
3722
- options = opts.value;
4309
+ if (vue.isRef(opts)) {
4310
+ options = opts.value || {};
3723
4311
  }
3724
- else if (vueDemi.isReactive(opts)) {
4312
+ else if (vue.isReactive(opts)) {
3725
4313
  options = { ...opts };
3726
4314
  }
3727
4315
  else {
3728
4316
  options = { ...opts };
3729
4317
  }
3730
- if (options.content)
4318
+ if (options.content) {
3731
4319
  options.content = getContent(options.content);
4320
+ }
4321
+ if (options.triggerTarget) {
4322
+ options.triggerTarget = vue.isRef(options.triggerTarget)
4323
+ ? options.triggerTarget.value
4324
+ : options.triggerTarget;
4325
+ }
4326
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4327
+ options.plugins = [];
4328
+ }
4329
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4330
+ options.plugins.push({
4331
+ name: 'vueTippyReactiveState',
4332
+ fn: () => {
4333
+ return {
4334
+ onCreate() {
4335
+ state.value.isEnabled = true;
4336
+ },
4337
+ onMount() {
4338
+ state.value.isMounted = true;
4339
+ },
4340
+ onShow() {
4341
+ state.value.isMounted = true;
4342
+ state.value.isVisible = true;
4343
+ },
4344
+ onShown() {
4345
+ state.value.isShown = true;
4346
+ },
4347
+ onHide() {
4348
+ state.value.isMounted = false;
4349
+ state.value.isVisible = false;
4350
+ },
4351
+ onHidden() {
4352
+ state.value.isShown = false;
4353
+ },
4354
+ onUnmounted() {
4355
+ state.value.isMounted = false;
4356
+ },
4357
+ onDestroy() {
4358
+ state.value.isDestroyed = true;
4359
+ },
4360
+ };
4361
+ }
4362
+ });
3732
4363
  return options;
3733
4364
  };
3734
4365
  const refresh = () => {
@@ -3767,10 +4398,12 @@ var VueTippy = (function (exports, vueDemi) {
3767
4398
  const disable = () => {
3768
4399
  var _a;
3769
4400
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4401
+ state.value.isEnabled = false;
3770
4402
  };
3771
4403
  const enable = () => {
3772
4404
  var _a;
3773
4405
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4406
+ state.value.isEnabled = true;
3774
4407
  };
3775
4408
  const unmount = () => {
3776
4409
  var _a;
@@ -3779,7 +4412,7 @@ var VueTippy = (function (exports, vueDemi) {
3779
4412
  const mount = () => {
3780
4413
  if (!el)
3781
4414
  return;
3782
- let target = vueDemi.isRef(el) ? el.value : el;
4415
+ let target = vue.isRef(el) ? el.value : el;
3783
4416
  if (typeof target === 'function')
3784
4417
  target = target();
3785
4418
  if (target) {
@@ -3801,17 +4434,17 @@ var VueTippy = (function (exports, vueDemi) {
3801
4434
  enable,
3802
4435
  unmount,
3803
4436
  mount,
4437
+ state,
3804
4438
  };
3805
4439
  if (settings.mount) {
3806
- const vm = vueDemi.getCurrentInstance();
3807
4440
  if (vm) {
3808
4441
  if (vm.isMounted) {
3809
4442
  mount();
3810
4443
  }
3811
4444
  else {
3812
- vueDemi.onMounted(mount);
4445
+ vue.onMounted(mount);
3813
4446
  }
3814
- vueDemi.onUnmounted(() => {
4447
+ vue.onUnmounted(() => {
3815
4448
  destroy();
3816
4449
  });
3817
4450
  }
@@ -3819,21 +4452,179 @@ var VueTippy = (function (exports, vueDemi) {
3819
4452
  mount();
3820
4453
  }
3821
4454
  }
3822
- if (vueDemi.isRef(opts) || vueDemi.isReactive(opts)) {
3823
- vueDemi.watch(opts, refresh, { immediate: false });
4455
+ if (vue.isRef(opts) || vue.isReactive(opts)) {
4456
+ vue.watch(opts, refresh, { immediate: false });
3824
4457
  }
3825
- else if (vueDemi.isRef(opts.content)) {
3826
- vueDemi.watch(opts.content, refreshContent, { immediate: false });
4458
+ else if (vue.isRef(opts.content)) {
4459
+ vue.watch(opts.content, refreshContent, { immediate: false });
3827
4460
  }
3828
4461
  return response;
3829
4462
  }
3830
4463
 
3831
- // const pluginProps = [
3832
- // 'animateFill',
3833
- // 'followCursor',
3834
- // 'inlinePositioning',
3835
- // 'sticky',
3836
- // ]
4464
+ function useTippyComponent(opts = {}, children) {
4465
+ const instance = vue.ref();
4466
+ return {
4467
+ instance,
4468
+ TippyComponent: vue.h(TippyComponent, {
4469
+ ...opts,
4470
+ onVnodeMounted: (vnode) => {
4471
+ //@ts-ignore
4472
+ instance.value = vnode.component.ctx;
4473
+ },
4474
+ }, children),
4475
+ };
4476
+ }
4477
+
4478
+ function useSingleton(instances, optionalProps) {
4479
+ const singleton = vue.ref();
4480
+ vue.onMounted(() => {
4481
+ const pendingTippyInstances = Array.isArray(instances)
4482
+ ? instances.map(i => i.value)
4483
+ : typeof instances === 'function'
4484
+ ? instances()
4485
+ : instances.value;
4486
+ const tippyInstances = pendingTippyInstances
4487
+ .map((instance) => {
4488
+ if (instance instanceof Element) {
4489
+ //@ts-ignore
4490
+ return instance._tippy;
4491
+ }
4492
+ return instance;
4493
+ })
4494
+ .filter(Boolean);
4495
+ singleton.value = createSingleton(tippyInstances, optionalProps
4496
+ ? { allowHTML: true, ...optionalProps }
4497
+ : { allowHTML: true });
4498
+ });
4499
+ return {
4500
+ singleton,
4501
+ };
4502
+ }
4503
+
4504
+ const TippyComponent = vue.defineComponent({
4505
+ props: {
4506
+ to: {
4507
+ type: [String, Function],
4508
+ },
4509
+ tag: {
4510
+ type: String,
4511
+ default: 'span'
4512
+ },
4513
+ contentTag: {
4514
+ type: String,
4515
+ default: 'span'
4516
+ },
4517
+ contentClass: {
4518
+ type: String,
4519
+ default: null
4520
+ },
4521
+ appendTo: { default: () => tippy.defaultProps['appendTo'] },
4522
+ aria: { default: () => tippy.defaultProps['aria'] },
4523
+ delay: { default: () => tippy.defaultProps['delay'] },
4524
+ duration: { default: () => tippy.defaultProps['duration'] },
4525
+ getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
4526
+ hideOnClick: { type: [Boolean, String], default: () => tippy.defaultProps['hideOnClick'] },
4527
+ ignoreAttributes: { type: Boolean, default: () => tippy.defaultProps['ignoreAttributes'] },
4528
+ interactive: { type: Boolean, default: () => tippy.defaultProps['interactive'] },
4529
+ interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
4530
+ interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
4531
+ moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
4532
+ offset: { default: () => tippy.defaultProps['offset'] },
4533
+ onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
4534
+ onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
4535
+ onCreate: { default: () => tippy.defaultProps['onCreate'] },
4536
+ onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
4537
+ onHidden: { default: () => tippy.defaultProps['onHidden'] },
4538
+ onHide: { default: () => tippy.defaultProps['onHide'] },
4539
+ onMount: { default: () => tippy.defaultProps['onMount'] },
4540
+ onShow: { default: () => tippy.defaultProps['onShow'] },
4541
+ onShown: { default: () => tippy.defaultProps['onShown'] },
4542
+ onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
4543
+ onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
4544
+ onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
4545
+ placement: { default: () => tippy.defaultProps['placement'] },
4546
+ plugins: { default: () => tippy.defaultProps['plugins'] },
4547
+ popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
4548
+ render: { default: () => tippy.defaultProps['render'] },
4549
+ showOnCreate: { type: Boolean, default: () => tippy.defaultProps['showOnCreate'] },
4550
+ touch: { type: [Boolean, String, Array], default: () => tippy.defaultProps['touch'] },
4551
+ trigger: { default: () => tippy.defaultProps['trigger'] },
4552
+ triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
4553
+ animateFill: { type: Boolean, default: () => tippy.defaultProps['animateFill'] },
4554
+ followCursor: { type: [Boolean, String], default: () => tippy.defaultProps['followCursor'] },
4555
+ inlinePositioning: { type: Boolean, default: () => tippy.defaultProps['inlinePositioning'] },
4556
+ sticky: { type: [Boolean, String], default: () => tippy.defaultProps['sticky'] },
4557
+ allowHTML: { type: Boolean, default: () => tippy.defaultProps['allowHTML'] },
4558
+ animation: { default: () => tippy.defaultProps['animation'] },
4559
+ arrow: { default: () => tippy.defaultProps['arrow'] },
4560
+ content: { default: () => tippy.defaultProps['content'] },
4561
+ inertia: { default: () => tippy.defaultProps['inertia'] },
4562
+ maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
4563
+ role: { default: () => tippy.defaultProps['role'] },
4564
+ theme: { default: () => tippy.defaultProps['theme'] },
4565
+ zIndex: { default: () => tippy.defaultProps['zIndex'] }
4566
+ },
4567
+ emits: ['state'],
4568
+ setup(props, { slots, emit, expose }) {
4569
+ const elem = vue.ref();
4570
+ const contentElem = vue.ref();
4571
+ const mounted = vue.ref(false);
4572
+ const getOptions = () => {
4573
+ let options = { ...props };
4574
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4575
+ if (options.hasOwnProperty(prop)) {
4576
+ // @ts-ignore
4577
+ delete options[prop];
4578
+ }
4579
+ }
4580
+ return options;
4581
+ };
4582
+ let target = elem;
4583
+ if (props.to) {
4584
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4585
+ target = () => props.to;
4586
+ }
4587
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4588
+ target = () => document.querySelector(props.to);
4589
+ }
4590
+ }
4591
+ const tippy = useTippy(target, getOptions());
4592
+ vue.onMounted(() => {
4593
+ mounted.value = true;
4594
+ vue.nextTick(() => {
4595
+ if (slots.content)
4596
+ tippy.setContent(() => contentElem.value);
4597
+ });
4598
+ });
4599
+ vue.watch(tippy.state, () => {
4600
+ emit('state', vue.unref(tippy.state));
4601
+ }, { immediate: true, deep: true });
4602
+ vue.watch(() => props, () => {
4603
+ tippy.setProps(getOptions());
4604
+ if (slots.content)
4605
+ tippy.setContent(() => contentElem.value);
4606
+ }, { deep: true });
4607
+ let exposed = vue.reactive({
4608
+ elem,
4609
+ contentElem,
4610
+ mounted,
4611
+ ...tippy
4612
+ });
4613
+ expose(exposed);
4614
+ return () => {
4615
+ const slot = slots.default ? slots.default(exposed) : [];
4616
+ return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4617
+ slot,
4618
+ vue.h(props.contentTag, {
4619
+ ref: contentElem,
4620
+ style: { display: mounted.value ? 'inherit' : 'none' },
4621
+ class: props.contentClass
4622
+ }, slots.content(exposed)),
4623
+ ] : slot);
4624
+ };
4625
+ },
4626
+ });
4627
+
3837
4628
  const booleanProps = [
3838
4629
  'a11y',
3839
4630
  'allowHTML',
@@ -3868,22 +4659,40 @@ var VueTippy = (function (exports, vueDemi) {
3868
4659
  };
3869
4660
  }
3870
4661
  });
3871
- const TippyComponent = vueDemi.defineComponent({
4662
+ const TippySingleton = vue.defineComponent({
3872
4663
  props,
3873
4664
  setup(props) {
3874
- const elem = vueDemi.ref();
3875
- const tippy = useTippy(elem, props);
3876
- return { elem, ...tippy };
4665
+ const instances = vue.ref([]);
4666
+ const { singleton } = useSingleton(instances, props);
4667
+ return { instances, singleton };
4668
+ },
4669
+ mounted() {
4670
+ var _a;
4671
+ const parent = this.$el.parentElement;
4672
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4673
+ this.instances = Array.from(elements)
4674
+ .map((el) => el._tippy)
4675
+ .filter(Boolean);
4676
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
3877
4677
  },
3878
4678
  render() {
3879
4679
  let slot = this.$slots.default ? this.$slots.default() : [];
3880
- return vueDemi.h('span', { ref: 'elem' }, slot);
4680
+ return vue.h(() => slot);
3881
4681
  },
3882
4682
  });
3883
4683
 
3884
4684
  const directive = {
3885
4685
  mounted(el, binding, vnode) {
3886
- const opts = binding.value || {};
4686
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4687
+ const modifiers = Object.keys(binding.modifiers || {});
4688
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4689
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4690
+ if (placement) {
4691
+ opts.placement = opts.placement || placement;
4692
+ }
4693
+ if (withArrow) {
4694
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4695
+ }
3887
4696
  if (vnode.props && vnode.props.onTippyShow) {
3888
4697
  opts.onShow = function (...args) {
3889
4698
  var _a;
@@ -3932,7 +4741,7 @@ var VueTippy = (function (exports, vueDemi) {
3932
4741
  }
3933
4742
  },
3934
4743
  updated(el, binding) {
3935
- const opts = binding.value || {};
4744
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
3936
4745
  if (el.getAttribute('title') && !opts.content) {
3937
4746
  opts.content = el.getAttribute('title');
3938
4747
  el.removeAttribute('title');
@@ -3954,76 +4763,30 @@ var VueTippy = (function (exports, vueDemi) {
3954
4763
  tippy.setDefaultProps(options.defaultProps || {});
3955
4764
  app.directive(options.directive || 'tippy', directive);
3956
4765
  app.component(options.component || 'tippy', TippyComponent);
4766
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
3957
4767
  },
3958
4768
  };
3959
4769
 
3960
- function useSingleton(instances, optionalProps) {
3961
- const singleton = vueDemi.ref();
3962
- vueDemi.onMounted(() => {
3963
- const pendingTippyInstances = Array.isArray(instances)
3964
- ? instances.map(i => i.value)
3965
- : instances.value;
3966
- const tippyInstances = pendingTippyInstances
3967
- .map((instance) => {
3968
- if (instance instanceof Element) {
3969
- //@ts-ignore
3970
- return instance._tippy;
3971
- }
3972
- return instance;
3973
- })
3974
- .filter(Boolean);
3975
- singleton.value = createSingleton(tippyInstances, optionalProps);
3976
- });
3977
- return {
3978
- singleton,
3979
- };
3980
- }
3981
-
3982
- function styleInject(css, ref) {
3983
- if ( ref === void 0 ) ref = {};
3984
- var insertAt = ref.insertAt;
3985
-
3986
- if (!css || typeof document === 'undefined') { return; }
3987
-
3988
- var head = document.head || document.getElementsByTagName('head')[0];
3989
- var style = document.createElement('style');
3990
- style.type = 'text/css';
3991
-
3992
- if (insertAt === 'top') {
3993
- if (head.firstChild) {
3994
- head.insertBefore(style, head.firstChild);
3995
- } else {
3996
- head.appendChild(style);
3997
- }
3998
- } else {
3999
- head.appendChild(style);
4000
- }
4001
-
4002
- if (style.styleSheet) {
4003
- style.styleSheet.cssText = css;
4004
- } else {
4005
- style.appendChild(document.createTextNode(css));
4006
- }
4007
- }
4008
-
4009
- 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}";
4010
- styleInject(css_248z);
4011
-
4012
4770
  const setDefaultProps$1 = tippy.setDefaultProps;
4013
4771
  setDefaultProps$1({
4772
+ ignoreAttributes: true,
4014
4773
  plugins: [sticky, inlinePositioning, followCursor, animateFill],
4015
4774
  });
4016
4775
 
4017
4776
  exports.Tippy = TippyComponent;
4777
+ exports.TippySingleton = TippySingleton;
4018
4778
  exports.default = plugin;
4019
4779
  exports.directive = directive;
4780
+ exports.plugin = plugin;
4781
+ exports.roundArrow = ROUND_ARROW;
4020
4782
  exports.setDefaultProps = setDefaultProps$1;
4021
4783
  exports.tippy = tippy;
4022
4784
  exports.useSingleton = useSingleton;
4023
4785
  exports.useTippy = useTippy;
4786
+ exports.useTippyComponent = useTippyComponent;
4024
4787
 
4025
4788
  Object.defineProperty(exports, '__esModule', { value: true });
4026
4789
 
4027
4790
  return exports;
4028
4791
 
4029
- }({}, VueDemi));
4792
+ }({}, Vue));