import { Message } from '@phosphor/messaging'; import { Widget } from '@phosphor/widgets'; import { DisposableCollection, Disposable } from './disposable'; import { Event, Emitter } from './event'; import PerfectScrollbar from 'perfect-scrollbar'; export declare type MaybePromise = T | PromiseLike; export declare const DEFAULT_SCROLL_OPTIONS: PerfectScrollbar.Options; /** * At a number of places in the code, we have effectively reimplemented Phosphor's Widget.attach and Widget.detach, * but omitted the checks that Phosphor expects to be performed for those operations. That is a bad idea, because it * means that we are telling widgets that they are attached or detached when not all the conditions that should apply * do apply. We should explicitly mark those locations so that we know where we should go fix them later. */ export declare namespace UnsafeWidgetUtilities { /** * Ordinarily, the following checks should be performed before detaching a widget: * It should not be the child of another widget * It should be attached and it should be a child of document.body */ function detach(widget: Widget): void; /** * @param ref The child of the host element to insert the widget before. * Ordinarily the following checks should be performed: * The widget should have no parent * The widget should not be attached, and its node should not be a child of document.body * The host should be a child of document.body * We often violate the last condition. */ function attach(widget: Widget, host: HTMLElement, ref?: HTMLElement | null): void; } export declare type EventListener = (this: HTMLElement, event: HTMLElementEventMap[K]) => any; export interface EventListenerObject { handleEvent(evt: HTMLElementEventMap[K]): void; } export declare namespace EventListenerObject { function is(listener: any | undefined): listener is EventListenerObject; } export declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; export declare function addEventListener(element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject, useCapture?: boolean): Disposable; export declare class BaseWidget extends Widget { protected readonly onScrollYReachEndEmitter: Emitter; readonly onScrollYReachEnd: Event; protected readonly onScrollUpEmitter: Emitter; readonly onScrollUp: Event; protected readonly onDidChangeVisibilityEmitter: Emitter; readonly onDidChangeVisibility: Event; protected readonly onDidDisposeEmitter: Emitter; readonly onDidDispose: Event; protected readonly toDispose: DisposableCollection; protected readonly toDisposeOnDetach: DisposableCollection; protected scrollBar: PerfectScrollbar; protected scrollOptions: PerfectScrollbar.Options; constructor(); setScrollOptions(options: PerfectScrollbar.Options): void; private resizeHandler; private debouncedResizeHandler; dispose(): void; protected onCloseRequest(msg: Message): void; protected onBeforeAttach(msg: Message): void; protected onAfterDetach(msg: Message): void; protected onBeforeDetach(msg: Message): void; protected onAfterAttach(msg: Message): void; protected getScrollContainer(): MaybePromise; protected disableScrollBarFocus(scrollContainer: HTMLElement): void; protected onUpdateRequest(msg: Message): void; protected onResize(msg: Widget.ResizeMessage): void; protected addUpdateListener(element: HTMLElement, type: K, useCapture?: boolean): void; protected addEventListener(element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; setFlag(flag: Widget.Flag): void; clearFlag(flag: Widget.Flag): void; updateScrollBar(): void; }