vue-tippy 6.0.0-alpha.35 → 6.0.0-alpha.39
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{vue-tippy.cjs.js → vue-tippy.cjs} +328 -10
- package/dist/vue-tippy.d.ts +1 -0
- package/dist/{vue-tippy.esm-bundler.js → vue-tippy.esm-browser.js} +329 -11
- package/dist/vue-tippy.iife.js +328 -10
- package/dist/vue-tippy.iife.prod.js +6 -0
- package/dist/vue-tippy.mjs +4582 -0
- package/dist/{vue-tippy.cjs.prod.js → vue-tippy.prod.cjs} +328 -10
- package/index.cjs +7 -0
- package/index.js +2 -2
- package/package.json +18 -9
- package/dist/vue-tippy.global.prod.js +0 -6
- package/index.mjs +0 -1
@@ -1,9 +1,9 @@
|
|
1
1
|
/*!
|
2
|
-
* vue-tippy v6.0.0-alpha.
|
3
|
-
* (c) 2021
|
2
|
+
* vue-tippy v6.0.0-alpha.39
|
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 } from 'vue';
|
7
7
|
|
8
8
|
var top = 'top';
|
9
9
|
var bottom = 'bottom';
|
@@ -407,7 +407,16 @@ function effect$1(_ref2) {
|
|
407
407
|
}
|
408
408
|
}
|
409
409
|
|
410
|
+
if (process.env.NODE_ENV !== "production") {
|
411
|
+
if (!isHTMLElement(arrowElement)) {
|
412
|
+
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(' '));
|
413
|
+
}
|
414
|
+
}
|
415
|
+
|
410
416
|
if (!contains(state.elements.popper, arrowElement)) {
|
417
|
+
if (process.env.NODE_ENV !== "production") {
|
418
|
+
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
|
419
|
+
}
|
411
420
|
|
412
421
|
return;
|
413
422
|
}
|
@@ -525,6 +534,16 @@ function computeStyles(_ref4) {
|
|
525
534
|
_options$roundOffsets = options.roundOffsets,
|
526
535
|
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
527
536
|
|
537
|
+
if (process.env.NODE_ENV !== "production") {
|
538
|
+
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
|
539
|
+
|
540
|
+
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
|
541
|
+
return transitionProperty.indexOf(property) >= 0;
|
542
|
+
})) {
|
543
|
+
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(' '));
|
544
|
+
}
|
545
|
+
}
|
546
|
+
|
528
547
|
var commonStyles = {
|
529
548
|
placement: getBasePlacement(state.placement),
|
530
549
|
popper: state.elements.popper,
|
@@ -976,6 +995,10 @@ function computeAutoPlacement(state, options) {
|
|
976
995
|
|
977
996
|
if (allowedPlacements.length === 0) {
|
978
997
|
allowedPlacements = placements$1;
|
998
|
+
|
999
|
+
if (process.env.NODE_ENV !== "production") {
|
1000
|
+
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(' '));
|
1001
|
+
}
|
979
1002
|
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
980
1003
|
|
981
1004
|
|
@@ -1500,6 +1523,103 @@ function debounce(fn) {
|
|
1500
1523
|
};
|
1501
1524
|
}
|
1502
1525
|
|
1526
|
+
function format(str) {
|
1527
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1528
|
+
args[_key - 1] = arguments[_key];
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
return [].concat(args).reduce(function (p, c) {
|
1532
|
+
return p.replace(/%s/, c);
|
1533
|
+
}, str);
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
1537
|
+
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
1538
|
+
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
1539
|
+
function validateModifiers(modifiers) {
|
1540
|
+
modifiers.forEach(function (modifier) {
|
1541
|
+
Object.keys(modifier).forEach(function (key) {
|
1542
|
+
switch (key) {
|
1543
|
+
case 'name':
|
1544
|
+
if (typeof modifier.name !== 'string') {
|
1545
|
+
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
break;
|
1549
|
+
|
1550
|
+
case 'enabled':
|
1551
|
+
if (typeof modifier.enabled !== 'boolean') {
|
1552
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
case 'phase':
|
1556
|
+
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
1557
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
1558
|
+
}
|
1559
|
+
|
1560
|
+
break;
|
1561
|
+
|
1562
|
+
case 'fn':
|
1563
|
+
if (typeof modifier.fn !== 'function') {
|
1564
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
break;
|
1568
|
+
|
1569
|
+
case 'effect':
|
1570
|
+
if (typeof modifier.effect !== 'function') {
|
1571
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
1572
|
+
}
|
1573
|
+
|
1574
|
+
break;
|
1575
|
+
|
1576
|
+
case 'requires':
|
1577
|
+
if (!Array.isArray(modifier.requires)) {
|
1578
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
break;
|
1582
|
+
|
1583
|
+
case 'requiresIfExists':
|
1584
|
+
if (!Array.isArray(modifier.requiresIfExists)) {
|
1585
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
break;
|
1589
|
+
|
1590
|
+
case 'options':
|
1591
|
+
case 'data':
|
1592
|
+
break;
|
1593
|
+
|
1594
|
+
default:
|
1595
|
+
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
1596
|
+
return "\"" + s + "\"";
|
1597
|
+
}).join(', ') + "; but \"" + key + "\" was provided.");
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
modifier.requires && modifier.requires.forEach(function (requirement) {
|
1601
|
+
if (modifiers.find(function (mod) {
|
1602
|
+
return mod.name === requirement;
|
1603
|
+
}) == null) {
|
1604
|
+
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
1605
|
+
}
|
1606
|
+
});
|
1607
|
+
});
|
1608
|
+
});
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
function uniqueBy(arr, fn) {
|
1612
|
+
var identifiers = new Set();
|
1613
|
+
return arr.filter(function (item) {
|
1614
|
+
var identifier = fn(item);
|
1615
|
+
|
1616
|
+
if (!identifiers.has(identifier)) {
|
1617
|
+
identifiers.add(identifier);
|
1618
|
+
return true;
|
1619
|
+
}
|
1620
|
+
});
|
1621
|
+
}
|
1622
|
+
|
1503
1623
|
function mergeByName(modifiers) {
|
1504
1624
|
var merged = modifiers.reduce(function (merged, current) {
|
1505
1625
|
var existing = merged[current.name];
|
@@ -1515,6 +1635,8 @@ function mergeByName(modifiers) {
|
|
1515
1635
|
});
|
1516
1636
|
}
|
1517
1637
|
|
1638
|
+
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
1639
|
+
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.';
|
1518
1640
|
var DEFAULT_OPTIONS = {
|
1519
1641
|
placement: 'bottom',
|
1520
1642
|
modifiers: [],
|
@@ -1576,6 +1698,40 @@ function popperGenerator(generatorOptions) {
|
|
1576
1698
|
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
1577
1699
|
return m.enabled;
|
1578
1700
|
}); // Validate the provided modifiers so that the consumer will get warned
|
1701
|
+
// if one of the modifiers is invalid for any reason
|
1702
|
+
|
1703
|
+
if (process.env.NODE_ENV !== "production") {
|
1704
|
+
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
1705
|
+
var name = _ref.name;
|
1706
|
+
return name;
|
1707
|
+
});
|
1708
|
+
validateModifiers(modifiers);
|
1709
|
+
|
1710
|
+
if (getBasePlacement(state.options.placement) === auto) {
|
1711
|
+
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
1712
|
+
var name = _ref2.name;
|
1713
|
+
return name === 'flip';
|
1714
|
+
});
|
1715
|
+
|
1716
|
+
if (!flipModifier) {
|
1717
|
+
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
1718
|
+
}
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
var _getComputedStyle = getComputedStyle(popper),
|
1722
|
+
marginTop = _getComputedStyle.marginTop,
|
1723
|
+
marginRight = _getComputedStyle.marginRight,
|
1724
|
+
marginBottom = _getComputedStyle.marginBottom,
|
1725
|
+
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
1726
|
+
// cause bugs with positioning, so we'll warn the consumer
|
1727
|
+
|
1728
|
+
|
1729
|
+
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
1730
|
+
return parseFloat(margin);
|
1731
|
+
})) {
|
1732
|
+
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(' '));
|
1733
|
+
}
|
1734
|
+
}
|
1579
1735
|
|
1580
1736
|
runModifierEffects();
|
1581
1737
|
return instance.update();
|
@@ -1596,6 +1752,9 @@ function popperGenerator(generatorOptions) {
|
|
1596
1752
|
// anymore
|
1597
1753
|
|
1598
1754
|
if (!areValidElements(reference, popper)) {
|
1755
|
+
if (process.env.NODE_ENV !== "production") {
|
1756
|
+
console.error(INVALID_ELEMENT_ERROR);
|
1757
|
+
}
|
1599
1758
|
|
1600
1759
|
return;
|
1601
1760
|
} // Store the reference and popper rects to be read by modifiers
|
@@ -1619,8 +1778,17 @@ function popperGenerator(generatorOptions) {
|
|
1619
1778
|
state.orderedModifiers.forEach(function (modifier) {
|
1620
1779
|
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
1621
1780
|
});
|
1781
|
+
var __debug_loops__ = 0;
|
1622
1782
|
|
1623
1783
|
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
1784
|
+
if (process.env.NODE_ENV !== "production") {
|
1785
|
+
__debug_loops__ += 1;
|
1786
|
+
|
1787
|
+
if (__debug_loops__ > 100) {
|
1788
|
+
console.error(INFINITE_LOOP_ERROR);
|
1789
|
+
break;
|
1790
|
+
}
|
1791
|
+
}
|
1624
1792
|
|
1625
1793
|
if (state.reset === true) {
|
1626
1794
|
state.reset = false;
|
@@ -1659,6 +1827,9 @@ function popperGenerator(generatorOptions) {
|
|
1659
1827
|
};
|
1660
1828
|
|
1661
1829
|
if (!areValidElements(reference, popper)) {
|
1830
|
+
if (process.env.NODE_ENV !== "production") {
|
1831
|
+
console.error(INVALID_ELEMENT_ERROR);
|
1832
|
+
}
|
1662
1833
|
|
1663
1834
|
return instance;
|
1664
1835
|
}
|
@@ -1727,6 +1898,10 @@ var TOUCH_OPTIONS = {
|
|
1727
1898
|
passive: true,
|
1728
1899
|
capture: true
|
1729
1900
|
};
|
1901
|
+
|
1902
|
+
function hasOwnProperty(obj, key) {
|
1903
|
+
return {}.hasOwnProperty.call(obj, key);
|
1904
|
+
}
|
1730
1905
|
function getValueAtIndexOrReturn(value, index, defaultValue) {
|
1731
1906
|
if (Array.isArray(value)) {
|
1732
1907
|
var v = value[index];
|
@@ -1950,6 +2125,61 @@ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'
|
|
1950
2125
|
var ua = isBrowser ? navigator.userAgent : '';
|
1951
2126
|
var isIE = /MSIE |Trident\//.test(ua);
|
1952
2127
|
|
2128
|
+
function createMemoryLeakWarning(method) {
|
2129
|
+
var txt = method === 'destroy' ? 'n already-' : ' ';
|
2130
|
+
return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
|
2131
|
+
}
|
2132
|
+
function clean(value) {
|
2133
|
+
var spacesAndTabs = /[ \t]{2,}/g;
|
2134
|
+
var lineStartWithSpaces = /^[ \t]*/gm;
|
2135
|
+
return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
|
2136
|
+
}
|
2137
|
+
|
2138
|
+
function getDevMessage(message) {
|
2139
|
+
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 ");
|
2140
|
+
}
|
2141
|
+
|
2142
|
+
function getFormattedMessage(message) {
|
2143
|
+
return [getDevMessage(message), // title
|
2144
|
+
'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
|
2145
|
+
'line-height: 1.5', // footer
|
2146
|
+
'color: #a6a095;'];
|
2147
|
+
} // Assume warnings and errors never have the same message
|
2148
|
+
|
2149
|
+
var visitedMessages;
|
2150
|
+
|
2151
|
+
if (process.env.NODE_ENV !== "production") {
|
2152
|
+
resetVisitedMessages();
|
2153
|
+
}
|
2154
|
+
|
2155
|
+
function resetVisitedMessages() {
|
2156
|
+
visitedMessages = new Set();
|
2157
|
+
}
|
2158
|
+
function warnWhen(condition, message) {
|
2159
|
+
if (condition && !visitedMessages.has(message)) {
|
2160
|
+
var _console;
|
2161
|
+
|
2162
|
+
visitedMessages.add(message);
|
2163
|
+
|
2164
|
+
(_console = console).warn.apply(_console, getFormattedMessage(message));
|
2165
|
+
}
|
2166
|
+
}
|
2167
|
+
function errorWhen(condition, message) {
|
2168
|
+
if (condition && !visitedMessages.has(message)) {
|
2169
|
+
var _console2;
|
2170
|
+
|
2171
|
+
visitedMessages.add(message);
|
2172
|
+
|
2173
|
+
(_console2 = console).error.apply(_console2, getFormattedMessage(message));
|
2174
|
+
}
|
2175
|
+
}
|
2176
|
+
function validateTargets(targets) {
|
2177
|
+
var didPassFalsyValue = !targets;
|
2178
|
+
var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
|
2179
|
+
errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
|
2180
|
+
errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
|
2181
|
+
}
|
2182
|
+
|
1953
2183
|
var pluginProps = {
|
1954
2184
|
animateFill: false,
|
1955
2185
|
followCursor: false,
|
@@ -2008,6 +2238,10 @@ var defaultProps = Object.assign({
|
|
2008
2238
|
}, pluginProps, {}, renderProps);
|
2009
2239
|
var defaultKeys = Object.keys(defaultProps);
|
2010
2240
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
2241
|
+
/* istanbul ignore else */
|
2242
|
+
if (process.env.NODE_ENV !== "production") {
|
2243
|
+
validateProps(partialProps, []);
|
2244
|
+
}
|
2011
2245
|
|
2012
2246
|
var keys = Object.keys(partialProps);
|
2013
2247
|
keys.forEach(function (key) {
|
@@ -2064,6 +2298,29 @@ function evaluateProps(reference, props) {
|
|
2064
2298
|
};
|
2065
2299
|
return out;
|
2066
2300
|
}
|
2301
|
+
function validateProps(partialProps, plugins) {
|
2302
|
+
if (partialProps === void 0) {
|
2303
|
+
partialProps = {};
|
2304
|
+
}
|
2305
|
+
|
2306
|
+
if (plugins === void 0) {
|
2307
|
+
plugins = [];
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
var keys = Object.keys(partialProps);
|
2311
|
+
keys.forEach(function (prop) {
|
2312
|
+
var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
|
2313
|
+
var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
|
2314
|
+
|
2315
|
+
if (didPassUnknownProp) {
|
2316
|
+
didPassUnknownProp = plugins.filter(function (plugin) {
|
2317
|
+
return plugin.name === prop;
|
2318
|
+
}).length === 0;
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
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(' '));
|
2322
|
+
});
|
2323
|
+
}
|
2067
2324
|
|
2068
2325
|
var innerHTML = function innerHTML() {
|
2069
2326
|
return 'innerHTML';
|
@@ -2256,6 +2513,9 @@ function createTippy(reference, passedProps) {
|
|
2256
2513
|
/* istanbul ignore if */
|
2257
2514
|
|
2258
2515
|
if (!props.render) {
|
2516
|
+
if (process.env.NODE_ENV !== "production") {
|
2517
|
+
errorWhen(true, 'render() function has not been supplied.');
|
2518
|
+
}
|
2259
2519
|
|
2260
2520
|
return instance;
|
2261
2521
|
} // ===========================================================================
|
@@ -2795,6 +3055,12 @@ function createTippy(reference, passedProps) {
|
|
2795
3055
|
}
|
2796
3056
|
|
2797
3057
|
createPopperInstance();
|
3058
|
+
/* istanbul ignore else */
|
3059
|
+
|
3060
|
+
if (process.env.NODE_ENV !== "production") {
|
3061
|
+
// Accessibility check
|
3062
|
+
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(' '));
|
3063
|
+
}
|
2798
3064
|
}
|
2799
3065
|
|
2800
3066
|
function getNestedPopperTree() {
|
@@ -2883,6 +3149,10 @@ function createTippy(reference, passedProps) {
|
|
2883
3149
|
}
|
2884
3150
|
|
2885
3151
|
function setProps(partialProps) {
|
3152
|
+
/* istanbul ignore else */
|
3153
|
+
if (process.env.NODE_ENV !== "production") {
|
3154
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
|
3155
|
+
}
|
2886
3156
|
|
2887
3157
|
if (instance.state.isDestroyed) {
|
2888
3158
|
return;
|
@@ -2941,6 +3211,10 @@ function createTippy(reference, passedProps) {
|
|
2941
3211
|
}
|
2942
3212
|
|
2943
3213
|
function show() {
|
3214
|
+
/* istanbul ignore else */
|
3215
|
+
if (process.env.NODE_ENV !== "production") {
|
3216
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
|
3217
|
+
} // Early bail-out
|
2944
3218
|
|
2945
3219
|
|
2946
3220
|
var isAlreadyVisible = instance.state.isVisible;
|
@@ -3031,6 +3305,10 @@ function createTippy(reference, passedProps) {
|
|
3031
3305
|
}
|
3032
3306
|
|
3033
3307
|
function hide() {
|
3308
|
+
/* istanbul ignore else */
|
3309
|
+
if (process.env.NODE_ENV !== "production") {
|
3310
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
|
3311
|
+
} // Early bail-out
|
3034
3312
|
|
3035
3313
|
|
3036
3314
|
var isAlreadyHidden = !instance.state.isVisible;
|
@@ -3085,6 +3363,10 @@ function createTippy(reference, passedProps) {
|
|
3085
3363
|
}
|
3086
3364
|
|
3087
3365
|
function hideWithInteractivity(event) {
|
3366
|
+
/* istanbul ignore else */
|
3367
|
+
if (process.env.NODE_ENV !== "production") {
|
3368
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
3369
|
+
}
|
3088
3370
|
|
3089
3371
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
3090
3372
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
@@ -3092,6 +3374,10 @@ function createTippy(reference, passedProps) {
|
|
3092
3374
|
}
|
3093
3375
|
|
3094
3376
|
function unmount() {
|
3377
|
+
/* istanbul ignore else */
|
3378
|
+
if (process.env.NODE_ENV !== "production") {
|
3379
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
|
3380
|
+
}
|
3095
3381
|
|
3096
3382
|
if (instance.state.isVisible) {
|
3097
3383
|
instance.hide();
|
@@ -3121,6 +3407,10 @@ function createTippy(reference, passedProps) {
|
|
3121
3407
|
}
|
3122
3408
|
|
3123
3409
|
function destroy() {
|
3410
|
+
/* istanbul ignore else */
|
3411
|
+
if (process.env.NODE_ENV !== "production") {
|
3412
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
|
3413
|
+
}
|
3124
3414
|
|
3125
3415
|
if (instance.state.isDestroyed) {
|
3126
3416
|
return;
|
@@ -3141,12 +3431,25 @@ function tippy(targets, optionalProps) {
|
|
3141
3431
|
}
|
3142
3432
|
|
3143
3433
|
var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
|
3434
|
+
/* istanbul ignore else */
|
3435
|
+
|
3436
|
+
if (process.env.NODE_ENV !== "production") {
|
3437
|
+
validateTargets(targets);
|
3438
|
+
validateProps(optionalProps, plugins);
|
3439
|
+
}
|
3144
3440
|
|
3145
3441
|
bindGlobalEventListeners();
|
3146
3442
|
var passedProps = Object.assign({}, optionalProps, {
|
3147
3443
|
plugins: plugins
|
3148
3444
|
});
|
3149
3445
|
var elements = getArrayOfElements(targets);
|
3446
|
+
/* istanbul ignore else */
|
3447
|
+
|
3448
|
+
if (process.env.NODE_ENV !== "production") {
|
3449
|
+
var isSingleContentElement = isElement$1(passedProps.content);
|
3450
|
+
var isMoreThanOneReferenceElement = elements.length > 1;
|
3451
|
+
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(' '));
|
3452
|
+
}
|
3150
3453
|
|
3151
3454
|
var instances = elements.reduce(function (acc, reference) {
|
3152
3455
|
var instance = reference && createTippy(reference, passedProps);
|
@@ -3201,6 +3504,11 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3201
3504
|
optionalProps = {};
|
3202
3505
|
}
|
3203
3506
|
|
3507
|
+
/* istanbul ignore else */
|
3508
|
+
if (process.env.NODE_ENV !== "production") {
|
3509
|
+
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
3510
|
+
}
|
3511
|
+
|
3204
3512
|
var individualInstances = tippyInstances;
|
3205
3513
|
var references = [];
|
3206
3514
|
var currentTarget;
|
@@ -3387,6 +3695,9 @@ var animateFill = {
|
|
3387
3695
|
|
3388
3696
|
// @ts-ignore
|
3389
3697
|
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
3698
|
+
if (process.env.NODE_ENV !== "production") {
|
3699
|
+
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
3700
|
+
}
|
3390
3701
|
|
3391
3702
|
return {};
|
3392
3703
|
}
|
@@ -4083,13 +4394,17 @@ const TippyComponent = defineComponent({
|
|
4083
4394
|
setup(props, { slots }) {
|
4084
4395
|
const elem = ref();
|
4085
4396
|
const contentElem = ref();
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4397
|
+
const mounted = ref(false);
|
4398
|
+
let options = { ...props };
|
4399
|
+
for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
|
4400
|
+
if (options.hasOwnProperty(prop)) {
|
4401
|
+
// @ts-ignore
|
4402
|
+
delete options[prop];
|
4403
|
+
}
|
4089
4404
|
}
|
4090
4405
|
let target = elem;
|
4091
4406
|
if (props.to) {
|
4092
|
-
if (props.to instanceof Element) {
|
4407
|
+
if (typeof Element !== 'undefined' && props.to instanceof Element) {
|
4093
4408
|
target = () => props.to;
|
4094
4409
|
}
|
4095
4410
|
else if (typeof props.to === 'string' || props.to instanceof String) {
|
@@ -4098,16 +4413,19 @@ const TippyComponent = defineComponent({
|
|
4098
4413
|
}
|
4099
4414
|
const tippy = useTippy(target, options);
|
4100
4415
|
onMounted(() => {
|
4101
|
-
|
4102
|
-
|
4416
|
+
mounted.value = true;
|
4417
|
+
nextTick(() => {
|
4418
|
+
if (slots.content)
|
4419
|
+
tippy.setContent(() => contentElem.value);
|
4420
|
+
});
|
4103
4421
|
});
|
4104
|
-
return { elem, contentElem, ...tippy };
|
4422
|
+
return { elem, contentElem, mounted, ...tippy };
|
4105
4423
|
},
|
4106
4424
|
render() {
|
4107
4425
|
let slot = this.$slots.default ? this.$slots.default(this) : [];
|
4108
4426
|
return h(this.tag, { ref: 'elem', 'data-v-tippy': '' }, this.$slots.content ? [
|
4109
4427
|
slot,
|
4110
|
-
h(this.contentTag, { ref: 'contentElem', class: this.contentClass }, this.$slots.content(this))
|
4428
|
+
h(this.contentTag, { ref: 'contentElem', style: { display: this.mounted ? 'inherit' : 'none' }, class: this.contentClass }, this.$slots.content(this)),
|
4111
4429
|
] : slot);
|
4112
4430
|
},
|
4113
4431
|
});
|