vrembem 1.37.0 → 1.40.1
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/dev/scripts.esm.js +176 -89
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +176 -89
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.js +172 -89
- package/dev/scripts.modern.js.map +1 -1
- package/dev/scripts.umd.js +176 -89
- package/dev/scripts.umd.js.map +1 -1
- package/dev/styles.css +47 -196
- package/dev/styles.css.map +1 -1
- package/dist/scripts.esm.js +1 -1
- package/dist/scripts.esm.js.map +1 -1
- package/dist/scripts.js +1 -1
- package/dist/scripts.js.map +1 -1
- package/dist/scripts.modern.js +1 -1
- package/dist/scripts.modern.js.map +1 -1
- package/dist/scripts.umd.js +1 -1
- package/dist/scripts.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/index.scss +0 -1
- package/package.json +26 -27
package/dev/scripts.modern.js
CHANGED
|
@@ -329,14 +329,6 @@ const closeTransition = (el, settings) => {
|
|
|
329
329
|
});
|
|
330
330
|
};
|
|
331
331
|
|
|
332
|
-
const breakpoints = {
|
|
333
|
-
xs: '480px',
|
|
334
|
-
sm: '620px',
|
|
335
|
-
md: '760px',
|
|
336
|
-
lg: '990px',
|
|
337
|
-
xl: '1380px'
|
|
338
|
-
};
|
|
339
|
-
|
|
340
332
|
var index = {
|
|
341
333
|
__proto__: null,
|
|
342
334
|
setInert: setInert,
|
|
@@ -354,8 +346,7 @@ var index = {
|
|
|
354
346
|
removeClass: removeClass,
|
|
355
347
|
toggleClass: toggleClass,
|
|
356
348
|
openTransition: openTransition,
|
|
357
|
-
closeTransition: closeTransition
|
|
358
|
-
breakpoints: breakpoints
|
|
349
|
+
closeTransition: closeTransition
|
|
359
350
|
};
|
|
360
351
|
|
|
361
352
|
function _extends() {
|
|
@@ -456,7 +447,7 @@ var defaults$2 = {
|
|
|
456
447
|
selectorInert: null,
|
|
457
448
|
selectorOverflow: null,
|
|
458
449
|
// Feature toggles
|
|
459
|
-
breakpoints:
|
|
450
|
+
breakpoints: null,
|
|
460
451
|
customEventPrefix: 'drawer:',
|
|
461
452
|
eventListeners: true,
|
|
462
453
|
stateSave: true,
|
|
@@ -510,6 +501,7 @@ class Breakpoint {
|
|
|
510
501
|
constructor(parent) {
|
|
511
502
|
this.mediaQueryLists = [];
|
|
512
503
|
this.parent = parent;
|
|
504
|
+
this.prefix = this.getVariablePrefix();
|
|
513
505
|
this.__check = this.check.bind(this);
|
|
514
506
|
}
|
|
515
507
|
|
|
@@ -518,7 +510,7 @@ class Breakpoint {
|
|
|
518
510
|
drawers.forEach(drawer => {
|
|
519
511
|
const id = drawer.getAttribute(`data-${this.parent.settings.dataDrawer}`);
|
|
520
512
|
const key = drawer.getAttribute(`data-${this.parent.settings.dataBreakpoint}`);
|
|
521
|
-
const bp = this.
|
|
513
|
+
const bp = this.getBreakpoint(key);
|
|
522
514
|
const mql = window.matchMedia('(min-width:' + bp + ')');
|
|
523
515
|
this.match(mql, drawer);
|
|
524
516
|
mql.addEventListener('change', this.__check);
|
|
@@ -563,6 +555,25 @@ class Breakpoint {
|
|
|
563
555
|
}
|
|
564
556
|
}
|
|
565
557
|
|
|
558
|
+
getBreakpoint(key) {
|
|
559
|
+
let breakpoint = key;
|
|
560
|
+
|
|
561
|
+
if (this.parent.settings.breakpoints && this.parent.settings.breakpoints[key]) {
|
|
562
|
+
breakpoint = this.parent.settings.breakpoints[key];
|
|
563
|
+
} else if (getComputedStyle(document.body).getPropertyValue(this.prefix + key)) {
|
|
564
|
+
breakpoint = getComputedStyle(document.body).getPropertyValue(this.prefix + key);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return breakpoint;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
getVariablePrefix() {
|
|
571
|
+
let prefix = '--';
|
|
572
|
+
prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
|
|
573
|
+
prefix += 'breakpoint-';
|
|
574
|
+
return prefix;
|
|
575
|
+
}
|
|
576
|
+
|
|
566
577
|
}
|
|
567
578
|
|
|
568
579
|
function handlerClick$2(event) {
|
|
@@ -1101,7 +1112,12 @@ function hide$2(popover, obj) {
|
|
|
1101
1112
|
const index = obj.collection.findIndex(item => {
|
|
1102
1113
|
return item.target === popover.target;
|
|
1103
1114
|
});
|
|
1104
|
-
obj.collection[index].state = 'hide'; //
|
|
1115
|
+
obj.collection[index].state = 'hide'; // Clear the memory if popover trigger matches the ones saved in memory
|
|
1116
|
+
|
|
1117
|
+
if (popover.trigger === obj.memory.trigger) {
|
|
1118
|
+
obj.memory.trigger = null;
|
|
1119
|
+
} // Return the popover
|
|
1120
|
+
|
|
1105
1121
|
|
|
1106
1122
|
return popover;
|
|
1107
1123
|
}
|
|
@@ -1115,7 +1131,9 @@ function hideAll(obj) {
|
|
|
1115
1131
|
return obj.collection;
|
|
1116
1132
|
}
|
|
1117
1133
|
function hideCheck(popover, obj) {
|
|
1118
|
-
//
|
|
1134
|
+
// Only run hideCheck if provided popover is currently open
|
|
1135
|
+
if (popover.state != 'show') return; // Needed to correctly check which element is currently being focused
|
|
1136
|
+
|
|
1119
1137
|
setTimeout(() => {
|
|
1120
1138
|
// Check if trigger or target are being hovered
|
|
1121
1139
|
const isHovered = popover.target.closest(':hover') === popover.target || popover.trigger.closest(':hover') === popover.trigger; // Check if trigger or target are being focused
|
|
@@ -1147,7 +1165,8 @@ function getConfig(el, settings) {
|
|
|
1147
1165
|
|
|
1148
1166
|
for (const prop in config) {
|
|
1149
1167
|
// Get the CSS variable property values
|
|
1150
|
-
const
|
|
1168
|
+
const prefix = getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
|
|
1169
|
+
const val = styles.getPropertyValue(`--${prefix}popover-${prop}`).trim(); // If a value was found, replace the default in config obj
|
|
1151
1170
|
|
|
1152
1171
|
if (val) {
|
|
1153
1172
|
config[prop] = val;
|
|
@@ -1280,13 +1299,29 @@ function handlerClick(popover) {
|
|
|
1280
1299
|
if (popover.target.classList.contains(this.settings.stateActive)) {
|
|
1281
1300
|
hide$2(popover, this);
|
|
1282
1301
|
} else {
|
|
1302
|
+
this.memory.trigger = popover.trigger;
|
|
1283
1303
|
show(popover, this);
|
|
1284
1304
|
documentClick(popover, this);
|
|
1285
1305
|
}
|
|
1286
1306
|
}
|
|
1287
1307
|
function handlerKeydown(event) {
|
|
1288
|
-
|
|
1289
|
-
|
|
1308
|
+
switch (event.key) {
|
|
1309
|
+
case 'Escape':
|
|
1310
|
+
if (this.memory.trigger) {
|
|
1311
|
+
this.memory.trigger.focus();
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
hideAll(this);
|
|
1315
|
+
return;
|
|
1316
|
+
|
|
1317
|
+
case 'Tab':
|
|
1318
|
+
this.collection.forEach(popover => {
|
|
1319
|
+
hideCheck(popover, this);
|
|
1320
|
+
});
|
|
1321
|
+
return;
|
|
1322
|
+
|
|
1323
|
+
default:
|
|
1324
|
+
return;
|
|
1290
1325
|
}
|
|
1291
1326
|
}
|
|
1292
1327
|
function documentClick(popover, obj) {
|
|
@@ -1464,29 +1499,32 @@ function getBasePlacement(placement) {
|
|
|
1464
1499
|
return placement.split('-')[0];
|
|
1465
1500
|
}
|
|
1466
1501
|
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1502
|
+
var max = Math.max;
|
|
1503
|
+
var min = Math.min;
|
|
1504
|
+
var round = Math.round;
|
|
1505
|
+
|
|
1506
|
+
function getBoundingClientRect(element, includeScale) {
|
|
1507
|
+
if (includeScale === void 0) {
|
|
1508
|
+
includeScale = false;
|
|
1509
|
+
}
|
|
1470
1510
|
|
|
1471
1511
|
var rect = element.getBoundingClientRect();
|
|
1472
1512
|
var scaleX = 1;
|
|
1473
|
-
var scaleY = 1;
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
// }
|
|
1489
|
-
// }
|
|
1513
|
+
var scaleY = 1;
|
|
1514
|
+
|
|
1515
|
+
if (isHTMLElement(element) && includeScale) {
|
|
1516
|
+
var offsetHeight = element.offsetHeight;
|
|
1517
|
+
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
|
1518
|
+
// Fallback to 1 in case both values are `0`
|
|
1519
|
+
|
|
1520
|
+
if (offsetWidth > 0) {
|
|
1521
|
+
scaleX = round(rect.width) / offsetWidth || 1;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
if (offsetHeight > 0) {
|
|
1525
|
+
scaleY = round(rect.height) / offsetHeight || 1;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1490
1528
|
|
|
1491
1529
|
return {
|
|
1492
1530
|
width: rect.width / scaleX,
|
|
@@ -1641,13 +1679,13 @@ function getMainAxisFromPlacement(placement) {
|
|
|
1641
1679
|
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
1642
1680
|
}
|
|
1643
1681
|
|
|
1644
|
-
var max = Math.max;
|
|
1645
|
-
var min = Math.min;
|
|
1646
|
-
var round = Math.round;
|
|
1647
|
-
|
|
1648
1682
|
function within(min$1, value, max$1) {
|
|
1649
1683
|
return max(min$1, min(value, max$1));
|
|
1650
1684
|
}
|
|
1685
|
+
function withinMaxClamp(min, value, max) {
|
|
1686
|
+
var v = within(min, value, max);
|
|
1687
|
+
return v > max ? max : v;
|
|
1688
|
+
}
|
|
1651
1689
|
|
|
1652
1690
|
function getFreshSideObject() {
|
|
1653
1691
|
return {
|
|
@@ -1770,8 +1808,8 @@ function roundOffsetsByDPR(_ref) {
|
|
|
1770
1808
|
var win = window;
|
|
1771
1809
|
var dpr = win.devicePixelRatio || 1;
|
|
1772
1810
|
return {
|
|
1773
|
-
x: round(
|
|
1774
|
-
y: round(
|
|
1811
|
+
x: round(x * dpr) / dpr || 0,
|
|
1812
|
+
y: round(y * dpr) / dpr || 0
|
|
1775
1813
|
};
|
|
1776
1814
|
}
|
|
1777
1815
|
|
|
@@ -1786,14 +1824,23 @@ function mapToStyles(_ref2) {
|
|
|
1786
1824
|
position = _ref2.position,
|
|
1787
1825
|
gpuAcceleration = _ref2.gpuAcceleration,
|
|
1788
1826
|
adaptive = _ref2.adaptive,
|
|
1789
|
-
roundOffsets = _ref2.roundOffsets
|
|
1790
|
-
|
|
1791
|
-
var
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1827
|
+
roundOffsets = _ref2.roundOffsets,
|
|
1828
|
+
isFixed = _ref2.isFixed;
|
|
1829
|
+
var _offsets$x = offsets.x,
|
|
1830
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
1831
|
+
_offsets$y = offsets.y,
|
|
1832
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
1833
|
+
|
|
1834
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
1835
|
+
x: x,
|
|
1836
|
+
y: y
|
|
1837
|
+
}) : {
|
|
1838
|
+
x: x,
|
|
1839
|
+
y: y
|
|
1840
|
+
};
|
|
1796
1841
|
|
|
1842
|
+
x = _ref3.x;
|
|
1843
|
+
y = _ref3.y;
|
|
1797
1844
|
var hasX = offsets.hasOwnProperty('x');
|
|
1798
1845
|
var hasY = offsets.hasOwnProperty('y');
|
|
1799
1846
|
var sideX = left;
|
|
@@ -1818,16 +1865,18 @@ function mapToStyles(_ref2) {
|
|
|
1818
1865
|
offsetParent = offsetParent;
|
|
1819
1866
|
|
|
1820
1867
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
1821
|
-
sideY = bottom;
|
|
1822
|
-
|
|
1823
|
-
|
|
1868
|
+
sideY = bottom;
|
|
1869
|
+
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
1870
|
+
offsetParent[heightProp];
|
|
1871
|
+
y -= offsetY - popperRect.height;
|
|
1824
1872
|
y *= gpuAcceleration ? 1 : -1;
|
|
1825
1873
|
}
|
|
1826
1874
|
|
|
1827
1875
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
1828
|
-
sideX = right;
|
|
1829
|
-
|
|
1830
|
-
|
|
1876
|
+
sideX = right;
|
|
1877
|
+
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
1878
|
+
offsetParent[widthProp];
|
|
1879
|
+
x -= offsetX - popperRect.width;
|
|
1831
1880
|
x *= gpuAcceleration ? 1 : -1;
|
|
1832
1881
|
}
|
|
1833
1882
|
}
|
|
@@ -1836,6 +1885,17 @@ function mapToStyles(_ref2) {
|
|
|
1836
1885
|
position: position
|
|
1837
1886
|
}, adaptive && unsetSides);
|
|
1838
1887
|
|
|
1888
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
1889
|
+
x: x,
|
|
1890
|
+
y: y
|
|
1891
|
+
}) : {
|
|
1892
|
+
x: x,
|
|
1893
|
+
y: y
|
|
1894
|
+
};
|
|
1895
|
+
|
|
1896
|
+
x = _ref4.x;
|
|
1897
|
+
y = _ref4.y;
|
|
1898
|
+
|
|
1839
1899
|
if (gpuAcceleration) {
|
|
1840
1900
|
var _Object$assign;
|
|
1841
1901
|
|
|
@@ -1845,9 +1905,9 @@ function mapToStyles(_ref2) {
|
|
|
1845
1905
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
1846
1906
|
}
|
|
1847
1907
|
|
|
1848
|
-
function computeStyles(
|
|
1849
|
-
var state =
|
|
1850
|
-
options =
|
|
1908
|
+
function computeStyles(_ref5) {
|
|
1909
|
+
var state = _ref5.state,
|
|
1910
|
+
options = _ref5.options;
|
|
1851
1911
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
1852
1912
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
1853
1913
|
_options$adaptive = options.adaptive,
|
|
@@ -1860,7 +1920,8 @@ function computeStyles(_ref4) {
|
|
|
1860
1920
|
variation: getVariation(state.placement),
|
|
1861
1921
|
popper: state.elements.popper,
|
|
1862
1922
|
popperRect: state.rects.popper,
|
|
1863
|
-
gpuAcceleration: gpuAcceleration
|
|
1923
|
+
gpuAcceleration: gpuAcceleration,
|
|
1924
|
+
isFixed: state.options.strategy === 'fixed'
|
|
1864
1925
|
};
|
|
1865
1926
|
|
|
1866
1927
|
if (state.modifiersData.popperOffsets != null) {
|
|
@@ -2118,7 +2179,7 @@ function getInnerBoundingClientRect(element) {
|
|
|
2118
2179
|
}
|
|
2119
2180
|
|
|
2120
2181
|
function getClientRectFromMixedType(element, clippingParent) {
|
|
2121
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) :
|
|
2182
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
2122
2183
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
2123
2184
|
// clipping (or hiding) overflowing elements with a position different from
|
|
2124
2185
|
// `initial`
|
|
@@ -2631,6 +2692,14 @@ function preventOverflow(_ref) {
|
|
|
2631
2692
|
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
|
2632
2693
|
placement: state.placement
|
|
2633
2694
|
})) : tetherOffset;
|
|
2695
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
|
2696
|
+
mainAxis: tetherOffsetValue,
|
|
2697
|
+
altAxis: tetherOffsetValue
|
|
2698
|
+
} : Object.assign({
|
|
2699
|
+
mainAxis: 0,
|
|
2700
|
+
altAxis: 0
|
|
2701
|
+
}, tetherOffsetValue);
|
|
2702
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
2634
2703
|
var data = {
|
|
2635
2704
|
x: 0,
|
|
2636
2705
|
y: 0
|
|
@@ -2640,13 +2709,15 @@ function preventOverflow(_ref) {
|
|
|
2640
2709
|
return;
|
|
2641
2710
|
}
|
|
2642
2711
|
|
|
2643
|
-
if (checkMainAxis
|
|
2712
|
+
if (checkMainAxis) {
|
|
2713
|
+
var _offsetModifierState$;
|
|
2714
|
+
|
|
2644
2715
|
var mainSide = mainAxis === 'y' ? top : left;
|
|
2645
2716
|
var altSide = mainAxis === 'y' ? bottom : right;
|
|
2646
2717
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
2647
2718
|
var offset = popperOffsets[mainAxis];
|
|
2648
|
-
var min$1 =
|
|
2649
|
-
var max$1 =
|
|
2719
|
+
var min$1 = offset + overflow[mainSide];
|
|
2720
|
+
var max$1 = offset - overflow[altSide];
|
|
2650
2721
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
2651
2722
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
2652
2723
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
@@ -2666,36 +2737,45 @@ function preventOverflow(_ref) {
|
|
|
2666
2737
|
// width or height)
|
|
2667
2738
|
|
|
2668
2739
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
2669
|
-
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin -
|
|
2670
|
-
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax +
|
|
2740
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
2741
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
2671
2742
|
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
2672
2743
|
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
2673
|
-
var offsetModifierValue =
|
|
2674
|
-
var tetherMin =
|
|
2675
|
-
var tetherMax =
|
|
2744
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
2745
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
|
2746
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
|
2747
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
|
2748
|
+
popperOffsets[mainAxis] = preventedOffset;
|
|
2749
|
+
data[mainAxis] = preventedOffset - offset;
|
|
2750
|
+
}
|
|
2676
2751
|
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
popperOffsets[mainAxis] = preventedOffset;
|
|
2680
|
-
data[mainAxis] = preventedOffset - offset;
|
|
2681
|
-
}
|
|
2752
|
+
if (checkAltAxis) {
|
|
2753
|
+
var _offsetModifierState$2;
|
|
2682
2754
|
|
|
2683
|
-
|
|
2684
|
-
var _mainSide = mainAxis === 'x' ? top : left;
|
|
2755
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
|
2685
2756
|
|
|
2686
|
-
|
|
2757
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
|
2687
2758
|
|
|
2688
|
-
|
|
2759
|
+
var _offset = popperOffsets[altAxis];
|
|
2689
2760
|
|
|
2690
|
-
|
|
2761
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
|
2691
2762
|
|
|
2692
|
-
|
|
2763
|
+
var _min = _offset + overflow[_mainSide];
|
|
2693
2764
|
|
|
2694
|
-
|
|
2765
|
+
var _max = _offset - overflow[_altSide];
|
|
2695
2766
|
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2767
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
2768
|
+
|
|
2769
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
2770
|
+
|
|
2771
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
2772
|
+
|
|
2773
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
2774
|
+
|
|
2775
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
2776
|
+
|
|
2777
|
+
popperOffsets[altAxis] = _preventedOffset;
|
|
2778
|
+
data[altAxis] = _preventedOffset - _offset;
|
|
2699
2779
|
}
|
|
2700
2780
|
|
|
2701
2781
|
state.modifiersData[name] = data;
|
|
@@ -2727,8 +2807,8 @@ function getNodeScroll(node) {
|
|
|
2727
2807
|
|
|
2728
2808
|
function isElementScaled(element) {
|
|
2729
2809
|
var rect = element.getBoundingClientRect();
|
|
2730
|
-
var scaleX = rect.width / element.offsetWidth || 1;
|
|
2731
|
-
var scaleY = rect.height / element.offsetHeight || 1;
|
|
2810
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
2811
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
2732
2812
|
return scaleX !== 1 || scaleY !== 1;
|
|
2733
2813
|
} // Returns the composite rect of an element relative to its offsetParent.
|
|
2734
2814
|
// Composite means it takes into account transforms as well as layout.
|
|
@@ -2740,9 +2820,9 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
2740
2820
|
}
|
|
2741
2821
|
|
|
2742
2822
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2743
|
-
isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
2823
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
2744
2824
|
var documentElement = getDocumentElement(offsetParent);
|
|
2745
|
-
var rect = getBoundingClientRect(elementOrVirtualElement);
|
|
2825
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
|
2746
2826
|
var scroll = {
|
|
2747
2827
|
scrollLeft: 0,
|
|
2748
2828
|
scrollTop: 0
|
|
@@ -2759,7 +2839,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
2759
2839
|
}
|
|
2760
2840
|
|
|
2761
2841
|
if (isHTMLElement(offsetParent)) {
|
|
2762
|
-
offsets = getBoundingClientRect(offsetParent);
|
|
2842
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
|
2763
2843
|
offsets.x += offsetParent.clientLeft;
|
|
2764
2844
|
offsets.y += offsetParent.clientTop;
|
|
2765
2845
|
} else if (documentElement) {
|
|
@@ -3209,6 +3289,9 @@ class Popover {
|
|
|
3209
3289
|
this.defaults = defaults;
|
|
3210
3290
|
this.settings = _extends({}, this.defaults, options);
|
|
3211
3291
|
this.collection = [];
|
|
3292
|
+
this.memory = {
|
|
3293
|
+
trigger: null
|
|
3294
|
+
};
|
|
3212
3295
|
this.__handlerKeydown = handlerKeydown.bind(this);
|
|
3213
3296
|
if (this.settings.autoInit) this.init();
|
|
3214
3297
|
}
|