vue-tippy 6.0.0-alpha.4 → 6.0.0-alpha.43

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * vue-tippy v6.0.0-alpha.3
3
- * (c) 2020 Georges KABBOUCHI
2
+ * vue-tippy v6.0.0-alpha.43
3
+ * (c) 2021
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;
@@ -374,15 +436,21 @@ function effect$1(_ref2) {
374
436
  }
375
437
  }
376
438
 
439
+ if (process.env.NODE_ENV !== "production") {
440
+ if (!isHTMLElement(arrowElement)) {
441
+ console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
442
+ }
443
+ }
444
+
377
445
  if (!contains(state.elements.popper, arrowElement)) {
446
+ if (process.env.NODE_ENV !== "production") {
447
+ console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
448
+ }
378
449
 
379
450
  return;
380
451
  }
381
452
 
382
453
  state.elements.arrow = arrowElement;
383
- state.modifiersData[name + "#persistent"] = {
384
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
385
- };
386
454
  } // eslint-disable-next-line import/no-unused-modules
387
455
 
388
456
 
@@ -396,6 +464,10 @@ var arrow$1 = {
396
464
  requiresIfExists: ['preventOverflow']
397
465
  };
398
466
 
467
+ function getVariation(placement) {
468
+ return placement.split('-')[1];
469
+ }
470
+
399
471
  var unsetSides = {
400
472
  top: 'auto',
401
473
  right: 'auto',
@@ -405,14 +477,14 @@ var unsetSides = {
405
477
  // Zooming can change the DPR, but it seems to report a value that will
406
478
  // cleanly divide the values into the appropriate subpixels.
407
479
 
408
- function roundOffsets(_ref) {
480
+ function roundOffsetsByDPR(_ref) {
409
481
  var x = _ref.x,
410
482
  y = _ref.y;
411
483
  var win = window;
412
484
  var dpr = win.devicePixelRatio || 1;
413
485
  return {
414
- x: Math.round(x * dpr) / dpr || 0,
415
- y: Math.round(y * dpr) / dpr || 0
486
+ x: round(x * dpr) / dpr || 0,
487
+ y: round(y * dpr) / dpr || 0
416
488
  };
417
489
  }
418
490
 
@@ -422,14 +494,19 @@ function mapToStyles(_ref2) {
422
494
  var popper = _ref2.popper,
423
495
  popperRect = _ref2.popperRect,
424
496
  placement = _ref2.placement,
497
+ variation = _ref2.variation,
425
498
  offsets = _ref2.offsets,
426
499
  position = _ref2.position,
427
500
  gpuAcceleration = _ref2.gpuAcceleration,
428
- adaptive = _ref2.adaptive;
501
+ adaptive = _ref2.adaptive,
502
+ roundOffsets = _ref2.roundOffsets,
503
+ isFixed = _ref2.isFixed;
429
504
 
430
- var _roundOffsets = roundOffsets(offsets),
431
- x = _roundOffsets.x,
432
- y = _roundOffsets.y;
505
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
506
+ _ref3$x = _ref3.x,
507
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
508
+ _ref3$y = _ref3.y,
509
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
433
510
 
434
511
  var hasX = offsets.hasOwnProperty('x');
435
512
  var hasY = offsets.hasOwnProperty('y');
@@ -439,23 +516,34 @@ function mapToStyles(_ref2) {
439
516
 
440
517
  if (adaptive) {
441
518
  var offsetParent = getOffsetParent(popper);
519
+ var heightProp = 'clientHeight';
520
+ var widthProp = 'clientWidth';
442
521
 
443
522
  if (offsetParent === getWindow(popper)) {
444
523
  offsetParent = getDocumentElement(popper);
445
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
446
524
 
447
- /*:: offsetParent = (offsetParent: Element); */
525
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
526
+ heightProp = 'scrollHeight';
527
+ widthProp = 'scrollWidth';
528
+ }
529
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
530
+
448
531
 
532
+ offsetParent = offsetParent;
449
533
 
450
- if (placement === top) {
534
+ if (placement === top || (placement === left || placement === right) && variation === end) {
451
535
  sideY = bottom;
452
- y -= offsetParent.clientHeight - popperRect.height;
536
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
537
+ offsetParent[heightProp];
538
+ y -= offsetY - popperRect.height;
453
539
  y *= gpuAcceleration ? 1 : -1;
454
540
  }
455
541
 
456
- if (placement === left) {
542
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
457
543
  sideX = right;
458
- x -= offsetParent.clientWidth - popperRect.width;
544
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
545
+ offsetParent[widthProp];
546
+ x -= offsetX - popperRect.width;
459
547
  x *= gpuAcceleration ? 1 : -1;
460
548
  }
461
549
  }
@@ -467,44 +555,60 @@ function mapToStyles(_ref2) {
467
555
  if (gpuAcceleration) {
468
556
  var _Object$assign;
469
557
 
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));
558
+ 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
559
  }
472
560
 
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));
561
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
474
562
  }
475
563
 
476
- function computeStyles(_ref3) {
477
- var state = _ref3.state,
478
- options = _ref3.options;
564
+ function computeStyles(_ref4) {
565
+ var state = _ref4.state,
566
+ options = _ref4.options;
479
567
  var _options$gpuAccelerat = options.gpuAcceleration,
480
568
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
481
569
  _options$adaptive = options.adaptive,
482
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
570
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
571
+ _options$roundOffsets = options.roundOffsets,
572
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
573
+
574
+ if (process.env.NODE_ENV !== "production") {
575
+ var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
576
+
577
+ if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
578
+ return transitionProperty.indexOf(property) >= 0;
579
+ })) {
580
+ console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
581
+ }
582
+ }
483
583
 
484
584
  var commonStyles = {
485
585
  placement: getBasePlacement(state.placement),
586
+ variation: getVariation(state.placement),
486
587
  popper: state.elements.popper,
487
588
  popperRect: state.rects.popper,
488
- gpuAcceleration: gpuAcceleration
589
+ gpuAcceleration: gpuAcceleration,
590
+ isFixed: state.options.strategy === 'fixed'
489
591
  };
490
592
 
491
593
  if (state.modifiersData.popperOffsets != null) {
492
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
594
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
493
595
  offsets: state.modifiersData.popperOffsets,
494
596
  position: state.options.strategy,
495
- adaptive: adaptive
597
+ adaptive: adaptive,
598
+ roundOffsets: roundOffsets
496
599
  })));
497
600
  }
498
601
 
499
602
  if (state.modifiersData.arrow != null) {
500
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
603
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
501
604
  offsets: state.modifiersData.arrow,
502
605
  position: 'absolute',
503
- adaptive: false
606
+ adaptive: false,
607
+ roundOffsets: roundOffsets
504
608
  })));
505
609
  }
506
610
 
507
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
611
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
508
612
  'data-popper-placement': state.placement
509
613
  });
510
614
  } // eslint-disable-next-line import/no-unused-modules
@@ -588,20 +692,6 @@ function getOppositeVariationPlacement(placement) {
588
692
  });
589
693
  }
