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,6 +1,6 @@
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
6
  'use strict';
@@ -45,10 +45,11 @@ function getNodeName(element) {
45
45
  return element ? (element.nodeName || '').toLowerCase() : null;
46
46
  }
47
47
 
48
- /*:: import type { Window } from '../types'; */
49
-
50
- /*:: declare function getWindow(node: Node | Window): Window; */
51
48
  function getWindow(node) {
49
+ if (node == null) {
50
+ return window;
51
+ }
52
+
52
53
  if (node.toString() !== '[object Window]') {
53
54
  var ownerDocument = node.ownerDocument;
54
55
  return ownerDocument ? ownerDocument.defaultView || window : window;
@@ -57,26 +58,22 @@ function getWindow(node) {
57
58
  return node;
58
59
  }
59
60
 
60
- /*:: declare function isElement(node: mixed): boolean %checks(node instanceof
61
- Element); */
62
-
63
61
  function isElement(node) {
64
62
  var OwnElement = getWindow(node).Element;
65
63
  return node instanceof OwnElement || node instanceof Element;
66
64
  }
67
- /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
68
- HTMLElement); */
69
-
70
65
 
71
66
  function isHTMLElement(node) {
72
67
  var OwnElement = getWindow(node).HTMLElement;
73
68
  return node instanceof OwnElement || node instanceof HTMLElement;
74
69
  }
75
- /*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
76
- ShadowRoot); */
77
-
78
70
 
79
71
  function isShadowRoot(node) {
72
+ // IE 11 has no ShadowRoot
73
+ if (typeof ShadowRoot === 'undefined') {
74
+ return false;
75
+ }
76
+
80
77
  var OwnElement = getWindow(node).ShadowRoot;
81
78
  return node instanceof OwnElement || node instanceof ShadowRoot;
82
79
  }
@@ -94,7 +91,7 @@ function applyStyles(_ref) {
94
91
  return;
95
92
  } // Flow doesn't support to extend this property, but it's the most
96
93
  // effective way to apply styles to an HTMLElement
97
- // $FlowFixMe
94
+ // $FlowFixMe[cannot-write]
98
95
 
99
96
 
100
97
  Object.assign(element.style, style);
@@ -125,6 +122,7 @@ function effect(_ref2) {
125
122
  reference: {}
126
123
  };
127
124
  Object.assign(state.elements.popper.style, initialStyles.popper);
125
+ state.styles = initialStyles;
128
126
 
129
127
  if (state.elements.arrow) {
130
128
  Object.assign(state.elements.arrow.style, initialStyles.arrow);
@@ -143,10 +141,7 @@ function effect(_ref2) {
143
141
 
144
142
  if (!isHTMLElement(element) || !getNodeName(element)) {
145
143
  return;
146
- } // Flow doesn't support to extend this property, but it's the most
147
- // effective way to apply styles to an HTMLElement
148
- // $FlowFixMe
149
-
144
+ }
150
145
 
151
146
  Object.assign(element.style, style);
152
147
  Object.keys(attributes).forEach(function (attribute) {
@@ -170,14 +165,67 @@ function getBasePlacement(placement) {
170
165
  return placement.split('-')[0];
171
166
  }
172
167
 
173
- // Returns the layout rect of an element relative to its offsetParent. Layout
168
+ var max = Math.max;
169
+ var min = Math.min;
170
+ var round = Math.round;
171
+
172
+ function getBoundingClientRect(element, includeScale) {
173
+ if (includeScale === void 0) {
174
+ includeScale = false;
175
+ }
176
+
177
+ var rect = element.getBoundingClientRect();
178
+ var scaleX = 1;
179
+ var scaleY = 1;
180
+
181
+ if (isHTMLElement(element) && includeScale) {
182
+ var offsetHeight = element.offsetHeight;
183
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
184
+ // Fallback to 1 in case both values are `0`
185
+
186
+ if (offsetWidth > 0) {
187
+ scaleX = round(rect.width) / offsetWidth || 1;
188
+ }
189
+
190
+ if (offsetHeight > 0) {
191
+ scaleY = round(rect.height) / offsetHeight || 1;
192
+ }
193
+ }
194
+
195
+ return {
196
+ width: rect.width / scaleX,
197
+ height: rect.height / scaleY,
198
+ top: rect.top / scaleY,
199
+ right: rect.right / scaleX,
200
+ bottom: rect.bottom / scaleY,
201
+ left: rect.left / scaleX,
202
+ x: rect.left / scaleX,
203
+ y: rect.top / scaleY
204
+ };
205
+ }
206
+
174
207
  // means it doesn't take into account transforms.
208
+
175
209
  function getLayoutRect(element) {
210
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
211
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
212
+
213
+ var width = element.offsetWidth;
214
+ var height = element.offsetHeight;
215
+
216
+ if (Math.abs(clientRect.width - width) <= 1) {
217
+ width = clientRect.width;
218
+ }
219
+
220
+ if (Math.abs(clientRect.height - height) <= 1) {
221
+ height = clientRect.height;
222
+ }
223
+
176
224
  return {
177
225
  x: element.offsetLeft,
178
226
  y: element.offsetTop,
179
- width: element.offsetWidth,
180
- height: element.offsetHeight
227
+ width: width,
228
+ height: height
181
229
  };
182
230
  }
183
231
 
@@ -193,7 +241,7 @@ function contains(parent, child) {
193
241
  do {
194
242
  if (next && parent.isSameNode(next)) {
195
243
  return true;
196
- } // $FlowFixMe: need a better way to handle this...
244
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
197
245
 
198
246
 
199
247
  next = next.parentNode || next.host;
@@ -213,8 +261,9 @@ function isTableElement(element) {
213
261
  }
214
262
 
215
263
  function getDocumentElement(element) {
216
- // $FlowFixMe: assume body is always available
217
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
264
+ // $FlowFixMe[incompatible-return]: assume body is always available
265
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
266
+ element.document) || window.document).documentElement;
218
267
  }
219
268
 
220
269
  function getParentNode(element) {
@@ -222,12 +271,13 @@ function getParentNode(element) {
222
271
  return element;
223
272
  }
224
273
 
225
- return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
274
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
275
+ // $FlowFixMe[incompatible-return]
276
+ // $FlowFixMe[prop-missing]
226
277
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
227
- element.parentNode || // DOM Element detected
228
- // $FlowFixMe: need a better way to handle this...
229
- element.host || // ShadowRoot detected
230
- // $FlowFixMe: HTMLElement is a Node
278
+ element.parentNode || ( // DOM Element detected
279
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
280
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
231
281
  getDocumentElement(element) // fallback
232
282
 
233
283
  );
@@ -239,29 +289,32 @@ function getTrueOffsetParent(element) {
239
289
  return null;
240
290
  }
241
291
 
242
- var offsetParent = element.offsetParent;
243
-
244
- if (offsetParent) {
245
- var html = getDocumentElement(offsetParent);
246
-
247
- if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
248
- return html;
249
- }
250
- }
251
-
252
- return offsetParent;
292
+ return element.offsetParent;
253
293
  } // `.offsetParent` reports `null` for fixed elements, while absolute elements
254
294
  // return the containing block
255
295
 
256
296
 
257
297
  function getContainingBlock(element) {
298
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
299
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
300
+
301
+ if (isIE && isHTMLElement(element)) {
302
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
303
+ var elementCss = getComputedStyle(element);
304
+
305
+ if (elementCss.position === 'fixed') {
306
+ return null;
307
+ }
308
+ }
309
+
258
310
  var currentNode = getParentNode(element);
259
311
 
260
312
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
261
313
  var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
262
314
  // create a containing block.
315
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
263
316
 
264
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
317
+ 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') {
265
318
  return currentNode;
266
319
  } else {
267
320
  currentNode = currentNode.parentNode;
@@ -281,7 +334,7 @@ function getOffsetParent(element) {
281
334
  offsetParent = getTrueOffsetParent(offsetParent);
282
335
  }
283
336
 
284
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
337
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
285
338
  return window;
286
339
  }
287
340
 
@@ -292,8 +345,12 @@ function getMainAxisFromPlacement(placement) {
292
345
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
293
346
  }
294
347
 
295
- function within(min, value, max) {
296
- return Math.max(min, Math.min(value, max));
348
+ function within(min$1, value, max$1) {
349
+ return max(min$1, min(value, max$1));
350
+ }
351
+ function withinMaxClamp(min, value, max) {
352
+ var v = within(min, value, max);
353
+ return v > max ? max : v;
297
354
  }
298
355
 
299
356
  function getFreshSideObject() {
@@ -306,7 +363,7 @@ function getFreshSideObject() {
306
363
  }
307
364
 
308
365
  function mergePaddingObject(paddingObject) {
309
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
366
+ return Object.assign({}, getFreshSideObject(), paddingObject);
310
367
  }
311
368
 
312
369
  function expandToHashMap(value, keys) {
@@ -316,11 +373,19 @@ function expandToHashMap(value, keys) {
316
373
  }, {});
317
374
  }
318
375
 
376
+ var toPaddingObject = function toPaddingObject(padding, state) {
377
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
378
+ placement: state.placement
379
+ })) : padding;
380
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
381
+ };
382
+
319
383
  function arrow(_ref) {
320
384
  var _state$modifiersData$;
321
385
 
322
386
  var state = _ref.state,
323
- name = _ref.name;
387
+ name = _ref.name,
388
+ options = _ref.options;
324
389
  var arrowElement = state.elements.arrow;
325
390
  var popperOffsets = state.modifiersData.popperOffsets;
326
391
  var basePlacement = getBasePlacement(state.placement);
@@ -332,7 +397,7 @@ function arrow(_ref) {
332
397
  return;
333
398
  }
334
399
 
335
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
400
+ var paddingObject = toPaddingObject(options.padding, state);
336
401
  var arrowRect = getLayoutRect(arrowElement);
337
402
  var minProp = axis === 'y' ? top : left;
338
403
  var maxProp = axis === 'y' ? bottom : right;
@@ -354,12 +419,9 @@ function arrow(_ref) {
354
419
 
355
420
  function effect$1(_ref2) {
356
421
  var state = _ref2.state,
357
- options = _ref2.options,
358
- name = _ref2.name;
422
+ options = _ref2.options;
359
423
  var _options$element = options.element,
360
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
361
- _options$padding = options.padding,
362
- padding = _options$padding === void 0 ? 0 : _options$padding;
424
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
363
425
 
364
426
  if (arrowElement == null) {
365
427
  return;
@@ -380,9 +442,6 @@ function effect$1(_ref2) {
380
442
  }
381
443
 
382
444
  state.elements.arrow = arrowElement;
383
- state.modifiersData[name + "#persistent"] = {
384
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
385
- };
386
445
  } // eslint-disable-next-line import/no-unused-modules
387
446
 
388
447
 
@@ -396,6 +455,10 @@ var arrow$1 = {
396
455
  requiresIfExists: ['preventOverflow']
397
456
  };
398
457
 
458
+ function getVariation(placement) {
459
+ return placement.split('-')[1];
460
+ }
461
+
399
462
  var unsetSides = {
400
463
  top: 'auto',
401
464
  right: 'auto',
@@ -405,14 +468,14 @@ var unsetSides = {
405
468
  // Zooming can change the DPR, but it seems to report a value that will
406
469
  // cleanly divide the values into the appropriate subpixels.
407
470
 
408
- function roundOffsets(_ref) {
471
+ function roundOffsetsByDPR(_ref) {
409
472
  var x = _ref.x,
410
473
  y = _ref.y;
411
474
  var win = window;
412
475
  var dpr = win.devicePixelRatio || 1;
413
476
  return {
414
- x: Math.round(x * dpr) / dpr || 0,
415
- y: Math.round(y * dpr) / dpr || 0
477
+ x: round(x * dpr) / dpr || 0,
478
+ y: round(y * dpr) / dpr || 0
416
479
  };
417
480
  }
418
481
 
@@ -422,14 +485,19 @@ function mapToStyles(_ref2) {
422
485
  var popper = _ref2.popper,
423
486
  popperRect = _ref2.popperRect,
424
487
  placement = _ref2.placement,
488
+ variation = _ref2.variation,
425
489
  offsets = _ref2.offsets,
426
490
  position = _ref2.position,
427
491
  gpuAcceleration = _ref2.gpuAcceleration,
428
- adaptive = _ref2.adaptive;
492
+ adaptive = _ref2.adaptive,
493
+ roundOffsets = _ref2.roundOffsets,
494
+ isFixed = _ref2.isFixed;
429
495
 
430
- var _roundOffsets = roundOffsets(offsets),
431
- x = _roundOffsets.x,
432
- y = _roundOffsets.y;
496
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
497
+ _ref3$x = _ref3.x,
498
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
499
+ _ref3$y = _ref3.y,
500
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
433
501
 
434
502
  var hasX = offsets.hasOwnProperty('x');
435
503
  var hasY = offsets.hasOwnProperty('y');
@@ -439,23 +507,34 @@ function mapToStyles(_ref2) {
439
507
 
440
508
  if (adaptive) {
441
509
  var offsetParent = getOffsetParent(popper);
510
+ var heightProp = 'clientHeight';
511
+ var widthProp = 'clientWidth';
442
512
 
443
513
  if (offsetParent === getWindow(popper)) {
444
514
  offsetParent = getDocumentElement(popper);
445
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
446
515
 
447
- /*:: offsetParent = (offsetParent: Element); */
516
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
517
+ heightProp = 'scrollHeight';
518
+ widthProp = 'scrollWidth';
519
+ }
520
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
521
+
448
522
 
523
+ offsetParent = offsetParent;
449
524
 
450
- if (placement === top) {
525
+ if (placement === top || (placement === left || placement === right) && variation === end) {
451
526
  sideY = bottom;
452
- y -= offsetParent.clientHeight - popperRect.height;
527
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
528
+ offsetParent[heightProp];
529
+ y -= offsetY - popperRect.height;
453
530
  y *= gpuAcceleration ? 1 : -1;
454
531
  }
455
532
 
456
- if (placement === left) {
533
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
457
534
  sideX = right;
458
- x -= offsetParent.clientWidth - popperRect.width;
535
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
536
+ offsetParent[widthProp];
537
+ x -= offsetX - popperRect.width;
459
538
  x *= gpuAcceleration ? 1 : -1;
460
539
  }
461
540
  }
@@ -467,44 +546,50 @@ function mapToStyles(_ref2) {
467
546
  if (gpuAcceleration) {
468
547
  var _Object$assign;
469
548
 
470
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
549
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
471
550
  }
472
551
 
473
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
552
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
474
553
  }
475
554
 
476
- function computeStyles(_ref3) {
477
- var state = _ref3.state,
478
- options = _ref3.options;
555
+ function computeStyles(_ref4) {
556
+ var state = _ref4.state,
557
+ options = _ref4.options;
479
558
  var _options$gpuAccelerat = options.gpuAcceleration,
480
559
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
481
560
  _options$adaptive = options.adaptive,
482
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
561
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
562
+ _options$roundOffsets = options.roundOffsets,
563
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
483
564
 
484
565
  var commonStyles = {
485
566
  placement: getBasePlacement(state.placement),
567
+ variation: getVariation(state.placement),
486
568
  popper: state.elements.popper,
487
569
  popperRect: state.rects.popper,
488
- gpuAcceleration: gpuAcceleration
570
+ gpuAcceleration: gpuAcceleration,
571
+ isFixed: state.options.strategy === 'fixed'
489
572
  };
490
573
 
491
574
  if (state.modifiersData.popperOffsets != null) {
492
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
575
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
493
576
  offsets: state.modifiersData.popperOffsets,
494
577
  position: state.options.strategy,
495
- adaptive: adaptive
578
+ adaptive: adaptive,
579
+ roundOffsets: roundOffsets
496
580
  })));
497
581
  }
498
582
 
499
583
  if (state.modifiersData.arrow != null) {
500
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
584
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
501
585
  offsets: state.modifiersData.arrow,
502
586
  position: 'absolute',
503
- adaptive: false
587
+ adaptive: false,
588
+ roundOffsets: roundOffsets
504
589
  })));
505
590
  }
506
591
 
507
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
592
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
508
593
  'data-popper-placement': state.placement
509
594
  });
510
595
  } // eslint-disable-next-line import/no-unused-modules
@@ -588,20 +673,6 @@ function getOppositeVariationPlacement(placement) {
588
673
  });
