planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
import { Component, ReactNode } from "react";
import { DetectElementResize } from "./vendor/detectElementResize.js";
import { Props } from "./types.js";
type State = {
height: number;
scaledHeight: number;
scaledWidth: number;
width: number;
};
export declare class AutoSizer extends Component<Props, State> {
state: {
height: number;
scaledHeight: number;
scaledWidth: number;
width: number;
};
_autoSizer: HTMLElement | null;
_detectElementResize: DetectElementResize | null;
_parentNode: HTMLElement | null;
_resizeObserver: ResizeObserver | null;
_timeoutId: number | null;
componentDidMount(): void;
componentWillUnmount(): void;
render(): ReactNode;
_onResize: () => void;
_setRef: (autoSizer: HTMLElement | null) => void;
}
export {};

View File

@@ -0,0 +1,3 @@
import { AutoSizer } from "./AutoSizer.js";
export default AutoSizer;
export * from "./types.js";

View File

@@ -0,0 +1,42 @@
import { HTMLAttributes, ReactNode } from "react";
export type HorizontalSize = {
width: number;
scaledWidth: number;
};
export type VerticalSize = {
height: number;
scaledHeight: number;
};
export type Size = HorizontalSize & VerticalSize;
type BaseProps = {
doNotBailOutOnEmptyChildren?: boolean;
nonce?: string;
tagName?: string;
} & Omit<HTMLAttributes<HTMLDivElement>, "children" | "onResize">;
export type HeightOnlyProps = BaseProps & {
children: (size: VerticalSize) => ReactNode;
defaultHeight?: number;
disableHeight?: false;
disableWidth: true;
onResize?: (size: VerticalSize) => void;
};
export type WidthOnlyProps = BaseProps & {
children: (size: HorizontalSize) => ReactNode;
defaultWidth?: number;
disableHeight: true;
disableWidth?: false;
onResize?: (size: HorizontalSize) => void;
};
export type HeightAndWidthProps = BaseProps & {
children: (size: Size) => ReactNode;
defaultHeight?: number;
defaultWidth?: number;
disableHeight?: false;
disableWidth?: false;
onResize?: (size: Size) => void;
};
export type Props = HeightOnlyProps | WidthOnlyProps | HeightAndWidthProps;
export declare function isHeightAndWidthProps(props: any): props is HeightAndWidthProps;
export declare function isHeightOnlyProps(props: any): props is HeightOnlyProps;
export declare function isWidthOnlyProps(props: any): props is WidthOnlyProps;
export {};

View File

@@ -0,0 +1,10 @@
type ResizeHandler = (element: HTMLElement, onResize: () => void) => void;
export type DetectElementResize = {
addResizeListener: ResizeHandler;
removeResizeListener: ResizeHandler;
};
export function createDetectElementResize(nonce?: string): DetectElementResize;
export {};