rax-countdown
Advanced tools
Comparing version 0.3.8 to 0.4.0
@@ -37,5 +37,2 @@ module.exports = function(require, exports, module) { | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
@@ -68,3 +65,3 @@ /******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 5); | ||
/******/ return __webpack_require__(__webpack_require__.s = 3); | ||
/******/ }) | ||
@@ -208,4 +205,2 @@ /************************************************************************/ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -215,28 +210,12 @@ value: true | ||
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 _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; }; }(); | ||
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; | ||
}; | ||
}(); | ||
var _class, _temp2; | ||
var _class, _temp; | ||
var _rax = __webpack_require__(0); | ||
var _universalEnv = __webpack_require__(1); | ||
var _raxText = __webpack_require__(4); | ||
var _raxText2 = _interopRequireDefault(_raxText); | ||
var _raxView = __webpack_require__(2); | ||
@@ -246,105 +225,223 @@ | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
var _raxImage = __webpack_require__(5); | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
var _raxImage2 = _interopRequireDefault(_raxImage); | ||
function _possibleConstructorReturn(self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self; | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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 === "undefined" ? "undefined" : _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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var Image = (_temp = _class = function (_Component) { | ||
_inherits(Image, _Component); | ||
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 Image() { | ||
_classCallCheck(this, Image); | ||
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; } | ||
return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments)); | ||
} | ||
function isFunction(functionToCheck) { | ||
return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'; | ||
}; | ||
_createClass(Image, [{ | ||
key: 'render', | ||
value: function render() { | ||
var nativeProps = _extends({}, this.props); | ||
var source = nativeProps.source; | ||
function addZero(num, timeWrapStyle, timeBackground, timeBackgroundStyle, timeStyle, secondStyle) { | ||
var displayNum = num < 0 ? 0 : num; | ||
var displayFirstNum = displayNum < 10 ? 0 : displayNum.toString().slice(0, 1); | ||
var displaySecondNum = displayNum < 10 ? displayNum : displayNum.toString().slice(1); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: [timeWrapStyle, styles.item] }, | ||
timeBackground ? (0, _rax.createElement)(_raxImage2.default, { source: timeBackground, style: timeBackgroundStyle }) : null, | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: timeStyle }, | ||
'' + displayFirstNum | ||
), | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: secondStyle }, | ||
'' + displaySecondNum | ||
) | ||
); | ||
}; | ||
// Source must a object | ||
if (source && source.uri) { | ||
var style = nativeProps.style; | ||
var width = source.width, | ||
height = source.height, | ||
uri = source.uri; | ||
var Index = (_temp2 = _class = function (_Component) { | ||
_inherits(Index, _Component); | ||
// Default is 0 | ||
function Index() { | ||
var _ref; | ||
if (width == null && height == null && style.height == null && style.width == null) { | ||
width = 0; | ||
height = 0; | ||
} | ||
var _temp, _this, _ret; | ||
nativeProps.style = _extends(_extends({}, !this.context.isInAParentText && { display: 'flex' }, { | ||
width: width, | ||
height: height | ||
}), style); | ||
nativeProps.src = uri; | ||
_classCallCheck(this, Index); | ||
delete nativeProps.source; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var NativeImage = void 0; | ||
if (_universalEnv.isWeex) { | ||
NativeImage = 'image'; | ||
} else { | ||
NativeImage = 'img'; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Index.__proto__ || Object.getPrototypeOf(Index)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
timeRemaining: 0 | ||
}, _this.timeoutId = 0, _this.tick = function () { | ||
var _this$props = _this.props, | ||
onComplete = _this$props.onComplete, | ||
onTick = _this$props.onTick, | ||
interval = _this$props.interval; | ||
var timeRemaining = _this.state.timeRemaining; | ||
// for cover and contain | ||
var resizeMode = nativeProps.resizeMode || nativeProps.style.resizeMode; | ||
if (resizeMode) { | ||
if (_universalEnv.isWeex) { | ||
nativeProps.resize = resizeMode; | ||
nativeProps.style.resizeMode = resizeMode; | ||
} else { | ||
nativeProps.style.objectFit = resizeMode; | ||
} | ||
} | ||
var countdownComplete = 1000 > timeRemaining; | ||
if (this.props.children) { | ||
nativeProps.children = null; | ||
return (0, _rax.createElement)(_raxView2.default, { style: nativeProps.style }, (0, _rax.createElement)(NativeImage, nativeProps), (0, _rax.createElement)(_raxView2.default, { style: styles.absoluteImage }, this.props.children)); | ||
} else { | ||
return (0, _rax.createElement)(NativeImage, nativeProps); | ||
if (_this.timeoutId) { | ||
clearTimeout(_this.timeoutId); | ||
} | ||
if (countdownComplete && isFunction(onComplete)) { | ||
onComplete(); | ||
} else { | ||
_this.timeoutId = !countdownComplete ? setTimeout(function () { | ||
return _this.setState({ | ||
timeRemaining: timeRemaining - interval | ||
}, function () { | ||
return isFunction(onTick) && onTick(timeRemaining); | ||
}); | ||
}, interval) : false; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(Index, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
var timeRemaining = this.props.timeRemaining; | ||
this.setState({ | ||
timeRemaining: timeRemaining | ||
}); | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(newProps) { | ||
if (newProps.timeRemaining !== this.props.timeRemaining) { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
} | ||
this.setState({ | ||
timeRemaining: newProps.timeRemaining | ||
}); | ||
} | ||
return null; | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
} | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return this.props.timeRemaining !== nextProps.timeRemaining || this.state.timeRemaining !== nextState.timeRemaining; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var timeRemaining = this.state.timeRemaining; | ||
var _props = this.props, | ||
formatFunc = _props.formatFunc, | ||
timeStyle = _props.timeStyle, | ||
timeBackgroundStyle = _props.timeBackgroundStyle, | ||
timeWrapStyle = _props.timeWrapStyle, | ||
timeBackground = _props.timeBackground, | ||
secondStyle = _props.secondStyle, | ||
textStyle = _props.textStyle, | ||
tpl = _props.tpl; | ||
if (formatFunc) { | ||
return formatFunc(timeRemaining); | ||
} | ||
var totalSeconds = Math.floor(timeRemaining / 1000); | ||
var days = parseInt(totalSeconds / 3600 / 24); | ||
var hours = parseInt(totalSeconds / 3600) % 24; | ||
var minutes = parseInt(totalSeconds / 60) % 60; | ||
var seconds = parseInt(totalSeconds % 60); | ||
var _timeBackgroundStyle = [styles.background, timeBackgroundStyle]; | ||
var isDay = new RegExp('{d}').test(tpl); | ||
var isHours = new RegExp('{h}').test(tpl); | ||
var isMinutes = new RegExp('{m}').test(tpl); | ||
var isSeconds = new RegExp('{s}').test(tpl); | ||
var tplIndexOfDay = tpl.indexOf('d'); | ||
var tplIndexOfHours = tpl.indexOf('h'); | ||
var tplIndexOfMinutes = tpl.indexOf('m'); | ||
var tplIndexOfSeconds = tpl.indexOf('s'); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: styles.main }, | ||
isDay ? addZero(days, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isDay ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfDay + 2, tplIndexOfDay + 3) | ||
) : null, | ||
isHours ? addZero(hours, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isHours ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfHours + 2, tplIndexOfHours + 3) | ||
) : null, | ||
isMinutes ? addZero(minutes, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isMinutes ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfMinutes + 2, tplIndexOfMinutes + 3) | ||
) : null, | ||
isSeconds ? addZero(seconds, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, secondStyle) : null, | ||
isSeconds ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfSeconds + 2, tplIndexOfSeconds + 3) | ||
) : null | ||
); | ||
} | ||
}]); | ||
return Image; | ||
}(_rax.Component), _class.propTypes = {}, _class.resizeMode = { | ||
contain: 'contain', | ||
cover: 'cover', | ||
stretch: 'stretch', | ||
center: 'center', | ||
repeat: 'repeat' | ||
}, _class.contextTypes = { | ||
isInAParentText: _rax.PropTypes.bool | ||
}, _temp); | ||
return Index; | ||
}(_rax.Component), _class.propTypes = { | ||
formatFunc: _rax.PropTypes.func, | ||
onTick: _rax.PropTypes.func, | ||
onComplete: _rax.PropTypes.func, | ||
tpl: _rax.PropTypes.string, // template (example {h}:{m}:{s}) | ||
timeRemaining: _rax.PropTypes.number, | ||
secondStyle: _rax.PropTypes.object, | ||
timeStyle: _rax.PropTypes.object, // style for num | ||
textStyle: _rax.PropTypes.object, // style for text | ||
timeWrapStyle: _rax.PropTypes.object, | ||
timeBackground: _rax.PropTypes.string, | ||
timeBackgroundStyle: _rax.PropTypes.object, | ||
interval: _rax.PropTypes.number | ||
}, _class.defaultProps = { | ||
tpl: '{d}天{h}时{m}分{s}秒', | ||
timeRemaining: 0, | ||
interval: 1000 | ||
}, _temp2); | ||
var styles = { | ||
absoluteImage: { | ||
left: 0, | ||
top: 0, | ||
main: { | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
alignItems: 'center' | ||
}, | ||
item: { | ||
flexDirection: 'row' | ||
}, | ||
background: { | ||
position: 'absolute' | ||
@@ -354,3 +451,3 @@ } | ||
exports.default = Image; | ||
exports.default = Index; | ||
module.exports = exports['default']; | ||
@@ -601,2 +698,4 @@ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -606,12 +705,28 @@ value: true | ||
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; }; }(); | ||
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 _class, _temp2; | ||
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; | ||
}; | ||
}(); | ||
var _class, _temp; | ||
var _rax = __webpack_require__(0); | ||
var _raxText = __webpack_require__(4); | ||
var _universalEnv = __webpack_require__(1); | ||
var _raxText2 = _interopRequireDefault(_raxText); | ||
var _raxView = __webpack_require__(2); | ||
@@ -621,223 +736,105 @@ | ||
var _raxImage = __webpack_require__(3); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
var _raxImage2 = _interopRequireDefault(_raxImage); | ||
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 _possibleConstructorReturn(self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self; | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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 === "undefined" ? "undefined" : _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 _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; } | ||
var Image = (_temp = _class = function (_Component) { | ||
_inherits(Image, _Component); | ||
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 Image() { | ||
_classCallCheck(this, Image); | ||
function isFunction(functionToCheck) { | ||
return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'; | ||
}; | ||
return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments)); | ||
} | ||
function addZero(num, timeWrapStyle, timeBackground, timeBackgroundStyle, timeStyle, secondStyle) { | ||
var displayNum = num < 0 ? 0 : num; | ||
var displayFirstNum = displayNum < 10 ? 0 : displayNum.toString().slice(0, 1); | ||
var displaySecondNum = displayNum < 10 ? displayNum : displayNum.toString().slice(1); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: [timeWrapStyle, styles.item] }, | ||
timeBackground ? (0, _rax.createElement)(_raxImage2.default, { source: timeBackground, style: timeBackgroundStyle }) : null, | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: timeStyle }, | ||
'' + displayFirstNum | ||
), | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: secondStyle }, | ||
'' + displaySecondNum | ||
) | ||
); | ||
}; | ||
_createClass(Image, [{ | ||
key: 'render', | ||
value: function render() { | ||
var nativeProps = _extends({}, this.props); | ||
var source = nativeProps.source; | ||
var Index = (_temp2 = _class = function (_Component) { | ||
_inherits(Index, _Component); | ||
// Source must a object | ||
if (source && source.uri) { | ||
var style = nativeProps.style; | ||
var width = source.width, | ||
height = source.height, | ||
uri = source.uri; | ||
function Index() { | ||
var _ref; | ||
// Default is 0 | ||
var _temp, _this, _ret; | ||
if (width == null && height == null && style.height == null && style.width == null) { | ||
width = 0; | ||
height = 0; | ||
} | ||
_classCallCheck(this, Index); | ||
nativeProps.style = _extends(_extends({}, !this.context.isInAParentText && { display: 'flex' }, { | ||
width: width, | ||
height: height | ||
}), style); | ||
nativeProps.src = uri; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
delete nativeProps.source; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Index.__proto__ || Object.getPrototypeOf(Index)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
timeRemaining: 0 | ||
}, _this.timeoutId = 0, _this.tick = function () { | ||
var _this$props = _this.props, | ||
onComplete = _this$props.onComplete, | ||
onTick = _this$props.onTick, | ||
interval = _this$props.interval; | ||
var timeRemaining = _this.state.timeRemaining; | ||
var NativeImage = void 0; | ||
if (_universalEnv.isWeex) { | ||
NativeImage = 'image'; | ||
} else { | ||
NativeImage = 'img'; | ||
} | ||
var countdownComplete = 1000 > timeRemaining; | ||
// for cover and contain | ||
var resizeMode = nativeProps.resizeMode || nativeProps.style.resizeMode; | ||
if (resizeMode) { | ||
if (_universalEnv.isWeex) { | ||
nativeProps.resize = resizeMode; | ||
nativeProps.style.resizeMode = resizeMode; | ||
} else { | ||
nativeProps.style.objectFit = resizeMode; | ||
} | ||
} | ||
if (_this.timeoutId) { | ||
clearTimeout(_this.timeoutId); | ||
} | ||
if (countdownComplete && isFunction(onComplete)) { | ||
onComplete(); | ||
} else { | ||
_this.timeoutId = !countdownComplete ? setTimeout(function () { | ||
return _this.setState({ | ||
timeRemaining: timeRemaining - interval | ||
}, function () { | ||
return isFunction(onTick) && onTick(timeRemaining); | ||
}); | ||
}, interval) : false; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(Index, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
var timeRemaining = this.props.timeRemaining; | ||
this.setState({ | ||
timeRemaining: timeRemaining | ||
}); | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(newProps) { | ||
if (newProps.timeRemaining !== this.props.timeRemaining) { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
if (this.props.children) { | ||
nativeProps.children = null; | ||
return (0, _rax.createElement)(_raxView2.default, { style: nativeProps.style }, (0, _rax.createElement)(NativeImage, nativeProps), (0, _rax.createElement)(_raxView2.default, { style: styles.absoluteImage }, this.props.children)); | ||
} else { | ||
return (0, _rax.createElement)(NativeImage, nativeProps); | ||
} | ||
this.setState({ | ||
timeRemaining: newProps.timeRemaining | ||
}); | ||
} | ||
return null; | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
} | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return this.props.timeRemaining !== nextProps.timeRemaining || this.state.timeRemaining !== nextState.timeRemaining; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var timeRemaining = this.state.timeRemaining; | ||
var _props = this.props, | ||
formatFunc = _props.formatFunc, | ||
timeStyle = _props.timeStyle, | ||
timeBackgroundStyle = _props.timeBackgroundStyle, | ||
timeWrapStyle = _props.timeWrapStyle, | ||
timeBackground = _props.timeBackground, | ||
secondStyle = _props.secondStyle, | ||
textStyle = _props.textStyle, | ||
tpl = _props.tpl; | ||
if (formatFunc) { | ||
return formatFunc(timeRemaining); | ||
} | ||
var totalSeconds = Math.floor(timeRemaining / 1000); | ||
var days = parseInt(totalSeconds / 3600 / 24); | ||
var hours = parseInt(totalSeconds / 3600) % 24; | ||
var minutes = parseInt(totalSeconds / 60) % 60; | ||
var seconds = parseInt(totalSeconds % 60); | ||
var _timeBackgroundStyle = [styles.background, timeBackgroundStyle]; | ||
var isDay = new RegExp('{d}').test(tpl); | ||
var isHours = new RegExp('{h}').test(tpl); | ||
var isMinutes = new RegExp('{m}').test(tpl); | ||
var isSeconds = new RegExp('{s}').test(tpl); | ||
var tplIndexOfDay = tpl.indexOf('d'); | ||
var tplIndexOfHours = tpl.indexOf('h'); | ||
var tplIndexOfMinutes = tpl.indexOf('m'); | ||
var tplIndexOfSeconds = tpl.indexOf('s'); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: styles.main }, | ||
isDay ? addZero(days, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isDay ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfDay + 2, tplIndexOfDay + 3) | ||
) : null, | ||
isHours ? addZero(hours, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isHours ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfHours + 2, tplIndexOfHours + 3) | ||
) : null, | ||
isMinutes ? addZero(minutes, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isMinutes ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfMinutes + 2, tplIndexOfMinutes + 3) | ||
) : null, | ||
isSeconds ? addZero(seconds, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, secondStyle) : null, | ||
isSeconds ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfSeconds + 2, tplIndexOfSeconds + 3) | ||
) : null | ||
); | ||
} | ||
}]); | ||
return Index; | ||
}(_rax.Component), _class.propTypes = { | ||
formatFunc: _rax.PropTypes.func, | ||
onTick: _rax.PropTypes.func, | ||
onComplete: _rax.PropTypes.func, | ||
tpl: _rax.PropTypes.string, // template (example {h}:{m}:{s}) | ||
timeRemaining: _rax.PropTypes.number, | ||
secondStyle: _rax.PropTypes.object, | ||
timeStyle: _rax.PropTypes.object, // style for num | ||
textStyle: _rax.PropTypes.object, // style for text | ||
timeWrapStyle: _rax.PropTypes.object, | ||
timeBackground: _rax.PropTypes.string, | ||
timeBackgroundStyle: _rax.PropTypes.object, | ||
interval: _rax.PropTypes.number | ||
}, _class.defaultProps = { | ||
tpl: '{d}天{h}时{m}分{s}秒', | ||
timeRemaining: 0, | ||
interval: 1000 | ||
}, _temp2); | ||
return Image; | ||
}(_rax.Component), _class.propTypes = {}, _class.resizeMode = { | ||
contain: 'contain', | ||
cover: 'cover', | ||
stretch: 'stretch', | ||
center: 'center', | ||
repeat: 'repeat' | ||
}, _class.contextTypes = { | ||
isInAParentText: _rax.PropTypes.bool | ||
}, _temp); | ||
var styles = { | ||
main: { | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
alignItems: 'center' | ||
}, | ||
item: { | ||
flexDirection: 'row' | ||
}, | ||
background: { | ||
absoluteImage: { | ||
left: 0, | ||
top: 0, | ||
position: 'absolute' | ||
@@ -847,3 +844,3 @@ } | ||
exports.default = Index; | ||
exports.default = Image; | ||
module.exports = exports['default']; | ||
@@ -850,0 +847,0 @@ |
@@ -59,5 +59,2 @@ | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
@@ -90,3 +87,3 @@ /******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 5); | ||
/******/ return __webpack_require__(__webpack_require__.s = 3); | ||
/******/ }) | ||
@@ -230,4 +227,2 @@ /************************************************************************/ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -237,28 +232,12 @@ value: true | ||
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 _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; }; }(); | ||
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; | ||
}; | ||
}(); | ||
var _class, _temp2; | ||
var _class, _temp; | ||
var _rax = __webpack_require__(0); | ||
var _universalEnv = __webpack_require__(1); | ||
var _raxText = __webpack_require__(4); | ||
var _raxText2 = _interopRequireDefault(_raxText); | ||
var _raxView = __webpack_require__(2); | ||
@@ -268,105 +247,223 @@ | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
var _raxImage = __webpack_require__(5); | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
var _raxImage2 = _interopRequireDefault(_raxImage); | ||
function _possibleConstructorReturn(self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self; | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
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 === "undefined" ? "undefined" : _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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var Image = (_temp = _class = function (_Component) { | ||
_inherits(Image, _Component); | ||
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 Image() { | ||
_classCallCheck(this, Image); | ||
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; } | ||
return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments)); | ||
} | ||
function isFunction(functionToCheck) { | ||
return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'; | ||
}; | ||
_createClass(Image, [{ | ||
key: 'render', | ||
value: function render() { | ||
var nativeProps = _extends({}, this.props); | ||
var source = nativeProps.source; | ||
function addZero(num, timeWrapStyle, timeBackground, timeBackgroundStyle, timeStyle, secondStyle) { | ||
var displayNum = num < 0 ? 0 : num; | ||
var displayFirstNum = displayNum < 10 ? 0 : displayNum.toString().slice(0, 1); | ||
var displaySecondNum = displayNum < 10 ? displayNum : displayNum.toString().slice(1); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: [timeWrapStyle, styles.item] }, | ||
timeBackground ? (0, _rax.createElement)(_raxImage2.default, { source: timeBackground, style: timeBackgroundStyle }) : null, | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: timeStyle }, | ||
'' + displayFirstNum | ||
), | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: secondStyle }, | ||
'' + displaySecondNum | ||
) | ||
); | ||
}; | ||
// Source must a object | ||
if (source && source.uri) { | ||
var style = nativeProps.style; | ||
var width = source.width, | ||
height = source.height, | ||
uri = source.uri; | ||
var Index = (_temp2 = _class = function (_Component) { | ||
_inherits(Index, _Component); | ||
// Default is 0 | ||
function Index() { | ||
var _ref; | ||
if (width == null && height == null && style.height == null && style.width == null) { | ||
width = 0; | ||
height = 0; | ||
} | ||
var _temp, _this, _ret; | ||
nativeProps.style = _extends(_extends({}, !this.context.isInAParentText && { display: 'flex' }, { | ||
width: width, | ||
height: height | ||
}), style); | ||
nativeProps.src = uri; | ||
_classCallCheck(this, Index); | ||
delete nativeProps.source; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var NativeImage = void 0; | ||
if (_universalEnv.isWeex) { | ||
NativeImage = 'image'; | ||
} else { | ||
NativeImage = 'img'; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Index.__proto__ || Object.getPrototypeOf(Index)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
timeRemaining: 0 | ||
}, _this.timeoutId = 0, _this.tick = function () { | ||
var _this$props = _this.props, | ||
onComplete = _this$props.onComplete, | ||
onTick = _this$props.onTick, | ||
interval = _this$props.interval; | ||
var timeRemaining = _this.state.timeRemaining; | ||
// for cover and contain | ||
var resizeMode = nativeProps.resizeMode || nativeProps.style.resizeMode; | ||
if (resizeMode) { | ||
if (_universalEnv.isWeex) { | ||
nativeProps.resize = resizeMode; | ||
nativeProps.style.resizeMode = resizeMode; | ||
} else { | ||
nativeProps.style.objectFit = resizeMode; | ||
} | ||
} | ||
var countdownComplete = 1000 > timeRemaining; | ||
if (this.props.children) { | ||
nativeProps.children = null; | ||
return (0, _rax.createElement)(_raxView2.default, { style: nativeProps.style }, (0, _rax.createElement)(NativeImage, nativeProps), (0, _rax.createElement)(_raxView2.default, { style: styles.absoluteImage }, this.props.children)); | ||
} else { | ||
return (0, _rax.createElement)(NativeImage, nativeProps); | ||
if (_this.timeoutId) { | ||
clearTimeout(_this.timeoutId); | ||
} | ||
if (countdownComplete && isFunction(onComplete)) { | ||
onComplete(); | ||
} else { | ||
_this.timeoutId = !countdownComplete ? setTimeout(function () { | ||
return _this.setState({ | ||
timeRemaining: timeRemaining - interval | ||
}, function () { | ||
return isFunction(onTick) && onTick(timeRemaining); | ||
}); | ||
}, interval) : false; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(Index, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
var timeRemaining = this.props.timeRemaining; | ||
this.setState({ | ||
timeRemaining: timeRemaining | ||
}); | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(newProps) { | ||
if (newProps.timeRemaining !== this.props.timeRemaining) { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
} | ||
this.setState({ | ||
timeRemaining: newProps.timeRemaining | ||
}); | ||
} | ||
return null; | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
} | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return this.props.timeRemaining !== nextProps.timeRemaining || this.state.timeRemaining !== nextState.timeRemaining; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var timeRemaining = this.state.timeRemaining; | ||
var _props = this.props, | ||
formatFunc = _props.formatFunc, | ||
timeStyle = _props.timeStyle, | ||
timeBackgroundStyle = _props.timeBackgroundStyle, | ||
timeWrapStyle = _props.timeWrapStyle, | ||
timeBackground = _props.timeBackground, | ||
secondStyle = _props.secondStyle, | ||
textStyle = _props.textStyle, | ||
tpl = _props.tpl; | ||
if (formatFunc) { | ||
return formatFunc(timeRemaining); | ||
} | ||
var totalSeconds = Math.floor(timeRemaining / 1000); | ||
var days = parseInt(totalSeconds / 3600 / 24); | ||
var hours = parseInt(totalSeconds / 3600) % 24; | ||
var minutes = parseInt(totalSeconds / 60) % 60; | ||
var seconds = parseInt(totalSeconds % 60); | ||
var _timeBackgroundStyle = [styles.background, timeBackgroundStyle]; | ||
var isDay = new RegExp('{d}').test(tpl); | ||
var isHours = new RegExp('{h}').test(tpl); | ||
var isMinutes = new RegExp('{m}').test(tpl); | ||
var isSeconds = new RegExp('{s}').test(tpl); | ||
var tplIndexOfDay = tpl.indexOf('d'); | ||
var tplIndexOfHours = tpl.indexOf('h'); | ||
var tplIndexOfMinutes = tpl.indexOf('m'); | ||
var tplIndexOfSeconds = tpl.indexOf('s'); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: styles.main }, | ||
isDay ? addZero(days, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isDay ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfDay + 2, tplIndexOfDay + 3) | ||
) : null, | ||
isHours ? addZero(hours, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isHours ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfHours + 2, tplIndexOfHours + 3) | ||
) : null, | ||
isMinutes ? addZero(minutes, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isMinutes ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfMinutes + 2, tplIndexOfMinutes + 3) | ||
) : null, | ||
isSeconds ? addZero(seconds, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, secondStyle) : null, | ||
isSeconds ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfSeconds + 2, tplIndexOfSeconds + 3) | ||
) : null | ||
); | ||
} | ||
}]); | ||
return Image; | ||
}(_rax.Component), _class.propTypes = {}, _class.resizeMode = { | ||
contain: 'contain', | ||
cover: 'cover', | ||
stretch: 'stretch', | ||
center: 'center', | ||
repeat: 'repeat' | ||
}, _class.contextTypes = { | ||
isInAParentText: _rax.PropTypes.bool | ||
}, _temp); | ||
return Index; | ||
}(_rax.Component), _class.propTypes = { | ||
formatFunc: _rax.PropTypes.func, | ||
onTick: _rax.PropTypes.func, | ||
onComplete: _rax.PropTypes.func, | ||
tpl: _rax.PropTypes.string, // template (example {h}:{m}:{s}) | ||
timeRemaining: _rax.PropTypes.number, | ||
secondStyle: _rax.PropTypes.object, | ||
timeStyle: _rax.PropTypes.object, // style for num | ||
textStyle: _rax.PropTypes.object, // style for text | ||
timeWrapStyle: _rax.PropTypes.object, | ||
timeBackground: _rax.PropTypes.string, | ||
timeBackgroundStyle: _rax.PropTypes.object, | ||
interval: _rax.PropTypes.number | ||
}, _class.defaultProps = { | ||
tpl: '{d}天{h}时{m}分{s}秒', | ||
timeRemaining: 0, | ||
interval: 1000 | ||
}, _temp2); | ||
var styles = { | ||
absoluteImage: { | ||
left: 0, | ||
top: 0, | ||
main: { | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
alignItems: 'center' | ||
}, | ||
item: { | ||
flexDirection: 'row' | ||
}, | ||
background: { | ||
position: 'absolute' | ||
@@ -376,3 +473,3 @@ } | ||
exports.default = Image; | ||
exports.default = Index; | ||
module.exports = exports['default']; | ||
@@ -623,2 +720,4 @@ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -628,12 +727,28 @@ value: true | ||
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; }; }(); | ||
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 _class, _temp2; | ||
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; | ||
}; | ||
}(); | ||
var _class, _temp; | ||
var _rax = __webpack_require__(0); | ||
var _raxText = __webpack_require__(4); | ||
var _universalEnv = __webpack_require__(1); | ||
var _raxText2 = _interopRequireDefault(_raxText); | ||
var _raxView = __webpack_require__(2); | ||
@@ -643,223 +758,105 @@ | ||
var _raxImage = __webpack_require__(3); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
var _raxImage2 = _interopRequireDefault(_raxImage); | ||
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 _possibleConstructorReturn(self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self; | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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 === "undefined" ? "undefined" : _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 _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; } | ||
var Image = (_temp = _class = function (_Component) { | ||
_inherits(Image, _Component); | ||
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 Image() { | ||
_classCallCheck(this, Image); | ||
function isFunction(functionToCheck) { | ||
return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'; | ||
}; | ||
return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments)); | ||
} | ||
function addZero(num, timeWrapStyle, timeBackground, timeBackgroundStyle, timeStyle, secondStyle) { | ||
var displayNum = num < 0 ? 0 : num; | ||
var displayFirstNum = displayNum < 10 ? 0 : displayNum.toString().slice(0, 1); | ||
var displaySecondNum = displayNum < 10 ? displayNum : displayNum.toString().slice(1); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: [timeWrapStyle, styles.item] }, | ||
timeBackground ? (0, _rax.createElement)(_raxImage2.default, { source: timeBackground, style: timeBackgroundStyle }) : null, | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: timeStyle }, | ||
'' + displayFirstNum | ||
), | ||
(0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: secondStyle }, | ||
'' + displaySecondNum | ||
) | ||
); | ||
}; | ||
_createClass(Image, [{ | ||
key: 'render', | ||
value: function render() { | ||
var nativeProps = _extends({}, this.props); | ||
var source = nativeProps.source; | ||
var Index = (_temp2 = _class = function (_Component) { | ||
_inherits(Index, _Component); | ||
// Source must a object | ||
if (source && source.uri) { | ||
var style = nativeProps.style; | ||
var width = source.width, | ||
height = source.height, | ||
uri = source.uri; | ||
function Index() { | ||
var _ref; | ||
// Default is 0 | ||
var _temp, _this, _ret; | ||
if (width == null && height == null && style.height == null && style.width == null) { | ||
width = 0; | ||
height = 0; | ||
} | ||
_classCallCheck(this, Index); | ||
nativeProps.style = _extends(_extends({}, !this.context.isInAParentText && { display: 'flex' }, { | ||
width: width, | ||
height: height | ||
}), style); | ||
nativeProps.src = uri; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
delete nativeProps.source; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Index.__proto__ || Object.getPrototypeOf(Index)).call.apply(_ref, [this].concat(args))), _this), _this.state = { | ||
timeRemaining: 0 | ||
}, _this.timeoutId = 0, _this.tick = function () { | ||
var _this$props = _this.props, | ||
onComplete = _this$props.onComplete, | ||
onTick = _this$props.onTick, | ||
interval = _this$props.interval; | ||
var timeRemaining = _this.state.timeRemaining; | ||
var NativeImage = void 0; | ||
if (_universalEnv.isWeex) { | ||
NativeImage = 'image'; | ||
} else { | ||
NativeImage = 'img'; | ||
} | ||
var countdownComplete = 1000 > timeRemaining; | ||
// for cover and contain | ||
var resizeMode = nativeProps.resizeMode || nativeProps.style.resizeMode; | ||
if (resizeMode) { | ||
if (_universalEnv.isWeex) { | ||
nativeProps.resize = resizeMode; | ||
nativeProps.style.resizeMode = resizeMode; | ||
} else { | ||
nativeProps.style.objectFit = resizeMode; | ||
} | ||
} | ||
if (_this.timeoutId) { | ||
clearTimeout(_this.timeoutId); | ||
} | ||
if (countdownComplete && isFunction(onComplete)) { | ||
onComplete(); | ||
} else { | ||
_this.timeoutId = !countdownComplete ? setTimeout(function () { | ||
return _this.setState({ | ||
timeRemaining: timeRemaining - interval | ||
}, function () { | ||
return isFunction(onTick) && onTick(timeRemaining); | ||
}); | ||
}, interval) : false; | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(Index, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
var timeRemaining = this.props.timeRemaining; | ||
this.setState({ | ||
timeRemaining: timeRemaining | ||
}); | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() { | ||
this.tick(); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(newProps) { | ||
if (newProps.timeRemaining !== this.props.timeRemaining) { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
if (this.props.children) { | ||
nativeProps.children = null; | ||
return (0, _rax.createElement)(_raxView2.default, { style: nativeProps.style }, (0, _rax.createElement)(NativeImage, nativeProps), (0, _rax.createElement)(_raxView2.default, { style: styles.absoluteImage }, this.props.children)); | ||
} else { | ||
return (0, _rax.createElement)(NativeImage, nativeProps); | ||
} | ||
this.setState({ | ||
timeRemaining: newProps.timeRemaining | ||
}); | ||
} | ||
return null; | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
if (this.timeoutId) { | ||
clearTimeout(this.timeoutId); | ||
} | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return this.props.timeRemaining !== nextProps.timeRemaining || this.state.timeRemaining !== nextState.timeRemaining; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var timeRemaining = this.state.timeRemaining; | ||
var _props = this.props, | ||
formatFunc = _props.formatFunc, | ||
timeStyle = _props.timeStyle, | ||
timeBackgroundStyle = _props.timeBackgroundStyle, | ||
timeWrapStyle = _props.timeWrapStyle, | ||
timeBackground = _props.timeBackground, | ||
secondStyle = _props.secondStyle, | ||
textStyle = _props.textStyle, | ||
tpl = _props.tpl; | ||
if (formatFunc) { | ||
return formatFunc(timeRemaining); | ||
} | ||
var totalSeconds = Math.floor(timeRemaining / 1000); | ||
var days = parseInt(totalSeconds / 3600 / 24); | ||
var hours = parseInt(totalSeconds / 3600) % 24; | ||
var minutes = parseInt(totalSeconds / 60) % 60; | ||
var seconds = parseInt(totalSeconds % 60); | ||
var _timeBackgroundStyle = [styles.background, timeBackgroundStyle]; | ||
var isDay = new RegExp('{d}').test(tpl); | ||
var isHours = new RegExp('{h}').test(tpl); | ||
var isMinutes = new RegExp('{m}').test(tpl); | ||
var isSeconds = new RegExp('{s}').test(tpl); | ||
var tplIndexOfDay = tpl.indexOf('d'); | ||
var tplIndexOfHours = tpl.indexOf('h'); | ||
var tplIndexOfMinutes = tpl.indexOf('m'); | ||
var tplIndexOfSeconds = tpl.indexOf('s'); | ||
return (0, _rax.createElement)( | ||
_raxView2.default, | ||
{ style: styles.main }, | ||
isDay ? addZero(days, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isDay ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfDay + 2, tplIndexOfDay + 3) | ||
) : null, | ||
isHours ? addZero(hours, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isHours ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfHours + 2, tplIndexOfHours + 3) | ||
) : null, | ||
isMinutes ? addZero(minutes, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, timeStyle) : null, | ||
isMinutes ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfMinutes + 2, tplIndexOfMinutes + 3) | ||
) : null, | ||
isSeconds ? addZero(seconds, timeWrapStyle, timeBackground, _timeBackgroundStyle, timeStyle, secondStyle) : null, | ||
isSeconds ? (0, _rax.createElement)( | ||
_raxText2.default, | ||
{ style: textStyle }, | ||
tpl.slice(tplIndexOfSeconds + 2, tplIndexOfSeconds + 3) | ||
) : null | ||
); | ||
} | ||
}]); | ||
return Index; | ||
}(_rax.Component), _class.propTypes = { | ||
formatFunc: _rax.PropTypes.func, | ||
onTick: _rax.PropTypes.func, | ||
onComplete: _rax.PropTypes.func, | ||
tpl: _rax.PropTypes.string, // template (example {h}:{m}:{s}) | ||
timeRemaining: _rax.PropTypes.number, | ||
secondStyle: _rax.PropTypes.object, | ||
timeStyle: _rax.PropTypes.object, // style for num | ||
textStyle: _rax.PropTypes.object, // style for text | ||
timeWrapStyle: _rax.PropTypes.object, | ||
timeBackground: _rax.PropTypes.string, | ||
timeBackgroundStyle: _rax.PropTypes.object, | ||
interval: _rax.PropTypes.number | ||
}, _class.defaultProps = { | ||
tpl: '{d}天{h}时{m}分{s}秒', | ||
timeRemaining: 0, | ||
interval: 1000 | ||
}, _temp2); | ||
return Image; | ||
}(_rax.Component), _class.propTypes = {}, _class.resizeMode = { | ||
contain: 'contain', | ||
cover: 'cover', | ||
stretch: 'stretch', | ||
center: 'center', | ||
repeat: 'repeat' | ||
}, _class.contextTypes = { | ||
isInAParentText: _rax.PropTypes.bool | ||
}, _temp); | ||
var styles = { | ||
main: { | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
alignItems: 'center' | ||
}, | ||
item: { | ||
flexDirection: 'row' | ||
}, | ||
background: { | ||
absoluteImage: { | ||
left: 0, | ||
top: 0, | ||
position: 'absolute' | ||
@@ -869,3 +866,3 @@ } | ||
exports.default = Index; | ||
exports.default = Image; | ||
module.exports = exports['default']; | ||
@@ -872,0 +869,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("rax-countdown",function(t,n,o){o.exports=e()});else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this,t.RaxCountdown=e()}}(function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t){e.exports=function(){var e;if(!e)try{e=require("rax")}catch(e){}return e}()},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)};t.isWeb="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),t.isNode="undefined"!=typeof process&&!(!process.versions||!process.versions.node),t.isWeex="function"==typeof callNative,t.isReactNative="undefined"!=typeof __fbBatchedBridgeConfig},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":u(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":u(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var l,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=(a=l=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=this.props;if(p.isWeex)return(0,f.createElement)("div",e);var t=c({},d.initial,e.style);return(0,f.createElement)("div",c({},e,{style:t}))}}]),t}(f.Component),l.propTypes={},a),d={initial:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"flex",flexDirection:"column",alignContent:"flex-start",flexShrink:0}};t.default=y,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":u(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":u(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var l,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=n(2),d=function(e){return e&&e.__esModule?e:{default:e}}(y),m=(a=l=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=c({},this.props),t=e.source;if(t&&t.uri){var n=e.style,o=t.width,r=t.height,i=t.uri;null==o&&null==r&&null==n.height&&null==n.width&&(o=0,r=0),e.style=c(c({},!this.context.isInAParentText&&{display:"flex"},{width:o,height:r}),n),e.src=i,delete e.source;var u=void 0;u=p.isWeex?"image":"img";var l=e.resizeMode||e.style.resizeMode;return l&&(p.isWeex?(e.resize=l,e.style.resizeMode=l):e.style.objectFit=l),this.props.children?(e.children=null,(0,f.createElement)(d.default,{style:e.style},(0,f.createElement)(u,e),(0,f.createElement)(d.default,{style:b.absoluteImage},this.props.children))):(0,f.createElement)(u,e)}return null}}]),t}(f.Component),l.propTypes={},l.resizeMode={contain:"contain",cover:"cover",stretch:"stretch",center:"center",repeat:"repeat"},l.contextTypes={isInAParentText:f.PropTypes.bool},a),b={absoluteImage:{left:0,top:0,position:"absolute"}};t.default=m,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":a(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){var n=e.type,o=e.props,r=o.children;if("function"==typeof type){var i=new n;return i.props=o,r&&(i.props.children=l(r,t)),i.context=t.getChildContext(),i.render()}return e}function l(e,t){var n=[];Array.isArray(e)||(e=[e]);for(var o=0;o<e.length;o++){var r=e[o];"string"==typeof r?n.push(r):"object"===(void 0===r?"undefined":f(r))&&n.push(u(r,t))}return n}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var c,s,f="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),d=n(0),m=n(1),b=(s=c=function(e){function t(){var e,n,i,u;o(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=i=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),i.renderText=function(){var e=i.props,t=p({},e,{style:e.style||{}}),n="";if(null!=e.children&&(n=Array.isArray(e.children)?e.children.join(""):e.children.toString()),i.context.isInAParentText)return(0,d.createElement)("span",t,n);if(e.onPress&&(t.onClick=e.onPress),m.isWeex)return e.numberOfLines&&(t.style.lines=e.numberOfLines),t.value=n,(0,d.createElement)("text",t);var o=p({},h.text,t.style),r=e.numberOfLines;return r&&(1===parseInt(r)?o.whiteSpace="nowrap":(o.display="-webkit-box",o.webkitBoxOrient="vertical",o.webkitLineClamp=String(r)),o.overflow="hidden"),(0,d.createElement)("span",p({},t,{style:o}),n)},i.renderRichText=function(){var e=i.props,t=e.children,n=p({},e,{style:e.style||{}}),o=p({},h.richtext,n.style);return m.isWeex&&(t=l(t,i)),(0,d.createElement)("p",p({},n,{style:o}),t)},u=n,r(i,u)}return i(t,e),y(t,[{key:"getChildContext",value:function(){return{isInAParentText:!0}}},{key:"render",value:function(){var e=this.props,t=e.children;Array.isArray(t)||(t=[t]);for(var n=!1,o=0;o<t.length;o++){var r=t[o];if(r&&"object"===(void 0===r?"undefined":f(r))){n=!0;break}}return n?this.renderRichText():this.renderText()}}]),t}(d.Component),c.propTypes={},c.contextTypes={isInAParentText:d.PropTypes.bool},c.childContextTypes={isInAParentText:d.PropTypes.bool},s),h={text:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"block",flexDirection:"column",alignContent:"flex-start",flexShrink:0,fontSize:32},richtext:{marginTop:0,marginBottom:0}};t.default=b,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e){return e&&"[object Function]"==={}.toString.call(e)}function a(e,t,n,o,r,i){var u=e<0?0:e,l=u<10?0:u.toString().slice(0,1),a=u<10?u:u.toString().slice(1);return(0,p.createElement)(b.default,{style:[t,x.item]},n?(0,p.createElement)(v.default,{source:n,style:o}):null,(0,p.createElement)(d.default,{style:r},""+l),(0,p.createElement)(d.default,{style:i},""+a))}Object.defineProperty(t,"__esModule",{value:!0});var c,s,f=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),p=n(0),y=n(4),d=o(y),m=n(2),b=o(m),h=n(3),v=o(h),g=(s=c=function(e){function t(){var e,n,o,u;r(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.state={timeRemaining:0},o.timeoutId=0,o.tick=function(){var e=o.props,t=e.onComplete,n=e.onTick,r=e.interval,i=o.state.timeRemaining,u=1e3>i;o.timeoutId&&clearTimeout(o.timeoutId),u&&l(t)?t():o.timeoutId=!u&&setTimeout(function(){return o.setState({timeRemaining:i-r},function(){return l(n)&&n(i)})},r)},u=n,i(o,u)}return u(t,e),f(t,[{key:"componentWillMount",value:function(){var e=this.props.timeRemaining;this.setState({timeRemaining:e})}},{key:"componentDidMount",value:function(){this.tick()}},{key:"componentDidUpdate",value:function(){this.tick()}},{key:"componentWillReceiveProps",value:function(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))}},{key:"componentWillUnmount",value:function(){this.timeoutId&&clearTimeout(this.timeoutId)}},{key:"shouldComponentUpdate",value:function(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining}},{key:"render",value:function(){var e=this.state.timeRemaining,t=this.props,n=t.formatFunc,o=t.timeStyle,r=t.timeBackgroundStyle,i=t.timeWrapStyle,u=t.timeBackground,l=t.secondStyle,c=t.textStyle,s=t.tpl;if(n)return n(e);var f=Math.floor(e/1e3),y=parseInt(f/3600/24),m=parseInt(f/3600)%24,h=parseInt(f/60)%60,v=parseInt(f%60),g=[x.background,r],w=new RegExp("{d}").test(s),S=new RegExp("{h}").test(s),O=new RegExp("{m}").test(s),P=new RegExp("{s}").test(s),j=s.indexOf("d"),_=s.indexOf("h"),T=s.indexOf("m"),k=s.indexOf("s");return(0,p.createElement)(b.default,{style:x.main},w?a(y,i,u,g,o,o):null,w?(0,p.createElement)(d.default,{style:c},s.slice(j+2,j+3)):null,S?a(m,i,u,g,o,o):null,S?(0,p.createElement)(d.default,{style:c},s.slice(_+2,_+3)):null,O?a(h,i,u,g,o,o):null,O?(0,p.createElement)(d.default,{style:c},s.slice(T+2,T+3)):null,P?a(v,i,u,g,o,l):null,P?(0,p.createElement)(d.default,{style:c},s.slice(k+2,k+3)):null)}}]),t}(p.Component),c.propTypes={formatFunc:p.PropTypes.func,onTick:p.PropTypes.func,onComplete:p.PropTypes.func,tpl:p.PropTypes.string,timeRemaining:p.PropTypes.number,secondStyle:p.PropTypes.object,timeStyle:p.PropTypes.object,textStyle:p.PropTypes.object,timeWrapStyle:p.PropTypes.object,timeBackground:p.PropTypes.string,timeBackgroundStyle:p.PropTypes.object,interval:p.PropTypes.number},c.defaultProps={tpl:"{d}天{h}时{m}分{s}秒",timeRemaining:0,interval:1e3},s),x={main:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},item:{flexDirection:"row"},background:{position:"absolute"}};t.default=g,e.exports=t.default}])}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("rax-countdown",function(t,n,o){o.exports=e()});else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this,t.RaxCountdown=e()}}(function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t){e.exports=function(){var e;if(!e)try{e=require("rax")}catch(e){}return e}()},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)};t.isWeb="object"===("undefined"==typeof navigator?"undefined":r(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),t.isNode="undefined"!=typeof process&&!(!process.versions||!process.versions.node),t.isWeex="function"==typeof callNative,t.isReactNative="undefined"!=typeof __fbBatchedBridgeConfig},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":l(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":l(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var u,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=(a=u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=this.props;if(p.isWeex)return(0,f.createElement)("div",e);var t=c({},d.initial,e.style);return(0,f.createElement)("div",c({},e,{style:t}))}}]),t}(f.Component),u.propTypes={},a),d={initial:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"flex",flexDirection:"column",alignContent:"flex-start",flexShrink:0}};t.default=y,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return e&&"[object Function]"==={}.toString.call(e)}function a(e,t,n,o,r,i){var l=e<0?0:e,u=l<10?0:l.toString().slice(0,1),a=l<10?l:l.toString().slice(1);return(0,p.createElement)(b.default,{style:[t,x.item]},n?(0,p.createElement)(v.default,{source:n,style:o}):null,(0,p.createElement)(d.default,{style:r},""+u),(0,p.createElement)(d.default,{style:i},""+a))}Object.defineProperty(t,"__esModule",{value:!0});var c,s,f=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),p=n(0),y=n(4),d=o(y),m=n(2),b=o(m),h=n(5),v=o(h),g=(s=c=function(e){function t(){var e,n,o,l;r(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.state={timeRemaining:0},o.timeoutId=0,o.tick=function(){var e=o.props,t=e.onComplete,n=e.onTick,r=e.interval,i=o.state.timeRemaining,l=1e3>i;o.timeoutId&&clearTimeout(o.timeoutId),l&&u(t)?t():o.timeoutId=!l&&setTimeout(function(){return o.setState({timeRemaining:i-r},function(){return u(n)&&n(i)})},r)},l=n,i(o,l)}return l(t,e),f(t,[{key:"componentWillMount",value:function(){var e=this.props.timeRemaining;this.setState({timeRemaining:e})}},{key:"componentDidMount",value:function(){this.tick()}},{key:"componentDidUpdate",value:function(){this.tick()}},{key:"componentWillReceiveProps",value:function(e){e.timeRemaining!==this.props.timeRemaining&&(this.timeoutId&&clearTimeout(this.timeoutId),this.setState({timeRemaining:e.timeRemaining}))}},{key:"componentWillUnmount",value:function(){this.timeoutId&&clearTimeout(this.timeoutId)}},{key:"shouldComponentUpdate",value:function(e,t){return this.props.timeRemaining!==e.timeRemaining||this.state.timeRemaining!==t.timeRemaining}},{key:"render",value:function(){var e=this.state.timeRemaining,t=this.props,n=t.formatFunc,o=t.timeStyle,r=t.timeBackgroundStyle,i=t.timeWrapStyle,l=t.timeBackground,u=t.secondStyle,c=t.textStyle,s=t.tpl;if(n)return n(e);var f=Math.floor(e/1e3),y=parseInt(f/3600/24),m=parseInt(f/3600)%24,h=parseInt(f/60)%60,v=parseInt(f%60),g=[x.background,r],w=new RegExp("{d}").test(s),S=new RegExp("{h}").test(s),O=new RegExp("{m}").test(s),P=new RegExp("{s}").test(s),j=s.indexOf("d"),_=s.indexOf("h"),T=s.indexOf("m"),k=s.indexOf("s");return(0,p.createElement)(b.default,{style:x.main},w?a(y,i,l,g,o,o):null,w?(0,p.createElement)(d.default,{style:c},s.slice(j+2,j+3)):null,S?a(m,i,l,g,o,o):null,S?(0,p.createElement)(d.default,{style:c},s.slice(_+2,_+3)):null,O?a(h,i,l,g,o,o):null,O?(0,p.createElement)(d.default,{style:c},s.slice(T+2,T+3)):null,P?a(v,i,l,g,o,u):null,P?(0,p.createElement)(d.default,{style:c},s.slice(k+2,k+3)):null)}}]),t}(p.Component),c.propTypes={formatFunc:p.PropTypes.func,onTick:p.PropTypes.func,onComplete:p.PropTypes.func,tpl:p.PropTypes.string,timeRemaining:p.PropTypes.number,secondStyle:p.PropTypes.object,timeStyle:p.PropTypes.object,textStyle:p.PropTypes.object,timeWrapStyle:p.PropTypes.object,timeBackground:p.PropTypes.string,timeBackgroundStyle:p.PropTypes.object,interval:p.PropTypes.number},c.defaultProps={tpl:"{d}天{h}时{m}分{s}秒",timeRemaining:0,interval:1e3},s),x={main:{flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},item:{flexDirection:"row"},background:{position:"absolute"}};t.default=g,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":a(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=e.type,o=e.props,r=o.children;if("function"==typeof type){var i=new n;return i.props=o,r&&(i.props.children=u(r,t)),i.context=t.getChildContext(),i.render()}return e}function u(e,t){var n=[];Array.isArray(e)||(e=[e]);for(var o=0;o<e.length;o++){var r=e[o];"string"==typeof r?n.push(r):"object"===(void 0===r?"undefined":f(r))&&n.push(l(r,t))}return n}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var c,s,f="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),d=n(0),m=n(1),b=(s=c=function(e){function t(){var e,n,i,l;o(this,t);for(var a=arguments.length,c=Array(a),s=0;s<a;s++)c[s]=arguments[s];return n=i=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),i.renderText=function(){var e=i.props,t=p({},e,{style:e.style||{}}),n="";if(null!=e.children&&(n=Array.isArray(e.children)?e.children.join(""):e.children.toString()),i.context.isInAParentText)return(0,d.createElement)("span",t,n);if(e.onPress&&(t.onClick=e.onPress),m.isWeex)return e.numberOfLines&&(t.style.lines=e.numberOfLines),t.value=n,(0,d.createElement)("text",t);var o=p({},h.text,t.style),r=e.numberOfLines;return r&&(1===parseInt(r)?o.whiteSpace="nowrap":(o.display="-webkit-box",o.webkitBoxOrient="vertical",o.webkitLineClamp=String(r)),o.overflow="hidden"),(0,d.createElement)("span",p({},t,{style:o}),n)},i.renderRichText=function(){var e=i.props,t=e.children,n=p({},e,{style:e.style||{}}),o=p({},h.richtext,n.style);return m.isWeex&&(t=u(t,i)),(0,d.createElement)("p",p({},n,{style:o}),t)},l=n,r(i,l)}return i(t,e),y(t,[{key:"getChildContext",value:function(){return{isInAParentText:!0}}},{key:"render",value:function(){var e=this.props,t=e.children;Array.isArray(t)||(t=[t]);for(var n=!1,o=0;o<t.length;o++){var r=t[o];if(r&&"object"===(void 0===r?"undefined":f(r))){n=!0;break}}return n?this.renderRichText():this.renderText()}}]),t}(d.Component),c.propTypes={},c.contextTypes={isInAParentText:d.PropTypes.bool},c.childContextTypes={isInAParentText:d.PropTypes.bool},s),h={text:{border:"0 solid black",position:"relative",boxSizing:"border-box",display:"block",flexDirection:"column",alignContent:"flex-start",flexShrink:0,fontSize:32},richtext:{marginTop:0,marginBottom:0}};t.default=b,e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":l(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":l(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var u,a,c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(0),p=n(1),y=n(2),d=function(e){return e&&e.__esModule?e:{default:e}}(y),m=(a=u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"render",value:function(){var e=c({},this.props),t=e.source;if(t&&t.uri){var n=e.style,o=t.width,r=t.height,i=t.uri;null==o&&null==r&&null==n.height&&null==n.width&&(o=0,r=0),e.style=c(c({},!this.context.isInAParentText&&{display:"flex"},{width:o,height:r}),n),e.src=i,delete e.source;var l=void 0;l=p.isWeex?"image":"img";var u=e.resizeMode||e.style.resizeMode;return u&&(p.isWeex?(e.resize=u,e.style.resizeMode=u):e.style.objectFit=u),this.props.children?(e.children=null,(0,f.createElement)(d.default,{style:e.style},(0,f.createElement)(l,e),(0,f.createElement)(d.default,{style:b.absoluteImage},this.props.children))):(0,f.createElement)(l,e)}return null}}]),t}(f.Component),u.propTypes={},u.resizeMode={contain:"contain",cover:"cover",stretch:"stretch",center:"center",repeat:"repeat"},u.contextTypes={isInAParentText:f.PropTypes.bool},a),b={absoluteImage:{left:0,top:0,position:"absolute"}};t.default=m,e.exports=t.default}])}); |
{ | ||
"name": "rax-countdown", | ||
"version": "0.3.8", | ||
"version": "0.4.0", | ||
"description": "Countdown component for Rax.", | ||
@@ -24,5 +24,5 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"rax-view": "^0.3.8", | ||
"rax-text": "^0.3.8", | ||
"rax-image": "^0.3.8" | ||
"rax-image": "^0.4.0", | ||
"rax-text": "^0.4.0", | ||
"rax-view": "^0.4.0" | ||
}, | ||
@@ -33,4 +33,4 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"rax-test-renderer": "^0.3.8" | ||
"rax-test-renderer": "^0.4.0" | ||
} | ||
} |
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
186305
1826
+ Addedrax-image@0.4.20(transitive)
+ Addedrax-text@0.4.20(transitive)
+ Addedrax-view@0.4.20(transitive)
+ Addeduniversal-env@0.4.20(transitive)
- Removedrax-image@0.3.8(transitive)
- Removedrax-text@0.3.8(transitive)
- Removedrax-view@0.3.8(transitive)
- Removeduniversal-env@0.3.8(transitive)
Updatedrax-image@^0.4.0
Updatedrax-text@^0.4.0
Updatedrax-view@^0.4.0