AnimatedPropertyItem.js (1759B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 createFactory, 9 PureComponent, 10 } = require("resource://devtools/client/shared/vendor/react.mjs"); 11 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 12 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs"); 13 14 const AnimatedPropertyName = createFactory( 15 require("resource://devtools/client/inspector/animation/components/AnimatedPropertyName.js") 16 ); 17 const KeyframesGraph = createFactory( 18 require("resource://devtools/client/inspector/animation/components/keyframes-graph/KeyframesGraph.js") 19 ); 20 21 class AnimatedPropertyItem extends PureComponent { 22 static get propTypes() { 23 return { 24 getComputedStyle: PropTypes.func.isRequired, 25 isUnchanged: PropTypes.bool.isRequired, 26 keyframes: PropTypes.array.isRequired, 27 name: PropTypes.string.isRequired, 28 simulateAnimation: PropTypes.func.isRequired, 29 state: PropTypes.object.isRequired, 30 type: PropTypes.string.isRequired, 31 }; 32 } 33 34 render() { 35 const { 36 getComputedStyle, 37 isUnchanged, 38 keyframes, 39 name, 40 simulateAnimation, 41 state, 42 type, 43 } = this.props; 44 45 return dom.li( 46 { 47 className: "animated-property-item" + (isUnchanged ? " unchanged" : ""), 48 }, 49 AnimatedPropertyName({ 50 name, 51 state, 52 }), 53 KeyframesGraph({ 54 getComputedStyle, 55 keyframes, 56 name, 57 simulateAnimation, 58 type, 59 }) 60 ); 61 } 62 } 63 64 module.exports = AnimatedPropertyItem;