@invisionag/iris-react-animation
Advanced tools
Comparing version 2.2.28 to 2.2.29
@@ -138,8 +138,7 @@ module.exports = | ||
var animationPlayState = function animationPlayState(_ref) { | ||
var paused = _ref.paused; | ||
return paused && 'paused !important'; | ||
}; | ||
const animationPlayState = ({ | ||
paused | ||
}) => paused && 'paused !important'; | ||
var AnimationStateChanger = external_styled_components_default()('div').withConfig({ | ||
const AnimationStateChanger = external_styled_components_default()('div').withConfig({ | ||
displayName: "styles__AnimationStateChanger", | ||
@@ -150,85 +149,46 @@ componentId: "koddox-0" | ||
// CONCATENATED MODULE: ./packages/react-animation/src/delayer.js | ||
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); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
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 AnimationDelayContext = external_react_default.a.createContext({ | ||
const AnimationDelayContext = external_react_default.a.createContext({ | ||
animationDelayed: false | ||
}); | ||
var delayer_AnimationDelayer = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(AnimationDelayer, _React$Component); | ||
function AnimationDelayer() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
_classCallCheck(this, AnimationDelayer); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(AnimationDelayer)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this.timeoutId = null; | ||
_this.state = { | ||
class delayer_AnimationDelayer extends external_react_default.a.Component { | ||
constructor(...args) { | ||
super(...args); | ||
this.timeoutId = null; | ||
this.state = { | ||
animationDelayed: true | ||
}; | ||
return _this; | ||
} | ||
_createClass(AnimationDelayer, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
var _this2 = this; | ||
componentDidMount() { | ||
const { | ||
delay | ||
} = this.props; | ||
this.timeoutId = setTimeout(() => this.setState(() => ({ | ||
animationDelayed: false | ||
})), delay); | ||
} | ||
var delay = this.props.delay; | ||
this.timeoutId = setTimeout(function () { | ||
return _this2.setState(function () { | ||
return { | ||
animationDelayed: false | ||
}; | ||
}); | ||
}, delay); | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
if (this.timeoutId) clearTimeout(this.timeoutId); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var animationDelayed = this.state.animationDelayed; | ||
var children = this.props.children; | ||
return external_react_default.a.createElement(AnimationDelayContext.Provider, { | ||
value: this.state | ||
}, external_react_default.a.createElement(AnimationStateChanger, { | ||
paused: animationDelayed | ||
}, children)); | ||
} | ||
}]); | ||
componentWillUnmount() { | ||
if (this.timeoutId) clearTimeout(this.timeoutId); | ||
} | ||
return AnimationDelayer; | ||
}(external_react_default.a.Component); | ||
render() { | ||
const { | ||
animationDelayed | ||
} = this.state; | ||
const { | ||
children | ||
} = this.props; | ||
return external_react_default.a.createElement(AnimationDelayContext.Provider, { | ||
value: this.state | ||
}, external_react_default.a.createElement(AnimationStateChanger, { | ||
paused: animationDelayed | ||
}, children)); | ||
} | ||
} | ||
delayer_AnimationDelayer.defaultProps = { | ||
@@ -244,37 +204,11 @@ delay: 1000 | ||
/* concated harmony reexport AnimationDelayContext */__webpack_require__.d(__webpack_exports__, "AnimationDelayContext", function() { return AnimationDelayContext; }); | ||
function src_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { src_typeof = function _typeof(obj) { return typeof obj; }; } else { src_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return src_typeof(obj); } | ||
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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function src_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function src_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 src_createClass(Constructor, protoProps, staticProps) { if (protoProps) src_defineProperties(Constructor.prototype, protoProps); if (staticProps) src_defineProperties(Constructor, staticProps); return Constructor; } | ||
function src_possibleConstructorReturn(self, call) { if (call && (src_typeof(call) === "object" || typeof call === "function")) { return call; } return src_assertThisInitialized(self); } | ||
function src_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function src_getPrototypeOf(o) { src_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return src_getPrototypeOf(o); } | ||
function src_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) src_setPrototypeOf(subClass, superClass); } | ||
function src_setPrototypeOf(o, p) { src_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return src_setPrototypeOf(o, p); } | ||
var defaultLottieOptions = { | ||
const defaultLottieOptions = { | ||
renderer: 'svg', | ||
@@ -287,90 +221,63 @@ loop: true, | ||
}; | ||
var src_Animation = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
src_inherits(Animation, _React$Component); | ||
class src_Animation extends external_react_default.a.Component { | ||
constructor(...args) { | ||
super(...args); | ||
this.ref = void 0; | ||
this.animation = void 0; | ||
function Animation() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
src_classCallCheck(this, Animation); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = src_possibleConstructorReturn(this, (_getPrototypeOf2 = src_getPrototypeOf(Animation)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this.ref = void 0; | ||
_this.animation = void 0; | ||
_this.destroyAnimation = function () { | ||
if (typeof _this.animation === 'undefined') return; | ||
_this.animation.destroy(); | ||
this.destroyAnimation = () => { | ||
if (typeof this.animation === 'undefined') return; | ||
this.animation.destroy(); | ||
}; | ||
_this.handleRef = function (ref) { | ||
this.handleRef = ref => { | ||
if (!ref) return; | ||
_this.ref = ref; | ||
_this.forceUpdate(); | ||
this.ref = ref; | ||
this.forceUpdate(); | ||
}; | ||
} | ||
return _this; | ||
componentWillUnmount() { | ||
this.destroyAnimation(); | ||
} | ||
src_createClass(Animation, [{ | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.destroyAnimation(); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
render() { | ||
const { | ||
children, | ||
data, | ||
lottieOptions, | ||
...props | ||
} = this.props; | ||
if (typeof children !== 'function') return null; | ||
return external_react_default.a.createElement(AnimationDelayContext.Consumer, null, ({ | ||
animationDelayed | ||
}) => { | ||
if (this.ref) { | ||
this.destroyAnimation(); | ||
this.animation = external_lottie_web_default.a.loadAnimation({ | ||
container: this.ref, | ||
animationData: data, | ||
...defaultLottieOptions, | ||
...lottieOptions, | ||
autoplay: !animationDelayed | ||
}); | ||
} | ||
var _this$props = this.props, | ||
children = _this$props.children, | ||
data = _this$props.data, | ||
lottieOptions = _this$props.lottieOptions, | ||
props = _objectWithoutProperties(_this$props, ["children", "data", "lottieOptions"]); | ||
if (typeof children !== 'function') return null; | ||
return external_react_default.a.createElement(AnimationDelayContext.Consumer, null, function (_ref) { | ||
var animationDelayed = _ref.animationDelayed; | ||
if (_this2.ref) { | ||
_this2.destroyAnimation(); | ||
_this2.animation = external_lottie_web_default.a.loadAnimation(_objectSpread({ | ||
container: _this2.ref, | ||
animationData: data | ||
}, defaultLottieOptions, lottieOptions, { | ||
autoplay: !animationDelayed | ||
})); | ||
} | ||
return children(_objectSpread({}, props, { | ||
onRef: _this2.handleRef, | ||
animation: _this2.animation, | ||
autoplay: !animationDelayed | ||
})); | ||
return children({ ...props, | ||
onRef: this.handleRef, | ||
animation: this.animation, | ||
autoplay: !animationDelayed | ||
}); | ||
} | ||
}]); | ||
}); | ||
} | ||
return Animation; | ||
}(external_react_default.a.Component); | ||
} | ||
src_Animation.defaultProps = { | ||
lottieOptions: {}, | ||
children: function children(_ref2) { | ||
var onRef = _ref2.onRef, | ||
rest = _objectWithoutProperties(_ref2, ["onRef"]); | ||
return external_react_default.a.createElement(iris_react_image_container_default.a, _extends({ | ||
ref: onRef | ||
}, rest)); | ||
} | ||
children: ({ | ||
onRef, | ||
...rest | ||
}) => external_react_default.a.createElement(iris_react_image_container_default.a, _extends({ | ||
ref: onRef | ||
}, rest)) | ||
}; | ||
@@ -377,0 +284,0 @@ /* harmony default export */ var src = __webpack_exports__["default"] = (src_Animation); |
{ | ||
"name": "@invisionag/iris-react-animation", | ||
"version": "2.2.28", | ||
"version": "2.2.29", | ||
"main": "dist/index.js", | ||
@@ -8,5 +8,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@invisionag/iris-react-image-container": "^2.3.28", | ||
"@invisionag/iris-settings": "^6.1.29", | ||
"@invisionag/iris-tools": "^4.1.28", | ||
"@invisionag/iris-react-image-container": "^2.3.29", | ||
"@invisionag/iris-settings": "^6.1.30", | ||
"@invisionag/iris-tools": "^4.1.29", | ||
"classnames": "^2.2.6", | ||
@@ -17,3 +17,3 @@ "lottie-web": "^5.5.5" | ||
"@invisionag/beacon-tokens": "^0.0.15", | ||
"@invisionag/iris-react-spinner": "^4.2.28" | ||
"@invisionag/iris-react-spinner": "^4.2.29" | ||
}, | ||
@@ -23,3 +23,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "1073ccb0ff0dfa260ef73af625bf231b457a3e7d" | ||
"gitHead": "3bbf8d39b7b9d568ec075c8f0b1a250ab257d6e1" | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20384
389
1