flipper-plugin
Version:
Flipper Desktop plugin SDK and components
68 lines • 2.43 kB
TypeScript
/**
* 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.
*
* @format
*/
import { ElementID, Element, ElementSearchResultSet } from './ElementsInspector';
import { PureComponent, ReactElement } from 'react';
import React, { KeyboardEvent } from 'react';
export declare const ElementsConstants: {
rowHeight: number;
};
type FlatElement = {
key: ElementID;
element: Element;
level: number;
};
type FlatElements = Array<FlatElement>;
export type DecorateRow = (e: Element) => ReactElement<any> | undefined | null;
type ElementsProps = {
root: ElementID | undefined | null;
selected: ElementID | undefined | null;
focused?: ElementID | undefined | null;
searchResults: ElementSearchResultSet | undefined | null;
elements: {
[key: string]: Element;
};
onElementSelected: (key: ElementID) => void;
onElementExpanded: (key: ElementID, deep: boolean) => void;
onElementHovered: ((key: ElementID | undefined | null) => void) | undefined | null;
alternateRowColor?: boolean;
contextMenuExtensions?: () => Array<ContextMenuExtension>;
decorateRow?: DecorateRow;
};
type ElementsState = {
flatKeys: Array<ElementID>;
flatElements: FlatElements;
maxDepth: number;
scrolledElement: string | null | undefined;
};
export type ContextMenuExtension = {
label: string;
click: (element: ElementID) => any;
};
export declare class Elements extends PureComponent<ElementsProps, ElementsState> {
static defaultProps: {
alternateRowColor: boolean;
};
constructor(props: ElementsProps, context: Object);
static getDerivedStateFromProps(props: ElementsProps): {
flatElements: FlatElements;
flatKeys: string[];
maxDepth: number;
};
selectElement: (key: ElementID) => void;
isDarwin: boolean;
onKeyDown: (e: KeyboardEvent<any>) => void;
onElementHoveredHandler: (key: string | null | undefined) => void;
onCopyExpandedTree: (element: Element, maxDepth: number, depth?: number) => string;
parentRef: React.RefObject<HTMLDivElement>;
scrollToSelectionRefHandler: (selectedRow: HTMLDivElement | null) => void;
buildRow: (row: FlatElement, index: number) => JSX.Element;
render(): JSX.Element;
}
export {};
//# sourceMappingURL=elements.d.ts.map