source: trip-planner-front/node_modules/@angular/cdk/a11y/input-modality/input-modality-detector.d.ts.__ivy_ngcc_bak@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.6 KB
Line 
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 */
8import { InjectionToken, OnDestroy, NgZone } from '@angular/core';
9import { Platform } from '@angular/cdk/platform';
10import { Observable } from 'rxjs';
11/**
12 * The input modalities detected by this service. Null is used if the input modality is unknown.
13 */
14export declare type InputModality = 'keyboard' | 'mouse' | 'touch' | null;
15/** Options to configure the behavior of the InputModalityDetector. */
16export interface InputModalityDetectorOptions {
17 /** Keys to ignore when detecting keyboard input modality. */
18 ignoreKeys?: number[];
19}
20/**
21 * Injectable options for the InputModalityDetector. These are shallowly merged with the default
22 * options.
23 */
24export declare const INPUT_MODALITY_DETECTOR_OPTIONS: InjectionToken<InputModalityDetectorOptions>;
25/**
26 * Default options for the InputModalityDetector.
27 *
28 * Modifier keys are ignored by default (i.e. when pressed won't cause the service to detect
29 * keyboard input modality) for two reasons:
30 *
31 * 1. Modifier keys are commonly used with mouse to perform actions such as 'right click' or 'open
32 * in new tab', and are thus less representative of actual keyboard interaction.
33 * 2. VoiceOver triggers some keyboard events when linearly navigating with Control + Option (but
34 * confusingly not with Caps Lock). Thus, to have parity with other screen readers, we ignore
35 * these keys so as to not update the input modality.
36 *
37 * Note that we do not by default ignore the right Meta key on Safari because it has the same key
38 * code as the ContextMenu key on other browsers. When we switch to using event.key, we can
39 * distinguish between the two.
40 */
41export declare const INPUT_MODALITY_DETECTOR_DEFAULT_OPTIONS: InputModalityDetectorOptions;
42/**
43 * The amount of time needed to pass after a touchstart event in order for a subsequent mousedown
44 * event to be attributed as mouse and not touch.
45 *
46 * This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found
47 * that a value of around 650ms seems appropriate.
48 */
49export declare const TOUCH_BUFFER_MS = 650;
50/**
51 * Service that detects the user's input modality.
52 *
53 * This service does not update the input modality when a user navigates with a screen reader
54 * (e.g. linear navigation with VoiceOver, object navigation / browse mode with NVDA, virtual PC
55 * cursor mode with JAWS). This is in part due to technical limitations (i.e. keyboard events do not
56 * fire as expected in these modes) but is also arguably the correct behavior. Navigating with a
57 * screen reader is akin to visually scanning a page, and should not be interpreted as actual user
58 * input interaction.
59 *
60 * When a user is not navigating but *interacting* with a screen reader, this service attempts to
61 * update the input modality to keyboard, but in general this service's behavior is largely
62 * undefined.
63 */
64export declare class InputModalityDetector implements OnDestroy {
65 private readonly _platform;
66 /** Emits whenever an input modality is detected. */
67 readonly modalityDetected: Observable<InputModality>;
68 /** Emits when the input modality changes. */
69 readonly modalityChanged: Observable<InputModality>;
70 /** The most recently detected input modality. */
71 get mostRecentModality(): InputModality;
72 /**
73 * The most recently detected input modality event target. Is null if no input modality has been
74 * detected or if the associated event target is null for some unknown reason.
75 */
76 _mostRecentTarget: HTMLElement | null;
77 /** The underlying BehaviorSubject that emits whenever an input modality is detected. */
78 private readonly _modality;
79 /** Options for this InputModalityDetector. */
80 private readonly _options;
81 /**
82 * The timestamp of the last touch input modality. Used to determine whether mousedown events
83 * should be attributed to mouse or touch.
84 */
85 private _lastTouchMs;
86 /**
87 * Handles keydown events. Must be an arrow function in order to preserve the context when it gets
88 * bound.
89 */
90 private _onKeydown;
91 /**
92 * Handles mousedown events. Must be an arrow function in order to preserve the context when it
93 * gets bound.
94 */
95 private _onMousedown;
96 /**
97 * Handles touchstart events. Must be an arrow function in order to preserve the context when it
98 * gets bound.
99 */
100 private _onTouchstart;
101 constructor(_platform: Platform, ngZone: NgZone, document: Document, options?: InputModalityDetectorOptions);
102 ngOnDestroy(): void;
103}
Note: See TracBrowser for help on using the repository browser.