Home / File/ Overlay.js — react Source File

Overlay.js — react Source File

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

File javascript BabelCompiler Validation 2 imports 1 dependents 2 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  5b39fc3a_1731_1aaf_f727_b3222027f445["Overlay.js"]
  68d130b4_8767_c9b9_03b4_1510bf2fc934["utils.js"]
  5b39fc3a_1731_1aaf_f727_b3222027f445 --> 68d130b4_8767_c9b9_03b4_1510bf2fc934
  7812cbae_0bd0_497c_0a05_31fe0a8d0fde["agent"]
  5b39fc3a_1731_1aaf_f727_b3222027f445 --> 7812cbae_0bd0_497c_0a05_31fe0a8d0fde
  637d6ae2_3589_aafb_1b83_9f14bbf636ac["Highlighter.js"]
  637d6ae2_3589_aafb_1b83_9f14bbf636ac --> 5b39fc3a_1731_1aaf_f727_b3222027f445
  style 5b39fc3a_1731_1aaf_f727_b3222027f445 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 {getElementDimensions, getNestedBoundingClientRect} from '../utils';

import type {Rect} from '../utils';
import type Agent from 'react-devtools-shared/src/backend/agent';

type Box = {top: number, left: number, width: number, height: number};

const assign = Object.assign;

// Note that the Overlay components are not affected by the active Theme,
// because they highlight elements in the main Chrome window (outside of devtools).
// The colors below were chosen to roughly match those used by Chrome devtools.

class OverlayRect {
  node: HTMLElement;
  border: HTMLElement;
  padding: HTMLElement;
  content: HTMLElement;

  constructor(doc: Document, container: HTMLElement) {
    this.node = doc.createElement('div');
    this.border = doc.createElement('div');
    this.padding = doc.createElement('div');
    this.content = doc.createElement('div');

    this.border.style.borderColor = overlayStyles.border;
    this.padding.style.borderColor = overlayStyles.padding;
    this.content.style.backgroundColor = overlayStyles.background;

    assign(this.node.style, {
      borderColor: overlayStyles.margin,
      pointerEvents: 'none',
      position: 'fixed',
    });

    this.node.style.zIndex = '10000000';

    this.node.appendChild(this.border);
    this.border.appendChild(this.padding);
    this.padding.appendChild(this.content);
    container.appendChild(this.node);
  }

  remove() {
    if (this.node.parentNode) {
      this.node.parentNode.removeChild(this.node);
    }
  }

  update(box: Rect, dims: any) {
    boxWrap(dims, 'margin', this.node);
// ... (270 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does Overlay.js do?
Overlay.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 Overlay.js?
Overlay.js defines 2 function(s): boxWrap, findTipPos.
What does Overlay.js depend on?
Overlay.js imports 2 module(s): agent, utils.js.
What files import Overlay.js?
Overlay.js is imported by 1 file(s): Highlighter.js.
Where is Overlay.js in the architecture?
Overlay.js is located at packages/react-devtools-shared/src/backend/views/Highlighter/Overlay.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/views/Highlighter).

Analyze Your Own Codebase

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

Try Supermodel Free