590
694
 
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
695
  function getWindowScroll(node) {
606
696
  var win = getWindow(node);
607
697
  var scrollLeft = win.pageXOffset;
@@ -664,16 +754,18 @@ function getViewportRect(element) {
664
754
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable
665
755
 
666
756
  function getDocumentRect(element) {
757
+ var _element$ownerDocumen;
758
+
667
759
  var html = getDocumentElement(element);
668
760
  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);
761
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
762
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
763
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
672
764
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
673
765
  var y = -winScroll.scrollTop;
674
766
 
675
767
  if (getComputedStyle(body || html).direction === 'rtl') {
676
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
768
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
677
769
  }
678
770
 
679
771
  return {
@@ -696,7 +788,7 @@ function isScrollParent(element) {
696
788
 
697
789
  function getScrollParent(node) {
698
790
  if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
699
- // $FlowFixMe: assume body is always available
791
+ // $FlowFixMe[incompatible-return]: assume body is always available
700
792
  return node.ownerDocument.body;
701
793
  }
702
794
 
@@ -710,26 +802,28 @@ function getScrollParent(node) {
710
802
  /*
711
803
  given a DOM element, return the list of all scroll parents, up the list of ancesors
712
804
  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
805
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
714
806
  reference element's position.
715
807
  */
716
808
 
717
809
  function listScrollParents(element, list) {
810
+ var _element$ownerDocumen;
811
+
718
812
  if (list === void 0) {
719
813
  list = [];
720
814
  }
721
815
 
722
816
  var scrollParent = getScrollParent(element);
723
- var isBody = getNodeName(scrollParent) === 'body';
817
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
724
818
  var win = getWindow(scrollParent);
725
819
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
726
820
  var updatedList = list.concat(target);
727
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
821
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
728
822
  updatedList.concat(listScrollParents(getParentNode(target)));
729
823
  }
730
824
 
731
825
  function rectToClientRect(rect) {
732
- return Object.assign(Object.assign({}, rect), {}, {
826
+ return Object.assign({}, rect, {
733
827
  left: rect.x,
734
828
  top: rect.y,
735
829
  right: rect.x + rect.width,
@@ -751,7 +845,7 @@ function getInnerBoundingClientRect(element) {
751
845
  }
752
846
 
753
847
  function getClientRectFromMixedType(element, clippingParent) {
754
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
848
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
755
849
  } // A "clipping parent" is an overflowable container with the characteristic of
756
850
  // clipping (or hiding) overflowing elements with a position different from
757
851
  // `initial`
@@ -764,11 +858,11 @@ function getClippingParents(element) {
764
858
 
765
859
  if (!isElement(clipperElement)) {
766
860
  return [];
767
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
861
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
768
862
 
769
863
 
770
864
  return clippingParents.filter(function (clippingParent) {
771
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
865
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
772
866
  });
773
867
  } // Gets the maximum area that the element is visible in due to any number of
774
868
  // clipping parents
@@ -780,10 +874,10 @@ function getClippingRect(element, boundary, rootBoundary) {
780
874
  var firstClippingParent = clippingParents[0];
781
875
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
782
876
  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);
877
+ accRect.top = max(rect.top, accRect.top);
878
+ accRect.right = min(rect.right, accRect.right);
879
+ accRect.bottom = min(rect.bottom, accRect.bottom);
880
+ accRect.left = max(rect.left, accRect.left);
787
881
  return accRect;
788
882
  }, getClientRectFromMixedType(element, firstClippingParent));
789
883
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -793,10 +887,6 @@ function getClippingRect(element, boundary, rootBoundary) {
793
887
  return clippingRect;
794
888
  }
795
889
 
796
- function getVariation(placement) {
797
- return placement.split('-')[1];
798
- }
799
-
800
890
  function computeOffsets(_ref) {
801
891
  var reference = _ref.reference,
802
892
  element = _ref.element,
@@ -850,11 +940,11 @@ function computeOffsets(_ref) {
850
940
 
851
941
  switch (variation) {
852
942
  case start:
853
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
943
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
854
944
  break;
855
945
 
856
946
  case end:
857
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
947
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
858
948
  break;
859
949
  }
860
950
  }
@@ -882,18 +972,17 @@ function detectOverflow(state, options) {
882
972
  padding = _options$padding === void 0 ? 0 : _options$padding;
883
973
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
884
974
  var altContext = elementContext === popper ? reference : popper;
885
- var referenceElement = state.elements.reference;
886
975
  var popperRect = state.rects.popper;
887
976
  var element = state.elements[altBoundary ? altContext : elementContext];
888
977
  var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
889
- var referenceClientRect = getBoundingClientRect(referenceElement);
978
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
890
979
  var popperOffsets = computeOffsets({
891
980
  reference: referenceClientRect,
892
981
  element: popperRect,
893
982
  strategy: 'absolute',
894
983
  placement: placement
895
984
  });
896
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
985
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
897
986
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
898
987
  // 0 or negative = within the clipping rect
899
988
 
@@ -917,9 +1006,6 @@ function detectOverflow(state, options) {
917
1006
  return overflowOffsets;
918
1007
  }
919
1008
 
920
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
921
-
922
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
923
1009
  function computeAutoPlacement(state, options) {
924
1010
  if (options === void 0) {
925
1011
  options = {};
@@ -936,15 +1022,18 @@ function computeAutoPlacement(state, options) {
936
1022
  var variation = getVariation(placement);
937
1023
  var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
938
1024
  return getVariation(placement) === variation;
939
- }) : basePlacements; // $FlowFixMe
940
-
1025
+ }) : basePlacements;
941
1026
  var allowedPlacements = placements$1.filter(function (placement) {
942
1027
  return allowedAutoPlacements.indexOf(placement) >= 0;
943
1028
  });
944
1029
 
945
1030
  if (allowedPlacements.length === 0) {
946
1031
  allowedPlacements = placements$1;
947
- } // $FlowFixMe: Flow seems to have problems with two array unions...
1032
+
1033
+ if (process.env.NODE_ENV !== "production") {
1034
+ console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
1035
+ }
1036
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
948
1037
 
949
1038
 
950
1039
  var overflows = allowedPlacements.reduce(function (acc, placement) {
@@ -1145,7 +1234,7 @@ function hide(_ref) {
1145
1234
  isReferenceHidden: isReferenceHidden,
1146
1235
  hasPopperEscaped: hasPopperEscaped
1147
1236
  };
1148
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1237
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1149
1238
  'data-popper-reference-hidden': isReferenceHidden,
1150
1239
  'data-popper-escaped': hasPopperEscaped
1151
1240
  });
@@ -1164,7 +1253,7 @@ function distanceAndSkiddingToXY(placement, rects, offset) {
1164
1253
  var basePlacement = getBasePlacement(placement);
1165
1254
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1166
1255
 
1167
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1256
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1168
1257
  placement: placement
1169
1258
  })) : offset,
1170
1259
  skidding = _ref[0],
@@ -1270,9 +1359,17 @@ function preventOverflow(_ref) {
1270
1359
  var popperOffsets = state.modifiersData.popperOffsets;
1271
1360
  var referenceRect = state.rects.reference;
1272
1361
  var popperRect = state.rects.popper;
1273
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1362
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1274
1363
  placement: state.placement
1275
1364
  })) : tetherOffset;
1365
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1366
+ mainAxis: tetherOffsetValue,
1367
+ altAxis: tetherOffsetValue
1368
+ } : Object.assign({
1369
+ mainAxis: 0,
1370
+ altAxis: 0
1371
+ }, tetherOffsetValue);
1372
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1276
1373
  var data = {
1277
1374
  x: 0,
1278
1375
  y: 0
@@ -1283,12 +1380,14 @@ function preventOverflow(_ref) {
1283
1380
  }
1284
1381
 
1285
1382
  if (checkMainAxis) {
1383
+ var _offsetModifierState$;
1384
+
1286
1385
  var mainSide = mainAxis === 'y' ? top : left;
1287
1386
  var altSide = mainAxis === 'y' ? bottom : right;
1288
1387
  var len = mainAxis === 'y' ? 'height' : 'width';
1289
1388
  var offset = popperOffsets[mainAxis];
1290
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1291
- var max = popperOffsets[mainAxis] - overflow[altSide];
1389
+ var min$1 = offset + overflow[mainSide];
1390
+ var max$1 = offset - overflow[altSide];
1292
1391
  var additive = tether ? -popperRect[len] / 2 : 0;
1293
1392
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1294
1393
  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 +1407,42 @@ function preventOverflow(_ref) {
1308
1407
  // width or height)
1309
1408
 
1310
1409
  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;
1410
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1411
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1313
1412
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1314
1413
  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);
1414
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1415
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1416
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1417
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1319
1418
  popperOffsets[mainAxis] = preventedOffset;
1320
1419
  data[mainAxis] = preventedOffset - offset;
1321
1420
  }
1322
1421
 
1323
1422
  if (checkAltAxis) {
1423
+ var _offsetModifierState$2;
1424
+
1324
1425
  var _mainSide = mainAxis === 'x' ? top : left;
1325
1426
 
1326
1427
  var _altSide = mainAxis === 'x' ? bottom : right;
1327
1428
 
1328
1429
  var _offset = popperOffsets[altAxis];
1329
1430
 
1431
+ var _len = altAxis === 'y' ? 'height' : 'width';
1432
+
1330
1433
  var _min = _offset + overflow[_mainSide];
1331
1434
 
1332
1435
  var _max = _offset - overflow[_altSide];
1333
1436
 
1334
- var _preventedOffset = within(_min, _offset, _max);
1437
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1438
+
1439
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1440
+
1441
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1442
+
1443
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1444
+
1445
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1335
1446
 
1336
1447
  popperOffsets[altAxis] = _preventedOffset;
1337
1448
  data[altAxis] = _preventedOffset - _offset;
@@ -1364,16 +1475,24 @@ function getNodeScroll(node) {
1364
1475
  }
1365
1476
  }
1366
1477
 
1478
+ function isElementScaled(element) {
1479
+ var rect = element.getBoundingClientRect();
1480
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1481
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1482
+ return scaleX !== 1 || scaleY !== 1;
1483
+ } // Returns the composite rect of an element relative to its offsetParent.
1367
1484
  // Composite means it takes into account transforms as well as layout.
1368
1485
 
1486
+
1369
1487
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1370
1488
  if (isFixed === void 0) {
1371
1489
  isFixed = false;
1372
1490
  }
1373
1491
 
1374
- var documentElement = getDocumentElement(offsetParent);
1375
- var rect = getBoundingClientRect(elementOrVirtualElement);
1376
1492
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1493
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1494
+ var documentElement = getDocumentElement(offsetParent);
1495
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1377
1496
  var scroll = {
1378
1497
  scrollLeft: 0,
1379
1498
  scrollTop: 0
@@ -1390,7 +1509,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1390
1509
  }
1391
1510
 
1392
1511
  if (isHTMLElement(offsetParent)) {
1393
- offsets = getBoundingClientRect(offsetParent);
1512
+ offsets = getBoundingClientRect(offsetParent, true);
1394
1513
  offsets.x += offsetParent.clientLeft;
1395
1514
  offsets.y += offsetParent.clientTop;
1396
1515
  } else if (documentElement) {
@@ -1465,12 +1584,114 @@ function debounce(fn) {
1465
1584
  };
1466
1585
  }
1467
1586
 
1587
+ function format(str) {
1588
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1589
+ args[_key - 1] = arguments[_key];
1590
+ }
1591
+
1592
+ return [].concat(args).reduce(function (p, c) {
1593
+ return p.replace(/%s/, c);
1594
+ }, str);
1595
+ }
1596
+
1597
+ var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
1598
+ var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
1599
+ var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
1600
+ function validateModifiers(modifiers) {
1601
+ modifiers.forEach(function (modifier) {
1602
+ [].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
1603
+ .filter(function (value, index, self) {
1604
+ return self.indexOf(value) === index;
1605
+ }).forEach(function (key) {
1606
+ switch (key) {
1607
+ case 'name':
1608
+ if (typeof modifier.name !== 'string') {
1609
+ console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
1610
+ }
1611
+
1612
+ break;
1613
+
1614
+ case 'enabled':
1615
+ if (typeof modifier.enabled !== 'boolean') {
1616
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
1617
+ }
1618
+
1619
+ break;
1620
+
1621
+ case 'phase':
1622
+ if (modifierPhases.indexOf(modifier.phase) < 0) {
1623
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
1624
+ }
1625
+
1626
+ break;
1627
+
1628
+ case 'fn':
1629
+ if (typeof modifier.fn !== 'function') {
1630
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
1631
+ }
1632
+
1633
+ break;
1634
+
1635
+ case 'effect':
1636
+ if (modifier.effect != null && typeof modifier.effect !== 'function') {
1637
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
1638
+ }
1639
+
1640
+ break;
1641
+
1642
+ case 'requires':
1643
+ if (modifier.requires != null && !Array.isArray(modifier.requires)) {
1644
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
1645
+ }
1646
+
1647
+ break;
1648
+
1649
+ case 'requiresIfExists':
1650
+ if (!Array.isArray(modifier.requiresIfExists)) {
1651
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
1652
+ }
1653
+
1654
+ break;
1655
+
1656
+ case 'options':
1657
+ case 'data':
1658
+ break;
1659
+
1660
+ default:
1661
+ console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
1662
+ return "\"" + s + "\"";
1663
+ }).join(', ') + "; but \"" + key + "\" was provided.");
1664
+ }
1665
+
1666
+ modifier.requires && modifier.requires.forEach(function (requirement) {
1667
+ if (modifiers.find(function (mod) {
1668
+ return mod.name === requirement;
1669
+ }) == null) {
1670
+ console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
1671
+ }
1672
+ });
1673
+ });
1674
+ });
1675
+ }
1676
+
1677
+ function uniqueBy(arr, fn) {
1678
+ var identifiers = new Set();
1679
+ return arr.filter(function (item) {
1680
+ var identifier = fn(item);
1681
+
1682
+ if (!identifiers.has(identifier)) {
1683
+ identifiers.add(identifier);
1684
+ return true;
1685
+ }
1686
+ });
1687
+ }
1688
+
1468
1689
  function mergeByName(modifiers) {
1469
1690
  var merged = modifiers.reduce(function (merged, current) {
1470
1691
  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)
1692
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1693
+ options: Object.assign({}, existing.options, current.options),
1694
+ data: Object.assign({}, existing.data, current.data)
1474
1695
  }) : current;
1475
1696
  return merged;
1476
1697
  }, {}); // IE11 does not support Object.values
