declare module "ui/core/view-base" { import { Observable, EventData } from "data/observable"; import { Property, PropertyOptions, CoercibleProperty, CoerciblePropertyOptions, InheritedProperty, CssProperty, CssPropertyOptions, InheritedCssProperty, ShorthandProperty, ShorthandPropertyOptions } from "ui/core/properties"; import { Binding, BindingOptions, Bindable } from "ui/core/bindable"; import { Style } from "ui/styling/style"; import { isIOS, isAndroid } from "platform"; import { fromString as gestureFromString } from "ui/gestures"; import { KeyframeAnimation } from "ui/animation/keyframe-animation"; import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace"; export { Observable, EventData, KeyframeAnimation, Binding, BindingOptions, Bindable, Style, isIOS, isAndroid, gestureFromString, traceEnabled, traceWrite, traceCategories, traceNotifyEvent, isCategorySet }; export * from "ui/core/properties"; /** * Gets an ancestor from a given type. * @param view - Starting view (child view). * @param criterion - The type of ancestor view we are looking for. Could be a string containing a class name or an actual type. * Returns an instance of a view (if found), otherwise undefined. */ export function getAncestor(view: ViewBase, criterion: string | Function): ViewBase; export function isEventOrGesture(name: string, view: ViewBase): boolean; /** * Gets a child view by id. * @param view - The parent (container) view of the view to look for. * @param id - The id of the view to look for. * Returns an instance of a view (if found), otherwise undefined. */ export function getViewById(view: ViewBase, id: string): ViewBase; export class ViewBase extends Observable { /** * String value used when hooking to loaded event. */ public static loadedEvent: string; /** * String value used when hooking to unloaded event. */ public static unloadedEvent: string; public ios: any; public android: any; public nativeView: any; public bindingContext: any; /** * Gets the parent view. This property is read-only. */ public readonly parent: ViewBase; /** * Gets or sets the id for this view. */ public id: string; /** * Returns the child view with the specified id. */ public getViewById(id: string): T; /** * Gets or sets the CSS class name for this view. */ public className: string; /** * Gets owner page. This is a read-only property. */ public readonly page: ViewBase; /** * Gets the style object associated to this view. */ public readonly style: Style; /** * Returns true if visibility is set to 'collapse'. * Readonly property */ public isCollapsed: boolean; public readonly isLoaded: boolean; public onLoaded(): void; public onUnloaded(): void; public bind(options: BindingOptions, source: Object): void; public unbind(property: string): void; public requestLayout(): void; public eachChild(callback: (child: ViewBase) => boolean): void; public _addView(view: ViewBase, atIndex?: number): void; public _removeView(view: ViewBase): void; public _parentChanged(oldParent: ViewBase): void; _childrenCount: number; _cssState: any /* "ui/styling/style-scope" */; _setCssState(next: any /* "ui/styling/style-scope" */); _registerAnimation(animation: KeyframeAnimation); _unregisterAnimation(animation: KeyframeAnimation); _cancelAllAnimations(); /** * @protected * @unstable * A widget can call this method to add a matching css pseudo class. */ public addPseudoClass(name: string): void; /** * @protected * @unstable * A widget can call this method to discard mathing css pseudo class. */ public deletePseudoClass(name: string): void; } export const idProperty: Property; export const classNameProperty: Property; export const bindingContextProperty: InheritedProperty; } declare module "ui/core/properties" { import { ViewBase } from "ui/core/view-base"; import { Style } from "ui/styling/style"; import { unsetValue } from "ui/core/dependency-observable"; export { unsetValue }; export interface PropertyOptions { readonly name: string, readonly defaultValue?: U, readonly affectsLayout?: boolean, readonly equalityComparer?: (x: U, y: U) => boolean, readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void, readonly valueConverter?: (value: string) => U } export interface CoerciblePropertyOptions extends PropertyOptions { readonly coerceValue: (t: T, u: U) => U; } export interface CssPropertyOptions extends PropertyOptions { readonly cssName: string; } export class Property implements TypedPropertyDescriptor { constructor(options: PropertyOptions); public readonly native: symbol; public readonly defaultValue: U; public register(cls: { prototype: T }): void; } export class CoercibleProperty implements TypedPropertyDescriptor { constructor(options: CoerciblePropertyOptions); public readonly native: symbol; public readonly defaultValue: U; public readonly coerce: (target: T) => void; public register(cls: { prototype: T }): void; } export class InheritedProperty extends Property { constructor(options: PropertyOptions); } export class CssProperty { constructor(options: CssPropertyOptions); public readonly native: symbol; public readonly name: string; public readonly cssName: string; public readonly defaultValue: U; public register(cls: { prototype: T }): void; } export class InheritedCssProperty extends CssProperty { constructor(options: CssPropertyOptions); } export interface ShorthandPropertyOptions { readonly name: string, readonly cssName: string; readonly converter: (value: string) => [CssProperty, any][], readonly getter: (this: Style) => string } export class ShorthandProperty { constructor(options: ShorthandPropertyOptions); public readonly native: symbol; public readonly name: string; public readonly cssName: string; public register(cls: { prototype: T }): void; } export function applyNativeSetters(view: ViewBase): void; export function resetStyleProperties(style: Style): void; export function makeValidator(...values: T[]): (value: any) => value is T; export function makeParser(isValid: (value: any) => boolean, def: T): (value: any) => T; }