UNPKG

@nativescript/core

Version:

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

145 lines (144 loc) • 6.83 kB
import { ViewBase } from '../view-base'; import { Style } from '../../styling/style'; import { PropertyOptions, CoerciblePropertyOptions, CssPropertyOptions, ShorthandPropertyOptions, CssAnimationPropertyOptions } from './property-shared'; export { unsetValue } from './property-shared'; /** * Whether the style still carries what the cascade last wrote for the property. * A `CssProperty` keeps one value: a local value both suppresses the css write and * takes the slot, so clearing it leaves the property at its default with the css * value gone. The cascade has to write it again rather than skip it as unchanged. */ export declare function _isCssValueStillApplied(style: unknown, cssLocalName: string, value: unknown): boolean; export declare function _printUnregisteredProperties(): void; export declare function _getProperties(): Property<any, any>[]; export declare function _getStyleProperties(): CssProperty<any, any>[]; /** * Placeholder cascaded for each longhand of a shorthand that cannot be split while * parsing - a single `var()` may substitute several longhands at once, so the * shorthand is only parsed once its expression is resolved per view. * @see https://drafts.csswg.org/css-variables/#variables-in-shorthands */ export declare class CssPendingSubstitution { readonly shorthand: string; readonly value: string; constructor(shorthand: string, value: string); toString(): string; } export declare function _isCssPendingSubstitution(value: unknown): value is CssPendingSubstitution; /** * One pending-substitution value per longhand of the shorthand, or `undefined` * when the longhands cannot be determined. */ export declare function _pendingCssShorthandSubstitution(cssName: string, value: string): [string, CssPendingSubstitution][] | undefined; /** * Expand a shorthand declaration into its longhand declarations, or `undefined` * when the property is not a shorthand, the value still has to be evaluated per * view (`var()`/`calc()`), or it does not parse. */ export declare function _expandCssShorthand(cssName: string, value: string): [string, any][] | undefined; export declare function isCssVariable(property: string): boolean; export declare function isCssCalcExpression(value: string): boolean; export declare function isCssVariableExpression(value: string): boolean; export declare function _evaluateCssVariableExpression(view: ViewBase, cssName: string, value: string): string; export declare function _evaluateCssCalcExpression(value: string): string; export declare class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<U>, Property<T, U> { private registered; readonly name: string; readonly key: symbol; readonly getDefault: symbol; readonly setNative: symbol; readonly defaultValueKey: symbol; readonly defaultValue: U; readonly nativeValueChange: (owner: T, value: U) => void; isStyleProperty: boolean; get: () => U; set: (value: U) => void; overrideHandlers: (options: PropertyOptions<T, U>) => void; enumerable: boolean; configurable: boolean; constructor(options: PropertyOptions<T, U>); register(cls: { prototype: T; }): void; isSet(instance: T): boolean; } export declare class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> implements CoercibleProperty<T, U> { readonly coerce: (target: T) => void; constructor(options: CoerciblePropertyOptions<T, U>); } export declare class InheritedProperty<T extends ViewBase, U> extends Property<T, U> implements InheritedProperty<T, U> { readonly sourceKey: symbol; readonly setInheritedValue: (value: U) => void; constructor(options: PropertyOptions<T, U>); } export declare class CssProperty<T extends Style, U> { private registered; readonly name: string; readonly cssName: string; readonly cssLocalName: string; protected readonly cssValueDescriptor: PropertyDescriptor; protected readonly localValueDescriptor: PropertyDescriptor; isStyleProperty: boolean; readonly key: symbol; readonly getDefault: symbol; readonly setNative: symbol; readonly sourceKey: symbol; readonly defaultValueKey: symbol; readonly defaultValue: U; overrideHandlers: (options: CssPropertyOptions<T, U>) => void; constructor(options: CssPropertyOptions<T, U>); register(cls: { prototype: T; }): void; isSet(instance: T): boolean; } export declare class CssAnimationProperty<T extends Style, U> implements CssAnimationProperty<T, U> { readonly name: string; readonly cssName: string; readonly cssLocalName: string; readonly getDefault: symbol; readonly setNative: symbol; readonly register: (cls: { prototype: any; }) => void; readonly keyframe: string; readonly defaultValueKey: symbol; readonly key: symbol; private readonly source; readonly defaultValue: U; isStyleProperty: boolean; private static properties; _valueConverter?: (value: string) => any; constructor(options: CssAnimationPropertyOptions<T, U>); _initDefaultNativeValue(target: T): void; static _getByCssName(name: string): CssAnimationProperty<any, any>; static _getPropertyNames(): string[]; isSet(instance: T): boolean; } export declare class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> implements InheritedCssProperty<T, U> { setInheritedValue: (value: U) => void; constructor(options: CssPropertyOptions<T, U>); } export declare class ShorthandProperty<T extends Style, P> implements ShorthandProperty<T, P> { private registered; readonly key: symbol; readonly name: string; readonly cssName: string; readonly cssLocalName: string; protected readonly cssValueDescriptor: PropertyDescriptor; protected readonly localValueDescriptor: PropertyDescriptor; readonly sourceKey: symbol; constructor(options: ShorthandPropertyOptions<P>); register(cls: typeof Style): void; } export { makeValidator, makeParser } from '../../../core-types/validators'; export declare const initNativeView: any; export declare function applyPendingNativeSetters(view: ViewBase): void; export declare function applyAllNativeSetters(view: ViewBase): void; export declare function resetNativeView(view: ViewBase): void; export declare function clearInheritedProperties(view: ViewBase): void; export declare function resetCSSProperties(style: Style): void; export declare function propagateInheritableProperties(view: ViewBase, child: ViewBase): void; export declare function propagateInheritableCssProperties(parentStyle: Style, childStyle: Style): void; export declare function getSetProperties(view: ViewBase): [string, any][]; export declare function getComputedCssValues(view: ViewBase): [string, any][];