[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 { ElementRef, NgZone } from '@angular/core';
|
---|
| 9 | import { Platform } from '@angular/cdk/platform';
|
---|
| 10 | import { RippleRef, RippleConfig } from './ripple-ref';
|
---|
| 11 | /**
|
---|
| 12 | * Interface that describes the target for launching ripples.
|
---|
| 13 | * It defines the ripple configuration and disabled state for interaction ripples.
|
---|
| 14 | * @docs-private
|
---|
| 15 | */
|
---|
| 16 | export interface RippleTarget {
|
---|
| 17 | /** Configuration for ripples that are launched on pointer down. */
|
---|
| 18 | rippleConfig: RippleConfig;
|
---|
| 19 | /** Whether ripples on pointer down should be disabled. */
|
---|
| 20 | rippleDisabled: boolean;
|
---|
| 21 | }
|
---|
| 22 | /**
|
---|
| 23 | * Default ripple animation configuration for ripples without an explicit
|
---|
| 24 | * animation config specified.
|
---|
| 25 | */
|
---|
| 26 | export declare const defaultRippleAnimationConfig: {
|
---|
| 27 | enterDuration: number;
|
---|
| 28 | exitDuration: number;
|
---|
| 29 | };
|
---|
| 30 | /**
|
---|
| 31 | * Helper service that performs DOM manipulations. Not intended to be used outside this module.
|
---|
| 32 | * The constructor takes a reference to the ripple directive's host element and a map of DOM
|
---|
| 33 | * event handlers to be installed on the element that triggers ripple animations.
|
---|
| 34 | * This will eventually become a custom renderer once Angular support exists.
|
---|
| 35 | * @docs-private
|
---|
| 36 | */
|
---|
| 37 | export declare class RippleRenderer implements EventListenerObject {
|
---|
| 38 | private _target;
|
---|
| 39 | private _ngZone;
|
---|
| 40 | /** Element where the ripples are being added to. */
|
---|
| 41 | private _containerElement;
|
---|
| 42 | /** Element which triggers the ripple elements on mouse events. */
|
---|
| 43 | private _triggerElement;
|
---|
| 44 | /** Whether the pointer is currently down or not. */
|
---|
| 45 | private _isPointerDown;
|
---|
| 46 | /** Set of currently active ripple references. */
|
---|
| 47 | private _activeRipples;
|
---|
| 48 | /** Latest non-persistent ripple that was triggered. */
|
---|
| 49 | private _mostRecentTransientRipple;
|
---|
| 50 | /** Time in milliseconds when the last touchstart event happened. */
|
---|
| 51 | private _lastTouchStartEvent;
|
---|
| 52 | /** Whether pointer-up event listeners have been registered. */
|
---|
| 53 | private _pointerUpEventsRegistered;
|
---|
| 54 | /**
|
---|
| 55 | * Cached dimensions of the ripple container. Set when the first
|
---|
| 56 | * ripple is shown and cleared once no more ripples are visible.
|
---|
| 57 | */
|
---|
| 58 | private _containerRect;
|
---|
| 59 | constructor(_target: RippleTarget, _ngZone: NgZone, elementOrElementRef: HTMLElement | ElementRef<HTMLElement>, platform: Platform);
|
---|
| 60 | /**
|
---|
| 61 | * Fades in a ripple at the given coordinates.
|
---|
| 62 | * @param x Coordinate within the element, along the X axis at which to start the ripple.
|
---|
| 63 | * @param y Coordinate within the element, along the Y axis at which to start the ripple.
|
---|
| 64 | * @param config Extra ripple options.
|
---|
| 65 | */
|
---|
| 66 | fadeInRipple(x: number, y: number, config?: RippleConfig): RippleRef;
|
---|
| 67 | /** Fades out a ripple reference. */
|
---|
| 68 | fadeOutRipple(rippleRef: RippleRef): void;
|
---|
| 69 | /** Fades out all currently active ripples. */
|
---|
| 70 | fadeOutAll(): void;
|
---|
| 71 | /** Fades out all currently active non-persistent ripples. */
|
---|
| 72 | fadeOutAllNonPersistent(): void;
|
---|
| 73 | /** Sets up the trigger event listeners */
|
---|
| 74 | setupTriggerEvents(elementOrElementRef: HTMLElement | ElementRef<HTMLElement>): void;
|
---|
| 75 | /**
|
---|
| 76 | * Handles all registered events.
|
---|
| 77 | * @docs-private
|
---|
| 78 | */
|
---|
| 79 | handleEvent(event: Event): void;
|
---|
| 80 | /** Function being called whenever the trigger is being pressed using mouse. */
|
---|
| 81 | private _onMousedown;
|
---|
| 82 | /** Function being called whenever the trigger is being pressed using touch. */
|
---|
| 83 | private _onTouchStart;
|
---|
| 84 | /** Function being called whenever the trigger is being released. */
|
---|
| 85 | private _onPointerUp;
|
---|
| 86 | /** Runs a timeout outside of the Angular zone to avoid triggering the change detection. */
|
---|
| 87 | private _runTimeoutOutsideZone;
|
---|
| 88 | /** Registers event listeners for a given list of events. */
|
---|
| 89 | private _registerEvents;
|
---|
| 90 | /** Removes previously registered event listeners from the trigger element. */
|
---|
| 91 | _removeTriggerEvents(): void;
|
---|
| 92 | }
|
---|