css-box-model
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -106,4 +106,3 @@ 'use strict'; | ||
var withScroll = function withScroll(original) { | ||
var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getWindowScroll(); | ||
var offset = function offset(original, change) { | ||
var borderBox = original.borderBox, | ||
@@ -114,3 +113,3 @@ border = original.border, | ||
var shifted = shift(borderBox, scroll); | ||
var shifted = shift(borderBox, change); | ||
@@ -125,2 +124,7 @@ return createBox({ | ||
var withScroll = function withScroll(original) { | ||
var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getWindowScroll(); | ||
return offset(original, scroll); | ||
}; | ||
var calculateBox = function calculateBox(borderBox, styles) { | ||
@@ -163,4 +167,5 @@ var margin = { | ||
exports.createBox = createBox; | ||
exports.offset = offset; | ||
exports.withScroll = withScroll; | ||
exports.calculateBox = calculateBox; | ||
exports.getBox = getBox; |
@@ -102,4 +102,3 @@ var getRect = function getRect(_ref) { | ||
var withScroll = function withScroll(original) { | ||
var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getWindowScroll(); | ||
var offset = function offset(original, change) { | ||
var borderBox = original.borderBox, | ||
@@ -110,3 +109,3 @@ border = original.border, | ||
var shifted = shift(borderBox, scroll); | ||
var shifted = shift(borderBox, change); | ||
@@ -121,2 +120,7 @@ return createBox({ | ||
var withScroll = function withScroll(original) { | ||
var scroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getWindowScroll(); | ||
return offset(original, scroll); | ||
}; | ||
var calculateBox = function calculateBox(borderBox, styles) { | ||
@@ -157,2 +161,2 @@ var margin = { | ||
export { getRect, createBox, withScroll, calculateBox, getBox }; | ||
export { getRect, createBox, offset, withScroll, calculateBox, getBox }; |
{ | ||
"name": "css-box-model", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Returns the css box model for a HTMLElement", | ||
@@ -32,14 +32,14 @@ "author": "Alex Reardon <alexreardon@gmail.com>", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-flow": "^6.23.0", | ||
"flow-bin": "^0.70.0", | ||
"jest": "^22.4.3", | ||
"prettier": "1.12.0", | ||
"flow-bin": "^0.74.0", | ||
"jest": "^23.1.0", | ||
"prettier": "1.13.4", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.58.1", | ||
"rollup-plugin-babel": "^3.0.3" | ||
"rollup": "^0.60.1", | ||
"rollup-plugin-babel": "^3.0.4" | ||
} | ||
} |
@@ -162,8 +162,5 @@ // @flow | ||
export const withScroll = ( | ||
original: BoxModel, | ||
scroll?: Position = getWindowScroll(), | ||
): BoxModel => { | ||
export const offset = (original: BoxModel, change: Position): BoxModel => { | ||
const { borderBox, border, margin, padding } = original; | ||
const shifted: Spacing = shift(borderBox, scroll); | ||
const shifted: Spacing = shift(borderBox, change); | ||
@@ -178,2 +175,7 @@ return createBox({ | ||
export const withScroll = ( | ||
original: BoxModel, | ||
scroll?: Position = getWindowScroll(), | ||
): BoxModel => offset(original, scroll); | ||
// Exposing this function directly for performance. If you have already computed these things | ||
@@ -180,0 +182,0 @@ // then you can simply pass them in |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19288
465
0