Home / File/ ReactFizzViewTransitionComponent.js — react Source File

ReactFizzViewTransitionComponent.js — react Source File

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

File javascript BabelCompiler Validation 4 imports 1 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  a625ee1f_41da_759d_b96d_f17ee797888e["ReactFizzViewTransitionComponent.js"]
  fe344404_ced0_26ed_f52b_cbbe258bc47a["ReactFizzTreeContext.js"]
  a625ee1f_41da_759d_b96d_f17ee797888e --> fe344404_ced0_26ed_f52b_cbbe258bc47a
  7a7f357d_7b45_550b_09d7_ec9967c0e9ef["ReactFizzConfig.js"]
  a625ee1f_41da_759d_b96d_f17ee797888e --> 7a7f357d_7b45_550b_09d7_ec9967c0e9ef
  fdc641fa_a6b8_f59a_e563_deb0f606ffe8["getTreeId"]
  a625ee1f_41da_759d_b96d_f17ee797888e --> fdc641fa_a6b8_f59a_e563_deb0f606ffe8
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  a625ee1f_41da_759d_b96d_f17ee797888e --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  1b694821_5816_1762_7c98_f0727a09e732["ReactFizzServer.js"]
  1b694821_5816_1762_7c98_f0727a09e732 --> a625ee1f_41da_759d_b96d_f17ee797888e
  style a625ee1f_41da_759d_b96d_f17ee797888e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {ViewTransitionProps, ViewTransitionClass} from 'shared/ReactTypes';
import type {TreeContext} from './ReactFizzTreeContext';
import type {ResumableState} from './ReactFizzConfig';

import {getTreeId} from './ReactFizzTreeContext';
import {makeId} from './ReactFizzConfig';

export function getViewTransitionName(
  props: ViewTransitionProps,
  treeContext: TreeContext,
  resumableState: ResumableState,
): string {
  if (props.name != null && props.name !== 'auto') {
    return props.name;
  }
  const treeId = getTreeId(treeContext);
  return makeId(resumableState, treeId, 0);
}

function getClassNameByType(classByType: ?ViewTransitionClass): ?string {
  if (classByType == null || typeof classByType === 'string') {
    return classByType;
  }
  let className: ?string = null;
  const activeTypes = null; // TODO: Support passing active types.
  if (activeTypes !== null) {
    for (let i = 0; i < activeTypes.length; i++) {
      const match = classByType[activeTypes[i]];
      if (match != null) {
        if (match === 'none') {
          // If anything matches "none" that takes precedence over any other
          // type that also matches.
          return 'none';
        }
        if (className == null) {
          className = match;
        } else {
          className += ' ' + match;
        }
      }
    }
  }
  if (className == null) {
    // We had no other matches. Match the default for this configuration.
    return classByType.default;
  }
  return className;
}

export function getViewTransitionClassName(
  defaultClass: ?ViewTransitionClass,
  eventClass: ?ViewTransitionClass,
): ?string {
  const className: ?string = getClassNameByType(defaultClass);
  const eventClassName: ?string = getClassNameByType(eventClass);
  if (eventClassName == null) {
    return className === 'auto' ? null : className;
  }
  if (eventClassName === 'auto') {
    return null;
  }
  return eventClassName;
}

Domain

Subdomains

Frequently Asked Questions

What does ReactFizzViewTransitionComponent.js do?
ReactFizzViewTransitionComponent.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactFizzViewTransitionComponent.js?
ReactFizzViewTransitionComponent.js defines 3 function(s): getClassNameByType, getViewTransitionClassName, getViewTransitionName.
What does ReactFizzViewTransitionComponent.js depend on?
ReactFizzViewTransitionComponent.js imports 4 module(s): ReactFizzConfig.js, ReactFizzTreeContext.js, ReactTypes, getTreeId.
What files import ReactFizzViewTransitionComponent.js?
ReactFizzViewTransitionComponent.js is imported by 1 file(s): ReactFizzServer.js.
Where is ReactFizzViewTransitionComponent.js in the architecture?
ReactFizzViewTransitionComponent.js is located at packages/react-server/src/ReactFizzViewTransitionComponent.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-server/src).

Analyze Your Own Codebase

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

Try Supermodel Free