import { MenuActionTypes } from "../actions/menuActions"; import { Reducer } from "react"; /** * Menu state definition. */ export type MenuState = { /** * Contains the id of the currently open menu */ openMenuId: string | null; /** * Contains the id of a menu that has been blurred but not yet closed. See menuReducer for algorithm. */ pendingBlurId: string | null; }; export declare const initialState: MenuState; /** * Algorithm for managing "toggle/blur" race condition * * When a user clicks the for an open window it triggers two events which end up in a race. * A blur event will close the menu. A toggle event will also close the menu. * However, if the blur event arrives *before* the toggle event then the menu would (1) close, (2) toggle back open * * The algorithm to address this race condition is to instead use three events. These are the two races * (1) BLUR_MENU - sets pendingBlurId to the id of the menu * (2) TOGGLE_MENU - closes the menu if it is open (true), and clears pendingBlurId * (3) CLOSE_IF_PENDING - closes the menu only if pendingBlurId is still set, and clears pendingBlurId * * (1) TOGGLE_MENU - closes the menu if it is open (pendingBlurId will not be set) * (2) BLUR_MENU - sets pendingBlurId to the id of the menu * (3) CLOSE_IF_PENDING - menu is already closed. clears pendingBlurId. * * menuHook() is responsible for triggering each of these events. * This algorithm depends on the time delay between BLUR_MENU and CLOSE_IF_PENDING to be long enough that TOGGLE_MENU is assured to trigger. */ export declare const menuReducer: Reducer; //# sourceMappingURL=menuReducer.d.ts.map