import { Spec } from 'immutability-helper'; /** * Valid node types * @see React.Key */ export type MosaicKey = string | number; /** * Base type for the Mosaic binary tree */ export type MosaicNode = MosaicParent | T; /** * Row means each window is side-by-side */ export type MosaicDirection = 'row' | 'column'; export interface MosaicParent { direction: MosaicDirection; first: MosaicNode; second: MosaicNode; splitPercentage?: number; } export type MosaicBranch = 'first' | 'second'; export type MosaicPath = MosaicBranch[]; /** * Used by many utility methods to update the tree. * spec will be passed to https://github.com/kolodny/immutability-helper */ export type MosaicUpdateSpec = Spec>; export interface MosaicUpdate { path: MosaicPath; spec: MosaicUpdateSpec; } /** * Mosaic needs a way to resolve `MosaicKey` into react elements for display. * This provides a way to render them. */ export type TileRenderer = (t: T, path: MosaicBranch[]) => JSX.Element; /** * Function that provides a new node to put into the tree */ export type CreateNode = (...args: any[]) => Promise> | MosaicNode; /** * Used by `react-dnd` * @type {{WINDOW: string}} */ export const MosaicDragType = { WINDOW: 'MosaicWindow', }; export interface EnabledResizeOptions { minimumPaneSizePercentage?: number; // Default: 20 allowMinimizedPanes?: boolean; // Default: 20 } export type ResizeOptions = 'DISABLED' | EnabledResizeOptions;