/** * PropertyParser types — the property-value union and the discriminated union * of all parsed property shapes. */ import type { ParsedFilterFunction } from '../FilterParser'; import type { ParsedDrawSVG } from '../DrawSVGParser'; import type { ParsedClipPath } from '../ClipPathParser'; /** * Valid property value types for animation */ export type PropertyValue = number | string; /** * Base fields shared by all parsed property types */ export interface ParsedPropertyBase { property: string; isTransform: boolean; } /** * Scalar property (numbers with units) */ export interface ParsedScalarProperty extends ParsedPropertyBase { type: 'scalar'; startValue: number; endValue: number; unit: string; startUnit?: string; endUnit?: string; } /** * Compound CSS string property (transform-origin, background-position, …). * Holds the raw start/end strings; PropTween interpolates them component-wise * when every token is numeric and snaps otherwise. */ export interface ParsedStringProperty extends ParsedPropertyBase { type: 'string'; startString: string; endString: string; } /** * Color property (RGBA values) */ export interface ParsedColorProperty extends ParsedPropertyBase { type: 'color'; startColor: Float32Array; endColor: Float32Array; } /** * Filter property (CSS filters) */ export interface ParsedFilterProperty extends ParsedPropertyBase { type: 'filter'; startFilters: ParsedFilterFunction[]; endFilters: ParsedFilterFunction[]; } /** * DrawSVG property (SVG stroke animation) */ export interface ParsedDrawSVGProperty extends ParsedPropertyBase { type: 'drawSVG'; startDraw: ParsedDrawSVG; endDraw: ParsedDrawSVG; length: number; } /** * Clip-path property (CSS clip-path shape function interpolation) */ export interface ParsedClipPathProperty extends ParsedPropertyBase { type: 'clipPath'; startClipPath: ParsedClipPath; endClipPath: ParsedClipPath; } /** * Path property (motion along SVG path) */ export interface ParsedPathProperty extends ParsedPropertyBase { type: 'path'; pathData: string; pathLength: number; startProgress: number; endProgress: number; rotate: boolean; alignOffset: { x: number; y: number; }; pathOffset: { x: number; y: number; }; pathScale: { x: number; y: number; }; alignTarget?: string | Element; alignAt: [number, number]; pathTarget: string | Element; } /** * Discriminated union of all parsed property types */ export type ParsedProperty = ParsedScalarProperty | ParsedStringProperty | ParsedColorProperty | ParsedFilterProperty | ParsedDrawSVGProperty | ParsedPathProperty | ParsedClipPathProperty;