popper_js 1.9.9 → 1.10.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/javascripts/popper.js +254 -90
- data/lib/popper_js/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f068cf219e4b899d49d1aaa1e76421837bbbfc84
|
4
|
+
data.tar.gz: 836f8bf44a3f52a55a0d294ea4156735eef0574c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65fb8ceb08822fe029c248acb4d0b8cde271baa2352863a69cb3dc444496721cc36679fd5e57c2e148d815a3a63a7a43cf484c481a32e187feb96498e7155afd
|
7
|
+
data.tar.gz: 4ffcb1f6e59f117abbadec8ad70a791fbee6678df307cfaff213febe3dc74e7bab5fd6190ef45448e36e467b072a0190b673f6b66ed84cb35ba91a84f2b58669
|
@@ -1,3 +1,27 @@
|
|
1
|
+
/**!
|
2
|
+
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
3
|
+
* @version 1.10.8
|
4
|
+
* @license
|
5
|
+
* Copyright (c) 2016 Federico Zivolo and contributors
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
15
|
+
* copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
* SOFTWARE.
|
24
|
+
*/
|
1
25
|
(function (global, factory) {
|
2
26
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3
27
|
typeof define === 'function' && define.amd ? define(factory) :
|
@@ -83,36 +107,6 @@ var supportsNativeMutationObserver = isBrowser && isNative(window.MutationObserv
|
|
83
107
|
*/
|
84
108
|
var debounce = supportsNativeMutationObserver ? microtaskDebounce : taskDebounce;
|
85
109
|
|
86
|
-
/**
|
87
|
-
* Tells if a given input is a number
|
88
|
-
* @method
|
89
|
-
* @memberof Popper.Utils
|
90
|
-
* @param {*} input to check
|
91
|
-
* @return {Boolean}
|
92
|
-
*/
|
93
|
-
function isNumeric(n) {
|
94
|
-
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
95
|
-
}
|
96
|
-
|
97
|
-
/**
|
98
|
-
* Set the style to the given popper
|
99
|
-
* @method
|
100
|
-
* @memberof Popper.Utils
|
101
|
-
* @argument {Element} element - Element to apply the style to
|
102
|
-
* @argument {Object} styles
|
103
|
-
* Object with a list of properties and values which will be applied to the element
|
104
|
-
*/
|
105
|
-
function setStyles(element, styles) {
|
106
|
-
Object.keys(styles).forEach(function (prop) {
|
107
|
-
var unit = '';
|
108
|
-
// add unit if the value is numeric and is one of the following
|
109
|
-
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
110
|
-
unit = 'px';
|
111
|
-
}
|
112
|
-
element.style[prop] = styles[prop] + unit;
|
113
|
-
});
|
114
|
-
}
|
115
|
-
|
116
110
|
/**
|
117
111
|
* Check if the given variable is a function
|
118
112
|
* @method
|
@@ -494,23 +488,27 @@ function getOffsetRectRelativeToArbitraryNode(children, parent) {
|
|
494
488
|
var childrenRect = getBoundingClientRect(children);
|
495
489
|
var parentRect = getBoundingClientRect(parent);
|
496
490
|
var scrollParent = getScrollParent(children);
|
491
|
+
|
492
|
+
var styles = getStyleComputedProperty(parent);
|
493
|
+
var borderTopWidth = +styles.borderTopWidth.split('px')[0];
|
494
|
+
var borderLeftWidth = +styles.borderLeftWidth.split('px')[0];
|
495
|
+
|
497
496
|
var offsets = getClientRect({
|
498
|
-
top: childrenRect.top - parentRect.top,
|
499
|
-
left: childrenRect.left - parentRect.left,
|
497
|
+
top: childrenRect.top - parentRect.top - borderTopWidth,
|
498
|
+
left: childrenRect.left - parentRect.left - borderLeftWidth,
|
500
499
|
width: childrenRect.width,
|
501
500
|
height: childrenRect.height
|
502
501
|
});
|
502
|
+
offsets.marginTop = 0;
|
503
|
+
offsets.marginLeft = 0;
|
503
504
|
|
504
505
|
// Subtract margins of documentElement in case it's being used as parent
|
505
506
|
// we do this only on HTML because it's the only element that behaves
|
506
507
|
// differently when margins are applied to it. The margins are included in
|
507
508
|
// the box of the documentElement, in the other cases not.
|
508
|
-
if (
|
509
|
-
var
|
510
|
-
var
|
511
|
-
var borderLeftWidth = isIE10 && isHTML ? 0 : +styles.borderLeftWidth.split('px')[0];
|
512
|
-
var marginTop = isIE10 && isHTML ? 0 : +styles.marginTop.split('px')[0];
|
513
|
-
var marginLeft = isIE10 && isHTML ? 0 : +styles.marginLeft.split('px')[0];
|
509
|
+
if (!isIE10 && isHTML) {
|
510
|
+
var marginTop = +styles.marginTop.split('px')[0];
|
511
|
+
var marginLeft = +styles.marginLeft.split('px')[0];
|
514
512
|
|
515
513
|
offsets.top -= borderTopWidth - marginTop;
|
516
514
|
offsets.bottom -= borderTopWidth - marginTop;
|
@@ -840,6 +838,12 @@ function runModifiers(modifiers, data, ends) {
|
|
840
838
|
}
|
841
839
|
var fn = modifier.function || modifier.fn;
|
842
840
|
if (modifier.enabled && isFunction(fn)) {
|
841
|
+
// Add properties to offsets to make them a complete clientRect object
|
842
|
+
// we do this before each modifier to make sure the previous one doesn't
|
843
|
+
// mess with these values
|
844
|
+
data.offsets.popper = getClientRect(data.offsets.popper);
|
845
|
+
data.offsets.reference = getClientRect(data.offsets.reference);
|
846
|
+
|
843
847
|
data = fn(data, modifier);
|
844
848
|
}
|
845
849
|
});
|
@@ -1038,6 +1042,36 @@ function disableEventListeners() {
|
|
1038
1042
|
}
|
1039
1043
|
}
|
1040
1044
|
|
1045
|
+
/**
|
1046
|
+
* Tells if a given input is a number
|
1047
|
+
* @method
|
1048
|
+
* @memberof Popper.Utils
|
1049
|
+
* @param {*} input to check
|
1050
|
+
* @return {Boolean}
|
1051
|
+
*/
|
1052
|
+
function isNumeric(n) {
|
1053
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
1054
|
+
}
|
1055
|
+
|
1056
|
+
/**
|
1057
|
+
* Set the style to the given popper
|
1058
|
+
* @method
|
1059
|
+
* @memberof Popper.Utils
|
1060
|
+
* @argument {Element} element - Element to apply the style to
|
1061
|
+
* @argument {Object} styles
|
1062
|
+
* Object with a list of properties and values which will be applied to the element
|
1063
|
+
*/
|
1064
|
+
function setStyles(element, styles) {
|
1065
|
+
Object.keys(styles).forEach(function (prop) {
|
1066
|
+
var unit = '';
|
1067
|
+
// add unit if the value is numeric and is one of the following
|
1068
|
+
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
1069
|
+
unit = 'px';
|
1070
|
+
}
|
1071
|
+
element.style[prop] = styles[prop] + unit;
|
1072
|
+
});
|
1073
|
+
}
|
1074
|
+
|
1041
1075
|
/**
|
1042
1076
|
* Set the attributes to the given popper
|
1043
1077
|
* @method
|
@@ -1066,46 +1100,16 @@ function setAttributes(element, attributes) {
|
|
1066
1100
|
* @argument {Object} options - Modifiers configuration and options
|
1067
1101
|
* @returns {Object} The same data object
|
1068
1102
|
*/
|
1069
|
-
function applyStyle(data
|
1070
|
-
// apply the final offsets to the popper
|
1071
|
-
// NOTE: 1 DOM access here
|
1072
|
-
var styles = {
|
1073
|
-
position: data.offsets.popper.position
|
1074
|
-
};
|
1075
|
-
|
1076
|
-
var attributes = {
|
1077
|
-
'x-placement': data.placement
|
1078
|
-
};
|
1079
|
-
|
1080
|
-
// round top and left to avoid blurry text
|
1081
|
-
var left = Math.round(data.offsets.popper.left);
|
1082
|
-
var top = Math.round(data.offsets.popper.top);
|
1083
|
-
|
1084
|
-
// if gpuAcceleration is set to true and transform is supported,
|
1085
|
-
// we use `translate3d` to apply the position to the popper we
|
1086
|
-
// automatically use the supported prefixed version if needed
|
1087
|
-
var prefixedProperty = getSupportedPropertyName('transform');
|
1088
|
-
if (options.gpuAcceleration && prefixedProperty) {
|
1089
|
-
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
1090
|
-
styles.top = 0;
|
1091
|
-
styles.left = 0;
|
1092
|
-
styles.willChange = 'transform';
|
1093
|
-
} else {
|
1094
|
-
// othwerise, we use the standard `left` and `top` properties
|
1095
|
-
styles.left = left;
|
1096
|
-
styles.top = top;
|
1097
|
-
styles.willChange = 'top, left';
|
1098
|
-
}
|
1099
|
-
|
1103
|
+
function applyStyle(data) {
|
1100
1104
|
// any property present in `data.styles` will be applied to the popper,
|
1101
1105
|
// in this way we can make the 3rd party modifiers add custom styles to it
|
1102
1106
|
// Be aware, modifiers could override the properties defined in the previous
|
1103
1107
|
// lines of this modifier!
|
1104
|
-
setStyles(data.instance.popper,
|
1108
|
+
setStyles(data.instance.popper, data.styles);
|
1105
1109
|
|
1106
1110
|
// any property present in `data.attributes` will be applied to the popper,
|
1107
1111
|
// they will be set as HTML attributes of the element
|
1108
|
-
setAttributes(data.instance.popper,
|
1112
|
+
setAttributes(data.instance.popper, data.attributes);
|
1109
1113
|
|
1110
1114
|
// if the arrow style has been computed, apply the arrow style
|
1111
1115
|
if (data.offsets.arrow) {
|
@@ -1135,9 +1139,107 @@ function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
|
|
1135
1139
|
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
|
1136
1140
|
|
1137
1141
|
popper.setAttribute('x-placement', placement);
|
1142
|
+
|
1143
|
+
// Apply `position` to popper before anything else because
|
1144
|
+
// without the position applied we can't guarantee correct computations
|
1145
|
+
setStyles(popper, { position: 'absolute' });
|
1146
|
+
|
1138
1147
|
return options;
|
1139
1148
|
}
|
1140
1149
|
|
1150
|
+
/**
|
1151
|
+
* @function
|
1152
|
+
* @memberof Modifiers
|
1153
|
+
* @argument {Object} data - The data object generated by `update` method
|
1154
|
+
* @argument {Object} options - Modifiers configuration and options
|
1155
|
+
* @returns {Object} The data object, properly modified
|
1156
|
+
*/
|
1157
|
+
function computeStyle(data, options) {
|
1158
|
+
var x = options.x,
|
1159
|
+
y = options.y;
|
1160
|
+
var popper = data.offsets.popper;
|
1161
|
+
|
1162
|
+
// Remove this legacy support in Popper.js v2
|
1163
|
+
|
1164
|
+
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
|
1165
|
+
return modifier.name === 'applyStyle';
|
1166
|
+
}).gpuAcceleration;
|
1167
|
+
if (legacyGpuAccelerationOption !== undefined) {
|
1168
|
+
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
|
1169
|
+
}
|
1170
|
+
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
|
1171
|
+
|
1172
|
+
var offsetParent = getOffsetParent(data.instance.popper);
|
1173
|
+
var offsetParentRect = getBoundingClientRect(offsetParent);
|
1174
|
+
|
1175
|
+
// Styles
|
1176
|
+
var styles = {
|
1177
|
+
position: popper.position
|
1178
|
+
};
|
1179
|
+
|
1180
|
+
// floor sides to avoid blurry text
|
1181
|
+
var offsets = {
|
1182
|
+
left: Math.floor(popper.left),
|
1183
|
+
top: Math.floor(popper.top),
|
1184
|
+
bottom: Math.floor(popper.bottom),
|
1185
|
+
right: Math.floor(popper.right)
|
1186
|
+
};
|
1187
|
+
|
1188
|
+
var sideA = x === 'bottom' ? 'top' : 'bottom';
|
1189
|
+
var sideB = y === 'right' ? 'left' : 'right';
|
1190
|
+
|
1191
|
+
// if gpuAcceleration is set to `true` and transform is supported,
|
1192
|
+
// we use `translate3d` to apply the position to the popper we
|
1193
|
+
// automatically use the supported prefixed version if needed
|
1194
|
+
var prefixedProperty = getSupportedPropertyName('transform');
|
1195
|
+
|
1196
|
+
// now, let's make a step back and look at this code closely (wtf?)
|
1197
|
+
// If the content of the popper grows once it's been positioned, it
|
1198
|
+
// may happen that the popper gets misplaced because of the new content
|
1199
|
+
// overflowing its reference element
|
1200
|
+
// To avoid this problem, we provide two options (x and y), which allow
|
1201
|
+
// the consumer to define the offset origin.
|
1202
|
+
// If we position a popper on top of a reference element, we can set
|
1203
|
+
// `x` to `top` to make the popper grow towards its top instead of
|
1204
|
+
// its bottom.
|
1205
|
+
var left = void 0,
|
1206
|
+
top = void 0;
|
1207
|
+
if (sideA === 'bottom') {
|
1208
|
+
top = -offsetParentRect.height + offsets.bottom;
|
1209
|
+
} else {
|
1210
|
+
top = offsets.top;
|
1211
|
+
}
|
1212
|
+
if (sideB === 'right') {
|
1213
|
+
left = -offsetParentRect.width + offsets.right;
|
1214
|
+
} else {
|
1215
|
+
left = offsets.left;
|
1216
|
+
}
|
1217
|
+
if (gpuAcceleration && prefixedProperty) {
|
1218
|
+
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
1219
|
+
styles[sideA] = 0;
|
1220
|
+
styles[sideB] = 0;
|
1221
|
+
styles.willChange = 'transform';
|
1222
|
+
} else {
|
1223
|
+
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
|
1224
|
+
var invertTop = sideA === 'bottom' ? -1 : 1;
|
1225
|
+
var invertLeft = sideB === 'right' ? -1 : 1;
|
1226
|
+
styles[sideA] = top * invertTop;
|
1227
|
+
styles[sideB] = left * invertLeft;
|
1228
|
+
styles.willChange = sideA + ', ' + sideB;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
// Attributes
|
1232
|
+
var attributes = {
|
1233
|
+
'x-placement': data.placement
|
1234
|
+
};
|
1235
|
+
|
1236
|
+
// Update attributes and styles of `data`
|
1237
|
+
data.attributes = _extends({}, attributes, data.attributes);
|
1238
|
+
data.styles = _extends({}, styles, data.styles);
|
1239
|
+
|
1240
|
+
return data;
|
1241
|
+
}
|
1242
|
+
|
1141
1243
|
/**
|
1142
1244
|
* Helper used to know if the given modifier depends from another one.<br />
|
1143
1245
|
* It checks if the needed modifier is listed and enabled.
|
@@ -1199,8 +1301,10 @@ function arrow(data, options) {
|
|
1199
1301
|
}
|
1200
1302
|
|
1201
1303
|
var placement = data.placement.split('-')[0];
|
1202
|
-
var
|
1203
|
-
|
1304
|
+
var _data$offsets = data.offsets,
|
1305
|
+
popper = _data$offsets.popper,
|
1306
|
+
reference = _data$offsets.reference;
|
1307
|
+
|
1204
1308
|
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
1205
1309
|
|
1206
1310
|
var len = isVertical ? 'height' : 'width';
|
@@ -1233,7 +1337,7 @@ function arrow(data, options) {
|
|
1233
1337
|
|
1234
1338
|
data.arrowElement = arrowElement;
|
1235
1339
|
data.offsets.arrow = {};
|
1236
|
-
data.offsets.arrow[side] = Math.
|
1340
|
+
data.offsets.arrow[side] = Math.round(sideValue);
|
1237
1341
|
data.offsets.arrow[altSide] = ''; // make sure to unset any eventual altSide value from the DOM node
|
1238
1342
|
|
1239
1343
|
return data;
|
@@ -1363,7 +1467,7 @@ function flip(data, options) {
|
|
1363
1467
|
placement = data.placement.split('-')[0];
|
1364
1468
|
placementOpposite = getOppositePlacement(placement);
|
1365
1469
|
|
1366
|
-
var popperOffsets =
|
1470
|
+
var popperOffsets = data.offsets.popper;
|
1367
1471
|
var refOffsets = data.offsets.reference;
|
1368
1472
|
|
1369
1473
|
// using floor because the reference offsets may contain decimals we are not going to consider here
|
@@ -1413,8 +1517,10 @@ function flip(data, options) {
|
|
1413
1517
|
* @returns {Object} The data object, properly modified
|
1414
1518
|
*/
|
1415
1519
|
function keepTogether(data) {
|
1416
|
-
var
|
1417
|
-
|
1520
|
+
var _data$offsets = data.offsets,
|
1521
|
+
popper = _data$offsets.popper,
|
1522
|
+
reference = _data$offsets.reference;
|
1523
|
+
|
1418
1524
|
var placement = data.placement.split('-')[0];
|
1419
1525
|
var floor = Math.floor;
|
1420
1526
|
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
@@ -1615,11 +1721,19 @@ function offset(data, _ref) {
|
|
1615
1721
|
*/
|
1616
1722
|
function preventOverflow(data, options) {
|
1617
1723
|
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
|
1724
|
+
|
1725
|
+
// If offsetParent is the reference element, we really want to
|
1726
|
+
// go one step up and use the next offsetParent as reference to
|
1727
|
+
// avoid to make this modifier completely useless and look like broken
|
1728
|
+
if (data.instance.reference === boundariesElement) {
|
1729
|
+
boundariesElement = getOffsetParent(boundariesElement);
|
1730
|
+
}
|
1731
|
+
|
1618
1732
|
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement);
|
1619
1733
|
options.boundaries = boundaries;
|
1620
1734
|
|
1621
1735
|
var order = options.priority;
|
1622
|
-
var popper =
|
1736
|
+
var popper = data.offsets.popper;
|
1623
1737
|
|
1624
1738
|
var check = {
|
1625
1739
|
primary: function primary(placement) {
|
@@ -1663,8 +1777,10 @@ function shift(data) {
|
|
1663
1777
|
|
1664
1778
|
// if shift shiftvariation is specified, run the modifier
|
1665
1779
|
if (shiftvariation) {
|
1666
|
-
var
|
1667
|
-
|
1780
|
+
var _data$offsets = data.offsets,
|
1781
|
+
reference = _data$offsets.reference,
|
1782
|
+
popper = _data$offsets.popper;
|
1783
|
+
|
1668
1784
|
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
|
1669
1785
|
var side = isVertical ? 'left' : 'top';
|
1670
1786
|
var measurement = isVertical ? 'width' : 'height';
|
@@ -1728,8 +1844,10 @@ function hide(data) {
|
|
1728
1844
|
function inner(data) {
|
1729
1845
|
var placement = data.placement;
|
1730
1846
|
var basePlacement = placement.split('-')[0];
|
1731
|
-
var
|
1732
|
-
|
1847
|
+
var _data$offsets = data.offsets,
|
1848
|
+
popper = _data$offsets.popper,
|
1849
|
+
reference = _data$offsets.reference;
|
1850
|
+
|
1733
1851
|
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
|
1734
1852
|
|
1735
1853
|
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
|
@@ -1854,7 +1972,7 @@ var modifiers = {
|
|
1854
1972
|
/** @prop {ModifierFn} */
|
1855
1973
|
fn: preventOverflow,
|
1856
1974
|
/**
|
1857
|
-
* @prop {Array} priority=['left',
|
1975
|
+
* @prop {Array} [priority=['left','right','top','bottom']]
|
1858
1976
|
* Popper will try to prevent overflow following these priorities by default,
|
1859
1977
|
* then, it could overflow on the left and on top of the `boundariesElement`
|
1860
1978
|
*/
|
@@ -1987,6 +2105,48 @@ var modifiers = {
|
|
1987
2105
|
fn: hide
|
1988
2106
|
},
|
1989
2107
|
|
2108
|
+
/**
|
2109
|
+
* Computes the style that will be applied to the popper element to gets
|
2110
|
+
* properly positioned.
|
2111
|
+
*
|
2112
|
+
* Note that this modifier will not touch the DOM, it just prepares the styles
|
2113
|
+
* so that `applyStyle` modifier can apply it. This separation is useful
|
2114
|
+
* in case you need to replace `applyStyle` with a custom implementation.
|
2115
|
+
*
|
2116
|
+
* This modifier has `850` as `order` value to maintain backward compatibility
|
2117
|
+
* with previous versions of Popper.js. Expect the modifiers ordering method
|
2118
|
+
* to change in future major versions of the library.
|
2119
|
+
*
|
2120
|
+
* @memberof modifiers
|
2121
|
+
* @inner
|
2122
|
+
*/
|
2123
|
+
computeStyle: {
|
2124
|
+
/** @prop {number} order=850 - Index used to define the order of execution */
|
2125
|
+
order: 850,
|
2126
|
+
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
2127
|
+
enabled: true,
|
2128
|
+
/** @prop {ModifierFn} */
|
2129
|
+
fn: computeStyle,
|
2130
|
+
/**
|
2131
|
+
* @prop {Boolean} gpuAcceleration=true
|
2132
|
+
* If true, it uses the CSS 3d transformation to position the popper.
|
2133
|
+
* Otherwise, it will use the `top` and `left` properties.
|
2134
|
+
*/
|
2135
|
+
gpuAcceleration: true,
|
2136
|
+
/**
|
2137
|
+
* @prop {string} [x='bottom']
|
2138
|
+
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
|
2139
|
+
* Change this if your popper should grow in a direction different from `bottom`
|
2140
|
+
*/
|
2141
|
+
x: 'bottom',
|
2142
|
+
/**
|
2143
|
+
* @prop {string} [x='left']
|
2144
|
+
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
|
2145
|
+
* Change this if your popper should grow in a direction different from `right`
|
2146
|
+
*/
|
2147
|
+
y: 'right'
|
2148
|
+
},
|
2149
|
+
|
1990
2150
|
/**
|
1991
2151
|
* Applies the computed styles to the popper element.
|
1992
2152
|
*
|
@@ -1994,6 +2154,9 @@ var modifiers = {
|
|
1994
2154
|
* you want to integrate Popper.js inside a framework or view library and you
|
1995
2155
|
* want to delegate all the DOM manipulations to it.
|
1996
2156
|
*
|
2157
|
+
* Note that if you disable this modifier, you must make sure the popper element
|
2158
|
+
* has its position set to `absolute` before Popper.js can do its work!
|
2159
|
+
*
|
1997
2160
|
* Just disable this modifier and define you own to achieve the desired effect.
|
1998
2161
|
*
|
1999
2162
|
* @memberof modifiers
|
@@ -2009,11 +2172,12 @@ var modifiers = {
|
|
2009
2172
|
/** @prop {Function} */
|
2010
2173
|
onLoad: applyStyleOnLoad,
|
2011
2174
|
/**
|
2175
|
+
* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
|
2012
2176
|
* @prop {Boolean} gpuAcceleration=true
|
2013
2177
|
* If true, it uses the CSS 3d transformation to position the popper.
|
2014
2178
|
* Otherwise, it will use the `top` and `left` properties.
|
2015
2179
|
*/
|
2016
|
-
gpuAcceleration:
|
2180
|
+
gpuAcceleration: undefined
|
2017
2181
|
}
|
2018
2182
|
};
|
2019
2183
|
|
@@ -2051,7 +2215,7 @@ var modifiers = {
|
|
2051
2215
|
* @static
|
2052
2216
|
* @memberof Popper
|
2053
2217
|
*/
|
2054
|
-
var
|
2218
|
+
var Defaults = {
|
2055
2219
|
/**
|
2056
2220
|
* Popper's placement
|
2057
2221
|
* @prop {Popper.placements} placement='bottom'
|
@@ -2115,7 +2279,7 @@ var Popper = function () {
|
|
2115
2279
|
* @class Popper
|
2116
2280
|
* @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
|
2117
2281
|
* @param {HTMLElement} popper - The HTML element used as popper.
|
2118
|
-
* @param {Object} options - Your custom options to override the ones defined in [
|
2282
|
+
* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
|
2119
2283
|
* @return {Object} instance - The generated Popper.js instance
|
2120
2284
|
*/
|
2121
2285
|
function Popper(reference, popper) {
|
@@ -2145,9 +2309,6 @@ var Popper = function () {
|
|
2145
2309
|
this.reference = reference.jquery ? reference[0] : reference;
|
2146
2310
|
this.popper = popper.jquery ? popper[0] : popper;
|
2147
2311
|
|
2148
|
-
// make sure to apply the popper position before any computation
|
2149
|
-
setStyles(this.popper, { position: 'absolute' });
|
2150
|
-
|
2151
2312
|
// Deep merge modifiers options
|
2152
2313
|
this.options.modifiers = {};
|
2153
2314
|
Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
|
@@ -2226,7 +2387,10 @@ var Popper = function () {
|
|
2226
2387
|
*
|
2227
2388
|
* **DEPRECATION**: This way to access PopperUtils is deprecated
|
2228
2389
|
* and will be removed in v2! Use the PopperUtils module directly instead.
|
2390
|
+
* Due to the high instability of the methods contained in Utils, we can't
|
2391
|
+
* guarantee them to follow semver. Use them at your own risk!
|
2229
2392
|
* @static
|
2393
|
+
* @private
|
2230
2394
|
* @type {Object}
|
2231
2395
|
* @deprecated since version 1.8
|
2232
2396
|
* @member Utils
|
@@ -2260,7 +2424,7 @@ var Popper = function () {
|
|
2260
2424
|
|
2261
2425
|
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
|
2262
2426
|
Popper.placements = placements;
|
2263
|
-
Popper.Defaults =
|
2427
|
+
Popper.Defaults = Defaults;
|
2264
2428
|
|
2265
2429
|
return Popper;
|
2266
2430
|
|
data/lib/popper_js/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: popper_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Mazovetskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description: Works with Rails out of the box.
|
70
70
|
email:
|
71
71
|
- glex.spb@gmail.com
|
72
72
|
executables: []
|
@@ -100,5 +100,5 @@ rubyforge_project:
|
|
100
100
|
rubygems_version: 2.6.12
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
|
-
summary: https://popper.js.org/
|
103
|
+
summary: Popper.js assets as a Ruby gem. https://popper.js.org/
|
104
104
|
test_files: []
|