@cloudflare/util-responsive
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -6,3 +6,11 @@ # Change Log | ||
<a name="1.0.17"></a> | ||
<a name="1.0.18"></a> | ||
## [1.0.18](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-responsive@1.0.17...@cloudflare/util-responsive@1.0.18) (2018-07-12) | ||
**Note:** Version bump only for package @cloudflare/util-responsive | ||
<a name="1.0.17"></a> | ||
## [1.0.17](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-responsive@1.0.16...@cloudflare/util-responsive@1.0.17) (2018-07-03) | ||
@@ -15,3 +23,3 @@ | ||
<a name="1.0.16"></a> | ||
<a name="1.0.16"></a> | ||
## [1.0.16](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-responsive@1.0.15...@cloudflare/util-responsive@1.0.16) (2018-06-29) | ||
@@ -24,3 +32,3 @@ | ||
<a name="1.0.15"></a> | ||
<a name="1.0.15"></a> | ||
@@ -27,0 +35,0 @@ ## [1.0.15](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-responsive@1.0.14...@cloudflare/util-responsive@1.0.15) (2018-06-29) |
@@ -1,11 +0,21 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
import React from 'react'; | ||
@@ -15,5 +25,6 @@ import PropTypes from 'prop-types'; | ||
import { Box } from '@cloudflare/component-box'; | ||
export default (function (Comp) { | ||
var InnerComp = function (_React$PureComponent) { | ||
var InnerComp = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent) { | ||
_inherits(InnerComp, _React$PureComponent); | ||
@@ -24,7 +35,7 @@ | ||
return _possibleConstructorReturn(this, (InnerComp.__proto__ || Object.getPrototypeOf(InnerComp)).apply(this, arguments)); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(InnerComp).apply(this, arguments)); | ||
} | ||
_createClass(InnerComp, [{ | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -47,37 +58,44 @@ return React.createElement(Comp, _extends({}, this.props, { | ||
}; | ||
var SizedComp = Dimensions()(InnerComp); // Provide containerWidth | ||
// | ||
var WrapperInit = function (_React$PureComponent2) { | ||
var WrapperInit = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent2) { | ||
_inherits(WrapperInit, _React$PureComponent2); | ||
function WrapperInit(props) { | ||
var _this; | ||
_classCallCheck(this, WrapperInit); | ||
var _this2 = _possibleConstructorReturn(this, (WrapperInit.__proto__ || Object.getPrototypeOf(WrapperInit)).call(this, props)); | ||
_this2.state = { init: false }; | ||
return _this2; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(WrapperInit).call(this, props)); | ||
_this.state = { | ||
init: false | ||
}; | ||
return _this; | ||
} | ||
_createClass(WrapperInit, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
var _this3 = this; | ||
var _this2 = this; | ||
// Attach SizedComp asynchronously on 2nd render to ensure containerWidth is computed after all Fela styles have been attached to the DOM | ||
setTimeout(function () { | ||
return _this3.setState({ init: true }); | ||
return _this2.setState({ | ||
init: true | ||
}); | ||
}); | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
width = _props.width, | ||
height = _props.height; | ||
return this.state.init ? React.createElement(SizedComp, this.props) : React.createElement(Box, { width: width, height: height }); | ||
var _this$props = this.props, | ||
width = _this$props.width, | ||
height = _this$props.height; | ||
return this.state.init ? React.createElement(SizedComp, this.props) : React.createElement(Box, { | ||
width: width, | ||
height: height | ||
}); | ||
} | ||
@@ -93,4 +111,3 @@ }]); | ||
}; | ||
return WrapperInit; | ||
}); |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _withAutoWidth = require('./withAutoWidth'); | ||
Object.defineProperty(exports, 'withAutoWidth', { | ||
Object.defineProperty(exports, "withAutoWidth", { | ||
enumerable: true, | ||
get: function () { | ||
return _interopRequireDefault(_withAutoWidth).default; | ||
get: function get() { | ||
return _withAutoWidth.default; | ||
} | ||
}); | ||
var _withAutoWidth = _interopRequireDefault(require("./withAutoWidth")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,33 +6,61 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react = require('react'); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _reactDimensions = _interopRequireDefault(require("react-dimensions")); | ||
var _propTypes = require('prop-types'); | ||
var _componentBox = require("@cloudflare/component-box"); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _reactDimensions = require('react-dimensions'); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var _reactDimensions2 = _interopRequireDefault(_reactDimensions); | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var _componentBox = require('@cloudflare/component-box'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
exports.default = Comp => { | ||
class InnerComp extends _react2.default.PureComponent { | ||
render() { | ||
return _react2.default.createElement(Comp, _extends({}, this.props, { | ||
width: this.props.width || this.props.containerWidth | ||
})); | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var _default = function _default(Comp) { | ||
var InnerComp = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent) { | ||
_inherits(InnerComp, _React$PureComponent); | ||
function InnerComp() { | ||
_classCallCheck(this, InnerComp); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(InnerComp).apply(this, arguments)); | ||
} | ||
} | ||
_createClass(InnerComp, [{ | ||
key: "render", | ||
value: function render() { | ||
return _react.default.createElement(Comp, _extends({}, this.props, { | ||
width: this.props.width || this.props.containerWidth | ||
})); | ||
} | ||
}]); | ||
return InnerComp; | ||
}(_react.default.PureComponent); | ||
InnerComp.propTypes = { | ||
width: _propTypes2.default.number, | ||
containerWidth: _propTypes2.default.number.isRequired | ||
width: _propTypes.default.number, | ||
containerWidth: _propTypes.default.number.isRequired | ||
}; | ||
@@ -42,30 +70,57 @@ InnerComp.defaultProps = { | ||
}; | ||
var SizedComp = (0, _reactDimensions.default)()(InnerComp); // Provide containerWidth | ||
// | ||
const SizedComp = (0, _reactDimensions2.default)()(InnerComp); // Provide containerWidth | ||
var WrapperInit = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent2) { | ||
_inherits(WrapperInit, _React$PureComponent2); | ||
// | ||
function WrapperInit(props) { | ||
var _this; | ||
class WrapperInit extends _react2.default.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
this.state = { init: false }; | ||
} | ||
_classCallCheck(this, WrapperInit); | ||
componentDidMount() { | ||
// Attach SizedComp asynchronously on 2nd render to ensure containerWidth is computed after all Fela styles have been attached to the DOM | ||
setTimeout(() => this.setState({ init: true })); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(WrapperInit).call(this, props)); | ||
_this.state = { | ||
init: false | ||
}; | ||
return _this; | ||
} | ||
render() { | ||
const { width, height } = this.props; | ||
return this.state.init ? _react2.default.createElement(SizedComp, this.props) : _react2.default.createElement(_componentBox.Box, { width: width, height: height }); | ||
} | ||
} | ||
_createClass(WrapperInit, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
var _this2 = this; | ||
// Attach SizedComp asynchronously on 2nd render to ensure containerWidth is computed after all Fela styles have been attached to the DOM | ||
setTimeout(function () { | ||
return _this2.setState({ | ||
init: true | ||
}); | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
width = _this$props.width, | ||
height = _this$props.height; | ||
return this.state.init ? _react.default.createElement(SizedComp, this.props) : _react.default.createElement(_componentBox.Box, { | ||
width: width, | ||
height: height | ||
}); | ||
} | ||
}]); | ||
return WrapperInit; | ||
}(_react.default.PureComponent); | ||
WrapperInit.propTypes = { | ||
width: _propTypes2.default.number, | ||
height: _propTypes2.default.number | ||
width: _propTypes.default.number, | ||
height: _propTypes.default.number | ||
}; | ||
return WrapperInit; | ||
}; | ||
return WrapperInit; | ||
}; | ||
exports.default = _default; |
{ | ||
"name": "@cloudflare/util-responsive", | ||
"description": "Cloudflare Responsive Design Utils", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"main": "lib/index.js", | ||
@@ -14,4 +14,4 @@ "module": "es/index.js", | ||
"dependencies": { | ||
"@cloudflare/component-box": "^1.0.17", | ||
"@cloudflare/style-container": "^2.0.3", | ||
"@cloudflare/component-box": "^2.0.0", | ||
"@cloudflare/style-container": "^3.0.0", | ||
"prop-types": "^15.6.0", | ||
@@ -18,0 +18,0 @@ "react-dimensions": "^1.3.1" |
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
21541
245
+ Added@babel/runtime@7.26.0(transitive)
+ Added@cloudflare/component-box@2.4.7(transitive)
+ Added@cloudflare/intl-types@1.5.6(transitive)
+ Added@cloudflare/style-const@2.5.35.10.0(transitive)
+ Added@cloudflare/style-container@3.0.37.13.3(transitive)
+ Added@cloudflare/types@6.29.1(transitive)
+ Added@cloudflare/util-en-garde@8.0.10(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedfela@11.7.0(transitive)
+ Addedfela-bindings@11.7.0(transitive)
+ Addedfela-dom@11.7.0(transitive)
+ Addedfela-tools@11.7.0(transitive)
+ Addedfela-utils@11.7.0(transitive)
+ Addedfp-ts@2.16.9(transitive)
+ Addedio-ts@2.2.22(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedpolished@4.3.1(transitive)
+ Addedreact-addons-shallow-compare@15.6.3(transitive)
+ Addedreact-fela@11.7.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedsort-css-media-queries@1.5.4(transitive)
- Removed@cloudflare/component-box@1.0.17(transitive)
- Removed@cloudflare/style-const@1.0.12(transitive)
- Removed@cloudflare/style-container@2.0.3(transitive)
- Removedcss-in-js-utils@2.0.0(transitive)
- Removedfela-utils@7.0.5(transitive)