Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-box-model

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-box-model - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

16

dist/css-box-model.cjs.js

@@ -89,3 +89,7 @@ 'use strict';

var suffix = raw.slice(-2);
!(suffix === 'px') ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected value to be a pixel value.\n Expected form: 10px\n Actual value: " + raw + "\n ") : invariant(false) : void 0;
if (suffix !== 'px') {
return 0;
}
var result = Number(value);

@@ -155,9 +159,9 @@ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;

exports.calculateBox = calculateBox;
exports.createBox = createBox;
exports.expand = expand;
exports.getBox = getBox;
exports.getRect = getRect;
exports.expand = expand;
exports.offset = offset;
exports.shrink = shrink;
exports.createBox = createBox;
exports.offset = offset;
exports.withScroll = withScroll;
exports.calculateBox = calculateBox;
exports.getBox = getBox;

@@ -83,3 +83,7 @@ import invariant from 'tiny-invariant';

var suffix = raw.slice(-2);
!(suffix === 'px') ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected value to be a pixel value.\n Expected form: 10px\n Actual value: " + raw + "\n ") : invariant(false) : void 0;
if (suffix !== 'px') {
return 0;
}
var result = Number(value);

@@ -149,2 +153,2 @@ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;

export { getRect, expand, shrink, createBox, offset, withScroll, calculateBox, getBox };
export { calculateBox, createBox, expand, getBox, getRect, offset, shrink, withScroll };
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.cssBoxModel = {})));
}(this, (function (exports) { 'use strict';
(global = global || self, factory(global.cssBoxModel = {}));
}(this, function (exports) { 'use strict';

@@ -99,3 +99,7 @@ var prefix = 'Invariant failed';

var suffix = raw.slice(-2);
!(suffix === 'px') ? invariant(false, "Expected value to be a pixel value.\n Expected form: 10px\n Actual value: " + raw + "\n ") : void 0;
if (suffix !== 'px') {
return 0;
}
var result = Number(value);

@@ -165,13 +169,13 @@ !!isNaN(result) ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : void 0;

exports.calculateBox = calculateBox;
exports.createBox = createBox;
exports.expand = expand;
exports.getBox = getBox;
exports.getRect = getRect;
exports.expand = expand;
exports.offset = offset;
exports.shrink = shrink;
exports.createBox = createBox;
exports.offset = offset;
exports.withScroll = withScroll;
exports.calculateBox = calculateBox;
exports.getBox = getBox;
Object.defineProperty(exports, '__esModule', { value: true });
})));
}));

@@ -1,1 +0,1 @@

