vue-tippy 6.0.0-alpha.5 → 6.0.0-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * vue-tippy v6.0.0-alpha.4
3
- * (c) 2020 Georges KABBOUCHI
2
+ * vue-tippy v6.0.0-alpha.50
3
+ * (c) 2022
4
4
  * @license MIT
5
5
  */
6
- import { ref, getCurrentInstance, onMounted, onUnmounted, isRef, isReactive, watch, isVNode, render as render$1, h, defineComponent } from 'vue';
6
+ import { getCurrentInstance, ref, onMounted, onUnmounted, isRef, isReactive, watch, isVNode, render as render$1, h, defineComponent, nextTick, unref } from 'vue';
7
7
 
8
8
  var top = 'top';
9
9
  var bottom = 'bottom';
@@ -41,10 +41,11 @@ function getNodeName(element) {
41
41
  return element ? (element.nodeName || '').toLowerCase() : null;
42
42
  }
43
43
 
44
- /*:: import type { Window } from '../types'; */
45
-
46
- /*:: declare function getWindow(node: Node | Window): Window; */
47
44
  function getWindow(node) {
45
+ if (node == null) {
46
+ return window;
47
+ }
48
+
48
49
  if (node.toString() !== '[object Window]') {
49
50
  var ownerDocument = node.ownerDocument;
50
51
  return ownerDocument ? ownerDocument.defaultView || window : window;
@@ -53,26 +54,22 @@ function getWindow(node) {
53
54
  return node;
54
55
  }
55
56
 
56
- /*:: declare function isElement(node: mixed): boolean %checks(node instanceof
57
- Element); */
58
-
59
57
  function isElement(node) {
60
58
  var OwnElement = getWindow(node).Element;
61
59
  return node instanceof OwnElement || node instanceof Element;
62
60
  }
63
- /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
64
- HTMLElement); */
65
-
66
61
 
67
62
  function isHTMLElement(node) {
68
63
  var OwnElement = getWindow(node).HTMLElement;
69
64
  return node instanceof OwnElement || node instanceof HTMLElement;
70
65
  }
71
- /*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
72
- ShadowRoot); */
73
-
74
66
 
75
67
  function isShadowRoot(node) {
68
+ // IE 11 has no ShadowRoot
69
+ if (typeof ShadowRoot === 'undefined') {
70
+ return false;
71
+ }
72
+
76
73
  var OwnElement = getWindow(node).ShadowRoot;
77
74
  return node instanceof OwnElement || node instanceof ShadowRoot;
78
75
  }
@@ -90,7 +87,7 @@ function applyStyles(_ref) {
90
87
  return;
91
88
  } // Flow doesn't support to extend this property, but it's the most
92
89
  // effective way to apply styles to an HTMLElement
93
- // $FlowFixMe
90
+ // $FlowFixMe[cannot-write]
94
91
 
95
92
 
96
93
  Object.assign(element.style, style);
@@ -121,6 +118,7 @@ function effect(_ref2) {
121
118
  reference: {}
122
119
  };
123
120
  Object.assign(state.elements.popper.style, initialStyles.popper);
121
+ state.styles = initialStyles;
124
122
 
125
123
  if (state.elements.arrow) {
126
124
  Object.assign(state.elements.arrow.style, initialStyles.arrow);
@@ -139,10 +137,7 @@ function effect(_ref2) {
139
137
 
140
138
  if (!isHTMLElement(element) || !getNodeName(element)) {
141
139
  return;
142
- } // Flow doesn't support to extend this property, but it's the most
143
- // effective way to apply styles to an HTMLElement
144
- // $FlowFixMe
145
-
140
+ }
146
141
 
147
142
  Object.assign(element.style, style);
148
143
  Object.keys(attributes).forEach(function (attribute) {
@@ -166,14 +161,67 @@ function getBasePlacement(placement) {
166
161
  return placement.split('-')[0];
167
162
  }
168
163
 
169
- // Returns the layout rect of an element relative to its offsetParent. Layout
164
+ var max = Math.max;
165
+ var min = Math.min;
166
+ var round = Math.round;
167
+
168
+ function getBoundingClientRect(element, includeScale) {
169
+ if (includeScale === void 0) {
170
+ includeScale = false;
171
+ }
172
+
173
+ var rect = element.getBoundingClientRect();
174
+ var scaleX = 1;
175
+ var scaleY = 1;
176
+
177
+ if (isHTMLElement(element) && includeScale) {
178
+ var offsetHeight = element.offsetHeight;
179
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
180
+ // Fallback to 1 in case both values are `0`
181
+
182
+ if (offsetWidth > 0) {
183
+ scaleX = round(rect.width) / offsetWidth || 1;
184
+ }
185
+
186
+ if (offsetHeight > 0) {
187
+ scaleY = round(rect.height) / offsetHeight || 1;
188
+ }
189
+ }
190
+
191
+ return {
192
+ width: rect.width / scaleX,
193
+ height: rect.height / scaleY,
194
+ top: rect.top / scaleY,
195
+ right: rect.right / scaleX,
196
+ bottom: rect.bottom / scaleY,
197
+ left: rect.left / scaleX,
198
+ x: rect.left / scaleX,
199
+ y: rect.top / scaleY
200
+ };
201
+ }
202
+
170
203
  // means it doesn't take into account transforms.
204
+
171
205
  function getLayoutRect(element) {
206
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
207
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
208
+
209
+ var width = element.offsetWidth;
210
+ var height = element.offsetHeight;
211
+
212
+ if (Math.abs(clientRect.width - width) <= 1) {
213
+ width = clientRect.width;
214
+ }
215
+
216
+ if (Math.abs(clientRect.height - height) <= 1) {
217
+ height = clientRect.height;
218
+ }
219
+
172
220
  return {
173
221
  x: element.offsetLeft,
174
222
  y: element.offsetTop,
175
- width: element.offsetWidth,
176
- height: element.offsetHeight
223
+ width: width,
224
+ height: height
177
225
  };
178
226
  }
179
227
 
@@ -189,7 +237,7 @@ function contains(parent, child) {
189
237
  do {
190
238
  if (next && parent.isSameNode(next)) {
191
239
  return true;
192
- } // $FlowFixMe: need a better way to handle this...
240
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
193
241
 
194
242
 
195
243
  next = next.parentNode || next.host;
@@ -209,8 +257,9 @@ function isTableElement(element) {
209
257
  }
210
258
 
211
259
  function getDocumentElement(element) {
212
- // $FlowFixMe: assume body is always available
213
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
260
+ // $FlowFixMe[incompatible-return]: assume body is always available
261
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
262
+ element.document) || window.document).documentElement;
214
263
  }
215
264
 
216
265
  function getParentNode(element) {
@@ -218,12 +267,13 @@ function getParentNode(element) {
218
267
  return element;
219
268
  }
220
269
 
221
- return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
270
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
271
+ // $FlowFixMe[incompatible-return]
272
+ // $FlowFixMe[prop-missing]
222
273
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
223
- element.parentNode || // DOM Element detected
224
- // $FlowFixMe: need a better way to handle this...
225
- element.host || // ShadowRoot detected
226
- // $FlowFixMe: HTMLElement is a Node
274
+ element.parentNode || ( // DOM Element detected
275
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
276
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
227
277
  getDocumentElement(element) // fallback
228
278
 
229
279
  );
@@ -235,29 +285,32 @@ function getTrueOffsetParent(element) {
235
285
  return null;
236
286
  }
237
287
 
238
- var offsetParent = element.offsetParent;
239
-
240
- if (offsetParent) {
241
- var html = getDocumentElement(offsetParent);
242
-
243
- if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
244
- return html;
245
- }
246
- }
247
-
248
- return offsetParent;
288
+ return element.offsetParent;
249
289
  } // `.offsetParent` reports `null` for fixed elements, while absolute elements
250
290
  // return the containing block
251
291
 
252
292
 
253
293
  function getContainingBlock(element) {
294
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
295
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
296
+
297
+ if (isIE && isHTMLElement(element)) {
298
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
299
+ var elementCss = getComputedStyle(element);
300
+
301
+ if (elementCss.position === 'fixed') {
302
+ return null;
303
+ }
304
+ }
305
+
254
306
  var currentNode = getParentNode(element);
255
307
 
256
308
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
257
309
  var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
258
310
  // create a containing block.
311
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
259
312
 
260
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
313
+ if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
261
314
  return currentNode;
262
315
  } else {
263
316
  currentNode = currentNode.parentNode;
@@ -277,7 +330,7 @@ function getOffsetParent(element) {
277
330
  offsetParent = getTrueOffsetParent(offsetParent);
278
331
  }
279
332
 
280
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
333
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
281
334
  return window;
282
335
  }
283
336
 
@@ -288,8 +341,12 @@ function getMainAxisFromPlacement(placement) {
288
341
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
289
342
  }
290
343
 
291
- function within(min, value, max) {
292
- return Math.max(min, Math.min(value, max));
344
+ function within(min$1, value, max$1) {
345
+ return max(min$1, min(value, max$1));
346
+ }
347
+ function withinMaxClamp(min, value, max) {
348
+ var v = within(min, value, max);
349
+ return v > max ? max : v;
293
350
  }
294
351
 
295
352
  function getFreshSideObject() {
@@ -302,7 +359,7 @@ function getFreshSideObject() {
302
359
  }
303
360
 
304
361
  function mergePaddingObject(paddingObject) {
305
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
362
+ return Object.assign({}, getFreshSideObject(), paddingObject);
306
363
  }
307
364
 
308
365
  function expandToHashMap(value, keys) {
@@ -312,11 +369,19 @@ function expandToHashMap(value, keys) {
312
369
  }, {});
313
370
  }
314
371
 
372
+ var toPaddingObject = function toPaddingObject(padding, state) {
373
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
374
+ placement: state.placement
375
+ })) : padding;
376
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
377
+ };
378
+
315
379
  function arrow(_ref) {
316
380
  var _state$modifiersData$;
317
381
 
318
382
  var state = _ref.state,
319
- name = _ref.name;
383
+ name = _ref.name,
384
+ options = _ref.options;
320
385
  var arrowElement = state.elements.arrow;
321
386
  var popperOffsets = state.modifiersData.popperOffsets;
322
387
  var basePlacement = getBasePlacement(state.placement);
@@ -328,7 +393,7 @@ function arrow(_ref) {
328
393
  return;
329
394
  }
330
395
 
331
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
396
+ var paddingObject = toPaddingObject(options.padding, state);
332
397
  var arrowRect = getLayoutRect(arrowElement);
333
398
  var minProp = axis === 'y' ? top : left;
334
399
  var maxProp = axis === 'y' ? bottom : right;
@@ -350,12 +415,9 @@ function arrow(_ref) {
350
415
 
351
416
  function effect$1(_ref2) {
352
417
  var state = _ref2.state,
353
- options = _ref2.options,
354
- name = _ref2.name;
418
+ options = _ref2.options;
355
419
  var _options$element = options.element,
356
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
357
- _options$padding = options.padding,
358
- padding = _options$padding === void 0 ? 0 : _options$padding;
420
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
359
421
 
360
422
  if (arrowElement == null) {
361
423
  return;
@@ -376,9 +438,6 @@ function effect$1(_ref2) {
376
438
  }
377
439
 
378
440
  state.elements.arrow = arrowElement;
379
- state.modifiersData[name + "#persistent"] = {
380
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
381
- };
382
441
  } // eslint-disable-next-line import/no-unused-modules
383
442
 
384
443
 
@@ -392,6 +451,10 @@ var arrow$1 = {
392
451
  requiresIfExists: ['preventOverflow']
393
452
  };
394
453
 
454
+ function getVariation(placement) {
455
+ return placement.split('-')[1];
456
+ }
457
+
395
458
  var unsetSides = {
396
459
  top: 'auto',
397
460
  right: 'auto',
@@ -401,14 +464,14 @@ var unsetSides = {
401
464
  // Zooming can change the DPR, but it seems to report a value that will
402
465
  // cleanly divide the values into the appropriate subpixels.
403
466
 
404
- function roundOffsets(_ref) {
467
+ function roundOffsetsByDPR(_ref) {
405
468
  var x = _ref.x,
406
469
  y = _ref.y;
407
470
  var win = window;
408
471
  var dpr = win.devicePixelRatio || 1;
409
472
  return {
410
- x: Math.round(x * dpr) / dpr || 0,
411
- y: Math.round(y * dpr) / dpr || 0
473
+ x: round(x * dpr) / dpr || 0,
474
+ y: round(y * dpr) / dpr || 0
412
475
  };
413
476
  }
414
477
 
@@ -418,14 +481,19 @@ function mapToStyles(_ref2) {
418
481
  var popper = _ref2.popper,
419
482
  popperRect = _ref2.popperRect,
420
483
  placement = _ref2.placement,
484
+ variation = _ref2.variation,
421
485
  offsets = _ref2.offsets,
422
486
  position = _ref2.position,
423
487
  gpuAcceleration = _ref2.gpuAcceleration,
424
- adaptive = _ref2.adaptive;
488
+ adaptive = _ref2.adaptive,
489
+ roundOffsets = _ref2.roundOffsets,
490
+ isFixed = _ref2.isFixed;
425
491
 
426
- var _roundOffsets = roundOffsets(offsets),
427
- x = _roundOffsets.x,
428
- y = _roundOffsets.y;
492
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
493
+ _ref3$x = _ref3.x,
494
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
495
+ _ref3$y = _ref3.y,
496
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
429
497
 
430
498
  var hasX = offsets.hasOwnProperty('x');
431
499
  var hasY = offsets.hasOwnProperty('y');
@@ -435,23 +503,34 @@ function mapToStyles(_ref2) {
435
503
 
436
504
  if (adaptive) {
437
505
  var offsetParent = getOffsetParent(popper);
506
+ var heightProp = 'clientHeight';
507
+ var widthProp = 'clientWidth';
438
508
 
439
509
  if (offsetParent === getWindow(popper)) {
440
510
  offsetParent = getDocumentElement(popper);
441
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
442
511
 
443
- /*:: offsetParent = (offsetParent: Element); */
512
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
513
+ heightProp = 'scrollHeight';
514
+ widthProp = 'scrollWidth';
515
+ }
516
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
517
+
444
518
 
519
+ offsetParent = offsetParent;
445
520
 
446
- if (placement === top) {
521
+ if (placement === top || (placement === left || placement === right) && variation === end) {
447
522
  sideY = bottom;
448
- y -= offsetParent.clientHeight - popperRect.height;
523
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
524
+ offsetParent[heightProp];
525
+ y -= offsetY - popperRect.height;
449
526
  y *= gpuAcceleration ? 1 : -1;
450
527
  }
451
528
 
452
- if (placement === left) {
529
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
453
530
  sideX = right;
454
- x -= offsetParent.clientWidth - popperRect.width;
531
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
532
+ offsetParent[widthProp];
533
+ x -= offsetX - popperRect.width;
455
534
  x *= gpuAcceleration ? 1 : -1;
456
535
  }
457
536
  }
@@ -463,44 +542,50 @@ function mapToStyles(_ref2) {
463
542
  if (gpuAcceleration) {
464
543
  var _Object$assign;
465
544
 
466
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
545
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
467
546
  }
468
547
 
469
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
548
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
470
549
  }
471
550
 
472
- function computeStyles(_ref3) {
473
- var state = _ref3.state,
474
- options = _ref3.options;
551
+ function computeStyles(_ref4) {
552
+ var state = _ref4.state,
553
+ options = _ref4.options;
475
554
  var _options$gpuAccelerat = options.gpuAcceleration,
476
555
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
477
556
  _options$adaptive = options.adaptive,
478
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
557
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
558
+ _options$roundOffsets = options.roundOffsets,
559
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
479
560
 
480
561
  var commonStyles = {
481
562
  placement: getBasePlacement(state.placement),
563
+ variation: getVariation(state.placement),
482
564
  popper: state.elements.popper,
483
565
  popperRect: state.rects.popper,
484
- gpuAcceleration: gpuAcceleration
566
+ gpuAcceleration: gpuAcceleration,
567
+ isFixed: state.options.strategy === 'fixed'
485
568
  };
486
569
 
487
570
  if (state.modifiersData.popperOffsets != null) {
488
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
571
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
489
572
  offsets: state.modifiersData.popperOffsets,
490
573
  position: state.options.strategy,
491
- adaptive: adaptive
574
+ adaptive: adaptive,
575
+ roundOffsets: roundOffsets
492
576
  })));
493
577
  }
494
578
 
495
579
  if (state.modifiersData.arrow != null) {
496
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
580
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
497
581
  offsets: state.modifiersData.arrow,
498
582
  position: 'absolute',
499
- adaptive: false
583
+ adaptive: false,
584
+ roundOffsets: roundOffsets
500
585
  })));
501
586
  }
502
587
 
503
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
588
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
504
589
  'data-popper-placement': state.placement
505
590
  });
506
591
  } // eslint-disable-next-line import/no-unused-modules
@@ -584,20 +669,6 @@ function getOppositeVariationPlacement(placement) {
584
669
  });
