vue-tippy 6.0.0-alpha.37 → 6.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-tippy.cjs +273 -109
- package/dist/vue-tippy.d.ts +817 -0
- package/dist/vue-tippy.esm-browser.js +274 -110
- package/dist/vue-tippy.iife.js +273 -109
- package/dist/vue-tippy.iife.prod.js +2 -2
- package/dist/vue-tippy.mjs +274 -110
- package/dist/vue-tippy.prod.cjs +273 -109
- package/package.json +3 -3
package/dist/vue-tippy.mjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/*!
|
2
|
-
* vue-tippy v6.0.0-alpha.
|
2
|
+
* vue-tippy v6.0.0-alpha.40
|
3
3
|
* (c) 2021
|
4
4
|
* @license MIT
|
5
5
|
*/
|
6
|
-
import { getCurrentInstance, ref, onMounted, onUnmounted, isRef, isReactive, watch, isVNode, render as render$1, h, defineComponent } from 'vue';
|
6
|
+
import { getCurrentInstance, ref, onMounted, onUnmounted, isRef, isReactive, watch, isVNode, render as render$1, h, defineComponent, nextTick, unref } from 'vue';
|
7
7
|
|
8
8
|
var top = 'top';
|
9
9
|
var bottom = 'bottom';
|
@@ -161,17 +161,42 @@ function getBasePlacement(placement) {
|
|
161
161
|
return placement.split('-')[0];
|
162
162
|
}
|
163
163
|
|
164
|
-
|
164
|
+
var max = Math.max;
|
165
|
+
var min = Math.min;
|
166
|
+
var round = Math.round;
|
167
|
+
|
168
|
+
function getBoundingClientRect(element, includeScale) {
|
169
|
+
if (includeScale === void 0) {
|
170
|
+
includeScale = false;
|
171
|
+
}
|
172
|
+
|
165
173
|
var rect = element.getBoundingClientRect();
|
174
|
+
var scaleX = 1;
|
175
|
+
var scaleY = 1;
|
176
|
+
|
177
|
+
if (isHTMLElement(element) && includeScale) {
|
178
|
+
var offsetHeight = element.offsetHeight;
|
179
|
+
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
180
|
+
// Fallback to 1 in case both values are `0`
|
181
|
+
|
182
|
+
if (offsetWidth > 0) {
|
183
|
+
scaleX = round(rect.width) / offsetWidth || 1;
|
184
|
+
}
|
185
|
+
|
186
|
+
if (offsetHeight > 0) {
|
187
|
+
scaleY = round(rect.height) / offsetHeight || 1;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
166
191
|
return {
|
167
|
-
width: rect.width,
|
168
|
-
height: rect.height,
|
169
|
-
top: rect.top,
|
170
|
-
right: rect.right,
|
171
|
-
bottom: rect.bottom,
|
172
|
-
left: rect.left,
|
173
|
-
x: rect.left,
|
174
|
-
y: rect.top
|
192
|
+
width: rect.width / scaleX,
|
193
|
+
height: rect.height / scaleY,
|
194
|
+
top: rect.top / scaleY,
|
195
|
+
right: rect.right / scaleX,
|
196
|
+
bottom: rect.bottom / scaleY,
|
197
|
+
left: rect.left / scaleX,
|
198
|
+
x: rect.left / scaleX,
|
199
|
+
y: rect.top / scaleY
|
175
200
|
};
|
176
201
|
}
|
177
202
|
|
@@ -316,13 +341,13 @@ function getMainAxisFromPlacement(placement) {
|
|
316
341
|
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
317
342
|
}
|
318
343
|
|
319
|
-
var max = Math.max;
|
320
|
-
var min = Math.min;
|
321
|
-
var round = Math.round;
|
322
|
-
|
323
344
|
function within(min$1, value, max$1) {
|
324
345
|
return max(min$1, min(value, max$1));
|
325
346
|
}
|
347
|
+
function withinMaxClamp(min, value, max) {
|
348
|
+
var v = within(min, value, max);
|
349
|
+
return v > max ? max : v;
|
350
|
+
}
|
326
351
|
|
327
352
|
function getFreshSideObject() {
|
328
353
|
return {
|
@@ -435,6 +460,10 @@ var arrow$1 = {
|
|
435
460
|
requiresIfExists: ['preventOverflow']
|
436
461
|
};
|
437
462
|
|
463
|
+
function getVariation(placement) {
|
464
|
+
return placement.split('-')[1];
|
465
|
+
}
|
466
|
+
|
438
467
|
var unsetSides = {
|
439
468
|
top: 'auto',
|
440
469
|
right: 'auto',
|
@@ -450,8 +479,8 @@ function roundOffsetsByDPR(_ref) {
|
|
450
479
|
var win = window;
|
451
480
|
var dpr = win.devicePixelRatio || 1;
|
452
481
|
return {
|
453
|
-
x: round(
|
454
|
-
y: round(
|
482
|
+
x: round(x * dpr) / dpr || 0,
|
483
|
+
y: round(y * dpr) / dpr || 0
|
455
484
|
};
|
456
485
|
}
|
457
486
|
|
@@ -461,11 +490,13 @@ function mapToStyles(_ref2) {
|
|
461
490
|
var popper = _ref2.popper,
|
462
491
|
popperRect = _ref2.popperRect,
|
463
492
|
placement = _ref2.placement,
|
493
|
+
variation = _ref2.variation,
|
464
494
|
offsets = _ref2.offsets,
|
465
495
|
position = _ref2.position,
|
466
496
|
gpuAcceleration = _ref2.gpuAcceleration,
|
467
497
|
adaptive = _ref2.adaptive,
|
468
|
-
roundOffsets = _ref2.roundOffsets
|
498
|
+
roundOffsets = _ref2.roundOffsets,
|
499
|
+
isFixed = _ref2.isFixed;
|
469
500
|
|
470
501
|
var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
|
471
502
|
_ref3$x = _ref3.x,
|
@@ -487,7 +518,7 @@ function mapToStyles(_ref2) {
|
|
487
518
|
if (offsetParent === getWindow(popper)) {
|
488
519
|
offsetParent = getDocumentElement(popper);
|
489
520
|
|
490
|
-
if (getComputedStyle(offsetParent).position !== 'static') {
|
521
|
+
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
491
522
|
heightProp = 'scrollHeight';
|
492
523
|
widthProp = 'scrollWidth';
|
493
524
|
}
|
@@ -496,17 +527,19 @@ function mapToStyles(_ref2) {
|
|
496
527
|
|
497
528
|
offsetParent = offsetParent;
|
498
529
|
|
499
|
-
if (placement === top) {
|
500
|
-
sideY = bottom;
|
501
|
-
|
502
|
-
|
530
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
531
|
+
sideY = bottom;
|
532
|
+
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
533
|
+
offsetParent[heightProp];
|
534
|
+
y -= offsetY - popperRect.height;
|
503
535
|
y *= gpuAcceleration ? 1 : -1;
|
504
536
|
}
|
505
537
|
|
506
|
-
if (placement === left) {
|
507
|
-
sideX = right;
|
508
|
-
|
509
|
-
|
538
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
539
|
+
sideX = right;
|
540
|
+
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
541
|
+
offsetParent[widthProp];
|
542
|
+
x -= offsetX - popperRect.width;
|
510
543
|
x *= gpuAcceleration ? 1 : -1;
|
511
544
|
}
|
512
545
|
}
|
@@ -518,7 +551,7 @@ function mapToStyles(_ref2) {
|
|
518
551
|
if (gpuAcceleration) {
|
519
552
|
var _Object$assign;
|
520
553
|
|
521
|
-
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1)
|
554
|
+
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));
|
522
555
|
}
|
523
556
|
|
524
557
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
@@ -546,9 +579,11 @@ function computeStyles(_ref4) {
|
|
546
579
|
|
547
580
|
var commonStyles = {
|
548
581
|
placement: getBasePlacement(state.placement),
|
582
|
+
variation: getVariation(state.placement),
|
549
583
|
popper: state.elements.popper,
|
550
584
|
popperRect: state.rects.popper,
|
551
|
-
gpuAcceleration: gpuAcceleration
|
585
|
+
gpuAcceleration: gpuAcceleration,
|
586
|
+
isFixed: state.options.strategy === 'fixed'
|
552
587
|
};
|
553
588
|
|
554
589
|
if (state.modifiersData.popperOffsets != null) {
|
@@ -806,7 +841,7 @@ function getInnerBoundingClientRect(element) {
|
|
806
841
|
}
|
807
842
|
|
808
843
|
function getClientRectFromMixedType(element, clippingParent) {
|
809
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) :
|
844
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
810
845
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
811
846
|
// clipping (or hiding) overflowing elements with a position different from
|
812
847
|
// `initial`
|
@@ -823,7 +858,7 @@ function getClippingParents(element) {
|
|
823
858
|
|
824
859
|
|
825
860
|
return clippingParents.filter(function (clippingParent) {
|
826
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
861
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
|
827
862
|
});
|
828
863
|
} // Gets the maximum area that the element is visible in due to any number of
|
829
864
|
// clipping parents
|
@@ -848,10 +883,6 @@ function getClippingRect(element, boundary, rootBoundary) {
|
|
848
883
|
return clippingRect;
|
849
884
|
}
|
850
885
|
|
851
|
-
function getVariation(placement) {
|
852
|
-
return placement.split('-')[1];
|
853
|
-
}
|
854
|
-
|
855
886
|
function computeOffsets(_ref) {
|
856
887
|
var reference = _ref.reference,
|
857
888
|
element = _ref.element,
|
@@ -937,11 +968,10 @@ function detectOverflow(state, options) {
|
|
937
968
|
padding = _options$padding === void 0 ? 0 : _options$padding;
|
938
969
|
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
939
970
|
var altContext = elementContext === popper ? reference : popper;
|
940
|
-
var referenceElement = state.elements.reference;
|
941
971
|
var popperRect = state.rects.popper;
|
942
972
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
943
973
|
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
944
|
-
var referenceClientRect = getBoundingClientRect(
|
974
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
945
975
|
var popperOffsets = computeOffsets({
|
946
976
|
reference: referenceClientRect,
|
947
977
|
element: popperRect,
|
@@ -1328,6 +1358,14 @@ function preventOverflow(_ref) {
|
|
1328
1358
|
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
1329
1359
|
placement: state.placement
|
1330
1360
|
})) : tetherOffset;
|
1361
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
1362
|
+
mainAxis: tetherOffsetValue,
|
1363
|
+
altAxis: tetherOffsetValue
|
1364
|
+
} : Object.assign({
|
1365
|
+
mainAxis: 0,
|
1366
|
+
altAxis: 0
|
1367
|
+
}, tetherOffsetValue);
|
1368
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
1331
1369
|
var data = {
|
1332
1370
|
x: 0,
|
1333
1371
|
y: 0
|
@@ -1337,13 +1375,15 @@ function preventOverflow(_ref) {
|
|
1337
1375
|
return;
|
1338
1376
|
}
|
1339
1377
|
|
1340
|
-
if (checkMainAxis
|
1378
|
+
if (checkMainAxis) {
|
1379
|
+
var _offsetModifierState$;
|
1380
|
+
|
1341
1381
|
var mainSide = mainAxis === 'y' ? top : left;
|
1342
1382
|
var altSide = mainAxis === 'y' ? bottom : right;
|
1343
1383
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
1344
1384
|
var offset = popperOffsets[mainAxis];
|
1345
|
-
var min$1 =
|
1346
|
-
var max$1 =
|
1385
|
+
var min$1 = offset + overflow[mainSide];
|
1386
|
+
var max$1 = offset - overflow[altSide];
|
1347
1387
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
1348
1388
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
1349
1389
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
@@ -1363,36 +1403,45 @@ function preventOverflow(_ref) {
|
|
1363
1403
|
// width or height)
|
1364
1404
|
|
1365
1405
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
1366
|
-
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin -
|
1367
|
-
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax +
|
1406
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
1407
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
1368
1408
|
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
1369
1409
|
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
1370
|
-
var offsetModifierValue =
|
1371
|
-
var tetherMin =
|
1372
|
-
var tetherMax =
|
1410
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
1411
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
1412
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
1413
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
1414
|
+
popperOffsets[mainAxis] = preventedOffset;
|
1415
|
+
data[mainAxis] = preventedOffset - offset;
|
1416
|
+
}
|
1373
1417
|
|
1374
|
-
|
1375
|
-
|
1376
|
-
popperOffsets[mainAxis] = preventedOffset;
|
1377
|
-
data[mainAxis] = preventedOffset - offset;
|
1378
|
-
}
|
1418
|
+
if (checkAltAxis) {
|
1419
|
+
var _offsetModifierState$2;
|
1379
1420
|
|
1380
|
-
|
1381
|
-
var _mainSide = mainAxis === 'x' ? top : left;
|
1421
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
1382
1422
|
|
1383
|
-
|
1423
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
1384
1424
|
|
1385
|
-
|
1425
|
+
var _offset = popperOffsets[altAxis];
|
1386
1426
|
|
1387
|
-
|
1427
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
1388
1428
|
|
1389
|
-
|
1429
|
+
var _min = _offset + overflow[_mainSide];
|
1390
1430
|
|
1391
|
-
|
1431
|
+
var _max = _offset - overflow[_altSide];
|
1392
1432
|
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1433
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
1434
|
+
|
1435
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
1436
|
+
|
1437
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
1438
|
+
|
1439
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
1440
|
+
|
1441
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
1442
|
+
|
1443
|
+
popperOffsets[altAxis] = _preventedOffset;
|
1444
|
+
data[altAxis] = _preventedOffset - _offset;
|
1396
1445
|
}
|
1397
1446
|
|
1398
1447
|
state.modifiersData[name] = data;
|
@@ -1422,16 +1471,24 @@ function getNodeScroll(node) {
|
|
1422
1471
|
}
|
1423
1472
|
}
|
1424
1473
|
|
1474
|
+
function isElementScaled(element) {
|
1475
|
+
var rect = element.getBoundingClientRect();
|
1476
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
1477
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
1478
|
+
return scaleX !== 1 || scaleY !== 1;
|
1479
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
1425
1480
|
// Composite means it takes into account transforms as well as layout.
|
1426
1481
|
|
1482
|
+
|
1427
1483
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
1428
1484
|
if (isFixed === void 0) {
|
1429
1485
|
isFixed = false;
|
1430
1486
|
}
|
1431
1487
|
|
1432
|
-
var documentElement = getDocumentElement(offsetParent);
|
1433
|
-
var rect = getBoundingClientRect(elementOrVirtualElement);
|
1434
1488
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1489
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
1490
|
+
var documentElement = getDocumentElement(offsetParent);
|
1491
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
1435
1492
|
var scroll = {
|
1436
1493
|
scrollLeft: 0,
|
1437
1494
|
scrollTop: 0
|
@@ -1448,7 +1505,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
1448
1505
|
}
|
1449
1506
|
|
1450
1507
|
if (isHTMLElement(offsetParent)) {
|
1451
|
-
offsets = getBoundingClientRect(offsetParent);
|
1508
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
1452
1509
|
offsets.x += offsetParent.clientLeft;
|
1453
1510
|
offsets.y += offsetParent.clientTop;
|
1454
1511
|
} else if (documentElement) {
|
@@ -1538,7 +1595,10 @@ var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" mo
|
|
1538
1595
|
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
1539
1596
|
function validateModifiers(modifiers) {
|
1540
1597
|
modifiers.forEach(function (modifier) {
|
1541
|
-
Object.keys(modifier)
|
1598
|
+
[].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
|
1599
|
+
.filter(function (value, index, self) {
|
1600
|
+
return self.indexOf(value) === index;
|
1601
|
+
}).forEach(function (key) {
|
1542
1602
|
switch (key) {
|
1543
1603
|
case 'name':
|
1544
1604
|
if (typeof modifier.name !== 'string') {
|
@@ -1552,6 +1612,8 @@ function validateModifiers(modifiers) {
|
|
1552
1612
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
1553
1613
|
}
|
1554
1614
|
|
1615
|
+
break;
|
1616
|
+
|
1555
1617
|
case 'phase':
|
1556
1618
|
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
1557
1619
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
@@ -1567,14 +1629,14 @@ function validateModifiers(modifiers) {
|
|
1567
1629
|
break;
|
1568
1630
|
|
1569
1631
|
case 'effect':
|
1570
|
-
if (typeof modifier.effect !== 'function') {
|
1632
|
+
if (modifier.effect != null && typeof modifier.effect !== 'function') {
|
1571
1633
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
1572
1634
|
}
|
1573
1635
|
|
1574
1636
|
break;
|
1575
1637
|
|
1576
1638
|
case 'requires':
|
1577
|
-
if (!Array.isArray(modifier.requires)) {
|
1639
|
+
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
|
1578
1640
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
1579
1641
|
}
|
1580
1642
|
|
@@ -1684,7 +1746,8 @@ function popperGenerator(generatorOptions) {
|
|
1684
1746
|
var isDestroyed = false;
|
1685
1747
|
var instance = {
|
1686
1748
|
state: state,
|
1687
|
-
setOptions: function setOptions(
|
1749
|
+
setOptions: function setOptions(setOptionsAction) {
|
1750
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
1688
1751
|
cleanupModifierEffects();
|
1689
1752
|
state.options = Object.assign({}, defaultOptions, state.options, options);
|
1690
1753
|
state.scrollParents = {
|
@@ -1883,7 +1946,7 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
1883
1946
|
}); // eslint-disable-next-line import/no-unused-modules
|
1884
1947
|
|
1885
1948
|
/**!
|
1886
|
-
* tippy.js v6.3.
|
1949
|
+
* tippy.js v6.3.7
|
1887
1950
|
* (c) 2017-2021 atomiks
|
1888
1951
|
* MIT License
|
1889
1952
|
*/
|
@@ -1898,6 +1961,9 @@ var TOUCH_OPTIONS = {
|
|
1898
1961
|
passive: true,
|
1899
1962
|
capture: true
|
1900
1963
|
};
|
1964
|
+
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
1965
|
+
return document.body;
|
1966
|
+
};
|
1901
1967
|
|
1902
1968
|
function hasOwnProperty(obj, key) {
|
1903
1969
|
return {}.hasOwnProperty.call(obj, key);
|
@@ -2023,7 +2089,7 @@ function getOwnerDocument(elementOrElements) {
|
|
2023
2089
|
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
2024
2090
|
|
2025
2091
|
|
2026
|
-
return
|
2092
|
+
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
2027
2093
|
}
|
2028
2094
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
2029
2095
|
var clientX = event.clientX,
|
@@ -2059,6 +2125,26 @@ function updateTransitionEndListener(box, action, listener) {
|
|
2059
2125
|
box[method](event, listener);
|
2060
2126
|
});
|
2061
2127
|
}
|
2128
|
+
/**
|
2129
|
+
* Compared to xxx.contains, this function works for dom structures with shadow
|
2130
|
+
* dom
|
2131
|
+
*/
|
2132
|
+
|
2133
|
+
function actualContains(parent, child) {
|
2134
|
+
var target = child;
|
2135
|
+
|
2136
|
+
while (target) {
|
2137
|
+
var _target$getRootNode;
|
2138
|
+
|
2139
|
+
if (parent.contains(target)) {
|
2140
|
+
return true;
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
2144
|
+
}
|
2145
|
+
|
2146
|
+
return false;
|
2147
|
+
}
|
2062
2148
|
|
2063
2149
|
var currentInput = {
|
2064
2150
|
isTouch: false
|
@@ -2122,8 +2208,8 @@ function bindGlobalEventListeners() {
|
|
2122
2208
|
}
|
2123
2209
|
|
2124
2210
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
2125
|
-
var
|
2126
|
-
|
2211
|
+
var isIE11 = isBrowser ? // @ts-ignore
|
2212
|
+
!!window.msCrypto : false;
|
2127
2213
|
|
2128
2214
|
function createMemoryLeakWarning(method) {
|
2129
2215
|
var txt = method === 'destroy' ? 'n already-' : ' ';
|
@@ -2198,9 +2284,7 @@ var renderProps = {
|
|
2198
2284
|
zIndex: 9999
|
2199
2285
|
};
|
2200
2286
|
var defaultProps = Object.assign({
|
2201
|
-
appendTo:
|
2202
|
-
return document.body;
|
2203
|
-
},
|
2287
|
+
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
2204
2288
|
aria: {
|
2205
2289
|
content: 'auto',
|
2206
2290
|
expanded: 'auto'
|
@@ -2235,7 +2319,7 @@ var defaultProps = Object.assign({
|
|
2235
2319
|
touch: true,
|
2236
2320
|
trigger: 'mouseenter focus',
|
2237
2321
|
triggerTarget: null
|
2238
|
-
}, pluginProps,
|
2322
|
+
}, pluginProps, renderProps);
|
2239
2323
|
var defaultKeys = Object.keys(defaultProps);
|
2240
2324
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
2241
2325
|
/* istanbul ignore else */
|
@@ -2255,12 +2339,14 @@ function getExtendedPassedProps(passedProps) {
|
|
2255
2339
|
defaultValue = plugin.defaultValue;
|
2256
2340
|
|
2257
2341
|
if (name) {
|
2258
|
-
|
2342
|
+
var _name;
|
2343
|
+
|
2344
|
+
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
2259
2345
|
}
|
2260
2346
|
|
2261
2347
|
return acc;
|
2262
2348
|
}, {});
|
2263
|
-
return Object.assign({}, passedProps,
|
2349
|
+
return Object.assign({}, passedProps, pluginProps);
|
2264
2350
|
}
|
2265
2351
|
function getDataAttributeProps(reference, plugins) {
|
2266
2352
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
@@ -2291,7 +2377,7 @@ function evaluateProps(reference, props) {
|
|
2291
2377
|
var out = Object.assign({}, props, {
|
2292
2378
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
2293
2379
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
2294
|
-
out.aria = Object.assign({}, defaultProps.aria,
|
2380
|
+
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
2295
2381
|
out.aria = {
|
2296
2382
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
2297
2383
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
@@ -2452,7 +2538,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
|
|
2452
2538
|
|
2453
2539
|
var mountedInstances = [];
|
2454
2540
|
function createTippy(reference, passedProps) {
|
2455
|
-
var props = evaluateProps(reference, Object.assign({}, defaultProps,
|
2541
|
+
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
2456
2542
|
// 🔒 Private members
|
2457
2543
|
// ===========================================================================
|
2458
2544
|
|
@@ -2552,10 +2638,9 @@ function createTippy(reference, passedProps) {
|
|
2552
2638
|
instance.clearDelayTimeouts();
|
2553
2639
|
}
|
2554
2640
|
});
|
2555
|
-
popper.addEventListener('mouseleave', function (
|
2641
|
+
popper.addEventListener('mouseleave', function () {
|
2556
2642
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
2557
2643
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
2558
|
-
debouncedOnMouseMove(event);
|
2559
2644
|
}
|
2560
2645
|
});
|
2561
2646
|
return instance; // ===========================================================================
|
@@ -2575,7 +2660,7 @@ function createTippy(reference, passedProps) {
|
|
2575
2660
|
var _instance$props$rende;
|
2576
2661
|
|
2577
2662
|
// @ts-ignore
|
2578
|
-
return !!((_instance$props$rende = instance.props.render)
|
2663
|
+
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
2579
2664
|
}
|
2580
2665
|
|
2581
2666
|
function getCurrentTarget() {
|
@@ -2602,8 +2687,12 @@ function createTippy(reference, passedProps) {
|
|
2602
2687
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
2603
2688
|
}
|
2604
2689
|
|
2605
|
-
function handleStyles() {
|
2606
|
-
|
2690
|
+
function handleStyles(fromHide) {
|
2691
|
+
if (fromHide === void 0) {
|
2692
|
+
fromHide = false;
|
2693
|
+
}
|
2694
|
+
|
2695
|
+
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
2607
2696
|
popper.style.zIndex = "" + instance.props.zIndex;
|
2608
2697
|
}
|
2609
2698
|
|
@@ -2614,7 +2703,7 @@ function createTippy(reference, passedProps) {
|
|
2614
2703
|
|
2615
2704
|
pluginsHooks.forEach(function (pluginHooks) {
|
2616
2705
|
if (pluginHooks[hook]) {
|
2617
|
-
pluginHooks[hook].apply(
|
2706
|
+
pluginHooks[hook].apply(pluginHooks, args);
|
2618
2707
|
}
|
2619
2708
|
});
|
2620
2709
|
|
@@ -2680,15 +2769,18 @@ function createTippy(reference, passedProps) {
|
|
2680
2769
|
if (didTouchMove || event.type === 'mousedown') {
|
2681
2770
|
return;
|
2682
2771
|
}
|
2683
|
-
}
|
2772
|
+
}
|
2684
2773
|
|
2774
|
+
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
2685
2775
|
|
2686
|
-
if (instance.props.interactive && popper
|
2776
|
+
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
2687
2777
|
return;
|
2688
2778
|
} // Clicked on the event listeners target
|
2689
2779
|
|
2690
2780
|
|
2691
|
-
if (
|
2781
|
+
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
2782
|
+
return actualContains(el, actualTarget);
|
2783
|
+
})) {
|
2692
2784
|
if (currentInput.isTouch) {
|
2693
2785
|
return;
|
2694
2786
|
}
|
@@ -2816,7 +2908,7 @@ function createTippy(reference, passedProps) {
|
|
2816
2908
|
break;
|
2817
2909
|
|
2818
2910
|
case 'focus':
|
2819
|
-
on(
|
2911
|
+
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
2820
2912
|
break;
|
2821
2913
|
|
2822
2914
|
case 'focusin':
|
@@ -3042,7 +3134,7 @@ function createTippy(reference, passedProps) {
|
|
3042
3134
|
|
3043
3135
|
var node = getCurrentTarget();
|
3044
3136
|
|
3045
|
-
if (instance.props.interactive && appendTo ===
|
3137
|
+
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
3046
3138
|
parentNode = node.parentNode;
|
3047
3139
|
} else {
|
3048
3140
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
@@ -3054,6 +3146,7 @@ function createTippy(reference, passedProps) {
|
|
3054
3146
|
parentNode.appendChild(popper);
|
3055
3147
|
}
|
3056
3148
|
|
3149
|
+
instance.state.isMounted = true;
|
3057
3150
|
createPopperInstance();
|
3058
3151
|
/* istanbul ignore else */
|
3059
3152
|
|
@@ -3161,7 +3254,7 @@ function createTippy(reference, passedProps) {
|
|
3161
3254
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
3162
3255
|
removeListeners();
|
3163
3256
|
var prevProps = instance.props;
|
3164
|
-
var nextProps = evaluateProps(reference, Object.assign({},
|
3257
|
+
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
3165
3258
|
ignoreAttributes: true
|
3166
3259
|
}));
|
3167
3260
|
instance.props = nextProps;
|
@@ -3290,7 +3383,6 @@ function createTippy(reference, passedProps) {
|
|
3290
3383
|
// popper has been positioned for the first time
|
3291
3384
|
|
3292
3385
|
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
3293
|
-
instance.state.isMounted = true;
|
3294
3386
|
invokeHook('onMount', [instance]);
|
3295
3387
|
|
3296
3388
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
@@ -3337,7 +3429,7 @@ function createTippy(reference, passedProps) {
|
|
3337
3429
|
|
3338
3430
|
cleanupInteractiveMouseListeners();
|
3339
3431
|
removeDocumentPress();
|
3340
|
-
handleStyles();
|
3432
|
+
handleStyles(true);
|
3341
3433
|
|
3342
3434
|
if (getIsDefaultRenderFn()) {
|
3343
3435
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
@@ -3511,11 +3603,20 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3511
3603
|
|
3512
3604
|
var individualInstances = tippyInstances;
|
3513
3605
|
var references = [];
|
3606
|
+
var triggerTargets = [];
|
3514
3607
|
var currentTarget;
|
3515
3608
|
var overrides = optionalProps.overrides;
|
3516
3609
|
var interceptSetPropsCleanups = [];
|
3517
3610
|
var shownOnCreate = false;
|
3518
3611
|
|
3612
|
+
function setTriggerTargets() {
|
3613
|
+
triggerTargets = individualInstances.map(function (instance) {
|
3614
|
+
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
3615
|
+
}).reduce(function (acc, item) {
|
3616
|
+
return acc.concat(item);
|
3617
|
+
}, []);
|
3618
|
+
}
|
3619
|
+
|
3519
3620
|
function setReferences() {
|
3520
3621
|
references = individualInstances.map(function (instance) {
|
3521
3622
|
return instance.reference;
|
@@ -3552,7 +3653,7 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3552
3653
|
|
3553
3654
|
|
3554
3655
|
function prepareInstance(singleton, target) {
|
3555
|
-
var index =
|
3656
|
+
var index = triggerTargets.indexOf(target); // bail-out
|
3556
3657
|
|
3557
3658
|
if (target === currentTarget) {
|
3558
3659
|
return;
|
@@ -3565,13 +3666,16 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3565
3666
|
}, {});
|
3566
3667
|
singleton.setProps(Object.assign({}, overrideProps, {
|
3567
3668
|
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
3568
|
-
|
3669
|
+
var _references$index;
|
3670
|
+
|
3671
|
+
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
3569
3672
|
}
|
3570
3673
|
}));
|
3571
3674
|
}
|
3572
3675
|
|
3573
3676
|
enableInstances(false);
|
3574
3677
|
setReferences();
|
3678
|
+
setTriggerTargets();
|
3575
3679
|
var plugin = {
|
3576
3680
|
fn: function fn() {
|
3577
3681
|
return {
|
@@ -3601,7 +3705,7 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3601
3705
|
};
|
3602
3706
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
3603
3707
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
3604
|
-
triggerTarget:
|
3708
|
+
triggerTarget: triggerTargets,
|
3605
3709
|
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
3606
3710
|
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
3607
3711
|
})
|
@@ -3628,13 +3732,13 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3628
3732
|
} // target is a child tippy instance
|
3629
3733
|
|
3630
3734
|
|
3631
|
-
if (individualInstances.
|
3735
|
+
if (individualInstances.indexOf(target) >= 0) {
|
3632
3736
|
var ref = target.reference;
|
3633
3737
|
return prepareInstance(singleton, ref);
|
3634
3738
|
} // target is a ReferenceElement
|
3635
3739
|
|
3636
3740
|
|
3637
|
-
if (references.
|
3741
|
+
if (references.indexOf(target) >= 0) {
|
3638
3742
|
return prepareInstance(singleton, target);
|
3639
3743
|
}
|
3640
3744
|
};
|
@@ -3677,9 +3781,10 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3677
3781
|
individualInstances = nextInstances;
|
3678
3782
|
enableInstances(false);
|
3679
3783
|
setReferences();
|
3680
|
-
|
3784
|
+
setTriggerTargets();
|
3785
|
+
interceptSetPropsCleanups = interceptSetProps(singleton);
|
3681
3786
|
singleton.setProps({
|
3682
|
-
triggerTarget:
|
3787
|
+
triggerTarget: triggerTargets
|
3683
3788
|
});
|
3684
3789
|
};
|
3685
3790
|
|
@@ -3694,7 +3799,7 @@ var animateFill = {
|
|
3694
3799
|
var _instance$props$rende;
|
3695
3800
|
|
3696
3801
|
// @ts-ignore
|
3697
|
-
if (!((_instance$props$rende = instance.props.render)
|
3802
|
+
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
3698
3803
|
if (process.env.NODE_ENV !== "production") {
|
3699
3804
|
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
3700
3805
|
}
|
@@ -3819,6 +3924,7 @@ var followCursor = {
|
|
3819
3924
|
|
3820
3925
|
if (isCursorOverReference || !instance.props.interactive) {
|
3821
3926
|
instance.setProps({
|
3927
|
+
// @ts-ignore - unneeded DOMRect properties
|
3822
3928
|
getReferenceClientRect: function getReferenceClientRect() {
|
3823
3929
|
var rect = reference.getBoundingClientRect();
|
3824
3930
|
var x = clientX;
|
@@ -3955,6 +4061,7 @@ var inlinePositioning = {
|
|
3955
4061
|
var placement;
|
3956
4062
|
var cursorRectIndex = -1;
|
3957
4063
|
var isInternalUpdate = false;
|
4064
|
+
var triedPlacements = [];
|
3958
4065
|
var modifier = {
|
3959
4066
|
name: 'tippyInlinePositioning',
|
3960
4067
|
enabled: true,
|
@@ -3963,8 +4070,14 @@ var inlinePositioning = {
|
|
3963
4070
|
var state = _ref2.state;
|
3964
4071
|
|
3965
4072
|
if (isEnabled()) {
|
3966
|
-
if (placement !==
|
4073
|
+
if (triedPlacements.indexOf(state.placement) !== -1) {
|
4074
|
+
triedPlacements = [];
|
4075
|
+
}
|
4076
|
+
|
4077
|
+
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
4078
|
+
triedPlacements.push(state.placement);
|
3967
4079
|
instance.setProps({
|
4080
|
+
// @ts-ignore - unneeded DOMRect properties
|
3968
4081
|
getReferenceClientRect: function getReferenceClientRect() {
|
3969
4082
|
return _getReferenceClientRect(state.placement);
|
3970
4083
|
}
|
@@ -4001,10 +4114,11 @@ var inlinePositioning = {
|
|
4001
4114
|
var cursorRect = rects.find(function (rect) {
|
4002
4115
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
4003
4116
|
});
|
4004
|
-
|
4117
|
+
var index = rects.indexOf(cursorRect);
|
4118
|
+
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
4005
4119
|
}
|
4006
4120
|
},
|
4007
|
-
|
4121
|
+
onHidden: function onHidden() {
|
4008
4122
|
cursorRectIndex = -1;
|
4009
4123
|
}
|
4010
4124
|
};
|
@@ -4150,6 +4264,13 @@ tippy.setDefaultProps({
|
|
4150
4264
|
function useTippy(el, opts = {}, settings = { mount: true }) {
|
4151
4265
|
const vm = getCurrentInstance();
|
4152
4266
|
const instance = ref();
|
4267
|
+
const state = ref({
|
4268
|
+
isEnabled: false,
|
4269
|
+
isVisible: false,
|
4270
|
+
isDestroyed: false,
|
4271
|
+
isMounted: false,
|
4272
|
+
isShown: false,
|
4273
|
+
});
|
4153
4274
|
let container = null;
|
4154
4275
|
const getContainer = () => {
|
4155
4276
|
if (container)
|
@@ -4201,6 +4322,38 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
4201
4322
|
? options.triggerTarget.value
|
4202
4323
|
: options.triggerTarget;
|
4203
4324
|
}
|
4325
|
+
options.plugins.push({
|
4326
|
+
fn() {
|
4327
|
+
return {
|
4328
|
+
onCreate() {
|
4329
|
+
state.value.isEnabled = true;
|
4330
|
+
},
|
4331
|
+
onMount() {
|
4332
|
+
state.value.isMounted = true;
|
4333
|
+
},
|
4334
|
+
onShow() {
|
4335
|
+
state.value.isMounted = true;
|
4336
|
+
state.value.isVisible = true;
|
4337
|
+
},
|
4338
|
+
onShown() {
|
4339
|
+
state.value.isShown = true;
|
4340
|
+
},
|
4341
|
+
onHide() {
|
4342
|
+
state.value.isMounted = false;
|
4343
|
+
state.value.isVisible = false;
|
4344
|
+
},
|
4345
|
+
onHidden() {
|
4346
|
+
state.value.isShown = false;
|
4347
|
+
},
|
4348
|
+
onUnmounted() {
|
4349
|
+
state.value.isMounted = false;
|
4350
|
+
},
|
4351
|
+
onDestroy() {
|
4352
|
+
state.value.isDestroyed = true;
|
4353
|
+
},
|
4354
|
+
};
|
4355
|
+
}
|
4356
|
+
});
|
4204
4357
|
return options;
|
4205
4358
|
};
|
4206
4359
|
const refresh = () => {
|
@@ -4239,10 +4392,12 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
4239
4392
|
const disable = () => {
|
4240
4393
|
var _a;
|
4241
4394
|
(_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
|
4395
|
+
state.value.isEnabled = false;
|
4242
4396
|
};
|
4243
4397
|
const enable = () => {
|
4244
4398
|
var _a;
|
4245
4399
|
(_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
|
4400
|
+
state.value.isEnabled = true;
|
4246
4401
|
};
|
4247
4402
|
const unmount = () => {
|
4248
4403
|
var _a;
|
@@ -4273,6 +4428,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
4273
4428
|
enable,
|
4274
4429
|
unmount,
|
4275
4430
|
mount,
|
4431
|
+
state,
|
4276
4432
|
};
|
4277
4433
|
if (settings.mount) {
|
4278
4434
|
if (vm) {
|
@@ -4391,9 +4547,11 @@ props['contentClass'] = {
|
|
4391
4547
|
};
|
4392
4548
|
const TippyComponent = defineComponent({
|
4393
4549
|
props,
|
4394
|
-
|
4550
|
+
emits: ['state'],
|
4551
|
+
setup(props, { slots, emit }) {
|
4395
4552
|
const elem = ref();
|
4396
4553
|
const contentElem = ref();
|
4554
|
+
const mounted = ref(false);
|
4397
4555
|
let options = { ...props };
|
4398
4556
|
for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
|
4399
4557
|
if (options.hasOwnProperty(prop)) {
|
@@ -4403,7 +4561,7 @@ const TippyComponent = defineComponent({
|
|
4403
4561
|
}
|
4404
4562
|
let target = elem;
|
4405
4563
|
if (props.to) {
|
4406
|
-
if (props.to instanceof Element) {
|
4564
|
+
if (typeof Element !== 'undefined' && props.to instanceof Element) {
|
4407
4565
|
target = () => props.to;
|
4408
4566
|
}
|
4409
4567
|
else if (typeof props.to === 'string' || props.to instanceof String) {
|
@@ -4412,16 +4570,22 @@ const TippyComponent = defineComponent({
|
|
4412
4570
|
}
|
4413
4571
|
const tippy = useTippy(target, options);
|
4414
4572
|
onMounted(() => {
|
4415
|
-
|
4416
|
-
|
4573
|
+
mounted.value = true;
|
4574
|
+
nextTick(() => {
|
4575
|
+
if (slots.content)
|
4576
|
+
tippy.setContent(() => contentElem.value);
|
4577
|
+
});
|
4417
4578
|
});
|
4418
|
-
|
4579
|
+
watch(tippy.state, () => {
|
4580
|
+
emit('state', unref(tippy.state));
|
4581
|
+
}, { immediate: true, deep: true });
|
4582
|
+
return { elem, contentElem, mounted, ...tippy };
|
4419
4583
|
},
|
4420
4584
|
render() {
|
4421
4585
|
let slot = this.$slots.default ? this.$slots.default(this) : [];
|
4422
4586
|
return h(this.tag, { ref: 'elem', 'data-v-tippy': '' }, this.$slots.content ? [
|
4423
4587
|
slot,
|
4424
|
-
h(this.contentTag, { ref: 'contentElem', class: this.contentClass }, this.$slots.content(this))
|
4588
|
+
h(this.contentTag, { ref: 'contentElem', style: { display: this.mounted ? 'inherit' : 'none' }, class: this.contentClass }, this.$slots.content(this)),
|
4425
4589
|
] : slot);
|
4426
4590
|
},
|
4427
4591
|
});
|