UNPKG

@nativescript/core

Version:

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

283 lines (282 loc) • 10.2 kB
import type { EventData } from '../data/observable'; import { Observable } from '../data/observable'; import type { View } from '../ui/core/view'; import type { Page } from '../ui/page'; export declare const accessibilityBlurEvent = "accessibilityBlur"; export declare const accessibilityFocusEvent = "accessibilityFocus"; export declare const accessibilityFocusChangedEvent = "accessibilityFocusChanged"; export declare const accessibilityPerformEscapeEvent = "accessibilityPerformEscape"; /** * Send notification when accessibility focus state changes. * If either receivedFocus or lostFocus is true, 'accessibilityFocusChanged' is send with value true if element received focus * If receivedFocus, 'accessibilityFocus' is send * if lostFocus, 'accessibilityBlur' is send * * @param {View} view * @param {boolean} receivedFocus * @param {boolean} lostFocus */ export declare function notifyAccessibilityFocusState(view: View, receivedFocus: boolean, lostFocus: boolean): void; export declare function getLastFocusedViewOnPage(page: Page): View | null; export declare class SharedA11YObservable extends Observable { accessibilityServiceEnabled?: boolean; } export declare const AccessibilityServiceEnabledPropName = "accessibilityServiceEnabled"; export declare class CommonA11YServiceEnabledObservable extends SharedA11YObservable { constructor(sharedA11YObservable: SharedA11YObservable); } export declare function isA11yEnabled(): boolean; export declare function setA11yEnabled(value: boolean): void; export declare function enforceArray(val: string | string[]): string[]; export declare const VALID_FONT_SCALES: number[]; export declare function getClosestValidFontScale(fontScale: number): number; export declare enum FontScaleCategory { ExtraSmall = "extra-small", Medium = "medium", ExtraLarge = "extra-large" } export declare const fontScaleExtraSmallCategoryClass = "a11y-fontscale-xs"; export declare const fontScaleMediumCategoryClass = "a11y-fontscale-m"; export declare const fontScaleExtraLargeCategoryClass = "a11y-fontscale-xl"; export declare const fontScaleCategoryClasses: string[]; export declare const a11yServiceEnabledClass = "a11y-service-enabled"; export declare const a11yServiceDisabledClass = "a11y-service-disabled"; export declare const a11yServiceClasses: string[]; export declare function setFontScale(scale: number): void; export declare function getFontScale(): number; export declare function getFontScaleCategory(): FontScaleCategory; export declare function setInitAccessibilityCssHelper(callback: () => void): void; export declare function readyInitAccessibilityCssHelper(): void; export declare function setInitFontScale(callback: () => void): void; export declare function readyInitFontScale(): void; export declare function setFontScaleCssClasses(value: Map<number, string>): void; export declare function getFontScaleCssClasses(): Map<number, string>; export declare function setCurrentFontScaleClass(value: string): void; export declare function getCurrentFontScaleClass(): string; export declare function setCurrentFontScaleCategory(value: string): void; export declare function getCurrentFontScaleCategory(): string; export declare function setCurrentA11YServiceClass(value: string): void; export declare function getCurrentA11YServiceClass(): string; export declare enum AccessibilityTrait { /** * The element allows direct touch interaction for VoiceOver users. */ AllowsDirectInteraction = "allowsDirectInteraction", /** * The element should cause an automatic page turn when VoiceOver finishes reading the text within it. * Note: Requires custom view with accessibilityScroll(...) */ CausesPageTurn = "pageTurn", /** * The element is not enabled and does not respond to user interaction. */ NotEnabled = "disabled", /** * The element is currently selected. */ Selected = "selected", /** * The element frequently updates its label or value. */ UpdatesFrequently = "frequentUpdates" } export declare enum AccessibilityRole { /** * The element allows continuous adjustment through a range of values. */ Adjustable = "adjustable", /** * The element should be treated as a button. */ Button = "button", /** * The element behaves like a Checkbox */ Checkbox = "checkbox", /** * The element is a header that divides content into sections, such as the title of a navigation bar. */ Header = "header", /** * The element should be treated as an image. */ Image = "image", /** * The element should be treated as a image button. */ ImageButton = "imageButton", /** * The element behaves as a keyboard key. */ KeyboardKey = "keyboardKey", /** * The element should be treated as a link. */ Link = "link", /** * The element has no traits. */ None = "none", /** * The element plays its own sound when activated. */ PlaysSound = "plays", /** * The element behaves like a ProgressBar */ ProgressBar = "progressBar", /** * The element behaves like a RadioButton */ RadioButton = "radioButton", /** * The element should be treated as a search field. */ Search = "search", /** * The element behaves like a SpinButton */ SpinButton = "spinButton", /** * The element starts a media session when it is activated. */ StartsMediaSession = "startsMedia", /** * The element should be treated as static text that cannot change. */ StaticText = "text", /** * The element provides summary information when the application starts. */ Summary = "summary", /** * The element behaves like a switch */ Switch = "switch" } export declare enum AccessibilityState { Selected = "selected", Checked = "checked", Unchecked = "unchecked", Disabled = "disabled" } export declare enum AccessibilityLiveRegion { None = "none", Polite = "polite", Assertive = "assertive" } export declare enum IOSPostAccessibilityNotificationType { Announcement = "announcement", Screen = "screen", Layout = "layout" } export declare enum AndroidAccessibilityEvent { /** * Invalid selection/focus position. */ INVALID_POSITION = "invalid_position", /** * Maximum length of the text fields. */ MAX_TEXT_LENGTH = "max_text_length", /** * Represents the event of clicking on a android.view.View like android.widget.Button, android.widget.CompoundButton, etc. */ VIEW_CLICKED = "view_clicked", /** * Represents the event of long clicking on a android.view.View like android.widget.Button, android.widget.CompoundButton, etc. */ VIEW_LONG_CLICKED = "view_long_clicked", /** * Represents the event of selecting an item usually in the context of an android.widget.AdapterView. */ VIEW_SELECTED = "view_selected", /** * Represents the event of setting input focus of a android.view.View. */ VIEW_FOCUSED = "view_focused", /** * Represents the event of changing the text of an android.widget.EditText. */ VIEW_TEXT_CHANGED = "view_text_changed", /** * Represents the event of opening a android.widget.PopupWindow, android.view.Menu, android.app.Dialog, etc. */ WINDOW_STATE_CHANGED = "window_state_changed", /** * Represents the event showing a android.app.Notification. */ NOTIFICATION_STATE_CHANGED = "notification_state_changed", /** * Represents the event of a hover enter over a android.view.View. */ VIEW_HOVER_ENTER = "view_hover_enter", /** * Represents the event of a hover exit over a android.view.View. */ VIEW_HOVER_EXIT = "view_hover_exit", /** * Represents the event of starting a touch exploration gesture. */ TOUCH_EXPLORATION_GESTURE_START = "touch_exploration_gesture_start", /** * Represents the event of ending a touch exploration gesture. */ TOUCH_EXPLORATION_GESTURE_END = "touch_exploration_gesture_end", /** * Represents the event of changing the content of a window and more specifically the sub-tree rooted at the event's source. */ WINDOW_CONTENT_CHANGED = "window_content_changed", /** * Represents the event of scrolling a view. */ VIEW_SCROLLED = "view_scrolled", /** * Represents the event of changing the selection in an android.widget.EditText. */ VIEW_TEXT_SELECTION_CHANGED = "view_text_selection_changed", /** * Represents the event of an application making an announcement. */ ANNOUNCEMENT = "announcement", /** * Represents the event of gaining accessibility focus. */ VIEW_ACCESSIBILITY_FOCUSED = "view_accessibility_focused", /** * Represents the event of clearing accessibility focus. */ VIEW_ACCESSIBILITY_FOCUS_CLEARED = "view_accessibility_focus_cleared", /** * Represents the event of traversing the text of a view at a given movement granularity. */ VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = "view_text_traversed_at_movement_granularity", /** * Represents the event of beginning gesture detection. */ GESTURE_DETECTION_START = "gesture_detection_start", /** * Represents the event of ending gesture detection. */ GESTURE_DETECTION_END = "gesture_detection_end", /** * Represents the event of the user starting to touch the screen. */ TOUCH_INTERACTION_START = "touch_interaction_start", /** * Represents the event of the user ending to touch the screen. */ TOUCH_INTERACTION_END = "touch_interaction_end", /** * Mask for AccessibilityEvent all types. */ ALL_MASK = "all" } export interface AccessibilityEventPerformEscape extends EventData { cancel?: boolean; } export interface AccessibilityEventOptions { androidAccessibilityEvent?: AndroidAccessibilityEvent; iosNotificationType?: IOSPostAccessibilityNotificationType; message?: string; }