!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o(t.cssBoxModel={})}(this,function(t){"use strict";function e(t,o){if(!t)throw new Error("Invariant failed")}var b=function(t){var o=t.top,r=t.right,e=t.bottom,i=t.left;return{top:o,right:r,bottom:e,left:i,width:r-i,height:e-o,x:i,y:o,center:{x:(r+i)/2,y:(e+o)/2}}},m=function(t,o){return{top:t.top-o.top,left:t.left-o.left,bottom:t.bottom+o.bottom,right:t.right+o.right}},u=function(t,o){return{top:t.top+o.top,left:t.left+o.left,bottom:t.bottom-o.bottom,right:t.right-o.right}},h={top:0,right:0,bottom:0,left:0},a=function(t){var o=t.borderBox,r=t.margin,e=void 0===r?h:r,i=t.border,n=void 0===i?h:i,d=t.padding,f=void 0===d?h:d,g=b(m(o,e)),a=b(u(o,n)),p=b(u(a,f));return{marginBox:g,borderBox:b(o),paddingBox:a,contentBox:p,margin:e,border:n,padding:f}},n=function(t){var o=t.slice(0,-2);"px"!==t.slice(-2)&&e(!1);var r=Number(o);return isNaN(r)&&e(!1),r},r=function(t,o){var r,e,i=t.borderBox,n=t.border,d=t.margin,f=t.padding,g=(e=o,{top:(r=i).top+e.y,left:r.left+e.x,bottom:r.bottom+e.y,right:r.right+e.x});return a({borderBox:g,border:n,margin:d,padding:f})},i=function(t,o){var r={top:n(o.marginTop),right:n(o.marginRight),bottom:n(o.marginBottom),left:n(o.marginLeft)},e={top:n(o.paddingTop),right:n(o.paddingRight),bottom:n(o.paddingBottom),left:n(o.paddingLeft)},i={top:n(o.borderTopWidth),right:n(o.borderRightWidth),bottom:n(o.borderBottomWidth),left:n(o.borderLeftWidth)};return a({borderBox:t,margin:r,padding:e,border:i})};t.getRect=b,t.expand=m,t.shrink=u,t.createBox=a,t.offset=r,t.withScroll=function(t,o){return void 0===o&&(o={x:window.pageXOffset,y:window.pageYOffset}),r(t,o)},t.calculateBox=i,t.getBox=function(t){var o=t.getBoundingClientRect(),r=window.getComputedStyle(t);return i(o,r)},Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((t=t||self).cssBoxModel={})}(this,function(t){"use strict";var u=function(t){var o=t.top,r=t.right,e=t.bottom,i=t.left;return{top:o,right:r,bottom:e,left:i,width:r-i,height:e-o,x:i,y:o,center:{x:(r+i)/2,y:(e+o)/2}}},b=function(t,o){return{top:t.top-o.top,left:t.left-o.left,bottom:t.bottom+o.bottom,right:t.right+o.right}},m=function(t,o){return{top:t.top+o.top,left:t.left+o.left,bottom:t.bottom-o.bottom,right:t.right-o.right}},h={top:0,right:0,bottom:0,left:0},a=function(t){var o=t.borderBox,r=t.margin,e=void 0===r?h:r,i=t.border,n=void 0===i?h:i,d=t.padding,f=void 0===d?h:d,g=u(b(o,e)),a=u(m(o,n)),p=u(m(a,f));return{marginBox:g,borderBox:u(o),paddingBox:a,contentBox:p,margin:e,border:n,padding:f}},n=function(t){var o=t.slice(0,-2);if("px"!==t.slice(-2))return 0;var r=Number(o);return isNaN(r)&&function(t,o){if(!t)throw new Error("Invariant failed")}(!1),r},r=function(t,o){var r,e,i=t.borderBox,n=t.border,d=t.margin,f=t.padding,g=(e=o,{top:(r=i).top+e.y,left:r.left+e.x,bottom:r.bottom+e.y,right:r.right+e.x});return a({borderBox:g,border:n,margin:d,padding:f})},e=function(t,o){var r={top:n(o.marginTop),right:n(o.marginRight),bottom:n(o.marginBottom),left:n(o.marginLeft)},e={top:n(o.paddingTop),right:n(o.paddingRight),bottom:n(o.paddingBottom),left:n(o.paddingLeft)},i={top:n(o.borderTopWidth),right:n(o.borderRightWidth),bottom:n(o.borderBottomWidth),left:n(o.borderLeftWidth)};return a({borderBox:t,margin:r,padding:e,border:i})};t.calculateBox=e,t.createBox=a,t.expand=b,t.getBox=function(t){var o=t.getBoundingClientRect(),r=window.getComputedStyle(t);return e(o,r)},t.getRect=u,t.offset=r,t.shrink=m,t.withScroll=function(t,o){return void 0===o&&(o={x:window.pageXOffset,y:window.pageYOffset}),r(t,o)},Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "css-box-model",
"version": "1.1.1",
"version": "1.1.2",
"description": "Get accurate and well named css box model information about an Element 📦",

@@ -9,6 +9,6 @@ "author": "Alex Reardon <alexreardon@gmail.com>",

"type": "git",
"url": "https://github.com/atlassian/react-beautiful-dnd.git"
"url": "https://github.com/alexreardon/css-box-model.git"
},
"bugs": {
"url": "https://github.com/atlassian/react-beautiful-dnd/issues"
"url": "https://github.com/alexreardon/css-box-model/issues"
},

@@ -45,22 +45,22 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-flow": "^7.0.0",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-jest": "^24.8.0",
"babel-plugin-dev-expression": "^0.2.1",
"flow-bin": "^0.85.0",
"jest": "^23.6.0",
"prettier": "1.15.0",
"rimraf": "^2.6.2",
"rollup": "^0.67.0",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^6.0.0"
"flow-bin": "^0.98.1",
"jest": "^24.8.0",
"prettier": "1.17.0",
"rimraf": "^2.6.3",
"rollup": "^1.11.3",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2"
},
"dependencies": {
"tiny-invariant": "^1.0.3"
"tiny-invariant": "^1.0.4"
}
}

@@ -160,10 +160,15 @@ // @flow

const suffix: string = raw.slice(-2);
invariant(
suffix === 'px',
`Expected value to be a pixel value.
Expected form: 10px
Actual value: ${raw}
`,
);
// ## Used values vs computed values
// `getComputedStyle` will return the * used values * if the
// element has `display: none` and the *computed values* otherwise
// *used values* can include 'rem' etc.
// Rather than throwing we are returning `0`.
// Given that the element is _not visible_ it takes up no visible space and so `0` is correct
// ## `jsdom`
// The `raw` value can also not be populated in jsdom
if (suffix !== 'px') {
return 0;
}
const result: number = Number(value);

@@ -170,0 +175,0 @@ invariant(

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc