import type { BaseStyleProps } from '..'; import type { DisplayObject } from '../display-objects'; import type { CSSStyleValue } from './cssom'; import type { CSSProperty } from './CSSProperty'; /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type */ export enum PropertySyntax { /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#coordinate */ COORDINATE = '', /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#color */ COLOR = '', /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#paint */ PAINT = '', /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#number */ NUMBER = '', /** * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/angle */ ANGLE = '', /** * with range 0..1 * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#opacity_value */ OPACITY_VALUE = '', /** * with range 0..Infinity */ SHADOW_BLUR = '', /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#length */ LENGTH = '', /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage */ PERCENTAGE = '', LENGTH_PERCENTAGE = ' | ', LENGTH_PERCENTAGE_12 = '[ | ]{1,2}', /** * @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin#formal_syntax */ LENGTH_PERCENTAGE_14 = '[ | ]{1,4}', /** * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts */ LIST_OF_POINTS = '', PATH = '', /** * @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax */ FILTER = '', Z_INDEX = '', OFFSET_DISTANCE = '', DEFINED_PATH = '', MARKER = '', TRANSFORM = '', TRANSFORM_ORIGIN = '', TEXT = '', TEXT_TRANSFORM = '', } export interface PropertyMetadata { n: string; /** * The interpolable flag indicates whether a property can be animated smoothly. * Default to `false`. */ int?: boolean; /** * The property will inherit by default if no value is specified. * Default to `false`. */ inh?: boolean; /** * This property affects only one field on ComputedStyle, and can be set * directly during inheritance instead of forcing a recalc. */ ind?: boolean; /** * This specifies the default value for this field. * - for keyword fields, this is the initial keyword * - for other fields, this is a string containg the C++ expression that is used to initialise the field. */ d?: string | ((nodeName: string) => string); /** * The resolved value used for getComputedStyle() depends on layout for this * property, which means we may need to update layout to return the correct * value from getComputedStyle(). */ l?: boolean; /** * This specifies all valid keyword values for the property. */ k?: string[]; /** * eg. strokeWidth is an alias of lineWidth */ a?: string[]; /** * sort before init attributes according to this priority */ p?: number; /** * eg. */ syntax?: string; } export interface PropertyParseOptions { skipUpdateAttribute: boolean; skipParse: boolean; forceUpdateGeometry: boolean; usedAttributes: string[]; } export interface StyleValueRegistry { recalc: (displayObject: DisplayObject) => void; registerMetadata: (metadata: PropertyMetadata) => void; unregisterMetadata: (name: string) => void; getPropertySyntax: (syntax: string) => CSSProperty; addUnresolveProperty: (object: DisplayObject, name: string) => void; processProperties: ( object: DisplayObject, attributes: BaseStyleProps, options?: Partial, ) => void; parseProperty: ( name: string, value: any, object: DisplayObject, ) => CSSStyleValue; computeProperty: ( name: string, computed: CSSStyleValue, object: DisplayObject, ) => any; } export interface LayoutRegistry { registerLayout: (name: string, ctor: any) => void; hasLayout: (name: string) => boolean; getLayout: (name: string) => any; }