UNPKG

@nativescript/core

Version:

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

88 lines (87 loc) 3.96 kB
import { ViewBase } from '../core/view-base'; import * as ReworkCSS from '../../css'; import { RuleSet, SelectorCore, SelectorsMatch, ChangeMap, Node } from './css-selector'; import { Keyframes, KeyframeAnimationInfo, KeyframeAnimation } from '../animation/keyframe-animation'; export declare function mergeCssSelectors(): void; export declare function mergeCssKeyframes(): void; export declare function _populateRules(nodes: ReworkCSS.Node[], rulesets: RuleSet[], keyframes: Keyframes[], mediaQueryString?: string): void; export declare function removeTaggedAdditionalCSS(tag: string | number): boolean; export declare function addTaggedAdditionalCSS(cssText: string, tag?: string | number): boolean; export declare const loadAppCSS: any; export declare class CssState { private viewRef; static emptyChangeMap: Readonly<ChangeMap<ViewBase>>; static emptyPropertyBag: Record<string, unknown>; static emptyAnimationArray: ReadonlyArray<KeyframeAnimation>; static emptyMatch: Readonly<SelectorsMatch<ViewBase>>; _onDynamicStateChangeHandler: () => void; _appliedChangeMap: Readonly<ChangeMap<ViewBase>>; private _appliedPropertyValues; _appliedAnimations: ReadonlyArray<KeyframeAnimation>; _appliedSelectorsVersion: number; _match: SelectorsMatch<ViewBase>; _matchInvalid: boolean; _playsKeyframeAnimations: boolean; constructor(viewRef: WeakRef<ViewBase>); /** * Called when a change had occurred that may invalidate the statically matching selectors (class, id, ancestor selectors). * As a result, at some point in time, the selectors matched have to be requerried from the style scope and applied to the view. */ onChange(): void; /** * Checks whether style scope and CSS state selectors are in sync. */ isSelectorsLatestVersionApplied(): boolean; onLoaded(): void; onUnloaded(): void; private updateMatch; private updateDynamicState; private playKeyframeAnimations; private stopKeyframeAnimations; /** * Calculate the difference between the previously applied property values, * and the new set of property values that have to be applied for the provided selectors. * Apply the values and ensure each property setter is called at most once to avoid excessive change notifications. * @param matchingSelectors */ private setPropertyValues; private subscribeForDynamicUpdates; private unsubscribeFromDynamicUpdates; toString(): string; } export declare class StyleScope { private _selectorScope; private _css; private _mergedCssSelectors; private _mergedCssKeyframes; private _localCssSelectors; private _localCssKeyframes; private _localCssSelectorVersion; private _localCssSelectorsAppliedVersion; private _applicationCssSelectorsAppliedVersion; private _cssFiles; get css(): string; set css(value: string); addCss(cssString: string, cssFileName?: string): void; addCssFile(cssFileName: string): void; changeCssFile(cssFileName: string): void; private setCss; private appendCss; getKeyframeAnimationWithName(animationName: string): KeyframeAnimationInfo; ensureSelectors(): number; /** * Increase the application CSS selector version. */ _increaseApplicationCssSelectorVersion(): void; isApplicationCssSelectorsLatestVersionApplied(): boolean; isLocalCssSelectorsLatestVersionApplied(): boolean; private _createSelectors; matchSelectors(view: any): SelectorsMatch<ViewBase>; query(node: Node): SelectorCore[]; getSelectorsVersion(): number; private _applyKeyframesToSelectors; getAnimations(ruleset: RuleSet): KeyframeAnimationInfo[]; private findKeyframeRule; } export declare function resolveFileNameFromUrl(url: string, appDirectory: string, fileExists: (name: string) => boolean, importSource?: string): string; export declare const applyInlineStyle: any;