contain-by-screen
Advanced tools
Comparing version 1.0.3 to 1.0.4
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
@@ -7,11 +11,12 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = containByScreen; | ||
var _lodash = require('lodash'); | ||
var _flatten = require('lodash/flatten'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _flatten2 = _interopRequireDefault(_flatten); | ||
var _uniq = require('lodash/uniq'); | ||
var _uniq2 = _interopRequireDefault(_uniq); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -38,37 +43,30 @@ | ||
var positions = options.position && options.forcePosition ? [options.position] : _lodash2.default.uniq([options.position].concat(['top', 'bottom', 'left', 'right']).filter(Boolean)); | ||
var hAligns = options.hAlign && options.forceHAlign ? [options.hAlign] : _lodash2.default.uniq([options.hAlign].concat(['center', 'left', 'right']).filter(Boolean)); | ||
var vAligns = options.vAlign && options.forceVAlign ? [options.vAlign] : _lodash2.default.uniq([options.vAlign].concat(['center', 'top', 'bottom']).filter(Boolean)); | ||
var positions = options.position && options.forcePosition ? [options.position] : (0, _uniq2.default)([options.position].filter(Boolean).concat(['top', 'bottom', 'left', 'right'])); | ||
var hAligns = options.hAlign && options.forceHAlign ? [options.hAlign] : (0, _uniq2.default)([options.hAlign].filter(Boolean).concat(['center', 'left', 'right'])); | ||
var vAligns = options.vAlign && options.forceVAlign ? [options.vAlign] : (0, _uniq2.default)([options.vAlign].filter(Boolean).concat(['center', 'top', 'bottom'])); | ||
var choiceAndCoord = _lodash2.default.chain(positions).map(function (position) { | ||
var allPossibleChoices = (0, _flatten2.default)(positions.map(function (position) { | ||
return position === 'top' || position === 'bottom' ? hAligns.map(function (hAlign) { | ||
return { position: position, hAlign: hAlign }; | ||
}) : [{ position: position, hAlign: 'center' }]; | ||
}).flatten().map(function (_ref) { | ||
var position = _ref.position; | ||
var hAlign = _ref.hAlign; | ||
return position === 'top' || position === 'bottom' ? [{ position: position, hAlign: hAlign, vAlign: 'center' }] : vAligns.map(function (vAlign) { | ||
return { position: position, hAlign: hAlign, vAlign: vAlign }; | ||
return { position: position, hAlign: hAlign, vAlign: 'center' }; | ||
}) : vAligns.map(function (vAlign) { | ||
return { position: position, hAlign: 'center', vAlign: vAlign }; | ||
}); | ||
}).flatten() | ||
// We've got an array of all sensible {position, hAlign, vAlign} combinations | ||
.map(function (_ref2) { | ||
var position = _ref2.position; | ||
var hAlign = _ref2.hAlign; | ||
var vAlign = _ref2.vAlign; | ||
return { | ||
choice: { position: position, hAlign: hAlign, vAlign: vAlign }, | ||
coord: positionAndAlign(elRect, anchorRect, position, hAlign, vAlign, buffers) | ||
}; | ||
}).filter(function (_ref3) { | ||
var choice = _ref3.choice; | ||
var _ref3$coord = _ref3.coord; | ||
var top = _ref3$coord.top; | ||
var left = _ref3$coord.left; | ||
return top - buffers.all - buffers.top >= 0 && left - buffers.all - buffers.left >= 0 && top + elRect.height + buffers.all + buffers.bottom <= window.innerHeight && left + elRect.width + buffers.all + buffers.right <= window.innerWidth; | ||
}).first().value(); | ||
})); | ||
var choiceAndCoord = null; | ||
for (var i = 0; i < allPossibleChoices.length; i++) { | ||
var choice = allPossibleChoices[i]; | ||
var coord = positionAndAlign(elRect, anchorRect, choice, buffers); | ||
var _top = coord.top; | ||
var _left = coord.left; | ||
if (_top - buffers.all - buffers.top >= 0 && _left - buffers.all - buffers.left >= 0 && _top + elRect.height + buffers.all + buffers.bottom <= window.innerHeight && _left + elRect.width + buffers.all + buffers.right <= window.innerWidth) { | ||
choiceAndCoord = { choice: choice, coord: coord }; | ||
break; | ||
} | ||
} | ||
// Fallback if we failed to find a position that fit on the screen. | ||
if (!choiceAndCoord) { | ||
var choice = { | ||
var _choice = { | ||
position: options.position || 'top', | ||
@@ -79,4 +77,4 @@ hAlign: options.hAlign || 'center', | ||
choiceAndCoord = { | ||
choice: choice, | ||
coord: positionAndAlign(elRect, anchorRect, choice.position, choice.hAlign, choice.vAlign, buffers) | ||
choice: _choice, | ||
coord: positionAndAlign(elRect, anchorRect, _choice, buffers) | ||
}; | ||
@@ -103,3 +101,7 @@ } | ||
function positionAndAlign(elRect, anchorRect, position, hAlign, vAlign, buffers) { | ||
function positionAndAlign(elRect, anchorRect, _ref, buffers) { | ||
var position = _ref.position; | ||
var hAlign = _ref.hAlign; | ||
var vAlign = _ref.vAlign; | ||
var top = 0, | ||
@@ -159,2 +161,2 @@ left = 0; | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7a0JBY3dCOzs7Ozs7OztBQUFULFNBQVMsZUFBVCxDQUF5QixPQUF6QixFQUErQyxXQUEvQyxFQUF5RSxPQUF6RSxFQUNzQztBQUNuRCxNQUFJLFFBQVEsR0FBUixDQUFZLFFBQVosS0FBeUIsWUFBekIsSUFBeUMsT0FBTyxnQkFBUCxFQUF5QjtBQUNwRSxRQUFNLFFBQVEsT0FBTyxnQkFBUCxDQUF3QixPQUF4QixDQUFSLENBRDhEO0FBRXBFLFFBQUksTUFBTSxRQUFOLEtBQW1CLE9BQW5CLEVBQTRCO0FBQzlCLGNBQVEsS0FBUixDQUFjLHVEQUFkLEVBQXVFLE9BQXZFLEVBRDhCO0tBQWhDO0dBRkY7O0FBT0EsTUFBTSxTQUFlLHNCQUFzQixPQUF0QixDQUFmLENBUjZDO0FBU25ELE1BQU0sYUFBbUIsc0JBQXNCLFdBQXRCLENBQW5CLENBVDZDOztBQVduRCxNQUFNLFVBQVU7QUFDZCxTQUFLLFFBQVEsTUFBUixJQUFrQixDQUFsQjtBQUNMLFNBQUssUUFBUSxTQUFSLElBQXFCLENBQXJCO0FBQ0wsWUFBUSxRQUFRLFlBQVIsSUFBd0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FzZSAnY2VudGVyJzpcbiAgICAgICAgdG9wID0gTWF0aC5yb3VuZCgoYW5jaG9yUmVjdC50b3AgKyBhbmNob3JSZWN0LmJvdHRvbSAtIGVsUmVjdC5oZWlnaHQpLzIpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ3RvcCc6XG4gICAgICAgIHRvcCA9IE1hdGgucm91bmQoYW5jaG9yUmVjdC50b3ApO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ2JvdHRvbSc6XG4gICAgICAgIHRvcCA9IE1hdGgucm91bmQoYW5jaG9yUmVjdC5ib3R0b20gLSBlbFJlY3QuaGVpZ2h0KTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBkZWZhdWx0OiB0aHJvdyBuZXcgRXJyb3IoXCJTaG91bGQgbm90IGhhcHBlblwiKTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHt0b3AsIGxlZnR9O1xufVxuIl19 |
{ | ||
"name": "contain-by-screen", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Position a dropdown element near a button in a way that fits on the screen.", | ||
"main": "js/index.js", | ||
"scripts": { | ||
"prepublish": "babel -s inline -d js/ src/ && cp -v src/index.js.flow js/", | ||
"prepublish": "babel -s inline -d js/ src/ && flow-copy-source -v src js", | ||
"test": "mocha" | ||
@@ -21,2 +21,7 @@ }, | ||
"license": "MIT", | ||
"browserify": { | ||
"transform": [ | ||
"envify" | ||
] | ||
}, | ||
"bugs": { | ||
@@ -28,3 +33,3 @@ "url": "https://github.com/AgentME/contain-by-screen/issues" | ||
"babel-cli": "^6.4.0", | ||
"babel-plugin-add-module-exports": "^0.1.3-alpha", | ||
"babel-plugin-add-module-exports": "^0.1.2", | ||
"babel-plugin-transform-class-properties": "^6.4.0", | ||
@@ -35,2 +40,3 @@ "babel-plugin-transform-flow-strip-types": "^6.4.0", | ||
"babel-register": "^6.4.3", | ||
"flow-copy-source": "^1.0.1", | ||
"mocha": "^2.3.4" | ||
@@ -40,4 +46,5 @@ }, | ||
"babel-runtime": "^6.3.19", | ||
"lodash": "^3.10.1" | ||
"envify": "^3.4.0", | ||
"lodash": "^4.6.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30241
10
3
9
143
+ Addedenvify@^3.4.0
+ Addedacorn@5.7.4(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedast-types@0.9.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase62@1.2.8(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedenvify@3.4.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjstransform@11.0.3(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedobject-assign@2.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedq@1.5.1(transitive)
+ Addedrecast@0.11.23(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsource-map@0.4.40.5.7(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedlodash@3.10.1(transitive)
Updatedlodash@^4.6.1