589
674
  }
590
675
 
591
- function getBoundingClientRect(element) {
592
- var rect = element.getBoundingClientRect();
593
- return {
594
- width: rect.width,
595
- height: rect.height,
596
- top: rect.top,
597
- right: rect.right,
598
- bottom: rect.bottom,
599
- left: rect.left,
600
- x: rect.left,
601
- y: rect.top
602
- };
603
- }
604
-
605
676
  function getWindowScroll(node) {
606
677
  var win = getWindow(node);
607
678
  var scrollLeft = win.pageXOffset;
@@ -664,16 +735,18 @@ function getViewportRect(element) {
664
735
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable
665
736
 
666
737
  function getDocumentRect(element) {
738
+ var _element$ownerDocumen;
739
+
667
740
  var html = getDocumentElement(element);
668
741
  var winScroll = getWindowScroll(element);
669
- var body = element.ownerDocument.body;
670
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
671
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
742
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
743
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
744
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
672
745
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
673
746
  var y = -winScroll.scrollTop;
674
747
 
675
748
  if (getComputedStyle(body || html).direction === 'rtl') {
676
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
749
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
677
750
  }
678
751
 
679
752
  return {
@@ -696,7 +769,7 @@ function isScrollParent(element) {
696
769
 
697
770
  function getScrollParent(node) {
698
771
  if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
699
- // $FlowFixMe: assume body is always available
772
+ // $FlowFixMe[incompatible-return]: assume body is always available
700
773
  return node.ownerDocument.body;
701
774
  }
702
775
 
@@ -710,26 +783,28 @@ function getScrollParent(node) {
710
783
  /*
711
784
  given a DOM element, return the list of all scroll parents, up the list of ancesors
712
785
  until we get to the top window object. This list is what we attach scroll listeners
713
- to, because if any of these parent elements scroll, we'll need to re-calculate the
786
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
714
787
  reference element's position.
715
788
  */
716
789
 
717
790
  function listScrollParents(element, list) {
791
+ var _element$ownerDocumen;
792
+
718
793
  if (list === void 0) {
719
794
  list = [];
720
795
  }
721
796
 
722
797
  var scrollParent = getScrollParent(element);
723
- var isBody = getNodeName(scrollParent) === 'body';
798
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
724
799
  var win = getWindow(scrollParent);
725
800
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
726
801
  var updatedList = list.concat(target);
727
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
802
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
728
803
  updatedList.concat(listScrollParents(getParentNode(target)));
729
804
  }
730
805
 
731
806
  function rectToClientRect(rect) {
732
- return Object.assign(Object.assign({}, rect), {}, {
807
+ return Object.assign({}, rect, {
733
808
  left: rect.x,
734
809
  top: rect.y,
735
810
  right: rect.x + rect.width,
@@ -751,7 +826,7 @@ function getInnerBoundingClientRect(element) {
751
826
  }
752
827
 
753
828
  function getClientRectFromMixedType(element, clippingParent) {
754
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
829
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
755
830
  } // A "clipping parent" is an overflowable container with the characteristic of
756
831
  // clipping (or hiding) overflowing elements with a position different from
757
832
  // `initial`
@@ -764,11 +839,11 @@ function getClippingParents(element) {
764
839
 
765
840
  if (!isElement(clipperElement)) {
766
841
  return [];
767
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
842
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
768
843
 
769
844
 
770
845
  return clippingParents.filter(function (clippingParent) {
771
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
846
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
772
847
  });
773
848
  } // Gets the maximum area that the element is visible in due to any number of
774
849
  // clipping parents
@@ -780,10 +855,10 @@ function getClippingRect(element, boundary, rootBoundary) {
780
855
  var firstClippingParent = clippingParents[0];
781
856
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
782
857
  var rect = getClientRectFromMixedType(element, clippingParent);
783
- accRect.top = Math.max(rect.top, accRect.top);
784
- accRect.right = Math.min(rect.right, accRect.right);
785
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
786
- accRect.left = Math.max(rect.left, accRect.left);
858
+ accRect.top = max(rect.top, accRect.top);
859
+ accRect.right = min(rect.right, accRect.right);
860
+ accRect.bottom = min(rect.bottom, accRect.bottom);
861
+ accRect.left = max(rect.left, accRect.left);
787
862
  return accRect;
788
863
  }, getClientRectFromMixedType(element, firstClippingParent));
789
864
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -793,10 +868,6 @@ function getClippingRect(element, boundary, rootBoundary) {
793
868
  return clippingRect;
794
869
  }
795
870
 
796
- function getVariation(placement) {
797
- return placement.split('-')[1];
798
- }
799
-
800
871
  function computeOffsets(_ref) {
801
872
  var reference = _ref.reference,
802
873
  element = _ref.element,
@@ -850,11 +921,11 @@ function computeOffsets(_ref) {
850
921
 
851
922
  switch (variation) {
852
923
  case start:
853
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
924
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
854
925
  break;
855
926
 
856
927
  case end:
857
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
928
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
858
929
  break;
859
930
  }
860
931
  }
@@ -882,18 +953,17 @@ function detectOverflow(state, options) {
882
953
  padding = _options$padding === void 0 ? 0 : _options$padding;
883
954
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
884
955
  var altContext = elementContext === popper ? reference : popper;
885
- var referenceElement = state.elements.reference;
886
956
  var popperRect = state.rects.popper;
887
957
  var element = state.elements[altBoundary ? altContext : elementContext];
888
958
  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
889
- var referenceClientRect = getBoundingClientRect(referenceElement);
959
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
890
960
  var popperOffsets = computeOffsets({
891
961
  reference: referenceClientRect,
892
962
  element: popperRect,
893
963
  strategy: 'absolute',
894
964
  placement: placement
895
965
  });
896
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
966
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
897
967
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
898
968
  // 0 or negative = within the clipping rect
899
969
 
@@ -917,9 +987,6 @@ function detectOverflow(state, options) {
917
987
  return overflowOffsets;
918
988
  }
919
989
 
920
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
921
-
922
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
923
990
  function computeAutoPlacement(state, options) {
924
991
  if (options === void 0) {
925
992
  options = {};
@@ -936,15 +1003,14 @@ function computeAutoPlacement(state, options) {
936
1003
  var variation = getVariation(placement);
937
1004
  var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
938
1005
  return getVariation(placement) === variation;
939
- }) : basePlacements; // $FlowFixMe
940
-
1006
+ }) : basePlacements;
941
1007
  var allowedPlacements = placements$1.filter(function (placement) {
942
1008
  return allowedAutoPlacements.indexOf(placement) >= 0;
943
1009
  });
944
1010
 
945
1011
  if (allowedPlacements.length === 0) {
946
1012
  allowedPlacements = placements$1;
947
- } // $FlowFixMe: Flow seems to have problems with two array unions...
1013
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
948
1014
 
949
1015
 
950
1016
  var overflows = allowedPlacements.reduce(function (acc, placement) {
@@ -1145,7 +1211,7 @@ function hide(_ref) {
1145
1211
  isReferenceHidden: isReferenceHidden,
1146
1212
  hasPopperEscaped: hasPopperEscaped
1147
1213
  };
1148
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1214
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1149
1215
  'data-popper-reference-hidden': isReferenceHidden,
1150
1216
  'data-popper-escaped': hasPopperEscaped
1151
1217
  });
@@ -1164,7 +1230,7 @@ function distanceAndSkiddingToXY(placement, rects, offset) {
1164
1230
  var basePlacement = getBasePlacement(placement);
1165
1231
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1166
1232
 
1167
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1233
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1168
1234
  placement: placement
1169
1235
  })) : offset,
1170
1236
  skidding = _ref[0],
@@ -1270,9 +1336,17 @@ function preventOverflow(_ref) {
1270
1336
  var popperOffsets = state.modifiersData.popperOffsets;
1271
1337
  var referenceRect = state.rects.reference;
1272
1338
  var popperRect = state.rects.popper;
1273
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1339
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1274
1340
  placement: state.placement
1275
1341
  })) : tetherOffset;
1342
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1343
+ mainAxis: tetherOffsetValue,
1344
+ altAxis: tetherOffsetValue
1345
+ } : Object.assign({
1346
+ mainAxis: 0,
1347
+ altAxis: 0
1348
+ }, tetherOffsetValue);
1349
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1276
1350
  var data = {
1277
1351
  x: 0,
1278
1352
  y: 0
@@ -1283,12 +1357,14 @@ function preventOverflow(_ref) {
1283
1357
  }
1284
1358
 
1285
1359
  if (checkMainAxis) {
1360
+ var _offsetModifierState$;
1361
+
1286
1362
  var mainSide = mainAxis === 'y' ? top : left;
1287
1363
  var altSide = mainAxis === 'y' ? bottom : right;
1288
1364
  var len = mainAxis === 'y' ? 'height' : 'width';
1289
1365
  var offset = popperOffsets[mainAxis];
1290
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1291
- var max = popperOffsets[mainAxis] - overflow[altSide];
1366
+ var min$1 = offset + overflow[mainSide];
1367
+ var max$1 = offset - overflow[altSide];
1292
1368
  var additive = tether ? -popperRect[len] / 2 : 0;
1293
1369
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1294
1370
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -1308,30 +1384,42 @@ function preventOverflow(_ref) {
1308
1384
  // width or height)
1309
1385
 
1310
1386
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1311
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1312
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1387
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1388
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1313
1389
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1314
1390
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1315
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1316
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1317
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1318
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1391
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1392
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1393
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1394
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1319
1395
  popperOffsets[mainAxis] = preventedOffset;
1320
1396
  data[mainAxis] = preventedOffset - offset;
1321
1397
  }
1322
1398
 
1323
1399
  if (checkAltAxis) {
1400
+ var _offsetModifierState$2;
1401
+
1324
1402
  var _mainSide = mainAxis === 'x' ? top : left;
1325
1403
 
1326
1404
  var _altSide = mainAxis === 'x' ? bottom : right;
1327
1405
 
1328
1406
  var _offset = popperOffsets[altAxis];
1329
1407
 
1408
+ var _len = altAxis === 'y' ? 'height' : 'width';
1409
+
1330
1410
  var _min = _offset + overflow[_mainSide];
1331
1411
 
1332
1412
  var _max = _offset - overflow[_altSide];
1333
1413
 
1334
- var _preventedOffset = within(_min, _offset, _max);
1414
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1415
+
1416
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1417
+
1418
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1419
+
1420
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1421
+
1422
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1335
1423
 
1336
1424
  popperOffsets[altAxis] = _preventedOffset;
1337
1425
  data[altAxis] = _preventedOffset - _offset;
@@ -1364,16 +1452,24 @@ function getNodeScroll(node) {
1364
1452
  }
1365
1453
  }
1366
1454
 
1455
+ function isElementScaled(element) {
1456
+ var rect = element.getBoundingClientRect();
1457
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1458
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1459
+ return scaleX !== 1 || scaleY !== 1;
1460
+ } // Returns the composite rect of an element relative to its offsetParent.
1367
1461
  // Composite means it takes into account transforms as well as layout.
1368
1462
 
1463
+
1369
1464
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1370
1465
  if (isFixed === void 0) {
1371
1466
  isFixed = false;
1372
1467
  }
1373
1468
 
1374
- var documentElement = getDocumentElement(offsetParent);
1375
- var rect = getBoundingClientRect(elementOrVirtualElement);
1376
1469
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1470
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1471
+ var documentElement = getDocumentElement(offsetParent);
1472
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1377
1473
  var scroll = {
1378
1474
  scrollLeft: 0,
1379
1475
  scrollTop: 0
@@ -1390,7 +1486,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1390
1486
  }
1391
1487
 
1392
1488
  if (isHTMLElement(offsetParent)) {
1393
- offsets = getBoundingClientRect(offsetParent);
1489
+ offsets = getBoundingClientRect(offsetParent, true);
1394
1490
  offsets.x += offsetParent.clientLeft;
1395
1491
  offsets.y += offsetParent.clientTop;
1396
1492
  } else if (documentElement) {
@@ -1468,9 +1564,9 @@ function debounce(fn) {
1468
1564
  function mergeByName(modifiers) {
1469
1565
  var merged = modifiers.reduce(function (merged, current) {
1470
1566
  var existing = merged[current.name];
1471
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1472
- options: Object.assign(Object.assign({}, existing.options), current.options),
1473
- data: Object.assign(Object.assign({}, existing.data), current.data)
1567
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1568
+ options: Object.assign({}, existing.options, current.options),
1569
+ data: Object.assign({}, existing.data, current.data)
1474
1570
  }) : current;
1475
1571
  return merged;
1476
1572
  }, {}); // IE11 does not support Object.values
@@ -1514,7 +1610,7 @@ function popperGenerator(generatorOptions) {
1514
1610
  var state = {
1515
1611
  placement: 'bottom',
1516
1612
  orderedModifiers: [],
1517
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1613
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1518
1614
  modifiersData: {},
1519
1615
  elements: {
1520
1616
  reference: reference,
@@ -1527,9 +1623,10 @@ function popperGenerator(generatorOptions) {
1527
1623
  var isDestroyed = false;
1528
1624
  var instance = {
1529
1625
  state: state,
1530
- setOptions: function setOptions(options) {
1626
+ setOptions: function setOptions(setOptionsAction) {
1627
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1531
1628
  cleanupModifierEffects();
1532
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1629
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1533
1630
  state.scrollParents = {
1534
1631
  reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1535
1632
  popper: listScrollParents(popper)
@@ -1677,10 +1774,12 @@ var createPopper = /*#__PURE__*/popperGenerator({
1677
1774
  }); // eslint-disable-next-line import/no-unused-modules
1678
1775
 
1679
1776
  /**!
1680
- * tippy.js v6.2.7
1681
- * (c) 2017-2020 atomiks
1777
+ * tippy.js v6.3.7
1778
+ * (c) 2017-2021 atomiks
1682
1779
  * MIT License
1683
1780
  */
1781
+
1782
+ 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>';
1684
1783
  var BOX_CLASS = "tippy-box";
1685
1784
  var CONTENT_CLASS = "tippy-content";
1686
1785
  var BACKDROP_CLASS = "tippy-backdrop";
@@ -1690,6 +1789,9 @@ var TOUCH_OPTIONS = {
1690
1789
  passive: true,
1691
1790
  capture: true
1692
1791
  };
1792
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1793
+ return document.body;
1794
+ };
1693
1795
  function getValueAtIndexOrReturn(value, index, defaultValue) {
1694
1796
  if (Array.isArray(value)) {
1695
1797
  var v = value[index];
@@ -1805,10 +1907,13 @@ function setVisibilityState(els, state) {
1805
1907
  });
1806
1908
  }
1807
1909
  function getOwnerDocument(elementOrElements) {
1910
+ var _element$ownerDocumen;
1911
+
1808
1912
  var _normalizeToArray = normalizeToArray(elementOrElements),
1809
- element = _normalizeToArray[0];
1913
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
1810
1914
 
1811
- return element ? element.ownerDocument || document : document;
1915
+
1916
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1812
1917
  }
1813
1918
  function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1814
1919
  var clientX = event.clientX,
@@ -1844,6 +1949,26 @@ function updateTransitionEndListener(box, action, listener) {
1844
1949
  box[method](event, listener);
1845
1950
  });
1846
1951
  }
1952
+ /**
1953
+ * Compared to xxx.contains, this function works for dom structures with shadow
1954
+ * dom
1955
+ */
1956
+
1957
+ function actualContains(parent, child) {
1958
+ var target = child;
1959
+
1960
+ while (target) {
1961
+ var _target$getRootNode;
1962
+
1963
+ if (parent.contains(target)) {
1964
+ return true;
1965
+ }
1966
+
1967
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
1968
+ }
1969
+
1970
+ return false;
1971
+ }
1847
1972
 
1848
1973
  var currentInput = {
1849
1974
  isTouch: false
@@ -1907,8 +2032,8 @@ function bindGlobalEventListeners() {
1907
2032
  }
1908
2033
 
1909
2034
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1910
- var ua = isBrowser ? navigator.userAgent : '';
1911
- var isIE = /MSIE |Trident\//.test(ua);
2035
+ var isIE11 = isBrowser ? // @ts-ignore
2036
+ !!window.msCrypto : false;
1912
2037
 
1913
2038
  var pluginProps = {
1914
2039
  animateFill: false,
@@ -1928,9 +2053,7 @@ var renderProps = {
1928
2053
  zIndex: 9999
1929
2054
  };
1930
2055
  var defaultProps = Object.assign({
1931
- appendTo: function appendTo() {
1932
- return document.body;
1933
- },
2056
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
1934
2057
  aria: {
1935
2058
  content: 'auto',
1936
2059
  expanded: 'auto'
@@ -1965,7 +2088,7 @@ var defaultProps = Object.assign({
1965
2088
  touch: true,
1966
2089
  trigger: 'mouseenter focus',
1967
2090
  triggerTarget: null
1968
- }, pluginProps, {}, renderProps);
2091
+ }, pluginProps, renderProps);
1969
2092
  var defaultKeys = Object.keys(defaultProps);
1970
2093
  var setDefaultProps = function setDefaultProps(partialProps) {
1971
2094
 
@@ -1981,12 +2104,14 @@ function getExtendedPassedProps(passedProps) {
1981
2104
  defaultValue = plugin.defaultValue;
1982
2105
 
1983
2106
  if (name) {
1984
- acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
2107
+ var _name;
2108
+
2109
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
1985
2110
  }
1986
2111
 
1987
2112
  return acc;
1988
2113
  }, {});
1989
- return Object.assign({}, passedProps, {}, pluginProps);
2114
+ return Object.assign({}, passedProps, pluginProps);
1990
2115
  }
1991
2116
  function getDataAttributeProps(reference, plugins) {
1992
2117
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
@@ -2017,7 +2142,7 @@ function evaluateProps(reference, props) {
2017
2142
  var out = Object.assign({}, props, {
2018
2143
  content: invokeWithArgsOrReturn(props.content, [reference])
2019
2144
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2020
- out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
2145
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2021
2146
  out.aria = {
2022
2147
  expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2023
2148
  content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
@@ -2155,7 +2280,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
2155
2280
 
2156
2281
  var mountedInstances = [];
2157
2282
  function createTippy(reference, passedProps) {
2158
- var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2283
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2159
2284
  // 🔒 Private members
2160
2285
  // ===========================================================================
2161
2286
 
@@ -2252,10 +2377,9 @@ function createTippy(reference, passedProps) {
2252
2377
  instance.clearDelayTimeouts();
2253
2378
  }
2254
2379
  });
2255
- popper.addEventListener('mouseleave', function (event) {
2380
+ popper.addEventListener('mouseleave', function () {
2256
2381
  if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2257
2382
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2258
- debouncedOnMouseMove(event);
2259
2383
  }
2260
2384
  });
2261
2385
  return instance; // ===========================================================================
@@ -2275,7 +2399,7 @@ function createTippy(reference, passedProps) {
2275
2399
  var _instance$props$rende;
2276
2400
 
2277
2401
  // @ts-ignore
2278
- return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
2402
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2279
2403
  }
2280
2404
 
2281
2405
  function getCurrentTarget() {
@@ -2302,8 +2426,12 @@ function createTippy(reference, passedProps) {
2302
2426
  return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2303
2427
  }
2304
2428
 
2305
- function handleStyles() {
2306
- popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
2429
+ function handleStyles(fromHide) {
2430
+ if (fromHide === void 0) {
2431
+ fromHide = false;
2432
+ }
2433
+
2434
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2307
2435
  popper.style.zIndex = "" + instance.props.zIndex;
2308
2436
  }
2309
2437
 
@@ -2314,7 +2442,7 @@ function createTippy(reference, passedProps) {
2314
2442
 
2315
2443
  pluginsHooks.forEach(function (pluginHooks) {
2316
2444
  if (pluginHooks[hook]) {
2317
- pluginHooks[hook].apply(void 0, args);
2445
+ pluginHooks[hook].apply(pluginHooks, args);
2318
2446
  }
2319
2447
  });
2320
2448
 
@@ -2380,15 +2508,18 @@ function createTippy(reference, passedProps) {
2380
2508
  if (didTouchMove || event.type === 'mousedown') {
2381
2509
  return;
2382
2510
  }
2383
- } // Clicked on interactive popper
2511
+ }
2384
2512
 
2513
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2385
2514
 
2386
- if (instance.props.interactive && popper.contains(event.target)) {
2515
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2387
2516
  return;
2388
2517
  } // Clicked on the event listeners target
2389
2518
 
2390
2519
 
2391
- if (getCurrentTarget().contains(event.target)) {
2520
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2521
+ return actualContains(el, actualTarget);
2522
+ })) {
2392
2523
  if (currentInput.isTouch) {
2393
2524
  return;
2394
2525
  }
@@ -2516,7 +2647,7 @@ function createTippy(reference, passedProps) {
2516
2647
  break;
2517
2648
 
2518
2649
  case 'focus':
2519
- on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
2650
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2520
2651
  break;
2521
2652
 
2522
2653
  case 'focusin':
@@ -2742,7 +2873,7 @@ function createTippy(reference, passedProps) {
2742
2873
 
2743
2874
  var node = getCurrentTarget();
2744
2875
 
2745
- if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
2876
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2746
2877
  parentNode = node.parentNode;
2747
2878
  } else {
2748
2879
  parentNode = invokeWithArgsOrReturn(appendTo, [node]);
@@ -2754,6 +2885,7 @@ function createTippy(reference, passedProps) {
2754
2885
  parentNode.appendChild(popper);
2755
2886
  }
2756
2887
 
2888
+ instance.state.isMounted = true;
2757
2889
  createPopperInstance();
2758
2890
  }
2759
2891
 
@@ -2851,7 +2983,7 @@ function createTippy(reference, passedProps) {
2851
2983
  invokeHook('onBeforeUpdate', [instance, partialProps]);
2852
2984
  removeListeners();
2853
2985
  var prevProps = instance.props;
2854
- var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
2986
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
2855
2987
  ignoreAttributes: true
2856
2988
  }));
2857
2989
  instance.props = nextProps;
@@ -2950,6 +3082,8 @@ function createTippy(reference, passedProps) {
2950
3082
  }
2951
3083
 
2952
3084
  onFirstUpdate = function onFirstUpdate() {
3085
+ var _instance$popperInsta2;
3086
+
2953
3087
  if (!instance.state.isVisible || ignoreOnFirstUpdate) {
2954
3088
  return;
2955
3089
  }
@@ -2970,8 +3104,10 @@ function createTippy(reference, passedProps) {
2970
3104
 
2971
3105
  handleAriaContentAttribute();
2972
3106
  handleAriaExpandedAttribute();
2973
- pushIfUnique(mountedInstances, instance);
2974
- instance.state.isMounted = true;
3107
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3108
+ // popper has been positioned for the first time
3109
+
3110
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
2975
3111
  invokeHook('onMount', [instance]);
2976
3112
 
2977
3113
  if (instance.props.animation && getIsDefaultRenderFn()) {
@@ -3014,7 +3150,7 @@ function createTippy(reference, passedProps) {
3014
3150
 
3015
3151
  cleanupInteractiveMouseListeners();
3016
3152
  removeDocumentPress();
3017
- handleStyles();
3153
+ handleStyles(true);
3018
3154
 
3019
3155
  if (getIsDefaultRenderFn()) {
3020
3156
  var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
@@ -3119,16 +3255,58 @@ tippy.defaultProps = defaultProps;
3119
3255
  tippy.setDefaultProps = setDefaultProps;
3120
3256
  tippy.currentInput = currentInput;
3121
3257
 
3258
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3259
+ // and causing transitions to break for singletons when the console is open, but
3260
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3261
+
3262
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3263
+ effect: function effect(_ref) {
3264
+ var state = _ref.state;
3265
+ var initialStyles = {
3266
+ popper: {
3267
+ position: state.options.strategy,
3268
+ left: '0',
3269
+ top: '0',
3270
+ margin: '0'
3271
+ },
3272
+ arrow: {
3273
+ position: 'absolute'
3274
+ },
3275
+ reference: {}
3276
+ };
3277
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3278
+ state.styles = initialStyles;
3279
+
3280
+ if (state.elements.arrow) {
3281
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3282
+ } // intentionally return no cleanup function
3283
+ // return () => { ... }
3284
+
3285
+ }
3286
+ });
3287
+
3122
3288
  var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3289
+ var _optionalProps$popper;
3290
+
3123
3291
  if (optionalProps === void 0) {
3124
3292
  optionalProps = {};
3125
3293
  }
3126
3294
 
3127
3295
  var individualInstances = tippyInstances;
3128
3296
  var references = [];
3297
+ var triggerTargets = [];
3129
3298
  var currentTarget;
3130
3299
  var overrides = optionalProps.overrides;
3131
3300
  var interceptSetPropsCleanups = [];
3301
+ var shownOnCreate = false;
3302
+
3303
+ function setTriggerTargets() {
3304
+ triggerTargets = individualInstances.map(function (instance) {
3305
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3306
+ }).reduce(function (acc, item) {
3307
+ return acc.concat(item);
3308
+ }, []);
3309
+ }
3132
3310
 
3133
3311
  function setReferences() {
3134
3312
  references = individualInstances.map(function (instance) {
@@ -3162,42 +3340,123 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3162
3340
  instance.setProps = originalSetProps;
3163
3341
  };
3164
3342
  });
3343
+ } // have to pass singleton, as it maybe undefined on first call
3344
+
3345
+
3346
+ function prepareInstance(singleton, target) {
3347
+ var index = triggerTargets.indexOf(target); // bail-out
3348
+
3349
+ if (target === currentTarget) {
3350
+ return;
3351
+ }
3352
+
3353
+ currentTarget = target;
3354
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3355
+ acc[prop] = individualInstances[index].props[prop];
3356
+ return acc;
3357
+ }, {});
3358
+ singleton.setProps(Object.assign({}, overrideProps, {
3359
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3360
+ var _references$index;
3361
+
3362
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3363
+ }
3364
+ }));
3165
3365
  }
3166
3366
 
3167
3367
  enableInstances(false);
3168
3368
  setReferences();
3369
+ setTriggerTargets();
3169
3370
  var plugin = {
3170
3371
  fn: function fn() {
3171
3372
  return {
3172
3373
  onDestroy: function onDestroy() {
3173
3374
  enableInstances(true);
3174
3375
  },
3175
- onTrigger: function onTrigger(instance, event) {
3176
- var target = event.currentTarget;
3177
- var index = references.indexOf(target); // bail-out
3178
-
3179
- if (target === currentTarget) {
3180
- return;
3376
+ onHidden: function onHidden() {
3377
+ currentTarget = null;
3378
+ },
3379
+ onClickOutside: function onClickOutside(instance) {
3380
+ if (instance.props.showOnCreate && !shownOnCreate) {
3381
+ shownOnCreate = true;
3382
+ currentTarget = null;
3181
3383
  }
3182
-
3183
- currentTarget = target;
3184
- var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3185
- acc[prop] = individualInstances[index].props[prop];
3186
- return acc;
3187
- }, {});
3188
- instance.setProps(Object.assign({}, overrideProps, {
3189
- getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3190
- return target.getBoundingClientRect();
3191
- }
3192
- }));
3384
+ },
3385
+ onShow: function onShow(instance) {
3386
+ if (instance.props.showOnCreate && !shownOnCreate) {
3387
+ shownOnCreate = true;
3388
+ prepareInstance(instance, references[0]);
3389
+ }
3390
+ },
3391
+ onTrigger: function onTrigger(instance, event) {
3392
+ prepareInstance(instance, event.currentTarget);
3193
3393
  }
3194
3394
  };
3195
3395
  }
3196
3396
  };
3197
3397
  var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3198
3398
  plugins: [plugin].concat(optionalProps.plugins || []),
3199
- triggerTarget: references
3399
+ triggerTarget: triggerTargets,
3400
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3401
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3402
+ })
3200
3403
  }));
3404
+ var originalShow = singleton.show;
3405
+
3406
+ singleton.show = function (target) {
3407
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3408
+ // default to showing first instance
3409
+
3410
+ if (!currentTarget && target == null) {
3411
+ return prepareInstance(singleton, references[0]);
3412
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3413
+ // programmatic call with no params when already visible (do nothing again)
3414
+
3415
+
3416
+ if (currentTarget && target == null) {
3417
+ return;
3418
+ } // target is index of instance
3419
+
3420
+
3421
+ if (typeof target === 'number') {
3422
+ return references[target] && prepareInstance(singleton, references[target]);
3423
+ } // target is a child tippy instance
3424
+
3425
+
3426
+ if (individualInstances.indexOf(target) >= 0) {
3427
+ var ref = target.reference;
3428
+ return prepareInstance(singleton, ref);
3429
+ } // target is a ReferenceElement
3430
+
3431
+
3432
+ if (references.indexOf(target) >= 0) {
3433
+ return prepareInstance(singleton, target);
3434
+ }
3435
+ };
3436
+
3437
+ singleton.showNext = function () {
3438
+ var first = references[0];
3439
+
3440
+ if (!currentTarget) {
3441
+ return singleton.show(0);
3442
+ }
3443
+
3444
+ var index = references.indexOf(currentTarget);
3445
+ singleton.show(references[index + 1] || first);
3446
+ };
3447
+
3448
+ singleton.showPrevious = function () {
3449
+ var last = references[references.length - 1];
3450
+
3451
+ if (!currentTarget) {
3452
+ return singleton.show(last);
3453
+ }
3454
+
3455
+ var index = references.indexOf(currentTarget);
3456
+ var target = references[index - 1] || last;
3457
+ singleton.show(target);
3458
+ };
3459
+
3201
3460
  var originalSetProps = singleton.setProps;
3202
3461
 
3203
3462
  singleton.setProps = function (props) {
@@ -3213,9 +3472,10 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3213
3472
  individualInstances = nextInstances;
3214
3473
  enableInstances(false);
3215
3474
  setReferences();
3216
- interceptSetProps(singleton);
3475
+ setTriggerTargets();
3476
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3217
3477
  singleton.setProps({
3218
- triggerTarget: references
3478
+ triggerTarget: triggerTargets
3219
3479
  });
3220
3480
  };
3221
3481
 
@@ -3230,7 +3490,7 @@ var animateFill = {
3230
3490
  var _instance$props$rende;
3231
3491
 
3232
3492
  // @ts-ignore
3233
- if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
3493
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3234
3494
 
3235
3495
  return {};
3236
3496
  }
@@ -3352,6 +3612,7 @@ var followCursor = {
3352
3612
 
3353
3613
  if (isCursorOverReference || !instance.props.interactive) {
3354
3614
  instance.setProps({
3615
+ // @ts-ignore - unneeded DOMRect properties
3355
3616
  getReferenceClientRect: function getReferenceClientRect() {
3356
3617
  var rect = reference.getBoundingClientRect();
3357
3618
  var x = clientX;
@@ -3488,6 +3749,7 @@ var inlinePositioning = {
3488
3749
  var placement;
3489
3750
  var cursorRectIndex = -1;
3490
3751
  var isInternalUpdate = false;
3752
+ var triedPlacements = [];
3491
3753
  var modifier = {
3492
3754
  name: 'tippyInlinePositioning',
3493
3755
  enabled: true,
@@ -3496,8 +3758,14 @@ var inlinePositioning = {
3496
3758
  var state = _ref2.state;
3497
3759
 
3498
3760
  if (isEnabled()) {
3499
- if (placement !== state.placement) {
3761
+ if (triedPlacements.indexOf(state.placement) !== -1) {
3762
+ triedPlacements = [];
3763
+ }
3764
+
3765
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
3766
+ triedPlacements.push(state.placement);
3500
3767
  instance.setProps({
3768
+ // @ts-ignore - unneeded DOMRect properties
3501
3769
  getReferenceClientRect: function getReferenceClientRect() {
3502
3770
  return _getReferenceClientRect(state.placement);
3503
3771
  }
@@ -3534,10 +3802,11 @@ var inlinePositioning = {
3534
3802
  var cursorRect = rects.find(function (rect) {
3535
3803
  return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
3536
3804
  });
3537
- cursorRectIndex = rects.indexOf(cursorRect);
3805
+ var index = rects.indexOf(cursorRect);
3806
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
3538
3807
  }
3539
3808
  },
3540
- onUntrigger: function onUntrigger() {
3809
+ onHidden: function onHidden() {
3541
3810
  cursorRectIndex = -1;
3542
3811
  }
3543
3812
  };
@@ -3681,12 +3950,20 @@ tippy.setDefaultProps({
3681
3950
  },
3682
3951
  });
3683
3952
  function useTippy(el, opts = {}, settings = { mount: true }) {
3953
+ const vm = vue.getCurrentInstance();
3684
3954
  const instance = vue.ref();
3955
+ const state = vue.ref({
3956
+ isEnabled: false,
3957
+ isVisible: false,
3958
+ isDestroyed: false,
3959
+ isMounted: false,
3960
+ isShown: false,
3961
+ });
3685
3962
  let container = null;
3686
3963
  const getContainer = () => {
3687
3964
  if (container)
3688
3965
  return container;
3689
- container = document.createElement('fragment');
3966
+ container = document.createDocumentFragment();
3690
3967
  return container;
3691
3968
  };
3692
3969
  const getContent = (content) => {
@@ -3695,11 +3972,18 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3695
3972
  ? content.value
3696
3973
  : content;
3697
3974
  if (vue.isVNode(unwrappedContent)) {
3975
+ if (vm) {
3976
+ unwrappedContent.appContext = vm.appContext;
3977
+ }
3698
3978
  vue.render(unwrappedContent, getContainer());
3699
3979
  newContent = () => getContainer();
3700
3980
  }
3701
3981
  else if (typeof unwrappedContent === 'object') {
3702
- vue.render(vue.h(unwrappedContent), getContainer());
3982
+ let comp = vue.h(unwrappedContent);
3983
+ if (vm) {
3984
+ comp.appContext = vm.appContext;
3985
+ }
3986
+ vue.render(comp, getContainer());
3703
3987
  newContent = () => getContainer();
3704
3988
  }
3705
3989
  else {
@@ -3710,7 +3994,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3710
3994
  const getProps = (opts) => {
3711
3995
  let options = {};
3712
3996
  if (vue.isRef(opts)) {
3713
- options = opts.value;
3997
+ options = opts.value || {};
3714
3998
  }
3715
3999
  else if (vue.isReactive(opts)) {
3716
4000
  options = { ...opts };
@@ -3718,8 +4002,51 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3718
4002
  else {
3719
4003
  options = { ...opts };
3720
4004
  }
3721
- if (options.content)
4005
+ if (options.content) {
3722
4006
  options.content = getContent(options.content);
4007
+ }
4008
+ if (options.triggerTarget) {
4009
+ options.triggerTarget = vue.isRef(options.triggerTarget)
4010
+ ? options.triggerTarget.value
4011
+ : options.triggerTarget;
4012
+ }
4013
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4014
+ options.plugins = [];
4015
+ }
4016
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4017
+ options.plugins.push({
4018
+ name: 'vueTippyReactiveState',
4019
+ fn: () => {
4020
+ return {
4021
+ onCreate() {
4022
+ state.value.isEnabled = true;
4023
+ },
4024
+ onMount() {
4025
+ state.value.isMounted = true;
4026
+ },
4027
+ onShow() {
4028
+ state.value.isMounted = true;
4029
+ state.value.isVisible = true;
4030
+ },
4031
+ onShown() {
4032
+ state.value.isShown = true;
4033
+ },
4034
+ onHide() {
4035
+ state.value.isMounted = false;
4036
+ state.value.isVisible = false;
4037
+ },
4038
+ onHidden() {
4039
+ state.value.isShown = false;
4040
+ },
4041
+ onUnmounted() {
4042
+ state.value.isMounted = false;
4043
+ },
4044
+ onDestroy() {
4045
+ state.value.isDestroyed = true;
4046
+ },
4047
+ };
4048
+ }
4049
+ });
3723
4050
  return options;
3724
4051
  };
3725
4052
  const refresh = () => {
@@ -3758,10 +4085,12 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3758
4085
  const disable = () => {
3759
4086
  var _a;
3760
4087
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4088
+ state.value.isEnabled = false;
3761
4089
  };
3762
4090
  const enable = () => {
3763
4091
  var _a;
3764
4092
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4093
+ state.value.isEnabled = true;
3765
4094
  };
3766
4095
  const unmount = () => {
3767
4096
  var _a;
@@ -3792,9 +4121,9 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3792
4121
  enable,
3793
4122
  unmount,
3794
4123
  mount,
4124
+ state,
3795
4125
  };
3796
4126
  if (settings.mount) {
3797
- const vm = vue.getCurrentInstance();
3798
4127
  if (vm) {
3799
4128
  if (vm.isMounted) {
3800
4129
  mount();
@@ -3819,6 +4148,46 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3819
4148
  return response;
3820
4149
  }
3821
4150
 
4151
+ function useTippyComponent(opts = {}, children) {
4152
+ const instance = vue.ref();
4153
+ return {
4154
+ instance,
4155
+ TippyComponent: vue.h(TippyComponent, {
4156
+ ...opts,
4157
+ onVnodeMounted: vnode => {
4158
+ //@ts-ignore
4159
+ instance.value = vnode.component.ctx;
4160
+ },
4161
+ }, children),
4162
+ };
4163
+ }
4164
+
4165
+ function useSingleton(instances, optionalProps) {
4166
+ const singleton = vue.ref();
4167
+ vue.onMounted(() => {
4168
+ const pendingTippyInstances = Array.isArray(instances)
4169
+ ? instances.map(i => i.value)
4170
+ : typeof instances === 'function'
4171
+ ? instances()
4172
+ : instances.value;
4173
+ const tippyInstances = pendingTippyInstances
4174
+ .map((instance) => {
4175
+ if (instance instanceof Element) {
4176
+ //@ts-ignore
4177
+ return instance._tippy;
4178
+ }
4179
+ return instance;
4180
+ })
4181
+ .filter(Boolean);
4182
+ singleton.value = createSingleton(tippyInstances, optionalProps
4183
+ ? { allowHTML: true, ...optionalProps }
4184
+ : { allowHTML: true });
4185
+ });
4186
+ return {
4187
+ singleton,
4188
+ };
4189
+ }
4190
+
3822
4191
  // const pluginProps = [
3823
4192
  // 'animateFill',
3824
4193
  // 'followCursor',
@@ -3845,7 +4214,7 @@ let props = {};
3845
4214
  Object.keys(tippy.defaultProps).forEach((prop) => {
3846
4215
  if (booleanProps.includes(prop)) {
3847
4216
  props[prop] = {
3848
- type: Boolean,
4217
+ type: prop === 'arrow' ? [String, Boolean, SVGElement, DocumentFragment] : Boolean,
3849
4218
  default: function () {
3850
4219
  return tippy.defaultProps[prop];
3851
4220
  },
@@ -3859,22 +4228,142 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
3859
4228
  };
3860
4229
  }
3861
4230
  });
4231
+ props['to'] = {};
4232
+ props['tag'] = {
4233
+ default: 'span'
4234
+ };
4235
+ props['contentTag'] = {
4236
+ default: 'span'
4237
+ };
4238
+ props['contentClass'] = {
4239
+ default: null
4240
+ };
3862
4241
  const TippyComponent = vue.defineComponent({
3863
4242
  props,
3864
- setup(props) {
4243
+ emits: ['state'],
4244
+ setup(props, { slots, emit, expose }) {
3865
4245
  const elem = vue.ref();
3866
- const tippy = useTippy(elem, props);
3867
- return { elem, ...tippy };
4246
+ const contentElem = vue.ref();
4247
+ const mounted = vue.ref(false);
4248
+ let options = { ...props };
4249
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4250
+ if (options.hasOwnProperty(prop)) {
4251
+ // @ts-ignore
4252
+ delete options[prop];
4253
+ }
4254
+ }
4255
+ let target = elem;
4256
+ if (props.to) {
4257
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4258
+ target = () => props.to;
4259
+ }
4260
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4261
+ target = () => document.querySelector(props.to);
4262
+ }
4263
+ }
4264
+ const tippy = useTippy(target, options);
4265
+ vue.onMounted(() => {
4266
+ mounted.value = true;
4267
+ vue.nextTick(() => {
4268
+ if (slots.content)
4269
+ tippy.setContent(() => contentElem.value);
4270
+ });
4271
+ });
4272
+ vue.watch(tippy.state, () => {
4273
+ emit('state', vue.unref(tippy.state));
4274
+ }, { immediate: true, deep: true });
4275
+ vue.watch(props, () => {
4276
+ tippy.setProps(props);
4277
+ });
4278
+ let exposed = {
4279
+ elem,
4280
+ contentElem,
4281
+ mounted,
4282
+ ...tippy
4283
+ };
4284
+ expose(exposed);
4285
+ const slot = slots.default ? slots.default(exposed) : [];
4286
+ return () => {
4287
+ return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4288
+ slot,
4289
+ vue.h(props.contentTag, {
4290
+ ref: contentElem,
4291
+ style: { display: mounted.value ? 'inherit' : 'none' },
4292
+ class: props.contentClass
4293
+ }, slots.content(exposed)),
4294
+ ] : slot);
4295
+ };
4296
+ },
4297
+ });
4298
+
4299
+ const booleanProps$1 = [
4300
+ 'a11y',
4301
+ 'allowHTML',
4302
+ 'arrow',
4303
+ 'flip',
4304
+ 'flipOnUpdate',
4305
+ 'hideOnClick',
4306
+ 'ignoreAttributes',
4307
+ 'inertia',
4308
+ 'interactive',
4309
+ 'lazy',
4310
+ 'multiple',
4311
+ 'showOnInit',
4312
+ 'touch',
4313
+ 'touchHold',
4314
+ ];
4315
+ let props$1 = {};
4316
+ Object.keys(tippy.defaultProps).forEach((prop) => {
4317
+ if (booleanProps$1.includes(prop)) {
4318
+ props$1[prop] = {
4319
+ type: Boolean,
4320
+ default: function () {
4321
+ return tippy.defaultProps[prop];
4322
+ },
4323
+ };
4324
+ }
4325
+ else {
4326
+ props$1[prop] = {
4327
+ default: function () {
4328
+ return tippy.defaultProps[prop];
4329
+ },
4330
+ };
4331
+ }
4332
+ });
4333
+ const TippySingleton = vue.defineComponent({
4334
+ props: props$1,
4335
+ setup(props) {
4336
+ const instances = vue.ref([]);
4337
+ const { singleton } = useSingleton(instances, props);
4338
+ return { instances, singleton };
4339
+ },
4340
+ mounted() {
4341
+ var _a;
4342
+ const parent = this.$el.parentElement;
4343
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4344
+ this.instances = Array.from(elements)
4345
+ .map((el) => el._tippy)
4346
+ .filter(Boolean);
4347
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
3868
4348
  },
3869
4349
  render() {
3870
4350
  let slot = this.$slots.default ? this.$slots.default() : [];
3871
- return vue.h('span', { ref: 'elem' }, slot);
4351
+ return vue.h(() => slot);
3872
4352
  },
3873
4353
  });
3874
4354
 
3875
4355
  const directive = {
3876
4356
  mounted(el, binding, vnode) {
3877
- const opts = binding.value || {};
4357
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4358
+ const modifiers = Object.keys(binding.modifiers || {});
4359
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4360
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4361
+ if (placement) {
4362
+ opts.placement = opts.placement || placement;
4363
+ }
4364
+ if (withArrow) {
4365
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4366
+ }
3878
4367
  if (vnode.props && vnode.props.onTippyShow) {
3879
4368
  opts.onShow = function (...args) {
3880
4369
  var _a;
@@ -3923,7 +4412,7 @@ const directive = {
3923
4412
  }
3924
4413
  },
3925
4414
  updated(el, binding) {
3926
- const opts = binding.value || {};
4415
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
3927
4416
  if (el.getAttribute('title') && !opts.content) {
3928
4417
  opts.content = el.getAttribute('title');
3929
4418
  el.removeAttribute('title');
@@ -3945,70 +4434,24 @@ const plugin = {
3945
4434
  tippy.setDefaultProps(options.defaultProps || {});
3946
4435
  app.directive(options.directive || 'tippy', directive);
3947
4436
  app.component(options.component || 'tippy', TippyComponent);
4437
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
3948
4438
  },
3949
4439
  };
3950
4440
 
3951
- function useSingleton(instances, optionalProps) {
3952
- const singleton = vue.ref();
3953
- vue.onMounted(() => {
3954
- const pendingTippyInstances = Array.isArray(instances)
3955
- ? instances.map(i => i.value)
3956
- : instances.value;
3957
- const tippyInstances = pendingTippyInstances
3958
- .map((instance) => {
3959
- if (instance instanceof Element) {
3960
- //@ts-ignore
3961
- return instance._tippy;
3962
- }
3963
- return instance;
3964
- })
3965
- .filter(Boolean);
3966
- singleton.value = createSingleton(tippyInstances, optionalProps);
3967
- });
3968
- return {
3969
- singleton,
3970
- };
3971
- }
3972
-
3973
- function styleInject(css, ref) {
3974
- if ( ref === void 0 ) ref = {};
3975
- var insertAt = ref.insertAt;
3976
-
3977
- if (!css || typeof document === 'undefined') { return; }
3978
-
3979
- var head = document.head || document.getElementsByTagName('head')[0];
3980
- var style = document.createElement('style');
3981
- style.type = 'text/css';
3982
-
3983
- if (insertAt === 'top') {
3984
- if (head.firstChild) {
3985
- head.insertBefore(style, head.firstChild);
3986
- } else {
3987
- head.appendChild(style);
3988
- }
3989
- } else {
3990
- head.appendChild(style);
3991
- }
3992
-
3993
- if (style.styleSheet) {
3994
- style.styleSheet.cssText = css;
3995
- } else {
3996
- style.appendChild(document.createTextNode(css));
3997
- }
3998
- }
3999
-
4000
- 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}";
4001
- styleInject(css_248z);
4002
-
4003
4441
  const setDefaultProps$1 = tippy.setDefaultProps;
4004
4442
  setDefaultProps$1({
4443
+ ignoreAttributes: true,
4005
4444
  plugins: [sticky, inlinePositioning, followCursor, animateFill],
4006
4445
  });
4007
4446
 
4008
4447
  exports.Tippy = TippyComponent;
4448
+ exports.TippySingleton = TippySingleton;
4009
4449
  exports.default = plugin;
4010
4450
  exports.directive = directive;
4451
+ exports.plugin = plugin;
4452
+ exports.roundArrow = ROUND_ARROW;
4011
4453
  exports.setDefaultProps = setDefaultProps$1;
4012
4454
  exports.tippy = tippy;
4013
4455
  exports.useSingleton = useSingleton;
4014
4456
  exports.useTippy = useTippy;
4457
+ exports.useTippyComponent = useTippyComponent;