vue-tippy 6.0.0-alpha.3 → 6.0.0-alpha.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * vue-tippy v6.0.0-alpha.1
3
- * (c) 2020 Georges KABBOUCHI
2
+ * vue-tippy v6.0.0-alpha.32
3
+ * (c) 2021 Georges KABBOUCHI
4
4
  * @license MIT
5
5
  */
6
6
  var VueTippy = (function (exports, vue) {
@@ -42,10 +42,11 @@ var VueTippy = (function (exports, vue) {
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, vue) {
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
  }
@@ -91,7 +88,7 @@ var VueTippy = (function (exports, vue) {
91
88
  return;
92
89
  } // Flow doesn't support to extend this property, but it's the most
93
90
  // effective way to apply styles to an HTMLElement
94
- // $FlowFixMe
91
+ // $FlowFixMe[cannot-write]
95
92
 
96
93
 
97
94
  Object.assign(element.style, style);
@@ -122,6 +119,7 @@ var VueTippy = (function (exports, vue) {
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);
@@ -140,10 +138,7 @@ var VueTippy = (function (exports, vue) {
140
138
 
141
139
  if (!isHTMLElement(element) || !getNodeName(element)) {
142
140
  return;
143
- } // Flow doesn't support to extend this property, but it's the most
144
- // effective way to apply styles to an HTMLElement
145
- // $FlowFixMe
146
-
141
+ }
147
142
 
148
143
  Object.assign(element.style, style);
149
144
  Object.keys(attributes).forEach(function (attribute) {
@@ -167,14 +162,42 @@ var VueTippy = (function (exports, vue) {
167
162
  return placement.split('-')[0];
168
163
  }
169
164
 
170
- // Returns the layout rect of an element relative to its offsetParent. Layout
165
+ function getBoundingClientRect(element) {
166
+ var rect = element.getBoundingClientRect();
167
+ return {
168
+ width: rect.width,
169
+ height: rect.height,
170
+ top: rect.top,
171
+ right: rect.right,
172
+ bottom: rect.bottom,
173
+ left: rect.left,
174
+ x: rect.left,
175
+ y: rect.top
176
+ };
177
+ }
178
+
171
179
  // means it doesn't take into account transforms.
180
+
172
181
  function getLayoutRect(element) {
182
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
183
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
184
+
185
+ var width = element.offsetWidth;
186
+ var height = element.offsetHeight;
187
+
188
+ if (Math.abs(clientRect.width - width) <= 1) {
189
+ width = clientRect.width;
190
+ }
191
+
192
+ if (Math.abs(clientRect.height - height) <= 1) {
193
+ height = clientRect.height;
194
+ }
195
+
173
196
  return {
174
197
  x: element.offsetLeft,
175
198
  y: element.offsetTop,
176
- width: element.offsetWidth,
177
- height: element.offsetHeight
199
+ width: width,
200
+ height: height
178
201
  };
179
202
  }
180
203
 
@@ -190,7 +213,7 @@ var VueTippy = (function (exports, vue) {
190
213
  do {
191
214
  if (next && parent.isSameNode(next)) {
192
215
  return true;
193
- } // $FlowFixMe: need a better way to handle this...
216
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
194
217
 
195
218
 
196
219
  next = next.parentNode || next.host;
@@ -210,8 +233,9 @@ var VueTippy = (function (exports, vue) {
210
233
  }
211
234
 
212
235
  function getDocumentElement(element) {
213
- // $FlowFixMe: assume body is always available
214
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
236
+ // $FlowFixMe[incompatible-return]: assume body is always available
237
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
238
+ element.document) || window.document).documentElement;
215
239
  }
216
240
 
217
241
  function getParentNode(element) {
@@ -219,12 +243,13 @@ var VueTippy = (function (exports, vue) {
219
243
  return element;
220
244
  }
221
245
 
222
- return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
246
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
247
+ // $FlowFixMe[incompatible-return]
248
+ // $FlowFixMe[prop-missing]
223
249
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
224
- element.parentNode || // DOM Element detected
225
- // $FlowFixMe: need a better way to handle this...
226
- element.host || // ShadowRoot detected
227
- // $FlowFixMe: HTMLElement is a Node
250
+ element.parentNode || ( // DOM Element detected
251
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
252
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
228
253
  getDocumentElement(element) // fallback
229
254
 
230
255
  );
@@ -236,29 +261,32 @@ var VueTippy = (function (exports, vue) {
236
261
  return null;
237
262
  }
238
263
 
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;
264
+ return element.offsetParent;
250
265
  } // `.offsetParent` reports `null` for fixed elements, while absolute elements
251
266
  // return the containing block
252
267
 
253
268
 
254
269
  function getContainingBlock(element) {
270
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
271
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
272
+
273
+ if (isIE && isHTMLElement(element)) {
274
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
275
+ var elementCss = getComputedStyle(element);
276
+
277
+ if (elementCss.position === 'fixed') {
278
+ return null;
279
+ }
280
+ }
281
+
255
282
  var currentNode = getParentNode(element);
256
283
 
257
284
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
258
285
  var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
259
286
  // create a containing block.
287
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
260
288
 
261
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
289
+ 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
290
  return currentNode;
263
291
  } else {
264
292
  currentNode = currentNode.parentNode;
@@ -278,7 +306,7 @@ var VueTippy = (function (exports, vue) {
278
306
  offsetParent = getTrueOffsetParent(offsetParent);
279
307
  }
280
308
 
281
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
309
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
282
310
  return window;
283
311
  }
284
312
 
@@ -289,8 +317,12 @@ var VueTippy = (function (exports, vue) {
289
317
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
290
318
  }
291
319
 
292
- function within(min, value, max) {
293
- return Math.max(min, Math.min(value, max));
320
+ var max = Math.max;
321
+ var min = Math.min;
322
+ var round = Math.round;
323
+
324
+ function within(min$1, value, max$1) {
325
+ return max(min$1, min(value, max$1));
294
326
  }
295
327
 
296
328
  function getFreshSideObject() {
@@ -303,7 +335,7 @@ var VueTippy = (function (exports, vue) {
303
335
  }
304
336
 
305
337
  function mergePaddingObject(paddingObject) {
306
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
338
+ return Object.assign({}, getFreshSideObject(), paddingObject);
307
339
  }
308
340
 
309
341
  function expandToHashMap(value, keys) {
@@ -313,11 +345,19 @@ var VueTippy = (function (exports, vue) {
313
345
  }, {});
314
346
  }
315
347
 
348
+ var toPaddingObject = function toPaddingObject(padding, state) {
349
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
350
+ placement: state.placement
351
+ })) : padding;
352
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
353
+ };
354
+
316
355
  function arrow(_ref) {
317
356
  var _state$modifiersData$;
318
357
 
319
358
  var state = _ref.state,
320
- name = _ref.name;
359
+ name = _ref.name,
360
+ options = _ref.options;
321
361
  var arrowElement = state.elements.arrow;
322
362
  var popperOffsets = state.modifiersData.popperOffsets;
323
363
  var basePlacement = getBasePlacement(state.placement);
@@ -329,7 +369,7 @@ var VueTippy = (function (exports, vue) {
329
369
  return;
330
370
  }
331
371
 
332
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
372
+ var paddingObject = toPaddingObject(options.padding, state);
333
373
  var arrowRect = getLayoutRect(arrowElement);
334
374
  var minProp = axis === 'y' ? top : left;
335
375
  var maxProp = axis === 'y' ? bottom : right;
@@ -351,12 +391,9 @@ var VueTippy = (function (exports, vue) {
351
391
 
352
392
  function effect$1(_ref2) {
353
393
  var state = _ref2.state,
354
- options = _ref2.options,
355
- name = _ref2.name;
394
+ options = _ref2.options;
356
395
  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;
396
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
360
397
 
361
398
  if (arrowElement == null) {
362
399
  return;
@@ -377,9 +414,6 @@ var VueTippy = (function (exports, vue) {
377
414
  }
378
415
 
379
416
  state.elements.arrow = arrowElement;
380
- state.modifiersData[name + "#persistent"] = {
381
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
382
- };
383
417
  } // eslint-disable-next-line import/no-unused-modules
384
418
 
385
419
 
@@ -402,14 +436,14 @@ var VueTippy = (function (exports, vue) {
402
436
  // Zooming can change the DPR, but it seems to report a value that will
403
437
  // cleanly divide the values into the appropriate subpixels.
404
438
 
405
- function roundOffsets(_ref) {
439
+ function roundOffsetsByDPR(_ref) {
406
440
  var x = _ref.x,
407
441
  y = _ref.y;
408
442
  var win = window;
409
443
  var dpr = win.devicePixelRatio || 1;
410
444
  return {
411
- x: Math.round(x * dpr) / dpr || 0,
412
- y: Math.round(y * dpr) / dpr || 0
445
+ x: round(round(x * dpr) / dpr) || 0,
446
+ y: round(round(y * dpr) / dpr) || 0
413
447
  };
414
448
  }
415
449
 
@@ -422,11 +456,14 @@ var VueTippy = (function (exports, vue) {
422
456
  offsets = _ref2.offsets,
423
457
  position = _ref2.position,
424
458
  gpuAcceleration = _ref2.gpuAcceleration,
425
- adaptive = _ref2.adaptive;
459
+ adaptive = _ref2.adaptive,
460
+ roundOffsets = _ref2.roundOffsets;
426
461
 
427
- var _roundOffsets = roundOffsets(offsets),
428
- x = _roundOffsets.x,
429
- y = _roundOffsets.y;
462
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
463
+ _ref3$x = _ref3.x,
464
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
465
+ _ref3$y = _ref3.y,
466
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
430
467
 
431
468
  var hasX = offsets.hasOwnProperty('x');
432
469
  var hasY = offsets.hasOwnProperty('y');
@@ -436,23 +473,32 @@ var VueTippy = (function (exports, vue) {
436
473
 
437
474
  if (adaptive) {
438
475
  var offsetParent = getOffsetParent(popper);
476
+ var heightProp = 'clientHeight';
477
+ var widthProp = 'clientWidth';
439
478
 
440
479
  if (offsetParent === getWindow(popper)) {
441
480
  offsetParent = getDocumentElement(popper);
442
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
443
481
 
444
- /*:: offsetParent = (offsetParent: Element); */
482
+ if (getComputedStyle(offsetParent).position !== 'static') {
483
+ heightProp = 'scrollHeight';
484
+ widthProp = 'scrollWidth';
485
+ }
486
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
487
+
445
488
 
489
+ offsetParent = offsetParent;
446
490
 
447
491
  if (placement === top) {
448
- sideY = bottom;
449
- y -= offsetParent.clientHeight - popperRect.height;
492
+ sideY = bottom; // $FlowFixMe[prop-missing]
493
+
494
+ y -= offsetParent[heightProp] - popperRect.height;
450
495
  y *= gpuAcceleration ? 1 : -1;
451
496
  }
452
497
 
453
498
  if (placement === left) {
454
- sideX = right;
455
- x -= offsetParent.clientWidth - popperRect.width;
499
+ sideX = right; // $FlowFixMe[prop-missing]
500
+
501
+ x -= offsetParent[widthProp] - popperRect.width;
456
502
  x *= gpuAcceleration ? 1 : -1;
457
503
  }
458
504
  }
@@ -464,19 +510,21 @@ var VueTippy = (function (exports, vue) {
464
510
  if (gpuAcceleration) {
465
511
  var _Object$assign;
466
512
 
467
- 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));
513
+ return 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));
468
514
  }
469
515
 
470
- 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));
516
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
471
517
  }
472
518
 
473
- function computeStyles(_ref3) {
474
- var state = _ref3.state,
475
- options = _ref3.options;
519
+ function computeStyles(_ref4) {
520
+ var state = _ref4.state,
521
+ options = _ref4.options;
476
522
  var _options$gpuAccelerat = options.gpuAcceleration,
477
523
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
478
524
  _options$adaptive = options.adaptive,
479
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
525
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
526
+ _options$roundOffsets = options.roundOffsets,
527
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
480
528
 
481
529
  var commonStyles = {
482
530
  placement: getBasePlacement(state.placement),
@@ -486,22 +534,24 @@ var VueTippy = (function (exports, vue) {
486
534
  };
487
535
 
488
536
  if (state.modifiersData.popperOffsets != null) {
489
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
537
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
490
538
  offsets: state.modifiersData.popperOffsets,
491
539
  position: state.options.strategy,
492
- adaptive: adaptive
540
+ adaptive: adaptive,
541
+ roundOffsets: roundOffsets
493
542
  })));
494
543
  }
495
544
 
496
545
  if (state.modifiersData.arrow != null) {
497
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
546
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
498
547
  offsets: state.modifiersData.arrow,
499
548
  position: 'absolute',
500
- adaptive: false
549
+ adaptive: false,
550
+ roundOffsets: roundOffsets
501
551
  })));
502
552
  }
503
553
 
504
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
554
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
505
555
  'data-popper-placement': state.placement
506
556
  });
507
557
  } // eslint-disable-next-line import/no-unused-modules
@@ -585,20 +635,6 @@ var VueTippy = (function (exports, vue) {
585
635
  });
586
636
  }
587
637
 
588
- function getBoundingClientRect(element) {
589
- var rect = element.getBoundingClientRect();
590
- return {
591
- width: rect.width,
592
- height: rect.height,
593
- top: rect.top,
594
- right: rect.right,
595
- bottom: rect.bottom,
596
- left: rect.left,
597
- x: rect.left,
598
- y: rect.top
599
- };
600
- }
601
-
602
638
  function getWindowScroll(node) {
603
639
  var win = getWindow(node);
604
640
  var scrollLeft = win.pageXOffset;
@@ -661,16 +697,18 @@ var VueTippy = (function (exports, vue) {
661
697
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable
662
698
 
663
699
  function getDocumentRect(element) {
700
+ var _element$ownerDocumen;
701
+
664
702
  var html = getDocumentElement(element);
665
703
  var winScroll = getWindowScroll(element);
666
- var body = element.ownerDocument.body;
667
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
668
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
704
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
705
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
706
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
669
707
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
670
708
  var y = -winScroll.scrollTop;
671
709
 
672
710
  if (getComputedStyle(body || html).direction === 'rtl') {
673
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
711
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
674
712
  }
675
713
 
676
714
  return {
@@ -693,7 +731,7 @@ var VueTippy = (function (exports, vue) {
693
731
 
694
732
  function getScrollParent(node) {
695
733
  if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
696
- // $FlowFixMe: assume body is always available
734
+ // $FlowFixMe[incompatible-return]: assume body is always available
697
735
  return node.ownerDocument.body;
698
736
  }
699
737
 
@@ -707,26 +745,28 @@ var VueTippy = (function (exports, vue) {
707
745
  /*
708
746
  given a DOM element, return the list of all scroll parents, up the list of ancesors
709
747
  until we get to the top window object. This list is what we attach scroll listeners
710
- to, because if any of these parent elements scroll, we'll need to re-calculate the
748
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
711
749
  reference element's position.
712
750
  */
713
751
 
714
752
  function listScrollParents(element, list) {
753
+ var _element$ownerDocumen;
754
+
715
755
  if (list === void 0) {
716
756
  list = [];
717
757
  }
718
758
 
719
759
  var scrollParent = getScrollParent(element);
720
- var isBody = getNodeName(scrollParent) === 'body';
760
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
721
761
  var win = getWindow(scrollParent);
722
762
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
723
763
  var updatedList = list.concat(target);
724
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
764
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
725
765
  updatedList.concat(listScrollParents(getParentNode(target)));
726
766
  }
727
767
 
728
768
  function rectToClientRect(rect) {
729
- return Object.assign(Object.assign({}, rect), {}, {
769
+ return Object.assign({}, rect, {
730
770
  left: rect.x,
731
771
  top: rect.y,
732
772
  right: rect.x + rect.width,
@@ -761,7 +801,7 @@ var VueTippy = (function (exports, vue) {
761
801
 
762
802
  if (!isElement(clipperElement)) {
763
803
  return [];
764
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
804
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
765
805
 
766
806
 
767
807
  return clippingParents.filter(function (clippingParent) {
@@ -777,10 +817,10 @@ var VueTippy = (function (exports, vue) {
777
817
  var firstClippingParent = clippingParents[0];
778
818
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
779
819
  var rect = getClientRectFromMixedType(element, clippingParent);
780
- accRect.top = Math.max(rect.top, accRect.top);
781
- accRect.right = Math.min(rect.right, accRect.right);
782
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
783
- accRect.left = Math.max(rect.left, accRect.left);
820
+ accRect.top = max(rect.top, accRect.top);
821
+ accRect.right = min(rect.right, accRect.right);
822
+ accRect.bottom = min(rect.bottom, accRect.bottom);
823
+ accRect.left = max(rect.left, accRect.left);
784
824
  return accRect;
785
825
  }, getClientRectFromMixedType(element, firstClippingParent));
786
826
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -847,11 +887,11 @@ var VueTippy = (function (exports, vue) {
847
887
 
848
888
  switch (variation) {
849
889
  case start:
850
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
890
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
851
891
  break;
852
892
 
853
893
  case end:
854
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
894
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
855
895
  break;
856
896
  }
857
897
  }
@@ -890,7 +930,7 @@ var VueTippy = (function (exports, vue) {
890
930
  strategy: 'absolute',
891
931
  placement: placement
892
932
  });
893
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
933
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
894
934
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
895
935
  // 0 or negative = within the clipping rect
896
936
 
@@ -914,9 +954,6 @@ var VueTippy = (function (exports, vue) {
914
954
  return overflowOffsets;
915
955
  }
916
956
 
917
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
918
-
919
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
920
957
  function computeAutoPlacement(state, options) {
921
958
  if (options === void 0) {
922
959
  options = {};
@@ -933,15 +970,14 @@ var VueTippy = (function (exports, vue) {
933
970
  var variation = getVariation(placement);
934
971
  var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
935
972
  return getVariation(placement) === variation;
936
- }) : basePlacements; // $FlowFixMe
937
-
973
+ }) : basePlacements;
938
974
  var allowedPlacements = placements$1.filter(function (placement) {
939
975
  return allowedAutoPlacements.indexOf(placement) >= 0;
940
976
  });
941
977
 
942
978
  if (allowedPlacements.length === 0) {
943
979
  allowedPlacements = placements$1;
944
- } // $FlowFixMe: Flow seems to have problems with two array unions...
980
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
945
981
 
946
982
 
947
983
  var overflows = allowedPlacements.reduce(function (acc, placement) {
@@ -1142,7 +1178,7 @@ var VueTippy = (function (exports, vue) {
1142
1178
  isReferenceHidden: isReferenceHidden,
1143
1179
  hasPopperEscaped: hasPopperEscaped
1144
1180
  };
1145
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1181
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1146
1182
  'data-popper-reference-hidden': isReferenceHidden,
1147
1183
  'data-popper-escaped': hasPopperEscaped
1148
1184
  });
@@ -1161,7 +1197,7 @@ var VueTippy = (function (exports, vue) {
1161
1197
  var basePlacement = getBasePlacement(placement);
1162
1198
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1163
1199
 
1164
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1200
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1165
1201
  placement: placement
1166
1202
  })) : offset,
1167
1203
  skidding = _ref[0],
@@ -1267,7 +1303,7 @@ var VueTippy = (function (exports, vue) {
1267
1303
  var popperOffsets = state.modifiersData.popperOffsets;
1268
1304
  var referenceRect = state.rects.reference;
1269
1305
  var popperRect = state.rects.popper;
1270
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1306
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1271
1307
  placement: state.placement
1272
1308
  })) : tetherOffset;
1273
1309
  var data = {
@@ -1279,13 +1315,13 @@ var VueTippy = (function (exports, vue) {
1279
1315
  return;
1280
1316
  }
1281
1317
 
1282
- if (checkMainAxis) {
1318
+ if (checkMainAxis || checkAltAxis) {
1283
1319
  var mainSide = mainAxis === 'y' ? top : left;
1284
1320
  var altSide = mainAxis === 'y' ? bottom : right;
1285
1321
  var len = mainAxis === 'y' ? 'height' : 'width';
1286
1322
  var offset = popperOffsets[mainAxis];
1287
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1288
- var max = popperOffsets[mainAxis] - overflow[altSide];
1323
+ var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
1324
+ var max$1 = popperOffsets[mainAxis] - overflow[altSide];
1289
1325
  var additive = tether ? -popperRect[len] / 2 : 0;
1290
1326
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1291
1327
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -1312,26 +1348,29 @@ var VueTippy = (function (exports, vue) {
1312
1348
  var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1313
1349
  var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1314
1350
  var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1315
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1316
- popperOffsets[mainAxis] = preventedOffset;
1317
- data[mainAxis] = preventedOffset - offset;
1318
- }
1319
1351
 
1320
- if (checkAltAxis) {
1321
- var _mainSide = mainAxis === 'x' ? top : left;
1352
+ if (checkMainAxis) {
1353
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1354
+ popperOffsets[mainAxis] = preventedOffset;
1355
+ data[mainAxis] = preventedOffset - offset;
1356
+ }
1357
+
1358
+ if (checkAltAxis) {
1359
+ var _mainSide = mainAxis === 'x' ? top : left;
1322
1360
 
1323
- var _altSide = mainAxis === 'x' ? bottom : right;
1361
+ var _altSide = mainAxis === 'x' ? bottom : right;
1324
1362
 
1325
- var _offset = popperOffsets[altAxis];
1363
+ var _offset = popperOffsets[altAxis];
1326
1364
 
1327
- var _min = _offset + overflow[_mainSide];
1365
+ var _min = _offset + overflow[_mainSide];
1328
1366
 
1329
- var _max = _offset - overflow[_altSide];
1367
+ var _max = _offset - overflow[_altSide];
1330
1368
 
1331
- var _preventedOffset = within(_min, _offset, _max);
1369
+ var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
1332
1370
 
1333
- popperOffsets[altAxis] = _preventedOffset;
1334
- data[altAxis] = _preventedOffset - _offset;
1371
+ popperOffsets[altAxis] = _preventedOffset;
1372
+ data[altAxis] = _preventedOffset - _offset;
1373
+ }
1335
1374
  }
1336
1375
 
1337
1376
  state.modifiersData[name] = data;
@@ -1465,9 +1504,9 @@ var VueTippy = (function (exports, vue) {
1465
1504
  function mergeByName(modifiers) {
1466
1505
  var merged = modifiers.reduce(function (merged, current) {
1467
1506
  var existing = merged[current.name];
1468
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1469
- options: Object.assign(Object.assign({}, existing.options), current.options),
1470
- data: Object.assign(Object.assign({}, existing.data), current.data)
1507
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1508
+ options: Object.assign({}, existing.options, current.options),
1509
+ data: Object.assign({}, existing.data, current.data)
1471
1510
  }) : current;
1472
1511
  return merged;
1473
1512
  }, {}); // IE11 does not support Object.values
@@ -1511,7 +1550,7 @@ var VueTippy = (function (exports, vue) {
1511
1550
  var state = {
1512
1551
  placement: 'bottom',
1513
1552
  orderedModifiers: [],
1514
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1553
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1515
1554
  modifiersData: {},
1516
1555
  elements: {
1517
1556
  reference: reference,
@@ -1526,7 +1565,7 @@ var VueTippy = (function (exports, vue) {
1526
1565
  state: state,
1527
1566
  setOptions: function setOptions(options) {
1528
1567
  cleanupModifierEffects();
1529
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1568
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1530
1569
  state.scrollParents = {
1531
1570
  reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1532
1571
  popper: listScrollParents(popper)
@@ -1674,10 +1713,12 @@ var VueTippy = (function (exports, vue) {
1674
1713
  }); // eslint-disable-next-line import/no-unused-modules
1675
1714
 
1676
1715
  /**!
1677
- * tippy.js v6.2.7
1678
- * (c) 2017-2020 atomiks
1716
+ * tippy.js v6.3.1
1717
+ * (c) 2017-2021 atomiks
1679
1718
  * MIT License
1680
1719
  */
1720
+
1721
+ 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>';
1681
1722
  var BOX_CLASS = "tippy-box";
1682
1723
  var CONTENT_CLASS = "tippy-content";
1683
1724
  var BACKDROP_CLASS = "tippy-backdrop";
@@ -1802,10 +1843,13 @@ var VueTippy = (function (exports, vue) {
1802
1843
  });
1803
1844
  }
1804
1845
  function getOwnerDocument(elementOrElements) {
1846
+ var _element$ownerDocumen;
1847
+
1805
1848
  var _normalizeToArray = normalizeToArray(elementOrElements),
1806
- element = _normalizeToArray[0];
1849
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
1807
1850
 
1808
- return element ? element.ownerDocument || document : document;
1851
+
1852
+ return (element == null ? void 0 : (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body) ? element.ownerDocument : document;
1809
1853
  }
1810
1854
  function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1811
1855
  var clientX = event.clientX,
@@ -2947,6 +2991,8 @@ var VueTippy = (function (exports, vue) {
2947
2991
  }
2948
2992
 
2949
2993
  onFirstUpdate = function onFirstUpdate() {
2994
+ var _instance$popperInsta2;
2995
+
2950
2996
  if (!instance.state.isVisible || ignoreOnFirstUpdate) {
2951
2997
  return;
2952
2998
  }
@@ -2967,7 +3013,10 @@ var VueTippy = (function (exports, vue) {
2967
3013
 
2968
3014
  handleAriaContentAttribute();
2969
3015
  handleAriaExpandedAttribute();
2970
- pushIfUnique(mountedInstances, instance);
3016
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3017
+ // popper has been positioned for the first time
3018
+
3019
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
2971
3020
  instance.state.isMounted = true;
2972
3021
  invokeHook('onMount', [instance]);
2973
3022
 
@@ -3116,7 +3165,39 @@ var VueTippy = (function (exports, vue) {
3116
3165
  tippy.setDefaultProps = setDefaultProps;
3117
3166
  tippy.currentInput = currentInput;
3118
3167
 
3168
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3169
+ // and causing transitions to break for singletons when the console is open, but
3170
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3171
+
3172
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3173
+ effect: function effect(_ref) {
3174
+ var state = _ref.state;
3175
+ var initialStyles = {
3176
+ popper: {
3177
+ position: state.options.strategy,
3178
+ left: '0',
3179
+ top: '0',
3180
+ margin: '0'
3181
+ },
3182
+ arrow: {
3183
+ position: 'absolute'
3184
+ },
3185
+ reference: {}
3186
+ };
3187
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3188
+ state.styles = initialStyles;
3189
+
3190
+ if (state.elements.arrow) {
3191
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3192
+ } // intentionally return no cleanup function
3193
+ // return () => { ... }
3194
+
3195
+ }
3196
+ });
3197
+
3119
3198
  var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3199
+ var _optionalProps$popper;
3200
+
3120
3201
  if (optionalProps === void 0) {
3121
3202
  optionalProps = {};
3122
3203
  }
@@ -3126,6 +3207,7 @@ var VueTippy = (function (exports, vue) {
3126
3207
  var currentTarget;
3127
3208
  var overrides = optionalProps.overrides;
3128
3209
  var interceptSetPropsCleanups = [];
3210
+ var shownOnCreate = false;
3129
3211
 
3130
3212
  function setReferences() {
3131
3213
  references = individualInstances.map(function (instance) {
@@ -3159,6 +3241,26 @@ var VueTippy = (function (exports, vue) {
3159
3241
  instance.setProps = originalSetProps;
3160
3242
  };
3161
3243
  });
3244
+ } // have to pass singleton, as it maybe undefined on first call
3245
+
3246
+
3247
+ function prepareInstance(singleton, target) {
3248
+ var index = references.indexOf(target); // bail-out
3249
+
3250
+ if (target === currentTarget) {
3251
+ return;
3252
+ }
3253
+
3254
+ currentTarget = target;
3255
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3256
+ acc[prop] = individualInstances[index].props[prop];
3257
+ return acc;
3258
+ }, {});
3259
+ singleton.setProps(Object.assign({}, overrideProps, {
3260
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3261
+ return target.getBoundingClientRect();
3262
+ }
3263
+ }));
3162
3264
  }
3163
3265
 
3164
3266
  enableInstances(false);
@@ -3169,32 +3271,90 @@ var VueTippy = (function (exports, vue) {
3169
3271
  onDestroy: function onDestroy() {
3170
3272
  enableInstances(true);
3171
3273
  },
3172
- onTrigger: function onTrigger(instance, event) {
3173
- var target = event.currentTarget;
3174
- var index = references.indexOf(target); // bail-out
3175
-
3176
- if (target === currentTarget) {
3177
- return;
3274
+ onHidden: function onHidden() {
3275
+ currentTarget = null;
3276
+ },
3277
+ onClickOutside: function onClickOutside(instance) {
3278
+ if (instance.props.showOnCreate && !shownOnCreate) {
3279
+ shownOnCreate = true;
3280
+ currentTarget = null;
3178
3281
  }
3179
-
3180
- currentTarget = target;
3181
- var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3182
- acc[prop] = individualInstances[index].props[prop];
3183
- return acc;
3184
- }, {});
3185
- instance.setProps(Object.assign({}, overrideProps, {
3186
- getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3187
- return target.getBoundingClientRect();
3188
- }
3189
- }));
3282
+ },
3283
+ onShow: function onShow(instance) {
3284
+ if (instance.props.showOnCreate && !shownOnCreate) {
3285
+ shownOnCreate = true;
3286
+ prepareInstance(instance, references[0]);
3287
+ }
3288
+ },
3289
+ onTrigger: function onTrigger(instance, event) {
3290
+ prepareInstance(instance, event.currentTarget);
3190
3291
  }
3191
3292
  };
3192
3293
  }
3193
3294
  };
3194
3295
  var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3195
3296
  plugins: [plugin].concat(optionalProps.plugins || []),
3196
- triggerTarget: references
3297
+ triggerTarget: references,
3298
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3299
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3300
+ })
3197
3301
  }));
3302
+ var originalShow = singleton.show;
3303
+
3304
+ singleton.show = function (target) {
3305
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3306
+ // default to showing first instance
3307
+
3308
+ if (!currentTarget && target == null) {
3309
+ return prepareInstance(singleton, references[0]);
3310
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3311
+ // programmatic call with no params when already visible (do nothing again)
3312
+
3313
+
3314
+ if (currentTarget && target == null) {
3315
+ return;
3316
+ } // target is index of instance
3317
+
3318
+
3319
+ if (typeof target === 'number') {
3320
+ return references[target] && prepareInstance(singleton, references[target]);
3321
+ } // target is a child tippy instance
3322
+
3323
+
3324
+ if (individualInstances.includes(target)) {
3325
+ var ref = target.reference;
3326
+ return prepareInstance(singleton, ref);
3327
+ } // target is a ReferenceElement
3328
+
3329
+
3330
+ if (references.includes(target)) {
3331
+ return prepareInstance(singleton, target);
3332
+ }
3333
+ };
3334
+
3335
+ singleton.showNext = function () {
3336
+ var first = references[0];
3337
+
3338
+ if (!currentTarget) {
3339
+ return singleton.show(0);
3340
+ }
3341
+
3342
+ var index = references.indexOf(currentTarget);
3343
+ singleton.show(references[index + 1] || first);
3344
+ };
3345
+
3346
+ singleton.showPrevious = function () {
3347
+ var last = references[references.length - 1];
3348
+
3349
+ if (!currentTarget) {
3350
+ return singleton.show(last);
3351
+ }
3352
+
3353
+ var index = references.indexOf(currentTarget);
3354
+ var target = references[index - 1] || last;
3355
+ singleton.show(target);
3356
+ };
3357
+
3198
3358
  var originalSetProps = singleton.setProps;
3199
3359
 
3200
3360
  singleton.setProps = function (props) {
@@ -3678,6 +3838,7 @@ var VueTippy = (function (exports, vue) {
3678
3838
  },
3679
3839
  });
3680
3840
  function useTippy(el, opts = {}, settings = { mount: true }) {
3841
+ const vm = vue.getCurrentInstance();
3681
3842
  const instance = vue.ref();
3682
3843
  let container = null;
3683
3844
  const getContainer = () => {
@@ -3692,11 +3853,18 @@ var VueTippy = (function (exports, vue) {
3692
3853
  ? content.value
3693
3854
  : content;
3694
3855
  if (vue.isVNode(unwrappedContent)) {
3856
+ if (vm) {
3857
+ unwrappedContent.appContext = vm.appContext;
3858
+ }
3695
3859
  vue.render(unwrappedContent, getContainer());
3696
3860
  newContent = () => getContainer();
3697
3861
  }
3698
3862
  else if (typeof unwrappedContent === 'object') {
3699
- vue.render(vue.h(unwrappedContent), getContainer());
3863
+ let comp = vue.h(unwrappedContent);
3864
+ if (vm) {
3865
+ comp.appContext = vm.appContext;
3866
+ }
3867
+ vue.render(comp, getContainer());
3700
3868
  newContent = () => getContainer();
3701
3869
  }
3702
3870
  else {
@@ -3715,8 +3883,14 @@ var VueTippy = (function (exports, vue) {
3715
3883
  else {
3716
3884
  options = { ...opts };
3717
3885
  }
3718
- if (options.content)
3886
+ if (options.content) {
3719
3887
  options.content = getContent(options.content);
3888
+ }
3889
+ if (options.triggerTarget) {
3890
+ options.triggerTarget = vue.isRef(options.triggerTarget)
3891
+ ? options.triggerTarget.value
3892
+ : options.triggerTarget;
3893
+ }
3720
3894
  return options;
3721
3895
  };
3722
3896
  const refresh = () => {
@@ -3791,7 +3965,6 @@ var VueTippy = (function (exports, vue) {
3791
3965
  mount,
3792
3966
  };
3793
3967
  if (settings.mount) {
3794
- const vm = vue.getCurrentInstance();
3795
3968
  if (vm) {
3796
3969
  if (vm.isMounted) {
3797
3970
  mount();
@@ -3816,6 +3989,46 @@ var VueTippy = (function (exports, vue) {
3816
3989
  return response;
3817
3990
  }
3818
3991
 
3992
+ function useTippyComponent(opts = {}, children) {
3993
+ const instance = vue.ref();
3994
+ return {
3995
+ instance,
3996
+ TippyComponent: vue.h(TippyComponent, {
3997
+ ...opts,
3998
+ onVnodeMounted: vnode => {
3999
+ //@ts-ignore
4000
+ instance.value = vnode.component.ctx;
4001
+ },
4002
+ }, children),
4003
+ };
4004
+ }
4005
+
4006
+ function useSingleton(instances, optionalProps) {
4007
+ const singleton = vue.ref();
4008
+ vue.onMounted(() => {
4009
+ const pendingTippyInstances = Array.isArray(instances)
4010
+ ? instances.map(i => i.value)
4011
+ : typeof instances === 'function'
4012
+ ? instances()
4013
+ : instances.value;
4014
+ const tippyInstances = pendingTippyInstances
4015
+ .map((instance) => {
4016
+ if (instance instanceof Element) {
4017
+ //@ts-ignore
4018
+ return instance._tippy;
4019
+ }
4020
+ return instance;
4021
+ })
4022
+ .filter(Boolean);
4023
+ singleton.value = createSingleton(tippyInstances, optionalProps
4024
+ ? { allowHTML: true, ...optionalProps }
4025
+ : { allowHTML: true });
4026
+ });
4027
+ return {
4028
+ singleton,
4029
+ };
4030
+ }
4031
+
3819
4032
  // const pluginProps = [
3820
4033
  // 'animateFill',
3821
4034
  // 'followCursor',
@@ -3856,50 +4069,137 @@ var VueTippy = (function (exports, vue) {
3856
4069
  };
3857
4070
  }
3858
4071
  });
4072
+ props['to'] = {};
4073
+ props['tag'] = {
4074
+ default: 'span'
4075
+ };
4076
+ props['contentTag'] = {
4077
+ default: 'span'
4078
+ };
4079
+ props['contentClass'] = {
4080
+ default: null
4081
+ };
3859
4082
  const TippyComponent = vue.defineComponent({
3860
4083
  props,
3861
- setup(props) {
4084
+ setup(props, { slots }) {
3862
4085
  const elem = vue.ref();
3863
- const tippy = useTippy(elem, props);
3864
- return { elem, ...tippy };
4086
+ const contentElem = vue.ref();
4087
+ let options = props;
4088
+ if (options.to) {
4089
+ delete options.to;
4090
+ }
4091
+ let target = elem;
4092
+ if (props.to) {
4093
+ if (props.to instanceof Element) {
4094
+ target = () => props.to;
4095
+ }
4096
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4097
+ target = () => document.querySelector(props.to);
4098
+ }
4099
+ }
4100
+ const tippy = useTippy(target, options);
4101
+ vue.onMounted(() => {
4102
+ if (slots.content)
4103
+ tippy.setContent(() => contentElem.value);
4104
+ });
4105
+ return { elem, contentElem, ...tippy };
4106
+ },
4107
+ render() {
4108
+ let slot = this.$slots.default ? this.$slots.default(this) : [];
4109
+ return vue.h(this.tag, { ref: 'elem', 'data-v-tippy': '' }, this.$slots.content ? [
4110
+ slot,
4111
+ vue.h(this.contentTag, { ref: 'contentElem', class: this.contentClass }, this.$slots.content(this))
4112
+ ] : slot);
4113
+ },
4114
+ });
4115
+
4116
+ const booleanProps$1 = [
4117
+ 'a11y',
4118
+ 'allowHTML',
4119
+ 'arrow',
4120
+ 'flip',
4121
+ 'flipOnUpdate',
4122
+ 'hideOnClick',
4123
+ 'ignoreAttributes',
4124
+ 'inertia',
4125
+ 'interactive',
4126
+ 'lazy',
4127
+ 'multiple',
4128
+ 'showOnInit',
4129
+ 'touch',
4130
+ 'touchHold',
4131
+ ];
4132
+ let props$1 = {};
4133
+ Object.keys(tippy.defaultProps).forEach((prop) => {
4134
+ if (booleanProps$1.includes(prop)) {
4135
+ props$1[prop] = {
4136
+ type: Boolean,
4137
+ default: function () {
4138
+ return tippy.defaultProps[prop];
4139
+ },
4140
+ };
4141
+ }
4142
+ else {
4143
+ props$1[prop] = {
4144
+ default: function () {
4145
+ return tippy.defaultProps[prop];
4146
+ },
4147
+ };
4148
+ }
4149
+ });
4150
+ const TippySingleton = vue.defineComponent({
4151
+ props: props$1,
4152
+ setup(props) {
4153
+ const instances = vue.ref([]);
4154
+ const { singleton } = useSingleton(instances, props);
4155
+ return { instances, singleton };
4156
+ },
4157
+ mounted() {
4158
+ var _a;
4159
+ const parent = this.$el.parentElement;
4160
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4161
+ this.instances = Array.from(elements)
4162
+ .map((el) => el._tippy)
4163
+ .filter(Boolean);
4164
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
3865
4165
  },
3866
4166
  render() {
3867
4167
  let slot = this.$slots.default ? this.$slots.default() : [];
3868
- return vue.h('span', { ref: 'elem' }, slot);
4168
+ return vue.h(() => slot);
3869
4169
  },
3870
4170
  });
3871
4171
 
3872
4172
  const directive = {
3873
4173
  mounted(el, binding, vnode) {
3874
- const opts = binding.value || {};
3875
- if (vnode.props && vnode.props.onShow) {
4174
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4175
+ if (vnode.props && vnode.props.onTippyShow) {
3876
4176
  opts.onShow = function (...args) {
3877
4177
  var _a;
3878
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onShow(...args);
4178
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShow(...args);
3879
4179
  };
3880
4180
  }
3881
- if (vnode.props && vnode.props.onShown) {
4181
+ if (vnode.props && vnode.props.onTippyShown) {
3882
4182
  opts.onShown = function (...args) {
3883
4183
  var _a;
3884
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onShown(...args);
4184
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShown(...args);
3885
4185
  };
3886
4186
  }
3887
- if (vnode.props && vnode.props.onHidden) {
4187
+ if (vnode.props && vnode.props.onTippyHidden) {
3888
4188
  opts.onHidden = function (...args) {
3889
4189
  var _a;
3890
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onHidden(...args);
4190
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHidden(...args);
3891
4191
  };
3892
4192
  }
3893
- if (vnode.props && vnode.props.onHide) {
4193
+ if (vnode.props && vnode.props.onTippyHide) {
3894
4194
  opts.onHide = function (...args) {
3895
4195
  var _a;
3896
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onHide(...args);
4196
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHide(...args);
3897
4197
  };
3898
4198
  }
3899
- if (vnode.props && vnode.props.onMount) {
4199
+ if (vnode.props && vnode.props.onTippyMount) {
3900
4200
  opts.onMount = function (...args) {
3901
4201
  var _a;
3902
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onMount(...args);
4202
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyMount(...args);
3903
4203
  };
3904
4204
  }
3905
4205
  if (el.getAttribute('title') && !opts.content) {
@@ -3920,7 +4220,7 @@ var VueTippy = (function (exports, vue) {
3920
4220
  }
3921
4221
  },
3922
4222
  updated(el, binding) {
3923
- const opts = binding.value || {};
4223
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
3924
4224
  if (el.getAttribute('title') && !opts.content) {
3925
4225
  opts.content = el.getAttribute('title');
3926
4226
  el.removeAttribute('title');
@@ -3942,61 +4242,27 @@ var VueTippy = (function (exports, vue) {
3942
4242
  tippy.setDefaultProps(options.defaultProps || {});
3943
4243
  app.directive(options.directive || 'tippy', directive);
3944
4244
  app.component(options.component || 'tippy', TippyComponent);
4245
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
3945
4246
  },
3946
4247
  };
3947
4248
 
3948
- function useSingleton(instances, optionalProps) {
3949
- const singleton = vue.ref();
3950
- vue.onMounted(() => {
3951
- singleton.value = createSingleton(instances.map(instance => instance.value), optionalProps);
3952
- });
3953
- return {
3954
- singleton,
3955
- };
3956
- }
3957
-
3958
- function styleInject(css, ref) {
3959
- if ( ref === void 0 ) ref = {};
3960
- var insertAt = ref.insertAt;
3961
-
3962
- if (!css || typeof document === 'undefined') { return; }
3963
-
3964
- var head = document.head || document.getElementsByTagName('head')[0];
3965
- var style = document.createElement('style');
3966
- style.type = 'text/css';
3967
-
3968
- if (insertAt === 'top') {
3969
- if (head.firstChild) {
3970
- head.insertBefore(style, head.firstChild);
3971
- } else {
3972
- head.appendChild(style);
3973
- }
3974
- } else {
3975
- head.appendChild(style);
3976
- }
3977
-
3978
- if (style.styleSheet) {
3979
- style.styleSheet.cssText = css;
3980
- } else {
3981
- style.appendChild(document.createTextNode(css));
3982
- }
3983
- }
3984
-
3985
- 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}";
3986
- styleInject(css_248z);
3987
-
3988
4249
  const setDefaultProps$1 = tippy.setDefaultProps;
3989
4250
  setDefaultProps$1({
4251
+ ignoreAttributes: true,
3990
4252
  plugins: [sticky, inlinePositioning, followCursor, animateFill],
3991
4253
  });
3992
4254
 
3993
4255
  exports.Tippy = TippyComponent;
4256
+ exports.TippySingleton = TippySingleton;
3994
4257
  exports.default = plugin;
3995
4258
  exports.directive = directive;
4259
+ exports.plugin = plugin;
4260
+ exports.roundArrow = ROUND_ARROW;
3996
4261
  exports.setDefaultProps = setDefaultProps$1;
3997
4262
  exports.tippy = tippy;
3998
4263
  exports.useSingleton = useSingleton;
3999
4264
  exports.useTippy = useTippy;
4265
+ exports.useTippyComponent = useTippyComponent;
4000
4266
 
4001
4267
  Object.defineProperty(exports, '__esModule', { value: true });
4002
4268