export type CanvasAtomType = 'method' | 'property'; export interface SerializedCanvasAtom { type: CanvasAtomType; inst: string; args: unknown[]; } export interface SerializedCanvasSequence { sequence: SerializedCanvasAtom[]; } type ContextMethod = T extends (...args: infer Args) => any ? (...args: Args) => void : never; export interface CanvasSequenceMethods { addHitRegion(...args: any[]): void; arc: ContextMethod; arcTo: ContextMethod; beginPath: ContextMethod; bezierCurveTo: ContextMethod; clearHitRegions(...args: any[]): void; clearRect: ContextMethod; clip: ContextMethod; closePath: ContextMethod; drawFocusIfNeeded(...args: any[]): void; drawImage: ContextMethod; ellipse: ContextMethod; fill: ContextMethod; fillRect: ContextMethod; fillText: ContextMethod; lineTo: ContextMethod; moveTo: ContextMethod; putImageData: ContextMethod; quadraticCurveTo: ContextMethod; rect: ContextMethod; reset(...args: any[]): void; removeHitRegion(...args: any[]): void; resetTransform: ContextMethod; restore: ContextMethod; rotate: ContextMethod; roundRect(...args: any[]): void; save: ContextMethod; scale: ContextMethod; scrollPathIntoView(...args: any[]): void; setLineDash: ContextMethod; setTransform: ContextMethod; stroke: ContextMethod; strokeRect: ContextMethod; strokeText: ContextMethod; transform: ContextMethod; translate: ContextMethod; } export interface CanvasSequenceProperties { direction: CanvasDirection; fillStyle: string | CanvasGradient | CanvasPattern; filter: string; font: string; fontKerning: string; fontStretch: string; fontVariantCaps: string; globalAlpha: number; globalCompositeOperation: GlobalCompositeOperation; imageSmoothingEnabled: boolean; imageSmoothingQuality: ImageSmoothingQuality; letterSpacing: string; lineCap: CanvasLineCap; lineDashOffset: number; lineJoin: CanvasLineJoin; lineWidth: number; miterLimit: number; shadowBlur: number; shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: CanvasTextAlign; textBaseline: CanvasTextBaseline; textRendering: string; wordSpacing: string; } export class CanvasSequence { constructor(data?: SerializedCanvasSequence | null); execute(context: CanvasRenderingContext2D): void; toJSON(): SerializedCanvasSequence; } export interface CanvasSequence extends CanvasSequenceMethods, CanvasSequenceProperties {} export class CanvasBlueprint extends CanvasSequence { build(values?: Record): CanvasSequence; execute(): never; }