popper_js 1.11.1 → 1.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 577f1f4a06dcf219922bf764954720b5f2f35038
4
- data.tar.gz: b1ecdbf0e183e7a4aa262078725fa73c23d754c0
3
+ metadata.gz: 912811d543482989df9a7843609e338a5c696268
4
+ data.tar.gz: b84bf5adf2941747df5d7796db02e17b852aa7f1
5
5
  SHA512:
6
- metadata.gz: 3746ff82a4c9c49d85c57714161d2ddd8e78db833baede2c07ff8ba69566736835e9f6c2e07ec9fd2ae4ccef2ae1efb033a816cb7e12b361800e99f4378aa650
7
- data.tar.gz: 569903603b71ebaae93af17fb8d04bd37b1af2b521ddc307214f01a18c6bbcc0e2381359f0558b55cf9c4b7f0063f45e24099483212c8dad1ded7421ae8a62d0
6
+ metadata.gz: 5238e13dcd05cdb6b39f66de06eb01ff35b1646bb662b1f6e76242724bda4c66b1378a05bd1e0eee8c50fa3aace5963186036f1c08674642bae4404003d68763
7
+ data.tar.gz: b503aadddeaed3abcd51276d5fd6a7f8dc4a6db0c41495c657074d401e6487b480a4fc572f548f4a25e8b90e7796f5ebdc5f7285c9ca2f42a76664398698d3b2
@@ -1,6 +1,6 @@
1
1
  /**!
2
2
  * @fileOverview Kickass library to create and place poppers near their reference elements.
3
- * @version 1.11.1
3
+ * @version 1.12.3
4
4
  * @license
5
5
  * Copyright (c) 2016 Federico Zivolo and contributors
6
6
  *
@@ -347,7 +347,7 @@ var isIE10$1 = function () {
347
347
  };
348
348
 
349
349
  function getSize(axis, body, html, computedStyle) {
350
- return Math.max(body['offset' + axis], html['client' + axis], html['offset' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0);
350
+ return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0);
351
351
  }
352
352
 
353
353
  function getWindowSizes() {
@@ -873,6 +873,7 @@ function update() {
873
873
  var data = {
874
874
  instance: this,
875
875
  styles: {},
876
+ arrowStyles: {},
876
877
  attributes: {},
877
878
  flipped: false,
878
879
  offsets: {}
@@ -1117,9 +1118,9 @@ function applyStyle(data) {
1117
1118
  // they will be set as HTML attributes of the element
1118
1119
  setAttributes(data.instance.popper, data.attributes);
1119
1120
 
1120
- // if the arrow style has been computed, apply the arrow style
1121
- if (data.offsets.arrow) {
1122
- setStyles(data.arrowElement, data.offsets.arrow);
1121
+ // if arrowElement is defined and arrowStyles has some properties
1122
+ if (data.arrowElement && Object.keys(data.arrowStyles).length) {
1123
+ setStyles(data.arrowElement, data.arrowStyles);
1123
1124
  }
1124
1125
 
1125
1126
  return data;
@@ -1239,9 +1240,10 @@ function computeStyle(data, options) {
1239
1240
  'x-placement': data.placement
1240
1241
  };
1241
1242
 
1242
- // Update attributes and styles of `data`
1243
+ // Update `data` attributes, styles and arrowStyles
1243
1244
  data.attributes = _extends({}, attributes, data.attributes);
1244
1245
  data.styles = _extends({}, styles, data.styles);
1246
+ data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
1245
1247
 
1246
1248
  return data;
1247
1249
  }
@@ -1314,13 +1316,15 @@ function arrow(data, options) {
1314
1316
  var isVertical = ['left', 'right'].indexOf(placement) !== -1;
1315
1317
 
1316
1318
  var len = isVertical ? 'height' : 'width';
1317
- var side = isVertical ? 'top' : 'left';
1319
+ var sideCapitalized = isVertical ? 'Top' : 'Left';
1320
+ var side = sideCapitalized.toLowerCase();
1318
1321
  var altSide = isVertical ? 'left' : 'top';
1319
1322
  var opSide = isVertical ? 'bottom' : 'right';
1320
1323
  var arrowElementSize = getOuterSizes(arrowElement)[len];
1321
1324
 
1322
1325
  //
1323
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
1326
+ // extends keepTogether behavior making sure the popper and its
1327
+ // reference have enough pixels in conjuction
1324
1328
  //
1325
1329
 
1326
1330
  // top/left side
@@ -1336,7 +1340,9 @@ function arrow(data, options) {
1336
1340
  var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
1337
1341
 
1338
1342
  // Compute the sideValue using the updated popper offsets
1339
- var sideValue = center - getClientRect(data.offsets.popper)[side];
1343
+ // take popper margin in account because we don't have this info available
1344
+ var popperMarginSide = getStyleComputedProperty(data.instance.popper, 'margin' + sideCapitalized).replace('px', '');
1345
+ var sideValue = center - getClientRect(data.offsets.popper)[side] - popperMarginSide;
1340
1346
 
1341
1347
  // prevent arrowElement from being placed not contiguously to its popper
1342
1348
  sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
@@ -1858,7 +1864,7 @@ function inner(data) {
1858
1864
 
1859
1865
  var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
1860
1866
 
1861
- popper[isHoriz ? 'left' : 'top'] = reference[placement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
1867
+ popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
1862
1868
 
1863
1869
  data.placement = getOppositePlacement(placement);
1864
1870
  data.offsets.popper = getClientRect(popper);
@@ -1936,6 +1942,9 @@ var modifiers = {
1936
1942
  * '10 - 5vh + 3%'
1937
1943
  * '-10px + 5vh, 5px - 6%'
1938
1944
  * ```
1945
+ * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
1946
+ * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
1947
+ * > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373)
1939
1948
  *
1940
1949
  * @memberof modifiers
1941
1950
  * @inner
@@ -2198,6 +2207,7 @@ var modifiers = {
2198
2207
  * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper.
2199
2208
  * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
2200
2209
  * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`)
2210
+ * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`)
2201
2211
  * @property {Object} data.boundaries Offsets of the popper boundaries
2202
2212
  * @property {Object} data.offsets The measurements of popper, reference and arrow elements.
2203
2213
  * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PopperJs
4
- VERSION = '1.11.1'
4
+ VERSION = '1.12.3'
5
5
  end
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.11.1
4
+ version: 1.12.3
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-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler