UNPKG

6.55 kBTypeScriptView Raw
1import { ViewBase } from '../view-base';
2import { Style } from '../../styling/style';
3/**
4 * Value specifying that Property should be set to its initial value.
5 */
6export declare const unsetValue: any;
7export interface PropertyOptions<T, U> {
8 readonly name: string;
9 readonly defaultValue?: U;
10 readonly affectsLayout?: boolean;
11 readonly equalityComparer?: (x: U, y: U) => boolean;
12 readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void;
13 readonly valueConverter?: (value: string) => U;
14}
15export interface CoerciblePropertyOptions<T, U> extends PropertyOptions<T, U> {
16 readonly coerceValue: (t: T, u: U) => U;
17}
18export interface CssPropertyOptions<T extends Style, U> extends PropertyOptions<T, U> {
19 readonly cssName: string;
20}
21export interface ShorthandPropertyOptions<P> {
22 readonly name: string;
23 readonly cssName: string;
24 readonly converter: (value: string | P) => [CssProperty<any, any> | CssAnimationProperty<any, any>, any][];
25 readonly getter: (this: Style) => string | P;
26}
27export interface CssAnimationPropertyOptions<T, U> {
28 readonly name: string;
29 readonly cssName?: string;
30 readonly defaultValue?: U;
31 readonly equalityComparer?: (x: U, y: U) => boolean;
32 readonly valueChanged?: (target: T, oldValue: U, newValue: U) => void;
33 readonly valueConverter?: (value: string) => U;
34}
35export declare function _printUnregisteredProperties(): void;
36export declare function _getProperties(): Property<any, any>[];
37export declare function _getStyleProperties(): CssProperty<any, any>[];
38export declare function isCssVariable(property: string): boolean;
39export declare function isCssCalcExpression(value: string): boolean;
40export declare function isCssVariableExpression(value: string): boolean;
41export declare function _evaluateCssVariableExpression(view: ViewBase, cssName: string, value: string): string;
42export declare function _evaluateCssCalcExpression(value: string): any;
43export declare class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<U>, Property<T, U> {
44 private registered;
45 readonly name: string;
46 readonly key: symbol;
47 readonly getDefault: symbol;
48 readonly setNative: symbol;
49 readonly defaultValueKey: symbol;
50 readonly defaultValue: U;
51 readonly nativeValueChange: (owner: T, value: U) => void;
52 isStyleProperty: boolean;
53 get: () => U;
54 set: (value: U) => void;
55 overrideHandlers: (options: PropertyOptions<T, U>) => void;
56 enumerable: boolean;
57 configurable: boolean;
58 constructor(options: PropertyOptions<T, U>);
59 register(cls: {
60 prototype: T;
61 }): void;
62 isSet(instance: T): boolean;
63}
64export declare class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> implements CoercibleProperty<T, U> {
65 readonly coerce: (target: T) => void;
66 constructor(options: CoerciblePropertyOptions<T, U>);
67}
68export declare class InheritedProperty<T extends ViewBase, U> extends Property<T, U> implements InheritedProperty<T, U> {
69 readonly sourceKey: symbol;
70 readonly setInheritedValue: (value: U) => void;
71 constructor(options: PropertyOptions<T, U>);
72}
73export declare class CssProperty<T extends Style, U> implements CssProperty<T, U> {
74 private registered;
75 readonly name: string;
76 readonly cssName: string;
77 readonly cssLocalName: string;
78 protected readonly cssValueDescriptor: PropertyDescriptor;
79 protected readonly localValueDescriptor: PropertyDescriptor;
80 isStyleProperty: boolean;
81 readonly key: symbol;
82 readonly getDefault: symbol;
83 readonly setNative: symbol;
84 readonly sourceKey: symbol;
85 readonly defaultValueKey: symbol;
86 readonly defaultValue: U;
87 overrideHandlers: (options: CssPropertyOptions<T, U>) => void;
88 constructor(options: CssPropertyOptions<T, U>);
89 register(cls: {
90 prototype: T;
91 }): void;
92 isSet(instance: T): boolean;
93}
94export declare class CssAnimationProperty<T extends Style, U> implements CssAnimationProperty<T, U> {
95 readonly name: string;
96 readonly cssName: string;
97 readonly cssLocalName: string;
98 readonly getDefault: symbol;
99 readonly setNative: symbol;
100 readonly register: (cls: {
101 prototype: any;
102 }) => void;
103 readonly keyframe: string;
104 readonly defaultValueKey: symbol;
105 readonly key: symbol;
106 private readonly source;
107 readonly defaultValue: U;
108 isStyleProperty: boolean;
109 private static properties;
110 _valueConverter?: (value: string) => any;
111 constructor(options: CssAnimationPropertyOptions<T, U>);
112 _initDefaultNativeValue(target: T): void;
113 static _getByCssName(name: string): CssAnimationProperty<any, any>;
114 static _getPropertyNames(): string[];
115 isSet(instance: T): boolean;
116}
117export declare class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> implements InheritedCssProperty<T, U> {
118 setInheritedValue: (value: U) => void;
119 overrideHandlers: (options: CssPropertyOptions<T, U>) => void;
120 constructor(options: CssPropertyOptions<T, U>);
121}
122export declare class ShorthandProperty<T extends Style, P> implements ShorthandProperty<T, P> {
123 private registered;
124 readonly key: symbol;
125 readonly name: string;
126 readonly cssName: string;
127 readonly cssLocalName: string;
128 protected readonly cssValueDescriptor: PropertyDescriptor;
129 protected readonly localValueDescriptor: PropertyDescriptor;
130 protected readonly propertyBagDescriptor: PropertyDescriptor;
131 readonly sourceKey: symbol;
132 constructor(options: ShorthandPropertyOptions<P>);
133 register(cls: typeof Style): void;
134}
135export declare const initNativeView: any;
136export declare function applyPendingNativeSetters(view: ViewBase): void;
137export declare function applyAllNativeSetters(view: ViewBase): void;
138export declare function resetNativeView(view: ViewBase): void;
139export declare function clearInheritedProperties(view: ViewBase): void;
140export declare function resetCSSProperties(style: Style): void;
141export declare function propagateInheritableProperties(view: ViewBase, child: ViewBase): void;
142export declare function propagateInheritableCssProperties(parentStyle: Style, childStyle: Style): void;
143export declare function makeValidator<T>(...values: T[]): (value: any) => value is T;
144export declare function makeParser<T>(isValid: (value: any) => boolean, allowNumbers?: boolean): (value: any) => T;
145export declare function getSetProperties(view: ViewBase): [string, any][];
146export declare function getComputedCssValues(view: ViewBase): [string, any][];