import { z } from "zod"; import { TextSprite } from "./TextSprite"; import { ClipStyle, ClipStyleOptions } from "../../ClipStyle"; import { TextStyleAlign, TextStyleFontStyle, TextStyleFontWeight } from '../../../../types/text.types'; interface TextClipStyleOptions extends ClipStyleOptions { fontSize?: number; color?: string; fontWeight?: TextStyleFontWeight; fontFamily?: string; textAlign?: TextStyleAlign; fontStyle?: TextStyleFontStyle; backgroundColor?: string | null; wordWrapWidth?: number | null; strokeColor?: string; strokeThickness?: number; padding?: number[]; lineHeight?: number; letterSpacing?: number; dropShadow?: boolean; dropShadowAlpha?: number; dropShadowAngle?: number; dropShadowBlur?: number; dropShadowColor?: string; dropShadowDistance?: number; } /** * Serialization schema for text clip styling, covering typography, wrapping, stroke, padding, and drop-shadow state. * * The schema is used for validation when persisting text clips and when reconstructing a `TextStyle` instance from * serialized project data. */ export declare const TextStyleSchema: z.ZodObject<{ scale: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; width: z.ZodOptional; alpha: z.ZodNumber; rotation: z.ZodNumber; height: z.ZodOptional; mediaDataId: z.ZodOptional; clipId: z.ZodString; position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; crop: z.ZodDefault>>; cropOffset: z.ZodDefault>>; zoom: z.ZodDefault>>; zIndex: z.ZodNumber; cornerRadius: z.ZodOptional>; relativeCornerRadius: z.ZodDefault>; fontSize: z.ZodNumber; color: z.ZodString; fontWeight: z.ZodEnum<["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]>; fontFamily: z.ZodString; textAlign: z.ZodEnum<["left", "center", "right", "justify"]>; fontStyle: z.ZodEnum<["normal", "italic", "oblique"]>; backgroundColor: z.ZodNullable; strokeColor: z.ZodDefault; strokeThickness: z.ZodDefault; wordWrapWidth: z.ZodDefault>; padding: z.ZodDefault>; lineHeight: z.ZodDefault; letterSpacing: z.ZodDefault; dropShadow: z.ZodDefault; dropShadowAlpha: z.ZodDefault; dropShadowAngle: z.ZodDefault; dropShadowBlur: z.ZodDefault; dropShadowColor: z.ZodDefault; dropShadowDistance: z.ZodDefault; }, "strip", z.ZodTypeAny, { scale: [number, number]; color: string; alpha: number; rotation: number; padding: number[]; clipId: string; position: [number, number]; crop: [number, number, number, number]; cropOffset: [number, number]; zoom: [number, number]; zIndex: number; relativeCornerRadius: boolean; fontSize: number; fontWeight: "normal" | "bold" | "bolder" | "lighter" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; fontFamily: string; textAlign: "left" | "center" | "right" | "justify"; fontStyle: "normal" | "italic" | "oblique"; backgroundColor: string | null; strokeColor: string; strokeThickness: number; wordWrapWidth: number | null; lineHeight: number; letterSpacing: number; dropShadow: boolean; dropShadowAlpha: number; dropShadowAngle: number; dropShadowBlur: number; dropShadowColor: string; dropShadowDistance: number; width?: number | undefined; height?: number | undefined; mediaDataId?: string | undefined; cornerRadius?: [number, number, number, number] | undefined; }, { scale: [number, number]; color: string; alpha: number; rotation: number; clipId: string; position: [number, number]; zIndex: number; fontSize: number; fontWeight: "normal" | "bold" | "bolder" | "lighter" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; fontFamily: string; textAlign: "left" | "center" | "right" | "justify"; fontStyle: "normal" | "italic" | "oblique"; backgroundColor: string | null; width?: number | undefined; height?: number | undefined; mediaDataId?: string | undefined; crop?: [number, number, number, number] | undefined; cropOffset?: [number, number] | undefined; zoom?: [number, number] | undefined; cornerRadius?: [number, number, number, number] | undefined; relativeCornerRadius?: boolean | undefined; strokeColor?: string | undefined; strokeThickness?: number | undefined; wordWrapWidth?: number | null | undefined; padding?: number[] | undefined; lineHeight?: number | undefined; letterSpacing?: number | undefined; dropShadow?: boolean | undefined; dropShadowAlpha?: number | undefined; dropShadowAngle?: number | undefined; dropShadowBlur?: number | undefined; dropShadowColor?: string | undefined; dropShadowDistance?: number | undefined; }>; /** * Clip style implementation for text content, including typography, stroke, padding, and drop-shadow settings. */ export declare class TextStyle extends ClipStyle { fontSize: number; color: string; fontWeight: TextStyleFontWeight; fontFamily: string; textAlign: TextStyleAlign; fontStyle: TextStyleFontStyle; backgroundColor: string | null; wordWrapWidth: number | null; strokeColor: string; strokeThickness: number; padding: number[]; lineHeight: number; letterSpacing: number; dropShadow: boolean; dropShadowAlpha: number; dropShadowAngle: number; dropShadowBlur: number; dropShadowColor: string; dropShadowDistance: number; private isDirty; protected animationColor: string; /** * Creates a text style. * * @param options Initial text style configuration. */ constructor(options: TextClipStyleOptions); /** * Marks the text style as needing a full text-layout refresh on the next update. * * @returns Nothing. */ setDirty(): void; /** * Enables or disables text drop shadow rendering. * * @param dropShadow Whether the drop shadow should be rendered. * @returns Nothing. */ setDropShadow(dropShadow: boolean): void; /** * Indicates whether text drop shadow rendering is enabled. * * @returns `true` if drop shadow rendering is enabled; otherwise `false`. */ getDropShadow(): boolean; /** * Sets the drop shadow opacity. * * @param dropShadowAlpha Drop shadow opacity multiplier. * @returns Nothing. */ setDropShadowAlpha(dropShadowAlpha: number): void; /** * Returns the drop shadow opacity. * * @returns The drop shadow opacity multiplier. */ getDropShadowAlpha(): number; /** * Sets the drop shadow angle in radians. * * @param dropShadowAngle Drop shadow angle. * @returns Nothing. */ setDropShadowAngle(dropShadowAngle: number): void; /** * Returns the drop shadow angle. * * @returns The drop shadow angle in radians. */ getDropShadowAngle(): number; /** * Sets the drop shadow blur radius. * * @param dropShadowBlur Blur radius. * @returns Nothing. */ setDropShadowBlur(dropShadowBlur: number): void; /** * Returns the drop shadow blur radius. * * @returns The blur radius. */ getDropShadowBlur(): number; /** * Sets the drop shadow color. * * @param dropShadowColor CSS-like color string. * @returns Nothing. */ setDropShadowColor(dropShadowColor: string): void; /** * Returns the drop shadow color. * * @returns The drop shadow color string. */ getDropShadowColor(): string; /** * Sets the drop shadow distance from the text glyphs. * * @param dropShadowDistance Distance in pixels. * @returns Nothing. */ setDropShadowDistance(dropShadowDistance: number): void; /** * Returns the drop shadow distance. * * @returns The drop shadow distance in pixels. */ getDropShadowDistance(): number; /** * Sets the text stroke color. * * @param strokeColor CSS-like color string. * @returns Nothing. */ setStrokeColor(strokeColor: string): void; /** * Returns the text stroke color. * * @returns The stroke color string. */ getStrokeColor(): string; /** * Sets the text stroke thickness. * * @param strokeThickness Stroke width in pixels. * @returns Nothing. */ setStrokeThickness(strokeThickness: number): void; /** * Returns the text stroke thickness. * * @returns The stroke width in pixels. */ getStrokeThickness(): number; /** * Sets the font size. * * @param fontSize Font size in pixels. * @returns Nothing. */ setFontSize(fontSize: number): void; /** * Returns the font size. * * @returns The font size in pixels. */ getFontSize(): number; /** * Returns the effective word-wrap width after scale is applied. * * @returns The word-wrap width in pixels, or `null` if wrapping is disabled. */ getWordWrapWidth(): number | null; /** * Sets the word-wrap width. * * @param wordWrapWidth Wrap width in pixels, or `null` to disable wrapping. * @returns Nothing. */ setWordWrapWidth(wordWrapWidth: number | null): void; /** * Sets the base text fill color. * * @param color CSS-like color string. * @returns Nothing. */ setColor(color: string): void; /** * Returns the base text fill color. * * @returns The text color string. */ getColor(): string; /** * Sets a temporary animation-driven fill color override. * * @param color CSS-like color string. An empty string clears the override. * @returns Nothing. */ setAnimationColor(color: string): void; /** * Returns the temporary animation-driven fill color override. * * @returns The override color string, or an empty string if no override is active. */ getAnimationColor(): string; /** * Sets the font weight. * * @param fontWeight Font weight value. * @returns Nothing. */ setFontWeight(fontWeight: TextStyleFontWeight): void; /** * Returns the font weight. * * @returns The configured font weight. */ getFontWeight(): "normal" | "bold" | "bolder" | "lighter" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; /** * Sets the preferred font family. * * @param fontFamily Font family name. * @returns Nothing. */ setFontFamily(fontFamily: string): void; /** * Returns the preferred font family. * * @returns The configured font family. */ getFontFamily(): string; /** * Sets horizontal text alignment. * * @param textAlign Text alignment mode. * @returns Nothing. */ setTextAlign(textAlign: TextStyleAlign): void; /** * Returns the horizontal text alignment. * * @returns The configured text alignment. */ getTextAlign(): "left" | "center" | "right" | "justify"; /** * Sets the font style. * * @param fontStyle Font style value. * @returns Nothing. */ setFontStyle(fontStyle: TextStyleFontStyle): void; /** * Returns the font style. * * @returns The configured font style. */ getFontStyle(): "normal" | "italic" | "oblique"; /** * Sets the optional text background color. * * @param backgroundColor CSS-like color string, or `null` to remove the background. * @returns Nothing. */ setBackgroundColor(backgroundColor: string | null): void; /** * Returns the optional text background color. * * @returns The background color string, or `null` if none is set. */ getBackgroundColor(): string | null; /** * Sets horizontal and vertical text padding. * * @param padding Uniform padding value or `[horizontal, vertical]` padding pair. * @returns Nothing. */ setPadding(padding: number | number[]): void; /** * Returns horizontal and vertical text padding. * * @returns The padding pair in `[horizontal, vertical]` order. */ getPadding(): number[]; /** * Sets the text line height. * * @param lineHeight Line height in pixels. * @returns Nothing. */ setLineHeight(lineHeight: number): void; /** * Returns the text line height. * * @returns The line height in pixels. */ getLineHeight(): number; /** * Sets the text letter spacing. * * @param letterSpacing Letter spacing in pixels. * @returns Nothing. */ setLetterSpacing(letterSpacing: number): void; /** * Returns the text letter spacing. * * @returns The letter spacing in pixels. */ getLetterSpacing(): number; update(container: TextSprite): void; /** * Serializes the text style. * * @returns The serialized text style payload. */ serialize(): { scale: [number, number]; color: string; alpha: number; rotation: number; padding: number[]; clipId: string; position: [number, number]; crop: [number, number, number, number]; cropOffset: [number, number]; zoom: [number, number]; zIndex: number; relativeCornerRadius: boolean; fontSize: number; fontWeight: "normal" | "bold" | "bolder" | "lighter" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; fontFamily: string; textAlign: "left" | "center" | "right" | "justify"; fontStyle: "normal" | "italic" | "oblique"; backgroundColor: string | null; strokeColor: string; strokeThickness: number; wordWrapWidth: number | null; lineHeight: number; letterSpacing: number; dropShadow: boolean; dropShadowAlpha: number; dropShadowAngle: number; dropShadowBlur: number; dropShadowColor: string; dropShadowDistance: number; width?: number | undefined; height?: number | undefined; mediaDataId?: string | undefined; cornerRadius?: [number, number, number, number] | undefined; }; /** * Creates a text style instance from serialized data. * * @param payload Serialized text style payload. * @returns The deserialized text style. */ static deserialize(payload: object): TextStyle; } export {};