layouter.js — react Source File
Architecture documentation for layouter.js, a javascript file in the react codebase. 2 imports, 4 dependents.
Entity Profile
Dependency Diagram
graph LR 967225f1_4dbc_efd7_073f_8182bb20aa4f["layouter.js"] 1d481b0c_03e1_6f28_eff1_74d4566b3dc8["geometry.js"] 967225f1_4dbc_efd7_073f_8182bb20aa4f --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8 82f60adf_9325_5735_ba06_dcbbfcf32cc9["View.js"] 967225f1_4dbc_efd7_073f_8182bb20aa4f --> 82f60adf_9325_5735_ba06_dcbbfcf32cc9 82f60adf_9325_5735_ba06_dcbbfcf32cc9["View.js"] 82f60adf_9325_5735_ba06_dcbbfcf32cc9 --> 967225f1_4dbc_efd7_073f_8182bb20aa4f 6e3184c5_8737_3bc9_5c7e_598f40316d02["ResizableView.js"] 6e3184c5_8737_3bc9_5c7e_598f40316d02 --> 967225f1_4dbc_efd7_073f_8182bb20aa4f b6da9a74_cd56_c43e_377b_37156f7faf8c["ResizeBarView.js"] b6da9a74_cd56_c43e_377b_37156f7faf8c --> 967225f1_4dbc_efd7_073f_8182bb20aa4f 9d25a570_0086_154f_00bb_c5b100737b42["withVerticalScrollbarLayout.js"] 9d25a570_0086_154f_00bb_c5b100737b42 --> 967225f1_4dbc_efd7_073f_8182bb20aa4f style 967225f1_4dbc_efd7_073f_8182bb20aa4f 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 {Rect} from './geometry';
import type {View} from './View';
export type LayoutInfo = {view: View, frame: Rect};
export type Layout = LayoutInfo[];
/**
* A function that takes a list of subviews, currently laid out in
* `existingLayout`, and lays them out into `containingFrame`.
*/
export type Layouter = (
existingLayout: Layout,
containingFrame: Rect,
) => Layout;
function viewToLayoutInfo(view: View): LayoutInfo {
return {view, frame: view.frame};
}
export function viewsToLayout(views: View[]): Layout {
return views.map(viewToLayoutInfo);
}
/**
* Applies `layout`'s `frame`s to its corresponding `view`.
*/
export function collapseLayoutIntoViews(layout: Layout) {
layout.forEach(({view, frame}) => view.setFrame(frame));
}
/**
* A no-operation layout; does not modify the layout.
*/
export const noopLayout: Layouter = layout => layout;
/**
* Layer views on top of each other. All views' frames will be set to `containerFrame`.
*
* Equivalent to composing:
* - `alignToContainerXLayout`,
* - `alignToContainerYLayout`,
* - `containerWidthLayout`, and
* - `containerHeightLayout`.
*/
export const layeredLayout: Layouter = (layout, containerFrame) => {
return layout.map(layoutInfo => ({...layoutInfo, frame: containerFrame}));
};
/**
* Stacks `views` vertically in `frame`.
* All views in `views` will have their widths set to the frame's width.
// ... (166 more lines)
Domain
Subdomains
Functions
- Layouter()
- alignToContainerXLayout()
- alignToContainerYLayout()
- atLeastContainerHeightLayout()
- collapseLayoutIntoViews()
- containerHeightLayout()
- containerWidthLayout()
- createComposedLayout()
- desiredHeightLayout()
- layeredLayout()
- noopLayout()
- uniformMaxSubviewHeightLayout()
- verticallyStackedLayout()
- viewToLayoutInfo()
- viewsToLayout()
Dependencies
Imported By
- packages/react-devtools-timeline/src/view-base/resizable/ResizableView.js
- packages/react-devtools-timeline/src/view-base/resizable/ResizeBarView.js
- packages/react-devtools-timeline/src/view-base/View.js
- packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js
Source
Frequently Asked Questions
What does layouter.js do?
layouter.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 layouter.js?
layouter.js defines 15 function(s): Layouter, alignToContainerXLayout, alignToContainerYLayout, atLeastContainerHeightLayout, collapseLayoutIntoViews, containerHeightLayout, containerWidthLayout, createComposedLayout, desiredHeightLayout, layeredLayout, and 5 more.
What does layouter.js depend on?
layouter.js imports 2 module(s): View.js, geometry.js.
What files import layouter.js?
layouter.js is imported by 4 file(s): ResizableView.js, ResizeBarView.js, View.js, withVerticalScrollbarLayout.js.
Where is layouter.js in the architecture?
layouter.js is located at packages/react-devtools-timeline/src/view-base/layouter.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src/view-base).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free