@@ -1480,6 +1701,8 @@ function mergeByName(modifiers) {
1480
1701
  });
1481
1702
  }
1482
1703
 
1704
+ var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
1705
+ var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
1483
1706
  var DEFAULT_OPTIONS = {
1484
1707
  placement: 'bottom',
1485
1708
  modifiers: [],
@@ -1514,7 +1737,7 @@ function popperGenerator(generatorOptions) {
1514
1737
  var state = {
1515
1738
  placement: 'bottom',
1516
1739
  orderedModifiers: [],
1517
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1740
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1518
1741
  modifiersData: {},
1519
1742
  elements: {
1520
1743
  reference: reference,
@@ -1527,9 +1750,10 @@ function popperGenerator(generatorOptions) {
1527
1750
  var isDestroyed = false;
1528
1751
  var instance = {
1529
1752
  state: state,
1530
- setOptions: function setOptions(options) {
1753
+ setOptions: function setOptions(setOptionsAction) {
1754
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1531
1755
  cleanupModifierEffects();
1532
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1756
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1533
1757
  state.scrollParents = {
1534
1758
  reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1535
1759
  popper: listScrollParents(popper)
@@ -1541,6 +1765,40 @@ function popperGenerator(generatorOptions) {
1541
1765
  state.orderedModifiers = orderedModifiers.filter(function (m) {
1542
1766
  return m.enabled;
1543
1767
  }); // Validate the provided modifiers so that the consumer will get warned
1768
+ // if one of the modifiers is invalid for any reason
1769
+
1770
+ if (process.env.NODE_ENV !== "production") {
1771
+ var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
1772
+ var name = _ref.name;
1773
+ return name;
1774
+ });
1775
+ validateModifiers(modifiers);
1776
+
1777
+ if (getBasePlacement(state.options.placement) === auto) {
1778
+ var flipModifier = state.orderedModifiers.find(function (_ref2) {
1779
+ var name = _ref2.name;
1780
+ return name === 'flip';
1781
+ });
1782
+
1783
+ if (!flipModifier) {
1784
+ console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
1785
+ }
1786
+ }
1787
+
1788
+ var _getComputedStyle = getComputedStyle(popper),
1789
+ marginTop = _getComputedStyle.marginTop,
1790
+ marginRight = _getComputedStyle.marginRight,
1791
+ marginBottom = _getComputedStyle.marginBottom,
1792
+ marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
1793
+ // cause bugs with positioning, so we'll warn the consumer
1794
+
1795
+
1796
+ if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
1797
+ return parseFloat(margin);
1798
+ })) {
1799
+ console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
1800
+ }
1801
+ }
1544
1802
 
1545
1803
  runModifierEffects();
1546
1804
  return instance.update();
@@ -1561,6 +1819,9 @@ function popperGenerator(generatorOptions) {
1561
1819
  // anymore
1562
1820
 
1563
1821
  if (!areValidElements(reference, popper)) {
1822
+ if (process.env.NODE_ENV !== "production") {
1823
+ console.error(INVALID_ELEMENT_ERROR);
1824
+ }
1564
1825
 
1565
1826
  return;
1566
1827
  } // Store the reference and popper rects to be read by modifiers
@@ -1584,8 +1845,17 @@ function popperGenerator(generatorOptions) {
1584
1845
  state.orderedModifiers.forEach(function (modifier) {
1585
1846
  return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1586
1847
  });
1848
+ var __debug_loops__ = 0;
1587
1849
 
1588
1850
  for (var index = 0; index < state.orderedModifiers.length; index++) {
1851
+ if (process.env.NODE_ENV !== "production") {
1852
+ __debug_loops__ += 1;
1853
+
1854
+ if (__debug_loops__ > 100) {
1855
+ console.error(INFINITE_LOOP_ERROR);
1856
+ break;
1857
+ }
1858
+ }
1589
1859
 
1590
1860
  if (state.reset === true) {
1591
1861
  state.reset = false;
@@ -1624,6 +1894,9 @@ function popperGenerator(generatorOptions) {
1624
1894
  };
1625
1895
 
1626
1896
  if (!areValidElements(reference, popper)) {
1897
+ if (process.env.NODE_ENV !== "production") {
1898
+ console.error(INVALID_ELEMENT_ERROR);
1899
+ }
1627
1900
 
1628
1901
  return instance;
1629
1902
  }
@@ -1677,10 +1950,12 @@ var createPopper = /*#__PURE__*/popperGenerator({
1677
1950
  }); // eslint-disable-next-line import/no-unused-modules
1678
1951
 
1679
1952
  /**!
1680
- * tippy.js v6.2.7
1681
- * (c) 2017-2020 atomiks
1953
+ * tippy.js v6.3.7
1954
+ * (c) 2017-2021 atomiks
1682
1955
  * MIT License
1683
1956
  */
1957
+
1958
+ 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
1959
  var BOX_CLASS = "tippy-box";
1685
1960
  var CONTENT_CLASS = "tippy-content";
1686
1961
  var BACKDROP_CLASS = "tippy-backdrop";
@@ -1690,6 +1965,13 @@ var TOUCH_OPTIONS = {
1690
1965
  passive: true,
1691
1966
  capture: true
1692
1967
  };
1968
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1969
+ return document.body;
1970
+ };
1971
+
1972
+ function hasOwnProperty(obj, key) {
1973
+ return {}.hasOwnProperty.call(obj, key);
1974
+ }
1693
1975
  function getValueAtIndexOrReturn(value, index, defaultValue) {
1694
1976
  if (Array.isArray(value)) {
1695
1977
  var v = value[index];
@@ -1805,10 +2087,13 @@ function setVisibilityState(els, state) {
1805
2087
  });
1806
2088
  }
1807
2089
  function getOwnerDocument(elementOrElements) {
2090
+ var _element$ownerDocumen;
2091
+
1808
2092
  var _normalizeToArray = normalizeToArray(elementOrElements),
1809
- element = _normalizeToArray[0];
2093
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
2094
+
1810
2095
 
1811
- return element ? element.ownerDocument || document : document;
2096
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1812
2097
  }
1813
2098
  function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1814
2099
  var clientX = event.clientX,
@@ -1844,6 +2129,26 @@ function updateTransitionEndListener(box, action, listener) {
1844
2129
  box[method](event, listener);
1845
2130
  });
1846
2131
  }
2132
+ /**
2133
+ * Compared to xxx.contains, this function works for dom structures with shadow
2134
+ * dom
2135
+ */
2136
+
2137
+ function actualContains(parent, child) {
2138
+ var target = child;
2139
+
2140
+ while (target) {
2141
+ var _target$getRootNode;
2142
+
2143
+ if (parent.contains(target)) {
2144
+ return true;
2145
+ }
2146
+
2147
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
2148
+ }
2149
+
2150
+ return false;
2151
+ }
1847
2152
 
1848
2153
  var currentInput = {
1849
2154
  isTouch: false
@@ -1907,8 +2212,63 @@ function bindGlobalEventListeners() {
1907
2212
  }
1908
2213
 
1909
2214
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1910
- var ua = isBrowser ? navigator.userAgent : '';
1911
- var isIE = /MSIE |Trident\//.test(ua);
2215
+ var isIE11 = isBrowser ? // @ts-ignore
2216
+ !!window.msCrypto : false;
2217
+
2218
+ function createMemoryLeakWarning(method) {
2219
+ var txt = method === 'destroy' ? 'n already-' : ' ';
2220
+ return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
2221
+ }
2222
+ function clean(value) {
2223
+ var spacesAndTabs = /[ \t]{2,}/g;
2224
+ var lineStartWithSpaces = /^[ \t]*/gm;
2225
+ return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
2226
+ }
2227
+
2228
+ function getDevMessage(message) {
2229
+ return clean("\n %ctippy.js\n\n %c" + clean(message) + "\n\n %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n ");
2230
+ }
2231
+
2232
+ function getFormattedMessage(message) {
2233
+ return [getDevMessage(message), // title
2234
+ 'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
2235
+ 'line-height: 1.5', // footer
2236
+ 'color: #a6a095;'];
2237
+ } // Assume warnings and errors never have the same message
2238
+
2239
+ var visitedMessages;
2240
+
2241
+ if (process.env.NODE_ENV !== "production") {
2242
+ resetVisitedMessages();
2243
+ }
2244
+
2245
+ function resetVisitedMessages() {
2246
+ visitedMessages = new Set();
2247
+ }
2248
+ function warnWhen(condition, message) {
2249
+ if (condition && !visitedMessages.has(message)) {
2250
+ var _console;
2251
+
2252
+ visitedMessages.add(message);
2253
+
2254
+ (_console = console).warn.apply(_console, getFormattedMessage(message));
2255
+ }
2256
+ }
2257
+ function errorWhen(condition, message) {
2258
+ if (condition && !visitedMessages.has(message)) {
2259
+ var _console2;
2260
+
2261
+ visitedMessages.add(message);
2262
+
2263
+ (_console2 = console).error.apply(_console2, getFormattedMessage(message));
2264
+ }
2265
+ }
2266
+ function validateTargets(targets) {
2267
+ var didPassFalsyValue = !targets;
2268
+ var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
2269
+ errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
2270
+ errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
2271
+ }
1912
2272
 
1913
2273
  var pluginProps = {
1914
2274
  animateFill: false,
@@ -1928,9 +2288,7 @@ var renderProps = {
1928
2288
  zIndex: 9999
1929
2289
  };
1930
2290
  var defaultProps = Object.assign({
1931
- appendTo: function appendTo() {
1932
- return document.body;
1933
- },
2291
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
1934
2292
  aria: {
1935
2293
  content: 'auto',
1936
2294
  expanded: 'auto'
@@ -1965,9 +2323,13 @@ var defaultProps = Object.assign({
1965
2323
  touch: true,
1966
2324
  trigger: 'mouseenter focus',
1967
2325
  triggerTarget: null
1968
- }, pluginProps, {}, renderProps);
2326
+ }, pluginProps, renderProps);
1969
2327
  var defaultKeys = Object.keys(defaultProps);
1970
2328
  var setDefaultProps = function setDefaultProps(partialProps) {
2329
+ /* istanbul ignore else */
2330
+ if (process.env.NODE_ENV !== "production") {
2331
+ validateProps(partialProps, []);
2332
+ }
1971
2333
 
1972
2334
  var keys = Object.keys(partialProps);
1973
2335
  keys.forEach(function (key) {
@@ -1981,12 +2343,14 @@ function getExtendedPassedProps(passedProps) {
1981
2343
  defaultValue = plugin.defaultValue;
1982
2344
 
1983
2345
  if (name) {
1984
- acc[name] = passedProps[name] !== undefined ? passedProps[name] : defaultValue;
2346
+ var _name;
2347
+
2348
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
1985
2349
  }
1986
2350
 
1987
2351
  return acc;
1988
2352
  }, {});
1989
- return Object.assign({}, passedProps, {}, pluginProps);
2353
+ return Object.assign({}, passedProps, pluginProps);
1990
2354
  }
1991
2355
  function getDataAttributeProps(reference, plugins) {
1992
2356
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
@@ -2017,13 +2381,36 @@ function evaluateProps(reference, props) {
2017
2381
  var out = Object.assign({}, props, {
2018
2382
  content: invokeWithArgsOrReturn(props.content, [reference])
2019
2383
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2020
- out.aria = Object.assign({}, defaultProps.aria, {}, out.aria);
2384
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2021
2385
  out.aria = {
2022
2386
  expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2023
2387
  content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
2024
2388
  };
2025
2389
  return out;
2026
2390
  }
2391
+ function validateProps(partialProps, plugins) {
2392
+ if (partialProps === void 0) {
2393
+ partialProps = {};
2394
+ }
2395
+
2396
+ if (plugins === void 0) {
2397
+ plugins = [];
2398
+ }
2399
+
2400
+ var keys = Object.keys(partialProps);
2401
+ keys.forEach(function (prop) {
2402
+ var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
2403
+ var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
2404
+
2405
+ if (didPassUnknownProp) {
2406
+ didPassUnknownProp = plugins.filter(function (plugin) {
2407
+ return plugin.name === prop;
2408
+ }).length === 0;
2409
+ }
2410
+
2411
+ warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' '));
2412
+ });
2413
+ }
2027
2414
 
2028
2415
  var innerHTML = function innerHTML() {
2029
2416
  return 'innerHTML';
@@ -2155,7 +2542,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
2155
2542
 
2156
2543
  var mountedInstances = [];
2157
2544
  function createTippy(reference, passedProps) {
2158
- var props = evaluateProps(reference, Object.assign({}, defaultProps, {}, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2545
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2159
2546
  // 🔒 Private members
2160
2547
  // ===========================================================================
2161
2548
 
@@ -2216,6 +2603,9 @@ function createTippy(reference, passedProps) {
2216
2603
  /* istanbul ignore if */
2217
2604
 
2218
2605
  if (!props.render) {
2606
+ if (process.env.NODE_ENV !== "production") {
2607
+ errorWhen(true, 'render() function has not been supplied.');
2608
+ }
2219
2609
 
2220
2610
  return instance;
2221
2611
  } // ===========================================================================
@@ -2252,10 +2642,9 @@ function createTippy(reference, passedProps) {
2252
2642
  instance.clearDelayTimeouts();
2253
2643
  }
2254
2644
  });
2255
- popper.addEventListener('mouseleave', function (event) {
2645
+ popper.addEventListener('mouseleave', function () {
2256
2646
  if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2257
2647
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2258
- debouncedOnMouseMove(event);
2259
2648
  }
2260
2649
  });
2261
2650
  return instance; // ===========================================================================
@@ -2275,7 +2664,7 @@ function createTippy(reference, passedProps) {
2275
2664
  var _instance$props$rende;
2276
2665
 
2277
2666
  // @ts-ignore
2278
- return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
2667
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2279
2668
  }
2280
2669
 
2281
2670
  function getCurrentTarget() {
@@ -2302,8 +2691,12 @@ function createTippy(reference, passedProps) {
2302
2691
  return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2303
2692
  }
2304
2693
 
2305
- function handleStyles() {
2306
- popper.style.pointerEvents = instance.props.interactive && instance.state.isVisible ? '' : 'none';
2694
+ function handleStyles(fromHide) {
2695
+ if (fromHide === void 0) {
2696
+ fromHide = false;
2697
+ }
2698
+
2699
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2307
2700
  popper.style.zIndex = "" + instance.props.zIndex;
2308
2701
  }
2309
2702
 
@@ -2314,7 +2707,7 @@ function createTippy(reference, passedProps) {
2314
2707
 
2315
2708
  pluginsHooks.forEach(function (pluginHooks) {
2316
2709
  if (pluginHooks[hook]) {
2317
- pluginHooks[hook].apply(void 0, args);
2710
+ pluginHooks[hook].apply(pluginHooks, args);
2318
2711
  }
2319
2712
  });
2320
2713
 
@@ -2380,15 +2773,18 @@ function createTippy(reference, passedProps) {
2380
2773
  if (didTouchMove || event.type === 'mousedown') {
2381
2774
  return;
2382
2775
  }
2383
- } // Clicked on interactive popper
2776
+ }
2384
2777
 
2778
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2385
2779
 
2386
- if (instance.props.interactive && popper.contains(event.target)) {
2780
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2387
2781
  return;
2388
2782
  } // Clicked on the event listeners target
2389
2783
 
2390
2784
 
2391
- if (getCurrentTarget().contains(event.target)) {
2785
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2786
+ return actualContains(el, actualTarget);
2787
+ })) {
2392
2788
  if (currentInput.isTouch) {
2393
2789
  return;
2394
2790
  }
@@ -2516,7 +2912,7 @@ function createTippy(reference, passedProps) {
2516
2912
  break;
2517
2913
 
2518
2914
  case 'focus':
2519
- on(isIE ? 'focusout' : 'blur', onBlurOrFocusOut);
2915
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2520
2916
  break;
2521
2917
 
2522
2918
  case 'focusin':
@@ -2742,7 +3138,7 @@ function createTippy(reference, passedProps) {
2742
3138
 
2743
3139
  var node = getCurrentTarget();
2744
3140
 
2745
- if (instance.props.interactive && appendTo === defaultProps.appendTo || appendTo === 'parent') {
3141
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2746
3142
  parentNode = node.parentNode;
2747
3143
  } else {
2748
3144
  parentNode = invokeWithArgsOrReturn(appendTo, [node]);
@@ -2754,7 +3150,14 @@ function createTippy(reference, passedProps) {
2754
3150
  parentNode.appendChild(popper);
2755
3151
  }
2756
3152
 
3153
+ instance.state.isMounted = true;
2757
3154
  createPopperInstance();
3155
+ /* istanbul ignore else */
3156
+
3157
+ if (process.env.NODE_ENV !== "production") {
3158
+ // Accessibility check
3159
+ warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper <div> or <span> tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' '));
3160
+ }
2758
3161
  }
2759
3162
 
2760
3163
  function getNestedPopperTree() {
@@ -2843,6 +3246,10 @@ function createTippy(reference, passedProps) {
2843
3246
  }
2844
3247
 
2845
3248
  function setProps(partialProps) {
3249
+ /* istanbul ignore else */
3250
+ if (process.env.NODE_ENV !== "production") {
3251
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
3252
+ }
2846
3253
 
2847
3254
  if (instance.state.isDestroyed) {
2848
3255
  return;
@@ -2851,7 +3258,7 @@ function createTippy(reference, passedProps) {
2851
3258
  invokeHook('onBeforeUpdate', [instance, partialProps]);
2852
3259
  removeListeners();
2853
3260
  var prevProps = instance.props;
2854
- var nextProps = evaluateProps(reference, Object.assign({}, instance.props, {}, partialProps, {
3261
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
2855
3262
  ignoreAttributes: true
2856
3263
  }));
2857
3264
  instance.props = nextProps;
@@ -2901,6 +3308,10 @@ function createTippy(reference, passedProps) {
2901
3308
  }
2902
3309
 
2903
3310
  function show() {
3311
+ /* istanbul ignore else */
3312
+ if (process.env.NODE_ENV !== "production") {
3313
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
3314
+ } // Early bail-out
2904
3315
 
2905
3316
 
2906
3317
  var isAlreadyVisible = instance.state.isVisible;
@@ -2950,6 +3361,8 @@ function createTippy(reference, passedProps) {
2950
3361
  }
2951
3362
 
2952
3363
  onFirstUpdate = function onFirstUpdate() {
3364
+ var _instance$popperInsta2;
3365
+
2953
3366
  if (!instance.state.isVisible || ignoreOnFirstUpdate) {
2954
3367
  return;
2955
3368
  }
@@ -2970,8 +3383,10 @@ function createTippy(reference, passedProps) {
2970
3383
 
2971
3384
  handleAriaContentAttribute();
2972
3385
  handleAriaExpandedAttribute();
2973
- pushIfUnique(mountedInstances, instance);
2974
- instance.state.isMounted = true;
3386
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3387
+ // popper has been positioned for the first time
3388
+
3389
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
2975
3390
  invokeHook('onMount', [instance]);
2976
3391
 
2977
3392
  if (instance.props.animation && getIsDefaultRenderFn()) {
@@ -2986,6 +3401,10 @@ function createTippy(reference, passedProps) {
2986
3401
  }
2987
3402
 
2988
3403
  function hide() {
3404
+ /* istanbul ignore else */
3405
+ if (process.env.NODE_ENV !== "production") {
3406
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
3407
+ } // Early bail-out
2989
3408
 
2990
3409
 
2991
3410
  var isAlreadyHidden = !instance.state.isVisible;
@@ -3014,7 +3433,7 @@ function createTippy(reference, passedProps) {
3014
3433
 
3015
3434
  cleanupInteractiveMouseListeners();
3016
3435
  removeDocumentPress();
3017
- handleStyles();
3436
+ handleStyles(true);
3018
3437
 
3019
3438
  if (getIsDefaultRenderFn()) {
3020
3439
  var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
@@ -3040,6 +3459,10 @@ function createTippy(reference, passedProps) {
3040
3459
  }
3041
3460
 
3042
3461
  function hideWithInteractivity(event) {
3462
+ /* istanbul ignore else */
3463
+ if (process.env.NODE_ENV !== "production") {
3464
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
3465
+ }
3043
3466
 
3044
3467
  getDocument().addEventListener('mousemove', debouncedOnMouseMove);
3045
3468
  pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
@@ -3047,6 +3470,10 @@ function createTippy(reference, passedProps) {
3047
3470
  }
3048
3471
 
3049
3472
  function unmount() {
3473
+ /* istanbul ignore else */
3474
+ if (process.env.NODE_ENV !== "production") {
3475
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
3476
+ }
3050
3477
 
3051
3478
  if (instance.state.isVisible) {
3052
3479
  instance.hide();
@@ -3076,6 +3503,10 @@ function createTippy(reference, passedProps) {
3076
3503
  }
3077
3504
 
3078
3505
  function destroy() {
3506
+ /* istanbul ignore else */
3507
+ if (process.env.NODE_ENV !== "production") {
3508
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
3509
+ }
3079
3510
 
3080
3511
  if (instance.state.isDestroyed) {
3081
3512
  return;
@@ -3096,12 +3527,25 @@ function tippy(targets, optionalProps) {
3096
3527
  }
3097
3528
 
3098
3529
  var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
3530
+ /* istanbul ignore else */
3531
+
3532
+ if (process.env.NODE_ENV !== "production") {
3533
+ validateTargets(targets);
3534
+ validateProps(optionalProps, plugins);
3535
+ }
3099
3536
 
3100
3537
  bindGlobalEventListeners();
3101
3538
  var passedProps = Object.assign({}, optionalProps, {
3102
3539
  plugins: plugins
3103
3540
  });
3104
3541
  var elements = getArrayOfElements(targets);
3542
+ /* istanbul ignore else */
3543
+
3544
+ if (process.env.NODE_ENV !== "production") {
3545
+ var isSingleContentElement = isElement$1(passedProps.content);
3546
+ var isMoreThanOneReferenceElement = elements.length > 1;
3547
+ warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' '));
3548
+ }
3105
3549
 
3106
3550
  var instances = elements.reduce(function (acc, reference) {
3107
3551
  var instance = reference && createTippy(reference, passedProps);
@@ -3119,16 +3563,63 @@ tippy.defaultProps = defaultProps;
3119
3563
  tippy.setDefaultProps = setDefaultProps;
3120
3564
  tippy.currentInput = currentInput;
3121
3565
 
3566
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3567
+ // and causing transitions to break for singletons when the console is open, but
3568
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3569
+
3570
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3571
+ effect: function effect(_ref) {
3572
+ var state = _ref.state;
3573
+ var initialStyles = {
3574
+ popper: {
3575
+ position: state.options.strategy,
3576
+ left: '0',
3577
+ top: '0',
3578
+ margin: '0'
3579
+ },
3580
+ arrow: {
3581
+ position: 'absolute'
3582
+ },
3583
+ reference: {}
3584
+ };
3585
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3586
+ state.styles = initialStyles;
3587
+
3588
+ if (state.elements.arrow) {
3589
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3590
+ } // intentionally return no cleanup function
3591
+ // return () => { ... }
3592
+
3593
+ }
3594
+ });
3595
+
3122
3596
  var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3597
+ var _optionalProps$popper;
3598
+
3123
3599
  if (optionalProps === void 0) {
3124
3600
  optionalProps = {};
3125
3601
  }
3126
3602
 
3603
+ /* istanbul ignore else */
3604
+ if (process.env.NODE_ENV !== "production") {
3605
+ errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
3606
+ }
3607
+
3127
3608
  var individualInstances = tippyInstances;
3128
3609
  var references = [];
3610
+ var triggerTargets = [];
3129
3611
  var currentTarget;
3130
3612
  var overrides = optionalProps.overrides;
3131
3613
  var interceptSetPropsCleanups = [];
3614
+ var shownOnCreate = false;
3615
+
3616
+ function setTriggerTargets() {
3617
+ triggerTargets = individualInstances.map(function (instance) {
3618
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3619
+ }).reduce(function (acc, item) {
3620
+ return acc.concat(item);
3621
+ }, []);
3622
+ }
3132
3623
 
3133
3624
  function setReferences() {
3134
3625
  references = individualInstances.map(function (instance) {
@@ -3162,42 +3653,123 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3162
3653
  instance.setProps = originalSetProps;
3163
3654
  };
3164
3655
  });
3656
+ } // have to pass singleton, as it maybe undefined on first call
3657
+
3658
+
3659
+ function prepareInstance(singleton, target) {
3660
+ var index = triggerTargets.indexOf(target); // bail-out
3661
+
3662
+ if (target === currentTarget) {
3663
+ return;
3664
+ }
3665
+
3666
+ currentTarget = target;
3667
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3668
+ acc[prop] = individualInstances[index].props[prop];
3669
+ return acc;
3670
+ }, {});
3671
+ singleton.setProps(Object.assign({}, overrideProps, {
3672
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3673
+ var _references$index;
3674
+
3675
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3676
+ }
3677
+ }));
3165
3678
  }
3166
3679
 
3167
3680
  enableInstances(false);
3168
3681
  setReferences();
3682
+ setTriggerTargets();
3169
3683
  var plugin = {
3170
3684
  fn: function fn() {
3171
3685
  return {
3172
3686
  onDestroy: function onDestroy() {
3173
3687
  enableInstances(true);
3174
3688
  },
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;
3689
+ onHidden: function onHidden() {
3690
+ currentTarget = null;
3691
+ },
3692
+ onClickOutside: function onClickOutside(instance) {
3693
+ if (instance.props.showOnCreate && !shownOnCreate) {
3694
+ shownOnCreate = true;
3695
+ currentTarget = null;
3181
3696
  }
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
- }));
3697
+ },
3698
+ onShow: function onShow(instance) {
3699
+ if (instance.props.showOnCreate && !shownOnCreate) {
3700
+ shownOnCreate = true;
3701
+ prepareInstance(instance, references[0]);
3702
+ }
3703
+ },
3704
+ onTrigger: function onTrigger(instance, event) {
3705
+ prepareInstance(instance, event.currentTarget);
3193
3706
  }
3194
3707
  };
3195
3708
  }
3196
3709
  };
3197
3710
  var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3198
3711
  plugins: [plugin].concat(optionalProps.plugins || []),
3199
- triggerTarget: references
3712
+ triggerTarget: triggerTargets,
3713
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3714
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3715
+ })
3200
3716
  }));
3717
+ var originalShow = singleton.show;
3718
+
3719
+ singleton.show = function (target) {
3720
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3721
+ // default to showing first instance
3722
+
3723
+ if (!currentTarget && target == null) {
3724
+ return prepareInstance(singleton, references[0]);
3725
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3726
+ // programmatic call with no params when already visible (do nothing again)
3727
+
3728
+
3729
+ if (currentTarget && target == null) {
3730
+ return;
3731
+ } // target is index of instance
3732
+
3733
+
3734
+ if (typeof target === 'number') {
3735
+ return references[target] && prepareInstance(singleton, references[target]);
3736
+ } // target is a child tippy instance
3737
+
3738
+
3739
+ if (individualInstances.indexOf(target) >= 0) {
3740
+ var ref = target.reference;
3741
+ return prepareInstance(singleton, ref);
3742
+ } // target is a ReferenceElement
3743
+
3744
+
3745
+ if (references.indexOf(target) >= 0) {
3746
+ return prepareInstance(singleton, target);
3747
+ }
3748
+ };
3749
+
3750
+ singleton.showNext = function () {
3751
+ var first = references[0];
3752
+
3753
+ if (!currentTarget) {
3754
+ return singleton.show(0);
3755
+ }
3756
+
3757
+ var index = references.indexOf(currentTarget);
3758
+ singleton.show(references[index + 1] || first);
3759
+ };
3760
+
3761
+ singleton.showPrevious = function () {
3762
+ var last = references[references.length - 1];
3763
+
3764
+ if (!currentTarget) {
3765
+ return singleton.show(last);
3766
+ }
3767
+
3768
+ var index = references.indexOf(currentTarget);
3769
+ var target = references[index - 1] || last;
3770
+ singleton.show(target);
3771
+ };
3772
+
3201
3773
  var originalSetProps = singleton.setProps;
3202
3774
 
3203
3775
  singleton.setProps = function (props) {
@@ -3213,9 +3785,10 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3213
3785
  individualInstances = nextInstances;
3214
3786
  enableInstances(false);
3215
3787
  setReferences();
3216
- interceptSetProps(singleton);
3788
+ setTriggerTargets();
3789
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3217
3790
  singleton.setProps({
3218
- triggerTarget: references
3791
+ triggerTarget: triggerTargets
3219
3792
  });
3220
3793
  };
3221
3794
 
@@ -3230,7 +3803,10 @@ var animateFill = {
3230
3803
  var _instance$props$rende;
3231
3804
 
3232
3805
  // @ts-ignore
3233
- if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
3806
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3807
+ if (process.env.NODE_ENV !== "production") {
3808
+ errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
3809
+ }
3234
3810
 
3235
3811
  return {};
3236
3812
  }
@@ -3352,6 +3928,7 @@ var followCursor = {
3352
3928
 
3353
3929
  if (isCursorOverReference || !instance.props.interactive) {
3354
3930
  instance.setProps({
3931
+ // @ts-ignore - unneeded DOMRect properties
3355
3932
  getReferenceClientRect: function getReferenceClientRect() {
3356
3933
  var rect = reference.getBoundingClientRect();
3357
3934
  var x = clientX;
@@ -3488,6 +4065,7 @@ var inlinePositioning = {
3488
4065
  var placement;
3489
4066
  var cursorRectIndex = -1;
3490
4067
  var isInternalUpdate = false;
4068
+ var triedPlacements = [];
3491
4069
  var modifier = {
3492
4070
  name: 'tippyInlinePositioning',
3493
4071
  enabled: true,
@@ -3496,8 +4074,14 @@ var inlinePositioning = {
3496
4074
  var state = _ref2.state;
3497
4075
 
3498
4076
  if (isEnabled()) {
3499
- if (placement !== state.placement) {
4077
+ if (triedPlacements.indexOf(state.placement) !== -1) {
4078
+ triedPlacements = [];
4079
+ }
4080
+
4081
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
4082
+ triedPlacements.push(state.placement);
3500
4083
  instance.setProps({
4084
+ // @ts-ignore - unneeded DOMRect properties
3501
4085
  getReferenceClientRect: function getReferenceClientRect() {
3502
4086
  return _getReferenceClientRect(state.placement);
3503
4087
  }
@@ -3534,10 +4118,11 @@ var inlinePositioning = {
3534
4118
  var cursorRect = rects.find(function (rect) {
3535
4119
  return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
3536
4120
  });
3537
- cursorRectIndex = rects.indexOf(cursorRect);
4121
+ var index = rects.indexOf(cursorRect);
4122
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
3538
4123
  }
3539
4124
  },
3540
- onUntrigger: function onUntrigger() {
4125
+ onHidden: function onHidden() {
3541
4126
  cursorRectIndex = -1;
3542
4127
  }
3543
4128
  };
@@ -3681,7 +4266,15 @@ tippy.setDefaultProps({
3681
4266
  },
3682
4267
  });
3683
4268
  function useTippy(el, opts = {}, settings = { mount: true }) {
4269
+ const vm = vue.getCurrentInstance();
3684
4270
  const instance = vue.ref();
4271
+ const state = vue.ref({
4272
+ isEnabled: false,
4273
+ isVisible: false,
4274
+ isDestroyed: false,
4275
+ isMounted: false,
4276
+ isShown: false,
4277
+ });
3685
4278
  let container = null;
3686
4279
  const getContainer = () => {
3687
4280
  if (container)
@@ -3695,11 +4288,18 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3695
4288
  ? content.value
3696
4289
  : content;
3697
4290
  if (vue.isVNode(unwrappedContent)) {
4291
+ if (vm) {
4292
+ unwrappedContent.appContext = vm.appContext;
4293
+ }
3698
4294
  vue.render(unwrappedContent, getContainer());
3699
4295
  newContent = () => getContainer();
3700
4296
  }
3701
4297
  else if (typeof unwrappedContent === 'object') {
3702
- vue.render(vue.h(unwrappedContent), getContainer());
4298
+ let comp = vue.h(unwrappedContent);
4299
+ if (vm) {
4300
+ comp.appContext = vm.appContext;
4301
+ }
4302
+ vue.render(comp, getContainer());
3703
4303
  newContent = () => getContainer();
3704
4304
  }
3705
4305
  else {
@@ -3710,7 +4310,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3710
4310
  const getProps = (opts) => {
3711
4311
  let options = {};
3712
4312
  if (vue.isRef(opts)) {
3713
- options = opts.value;
4313
+ options = opts.value || {};
3714
4314
  }
3715
4315
  else if (vue.isReactive(opts)) {
3716
4316
  options = { ...opts };
@@ -3718,8 +4318,51 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3718
4318
  else {
3719
4319
  options = { ...opts };
3720
4320
  }
3721
- if (options.content)
4321
+ if (options.content) {
3722
4322
  options.content = getContent(options.content);
4323
+ }
4324
+ if (options.triggerTarget) {
4325
+ options.triggerTarget = vue.isRef(options.triggerTarget)
4326
+ ? options.triggerTarget.value
4327
+ : options.triggerTarget;
4328
+ }
4329
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4330
+ options.plugins = [];
4331
+ }
4332
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4333
+ options.plugins.push({
4334
+ name: 'vueTippyReactiveState',
4335
+ fn: () => {
4336
+ return {
4337
+ onCreate() {
4338
+ state.value.isEnabled = true;
4339
+ },
4340
+ onMount() {
4341
+ state.value.isMounted = true;
4342
+ },
4343
+ onShow() {
4344
+ state.value.isMounted = true;
4345
+ state.value.isVisible = true;
4346
+ },
4347
+ onShown() {
4348
+ state.value.isShown = true;
4349
+ },
4350
+ onHide() {
4351
+ state.value.isMounted = false;
4352
+ state.value.isVisible = false;
4353
+ },
4354
+ onHidden() {
4355
+ state.value.isShown = false;
4356
+ },
4357
+ onUnmounted() {
4358
+ state.value.isMounted = false;
4359
+ },
4360
+ onDestroy() {
4361
+ state.value.isDestroyed = true;
4362
+ },
4363
+ };
4364
+ }
4365
+ });
3723
4366
  return options;
3724
4367
  };
3725
4368
  const refresh = () => {
@@ -3758,10 +4401,12 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3758
4401
  const disable = () => {
3759
4402
  var _a;
3760
4403
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4404
+ state.value.isEnabled = false;
3761
4405
  };
3762
4406
  const enable = () => {
3763
4407
  var _a;
3764
4408
  (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4409
+ state.value.isEnabled = true;
3765
4410
  };
3766
4411
  const unmount = () => {
3767
4412
  var _a;
@@ -3792,9 +4437,9 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3792
4437
  enable,
3793
4438
  unmount,
3794
4439
  mount,
4440
+ state,
3795
4441
  };
3796
4442
  if (settings.mount) {
3797
- const vm = vue.getCurrentInstance();
3798
4443
  if (vm) {
3799
4444
  if (vm.isMounted) {
3800
4445
  mount();
@@ -3819,6 +4464,46 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3819
4464
  return response;
3820
4465
  }
3821
4466
 
4467
+ function useTippyComponent(opts = {}, children) {
4468
+ const instance = vue.ref();
4469
+ return {
4470
+ instance,
4471
+ TippyComponent: vue.h(TippyComponent, {
4472
+ ...opts,
4473
+ onVnodeMounted: vnode => {
4474
+ //@ts-ignore
4475
+ instance.value = vnode.component.ctx;
4476
+ },
4477
+ }, children),
4478
+ };
4479
+ }
4480
+
4481
+ function useSingleton(instances, optionalProps) {
4482
+ const singleton = vue.ref();
4483
+ vue.onMounted(() => {
4484
+ const pendingTippyInstances = Array.isArray(instances)
4485
+ ? instances.map(i => i.value)
4486
+ : typeof instances === 'function'
4487
+ ? instances()
4488
+ : instances.value;
4489
+ const tippyInstances = pendingTippyInstances
4490
+ .map((instance) => {
4491
+ if (instance instanceof Element) {
4492
+ //@ts-ignore
4493
+ return instance._tippy;
4494
+ }
4495
+ return instance;
4496
+ })
4497
+ .filter(Boolean);
4498
+ singleton.value = createSingleton(tippyInstances, optionalProps
4499
+ ? { allowHTML: true, ...optionalProps }
4500
+ : { allowHTML: true });
4501
+ });
4502
+ return {
4503
+ singleton,
4504
+ };
4505
+ }
4506
+
3822
4507
  // const pluginProps = [
3823
4508
  // 'animateFill',
3824
4509
  // 'followCursor',
@@ -3859,50 +4544,157 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
3859
4544
  };
3860
4545
  }
3861
4546
  });
4547
+ props['to'] = {};
4548
+ props['tag'] = {
4549
+ default: 'span'
4550
+ };
4551
+ props['contentTag'] = {
4552
+ default: 'span'
4553
+ };
4554
+ props['contentClass'] = {
4555
+ default: null
4556
+ };
3862
4557
  const TippyComponent = vue.defineComponent({
3863
4558
  props,
3864
- setup(props) {
4559
+ emits: ['state'],
4560
+ setup(props, { slots, emit }) {
3865
4561
  const elem = vue.ref();
3866
- const tippy = useTippy(elem, props);
3867
- return { elem, ...tippy };
4562
+ const contentElem = vue.ref();
4563
+ const mounted = vue.ref(false);
4564
+ let options = { ...props };
4565
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4566
+ if (options.hasOwnProperty(prop)) {
4567
+ // @ts-ignore
4568
+ delete options[prop];
4569
+ }
4570
+ }
4571
+ let target = elem;
4572
+ if (props.to) {
4573
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4574
+ target = () => props.to;
4575
+ }
4576
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4577
+ target = () => document.querySelector(props.to);
4578
+ }
4579
+ }
4580
+ const tippy = useTippy(target, options);
4581
+ vue.onMounted(() => {
4582
+ mounted.value = true;
4583
+ vue.nextTick(() => {
4584
+ if (slots.content)
4585
+ tippy.setContent(() => contentElem.value);
4586
+ });
4587
+ });
4588
+ vue.watch(tippy.state, () => {
4589
+ emit('state', vue.unref(tippy.state));
4590
+ }, { immediate: true, deep: true });
4591
+ return { elem, contentElem, mounted, ...tippy };
4592
+ },
4593
+ render() {
4594
+ let slot = this.$slots.default ? this.$slots.default(this) : [];
4595
+ return vue.h(this.tag, { ref: 'elem', 'data-v-tippy': '' }, this.$slots.content ? [
4596
+ slot,
4597
+ vue.h(this.contentTag, { ref: 'contentElem', style: { display: this.mounted ? 'inherit' : 'none' }, class: this.contentClass }, this.$slots.content(this)),
4598
+ ] : slot);
4599
+ },
4600
+ });
4601
+
4602
+ const booleanProps$1 = [
4603
+ 'a11y',
4604
+ 'allowHTML',
4605
+ 'arrow',
4606
+ 'flip',
4607
+ 'flipOnUpdate',
4608
+ 'hideOnClick',
4609
+ 'ignoreAttributes',
4610
+ 'inertia',
4611
+ 'interactive',
4612
+ 'lazy',
4613
+ 'multiple',
4614
+ 'showOnInit',
4615
+ 'touch',
4616
+ 'touchHold',
4617
+ ];
4618
+ let props$1 = {};
4619
+ Object.keys(tippy.defaultProps).forEach((prop) => {
4620
+ if (booleanProps$1.includes(prop)) {
4621
+ props$1[prop] = {
4622
+ type: Boolean,
4623
+ default: function () {
4624
+ return tippy.defaultProps[prop];
4625
+ },
4626
+ };
4627
+ }
4628
+ else {
4629
+ props$1[prop] = {
4630
+ default: function () {
4631
+ return tippy.defaultProps[prop];
4632
+ },
4633
+ };
4634
+ }
4635
+ });
4636
+ const TippySingleton = vue.defineComponent({
4637
+ props: props$1,
4638
+ setup(props) {
4639
+ const instances = vue.ref([]);
4640
+ const { singleton } = useSingleton(instances, props);
4641
+ return { instances, singleton };
4642
+ },
4643
+ mounted() {
4644
+ var _a;
4645
+ const parent = this.$el.parentElement;
4646
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4647
+ this.instances = Array.from(elements)
4648
+ .map((el) => el._tippy)
4649
+ .filter(Boolean);
4650
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
3868
4651
  },
3869
4652
  render() {
3870
4653
  let slot = this.$slots.default ? this.$slots.default() : [];
3871
- return vue.h('span', { ref: 'elem' }, slot);
4654
+ return vue.h(() => slot);
3872
4655
  },
3873
4656
  });
3874
4657
 
3875
4658
  const directive = {
3876
4659
  mounted(el, binding, vnode) {
3877
- const opts = binding.value || {};
3878
- if (vnode.props && vnode.props.onShow) {
4660
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4661
+ const modifiers = Object.keys(binding.modifiers || {});
4662
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4663
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4664
+ if (placement) {
4665
+ opts.placement = opts.placement || placement;
4666
+ }
4667
+ if (withArrow) {
4668
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4669
+ }
4670
+ if (vnode.props && vnode.props.onTippyShow) {
3879
4671
  opts.onShow = function (...args) {
3880
4672
  var _a;
3881
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onShow(...args);
4673
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShow(...args);
3882
4674
  };
3883
4675
  }
3884
- if (vnode.props && vnode.props.onShown) {
4676
+ if (vnode.props && vnode.props.onTippyShown) {
3885
4677
  opts.onShown = function (...args) {
3886
4678
  var _a;
3887
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onShown(...args);
4679
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShown(...args);
3888
4680
  };
3889
4681
  }
3890
- if (vnode.props && vnode.props.onHidden) {
4682
+ if (vnode.props && vnode.props.onTippyHidden) {
3891
4683
  opts.onHidden = function (...args) {
3892
4684
  var _a;
3893
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onHidden(...args);
4685
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHidden(...args);
3894
4686
  };
3895
4687
  }
3896
- if (vnode.props && vnode.props.onHide) {
4688
+ if (vnode.props && vnode.props.onTippyHide) {
3897
4689
  opts.onHide = function (...args) {
3898
4690
  var _a;
3899
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onHide(...args);
4691
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHide(...args);
3900
4692
  };
3901
4693
  }
3902
- if (vnode.props && vnode.props.onMount) {
4694
+ if (vnode.props && vnode.props.onTippyMount) {
3903
4695
  opts.onMount = function (...args) {
3904
4696
  var _a;
3905
- return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onMount(...args);
4697
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyMount(...args);
3906
4698
  };
3907
4699
  }
3908
4700
  if (el.getAttribute('title') && !opts.content) {
@@ -3923,7 +4715,7 @@ const directive = {
3923
4715
  }
3924
4716
  },
3925
4717
  updated(el, binding) {
3926
- const opts = binding.value || {};
4718
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
3927
4719
  if (el.getAttribute('title') && !opts.content) {
3928
4720
  opts.content = el.getAttribute('title');
3929
4721
  el.removeAttribute('title');
@@ -3945,70 +4737,24 @@ const plugin = {
3945
4737
  tippy.setDefaultProps(options.defaultProps || {});
3946
4738
  app.directive(options.directive || 'tippy', directive);
3947
4739
  app.component(options.component || 'tippy', TippyComponent);
4740
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
3948
4741
  },
3949
4742
  };
3950
4743
 
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
4744
  const setDefaultProps$1 = tippy.setDefaultProps;
4004
4745
  setDefaultProps$1({
4746
+ ignoreAttributes: true,
4005
4747
  plugins: [sticky, inlinePositioning, followCursor, animateFill],
4006
4748
  });
4007
4749
 
4008
4750
  exports.Tippy = TippyComponent;
4751
+ exports.TippySingleton = TippySingleton;
4009
4752
  exports.default = plugin;
4010
4753
  exports.directive = directive;
4754
+ exports.plugin = plugin;
4755
+ exports.roundArrow = ROUND_ARROW;
4011
4756
  exports.setDefaultProps = setDefaultProps$1;
4012
4757
  exports.tippy = tippy;
4013
4758
  exports.useSingleton = useSingleton;
4014
4759
  exports.useTippy = useTippy;
4760
+ exports.useTippyComponent = useTippyComponent;