import { Config, ContentItem } from "golden-layout"; import { ItemConfigType, IWorkbenchState, WorkbenchStateTransformer } from "./types"; import { Workbench } from "./workbench"; /** * Special symbol that can be fed into a generator that iterates over the * content items of a workbench to indicate that the current content item * should be removed. */ declare const REMOVE: unique symbol; /** * String constants defining the known iteration orders. */ export type IterationOrder = "dfsReverse"; export interface IIterationOptions { order: IterationOrder; } /** * Iterates over the items of a workbench or workbench configuration * according to some iteration order. * * Both panels (leaf nodes) and containers (rows, columns and stacks) will be * returned by the iterator. If you need the panels only, use `panelsIn()`. * If you need the containers only, use `containersIn()`. * * @param input the workbench or workbench configuration whose items are * to be iterated over * @param options additional options that influence the iterator behaviour * @return the iterator */ export declare function itemsIn(input: Workbench, options?: Partial): Iterator; export declare function itemsIn(input: Config | IWorkbenchState, options?: Partial): Iterator; /** * Iterates over the panels of a workbench or a workbench configuration object * according to some iteration order. * * Only panels will be returned by this iterator; containers will be ignored. * * @param input the workbench or workbench configuration whose panels are * to be iterated over * @param options additional options that influence the iterator behaviour * @return the iterator */ export declare function panelsIn(input: Workbench, options?: Partial): Iterator; export declare function panelsIn(input: Config | IWorkbenchState, options?: Partial): Iterator; /** * Iterates over the containers of a workbench or a workbench configuration * object according to some iteration order. * * Only containers will be returned by this iterator; panels will be ignored. * * @param input the workbench or workbench configuration whose containers * are to be iterated over * @param options additional options that influence the iterator behaviour * @return the iterator */ export declare function containersIn(input: Workbench, options?: Partial): Iterator; export declare function containersIn(input: Config | IWorkbenchState, options?: Partial): Iterator; /** * Filters the configuration of a workbench in-place by calling a predicate * with each configuration item (panel or container) and removing it if the * given predicate returns false. * * This is considered a low-level function; typically you can simply use * `filteredState()` instead, which takes an IWorkbenchState and returns * another, filtered one, without modifying the original one. It can also be * used in curried form. * * @param pred the filter predicate * @param input the workbench configuration or state to transform, or an * iterator that yields items from a workbench configuration */ export declare function filterState(pred: (item: ItemConfigType) => boolean, input: Config | IWorkbenchState | Iterator): void; /** * Filters a workbench state object by calling a predicate with each * panel in the state object (but not containers) and removing it if the given * predicate returns false. * * @param pred the filter predicate * @param state the state object to filter * @return the filtered state object */ export declare function filteredPanels(pred: (item: ItemConfigType) => boolean): WorkbenchStateTransformer; export declare function filteredPanels(pred: (item: ItemConfigType) => boolean, state: IWorkbenchState): IWorkbenchState; /** * Filters a workbench state object by calling a predicate with each * configuration item (panel or container) and removing it if the given * predicate returns false. * * This function does not modify the original state object and returns a * deep copy instead. The function can also be used in curried form by omitting * the input. * * @param pred the filter predicate * @param state the state object to filter * @return the filtered state object */ export declare function filteredState(pred: (item: ItemConfigType) => boolean): WorkbenchStateTransformer; export declare function filteredState(pred: (item: ItemConfigType) => boolean, state: IWorkbenchState): IWorkbenchState; /** * Transforms the configuration of a workbench in-place by calling a function * with each configuration item (panel or container) and replacing the * configuration item with whatever the mapping function returns. * * This is considered a low-level function; typically you can simply use * `transformedState()` instead, which takes an IWorkbenchState and returns * another, transformed one, without modifying the original one. It can also be * used in curried form. * * @param func the mapper function * @param input the workbench configuration or state to transform, or an * iterator that yields items from a workbench configuration */ export declare function transformState(func: (item: ItemConfigType) => ItemConfigType, input: Config | IWorkbenchState | Iterator): void; /** * Transforms a workbench state object by calling a function with each * configuration item (panel or container) and replacing the * configuration item with whatever the mapping function returns. * * This function does not modify the original state object and returns a * deep copy instead. The function can also be used in curried form by omitting * the input. * * @param func the mapper function * @param state the state object to transform * @return the transformed state object */ export declare function transformedState(func: (item: ItemConfigType) => ItemConfigType): WorkbenchStateTransformer; export declare function transformedState(func: (item: ItemConfigType) => ItemConfigType, state: IWorkbenchState): IWorkbenchState; export {};