Element.js — react Source File
Architecture documentation for Element.js, a javascript file in the react codebase. 21 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9930e8cf_03b4_86c0_be04_47b410246b71["Element.js"] 9f39024f_b905_9b0f_2fc7_e24785732638["ButtonIcon.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 9f39024f_b905_9b0f_2fc7_e24785732638 4690d9c0_cb81_9593_7817_f9e61a49f9e7["ButtonIcon"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 4690d9c0_cb81_9593_7817_f9e61a49f9e7 2d59b0f9_9ad6_da4d_0264_d98f193ab3fd["TreeContext.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 2d59b0f9_9ad6_da4d_0264_d98f193ab3fd 913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76 315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 315baf50_1028_51ca_a9c1_679c6a17ed98 0c2aa36f_2bfd_0e20_42bf_2839b3e43e73["IndexableElementBadges.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 0c2aa36f_2bfd_0e20_42bf_2839b3e43e73 6c5dd321_aa62_70b5_69c3_7a98c75675ee["IndexableElementBadges"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 6c5dd321_aa62_70b5_69c3_7a98c75675ee 9e753c35_ccc6_2061_a942_6e9b10c9177c["IndexableDisplayName.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 9e753c35_ccc6_2061_a942_6e9b10c9177c 944cc9b2_cf30_ba1e_496b_02b48a5aaa97["IndexableDisplayName"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 944cc9b2_cf30_ba1e_496b_02b48a5aaa97 80ad5569_a221_98e5_daec_ede1bea33ee0["Tree.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 80ad5569_a221_98e5_daec_ede1bea33ee0 5a81d86f_6a8c_9985_ddb8_5ba82a404c8b["Element.css"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 5a81d86f_6a8c_9985_ddb8_5ba82a404c8b 21af3248_c15c_a61c_1f5b_7409a91b945c["Icon.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> 21af3248_c15c_a61c_1f5b_7409a91b945c f23861b1_8332_6fa9_2862_ddd6110f3776["Icon"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> f23861b1_8332_6fa9_2862_ddd6110f3776 fd0c3251_3b74_cf9d_8897_18f7e16e765e["OwnersListContext.js"] 9930e8cf_03b4_86c0_be04_47b410246b71 --> fd0c3251_3b74_cf9d_8897_18f7e16e765e style 9930e8cf_03b4_86c0_be04_47b410246b71 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 * as React from 'react';
import {Fragment, startTransition, useContext, useMemo, useState} from 'react';
import Store from 'react-devtools-shared/src/devtools/store';
import {ElementTypeActivity} from 'react-devtools-shared/src/frontend/types';
import ButtonIcon from '../ButtonIcon';
import {TreeDispatcherContext, TreeStateContext} from './TreeContext';
import {StoreContext} from '../context';
import {useSubscription} from '../hooks';
import {logEvent} from 'react-devtools-shared/src/Logger';
import IndexableElementBadges from './IndexableElementBadges';
import IndexableDisplayName from './IndexableDisplayName';
import type {ItemData} from './Tree';
import type {Element as ElementType} from 'react-devtools-shared/src/frontend/types';
import styles from './Element.css';
import Icon from '../Icon';
import {useChangeOwnerAction} from './OwnersListContext';
import Tooltip from './reach-ui/tooltip';
import {useChangeActivitySliceAction} from '../SuspenseTab/ActivityList';
type Props = {
data: ItemData,
index: number,
style: Object,
...
};
export default function Element({data, index, style}: Props): React.Node {
const store = useContext(StoreContext);
const {ownerFlatTree, ownerID, inspectedElementID} =
useContext(TreeStateContext);
const dispatch = useContext(TreeDispatcherContext);
const element =
ownerFlatTree !== null
? ownerFlatTree[index]
: store.getElementAtIndex(index);
const [isHovered, setIsHovered] = useState(false);
const errorsAndWarningsSubscription = useMemo(
() => ({
getCurrentValue: () =>
element === null
? {errorCount: 0, warningCount: 0}
: store.getErrorAndWarningCountForElementID(element.id),
subscribe: (callback: Function) => {
store.addListener('mutated', callback);
return () => store.removeListener('mutated', callback);
},
// ... (237 more lines)
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does Element.js do?
Element.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 Element.js?
Element.js defines 3 function(s): Element, ExpandCollapseToggle, swallowDoubleClick.
What does Element.js depend on?
Element.js imports 21 module(s): ActivityList.js, ButtonIcon, ButtonIcon.js, Element.css, Icon, Icon.js, IndexableDisplayName, IndexableDisplayName.js, and 13 more.
What files import Element.js?
Element.js is imported by 1 file(s): Tree.js.
Where is Element.js in the architecture?
Element.js is located at packages/react-devtools-shared/src/devtools/views/Components/Element.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free