UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

56 lines 2.73 kB
import { Disposable, DisposableCollection } from '../common'; import { MarkdownString } from '../common/markdown-rendering/markdown-string'; import { MarkdownRenderer, MarkdownRendererFactory } from './markdown-rendering/markdown-renderer'; import { PreferenceService } from './preferences'; import '../../src/browser/style/hover-service.css'; export type HoverPosition = 'left' | 'right' | 'top' | 'bottom'; export declare namespace HoverPosition { function invertIfNecessary(position: HoverPosition, target: DOMRect, host: DOMRect, totalWidth: number, totalHeight: number): HoverPosition; } export interface HoverRequest { content: string | MarkdownString | HTMLElement; target: HTMLElement; /** * The position where the hover should appear. * Note that the hover service will try to invert the position (i.e. right -> left) * if the specified content does not fit in the window next to the target element */ position: HoverPosition; /** * Additional css classes that should be added to the hover box. * Used to style certain boxes different e.g. for the extended tab preview. */ cssClasses?: string[]; /** * A function to render a visual preview on the hover. * Function that takes the desired width and returns a HTMLElement to be rendered. */ visualPreview?: (width: number) => HTMLElement | undefined; } export declare class HoverService { protected static hostClassName: string; protected static styleSheetId: string; protected readonly preferences: PreferenceService; protected readonly markdownRendererFactory: MarkdownRendererFactory; protected _markdownRenderer: MarkdownRenderer | undefined; protected get markdownRenderer(): MarkdownRenderer; protected _hoverHost: HTMLElement | undefined; protected get hoverHost(): HTMLElement; protected pendingTimeout: Disposable | undefined; protected hoverTarget: HTMLElement | undefined; protected lastHidHover: number; protected readonly disposeOnHide: DisposableCollection; requestHover(request: HoverRequest): void; protected getHoverDelay(): number; protected renderHover(request: HoverRequest): Promise<void>; protected setHostPosition(target: HTMLElement, host: HTMLElement, position: HoverPosition): HoverPosition; protected listenForMouseOut(): void; cancelHover(): void; /** * Listen for any mouse click (mousedown) event and cancel the hover if detected. * This ensures the hover is dismissed when the user clicks anywhere (including on the target or elsewhere). */ protected listenForMouseClick(): void; protected unRenderHover(): void; } //# sourceMappingURL=hover-service.d.ts.map