tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AnimationList.js (2094B)


      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 AnimationItem = createFactory(
     15  require("resource://devtools/client/inspector/animation/components/AnimationItem.js")
     16 );
     17 
     18 class AnimationList extends PureComponent {
     19  static get propTypes() {
     20    return {
     21      animations: PropTypes.arrayOf(PropTypes.object).isRequired,
     22      dispatch: PropTypes.func.isRequired,
     23      displayableRange: PropTypes.object.isRequired,
     24      getAnimatedPropertyMap: PropTypes.func.isRequired,
     25      getNodeFromActor: PropTypes.func.isRequired,
     26      selectAnimation: PropTypes.func.isRequired,
     27      setHighlightedNode: PropTypes.func.isRequired,
     28      setSelectedNode: PropTypes.func.isRequired,
     29      simulateAnimation: PropTypes.func.isRequired,
     30      timeScale: PropTypes.object.isRequired,
     31    };
     32  }
     33 
     34  render() {
     35    const {
     36      animations,
     37      dispatch,
     38      displayableRange,
     39      getAnimatedPropertyMap,
     40      getNodeFromActor,
     41      selectAnimation,
     42      setHighlightedNode,
     43      setSelectedNode,
     44      simulateAnimation,
     45      timeScale,
     46    } = this.props;
     47 
     48    const { startIndex, endIndex } = displayableRange;
     49 
     50    return dom.ul(
     51      {
     52        className: "animation-list",
     53      },
     54      animations.map((animation, index) =>
     55        AnimationItem({
     56          animation,
     57          dispatch,
     58          getAnimatedPropertyMap,
     59          getNodeFromActor,
     60          isDisplayable: startIndex <= index && index <= endIndex,
     61          selectAnimation,
     62          setHighlightedNode,
     63          setSelectedNode,
     64          simulateAnimation,
     65          timeScale,
     66        })
     67      )
     68    );
     69  }
     70 }
     71 
     72 module.exports = AnimationList;