InspectedElementViewSourceButton.js — react Source File
Architecture documentation for InspectedElementViewSourceButton.js, a javascript file in the react codebase. 8 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR e1b4c141_a4b7_37b7_6892_efa866707492["InspectedElementViewSourceButton.js"] 9f39024f_b905_9b0f_2fc7_e24785732638["ButtonIcon.js"] e1b4c141_a4b7_37b7_6892_efa866707492 --> 9f39024f_b905_9b0f_2fc7_e24785732638 4690d9c0_cb81_9593_7817_f9e61a49f9e7["ButtonIcon"] e1b4c141_a4b7_37b7_6892_efa866707492 --> 4690d9c0_cb81_9593_7817_f9e61a49f9e7 f9049b08_60f8_abce_a6a6_153f88447124["Button.js"] e1b4c141_a4b7_37b7_6892_efa866707492 --> f9049b08_60f8_abce_a6a6_153f88447124 f71ee326_17f0_7db4_4178_2763fb1c2ad1["Button"] e1b4c141_a4b7_37b7_6892_efa866707492 --> f71ee326_17f0_7db4_4178_2763fb1c2ad1 4d6a124e_fdc4_9da9_8ac7_85f75cd106fe["useOpenResource.js"] e1b4c141_a4b7_37b7_6892_efa866707492 --> 4d6a124e_fdc4_9da9_8ac7_85f75cd106fe ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] e1b4c141_a4b7_37b7_6892_efa866707492 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] e1b4c141_a4b7_37b7_6892_efa866707492 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 c3870ba8_6512_a088_2557_ff78b3a22e41["symbolicateSource"] e1b4c141_a4b7_37b7_6892_efa866707492 --> c3870ba8_6512_a088_2557_ff78b3a22e41 4c0d725a_27bd_a723_3599_a3e75bea5bd3["InspectedElement.js"] 4c0d725a_27bd_a723_3599_a3e75bea5bd3 --> e1b4c141_a4b7_37b7_6892_efa866707492 style e1b4c141_a4b7_37b7_6892_efa866707492 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 ButtonIcon from '../ButtonIcon';
import Button from '../Button';
import type {ReactFunctionLocation} from 'shared/ReactTypes';
import type {SourceMappedLocation} from 'react-devtools-shared/src/symbolicateSource';
import useOpenResource from '../useOpenResource';
type Props = {
source: null | ReactFunctionLocation,
symbolicatedSourcePromise: Promise<SourceMappedLocation | null> | null,
};
function InspectedElementViewSourceButton({
source,
symbolicatedSourcePromise,
}: Props): React.Node {
return (
<React.Suspense
fallback={
<Button disabled={true} title="Loading source maps...">
<ButtonIcon type="view-source" />
</Button>
}>
<ActualSourceButton
source={source}
symbolicatedSourcePromise={symbolicatedSourcePromise}
/>
</React.Suspense>
);
}
type ActualSourceButtonProps = {
source: null | ReactFunctionLocation,
symbolicatedSourcePromise: Promise<SourceMappedLocation | null> | null,
};
function ActualSourceButton({
source,
symbolicatedSourcePromise,
}: ActualSourceButtonProps): React.Node {
const symbolicatedSource =
symbolicatedSourcePromise == null
? null
: React.use(symbolicatedSourcePromise);
const [buttonIsEnabled, viewSource] = useOpenResource(
source,
symbolicatedSource == null ? null : symbolicatedSource.location,
);
return (
<Button
disabled={!buttonIsEnabled}
onClick={viewSource}
title="View source for this element">
<ButtonIcon type="view-source" />
</Button>
);
}
export default InspectedElementViewSourceButton;
Domain
Subdomains
Dependencies
- Button
- Button.js
- ButtonIcon
- ButtonIcon.js
- ReactTypes
- react
- symbolicateSource
- useOpenResource.js
Source
Frequently Asked Questions
What does InspectedElementViewSourceButton.js do?
InspectedElementViewSourceButton.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 InspectedElementViewSourceButton.js?
InspectedElementViewSourceButton.js defines 2 function(s): ActualSourceButton, InspectedElementViewSourceButton.
What does InspectedElementViewSourceButton.js depend on?
InspectedElementViewSourceButton.js imports 8 module(s): Button, Button.js, ButtonIcon, ButtonIcon.js, ReactTypes, react, symbolicateSource, useOpenResource.js.
What files import InspectedElementViewSourceButton.js?
InspectedElementViewSourceButton.js is imported by 1 file(s): InspectedElement.js.
Where is InspectedElementViewSourceButton.js in the architecture?
InspectedElementViewSourceButton.js is located at packages/react-devtools-shared/src/devtools/views/Components/InspectedElementViewSourceButton.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