import type OpenFin from '@openfin/core'; import { WindowIdentity } from '../../../common/src/utils/window'; import type { PagePinnedState } from '../../../common/src/api/pages/shapes'; import { AttachedPage, BrowserCreateViewRequest, PageLayout } from '../../../client-api-platform/src/shapes'; export type LayoutDOMEventType = /** * Fired when a tab is created in a container. (Emmitted by ??) */ 'tabs-list-resized' /** * Fired when a tab is created in a container. (Emmitted by core) */ | 'tab-created' /** * Fired when a new container/stack is created. (Emitted by Golden Layout) */ | 'container-created' /** * Fired when the layout container is ready to be used. (Emitted by us) */ | 'container-resized' /** * Fired when a view item container is resized (e.g., via separator drag). (Emitted by us) */ | 'view-container-resized' | 'tab-closed'; export type LayoutDOMEvent = { type: Extract; } | { type: Extract; } | { type: Extract; detail: { containerSelector: string; tabSelector: string; name: string; topic: string; type: string; uuid: string; originalElement: HTMLElement; }; isInitialized: boolean; target: HTMLElement; } | { type: Extract; detail?: { containerSelector?: string; [key: string]: any; }; target?: HTMLElement; originalElement?: HTMLElement; } | { type: Extract; }; export type LayoutDOMEventListener = (ev: LayoutDOMEvent) => void; export declare const VIEW_NAME_PREFIX: "internal-generated-view-"; export declare const getViewNameFromTabId: (tabId: string) => string; export declare const getFirstActiveViewFromLayout: (identity: OpenFin.LayoutIdentity) => OpenFin.Identity | undefined; /** * Recursively clones a layout object, calling a passed callback on each `componentState` in the tree. * @param node Either the layout object itself, or one of the items in its tree. * @param callback Callback to be called on each component's `componentState` * @returns A mapped copy of the layout */ export declare const mapLayoutViewComponents: (node: any, callback: (arg0: any) => any) => any; /** * Recursively clones a layout object, calling a passed async callback on each `componentState` in the tree. * @param node Either the layout object itself, or one of the items in its tree. * @param callback Async callback to be called on each component's `componentState` * @returns A Promise resolving to a mapped copy of the layout */ export declare const mapLayoutViewComponentsAsync: (node: any, callback: (arg0: any) => Promise) => Promise; /** * Copies the componentState and generates a name if it's not there * @param componentState view's componentState in the layout object, corresponds to View options * @returns A copy of the componentState with name filled in */ export declare const generateViewNameIfNotExists: (componentState: T) => Omit & { name: string; }; export declare const generateViewNameAndIdentifierNameIfNotExists: (componentState: T) => T & { name?: string; }; /** * Deep clones a layout and converts view options (add names if necessary, apply defaults). * @param layout The Layout to be cloned * @returns A Promise resolving to a copy of the layout with view options converted */ export declare const cloneLayoutAndConvertViewOptions: (layout: PageLayout, initViewOptions?: Partial) => Promise; export declare const cloneViewComponentWithoutName: (componentState: any) => any; /** * Deep clones a layout and removes generated view names. * @param layout The Layout to be cloned * @returns A copy of the layout with generated names removed */ export declare const cloneLayoutAndRemoveGeneratedNames: (layout: PageLayout) => any; export declare const mapContentComponentState: (content: OpenFin.LayoutContent) => OpenFin.LayoutComponent["componentState"][]; export declare const getLayoutWithSingleView: (title: string, url: string, winIdentity?: OpenFin.Identity) => Promise; export declare const layoutNameInitializedMap: Map; export declare const isLayoutTabActive: (tabSelector: string) => boolean; export declare const containerId = "layout_container"; export declare const viewTabslistSelectors = ".lm_tabs"; export declare const addLayoutEventListener: (event: LayoutDOMEventType, listener: LayoutDOMEventListener) => void; export declare const removeLayoutEventListener: (event: LayoutDOMEventType, listener: LayoutDOMEventListener) => void; /** * Cleans up ResizeObservers and event listeners for a specific layout. * Should be called when a layout is destroyed to prevent memory leaks. * @param layoutName The layoutName/layoutContainerKey to cleanup */ export declare const cleanupLayoutObservers: (layoutName: string) => void; /** * Initialize the layout for the current OF window. */ export declare const initLayoutListeners: () => Promise; /** * Returns true when a page's in-page layout should be locked. * This applies for user-locked pages (`isLocked`) and platform-pinned pages (`pinned === 'platform'`). */ export declare const isPageLayoutLocked: (page: { isLocked?: boolean; pinned?: PagePinnedState; }) => boolean; /** * Deep clones a layout and changes its settings to make it "locked". * @param layout The Layout to be locked * @returns A restricted copy of the layout */ export declare const getLockedPageLayout: (layout: PageLayout) => any; /** * Accepts a locked layout and an unlocked layout as a reference. * Takes the layout settings of the reference layout and merges them into the locked layout, thereby unlocking it. * @param lockedLayout The Layout to unlock * @param referenceUnlockedLayout The Layout to serve as a reference of an unlocked layout * @returns An unlocked version of the target layout */ export declare const getUnlockedLayout: (lockedLayout: PageLayout, referenceUnlockedLayout: PageLayout) => any; /** * Replaces the layout of the window with the provided layout and adjusts it based on provided page's options * @param layout Layout with which to replace current window's layout * @param page Page object * @returns */ export declare const replaceLayout: (layout: PageLayout, page: AttachedPage) => Promise; export declare const findViewInLayout: (node: any, viewId: OpenFin.Identity) => any[]; /** * Calculates the total number of views in a given layout configuration. * * @param node - The layout configuration to traverse. * @returns The total number of views in the layout configuration. */ export declare const countViews: (node: OpenFin.LayoutContent) => number; /** * Returns the sole view component when a page layout contains exactly one view. * Used to decide whether a page-tab drag should emit a single-view merge payload. * * Importantly this counts views recursively across the layout tree, not just * top-level sections — a one-section/tab-strip supertab with multiple views * must not be treated as a single-view page. * * Also requires a non-empty `componentState.name`. Core types mark * `componentState` / `name` as optional, and a merge payload without a name * is invalid — treat those layouts as non-mergeable page drags instead. */ export declare const getSingleViewComponent: (content: OpenFin.LayoutContent | undefined) => OpenFin.LayoutComponent | null; export declare const getLayoutConfig: (layoutContainerKey: string) => Promise; export declare const findPageForView: (viewName: string, browserWindowIdentity?: WindowIdentity) => Promise; /** * Waits for a specific view to receive focus on the current window, resolving * either when the matching `view-focused` event fires or after a timeout (default 150ms). * Useful for ensuring focus is stable before opening popups that would auto-close on focus shift. */ export declare const waitForViewFocus: (viewName: string, timeoutMs?: number) => Promise; /** * Only show the view tab icon when not on the landing page */ export declare const hideFavIconForLandingPage: (view: OpenFin.View, tab: HTMLElement) => Promise;