import { Injector, Signal } from "@angular/core"; import { AnyObject } from "../../../../../utils/utils"; import { TermElement } from './Element'; type StyleKey = keyof StyleValue; export type Layer = SimpleLayer | ((StyleHandler: any) => StyleValue) | SignalLayer; type SimpleLayer = StyleValue; type SignalLayer = Signal; export declare class StyleHandler { element: TermElement; injector: Injector; /** * Style layers that are added to the element. */ layers: Layer[]; /** * Whether the style has been modified since the last update. */ dirty: boolean; childLayerDirty: boolean; /** * Whether the style has been queued for updating in the root TermScreen. * See TermScreen.queueDirtyStyle and TermScreen.computeStyles. */ wasQueued: boolean; /** * Properties that are defined on the current element. * It is the result of adding all the layers together in order. * It can contain the value 'inherit' which then need to be resolved to the parent value. */ self: StyleValue; /** * Properties that are inherited from the parent element. */ inherited: StyleValue; /** * Layers that are gonna be used by each child as their *first* layer. */ childLayers: Layer[]; /** * Functions that will be called when the style handler is disposed. */ onDispose: (() => void)[]; constructor(element: TermElement, injector: Injector); /** * Adds a style layer. * It can be a simple object, a function that returns an object, or a signal. * */ add(layer: Layer): void; addChildLayer(layer: Layer): void; markDirtyAndQueue(): void; getSelf(key: K, checks?: boolean): StyleValue[K]; get(key: K): StyleValue[K]; init(): void; update(parentModified?: StyleValue, childLayers?: Layer[]): void; reset(): void; dispose(): void; } /** * Compares two objects and generates a diff object containing only the changed values. * If a property exists in 'b' but not in 'a', it's added to the result. * If a property exists in both 'a' and 'b' with different values, the value from 'b' is added to the result. * If a property exists in 'a' but not in 'b', it's set to undefined in the result. * * @param a - The source object to compare against * @param b - The object containing new values to compare with * @param res - The result object where differences will be stored * * @example * const a = { foo: 1, bar: 2, qux: 5 }; * const b = { foo: 1, bar: 3, baz: 4 }; * const result = {}; * diff(a, b, result) // result = { bar: 3, baz: 4, qux: undefined } */ export declare function diff(a: { [key: string]: any; }, b: { [key: string]: any; }, res: AnyObject): void; export declare function cond(condition: Signal | any | ((...args: any[]) => boolean), style: StyleValue): Signal; export declare function eq(value1: any, value2: any): () => boolean; export declare function neq(value1: any, value2: any): () => boolean; export declare function ifEq(value1: any, value2: any, style: any): Signal; export declare function ifNeq(value1: any, value2: any, style: any): Signal; export declare function addStyle(layer: Layer): void; export interface StyleValue { display?: 'flex' | 'none'; alignContent?: 'flexStart' | 'flexEnd' | 'center' | 'spaceBetween' | 'spaceAround' | 'stretch'; alignItems?: 'flexStart' | 'flexEnd' | 'center' | 'baseline' | 'stretch'; alignSelf?: 'auto' | 'flexStart' | 'flexEnd' | 'center' | 'baseline' | 'stretch'; flexDirection?: 'row' | 'column' | 'rowReverse' | 'columnReverse'; position?: 'relative' | 'sticky' | 'absolute' | 'fixed'; left?: string | number; right?: string | number; top?: string | number; bottom?: string | number; zIndex?: number; margin?: string | number | (string | number)[]; marginLeft?: string | number; marginRight?: string | number; marginTop?: string | number; marginBottom?: string | number; flexGrow?: number; flexShrink?: number; flexBasis?: number; width?: string | number; height?: number | string; minWidth?: string | number; minHeight?: string | number; maxWidth?: string | number; maxHeight?: string | number; overflow?: 'visible' | 'hidden'; border?: 'simple' | 'modern' | 'strong' | 'double' | 'block' | 'rounded'; borderLeftCharacter?: string | null; borderRightCharacter?: string | null; borderTopCharacter?: string | null; borderBottomCharacter?: string | null; borderTopLeftCharacter?: string | null; borderTopRightCharacter?: string | null; borderBottomLeftCharacter?: string | null; borderBottomRightCharacter?: string | null; padding?: (string | number)[]; paddingLeft?: string | number; paddingRight?: string | number; paddingTop?: string | number; paddingBottom?: string | number; fontWeight?: 'normal' | 'bold' | 'fainted'; textAlign?: 'left' | 'center' | 'right' | 'justify'; textDecoration?: 'underline' | null; color?: Color; borderColor?: Color; backgroundClip?: 'borderBox' | 'paddingBox' | 'contentBox'; backgroundColor?: Color; backgroundCharacter?: string; pointerEvents?: boolean; scroll?: 'x' | 'y' | 'xy' | null; scrollF?: 'x' | 'y' | 'xy' | null; hgrow?: boolean; vgrow?: boolean; justifyContent?: 'flexStart' | 'flexEnd' | 'center' | 'baseline' | 'stretch'; wrap?: 'wrap' | null; } export type Color = string | null; export {};