585
670
  }
586
671
 
587
- function getBoundingClientRect(element) {
588
- var rect = element.getBoundingClientRect();
589
- return {
590
- width: rect.width,
591
- height: rect.height,
592
- top: rect.top,
593
- right: rect.right,
594
- bottom: rect.bottom,
595
- left: rect.left,
596
- x: rect.left,
597
- y: rect.top
598
- };
599
- }
600
-
601
672
  function getWindowScroll(node) {
602
673
  var win = getWindow(node);
603
674
  var scrollLeft = win.pageXOffset;
@@ -660,16 +731,18 @@ function getViewportRect(element) {
660
731
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable
661
732
 
662
733
  function getDocumentRect(element) {
734
+ var _element$ownerDocumen;
735
+
663
736
  var html = getDocumentElement(element);
664
737
  var winScroll = getWindowScroll(element);
665
- var body = element.ownerDocument.body;
666
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
667
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
738
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
739
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
740
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
668
741
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
669
742
  var y = -winScroll.scrollTop;
670
743
 
671
744
  if (getComputedStyle(body || html).direction === 'rtl') {
672
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
745
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
673
746
  }
674
747
 
675
748
  return {
@@ -692,7 +765,7 @@ function isScrollParent(element) {
692
765
 
693
766
  function getScrollParent(node) {
694
767
  if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
695
- // $FlowFixMe: assume body is always available
768
+ // $FlowFixMe[incompatible-return]: assume body is always available
696
769
  return node.ownerDocument.body;
697
770
  }
698
771
 
@@ -706,26 +779,28 @@ function getScrollParent(node) {
706
779
  /*
707
780
  given a DOM element, return the list of all scroll parents, up the list of ancesors
708
781
  until we get to the top window object. This list is what we attach scroll listeners
709
- to, because if any of these parent elements scroll, we'll need to re-calculate the
782
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
710
783
  reference element's position.
711
784
  */
712
785
 
713
786
  function listScrollParents(element, list) {
787
+ var _element$ownerDocumen;
788
+
714
789
  if (list === void 0) {
715
790
  list = [];
716
791
  }
717
792
 
718
793
  var scrollParent = getScrollParent(element);
719
- var isBody = getNodeName(scrollParent) === 'body';
794
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
720
795
  var win = getWindow(scrollParent);
721
796
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
722
797
  var updatedList = list.concat(target);
723
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
798
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
724
799
  updatedList.concat(listScrollParents(getParentNode(target)));
725
800
  }
726
801
 
727
802
  function rectToClientRect(rect) {
728
- return Object.assign(Object.assign({}, rect), {}, {
803
+ return Object.assign({}, rect, {
729
804
  left: rect.x,
730
805
  top: rect.y,
731
806
  right: rect.x + rect.width,
@@ -747,7 +822,7 @@ function getInnerBoundingClientRect(element) {
747
822
  }
748
823
 
749
824
  function getClientRectFromMixedType(element, clippingParent) {
750
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
825
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
751
826
  } // A "clipping parent" is an overflowable container with the characteristic of
752
827
  // clipping (or hiding) overflowing elements with a position different from
753
828
  // `initial`
@@ -760,11 +835,11 @@ function getClippingParents(element) {
760
835
 
761
836
  if (!isElement(clipperElement)) {
762
837
  return [];
763
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
838
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
764
839
 
765
840
 
766
841
  return clippingParents.filter(function (clippingParent) {
767
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
842
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
768
843
  });
769
844
  } // Gets the maximum area that the element is visible in due to any number of
770
845
  // clipping parents
@@ -776,10 +851,10 @@ function getClippingRect(element, boundary, rootBoundary) {
776
851
  var firstClippingParent = clippingParents[0];
777
852
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
778
853
  var rect = getClientRectFromMixedType(element, clippingParent);
779
- accRect.top = Math.max(rect.top, accRect.top);
780
- accRect.right = Math.min(rect.right, accRect.right);
781
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
782
- accRect.left = Math.max(rect.left, accRect.left);
854
+ accRect.top = max(rect.top, accRect.top);
855
+ accRect.right = min(rect.right, accRect.right);
856
+ accRect.bottom = min(rect.bottom, accRect.bottom);
857
+ accRect.left = max(rect.left, accRect.left);
783
858
  return accRect;
784
859
  }, getClientRectFromMixedType(element, firstClippingParent));
785
860
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -789,10 +864,6 @@ function getClippingRect(element, boundary, rootBoundary) {
789
864
  return clippingRect;
790
865
  }
791
866
 
792
- function getVariation(placement) {
793
- return placement.split('-')[1];
794
- }
795
-
796
867
  function computeOffsets(_ref) {
797
868
  var reference = _ref.reference,
798
869
  element = _ref.element,
@@ -846,11 +917,11 @@ function computeOffsets(_ref) {
846
917
 
847
918
  switch (variation) {
848
919
  case start:
849
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
920
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
850
921
  break;
851
922
 
852
923
  case end:
853
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
924
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
854
925
  break;
855
926
  }
856
927
  }
@@ -878,18 +949,17 @@ function detectOverflow(state, options) {
878
949
  padding = _options$padding === void 0 ? 0 : _options$padding;
879
950
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
880
951
  var altContext = elementContext === popper ? reference : popper;
881
- var referenceElement = state.elements.reference;
882
952
  var popperRect = state.rects.popper;
883
953
  var element = state.elements[altBoundary ? altContext : elementContext];
884
954
  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
885
- var referenceClientRect = getBoundingClientRect(referenceElement);
955
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
886
956
  var popperOffsets = computeOffsets({
887
957
  reference: referenceClientRect,
888
958
  element: popperRect,
889
959
  strategy: 'absolute',
890
960
  placement: placement
891
961
  });
892
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
962
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
893
963
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
894
964
  // 0 or negative = within the clipping rect
895
965
 
@@ -913,9 +983,6 @@ function detectOverflow(state, options) {
913
983
  return overflowOffsets;
914
984
  }
915
985
 
916
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
917
-
918
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
919
986
  function computeAutoPlacement(state, options) {
920
987
  if (options === void 0) {
921
988
  options = {};
@@ -932,15 +999,14 @@ function computeAutoPlacement(state, options) {
932
999
  var variation = getVariation(placement);
933
1000
  var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
934
1001
  return getVariation(placement) === variation;
935
- }) : basePlacements; // $FlowFixMe
936
-
1002
+ }) : basePlacements;
937
1003
  var allowedPlacements = placements$1.filter(function (placement) {
938
1004
  return allowedAutoPlacements.indexOf(placement) >= 0;
939
1005
  });
940
1006
 
941
1007
  if (allowedPlacements.length === 0) {
942
1008
  allowedPlacements = placements$1;
943
- } // $FlowFixMe: Flow seems to have problems with two array unions...
1009
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
944
1010
 
945
1011
 
946
1012
  var overflows = allowedPlacements.reduce(function (acc, placement) {
@@ -1141,7 +1207,7 @@ function hide(_ref) {
1141
1207
  isReferenceHidden: isReferenceHidden,
1142
1208
  hasPopperEscaped: hasPopperEscaped
1143
1209
  };
1144
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1210
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1145
1211
  'data-popper-reference-hidden': isReferenceHidden,
1146
1212
  'data-popper-escaped': hasPopperEscaped
1147
1213
  });
@@ -1160,7 +1226,7 @@ function distanceAndSkiddingToXY(placement, rects, offset) {
1160
1226
  var basePlacement = getBasePlacement(placement);
1161
1227
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1162
1228
 
1163
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1229
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1164
1230
  placement: placement
1165
1231
  })) : offset,
1166
1232
  skidding = _ref[0],
@@ -1266,9 +1332,17 @@ function preventOverflow(_ref) {
1266
1332
  var popperOffsets = state.modifiersData.popperOffsets;
1267
1333
  var referenceRect = state.rects.reference;
1268
1334
  var popperRect = state.rects.popper;
1269
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1335
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1270
1336
  placement: state.placement
1271
1337
  })) : tetherOffset;
1338
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1339
+ mainAxis: tetherOffsetValue,
1340
+ altAxis: tetherOffsetValue
1341
+ } : Object.assign({
1342
+ mainAxis: 0,
1343
+ altAxis: 0
1344
+ }, tetherOffsetValue);
1345
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1272
1346
  var data = {
1273
1347
  x: 0,
1274
1348
  y: 0
@@ -1279,12 +1353,14 @@ function preventOverflow(_ref) {
1279
1353
  }
1280
1354
 
1281
1355
  if (checkMainAxis) {
1356
+ var _offsetModifierState$;
1357
+
1282
1358
  var mainSide = mainAxis === 'y' ? top : left;
1283
1359
  var altSide = mainAxis === 'y' ? bottom : right;
1284
1360
  var len = mainAxis === 'y' ? 'height' : 'width';
1285
1361
  var offset = popperOffsets[mainAxis];
1286
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1287
- var max = popperOffsets[mainAxis] - overflow[altSide];
1362
+ var min$1 = offset + overflow[mainSide];
1363
+ var max$1 = offset - overflow[altSide];
1288
1364
  var additive = tether ? -popperRect[len] / 2 : 0;
1289
1365
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1290
1366
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -1304,30 +1380,42 @@ function preventOverflow(_ref) {
1304
1380
  // width or height)
1305
1381
 
1306
1382
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1307
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1308
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1383
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1384
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1309
1385
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1310
1386
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1311
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1312
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1313
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1314
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1387
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1388
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1389
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1390
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1315
1391
  popperOffsets[mainAxis] = preventedOffset;
1316
1392
  data[mainAxis] = preventedOffset - offset;
1317
1393
  }
1318
1394
 
1319
1395
  if (checkAltAxis) {
1396
+ var _offsetModifierState$2;
1397
+
1320
1398
  var _mainSide = mainAxis === 'x' ? top : left;
1321
1399
 
1322
1400
  var _altSide = mainAxis === 'x' ? bottom : right;
1323
1401
 
1324
1402
  var _offset = popperOffsets[altAxis];
1325
1403
 
1404
+ var _len = altAxis === 'y' ? 'height' : 'width';
1405
+
1326
1406
  var _min = _offset + overflow[_mainSide];
1327
1407
 
1328
1408
  var _max = _offset - overflow[_altSide];
1329
1409
 
1330
- var _preventedOffset = within(_min, _offset, _max);
1410
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1411
+
1412
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1413
+
1414
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1415
+
1416
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1417
+
1418
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1331
1419
 
1332
1420
  popperOffsets[altAxis] = _preventedOffset;
1333
1421
  data[altAxis] = _preventedOffset - _offset;
@@ -1360,16 +1448,24 @@ function getNodeScroll(node) {
1360
1448
  }
1361
1449
  }
1362
1450
 
1451
+ function isElementScaled(element) {
1452
+ var rect = element.getBoundingClientRect();
1453
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1454
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1455
+ return scaleX !== 1 || scaleY !== 1;
1456
+ } // Returns the composite rect of an element relative to its offsetParent.
1363
1457
  // Composite means it takes into account transforms as well as layout.
1364
1458
 
1459
+
1365
1460
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1366
1461
  if (isFixed === void 0) {
1367
1462
  isFixed = false;
1368
1463
  }
1369
1464
 
1370
- var documentElement = getDocumentElement(offsetParent);
1371
- var rect = getBoundingClientRect(elementOrVirtualElement);
1372
1465
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1466
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1467
+ var documentElement = getDocumentElement(offsetParent);
1468
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1373
1469
  var scroll = {
1374
1470
  scrollLeft: 0,
1375
1471
  scrollTop: 0
@@ -1386,7 +1482,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1386
1482
  }
1387
1483
 
1388
1484
  if (isHTMLElement(offsetParent)) {
1389
- offsets = getBoundingClientRect(offsetParent);
1485
+ offsets = getBoundingClientRect(offsetParent, true);
1390
1486
  offsets.x += offsetParent.clientLeft;
1391
1487
  offsets.y += offsetParent.clientTop;
1392
1488
  } else if (documentElement) {
@@ -1464,9 +1560,9 @@ function debounce(fn) {
1464
1560
  function mergeByName(modifiers) {
1465
1561
  var merged = modifiers.reduce(function (merged, current) {
1466
1562
  var existing = merged[current.name];
1467
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1468
- options: Object.assign(Object.assign({}, existing.options), current.options),
1469
- data: Object.assign(Object.assign({}, existing.data), current.data)
1563
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1564
+ options: Object.assign({}, existing.options, current.options),
1565
+ data: Object.assign({}, existing.data, current.data)
1470
1566
  }) : current;
1471
1567
  return merged;
1472
1568
  }, {}); // IE11 does not support Object.values
@@ -1510,7 +1606,7 @@ function popperGenerator(generatorOptions) {
1510
1606
  var state = {
1511
1607
  placement: 'bottom',
1512
1608
  orderedModifiers: [],
1513
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1609
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1514
1610
  modifiersData: {},
1515
1611
  elements: {
1516
1612
  reference: reference,
@@ -1523,9 +1619,10 @@ function popperGenerator(generatorOptions) {
1523
1619
  var isDestroyed = false;
1524
1620
  var instance = {
1525
1621
  state: state,
1526
- setOptions: function setOptions(options) {
1622
+ setOptions: function setOptions(setOptionsAction) {
1623
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1527
1624
  cleanupModifierEffects();
1528
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1625
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1529
1626
  state.scrollParents = {
1530
1627
  reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1531
1628
  popper: listScrollParents(popper)
@@ -1673,10 +1770,12 @@ var createPopper = /*#__PURE__*/popperGenerator({
1673
1770
  }); // eslint-disable-next-line import/no-unused-modules
1674
1771
 
1675
1772
  /**!
1676
- * tippy.js v6.2.7
1677
- * (c) 2017-2020 atomiks
1773
+ * tippy.js v6.3.7
1774
+ * (c) 2017-2021 atomiks
1678
1775
  * MIT License
1679
1776
  */
1777
+
1778
+ var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
1680
1779
  var BOX_CLASS = "tippy-box";
1681
1780
  var CONTENT_CLASS = "tippy-content";
1682
1781
  var BACKDROP_CLASS = "tippy-backdrop";
@@ -1686,6 +1785,9 @@ var TOUCH_OPTIONS = {
1686
1785
  passive: true,
1687
1786
  capture: true
1688
1787
  };
1788
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1789
+ return document.body;
1790
+ };
1689
1791
  function getValueAtIndexOrReturn(value, index, defaultValue) {
1690
1792
  if (Array.isArray(value)) {
1691
1793
  var v = value[index];
@@ -1801,10 +1903,13 @@ function setVisibilityState(els, state) {
1801
1903
  });
1802
1904
  }
1803
1905
  function getOwnerDocument(elementOrElements) {
1906
+ var _element$ownerDocumen;
1907
+
1804
1908
  var _normalizeToArray = normalizeToArray(elementOrElements),
1805
- element = _normalizeToArray[0];
1909
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
1806
1910
 
1807
- return element ? element.ownerDocument || document : document;
1911
+
1912
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1808
1913
  }
1809
1914
  function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1810
1915
  var clientX = event.clientX,
@@ -1840,6 +1945,26 @@ function updateTransitionEndListener(box, action, listener) {
1840
1945
  box[method](event, listener);
1841
1946
  });
1842
1947
  }
1948
+ /**
1949
+ * Compared to xxx.contains, this function works for dom structures with shadow
1950
+ * dom
1951
+ */
1952
+
1953
+ function actualContains(parent, child) {
1954
+ var target = child;
1955
+
1956
+ while (target) {
1957
+ var _target$getRootNode;
1958
+
1959
+ if (parent.contains(target)) {
1960
+ return true;
1961
+ }
1962
+
1963
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
1964
+ }
1965
+
1966
+ return false;
1967
+ }
1843
1968
 
1844
1969
  var currentInput = {
1845
1970
  isTouch: false
@@ -1903,8 +2028,8 @@ function bindGlobalEventListeners() {
1903
2028
  }
1904
2029
 
1905
2030
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1906
- var ua = isBrowser ? navigator.userAgent : '';
1907
- var isIE = /MSIE |Trident\//.test(ua);
2031
+ var isIE11 = isBrowser ? // @ts-ignore
2032
+ !!window.msCrypto : false;
1908
2033
 
1909
2034
  var pluginProps = {
1910
2035
  animateFill: false,
@@ -1924,9 +2049,7 @@ var renderProps = {
1924
2049
  zIndex: 9999
1925
2050
  };
1926
2051
  var defaultProps = Object.assign({
1927
- appendTo: function appendTo() {
1928
- return document.body;
1929
- },
2052
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
1930
2053
  aria: {
1931
2054
  content: 'auto',
1932
2055
  expanded: 'auto'
@@ -1961,7 +2084,7 @@ var defaultProps = Object.assign({
1961
2084
  touch: true,
1962
2085
  trigger: 'mouseenter focus',
1963
2086
  triggerTarget: null
1964
- }, pluginProps, {}, renderProps);
2087
+ }, pluginProps, renderProps);
1965
2088
  var defaultKeys = Object.keys(defaultProps);
1966
2089
  var setDefaultProps = function setDefaultProps(partialProps) {
1967
2090
 
@@ -1977,12 +2100,14 @@ function getExtendedPassedProps(passedProps) {
1977
2100
  defaultValue = plugin.defaultValue;
1978
2101
 
1979
2102
  if (name) {
1980
- acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
2103
+ var _name;
2104
+
2105
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
1981
2106
  }
1982
2107
 
1983
2108
  return acc;
1984
2109
  }, {});
1985
- return Object.assign({}, passedProps, {}, pluginProps);
2110
+ return Object.assign({}, passedProps, pluginProps);
1986
2111
  }
1987
2112
  function getDataAttributeProps(reference, plugins) {
1988
2113
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
@@ -2013,7 +2138,7 @@ function evaluateProps(reference, props) {
2013
2138
  var out = Object.assign({}, props, {
2014
2139
  content: invokeWithArgsOrReturn(props.content, [reference])
2015
2140
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2016
- out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
2141
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2017
2142
  out.aria = {
2018
2143
  expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2019
2144
  content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
@@ -2151,7 +2276,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
2151
2276
 
2152
2277
  var mountedInstances = [];
2153
2278
  function createTippy(reference, passedProps) {
2154
- var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2279
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2155
2280
  // 🔒 Private members
2156
2281
  // ===========================================================================
2157
2282
 
@@ -2248,10 +2373,9 @@ function createTippy(reference, passedProps) {
2248
2373
  instance.clearDelayTimeouts();
2249
2374
  }
2250
2375
  });
2251
- popper.addEventListener('mouseleave', function (event) {
2376
+ popper.addEventListener('mouseleave', function () {
2252
2377
  if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2253
2378
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2254
- debouncedOnMouseMove(event);
2255
2379
  }
2256
2380
  });
2257
2381
  return instance; // ===========================================================================
@@ -2271,7 +2395,7 @@ function createTippy(reference, passedProps) {
2271
2395
  var _instance$props$rende;
2272
2396
 
2273
2397
  // @ts-ignore
2274
- return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
2398
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2275
2399
  }
2276
2400
 
2277
2401
  function getCurrentTarget() {
@@ -2298,8 +2422,12 @@ function createTippy(reference, passedProps) {
2298
2422
  return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2299
2423
  }
2300
2424
 
2301
- function handleStyles() {
2302
- popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
2425
+ function handleStyles(fromHide) {
2426
+ if (fromHide === void 0) {
2427
+ fromHide = false;
2428
+ }
2429
+
2430
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2303
2431
  popper.style.zIndex = "" + instance.props.zIndex;
2304
2432
  }
2305
2433
 
@@ -2310,7 +2438,7 @@ function createTippy(reference, passedProps) {
2310
2438
 
2311
2439
  pluginsHooks.forEach(function (pluginHooks) {
2312
2440
  if (pluginHooks[hook]) {
2313
- pluginHooks[hook].apply(void 0, args);
2441
+ pluginHooks[hook].apply(pluginHooks, args);
2314
2442
  }
2315
2443
  });
2316
2444
 
@@ -2376,15 +2504,18 @@ function createTippy(reference, passedProps) {
2376
2504
  if (didTouchMove || event.type === 'mousedown') {
2377
2505
  return;
2378
2506
  }
2379
- } // Clicked on interactive popper
2507
+ }
2380
2508
 
2509
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2381
2510
 
2382
- if (instance.props.interactive && popper.contains(event.target)) {
2511
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2383
2512
  return;
2384
2513
  } // Clicked on the event listeners target
2385
2514
 
2386
2515
 
2387
- if (getCurrentTarget().contains(event.target)) {
2516
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2517
+ return actualContains(el, actualTarget);
2518
+ })) {
2388
2519
  if (currentInput.isTouch) {
2389
2520
  return;
2390
2521
  }
@@ -2512,7 +2643,7 @@ function createTippy(reference, passedProps) {
2512
2643
  break;
2513
2644
 
2514
2645
  case 'focus':
2515
- on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
2646
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2516
2647
  break;
2517
2648
 
2518
2649
  case 'focusin':
@@ -2738,7 +2869,7 @@ function createTippy(reference, passedProps) {
2738
2869
 
2739
2870
  var node = getCurrentTarget();
2740
2871
 
2741
- if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
2872
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2742
2873
  parentNode = node.parentNode;
2743
2874
  } else {
2744
2875
  parentNode = invokeWithArgsOrReturn(appendTo, [node]);
@@ -2750,6 +2881,7 @@ function createTippy(reference, passedProps) {
2750
2881
  parentNode.appendChild(popper);
2751
2882
  }
2752
2883
 
2884
+ instance.state.isMounted = true;
2753
2885
  createPopperInstance();
2754
2886
  }
2755
2887
 
@@ -2847,7 +2979,7 @@ function createTippy(reference, passedProps) {
2847
2979
  invokeHook('onBeforeUpdate', [instance, partialProps]);
2848
2980
  removeListeners();
2849
2981
  var prevProps = instance.props;
2850
- var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
2982
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
2851
2983
  ignoreAttributes: true
2852
2984
  }));
2853
2985
  instance.props = nextProps;
@@ -2946,6 +3078,8 @@ function createTippy(reference, passedProps) {
2946
3078
  }
2947
3079
 
2948
3080
  onFirstUpdate = function onFirstUpdate() {
3081
+ var _instance$popperInsta2;
3082
+
2949
3083
  if (!instance.state.isVisible || ignoreOnFirstUpdate) {
2950
3084
  return;
2951
3085
  }
@@ -2966,8 +3100,10 @@ function createTippy(reference, passedProps) {
2966
3100
 
2967
3101
  handleAriaContentAttribute();
2968
3102
  handleAriaExpandedAttribute();
2969
- pushIfUnique(mountedInstances, instance);
2970
- instance.state.isMounted = true;
3103
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3104
+ // popper has been positioned for the first time
3105
+
3106
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
2971
3107
  invokeHook('onMount', [instance]);
2972
3108
 
2973
3109
  if (instance.props.animation && getIsDefaultRenderFn()) {
@@ -3010,7 +3146,7 @@ function createTippy(reference, passedProps) {
3010
3146
 
3011
3147
  cleanupInteractiveMouseListeners();
3012
3148
  removeDocumentPress();
3013
- handleStyles();
3149
+ handleStyles(true);
3014
3150
 
3015
3151
  if (getIsDefaultRenderFn()) {
3016
3152
  var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
@@ -3115,16 +3251,58 @@ tippy.defaultProps = defaultProps;
3115
3251
  tippy.setDefaultProps = setDefaultProps;
3116
3252
  tippy.currentInput = currentInput;
3117
3253
 
3254
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3255
+ // and causing transitions to break for singletons when the console is open, but
3256
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3257
+
3258
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3259
+ effect: function effect(_ref) {
3260
+ var state = _ref.state;
3261
+ var initialStyles = {
3262
+ popper: {
3263
+ position: state.options.strategy,
3264
+ left: '0',
3265
+ top: '0',
3266
+ margin: '0'
3267
+ },
3268
+ arrow: {
3269
+ position: 'absolute'
3270
+ },
3271
+ reference: {}
3272
+ };
3273
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3274
+ state.styles = initialStyles;
3275
+
3276
+ if (state.elements.arrow) {
3277
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3278
+ } // intentionally return no cleanup function
3279
+ // return () => { ... }
3280
+
3281
+ }
3282
+ });
3283
+
3118
3284
  var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3285
+ var _optionalProps$popper;
3286
+
3119
3287
  if (optionalProps === void 0) {
3120
3288
  optionalProps = {};
3121
3289
  }
3122
3290
 
3123
3291
  var individualInstances = tippyInstances;
3124
3292
  var references = [];
3293
+ var triggerTargets = [];
3125
3294
  var currentTarget;
3126
3295
  var overrides = optionalProps.overrides;
3127
3296
  var interceptSetPropsCleanups = [];
3297
+ var shownOnCreate = false;
3298
+
3299
+ function setTriggerTargets() {
3300
+ triggerTargets = individualInstances.map(function (instance) {
3301
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3302
+ }).reduce(function (acc, item) {
3303
+ return acc.concat(item);
3304
+ }, []);
3305
+ }
3128
3306
 
3129
3307
  function setReferences() {
3130
3308
  references = individualInstances.map(function (instance) {
@@ -3158,42 +3336,123 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3158
3336
  instance.setProps = originalSetProps;
3159
3337
  };
3160
3338
  });
3339
+ } // have to pass singleton, as it maybe undefined on first call
3340
+
3341
+
3342
+ function prepareInstance(singleton, target) {
3343
+ var index = triggerTargets.indexOf(target); // bail-out
3344
+
3345
+ if (target === currentTarget) {
3346
+ return;
3347
+ }
3348
+
3349
+ currentTarget = target;
3350
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3351
+ acc[prop] = individualInstances[index].props[prop];
3352
+ return acc;
3353
+ }, {});
3354
+ singleton.setProps(Object.assign({}, overrideProps, {
3355
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3356
+ var _references$index;
3357
+
3358
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3359
+ }
3360
+ }));
3161
3361
  }
3162
3362
 
3163
3363
  enableInstances(false);
3164
3364
  setReferences();
3365
+ setTriggerTargets();
3165
3366
  var plugin = {
3166
3367
  fn: function fn() {
3167
3368
  return {
3168
3369
  onDestroy: function onDestroy() {
3169
3370
  enableInstances(true);
3170
3371
  },
3171
- onTrigger: function onTrigger(instance, event) {
3172
- var target = event.currentTarget;
3173
- var index = references.indexOf(target); // bail-out
3174
-
3175
- if (target === currentTarget) {
3176
- return;
3372
+ onHidden: function onHidden() {
3373
+ currentTarget = null;
3374
+ },
3375
+ onClickOutside: function onClickOutside(instance) {
3376
+ if (instance.props.showOnCreate && !shownOnCreate) {
3377
+ shownOnCreate = true;
3378
+ currentTarget = null;
3177
3379
  }
3178
-
3179
- currentTarget = target;
3180
- var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3181
- acc[prop] = individualInstances[index].props[prop];
3182
- return acc;
3183
- }, {});
3184
- instance.setProps(Object.assign({}, overrideProps, {
3185
- getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3186
- return target.getBoundingClientRect();
3187
- }
3188
- }));
3380
+ },
3381
+ onShow: function onShow(instance) {
3382
+ if (instance.props.showOnCreate && !shownOnCreate) {
3383
+ shownOnCreate = true;
3384
+ prepareInstance(instance, references[0]);
3385
+ }
3386
+ },
3387
+ onTrigger: function onTrigger(instance, event) {
3388
+ prepareInstance(instance, event.currentTarget);
3189
3389
  }
3190
3390
  };
3191
3391
  }
3192
3392
  };
3193
3393
  var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3194
3394
  plugins: [plugin].concat(optionalProps.plugins || []),
3195
- triggerTarget: references
3395
+ triggerTarget: triggerTargets,
3396
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3397
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3398
+ })
3196
3399
  }));
3400
+ var originalShow = singleton.show;
3401
+
3402
+ singleton.show = function (target) {
3403
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3404
+ // default to showing first instance
3405
+
3406
+ if (!currentTarget && target == null) {
3407
+ return prepareInstance(singleton, references[0]);
3408
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3409
+ // programmatic call with no params when already visible (do nothing again)
3410
+
3411
+
3412
+ if (currentTarget && target == null) {
3413
+ return;
3414
+ } // target is index of instance
3415
+
3416
+
3417
+ if (typeof target === 'number') {
3418
+ return references[target] && prepareInstance(singleton, references[target]);
3419
+ } // target is a child tippy instance
3420
+
3421
+
3422
+ if (individualInstances.indexOf(target) >= 0) {
3423
+ var ref = target.reference;
3424
+ return prepareInstance(singleton, ref);
3425
+ } // target is a ReferenceElement
3426
+
3427
+
3428
+ if (references.indexOf(target) >= 0) {
3429
+ return prepareInstance(singleton, target);
3430
+ }
3431
+ };
3432
+
3433
+ singleton.showNext = function () {
3434
+ var first = references[0];
3435
+
3436
+ if (!currentTarget) {
3437
+ return singleton.show(0);
3438
+ }
3439
+
3440
+ var index = references.indexOf(currentTarget);
3441
+ singleton.show(references[index + 1] || first);
3442
+ };
3443
+
3444
+ singleton.showPrevious = function () {
3445
+ var last = references[references.length - 1];
3446
+
3447
+ if (!currentTarget) {
3448
+ return singleton.show(last);
3449
+ }
3450
+
3451
+ var index = references.indexOf(currentTarget);
3452
+ var target = references[index - 1] || last;
3453
+ singleton.show(target);
3454
+ };
3455
+
3197
3456
  var originalSetProps = singleton.setProps;
3198
3457
 
3199
3458
  singleton.setProps = function (props) {
@@ -3209,9 +3468,10 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3209
3468
  individualInstances = nextInstances;
3210
3469
  enableInstances(false);
3211
3470
  setReferences();
3212
- interceptSetProps(singleton);
3471
+ setTriggerTargets();
3472
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3213
3473
  singleton.setProps({
3214
- triggerTarget: references
3474
+ triggerTarget: triggerTargets
3215
3475
  });
3216
3476
  };
3217
3477
 
@@ -3226,7 +3486,7 @@ var animateFill = {
3226
3486
  var _instance$props$rende;
3227
3487
 
3228
3488
  // @ts-ignore
3229
- if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
3489
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3230
3490
 
3231
3491
  return {};
3232
3492
  }
@@ -3348,6 +3608,7 @@ var followCursor = {
3348
3608
 
3349
3609
  if (isCursorOverReference || !instance.props.interactive) {
3350
3610
  instance.setProps({
3611
+ // @ts-ignore - unneeded DOMRect properties
3351
3612
  getReferenceClientRect: function getReferenceClientRect() {
3352
3613
  var rect = reference.getBoundingClientRect();
3353
3614
  var x = clientX;
@@ -3484,6 +3745,7 @@ var inlinePositioning = {
3484
3745
  var placement;
3485
3746
  var cursorRectIndex = -1;
3486
3747
  var isInternalUpdate = false;
3748
+ var triedPlacements = [];
3487
3749
  var modifier = {
3488
3750
  name: 'tippyInlinePositioning',
3489
3751
  enabled: true,
@@ -3492,8 +3754,14 @@ var inlinePositioning = {
3492
3754
  var state = _ref2.state;
3493
3755
 
3494
3756
  if (isEnabled()) {
3495
- if (placement !== state.placement) {
3757
+ if (triedPlacements.indexOf(state.placement) !== -1) {
3758
+ triedPlacements = [];
3759
+ }
3760
+
3761
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
3762
+ triedPlacements.push(state.placement);
3496
3763
  instance.setProps({
3764
+ // @ts-ignore - unneeded DOMRect properties
3497
3765
  getReferenceClientRect: function getReferenceClientRect() {
3498
3766
  return _getReferenceClientRect(state.placement);
3499
3767
  }
@@ -3530,10 +3798,11 @@ var inlinePositioning = {
3530
3798
  var cursorRect = rects.find(function (rect) {
3531
3799
  return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
3532
3800
  });
3533
- cursorRectIndex = rects.indexOf(cursorRect);
3801
+ var index = rects.indexOf(cursorRect);
3802
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
3534
3803
  }
3535
3804
  },
3536
- onUntrigger: function onUntrigger() {
3805
+ onHidden: function onHidden() {
3537
3806
  cursorRectIndex = -1;
3538
3807
  }
3539
3808
  };
@@ -3677,12 +3946,20 @@ tippy.setDefaultProps({
3677
3946
  },
3678
3947
  });
3679
3948
  function useTippy(el, opts = {}, settings = { mount: true }) {
3949
+ const vm = getCurrentInstance();
3680
3950
  const instance = ref();
3951
+ const state = ref({
3952
+ isEnabled: false,
3953
+ isVisible: false,
3954
+ isDestroyed: false,
3955
+ isMounted: false,
3956
+ isShown: false,
3957
+ });
3681
3958
  let container = null;
3682
3959
  const getContainer = () => {
3683
3960
  if (container)
3684
3961
  return container;
3685
- container = document.createElement('fragment');
3962
+ container = document.createDocumentFragment();
3686
3963
  return container;
3687
3964
  };
3688
3965
  const getContent = (content) => {
@@ -3691,11 +3968,18 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3691
3968
  ? content.value
3692
3969
  : content;
3693
3970
  if (isVNode(unwrappedContent)) {
3971
+ if (vm) {
3972
+ unwrappedContent.appContext = vm.appContext;
3973
+ }
3694
3974
  render$1(unwrappedContent, getContainer());
3695
3975
  newContent = () => getContainer();
3696
3976
  }
3697
3977
  else if (typeof unwrappedContent === 'object') {
3698
- render$1(h(unwrappedContent), getContainer());
3978
+ let comp = h(unwrappedContent);
3979
+ if (vm) {
3980
+ comp.appContext = vm.appContext;
3981
+ }
3982
+ render$1(comp, getContainer());
3699
3983
  newContent = () => getContainer();
3700
3984
  }
3701
3985
  else {
@@ -3706,7 +3990,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3706
3990
  const getProps = (opts) => {
3707
3991
  let options = {};
3708
3992
  if (isRef(opts)) {
3709
- options = opts.value;
3993
+ options = opts.value || {};
3710
3994
  }
3711
3995
  else if (isReactive(opts)) {
3712
3996
  options = { ...opts };
@@ -3714,8 +3998,51 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3714
3998
  else {
3715
3999
  options = { ...opts };
3716
4000
  }
3717
- if (options.content)
4001
+ if (options.content) {
3718
4002
  options.content = getContent(options.content);
4003
+ }
4004
+ if (options.triggerTarget) {
4005
+ options.triggerTarget = isRef(options.triggerTarget)
4006
+ ? options.triggerTarget.value
4007
+ : options.triggerTarget;
4008
+ }
4009
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4010
+ options.plugins = [];
4011
+ }
4012
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4013
+ options.plugins.push({
4014
+ name: 'vueTippyReactiveState',
4015
+ fn: () => {
4016
+ return {
4017
+ onCreate() {
4018
+ state.value.isEnabled = true;
4019
+ },
4020
+ onMount() {
4021
+ state.value.isMounted = true;
4022
+ },
4023
+ onShow() {
4024
+ state.value.isMounted = true;
4025
+ state.value.isVisible = true;
4026
+ },
4027
+ onShown() {
4028
+ state.value.isShown = true;
4029
+ },
4030
+ onHide() {
4031
+ state.value.isMounted = false;
4032
+ state.value.isVisible = false;
4033
+ },
4034
+ onHidden() {
4035
+ state.value.isShown = false;
4036
+ },
4037
+ onUnmounted() {
4038
+ state.value.isMounted = false;
4039
+ },
4040
+ onDestroy() {
4041
+ state.value.isDestroyed = true;
4042
+ },
4043
+ };
4044
+ }
4045
+ });
3719
4046
  return options;
3720
4047
  };
3721
4048
  const refresh = () => {
@@ -3754,10 +4081,12 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3754
4081
  const disable = () => {
3755
4082
  var _a;
3756
4083
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4084
+ state.value.isEnabled = false;
3757
4085
  };
3758
4086
  const enable = () => {
3759
4087
  var _a;
3760
4088
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4089
+ state.value.isEnabled = true;
3761
4090
  };
3762
4091
  const unmount = () => {
3763
4092
  var _a;
@@ -3788,9 +4117,9 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3788
4117
  enable,
3789
4118
  unmount,
3790
4119
  mount,
4120
+ state,
3791
4121
  };
3792
4122
  if (settings.mount) {
3793
- const vm = getCurrentInstance();
3794
4123
  if (vm) {
3795
4124
  if (vm.isMounted) {
3796
4125
  mount();
@@ -3815,6 +4144,46 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3815
4144
  return response;
3816
4145
  }
3817
4146
 
4147
+ function useTippyComponent(opts = {}, children) {
4148
+ const instance = ref();
4149
+ return {
4150
+ instance,
4151
+ TippyComponent: h(TippyComponent, {
4152
+ ...opts,
4153
+ onVnodeMounted: vnode => {
4154
+ //@ts-ignore
4155
+ instance.value = vnode.component.ctx;
4156
+ },
4157
+ }, children),
4158
+ };
4159
+ }
4160
+
4161
+ function useSingleton(instances, optionalProps) {
4162
+ const singleton = ref();
4163
+ onMounted(() => {
4164
+ const pendingTippyInstances = Array.isArray(instances)
4165
+ ? instances.map(i => i.value)
4166
+ : typeof instances === 'function'
4167
+ ? instances()
4168
+ : instances.value;
4169
+ const tippyInstances = pendingTippyInstances
4170
+ .map((instance) => {
4171
+ if (instance instanceof Element) {
4172
+ //@ts-ignore
4173
+ return instance._tippy;
4174
+ }
4175
+ return instance;
4176
+ })
4177
+ .filter(Boolean);
4178
+ singleton.value = createSingleton(tippyInstances, optionalProps
4179
+ ? { allowHTML: true, ...optionalProps }
4180
+ : { allowHTML: true });
4181
+ });
4182
+ return {
4183
+ singleton,
4184
+ };
4185
+ }
4186
+
3818
4187
  // const pluginProps = [
3819
4188
  // 'animateFill',
3820
4189
  // 'followCursor',
@@ -3841,7 +4210,7 @@ let props = {};
3841
4210
  Object.keys(tippy.defaultProps).forEach((prop) => {
3842
4211
  if (booleanProps.includes(prop)) {
3843
4212
  props[prop] = {
3844
- type: Boolean,
4213
+ type: prop === 'arrow' ? [String, Boolean, SVGElement, DocumentFragment] : Boolean,
3845
4214
  default: function () {
3846
4215
  return tippy.defaultProps[prop];
3847
4216
  },
@@ -3855,22 +4224,142 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
3855
4224
  };
3856
4225
  }
3857
4226
  });
4227
+ props['to'] = {};
4228
+ props['tag'] = {
4229
+ default: 'span'
4230
+ };
4231
+ props['contentTag'] = {
4232
+ default: 'span'
4233
+ };
4234
+ props['contentClass'] = {
4235
+ default: null
4236
+ };
3858
4237
  const TippyComponent = defineComponent({
3859
4238
  props,
3860
- setup(props) {
4239
+ emits: ['state'],
4240
+ setup(props, { slots, emit, expose }) {
3861
4241
  const elem = ref();
3862
- const tippy = useTippy(elem, props);
3863
- return { elem, ...tippy };
4242
+ const contentElem = ref();
4243
+ const mounted = ref(false);
4244
+ let options = { ...props };
4245
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4246
+ if (options.hasOwnProperty(prop)) {
4247
+ // @ts-ignore
4248
+ delete options[prop];
4249
+ }
4250
+ }
4251
+ let target = elem;
4252
+ if (props.to) {
4253
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4254
+ target = () => props.to;
4255
+ }
4256
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4257
+ target = () => document.querySelector(props.to);
4258
+ }
4259
+ }
4260
+ const tippy = useTippy(target, options);
4261
+ onMounted(() => {
4262
+ mounted.value = true;
4263
+ nextTick(() => {
4264
+ if (slots.content)
4265
+ tippy.setContent(() => contentElem.value);
4266
+ });
4267
+ });
4268
+ watch(tippy.state, () => {
4269
+ emit('state', unref(tippy.state));
4270
+ }, { immediate: true, deep: true });
4271
+ watch(props, () => {
4272
+ tippy.setProps(props);
4273
+ });
4274
+ let exposed = {
4275
+ elem,
4276
+ contentElem,
4277
+ mounted,
4278
+ ...tippy
4279
+ };
4280
+ expose(exposed);
4281
+ const slot = slots.default ? slots.default(exposed) : [];
4282
+ return () => {
4283
+ return h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4284
+ slot,
4285
+ h(props.contentTag, {
4286
+ ref: contentElem,
4287
+ style: { display: mounted.value ? 'inherit' : 'none' },
4288
+ class: props.contentClass
4289
+ }, slots.content(exposed)),
4290
+ ] : slot);
4291
+ };
4292
+ },
4293
+ });
4294
+
4295
+ const booleanProps$1 = [
4296
+ 'a11y',
4297
+ 'allowHTML',
4298
+ 'arrow',
4299
+ 'flip',
4300
+ 'flipOnUpdate',
4301
+ 'hideOnClick',
4302
+ 'ignoreAttributes',
4303
+ 'inertia',
4304
+ 'interactive',
4305
+ 'lazy',
4306
+ 'multiple',
4307
+ 'showOnInit',
4308
+ 'touch',
4309
+ 'touchHold',
4310
+ ];
4311
+ let props$1 = {};
4312
+ Object.keys(tippy.defaultProps).forEach((prop) => {
4313
+ if (booleanProps$1.includes(prop)) {
4314
+ props$1[prop] = {
4315
+ type: Boolean,
4316
+ default: function () {
4317
+ return tippy.defaultProps[prop];
4318
+ },
4319
+ };
4320
+ }
4321
+ else {
4322
+ props$1[prop] = {
4323
+ default: function () {
4324
+ return tippy.defaultProps[prop];
4325
+ },
4326
+ };
4327
+ }
4328
+ });
4329
+ const TippySingleton = defineComponent({
4330
+ props: props$1,
4331
+ setup(props) {
4332
+ const instances = ref([]);
4333
+ const { singleton } = useSingleton(instances, props);
4334
+ return { instances, singleton };
4335
+ },
4336
+ mounted() {
4337
+ var _a;
4338
+ const parent = this.$el.parentElement;
4339
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4340
+ this.instances = Array.from(elements)
4341
+ .map((el) => el._tippy)
4342
+ .filter(Boolean);
4343
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
3864
4344
  },
3865
4345
  render() {
3866
4346
  let slot = this.$slots.default ? this.$slots.default() : [];
3867
- return h('span', { ref: 'elem' }, slot);
4347
+ return h(() => slot);
3868
4348
  },
3869
4349
  });
3870
4350
 
3871
4351
  const directive = {
3872
4352
  mounted(el, binding, vnode) {
3873
- const opts = binding.value || {};
4353
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4354
+ const modifiers = Object.keys(binding.modifiers || {});
4355
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4356
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4357
+ if (placement) {
4358
+ opts.placement = opts.placement || placement;
4359
+ }
4360
+ if (withArrow) {
4361
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4362
+ }
3874
4363
  if (vnode.props && vnode.props.onTippyShow) {
3875
4364
  opts.onShow = function (...args) {
3876
4365
  var _a;
@@ -3919,7 +4408,7 @@ const directive = {
3919
4408
  }
3920
4409
  },
3921
4410
  updated(el, binding) {
3922
- const opts = binding.value || {};
4411
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
3923
4412
  if (el.getAttribute('title') && !opts.content) {
3924
4413
  opts.content = el.getAttribute('title');
3925
4414
  el.removeAttribute('title');
@@ -3941,65 +4430,15 @@ const plugin = {
3941
4430
  tippy.setDefaultProps(options.defaultProps || {});
3942
4431
  app.directive(options.directive || 'tippy', directive);
3943
4432
  app.component(options.component || 'tippy', TippyComponent);
4433
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
3944
4434
  },
3945
4435
  };
3946
4436
 
3947
- function useSingleton(instances, optionalProps) {
3948
- const singleton = ref();
3949
- onMounted(() => {
3950
- const pendingTippyInstances = Array.isArray(instances)
3951
- ? instances.map(i => i.value)
3952
- : instances.value;
3953
- const tippyInstances = pendingTippyInstances
3954
- .map((instance) => {
3955
- if (instance instanceof Element) {
3956
- //@ts-ignore
3957
- return instance._tippy;
3958
- }
3959
- return instance;
3960
- })
3961
- .filter(Boolean);
3962
- singleton.value = createSingleton(tippyInstances, optionalProps);
3963
- });
3964
- return {
3965
- singleton,
3966
- };
3967
- }
3968
-
3969
- function styleInject(css, ref) {
3970
- if ( ref === void 0 ) ref = {};
3971
- var insertAt = ref.insertAt;
3972
-
3973
- if (!css || typeof document === 'undefined') { return; }
3974
-
3975
- var head = document.head || document.getElementsByTagName('head')[0];
3976
- var style = document.createElement('style');
3977
- style.type = 'text/css';
3978
-
3979
- if (insertAt === 'top') {
3980
- if (head.firstChild) {
3981
- head.insertBefore(style, head.firstChild);
3982
- } else {
3983
- head.appendChild(style);
3984
- }
3985
- } else {
3986
- head.appendChild(style);
3987
- }
3988
-
3989
- if (style.styleSheet) {
3990
- style.styleSheet.cssText = css;
3991
- } else {
3992
- style.appendChild(document.createTextNode(css));
3993
- }
3994
- }
3995
-
3996
- 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}";
3997
- styleInject(css_248z);
3998
-
3999
4437
  const setDefaultProps$1 = tippy.setDefaultProps;
4000
4438
  setDefaultProps$1({
4439
+ ignoreAttributes: true,
4001
4440
  plugins: [sticky, inlinePositioning, followCursor, animateFill],
4002
4441
  });
4003
4442
 
4004
4443
  export default plugin;
4005
- export { TippyComponent as Tippy, directive, setDefaultProps$1 as setDefaultProps, tippy, useSingleton, useTippy };
4444
+ export { TippyComponent as Tippy, TippySingleton, directive, plugin, ROUND_ARROW as roundArrow, setDefaultProps$1 as setDefaultProps, tippy, useSingleton, useTippy, useTippyComponent };