Home / File/ Fibers.js — react Source File

Fibers.js — react Source File

Architecture documentation for Fibers.js, a javascript file in the react codebase. 3 imports, 1 dependents.

File javascript BabelCompiler Optimization 3 imports 1 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  a811b6d7_3802_33c4_440e_c2d161277e14["Fibers.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  a811b6d7_3802_33c4_440e_c2d161277e14 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  83aee897_c6a8_0862_b6a0_cb9f13776728["react-motion"]
  a811b6d7_3802_33c4_440e_c2d161277e14 --> 83aee897_c6a8_0862_b6a0_cb9f13776728
  48aa626d_265b_27c9_4de0_90d5a22b2d2d["dagre"]
  a811b6d7_3802_33c4_440e_c2d161277e14 --> 48aa626d_265b_27c9_4de0_90d5a22b2d2d
  5bd02a98_f81e_d049_4b30_df0a827f81d8["App.js"]
  5bd02a98_f81e_d049_4b30_df0a827f81d8 --> a811b6d7_3802_33c4_440e_c2d161277e14
  style a811b6d7_3802_33c4_440e_c2d161277e14 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import React from 'react';
import {Motion, spring} from 'react-motion';
import dagre from 'dagre';
// import prettyFormat from 'pretty-format';
// import reactElement from 'pretty-format/plugins/ReactElement';

function getFiberColor(fibers, id) {
  if (fibers.currentIDs.indexOf(id) > -1) {
    return 'lightgreen';
  }
  if (id === fibers.workInProgressID) {
    return 'yellow';
  }
  return 'lightyellow';
}

function Graph(props) {
  const {rankdir, trackActive} = props.settings;
  var g = new dagre.graphlib.Graph();
  g.setGraph({
    width: 1000,
    height: 1000,
    nodesep: 50,
    edgesep: 150,
    ranksep: 100,
    marginx: 100,
    marginy: 100,
    rankdir,
  });

  var edgeLabels = {};
  React.Children.forEach(props.children, function (child) {
    if (!child) {
      return;
    }
    if (child.type.isVertex) {
      g.setNode(child.key, {
        label: child,
        width: child.props.width,
        height: child.props.height,
      });
    } else if (child.type.isEdge) {
      const relationshipKey = child.props.source + ':' + child.props.target;
      if (!edgeLabels[relationshipKey]) {
        edgeLabels[relationshipKey] = [];
      }
      edgeLabels[relationshipKey].push(child);
    }
  });

  Object.keys(edgeLabels).forEach(key => {
    const children = edgeLabels[key];
    const child = children[0];
    g.setEdge(child.props.source, child.props.target, {
      label: child,
      allChildren: children.map(c => c.props.children),
      weight: child.props.weight,
    });
  });

// ... (348 more lines)

Domain

Subdomains

Dependencies

  • dagre
  • react
  • react-motion

Frequently Asked Questions

What does Fibers.js do?
Fibers.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in Fibers.js?
Fibers.js defines 6 function(s): Edge, Fibers, Graph, Vertex, formatPriority, getFiberColor.
What does Fibers.js depend on?
Fibers.js imports 3 module(s): dagre, react, react-motion.
What files import Fibers.js?
Fibers.js is imported by 1 file(s): App.js.
Where is Fibers.js in the architecture?
Fibers.js is located at fixtures/fiber-debugger/src/Fibers.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/fiber-debugger/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free