[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { Platform } from '@angular/cdk/platform';
|
---|
| 9 | import { NgZone, OnDestroy } from '@angular/core';
|
---|
| 10 | import { Observable } from 'rxjs';
|
---|
| 11 | /** Time in ms to throttle the resize events by default. */
|
---|
| 12 | export declare const DEFAULT_RESIZE_TIME = 20;
|
---|
| 13 | /** Object that holds the scroll position of the viewport in each direction. */
|
---|
| 14 | export interface ViewportScrollPosition {
|
---|
| 15 | top: number;
|
---|
| 16 | left: number;
|
---|
| 17 | }
|
---|
| 18 | /**
|
---|
| 19 | * Simple utility for getting the bounds of the browser viewport.
|
---|
| 20 | * @docs-private
|
---|
| 21 | */
|
---|
| 22 | export declare class ViewportRuler implements OnDestroy {
|
---|
| 23 | private _platform;
|
---|
| 24 | /** Cached viewport dimensions. */
|
---|
| 25 | private _viewportSize;
|
---|
| 26 | /** Stream of viewport change events. */
|
---|
| 27 | private readonly _change;
|
---|
| 28 | /** Event listener that will be used to handle the viewport change events. */
|
---|
| 29 | private _changeListener;
|
---|
| 30 | /** Used to reference correct document/window */
|
---|
| 31 | protected _document: Document;
|
---|
| 32 | constructor(_platform: Platform, ngZone: NgZone, document: any);
|
---|
| 33 | ngOnDestroy(): void;
|
---|
| 34 | /** Returns the viewport's width and height. */
|
---|
| 35 | getViewportSize(): Readonly<{
|
---|
| 36 | width: number;
|
---|
| 37 | height: number;
|
---|
| 38 | }>;
|
---|
| 39 | /** Gets a ClientRect for the viewport's bounds. */
|
---|
| 40 | getViewportRect(): ClientRect;
|
---|
| 41 | /** Gets the (top, left) scroll position of the viewport. */
|
---|
| 42 | getViewportScrollPosition(): ViewportScrollPosition;
|
---|
| 43 | /**
|
---|
| 44 | * Returns a stream that emits whenever the size of the viewport changes.
|
---|
| 45 | * This stream emits outside of the Angular zone.
|
---|
| 46 | * @param throttleTime Time in milliseconds to throttle the stream.
|
---|
| 47 | */
|
---|
| 48 | change(throttleTime?: number): Observable<Event>;
|
---|
| 49 | /** Use defaultView of injected document if available or fallback to global window reference */
|
---|
| 50 | private _getWindow;
|
---|
| 51 | /** Updates the cached viewport size. */
|
---|
| 52 | private _updateViewportSize;
|
---|
| 53 | }
|
---|