vue-tippy 6.0.0-alpha.9 → 6.0.0-beta.0
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/README.md +106 -3
- package/dist/{vue-tippy.cjs.prod.js → vue-tippy.cjs} +1029 -266
- package/dist/vue-tippy.d.ts +698 -29
- package/dist/{vue-tippy.esm-bundler.js → vue-tippy.esm-browser.js} +699 -256
- package/dist/{vue-tippy.global.js → vue-tippy.iife.js} +1030 -267
- package/dist/vue-tippy.iife.prod.js +6 -0
- package/dist/{vue-tippy.esm.js → vue-tippy.mjs} +699 -256
- package/dist/{vue-tippy.cjs.js → vue-tippy.prod.cjs} +713 -266
- package/index.cjs +7 -0
- package/index.js +7 -0
- package/package.json +36 -13
- package/src/components/Tippy.ts +158 -0
- package/src/components/TippySingleton.ts +74 -0
- package/src/composables/index.ts +3 -0
- package/src/composables/useSingleton.ts +44 -0
- package/src/composables/useTippy.ts +255 -0
- package/src/composables/useTippyComponent.ts +25 -0
- package/src/directive/index.ts +89 -0
- package/src/global.d.ts +4 -0
- package/src/index.ts +39 -0
- package/src/plugin/index.ts +18 -0
- package/src/types/index.ts +37 -0
- package/tsconfig.json +31 -0
- package/dist/vue-tippy.global.prod.js +0 -6
@@ -1,13 +1,13 @@
|
|
1
1
|
/*!
|
2
|
-
* vue-tippy v6.0.0-
|
3
|
-
* (c)
|
2
|
+
* vue-tippy v6.0.0-beta.0
|
3
|
+
* (c) 2022
|
4
4
|
* @license MIT
|
5
5
|
*/
|
6
6
|
'use strict';
|
7
7
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
9
9
|
|
10
|
-
var
|
10
|
+
var vue = require('vue');
|
11
11
|
|
12
12
|
var top = 'top';
|
13
13
|
var bottom = 'bottom';
|
@@ -45,10 +45,11 @@ function getNodeName(element) {
|
|
45
45
|
return element ? (element.nodeName || '').toLowerCase() : null;
|
46
46
|
}
|
47
47
|
|
48
|
-
/*:: import type { Window } from '../types'; */
|
49
|
-
|
50
|
-
/*:: declare function getWindow(node: Node | Window): Window; */
|
51
48
|
function getWindow(node) {
|
49
|
+
if (node == null) {
|
50
|
+
return window;
|
51
|
+
}
|
52
|
+
|
52
53
|
if (node.toString() !== '[object Window]') {
|
53
54
|
var ownerDocument = node.ownerDocument;
|
54
55
|
return ownerDocument ? ownerDocument.defaultView || window : window;
|
@@ -57,26 +58,22 @@ function getWindow(node) {
|
|
57
58
|
return node;
|
58
59
|
}
|
59
60
|
|
60
|
-
/*:: declare function isElement(node: mixed): boolean %checks(node instanceof
|
61
|
-
Element); */
|
62
|
-
|
63
61
|
function isElement(node) {
|
64
62
|
var OwnElement = getWindow(node).Element;
|
65
63
|
return node instanceof OwnElement || node instanceof Element;
|
66
64
|
}
|
67
|
-
/*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
|
68
|
-
HTMLElement); */
|
69
|
-
|
70
65
|
|
71
66
|
function isHTMLElement(node) {
|
72
67
|
var OwnElement = getWindow(node).HTMLElement;
|
73
68
|
return node instanceof OwnElement || node instanceof HTMLElement;
|
74
69
|
}
|
75
|
-
/*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
|
76
|
-
ShadowRoot); */
|
77
|
-
|
78
70
|
|
79
71
|
function isShadowRoot(node) {
|
72
|
+
// IE 11 has no ShadowRoot
|
73
|
+
if (typeof ShadowRoot === 'undefined') {
|
74
|
+
return false;
|
75
|
+
}
|
76
|
+
|
80
77
|
var OwnElement = getWindow(node).ShadowRoot;
|
81
78
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
82
79
|
}
|
@@ -125,6 +122,7 @@ function effect(_ref2) {
|
|
125
122
|
reference: {}
|
126
123
|
};
|
127
124
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
125
|
+
state.styles = initialStyles;
|
128
126
|
|
129
127
|
if (state.elements.arrow) {
|
130
128
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
@@ -167,14 +165,67 @@ function getBasePlacement(placement) {
|
|
167
165
|
return placement.split('-')[0];
|
168
166
|
}
|
169
167
|
|
170
|
-
|
168
|
+
var max = Math.max;
|
169
|
+
var min = Math.min;
|
170
|
+
var round = Math.round;
|
171
|
+
|
172
|
+
function getBoundingClientRect(element, includeScale) {
|
173
|
+
if (includeScale === void 0) {
|
174
|
+
includeScale = false;
|
175
|
+
}
|
176
|
+
|
177
|
+
var rect = element.getBoundingClientRect();
|
178
|
+
var scaleX = 1;
|
179
|
+
var scaleY = 1;
|
180
|
+
|
181
|
+
if (isHTMLElement(element) && includeScale) {
|
182
|
+
var offsetHeight = element.offsetHeight;
|
183
|
+
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
184
|
+
// Fallback to 1 in case both values are `0`
|
185
|
+
|
186
|
+
if (offsetWidth > 0) {
|
187
|
+
scaleX = round(rect.width) / offsetWidth || 1;
|
188
|
+
}
|
189
|
+
|
190
|
+
if (offsetHeight > 0) {
|
191
|
+
scaleY = round(rect.height) / offsetHeight || 1;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
return {
|
196
|
+
width: rect.width / scaleX,
|
197
|
+
height: rect.height / scaleY,
|
198
|
+
top: rect.top / scaleY,
|
199
|
+
right: rect.right / scaleX,
|
200
|
+
bottom: rect.bottom / scaleY,
|
201
|
+
left: rect.left / scaleX,
|
202
|
+
x: rect.left / scaleX,
|
203
|
+
y: rect.top / scaleY
|
204
|
+
};
|
205
|
+
}
|
206
|
+
|
171
207
|
// means it doesn't take into account transforms.
|
208
|
+
|
172
209
|
function getLayoutRect(element) {
|
210
|
+
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
211
|
+
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
212
|
+
|
213
|
+
var width = element.offsetWidth;
|
214
|
+
var height = element.offsetHeight;
|
215
|
+
|
216
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
217
|
+
width = clientRect.width;
|
218
|
+
}
|
219
|
+
|
220
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
221
|
+
height = clientRect.height;
|
222
|
+
}
|
223
|
+
|
173
224
|
return {
|
174
225
|
x: element.offsetLeft,
|
175
226
|
y: element.offsetTop,
|
176
|
-
width:
|
177
|
-
height:
|
227
|
+
width: width,
|
228
|
+
height: height
|
178
229
|
};
|
179
230
|
}
|
180
231
|
|
@@ -224,9 +275,8 @@ function getParentNode(element) {
|
|
224
275
|
// $FlowFixMe[incompatible-return]
|
225
276
|
// $FlowFixMe[prop-missing]
|
226
277
|
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
227
|
-
element.parentNode || // DOM Element detected
|
228
|
-
|
229
|
-
element.host || // ShadowRoot detected
|
278
|
+
element.parentNode || ( // DOM Element detected
|
279
|
+
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
230
280
|
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
231
281
|
getDocumentElement(element) // fallback
|
232
282
|
|
@@ -239,29 +289,32 @@ function getTrueOffsetParent(element) {
|
|
239
289
|
return null;
|
240
290
|
}
|
241
291
|
|
242
|
-
|
243
|
-
|
244
|
-
if (offsetParent) {
|
245
|
-
var html = getDocumentElement(offsetParent);
|
246
|
-
|
247
|
-
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
|
248
|
-
return html;
|
249
|
-
}
|
250
|
-
}
|
251
|
-
|
252
|
-
return offsetParent;
|
292
|
+
return element.offsetParent;
|
253
293
|
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
254
294
|
// return the containing block
|
255
295
|
|
256
296
|
|
257
297
|
function getContainingBlock(element) {
|
298
|
+
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
|
299
|
+
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
|
300
|
+
|
301
|
+
if (isIE && isHTMLElement(element)) {
|
302
|
+
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
303
|
+
var elementCss = getComputedStyle(element);
|
304
|
+
|
305
|
+
if (elementCss.position === 'fixed') {
|
306
|
+
return null;
|
307
|
+
}
|
308
|
+
}
|
309
|
+
|
258
310
|
var currentNode = getParentNode(element);
|
259
311
|
|
260
312
|
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
261
313
|
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
262
314
|
// create a containing block.
|
315
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
263
316
|
|
264
|
-
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== '
|
317
|
+
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
265
318
|
return currentNode;
|
266
319
|
} else {
|
267
320
|
currentNode = currentNode.parentNode;
|
@@ -281,7 +334,7 @@ function getOffsetParent(element) {
|
|
281
334
|
offsetParent = getTrueOffsetParent(offsetParent);
|
282
335
|
}
|
283
336
|
|
284
|
-
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
|
337
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
285
338
|
return window;
|
286
339
|
}
|
287
340
|
|
@@ -292,8 +345,12 @@ function getMainAxisFromPlacement(placement) {
|
|
292
345
|
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
293
346
|
}
|
294
347
|
|
295
|
-
function within(min, value, max) {
|
296
|
-
return
|
348
|
+
function within(min$1, value, max$1) {
|
349
|
+
return max(min$1, min(value, max$1));
|
350
|
+
}
|
351
|
+
function withinMaxClamp(min, value, max) {
|
352
|
+
var v = within(min, value, max);
|
353
|
+
return v > max ? max : v;
|
297
354
|
}
|
298
355
|
|
299
356
|
function getFreshSideObject() {
|
@@ -306,7 +363,7 @@ function getFreshSideObject() {
|
|
306
363
|
}
|
307
364
|
|
308
365
|
function mergePaddingObject(paddingObject) {
|
309
|
-
return Object.assign(
|
366
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
310
367
|
}
|
311
368
|
|
312
369
|
function expandToHashMap(value, keys) {
|
@@ -316,11 +373,19 @@ function expandToHashMap(value, keys) {
|
|
316
373
|
}, {});
|
317
374
|
}
|
318
375
|
|
376
|
+
var toPaddingObject = function toPaddingObject(padding, state) {
|
377
|
+
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
378
|
+
placement: state.placement
|
379
|
+
})) : padding;
|
380
|
+
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
381
|
+
};
|
382
|
+
|
319
383
|
function arrow(_ref) {
|
320
384
|
var _state$modifiersData$;
|
321
385
|
|
322
386
|
var state = _ref.state,
|
323
|
-
name = _ref.name
|
387
|
+
name = _ref.name,
|
388
|
+
options = _ref.options;
|
324
389
|
var arrowElement = state.elements.arrow;
|
325
390
|
var popperOffsets = state.modifiersData.popperOffsets;
|
326
391
|
var basePlacement = getBasePlacement(state.placement);
|
@@ -332,7 +397,7 @@ function arrow(_ref) {
|
|
332
397
|
return;
|
333
398
|
}
|
334
399
|
|
335
|
-
var paddingObject =
|
400
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
336
401
|
var arrowRect = getLayoutRect(arrowElement);
|
337
402
|
var minProp = axis === 'y' ? top : left;
|
338
403
|
var maxProp = axis === 'y' ? bottom : right;
|
@@ -354,12 +419,9 @@ function arrow(_ref) {
|
|
354
419
|
|
355
420
|
function effect$1(_ref2) {
|
356
421
|
var state = _ref2.state,
|
357
|
-
options = _ref2.options
|
358
|
-
name = _ref2.name;
|
422
|
+
options = _ref2.options;
|
359
423
|
var _options$element = options.element,
|
360
|
-
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element
|
361
|
-
_options$padding = options.padding,
|
362
|
-
padding = _options$padding === void 0 ? 0 : _options$padding;
|
424
|
+
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
363
425
|
|
364
426
|
if (arrowElement == null) {
|
365
427
|
return;
|
@@ -380,9 +442,6 @@ function effect$1(_ref2) {
|
|
380
442
|
}
|
381
443
|
|
382
444
|
state.elements.arrow = arrowElement;
|
383
|
-
state.modifiersData[name + "#persistent"] = {
|
384
|
-
padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
|
385
|
-
};
|
386
445
|
} // eslint-disable-next-line import/no-unused-modules
|
387
446
|
|
388
447
|
|
@@ -396,6 +455,10 @@ var arrow$1 = {
|
|
396
455
|
requiresIfExists: ['preventOverflow']
|
397
456
|
};
|
398
457
|
|
458
|
+
function getVariation(placement) {
|
459
|
+
return placement.split('-')[1];
|
460
|
+
}
|
461
|
+
|
399
462
|
var unsetSides = {
|
400
463
|
top: 'auto',
|
401
464
|
right: 'auto',
|
@@ -411,8 +474,8 @@ function roundOffsetsByDPR(_ref) {
|
|
411
474
|
var win = window;
|
412
475
|
var dpr = win.devicePixelRatio || 1;
|
413
476
|
return {
|
414
|
-
x:
|
415
|
-
y:
|
477
|
+
x: round(x * dpr) / dpr || 0,
|
478
|
+
y: round(y * dpr) / dpr || 0
|
416
479
|
};
|
417
480
|
}
|
418
481
|
|
@@ -422,13 +485,15 @@ function mapToStyles(_ref2) {
|
|
422
485
|
var popper = _ref2.popper,
|
423
486
|
popperRect = _ref2.popperRect,
|
424
487
|
placement = _ref2.placement,
|
488
|
+
variation = _ref2.variation,
|
425
489
|
offsets = _ref2.offsets,
|
426
490
|
position = _ref2.position,
|
427
491
|
gpuAcceleration = _ref2.gpuAcceleration,
|
428
492
|
adaptive = _ref2.adaptive,
|
429
|
-
roundOffsets = _ref2.roundOffsets
|
493
|
+
roundOffsets = _ref2.roundOffsets,
|
494
|
+
isFixed = _ref2.isFixed;
|
430
495
|
|
431
|
-
var _ref3 = roundOffsets ? roundOffsetsByDPR(offsets) : offsets,
|
496
|
+
var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
|
432
497
|
_ref3$x = _ref3.x,
|
433
498
|
x = _ref3$x === void 0 ? 0 : _ref3$x,
|
434
499
|
_ref3$y = _ref3.y,
|
@@ -442,23 +507,34 @@ function mapToStyles(_ref2) {
|
|
442
507
|
|
443
508
|
if (adaptive) {
|
444
509
|
var offsetParent = getOffsetParent(popper);
|
510
|
+
var heightProp = 'clientHeight';
|
511
|
+
var widthProp = 'clientWidth';
|
445
512
|
|
446
513
|
if (offsetParent === getWindow(popper)) {
|
447
514
|
offsetParent = getDocumentElement(popper);
|
515
|
+
|
516
|
+
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
517
|
+
heightProp = 'scrollHeight';
|
518
|
+
widthProp = 'scrollWidth';
|
519
|
+
}
|
448
520
|
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
449
521
|
|
450
|
-
/*:: offsetParent = (offsetParent: Element); */
|
451
522
|
|
523
|
+
offsetParent = offsetParent;
|
452
524
|
|
453
|
-
if (placement === top) {
|
525
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
454
526
|
sideY = bottom;
|
455
|
-
|
527
|
+
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
528
|
+
offsetParent[heightProp];
|
529
|
+
y -= offsetY - popperRect.height;
|
456
530
|
y *= gpuAcceleration ? 1 : -1;
|
457
531
|
}
|
458
532
|
|
459
|
-
if (placement === left) {
|
533
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
460
534
|
sideX = right;
|
461
|
-
|
535
|
+
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
536
|
+
offsetParent[widthProp];
|
537
|
+
x -= offsetX - popperRect.width;
|
462
538
|
x *= gpuAcceleration ? 1 : -1;
|
463
539
|
}
|
464
540
|
}
|
@@ -470,10 +546,10 @@ function mapToStyles(_ref2) {
|
|
470
546
|
if (gpuAcceleration) {
|
471
547
|
var _Object$assign;
|
472
548
|
|
473
|
-
return Object.assign(
|
549
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
474
550
|
}
|
475
551
|
|
476
|
-
return Object.assign(
|
552
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
477
553
|
}
|
478
554
|
|
479
555
|
function computeStyles(_ref4) {
|
@@ -488,13 +564,15 @@ function computeStyles(_ref4) {
|
|
488
564
|
|
489
565
|
var commonStyles = {
|
490
566
|
placement: getBasePlacement(state.placement),
|
567
|
+
variation: getVariation(state.placement),
|
491
568
|
popper: state.elements.popper,
|
492
569
|
popperRect: state.rects.popper,
|
493
|
-
gpuAcceleration: gpuAcceleration
|
570
|
+
gpuAcceleration: gpuAcceleration,
|
571
|
+
isFixed: state.options.strategy === 'fixed'
|
494
572
|
};
|
495
573
|
|
496
574
|
if (state.modifiersData.popperOffsets != null) {
|
497
|
-
state.styles.popper = Object.assign(
|
575
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
498
576
|
offsets: state.modifiersData.popperOffsets,
|
499
577
|
position: state.options.strategy,
|
500
578
|
adaptive: adaptive,
|
@@ -503,7 +581,7 @@ function computeStyles(_ref4) {
|
|
503
581
|
}
|
504
582
|
|
505
583
|
if (state.modifiersData.arrow != null) {
|
506
|
-
state.styles.arrow = Object.assign(
|
584
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
507
585
|
offsets: state.modifiersData.arrow,
|
508
586
|
position: 'absolute',
|
509
587
|
adaptive: false,
|
@@ -511,7 +589,7 @@ function computeStyles(_ref4) {
|
|
511
589
|
})));
|
512
590
|
}
|
513
591
|
|
514
|
-
state.attributes.popper = Object.assign(
|
592
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
515
593
|
'data-popper-placement': state.placement
|
516
594
|
});
|
517
595
|
} // eslint-disable-next-line import/no-unused-modules
|
@@ -595,20 +673,6 @@ function getOppositeVariationPlacement(placement) {
|
|
595
673
|
});
|
596
674
|
}
|
597
675
|
|
598
|
-
function getBoundingClientRect(element) {
|
599
|
-
var rect = element.getBoundingClientRect();
|
600
|
-
return {
|
601
|
-
width: rect.width,
|
602
|
-
height: rect.height,
|
603
|
-
top: rect.top,
|
604
|
-
right: rect.right,
|
605
|
-
bottom: rect.bottom,
|
606
|
-
left: rect.left,
|
607
|
-
x: rect.left,
|
608
|
-
y: rect.top
|
609
|
-
};
|
610
|
-
}
|
611
|
-
|
612
676
|
function getWindowScroll(node) {
|
613
677
|
var win = getWindow(node);
|
614
678
|
var scrollLeft = win.pageXOffset;
|
@@ -671,16 +735,18 @@ function getViewportRect(element) {
|
|
671
735
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
672
736
|
|
673
737
|
function getDocumentRect(element) {
|
738
|
+
var _element$ownerDocumen;
|
739
|
+
|
674
740
|
var html = getDocumentElement(element);
|
675
741
|
var winScroll = getWindowScroll(element);
|
676
|
-
var body = element.ownerDocument.body;
|
677
|
-
var width =
|
678
|
-
var height =
|
742
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
743
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
744
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
679
745
|
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
680
746
|
var y = -winScroll.scrollTop;
|
681
747
|
|
682
748
|
if (getComputedStyle(body || html).direction === 'rtl') {
|
683
|
-
x +=
|
749
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
684
750
|
}
|
685
751
|
|
686
752
|
return {
|
@@ -722,12 +788,14 @@ reference element's position.
|
|
722
788
|
*/
|
723
789
|
|
724
790
|
function listScrollParents(element, list) {
|
791
|
+
var _element$ownerDocumen;
|
792
|
+
|
725
793
|
if (list === void 0) {
|
726
794
|
list = [];
|
727
795
|
}
|
728
796
|
|
729
797
|
var scrollParent = getScrollParent(element);
|
730
|
-
var isBody =
|
798
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
731
799
|
var win = getWindow(scrollParent);
|
732
800
|
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
733
801
|
var updatedList = list.concat(target);
|
@@ -736,7 +804,7 @@ function listScrollParents(element, list) {
|
|
736
804
|
}
|
737
805
|
|
738
806
|
function rectToClientRect(rect) {
|
739
|
-
return Object.assign(
|
807
|
+
return Object.assign({}, rect, {
|
740
808
|
left: rect.x,
|
741
809
|
top: rect.y,
|
742
810
|
right: rect.x + rect.width,
|
@@ -758,7 +826,7 @@ function getInnerBoundingClientRect(element) {
|
|
758
826
|
}
|
759
827
|
|
760
828
|
function getClientRectFromMixedType(element, clippingParent) {
|
761
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) :
|
829
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
762
830
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
763
831
|
// clipping (or hiding) overflowing elements with a position different from
|
764
832
|
// `initial`
|
@@ -775,7 +843,7 @@ function getClippingParents(element) {
|
|
775
843
|
|
776
844
|
|
777
845
|
return clippingParents.filter(function (clippingParent) {
|
778
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
846
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
|
779
847
|
});
|
780
848
|
} // Gets the maximum area that the element is visible in due to any number of
|
781
849
|
// clipping parents
|
@@ -787,10 +855,10 @@ function getClippingRect(element, boundary, rootBoundary) {
|
|
787
855
|
var firstClippingParent = clippingParents[0];
|
788
856
|
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
789
857
|
var rect = getClientRectFromMixedType(element, clippingParent);
|
790
|
-
accRect.top =
|
791
|
-
accRect.right =
|
792
|
-
accRect.bottom =
|
793
|
-
accRect.left =
|
858
|
+
accRect.top = max(rect.top, accRect.top);
|
859
|
+
accRect.right = min(rect.right, accRect.right);
|
860
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
861
|
+
accRect.left = max(rect.left, accRect.left);
|
794
862
|
return accRect;
|
795
863
|
}, getClientRectFromMixedType(element, firstClippingParent));
|
796
864
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
@@ -800,10 +868,6 @@ function getClippingRect(element, boundary, rootBoundary) {
|
|
800
868
|
return clippingRect;
|
801
869
|
}
|
802
870
|
|
803
|
-
function getVariation(placement) {
|
804
|
-
return placement.split('-')[1];
|
805
|
-
}
|
806
|
-
|
807
871
|
function computeOffsets(_ref) {
|
808
872
|
var reference = _ref.reference,
|
809
873
|
element = _ref.element,
|
@@ -889,18 +953,17 @@ function detectOverflow(state, options) {
|
|
889
953
|
padding = _options$padding === void 0 ? 0 : _options$padding;
|
890
954
|
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
891
955
|
var altContext = elementContext === popper ? reference : popper;
|
892
|
-
var referenceElement = state.elements.reference;
|
893
956
|
var popperRect = state.rects.popper;
|
894
957
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
895
958
|
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
896
|
-
var referenceClientRect = getBoundingClientRect(
|
959
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
897
960
|
var popperOffsets = computeOffsets({
|
898
961
|
reference: referenceClientRect,
|
899
962
|
element: popperRect,
|
900
963
|
strategy: 'absolute',
|
901
964
|
placement: placement
|
902
965
|
});
|
903
|
-
var popperClientRect = rectToClientRect(Object.assign(
|
966
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
904
967
|
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
905
968
|
// 0 or negative = within the clipping rect
|
906
969
|
|
@@ -924,9 +987,6 @@ function detectOverflow(state, options) {
|
|
924
987
|
return overflowOffsets;
|
925
988
|
}
|
926
989
|
|
927
|
-
/*:: type OverflowsMap = { [ComputedPlacement]: number }; */
|
928
|
-
|
929
|
-
/*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
|
930
990
|
function computeAutoPlacement(state, options) {
|
931
991
|
if (options === void 0) {
|
932
992
|
options = {};
|
@@ -1151,7 +1211,7 @@ function hide(_ref) {
|
|
1151
1211
|
isReferenceHidden: isReferenceHidden,
|
1152
1212
|
hasPopperEscaped: hasPopperEscaped
|
1153
1213
|
};
|
1154
|
-
state.attributes.popper = Object.assign(
|
1214
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
1155
1215
|
'data-popper-reference-hidden': isReferenceHidden,
|
1156
1216
|
'data-popper-escaped': hasPopperEscaped
|
1157
1217
|
});
|
@@ -1170,7 +1230,7 @@ function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
1170
1230
|
var basePlacement = getBasePlacement(placement);
|
1171
1231
|
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
1172
1232
|
|
1173
|
-
var _ref = typeof offset === 'function' ? offset(Object.assign(
|
1233
|
+
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
1174
1234
|
placement: placement
|
1175
1235
|
})) : offset,
|
1176
1236
|
skidding = _ref[0],
|
@@ -1276,9 +1336,17 @@ function preventOverflow(_ref) {
|
|
1276
1336
|
var popperOffsets = state.modifiersData.popperOffsets;
|
1277
1337
|
var referenceRect = state.rects.reference;
|
1278
1338
|
var popperRect = state.rects.popper;
|
1279
|
-
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(
|
1339
|
+
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
1280
1340
|
placement: state.placement
|
1281
1341
|
})) : tetherOffset;
|
1342
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
1343
|
+
mainAxis: tetherOffsetValue,
|
1344
|
+
altAxis: tetherOffsetValue
|
1345
|
+
} : Object.assign({
|
1346
|
+
mainAxis: 0,
|
1347
|
+
altAxis: 0
|
1348
|
+
}, tetherOffsetValue);
|
1349
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
1282
1350
|
var data = {
|
1283
1351
|
x: 0,
|
1284
1352
|
y: 0
|
@@ -1289,12 +1357,14 @@ function preventOverflow(_ref) {
|
|
1289
1357
|
}
|
1290
1358
|
|
1291
1359
|
if (checkMainAxis) {
|
1360
|
+
var _offsetModifierState$;
|
1361
|
+
|
1292
1362
|
var mainSide = mainAxis === 'y' ? top : left;
|
1293
1363
|
var altSide = mainAxis === 'y' ? bottom : right;
|
1294
1364
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
1295
1365
|
var offset = popperOffsets[mainAxis];
|
1296
|
-
var min =
|
1297
|
-
var max =
|
1366
|
+
var min$1 = offset + overflow[mainSide];
|
1367
|
+
var max$1 = offset - overflow[altSide];
|
1298
1368
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
1299
1369
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
1300
1370
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
@@ -1314,30 +1384,42 @@ function preventOverflow(_ref) {
|
|
1314
1384
|
// width or height)
|
1315
1385
|
|
1316
1386
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
1317
|
-
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin -
|
1318
|
-
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax +
|
1387
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
1388
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
1319
1389
|
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
1320
1390
|
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
1321
|
-
var offsetModifierValue =
|
1322
|
-
var tetherMin =
|
1323
|
-
var tetherMax =
|
1324
|
-
var preventedOffset = within(tether ?
|
1391
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
1392
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
1393
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
1394
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
1325
1395
|
popperOffsets[mainAxis] = preventedOffset;
|
1326
1396
|
data[mainAxis] = preventedOffset - offset;
|
1327
1397
|
}
|
1328
1398
|
|
1329
1399
|
if (checkAltAxis) {
|
1400
|
+
var _offsetModifierState$2;
|
1401
|
+
|
1330
1402
|
var _mainSide = mainAxis === 'x' ? top : left;
|
1331
1403
|
|
1332
1404
|
var _altSide = mainAxis === 'x' ? bottom : right;
|
1333
1405
|
|
1334
1406
|
var _offset = popperOffsets[altAxis];
|
1335
1407
|
|
1408
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
1409
|
+
|
1336
1410
|
var _min = _offset + overflow[_mainSide];
|
1337
1411
|
|
1338
1412
|
var _max = _offset - overflow[_altSide];
|
1339
1413
|
|
1340
|
-
var
|
1414
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
1415
|
+
|
1416
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
1417
|
+
|
1418
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
1419
|
+
|
1420
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
1421
|
+
|
1422
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
1341
1423
|
|
1342
1424
|
popperOffsets[altAxis] = _preventedOffset;
|
1343
1425
|
data[altAxis] = _preventedOffset - _offset;
|
@@ -1370,16 +1452,24 @@ function getNodeScroll(node) {
|
|
1370
1452
|
}
|
1371
1453
|
}
|
1372
1454
|
|
1455
|
+
function isElementScaled(element) {
|
1456
|
+
var rect = element.getBoundingClientRect();
|
1457
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
1458
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
1459
|
+
return scaleX !== 1 || scaleY !== 1;
|
1460
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
1373
1461
|
// Composite means it takes into account transforms as well as layout.
|
1374
1462
|
|
1463
|
+
|
1375
1464
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
1376
1465
|
if (isFixed === void 0) {
|
1377
1466
|
isFixed = false;
|
1378
1467
|
}
|
1379
1468
|
|
1380
|
-
var documentElement = getDocumentElement(offsetParent);
|
1381
|
-
var rect = getBoundingClientRect(elementOrVirtualElement);
|
1382
1469
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1470
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
1471
|
+
var documentElement = getDocumentElement(offsetParent);
|
1472
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
1383
1473
|
var scroll = {
|
1384
1474
|
scrollLeft: 0,
|
1385
1475
|
scrollTop: 0
|
@@ -1396,7 +1486,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
1396
1486
|
}
|
1397
1487
|
|
1398
1488
|
if (isHTMLElement(offsetParent)) {
|
1399
|
-
offsets = getBoundingClientRect(offsetParent);
|
1489
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
1400
1490
|
offsets.x += offsetParent.clientLeft;
|
1401
1491
|
offsets.y += offsetParent.clientTop;
|
1402
1492
|
} else if (documentElement) {
|
@@ -1474,9 +1564,9 @@ function debounce(fn) {
|
|
1474
1564
|
function mergeByName(modifiers) {
|
1475
1565
|
var merged = modifiers.reduce(function (merged, current) {
|
1476
1566
|
var existing = merged[current.name];
|
1477
|
-
merged[current.name] = existing ? Object.assign(
|
1478
|
-
options: Object.assign(
|
1479
|
-
data: Object.assign(
|
1567
|
+
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
1568
|
+
options: Object.assign({}, existing.options, current.options),
|
1569
|
+
data: Object.assign({}, existing.data, current.data)
|
1480
1570
|
}) : current;
|
1481
1571
|
return merged;
|
1482
1572
|
}, {}); // IE11 does not support Object.values
|
@@ -1520,7 +1610,7 @@ function popperGenerator(generatorOptions) {
|
|
1520
1610
|
var state = {
|
1521
1611
|
placement: 'bottom',
|
1522
1612
|
orderedModifiers: [],
|
1523
|
-
options: Object.assign(
|
1613
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
1524
1614
|
modifiersData: {},
|
1525
1615
|
elements: {
|
1526
1616
|
reference: reference,
|
@@ -1533,9 +1623,10 @@ function popperGenerator(generatorOptions) {
|
|
1533
1623
|
var isDestroyed = false;
|
1534
1624
|
var instance = {
|
1535
1625
|
state: state,
|
1536
|
-
setOptions: function setOptions(
|
1626
|
+
setOptions: function setOptions(setOptionsAction) {
|
1627
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
1537
1628
|
cleanupModifierEffects();
|
1538
|
-
state.options = Object.assign(
|
1629
|
+
state.options = Object.assign({}, defaultOptions, state.options, options);
|
1539
1630
|
state.scrollParents = {
|
1540
1631
|
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
1541
1632
|
popper: listScrollParents(popper)
|
@@ -1683,10 +1774,12 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
1683
1774
|
}); // eslint-disable-next-line import/no-unused-modules
|
1684
1775
|
|
1685
1776
|
/**!
|
1686
|
-
* tippy.js v6.
|
1687
|
-
* (c) 2017-
|
1777
|
+
* tippy.js v6.3.7
|
1778
|
+
* (c) 2017-2021 atomiks
|
1688
1779
|
* MIT License
|
1689
1780
|
*/
|
1781
|
+
|
1782
|
+
var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
|
1690
1783
|
var BOX_CLASS = "tippy-box";
|
1691
1784
|
var CONTENT_CLASS = "tippy-content";
|
1692
1785
|
var BACKDROP_CLASS = "tippy-backdrop";
|
@@ -1696,6 +1789,9 @@ var TOUCH_OPTIONS = {
|
|
1696
1789
|
passive: true,
|
1697
1790
|
capture: true
|
1698
1791
|
};
|
1792
|
+
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
|
1793
|
+
return document.body;
|
1794
|
+
};
|
1699
1795
|
function getValueAtIndexOrReturn(value, index, defaultValue) {
|
1700
1796
|
if (Array.isArray(value)) {
|
1701
1797
|
var v = value[index];
|
@@ -1811,10 +1907,13 @@ function setVisibilityState(els, state) {
|
|
1811
1907
|
});
|
1812
1908
|
}
|
1813
1909
|
function getOwnerDocument(elementOrElements) {
|
1910
|
+
var _element$ownerDocumen;
|
1911
|
+
|
1814
1912
|
var _normalizeToArray = normalizeToArray(elementOrElements),
|
1815
|
-
element = _normalizeToArray[0];
|
1913
|
+
element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
|
1914
|
+
|
1816
1915
|
|
1817
|
-
return element
|
1916
|
+
return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
|
1818
1917
|
}
|
1819
1918
|
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
|
1820
1919
|
var clientX = event.clientX,
|
@@ -1850,6 +1949,26 @@ function updateTransitionEndListener(box, action, listener) {
|
|
1850
1949
|
box[method](event, listener);
|
1851
1950
|
});
|
1852
1951
|
}
|
1952
|
+
/**
|
1953
|
+
* Compared to xxx.contains, this function works for dom structures with shadow
|
1954
|
+
* dom
|
1955
|
+
*/
|
1956
|
+
|
1957
|
+
function actualContains(parent, child) {
|
1958
|
+
var target = child;
|
1959
|
+
|
1960
|
+
while (target) {
|
1961
|
+
var _target$getRootNode;
|
1962
|
+
|
1963
|
+
if (parent.contains(target)) {
|
1964
|
+
return true;
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
|
1968
|
+
}
|
1969
|
+
|
1970
|
+
return false;
|
1971
|
+
}
|
1853
1972
|
|
1854
1973
|
var currentInput = {
|
1855
1974
|
isTouch: false
|
@@ -1913,8 +2032,8 @@ function bindGlobalEventListeners() {
|
|
1913
2032
|
}
|
1914
2033
|
|
1915
2034
|
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
1916
|
-
var
|
1917
|
-
|
2035
|
+
var isIE11 = isBrowser ? // @ts-ignore
|
2036
|
+
!!window.msCrypto : false;
|
1918
2037
|
|
1919
2038
|
var pluginProps = {
|
1920
2039
|
animateFill: false,
|
@@ -1934,9 +2053,7 @@ var renderProps = {
|
|
1934
2053
|
zIndex: 9999
|
1935
2054
|
};
|
1936
2055
|
var defaultProps = Object.assign({
|
1937
|
-
appendTo:
|
1938
|
-
return document.body;
|
1939
|
-
},
|
2056
|
+
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
1940
2057
|
aria: {
|
1941
2058
|
content: 'auto',
|
1942
2059
|
expanded: 'auto'
|
@@ -1971,7 +2088,7 @@ var defaultProps = Object.assign({
|
|
1971
2088
|
touch: true,
|
1972
2089
|
trigger: 'mouseenter focus',
|
1973
2090
|
triggerTarget: null
|
1974
|
-
}, pluginProps,
|
2091
|
+
}, pluginProps, renderProps);
|
1975
2092
|
var defaultKeys = Object.keys(defaultProps);
|
1976
2093
|
var setDefaultProps = function setDefaultProps(partialProps) {
|
1977
2094
|
|
@@ -1987,12 +2104,14 @@ function getExtendedPassedProps(passedProps) {
|
|
1987
2104
|
defaultValue = plugin.defaultValue;
|
1988
2105
|
|
1989
2106
|
if (name) {
|
1990
|
-
|
2107
|
+
var _name;
|
2108
|
+
|
2109
|
+
acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
|
1991
2110
|
}
|
1992
2111
|
|
1993
2112
|
return acc;
|
1994
2113
|
}, {});
|
1995
|
-
return Object.assign({}, passedProps,
|
2114
|
+
return Object.assign({}, passedProps, pluginProps);
|
1996
2115
|
}
|
1997
2116
|
function getDataAttributeProps(reference, plugins) {
|
1998
2117
|
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
@@ -2023,7 +2142,7 @@ function evaluateProps(reference, props) {
|
|
2023
2142
|
var out = Object.assign({}, props, {
|
2024
2143
|
content: invokeWithArgsOrReturn(props.content, [reference])
|
2025
2144
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
|
2026
|
-
out.aria = Object.assign({}, defaultProps.aria,
|
2145
|
+
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
2027
2146
|
out.aria = {
|
2028
2147
|
expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
|
2029
2148
|
content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
|
@@ -2161,7 +2280,7 @@ var mouseMoveListeners = []; // Used by `hideAll()`
|
|
2161
2280
|
|
2162
2281
|
var mountedInstances = [];
|
2163
2282
|
function createTippy(reference, passedProps) {
|
2164
|
-
var props = evaluateProps(reference, Object.assign({}, defaultProps,
|
2283
|
+
var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
|
2165
2284
|
// 🔒 Private members
|
2166
2285
|
// ===========================================================================
|
2167
2286
|
|
@@ -2258,10 +2377,9 @@ function createTippy(reference, passedProps) {
|
|
2258
2377
|
instance.clearDelayTimeouts();
|
2259
2378
|
}
|
2260
2379
|
});
|
2261
|
-
popper.addEventListener('mouseleave', function (
|
2380
|
+
popper.addEventListener('mouseleave', function () {
|
2262
2381
|
if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
|
2263
2382
|
getDocument().addEventListener('mousemove', debouncedOnMouseMove);
|
2264
|
-
debouncedOnMouseMove(event);
|
2265
2383
|
}
|
2266
2384
|
});
|
2267
2385
|
return instance; // ===========================================================================
|
@@ -2281,7 +2399,7 @@ function createTippy(reference, passedProps) {
|
|
2281
2399
|
var _instance$props$rende;
|
2282
2400
|
|
2283
2401
|
// @ts-ignore
|
2284
|
-
return !!((_instance$props$rende = instance.props.render)
|
2402
|
+
return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
|
2285
2403
|
}
|
2286
2404
|
|
2287
2405
|
function getCurrentTarget() {
|
@@ -2308,8 +2426,12 @@ function createTippy(reference, passedProps) {
|
|
2308
2426
|
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
|
2309
2427
|
}
|
2310
2428
|
|
2311
|
-
function handleStyles() {
|
2312
|
-
|
2429
|
+
function handleStyles(fromHide) {
|
2430
|
+
if (fromHide === void 0) {
|
2431
|
+
fromHide = false;
|
2432
|
+
}
|
2433
|
+
|
2434
|
+
popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
|
2313
2435
|
popper.style.zIndex = "" + instance.props.zIndex;
|
2314
2436
|
}
|
2315
2437
|
|
@@ -2320,7 +2442,7 @@ function createTippy(reference, passedProps) {
|
|
2320
2442
|
|
2321
2443
|
pluginsHooks.forEach(function (pluginHooks) {
|
2322
2444
|
if (pluginHooks[hook]) {
|
2323
|
-
pluginHooks[hook].apply(
|
2445
|
+
pluginHooks[hook].apply(pluginHooks, args);
|
2324
2446
|
}
|
2325
2447
|
});
|
2326
2448
|
|
@@ -2386,15 +2508,18 @@ function createTippy(reference, passedProps) {
|
|
2386
2508
|
if (didTouchMove || event.type === 'mousedown') {
|
2387
2509
|
return;
|
2388
2510
|
}
|
2389
|
-
}
|
2511
|
+
}
|
2390
2512
|
|
2513
|
+
var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
|
2391
2514
|
|
2392
|
-
if (instance.props.interactive && popper
|
2515
|
+
if (instance.props.interactive && actualContains(popper, actualTarget)) {
|
2393
2516
|
return;
|
2394
2517
|
} // Clicked on the event listeners target
|
2395
2518
|
|
2396
2519
|
|
2397
|
-
if (
|
2520
|
+
if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
|
2521
|
+
return actualContains(el, actualTarget);
|
2522
|
+
})) {
|
2398
2523
|
if (currentInput.isTouch) {
|
2399
2524
|
return;
|
2400
2525
|
}
|
@@ -2522,7 +2647,7 @@ function createTippy(reference, passedProps) {
|
|
2522
2647
|
break;
|
2523
2648
|
|
2524
2649
|
case 'focus':
|
2525
|
-
on(
|
2650
|
+
on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
|
2526
2651
|
break;
|
2527
2652
|
|
2528
2653
|
case 'focusin':
|
@@ -2748,7 +2873,7 @@ function createTippy(reference, passedProps) {
|
|
2748
2873
|
|
2749
2874
|
var node = getCurrentTarget();
|
2750
2875
|
|
2751
|
-
if (instance.props.interactive && appendTo ===
|
2876
|
+
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
|
2752
2877
|
parentNode = node.parentNode;
|
2753
2878
|
} else {
|
2754
2879
|
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
@@ -2760,6 +2885,7 @@ function createTippy(reference, passedProps) {
|
|
2760
2885
|
parentNode.appendChild(popper);
|
2761
2886
|
}
|
2762
2887
|
|
2888
|
+
instance.state.isMounted = true;
|
2763
2889
|
createPopperInstance();
|
2764
2890
|
}
|
2765
2891
|
|
@@ -2857,7 +2983,7 @@ function createTippy(reference, passedProps) {
|
|
2857
2983
|
invokeHook('onBeforeUpdate', [instance, partialProps]);
|
2858
2984
|
removeListeners();
|
2859
2985
|
var prevProps = instance.props;
|
2860
|
-
var nextProps = evaluateProps(reference, Object.assign({},
|
2986
|
+
var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
|
2861
2987
|
ignoreAttributes: true
|
2862
2988
|
}));
|
2863
2989
|
instance.props = nextProps;
|
@@ -2956,6 +3082,8 @@ function createTippy(reference, passedProps) {
|
|
2956
3082
|
}
|
2957
3083
|
|
2958
3084
|
onFirstUpdate = function onFirstUpdate() {
|
3085
|
+
var _instance$popperInsta2;
|
3086
|
+
|
2959
3087
|
if (!instance.state.isVisible || ignoreOnFirstUpdate) {
|
2960
3088
|
return;
|
2961
3089
|
}
|
@@ -2976,8 +3104,10 @@ function createTippy(reference, passedProps) {
|
|
2976
3104
|
|
2977
3105
|
handleAriaContentAttribute();
|
2978
3106
|
handleAriaExpandedAttribute();
|
2979
|
-
pushIfUnique(mountedInstances, instance);
|
2980
|
-
|
3107
|
+
pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
|
3108
|
+
// popper has been positioned for the first time
|
3109
|
+
|
3110
|
+
(_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
|
2981
3111
|
invokeHook('onMount', [instance]);
|
2982
3112
|
|
2983
3113
|
if (instance.props.animation && getIsDefaultRenderFn()) {
|
@@ -3020,7 +3150,7 @@ function createTippy(reference, passedProps) {
|
|
3020
3150
|
|
3021
3151
|
cleanupInteractiveMouseListeners();
|
3022
3152
|
removeDocumentPress();
|
3023
|
-
handleStyles();
|
3153
|
+
handleStyles(true);
|
3024
3154
|
|
3025
3155
|
if (getIsDefaultRenderFn()) {
|
3026
3156
|
var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
|
@@ -3125,16 +3255,58 @@ tippy.defaultProps = defaultProps;
|
|
3125
3255
|
tippy.setDefaultProps = setDefaultProps;
|
3126
3256
|
tippy.currentInput = currentInput;
|
3127
3257
|
|
3258
|
+
// every time the popper is destroyed (i.e. a new target), removing the styles
|
3259
|
+
// and causing transitions to break for singletons when the console is open, but
|
3260
|
+
// most notably for non-transform styles being used, `gpuAcceleration: false`.
|
3261
|
+
|
3262
|
+
var applyStylesModifier = Object.assign({}, applyStyles$1, {
|
3263
|
+
effect: function effect(_ref) {
|
3264
|
+
var state = _ref.state;
|
3265
|
+
var initialStyles = {
|
3266
|
+
popper: {
|
3267
|
+
position: state.options.strategy,
|
3268
|
+
left: '0',
|
3269
|
+
top: '0',
|
3270
|
+
margin: '0'
|
3271
|
+
},
|
3272
|
+
arrow: {
|
3273
|
+
position: 'absolute'
|
3274
|
+
},
|
3275
|
+
reference: {}
|
3276
|
+
};
|
3277
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
3278
|
+
state.styles = initialStyles;
|
3279
|
+
|
3280
|
+
if (state.elements.arrow) {
|
3281
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
3282
|
+
} // intentionally return no cleanup function
|
3283
|
+
// return () => { ... }
|
3284
|
+
|
3285
|
+
}
|
3286
|
+
});
|
3287
|
+
|
3128
3288
|
var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
3289
|
+
var _optionalProps$popper;
|
3290
|
+
|
3129
3291
|
if (optionalProps === void 0) {
|
3130
3292
|
optionalProps = {};
|
3131
3293
|
}
|
3132
3294
|
|
3133
3295
|
var individualInstances = tippyInstances;
|
3134
3296
|
var references = [];
|
3297
|
+
var triggerTargets = [];
|
3135
3298
|
var currentTarget;
|
3136
3299
|
var overrides = optionalProps.overrides;
|
3137
3300
|
var interceptSetPropsCleanups = [];
|
3301
|
+
var shownOnCreate = false;
|
3302
|
+
|
3303
|
+
function setTriggerTargets() {
|
3304
|
+
triggerTargets = individualInstances.map(function (instance) {
|
3305
|
+
return normalizeToArray(instance.props.triggerTarget || instance.reference);
|
3306
|
+
}).reduce(function (acc, item) {
|
3307
|
+
return acc.concat(item);
|
3308
|
+
}, []);
|
3309
|
+
}
|
3138
3310
|
|
3139
3311
|
function setReferences() {
|
3140
3312
|
references = individualInstances.map(function (instance) {
|
@@ -3168,42 +3340,123 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3168
3340
|
instance.setProps = originalSetProps;
|
3169
3341
|
};
|
3170
3342
|
});
|
3343
|
+
} // have to pass singleton, as it maybe undefined on first call
|
3344
|
+
|
3345
|
+
|
3346
|
+
function prepareInstance(singleton, target) {
|
3347
|
+
var index = triggerTargets.indexOf(target); // bail-out
|
3348
|
+
|
3349
|
+
if (target === currentTarget) {
|
3350
|
+
return;
|
3351
|
+
}
|
3352
|
+
|
3353
|
+
currentTarget = target;
|
3354
|
+
var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
|
3355
|
+
acc[prop] = individualInstances[index].props[prop];
|
3356
|
+
return acc;
|
3357
|
+
}, {});
|
3358
|
+
singleton.setProps(Object.assign({}, overrideProps, {
|
3359
|
+
getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
|
3360
|
+
var _references$index;
|
3361
|
+
|
3362
|
+
return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
|
3363
|
+
}
|
3364
|
+
}));
|
3171
3365
|
}
|
3172
3366
|
|
3173
3367
|
enableInstances(false);
|
3174
3368
|
setReferences();
|
3369
|
+
setTriggerTargets();
|
3175
3370
|
var plugin = {
|
3176
3371
|
fn: function fn() {
|
3177
3372
|
return {
|
3178
3373
|
onDestroy: function onDestroy() {
|
3179
3374
|
enableInstances(true);
|
3180
3375
|
},
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
if (
|
3186
|
-
|
3376
|
+
onHidden: function onHidden() {
|
3377
|
+
currentTarget = null;
|
3378
|
+
},
|
3379
|
+
onClickOutside: function onClickOutside(instance) {
|
3380
|
+
if (instance.props.showOnCreate && !shownOnCreate) {
|
3381
|
+
shownOnCreate = true;
|
3382
|
+
currentTarget = null;
|
3187
3383
|
}
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
}
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
}
|
3198
|
-
}));
|
3384
|
+
},
|
3385
|
+
onShow: function onShow(instance) {
|
3386
|
+
if (instance.props.showOnCreate && !shownOnCreate) {
|
3387
|
+
shownOnCreate = true;
|
3388
|
+
prepareInstance(instance, references[0]);
|
3389
|
+
}
|
3390
|
+
},
|
3391
|
+
onTrigger: function onTrigger(instance, event) {
|
3392
|
+
prepareInstance(instance, event.currentTarget);
|
3199
3393
|
}
|
3200
3394
|
};
|
3201
3395
|
}
|
3202
3396
|
};
|
3203
3397
|
var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
|
3204
3398
|
plugins: [plugin].concat(optionalProps.plugins || []),
|
3205
|
-
triggerTarget:
|
3399
|
+
triggerTarget: triggerTargets,
|
3400
|
+
popperOptions: Object.assign({}, optionalProps.popperOptions, {
|
3401
|
+
modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
|
3402
|
+
})
|
3206
3403
|
}));
|
3404
|
+
var originalShow = singleton.show;
|
3405
|
+
|
3406
|
+
singleton.show = function (target) {
|
3407
|
+
originalShow(); // first time, showOnCreate or programmatic call with no params
|
3408
|
+
// default to showing first instance
|
3409
|
+
|
3410
|
+
if (!currentTarget && target == null) {
|
3411
|
+
return prepareInstance(singleton, references[0]);
|
3412
|
+
} // triggered from event (do nothing as prepareInstance already called by onTrigger)
|
3413
|
+
// programmatic call with no params when already visible (do nothing again)
|
3414
|
+
|
3415
|
+
|
3416
|
+
if (currentTarget && target == null) {
|
3417
|
+
return;
|
3418
|
+
} // target is index of instance
|
3419
|
+
|
3420
|
+
|
3421
|
+
if (typeof target === 'number') {
|
3422
|
+
return references[target] && prepareInstance(singleton, references[target]);
|
3423
|
+
} // target is a child tippy instance
|
3424
|
+
|
3425
|
+
|
3426
|
+
if (individualInstances.indexOf(target) >= 0) {
|
3427
|
+
var ref = target.reference;
|
3428
|
+
return prepareInstance(singleton, ref);
|
3429
|
+
} // target is a ReferenceElement
|
3430
|
+
|
3431
|
+
|
3432
|
+
if (references.indexOf(target) >= 0) {
|
3433
|
+
return prepareInstance(singleton, target);
|
3434
|
+
}
|
3435
|
+
};
|
3436
|
+
|
3437
|
+
singleton.showNext = function () {
|
3438
|
+
var first = references[0];
|
3439
|
+
|
3440
|
+
if (!currentTarget) {
|
3441
|
+
return singleton.show(0);
|
3442
|
+
}
|
3443
|
+
|
3444
|
+
var index = references.indexOf(currentTarget);
|
3445
|
+
singleton.show(references[index + 1] || first);
|
3446
|
+
};
|
3447
|
+
|
3448
|
+
singleton.showPrevious = function () {
|
3449
|
+
var last = references[references.length - 1];
|
3450
|
+
|
3451
|
+
if (!currentTarget) {
|
3452
|
+
return singleton.show(last);
|
3453
|
+
}
|
3454
|
+
|
3455
|
+
var index = references.indexOf(currentTarget);
|
3456
|
+
var target = references[index - 1] || last;
|
3457
|
+
singleton.show(target);
|
3458
|
+
};
|
3459
|
+
|
3207
3460
|
var originalSetProps = singleton.setProps;
|
3208
3461
|
|
3209
3462
|
singleton.setProps = function (props) {
|
@@ -3219,9 +3472,10 @@ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
|
|
3219
3472
|
individualInstances = nextInstances;
|
3220
3473
|
enableInstances(false);
|
3221
3474
|
setReferences();
|
3222
|
-
|
3475
|
+
setTriggerTargets();
|
3476
|
+
interceptSetPropsCleanups = interceptSetProps(singleton);
|
3223
3477
|
singleton.setProps({
|
3224
|
-
triggerTarget:
|
3478
|
+
triggerTarget: triggerTargets
|
3225
3479
|
});
|
3226
3480
|
};
|
3227
3481
|
|
@@ -3236,7 +3490,7 @@ var animateFill = {
|
|
3236
3490
|
var _instance$props$rende;
|
3237
3491
|
|
3238
3492
|
// @ts-ignore
|
3239
|
-
if (!((_instance$props$rende = instance.props.render)
|
3493
|
+
if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
|
3240
3494
|
|
3241
3495
|
return {};
|
3242
3496
|
}
|
@@ -3358,6 +3612,7 @@ var followCursor = {
|
|
3358
3612
|
|
3359
3613
|
if (isCursorOverReference || !instance.props.interactive) {
|
3360
3614
|
instance.setProps({
|
3615
|
+
// @ts-ignore - unneeded DOMRect properties
|
3361
3616
|
getReferenceClientRect: function getReferenceClientRect() {
|
3362
3617
|
var rect = reference.getBoundingClientRect();
|
3363
3618
|
var x = clientX;
|
@@ -3494,6 +3749,7 @@ var inlinePositioning = {
|
|
3494
3749
|
var placement;
|
3495
3750
|
var cursorRectIndex = -1;
|
3496
3751
|
var isInternalUpdate = false;
|
3752
|
+
var triedPlacements = [];
|
3497
3753
|
var modifier = {
|
3498
3754
|
name: 'tippyInlinePositioning',
|
3499
3755
|
enabled: true,
|
@@ -3502,8 +3758,14 @@ var inlinePositioning = {
|
|
3502
3758
|
var state = _ref2.state;
|
3503
3759
|
|
3504
3760
|
if (isEnabled()) {
|
3505
|
-
if (placement !==
|
3761
|
+
if (triedPlacements.indexOf(state.placement) !== -1) {
|
3762
|
+
triedPlacements = [];
|
3763
|
+
}
|
3764
|
+
|
3765
|
+
if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
|
3766
|
+
triedPlacements.push(state.placement);
|
3506
3767
|
instance.setProps({
|
3768
|
+
// @ts-ignore - unneeded DOMRect properties
|
3507
3769
|
getReferenceClientRect: function getReferenceClientRect() {
|
3508
3770
|
return _getReferenceClientRect(state.placement);
|
3509
3771
|
}
|
@@ -3540,10 +3802,11 @@ var inlinePositioning = {
|
|
3540
3802
|
var cursorRect = rects.find(function (rect) {
|
3541
3803
|
return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
|
3542
3804
|
});
|
3543
|
-
|
3805
|
+
var index = rects.indexOf(cursorRect);
|
3806
|
+
cursorRectIndex = index > -1 ? index : cursorRectIndex;
|
3544
3807
|
}
|
3545
3808
|
},
|
3546
|
-
|
3809
|
+
onHidden: function onHidden() {
|
3547
3810
|
cursorRectIndex = -1;
|
3548
3811
|
}
|
3549
3812
|
};
|
@@ -3687,51 +3950,103 @@ tippy.setDefaultProps({
|
|
3687
3950
|
},
|
3688
3951
|
});
|
3689
3952
|
function useTippy(el, opts = {}, settings = { mount: true }) {
|
3690
|
-
const
|
3953
|
+
const vm = vue.getCurrentInstance();
|
3954
|
+
const instance = vue.ref();
|
3955
|
+
const state = vue.ref({
|
3956
|
+
isEnabled: false,
|
3957
|
+
isVisible: false,
|
3958
|
+
isDestroyed: false,
|
3959
|
+
isMounted: false,
|
3960
|
+
isShown: false,
|
3961
|
+
});
|
3691
3962
|
let container = null;
|
3692
3963
|
const getContainer = () => {
|
3693
3964
|
if (container)
|
3694
3965
|
return container;
|
3695
|
-
container = document.
|
3966
|
+
container = document.createDocumentFragment();
|
3696
3967
|
return container;
|
3697
3968
|
};
|
3698
3969
|
const getContent = (content) => {
|
3699
3970
|
let newContent;
|
3700
|
-
let unwrappedContent =
|
3971
|
+
let unwrappedContent = vue.isRef(content)
|
3701
3972
|
? content.value
|
3702
3973
|
: content;
|
3703
|
-
if (
|
3704
|
-
|
3705
|
-
|
3706
|
-
}
|
3707
|
-
else {
|
3708
|
-
if (vueDemi.isVNode(unwrappedContent)) {
|
3709
|
-
vueDemi.render(unwrappedContent, getContainer());
|
3710
|
-
newContent = () => getContainer();
|
3974
|
+
if (vue.isVNode(unwrappedContent)) {
|
3975
|
+
if (vm) {
|
3976
|
+
unwrappedContent.appContext = vm.appContext;
|
3711
3977
|
}
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
|
3717
|
-
|
3978
|
+
vue.render(unwrappedContent, getContainer());
|
3979
|
+
newContent = () => getContainer();
|
3980
|
+
}
|
3981
|
+
else if (typeof unwrappedContent === 'object') {
|
3982
|
+
let comp = vue.h(unwrappedContent);
|
3983
|
+
if (vm) {
|
3984
|
+
comp.appContext = vm.appContext;
|
3718
3985
|
}
|
3986
|
+
vue.render(comp, getContainer());
|
3987
|
+
newContent = () => getContainer();
|
3988
|
+
}
|
3989
|
+
else {
|
3990
|
+
newContent = unwrappedContent;
|
3719
3991
|
}
|
3720
3992
|
return newContent;
|
3721
3993
|
};
|
3722
3994
|
const getProps = (opts) => {
|
3723
3995
|
let options = {};
|
3724
|
-
if (
|
3725
|
-
options = opts.value;
|
3996
|
+
if (vue.isRef(opts)) {
|
3997
|
+
options = opts.value || {};
|
3726
3998
|
}
|
3727
|
-
else if (
|
3999
|
+
else if (vue.isReactive(opts)) {
|
3728
4000
|
options = { ...opts };
|
3729
4001
|
}
|
3730
4002
|
else {
|
3731
4003
|
options = { ...opts };
|
3732
4004
|
}
|
3733
|
-
if (options.content)
|
4005
|
+
if (options.content) {
|
3734
4006
|
options.content = getContent(options.content);
|
4007
|
+
}
|
4008
|
+
if (options.triggerTarget) {
|
4009
|
+
options.triggerTarget = vue.isRef(options.triggerTarget)
|
4010
|
+
? options.triggerTarget.value
|
4011
|
+
: options.triggerTarget;
|
4012
|
+
}
|
4013
|
+
if (!options.plugins || !Array.isArray(options.plugins)) {
|
4014
|
+
options.plugins = [];
|
4015
|
+
}
|
4016
|
+
options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
|
4017
|
+
options.plugins.push({
|
4018
|
+
name: 'vueTippyReactiveState',
|
4019
|
+
fn: () => {
|
4020
|
+
return {
|
4021
|
+
onCreate() {
|
4022
|
+
state.value.isEnabled = true;
|
4023
|
+
},
|
4024
|
+
onMount() {
|
4025
|
+
state.value.isMounted = true;
|
4026
|
+
},
|
4027
|
+
onShow() {
|
4028
|
+
state.value.isMounted = true;
|
4029
|
+
state.value.isVisible = true;
|
4030
|
+
},
|
4031
|
+
onShown() {
|
4032
|
+
state.value.isShown = true;
|
4033
|
+
},
|
4034
|
+
onHide() {
|
4035
|
+
state.value.isMounted = false;
|
4036
|
+
state.value.isVisible = false;
|
4037
|
+
},
|
4038
|
+
onHidden() {
|
4039
|
+
state.value.isShown = false;
|
4040
|
+
},
|
4041
|
+
onUnmounted() {
|
4042
|
+
state.value.isMounted = false;
|
4043
|
+
},
|
4044
|
+
onDestroy() {
|
4045
|
+
state.value.isDestroyed = true;
|
4046
|
+
},
|
4047
|
+
};
|
4048
|
+
}
|
4049
|
+
});
|
3735
4050
|
return options;
|
3736
4051
|
};
|
3737
4052
|
const refresh = () => {
|
@@ -3770,10 +4085,12 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
3770
4085
|
const disable = () => {
|
3771
4086
|
var _a;
|
3772
4087
|
(_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
|
4088
|
+
state.value.isEnabled = false;
|
3773
4089
|
};
|
3774
4090
|
const enable = () => {
|
3775
4091
|
var _a;
|
3776
4092
|
(_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
|
4093
|
+
state.value.isEnabled = true;
|
3777
4094
|
};
|
3778
4095
|
const unmount = () => {
|
3779
4096
|
var _a;
|
@@ -3782,7 +4099,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
3782
4099
|
const mount = () => {
|
3783
4100
|
if (!el)
|
3784
4101
|
return;
|
3785
|
-
let target =
|
4102
|
+
let target = vue.isRef(el) ? el.value : el;
|
3786
4103
|
if (typeof target === 'function')
|
3787
4104
|
target = target();
|
3788
4105
|
if (target) {
|
@@ -3804,17 +4121,17 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
3804
4121
|
enable,
|
3805
4122
|
unmount,
|
3806
4123
|
mount,
|
4124
|
+
state,
|
3807
4125
|
};
|
3808
4126
|
if (settings.mount) {
|
3809
|
-
const vm = vueDemi.getCurrentInstance();
|
3810
4127
|
if (vm) {
|
3811
4128
|
if (vm.isMounted) {
|
3812
4129
|
mount();
|
3813
4130
|
}
|
3814
4131
|
else {
|
3815
|
-
|
4132
|
+
vue.onMounted(mount);
|
3816
4133
|
}
|
3817
|
-
|
4134
|
+
vue.onUnmounted(() => {
|
3818
4135
|
destroy();
|
3819
4136
|
});
|
3820
4137
|
}
|
@@ -3822,21 +4139,179 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
|
|
3822
4139
|
mount();
|
3823
4140
|
}
|
3824
4141
|
}
|
3825
|
-
if (
|
3826
|
-
|
4142
|
+
if (vue.isRef(opts) || vue.isReactive(opts)) {
|
4143
|
+
vue.watch(opts, refresh, { immediate: false });
|
3827
4144
|
}
|
3828
|
-
else if (
|
3829
|
-
|
4145
|
+
else if (vue.isRef(opts.content)) {
|
4146
|
+
vue.watch(opts.content, refreshContent, { immediate: false });
|
3830
4147
|
}
|
3831
4148
|
return response;
|
3832
4149
|
}
|
3833
4150
|
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
4151
|
+
function useTippyComponent(opts = {}, children) {
|
4152
|
+
const instance = vue.ref();
|
4153
|
+
return {
|
4154
|
+
instance,
|
4155
|
+
TippyComponent: vue.h(TippyComponent, {
|
4156
|
+
...opts,
|
4157
|
+
onVnodeMounted: (vnode) => {
|
4158
|
+
//@ts-ignore
|
4159
|
+
instance.value = vnode.component.ctx;
|
4160
|
+
},
|
4161
|
+
}, children),
|
4162
|
+
};
|
4163
|
+
}
|
4164
|
+
|
4165
|
+
function useSingleton(instances, optionalProps) {
|
4166
|
+
const singleton = vue.ref();
|
4167
|
+
vue.onMounted(() => {
|
4168
|
+
const pendingTippyInstances = Array.isArray(instances)
|
4169
|
+
? instances.map(i => i.value)
|
4170
|
+
: typeof instances === 'function'
|
4171
|
+
? instances()
|
4172
|
+
: instances.value;
|
4173
|
+
const tippyInstances = pendingTippyInstances
|
4174
|
+
.map((instance) => {
|
4175
|
+
if (instance instanceof Element) {
|
4176
|
+
//@ts-ignore
|
4177
|
+
return instance._tippy;
|
4178
|
+
}
|
4179
|
+
return instance;
|
4180
|
+
})
|
4181
|
+
.filter(Boolean);
|
4182
|
+
singleton.value = createSingleton(tippyInstances, optionalProps
|
4183
|
+
? { allowHTML: true, ...optionalProps }
|
4184
|
+
: { allowHTML: true });
|
4185
|
+
});
|
4186
|
+
return {
|
4187
|
+
singleton,
|
4188
|
+
};
|
4189
|
+
}
|
4190
|
+
|
4191
|
+
const TippyComponent = vue.defineComponent({
|
4192
|
+
props: {
|
4193
|
+
to: {
|
4194
|
+
type: [String, Function],
|
4195
|
+
},
|
4196
|
+
tag: {
|
4197
|
+
type: String,
|
4198
|
+
default: 'span'
|
4199
|
+
},
|
4200
|
+
contentTag: {
|
4201
|
+
type: String,
|
4202
|
+
default: 'span'
|
4203
|
+
},
|
4204
|
+
contentClass: {
|
4205
|
+
type: String,
|
4206
|
+
default: null
|
4207
|
+
},
|
4208
|
+
appendTo: { default: () => tippy.defaultProps['appendTo'] },
|
4209
|
+
aria: { default: () => tippy.defaultProps['aria'] },
|
4210
|
+
delay: { default: () => tippy.defaultProps['delay'] },
|
4211
|
+
duration: { default: () => tippy.defaultProps['duration'] },
|
4212
|
+
getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
|
4213
|
+
hideOnClick: { type: [Boolean, String], default: () => tippy.defaultProps['hideOnClick'] },
|
4214
|
+
ignoreAttributes: { type: Boolean, default: () => tippy.defaultProps['ignoreAttributes'] },
|
4215
|
+
interactive: { type: Boolean, default: () => tippy.defaultProps['interactive'] },
|
4216
|
+
interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
|
4217
|
+
interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
|
4218
|
+
moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
|
4219
|
+
offset: { default: () => tippy.defaultProps['offset'] },
|
4220
|
+
onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
|
4221
|
+
onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
|
4222
|
+
onCreate: { default: () => tippy.defaultProps['onCreate'] },
|
4223
|
+
onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
|
4224
|
+
onHidden: { default: () => tippy.defaultProps['onHidden'] },
|
4225
|
+
onHide: { default: () => tippy.defaultProps['onHide'] },
|
4226
|
+
onMount: { default: () => tippy.defaultProps['onMount'] },
|
4227
|
+
onShow: { default: () => tippy.defaultProps['onShow'] },
|
4228
|
+
onShown: { default: () => tippy.defaultProps['onShown'] },
|
4229
|
+
onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
|
4230
|
+
onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
|
4231
|
+
onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
|
4232
|
+
placement: { default: () => tippy.defaultProps['placement'] },
|
4233
|
+
plugins: { default: () => tippy.defaultProps['plugins'] },
|
4234
|
+
popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
|
4235
|
+
render: { default: () => tippy.defaultProps['render'] },
|
4236
|
+
showOnCreate: { type: Boolean, default: () => tippy.defaultProps['showOnCreate'] },
|
4237
|
+
touch: { type: [Boolean, String, Array], default: () => tippy.defaultProps['touch'] },
|
4238
|
+
trigger: { default: () => tippy.defaultProps['trigger'] },
|
4239
|
+
triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
|
4240
|
+
animateFill: { type: Boolean, default: () => tippy.defaultProps['animateFill'] },
|
4241
|
+
followCursor: { type: [Boolean, String], default: () => tippy.defaultProps['followCursor'] },
|
4242
|
+
inlinePositioning: { type: Boolean, default: () => tippy.defaultProps['inlinePositioning'] },
|
4243
|
+
sticky: { type: [Boolean, String], default: () => tippy.defaultProps['sticky'] },
|
4244
|
+
allowHTML: { type: Boolean, default: () => tippy.defaultProps['allowHTML'] },
|
4245
|
+
animation: { default: () => tippy.defaultProps['animation'] },
|
4246
|
+
arrow: { default: () => tippy.defaultProps['arrow'] },
|
4247
|
+
content: { default: () => tippy.defaultProps['content'] },
|
4248
|
+
inertia: { default: () => tippy.defaultProps['inertia'] },
|
4249
|
+
maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
|
4250
|
+
role: { default: () => tippy.defaultProps['role'] },
|
4251
|
+
theme: { default: () => tippy.defaultProps['theme'] },
|
4252
|
+
zIndex: { default: () => tippy.defaultProps['zIndex'] }
|
4253
|
+
},
|
4254
|
+
emits: ['state'],
|
4255
|
+
setup(props, { slots, emit, expose }) {
|
4256
|
+
const elem = vue.ref();
|
4257
|
+
const contentElem = vue.ref();
|
4258
|
+
const mounted = vue.ref(false);
|
4259
|
+
const getOptions = () => {
|
4260
|
+
let options = { ...props };
|
4261
|
+
for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
|
4262
|
+
if (options.hasOwnProperty(prop)) {
|
4263
|
+
// @ts-ignore
|
4264
|
+
delete options[prop];
|
4265
|
+
}
|
4266
|
+
}
|
4267
|
+
return options;
|
4268
|
+
};
|
4269
|
+
let target = elem;
|
4270
|
+
if (props.to) {
|
4271
|
+
if (typeof Element !== 'undefined' && props.to instanceof Element) {
|
4272
|
+
target = () => props.to;
|
4273
|
+
}
|
4274
|
+
else if (typeof props.to === 'string' || props.to instanceof String) {
|
4275
|
+
target = () => document.querySelector(props.to);
|
4276
|
+
}
|
4277
|
+
}
|
4278
|
+
const tippy = useTippy(target, getOptions());
|
4279
|
+
vue.onMounted(() => {
|
4280
|
+
mounted.value = true;
|
4281
|
+
vue.nextTick(() => {
|
4282
|
+
if (slots.content)
|
4283
|
+
tippy.setContent(() => contentElem.value);
|
4284
|
+
});
|
4285
|
+
});
|
4286
|
+
vue.watch(tippy.state, () => {
|
4287
|
+
emit('state', vue.unref(tippy.state));
|
4288
|
+
}, { immediate: true, deep: true });
|
4289
|
+
vue.watch(() => props, () => {
|
4290
|
+
tippy.setProps(getOptions());
|
4291
|
+
if (slots.content)
|
4292
|
+
tippy.setContent(() => contentElem.value);
|
4293
|
+
}, { deep: true });
|
4294
|
+
let exposed = vue.reactive({
|
4295
|
+
elem,
|
4296
|
+
contentElem,
|
4297
|
+
mounted,
|
4298
|
+
...tippy
|
4299
|
+
});
|
4300
|
+
expose(exposed);
|
4301
|
+
return () => {
|
4302
|
+
const slot = slots.default ? slots.default(exposed) : [];
|
4303
|
+
return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
|
4304
|
+
slot,
|
4305
|
+
vue.h(props.contentTag, {
|
4306
|
+
ref: contentElem,
|
4307
|
+
style: { display: mounted.value ? 'inherit' : 'none' },
|
4308
|
+
class: props.contentClass
|
4309
|
+
}, slots.content(exposed)),
|
4310
|
+
] : slot);
|
4311
|
+
};
|
4312
|
+
},
|
4313
|
+
});
|
4314
|
+
|
3840
4315
|
const booleanProps = [
|
3841
4316
|
'a11y',
|
3842
4317
|
'allowHTML',
|
@@ -3871,22 +4346,40 @@ Object.keys(tippy.defaultProps).forEach((prop) => {
|
|
3871
4346
|
};
|
3872
4347
|
}
|
3873
4348
|
});
|
3874
|
-
const
|
4349
|
+
const TippySingleton = vue.defineComponent({
|
3875
4350
|
props,
|
3876
4351
|
setup(props) {
|
3877
|
-
const
|
3878
|
-
const
|
3879
|
-
return {
|
4352
|
+
const instances = vue.ref([]);
|
4353
|
+
const { singleton } = useSingleton(instances, props);
|
4354
|
+
return { instances, singleton };
|
4355
|
+
},
|
4356
|
+
mounted() {
|
4357
|
+
var _a;
|
4358
|
+
const parent = this.$el.parentElement;
|
4359
|
+
const elements = parent.querySelectorAll('[data-v-tippy]');
|
4360
|
+
this.instances = Array.from(elements)
|
4361
|
+
.map((el) => el._tippy)
|
4362
|
+
.filter(Boolean);
|
4363
|
+
(_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
|
3880
4364
|
},
|
3881
4365
|
render() {
|
3882
4366
|
let slot = this.$slots.default ? this.$slots.default() : [];
|
3883
|
-
return
|
4367
|
+
return vue.h(() => slot);
|
3884
4368
|
},
|
3885
4369
|
});
|
3886
4370
|
|
3887
4371
|
const directive = {
|
3888
4372
|
mounted(el, binding, vnode) {
|
3889
|
-
const opts = binding.value || {};
|
4373
|
+
const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
|
4374
|
+
const modifiers = Object.keys(binding.modifiers || {});
|
4375
|
+
const placement = modifiers.find(modifier => modifier !== 'arrow');
|
4376
|
+
const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
|
4377
|
+
if (placement) {
|
4378
|
+
opts.placement = opts.placement || placement;
|
4379
|
+
}
|
4380
|
+
if (withArrow) {
|
4381
|
+
opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
|
4382
|
+
}
|
3890
4383
|
if (vnode.props && vnode.props.onTippyShow) {
|
3891
4384
|
opts.onShow = function (...args) {
|
3892
4385
|
var _a;
|
@@ -3935,7 +4428,7 @@ const directive = {
|
|
3935
4428
|
}
|
3936
4429
|
},
|
3937
4430
|
updated(el, binding) {
|
3938
|
-
const opts = binding.value || {};
|
4431
|
+
const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
|
3939
4432
|
if (el.getAttribute('title') && !opts.content) {
|
3940
4433
|
opts.content = el.getAttribute('title');
|
3941
4434
|
el.removeAttribute('title');
|
@@ -3957,70 +4450,24 @@ const plugin = {
|
|
3957
4450
|
tippy.setDefaultProps(options.defaultProps || {});
|
3958
4451
|
app.directive(options.directive || 'tippy', directive);
|
3959
4452
|
app.component(options.component || 'tippy', TippyComponent);
|
4453
|
+
app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
|
3960
4454
|
},
|
3961
4455
|
};
|
3962
4456
|
|
3963
|
-
function useSingleton(instances, optionalProps) {
|
3964
|
-
const singleton = vueDemi.ref();
|
3965
|
-
vueDemi.onMounted(() => {
|
3966
|
-
const pendingTippyInstances = Array.isArray(instances)
|
3967
|
-
? instances.map(i => i.value)
|
3968
|
-
: instances.value;
|
3969
|
-
const tippyInstances = pendingTippyInstances
|
3970
|
-
.map((instance) => {
|
3971
|
-
if (instance instanceof Element) {
|
3972
|
-
//@ts-ignore
|
3973
|
-
return instance._tippy;
|
3974
|
-
}
|
3975
|
-
return instance;
|
3976
|
-
})
|
3977
|
-
.filter(Boolean);
|
3978
|
-
singleton.value = createSingleton(tippyInstances, optionalProps);
|
3979
|
-
});
|
3980
|
-
return {
|
3981
|
-
singleton,
|
3982
|
-
};
|
3983
|
-
}
|
3984
|
-
|
3985
|
-
function styleInject(css, ref) {
|
3986
|
-
if ( ref === void 0 ) ref = {};
|
3987
|
-
var insertAt = ref.insertAt;
|
3988
|
-
|
3989
|
-
if (!css || typeof document === 'undefined') { return; }
|
3990
|
-
|
3991
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
3992
|
-
var style = document.createElement('style');
|
3993
|
-
style.type = 'text/css';
|
3994
|
-
|
3995
|
-
if (insertAt === 'top') {
|
3996
|
-
if (head.firstChild) {
|
3997
|
-
head.insertBefore(style, head.firstChild);
|
3998
|
-
} else {
|
3999
|
-
head.appendChild(style);
|
4000
|
-
}
|
4001
|
-
} else {
|
4002
|
-
head.appendChild(style);
|
4003
|
-
}
|
4004
|
-
|
4005
|
-
if (style.styleSheet) {
|
4006
|
-
style.styleSheet.cssText = css;
|
4007
|
-
} else {
|
4008
|
-
style.appendChild(document.createTextNode(css));
|
4009
|
-
}
|
4010
|
-
}
|
4011
|
-
|
4012
|
-
var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:\"\";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}";
|
4013
|
-
styleInject(css_248z);
|
4014
|
-
|
4015
4457
|
const setDefaultProps$1 = tippy.setDefaultProps;
|
4016
4458
|
setDefaultProps$1({
|
4459
|
+
ignoreAttributes: true,
|
4017
4460
|
plugins: [sticky, inlinePositioning, followCursor, animateFill],
|
4018
4461
|
});
|
4019
4462
|
|
4020
4463
|
exports.Tippy = TippyComponent;
|
4464
|
+
exports.TippySingleton = TippySingleton;
|
4021
4465
|
exports.default = plugin;
|
4022
4466
|
exports.directive = directive;
|
4467
|
+
exports.plugin = plugin;
|
4468
|
+
exports.roundArrow = ROUND_ARROW;
|
4023
4469
|
exports.setDefaultProps = setDefaultProps$1;
|
4024
4470
|
exports.tippy = tippy;
|
4025
4471
|
exports.useSingleton = useSingleton;
|
4026
4472
|
exports.useTippy = useTippy;
|
4473
|
+
exports.useTippyComponent = useTippyComponent;
|