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,6 +1,6 @@
|
|
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
6
|
'use strict';
|
@@ -411,7 +411,16 @@ function effect$1(_ref2) {
|
|
411
411
|
}
|
412
412
|
}
|
413
413
|
|
414
|
+
if (process.env.NODE_ENV !== "production") {
|
415
|
+
if (!isHTMLElement(arrowElement)) {
|
416
|
+
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(' '));
|
417
|
+
}
|
418
|
+
}
|
419
|
+
|
414
420
|
if (!contains(state.elements.popper, arrowElement)) {
|
421
|
+
if (process.env.NODE_ENV !== "production") {
|
422
|
+
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
|
423
|
+
}
|
415
424
|
|
416
425
|
return;
|
417
426
|
}
|
@@ -529,6 +538,16 @@ function computeStyles(_ref4) {
|
|
529
538
|
_options$roundOffsets = options.roundOffsets,
|
530
539
|
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
531
540
|
|
541
|
+
if (process.env.NODE_ENV !== "production") {
|
542
|
+
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
|
543
|
+
|
544
|
+
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
|
545
|
+
return transitionProperty.indexOf(property) >= 0;
|
546
|
+
})) {
|
547
|
+
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(' '));
|
548
|
+
}
|
549
|
+
}
|
550
|
+
|
532
551
|
var commonStyles = {
|
533
552
|
placement: getBasePlacement(state.placement),
|
534
553
|
popper: state.elements.popper,
|
@@ -980,6 +999,10 @@ function computeAutoPlacement(state, options) {
|
|
980
999
|
|
981
1000
|
if (allowedPlacements.length === 0) {
|
982
1001
|
allowedPlacements = placements$1;
|
1002
|
+
|
1003
|
+
if (process.env.NODE_ENV !== "production") {
|
1004
|
+
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(' '));
|
1005
|
+
}
|
983
1006
|
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
984
1007
|
|
985
1008
|
|
@@ -1504,6 +1527,103 @@ function debounce(fn) {
|
|
1504
1527
|
};
|
1505
1528
|
}
|
1506
1529
|
|
1530
|
+
function format(str) {
|
1531
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1532
|
+
args[_key - 1] = arguments[_key];
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
return [].concat(args).reduce(function (p, c) {
|
1536
|
+
return p.replace(/%s/, c);
|
1537
|
+
}, str);
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
1541
|
+
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
1542
|
+
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
1543
|
+
function validateModifiers(modifiers) {
|
1544
|
+
modifiers.forEach(function (modifier) {
|
1545
|
+
Object.keys(modifier).forEach(function (key) {
|
1546
|
+
switch (key) {
|
1547
|
+
case 'name':
|
1548
|
+
if (typeof modifier.name !== 'string') {
|
1549
|
+
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
break;
|
1553
|
+
|
1554
|
+
case 'enabled':
|
1555
|
+
if (typeof modifier.enabled !== 'boolean') {
|
1556
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
case 'phase':
|
1560
|
+
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
1561
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
break;
|
1565
|
+
|
1566
|
+
case 'fn':
|
1567
|
+
if (typeof modifier.fn !== 'function') {
|
1568
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
1569
|
+
}
|
1570
|
+
|
1571
|
+
break;
|
1572
|
+
|
1573
|
+
case 'effect':
|
1574
|
+
if (typeof modifier.effect !== 'function') {
|
1575
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
break;
|
1579
|
+
|
1580
|
+
case 'requires':
|
1581
|
+
if (!Array.isArray(modifier.requires)) {
|
1582
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
break;
|
1586
|
+
|
1587
|
+
case 'requiresIfExists':
|
1588
|
+
if (!Array.isArray(modifier.requiresIfExists)) {
|
1589
|
+
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
break;
|
1593
|
+
|
1594
|
+
case 'options':
|
1595
|
+
case 'data':
|
1596
|
+
break;
|
1597
|
+
|
1598
|
+
default:
|
1599
|
+
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
1600
|
+
return "\"" + s + "\"";
|
1601
|
+
}).join(', ') + "; but \"" + key + "\" was provided.");
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
modifier.requires && modifier.requires.forEach(function (requirement) {
|
1605
|
+
if (modifiers.find(function (mod) {
|
1606
|
+
return mod.name === requirement;
|
1607
|
+
}) == null) {
|
1608
|
+
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
1609
|
+
}
|
1610
|
+
});
|
1611
|
+
});
|
1612
|
+
});
|
1613
|
+
}
|
1614
|
+
|
1615
|
+
function uniqueBy(arr, fn) {
|
1616
|
+
var identifiers = new Set();
|
1617
|
+
return arr.filter(function (item) {
|
1618
|
+
var identifier = fn(item);
|
1619
|
+
|
1620
|
+
if (!identifiers.has(identifier)) {
|
1621
|
+
identifiers.add(identifier);
|
1622
|
+
return true;
|
1623
|
+
}
|
1624
|
+
});
|
1625
|
+
}
|
1626
|
+
|
1507
1627
|
function mergeByName(modifiers) {
|
1508
1628
|
var merged = modifiers.reduce(function (merged, current) {
|
1509
1629
|
var existing = merged[current.name];
|
@@ -1519,6 +1639,8 @@ function mergeByName(modifiers) {
|
|
1519
1639
|
});
|
1520
1640
|
}
|
1521
1641
|
|
1642
|
+
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
1643
|
+
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.';
|
1522
1644
|
var DEFAULT_OPTIONS = {
|
1523
1645
|
placement: 'bottom',
|
1524
1646
|
modifiers: [],
|
@@ -1580,6 +1702,40 @@ function popperGenerator(generatorOptions) {
|
|
1580
1702
|
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
1581
1703
|
return m.enabled;
|
1582
1704
|
}); // Validate the provided modifiers so that the consumer will get warned
|
1705
|
+
// if one of the modifiers is invalid for any reason
|
1706
|
+
|
1707
|
+
if (process.env.NODE_ENV !== "production") {
|
1708
|
+
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
1709
|
+
var name = _ref.name;
|
1710
|
+
return name;
|
1711
|
+
});
|
1712
|
+
validateModifiers(modifiers);
|
1713
|
+
|
1714
|
+
if (getBasePlacement(state.options.placement) === auto) {
|
1715
|
+
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
1716
|
+
var name = _ref2.name;
|
1717
|
+
return name === 'flip';
|
1718
|
+
});
|
1719
|
+
|
1720
|
+
if (!flipModifier) {
|
1721
|
+
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
|
1725
|
+
var _getComputedStyle = getComputedStyle(popper),
|
1726
|
+
marginTop = _getComputedStyle.marginTop,
|
1727
|
+
marginRight = _getComputedStyle.marginRight,
|
1728
|
+
marginBottom = _getComputedStyle.marginBottom,
|
1729
|
+
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
1730
|
+
// cause bugs with positioning, so we'll warn the consumer
|
1731
|
+
|
1732
|
+
|
1733
|
+
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
1734
|
+
return parseFloat(margin);
|
1735
|
+
})) {
|
1736
|
+
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(' '));
|
1737
|
+
}
|
1738
|
+
}
|
1583
1739
|
|
1584
1740
|
runModifierEffects();
|
1585
1741
|
return instance.update();
|
@@ -1600,6 +1756,9 @@ function popperGenerator(generatorOptions) {
|
|
1600
1756
|
// anymore
|
1601
1757
|
|
1602
1758
|
if (!areValidElements(reference, popper)) {
|
1759
|
+
if (process.env.NODE_ENV !== "production") {
|
1760
|
+
console.error(INVALID_ELEMENT_ERROR);
|
1761
|
+
}
|
1603
1762
|
|
1604
1763
|
return;
|
1605
1764
|
} // Store the reference and popper rects to be read by modifiers
|
@@ -1623,8 +1782,17 @@ function popperGenerator(generatorOptions) {
|
|
1623
1782
|
state.orderedModifiers.forEach(function (modifier) {
|
1624
1783
|
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
1625
1784
|
});
|
1785
|
+
var __debug_loops__ = 0;
|
1626
1786
|
|
1627
1787
|
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
1788
|
+
if (process.env.NODE_ENV !== "production") {
|
1789
|
+
__debug_loops__ += 1;
|
1790
|
+
|
1791
|
+
if (__debug_loops__ > 100) {
|
1792
|
+
console.error(INFINITE_LOOP_ERROR);
|
1793
|
+
break;
|
1794
|
+
}
|
1795
|
+
}
|
1628
1796
|
|
1629
1797
|
if (state.reset === true) {
|
1630
1798
|
state.reset = false;
|
@@ -1663,6 +1831,9 @@ function popperGenerator(generatorOptions) {
|
|
1663
1831
|
};
|
1664
1832
|
|
1665
1833
|
if (!areValidElements(reference, popper)) {
|
1834
|
+
if (process.env.NODE_ENV !== "production") {
|
1835
|
+
console.error(INVALID_ELEMENT_ERROR);
|
1836
|
+
}
|
1666
1837
|
|
1667
1838
|
return instance;
|
1668
1839
|
}
|
@@ -1731,6 +1902,10 @@ var TOUCH_OPTIONS = {
|
|
1731
1902
|
passive: true,
|
1732
1903
|
capture: true
|
1733
1904
|
};
|
1905
|
+
|
1906
|
+
function hasOwnProperty(obj, key) {
|
1907
|
+
return {}.hasOwnProperty.call(obj, key);
|
1908
|
+
}
|
1734
1909
|
function getValueAtIndexOrReturn(value, index, defaultValue) {
|
1735
1910
|
if (Array.isArray(value)) {
|
1736
1911
|
var v = value[index];
|
@@ -1954,6 +2129,61 @@ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'
|
|
1954
2129
|
var ua = isBrowser ? navigator.userAgent : '';
|
1955
2130
|
var isIE = /MSIE |Trident\//.test(ua);
|
1956
2131
|
|
2132
|
+
function createMemoryLeakWarning(method) {
|
2133
|
+
var txt = method === 'destroy' ? 'n already-' : ' ';
|
2134
|
+
return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
|
2135
|
+
}
|
2136
|
+
function clean(value) {
|
2137
|
+
var spacesAndTabs = /[ \t]{2,}/g;
|
2138
|
+
var lineStartWithSpaces = /^[ \t]*/gm;
|
2139
|
+
return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
|
2140
|
+
}
|
2141
|
+
|
2142
|
+
function getDevMessage(message) {
|
2143
|
+
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 ");
|
2144
|
+
}
|
2145
|
+
|
2146
|
+
function getFormattedMessage(message) {
|
2147
|
+
return [getDevMessage(message), // title
|
2148
|
+
'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
|
2149
|
+
'line-height: 1.5', // footer
|
2150
|
+
'color: #a6a095;'];
|
2151
|
+
} // Assume warnings and errors never have the same message
|
2152
|
+
|
2153
|
+
var visitedMessages;
|
2154
|
+
|
2155
|
+
if (process.env.NODE_ENV !== "production") {
|
2156
|
+
resetVisitedMessages();
|
2157
|
+
}
|
2158
|
+
|
2159
|
+
function resetVisitedMessages() {
|
2160
|
+
visitedMessages = new Set();
|
2161
|
+
}
|
2162
|
+
function warnWhen(condition, message) {
|
2163
|
+
if (condition && !visitedMessages.has(message)) {
|
2164
|
+
var _console;
|
2165
|
+
|
2166
|
+
visitedMessages.add(message);
|
2167
|
+
|
2168
|
+
(_console = console).warn.apply(_console, getFormattedMessage(message));
|
2169
|
+
}
|
2170
|
+
}
|
2171
|
+
function errorWhen(condition, message) {
|
2172
|
+
if (condition && !visitedMessages.has(message)) {
|
2173
|
+
var _console2;
|
2174
|
+
|
2175
|
+
visitedMessages.add(message);
|
2176
|
+
|
2177
|
+
(_console2 = console).error.apply(_console2, getFormattedMessage(message));
|
2178
|
+
}
|
2179
|
+
}
|
2180
|
+
function validateTargets(targets) {
|
2181
|
+
var didPassFalsyValue = !targets;
|
2182
|
+
var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
|
2183
|
+
errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
|
2184
|
+
errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
|
2185
|
+
}
|
2186
|
+
|
1957
2187
|
var pluginProps = {
|
1958
2188
|
animateFill: false,
|
1959
2189
|
followCursor: false,
|
@@ -2012,6 +2242,10 @@ var defaultProps = Object.assign({
|
|
2012
2242
|
}, pluginProps, {}, renderProps);
|
2013
2243
|
var defaultKeys = Object.keys(defaultProps);
|
2014
2244
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
2245
|
+
/* istanbul ignore else */
|
2246
|
+
if (process.env.NODE_ENV !== "production") {
|
2247
|
+
validateProps(partialProps, []);
|
2248
|
+
}
|
2015
2249
|
|
2016
2250
|
var keys = Object.keys(partialProps);
|
2017
2251
|
keys.forEach(function (key) {
|
@@ -2068,6 +2302,29 @@ function evaluateProps(reference, props) {
|
|
2068
2302
|
};
|
2069
2303
|
return out;
|
2070
2304
|
}
|
2305
|
+
function validateProps(partialProps, plugins) {
|
2306
|
+
if (partialProps === void 0) {
|
2307
|
+
partialProps = {};
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
if (plugins === void 0) {
|
2311
|
+
plugins = [];
|
2312
|
+
}
|
2313
|
+
|
2314
|
+
var keys = Object.keys(partialProps);
|
2315
|
+
keys.forEach(function (prop) {
|
2316
|
+
var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
|
2317
|
+
var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
|
2318
|
+
|
2319
|
+
if (didPassUnknownProp) {
|
2320
|
+
didPassUnknownProp = plugins.filter(function (plugin) {
|
2321
|
+
return plugin.name === prop;
|
2322
|
+
}).length === 0;
|
2323
|
+
}
|
2324
|
+
|
2325
|
+
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(' '));
|
2326
|
+
});
|
2327
|
+
}
|
2071
2328
|
|
2072
2329
|
var innerHTML = function innerHTML() {
|
2073
2330
|
return 'innerHTML';
|
@@ -2260,6 +2517,9 @@ function createTippy(reference, passedProps) {
|
|
2260
2517
|
/* istanbul ignore if */
|
2261
2518
|
|
2262
2519
|
if (!props.render) {
|
2520
|
+
if (process.env.NODE_ENV !== "production") {
|
2521
|
+
errorWhen(true, 'render() function has not been supplied.');
|
2522
|
+
}
|
2263
2523
|
|
2264
2524
|
return instance;
|
2265
2525
|
} // ===========================================================================
|
@@ -2799,6 +3059,12 @@ function createTippy(reference, passedProps) {
|
|
2799
3059
|
}
|
2800
3060
|
|
2801
3061
|
createPopperInstance();
|
3062
|
+
/* istanbul ignore else */
|
3063
|
+
|
3064
|
+
if (process.env.NODE_ENV !== "production") {
|
3065
|
+
// Accessibility check
|
3066
|
+
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(' '));
|
3067
|
+
}
|
2802
3068
|
}
|
2803
3069
|
|
2804
3070
|
function getNestedPopperTree() {
|
@@ -2887,6 +3153,10 @@ function createTippy(reference, passedProps) {
|
|
2887
3153
|
}
|
2888
3154
|
|
2889
3155
|
function setProps(partialProps) {
|
3156
|
+
/* istanbul ignore else */
|
3157
|
+
if (process.env.NODE_ENV !== "production") {
|
3158
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
|
3159
|
+
}
|
2890
3160
|
|
2891
3161
|
if (instance.state.isDestroyed) {
|
2892
3162
|
return;
|
@@ -2945,6 +3215,10 @@ function createTippy(reference, passedProps) {
|
|
2945
3215
|
}
|
2946
3216
|
|
2947
3217
|
function show() {
|
3218
|
+
/* istanbul ignore else */
|
3219
|
+
if (process.env.NODE_ENV !== "production") {
|
3220
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
|
3221
|
+
} // Early bail-out
|
2948
3222
|
|
2949
3223
|
|
2950
3224
|
var isAlreadyVisible = instance.state.isVisible;
|
@@ -3035,6 +3309,10 @@ function createTippy(reference, passedProps) {
|
|
3035
3309
|
}
|
3036
3310
|
|
3037
3311
|
function hide() {
|
3312
|
+
/* istanbul ignore else */
|
3313
|
+
if (process.env.NODE_ENV !== "production") {
|
3314
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
|
3315
|
+
} // Early bail-out
|
3038
3316
|
|
3039
3317
|
|
3040
3318
|
var isAlreadyHidden = !instance.state.isVisible;
|
@@ -3089,6 +3367,10 @@ function createTippy(reference, passedProps) {
|
|
3089
3367
|
}
|
3090
3368
|
|
3091
3369
|
function hideWithInteractivity(event) {
|
3370
|
+
/* istanbul ignore else */
|
3371
|
+
if (process.env.NODE_ENV !== "production") {
|
3372
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
|
3373
|
+
}
|
3092
3374
|
|
3093
3375
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
3094
3376
|
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
@@ -3096,6 +3378,10 @@ function createTippy(reference, passedProps) {
|
|
3096
3378
|
}
|
3097
3379
|
|
3098
3380
|
function unmount() {
|
3381
|
+
/* istanbul ignore else */
|
3382
|
+
if (process.env.NODE_ENV !== "production") {
|
3383
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
|
3384
|
+
}
|
3099
3385
|
|
3100
3386
|
if (instance.state.isVisible) {
|
3101
3387
|
instance.hide();
|
@@ -3125,6 +3411,10 @@ function createTippy(reference, passedProps) {
|
|
3125
3411
|
}
|
3126
3412
|
|
3127
3413
|
function destroy() {
|
3414
|
+
/* istanbul ignore else */
|
3415
|
+
if (process.env.NODE_ENV !== "production") {
|
3416
|
+
warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
|
3417
|
+
}
|
3128
3418
|
|
3129
3419
|
if (instance.state.isDestroyed) {
|
3130
3420
|
return;
|
@@ -3145,12 +3435,25 @@ function tippy(targets, optionalProps) {
|
|
3145
3435
|
}
|
3146
3436
|
|
3147
3437
|
var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
|
3438
|
+
/* istanbul ignore else */
|
3439
|
+
|
3440
|
+
if (process.env.NODE_ENV !== "production") {
|
3441
|
+
validateTargets(targets);
|
3442
|
+
validateProps(optionalProps, plugins);
|
3443
|
+
}
|
3148
3444
|
|
3149
3445
|
bindGlobalEventListeners();
|
3150
3446
|
var passedProps = Object.assign({}, optionalProps, {
|
3151
3447
|
plugins: plugins
|
3152
3448
|
});
|
3153
3449
|
var elements = getArrayOfElements(targets);
|
3450
|
+
/* istanbul ignore else */
|
3451
|
+
|
3452
|
+
if (process.env.NODE_ENV !== "production") {
|
3453
|
+
var isSingleContentElement = isElement$1(passedProps.content);
|
3454
|
+
var isMoreThanOneReferenceElement = elements.length > 1;
|
3455
|
+
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(' '));
|
3456
|
+
}
|
3154
3457
|
|
3155
3458
|
var instances = elements.reduce(function (acc, reference) {
|
3156
3459
|
var instance = reference && createTippy(reference, passedProps);
|
@@ -3205,6 +3508,11 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3205
3508
|
optionalProps = {};
|
3206
3509
|
}
|
3207
3510
|
|
3511
|
+
/* istanbul ignore else */
|
3512
|
+
if (process.env.NODE_ENV !== "production") {
|
3513
|
+
errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
|
3514
|
+
}
|
3515
|
+
|
3208
3516
|
var individualInstances = tippyInstances;
|
3209
3517
|
var references = [];
|
3210
3518
|
var currentTarget;
|
@@ -3391,6 +3699,9 @@ var animateFill = {
|
|
3391
3699
|
|
3392
3700
|
// @ts-ignore
|
3393
3701
|
if (!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy)) {
|
3702
|
+
if (process.env.NODE_ENV !== "production") {
|
3703
|
+
errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
|
3704
|
+
}
|
3394
3705
|
|
3395
3706
|
return {};
|
3396
3707
|
}
|
@@ -4087,13 +4398,17 @@ const TippyComponent = vue.defineComponent({
|
|
4087
4398
|
setup(props, { slots }) {
|
4088
4399
|
const elem = vue.ref();
|
4089
4400
|
const contentElem = vue.ref();
|
4090
|
-
|
4091
|
-
|
4092
|
-
|
4401
|
+
const mounted = vue.ref(false);
|
4402
|
+
let options = { ...props };
|
4403
|
+
for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
|
4404
|
+
if (options.hasOwnProperty(prop)) {
|
4405
|
+
// @ts-ignore
|
4406
|
+
delete options[prop];
|
4407
|
+
}
|
4093
4408
|
}
|
4094
4409
|
let target = elem;
|
4095
4410
|
if (props.to) {
|
4096
|
-
if (props.to instanceof Element) {
|
4411
|
+
if (typeof Element !== 'undefined' && props.to instanceof Element) {
|
4097
4412
|
target = () => props.to;
|
4098
4413
|
}
|
4099
4414
|
else if (typeof props.to === 'string' || props.to instanceof String) {
|
@@ -4102,16 +4417,19 @@ const TippyComponent = vue.defineComponent({
|
|
4102
4417
|
}
|
4103
4418
|
const tippy = useTippy(target, options);
|
4104
4419
|
vue.onMounted(() => {
|
4105
|
-
|
4106
|
-
|
4420
|
+
mounted.value = true;
|
4421
|
+
vue.nextTick(() => {
|
4422
|
+
if (slots.content)
|
4423
|
+
tippy.setContent(() => contentElem.value);
|
4424
|
+
});
|
4107
4425
|
});
|
4108
|
-
return { elem, contentElem, ...tippy };
|
4426
|
+
return { elem, contentElem, mounted, ...tippy };
|
4109
4427
|
},
|
4110
4428
|
render() {
|
4111
4429
|
let slot = this.$slots.default ? this.$slots.default(this) : [];
|
4112
4430
|
return vue.h(this.tag, { ref: 'elem', 'data-v-tippy': '' }, this.$slots.content ? [
|
4113
4431
|
slot,
|
4114
|
-
vue.h(this.contentTag, { ref: 'contentElem', class: this.contentClass }, this.$slots.content(this))
|
4432
|
+
vue.h(this.contentTag, { ref: 'contentElem', style: { display: this.mounted ? 'inherit' : 'none' }, class: this.contentClass }, this.$slots.content(this)),
|
4115
4433
|
] : slot);
|
4116
4434
|
},
|
4117
4435
|
});
|
package/dist/vue-tippy.d.ts
CHANGED
@@ -39,6 +39,7 @@ export declare const Tippy: import("vue").DefineComponent<ComponentObjectPropsOp
|
|
39
39
|
mount: () => void;
|
40
40
|
elem: import("vue").Ref<Element | undefined>;
|
41
41
|
contentElem: import("vue").Ref<Element | undefined>;
|
42
|
+
mounted: import("vue").Ref<boolean>;
|
42
43
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{} & {
|
43
44
|
[x: string]: any;
|
44
45
|
}>, {}>;
|