import type { Properties as CSSProperties } from 'csstype';
import { ElementContext } from './change-types';
/**
 * Result type for operations that can fail
 * Follows Rust-style error handling pattern
 */
export type Result<T, E = Error> = {
    ok: true;
    value: T;
} | {
    ok: false;
    error: E;
};
/**
 * Helper constructors for Result type
 */
export declare const Ok: <T>(value: T) => Result<T, never>;
export declare const Err: <E>(error: E) => Result<never, E>;
/**
 * Stable identifier for DOM elements that survives HMR and navigation
 * Uses multiple strategies to locate elements reliably
 */
export interface ElementIdentifier {
    /** Injected stable ID (preferred) - survives most HMR scenarios */
    rivetId: string;
    /** XPath from document root (fallback #1) - brittle but works when ID removed */
    xpath: string;
    /** CSS selector if available (fallback #2) - faster than xpath */
    cssSelector?: string;
    /** File path from component search - for tracking which file owns this element */
    filePath?: string;
}
/**
 * Represents a single CSS property change on an element
 */
export interface StyleChange {
    /** Discriminator for change type */
    type: 'style';
    /** Unique identifier for this change */
    id: string;
    /** Timestamp when change was made */
    timestamp: number;
    /** Element that was modified */
    elementId: ElementIdentifier;
    /** Full element context (for LLM translation phase) */
    elementContext: ElementContext;
    /** CSS property that was changed */
    property: keyof CSSProperties;
    /** Original computed value before change */
    oldValue: string;
    /** New value applied to element */
    newValue: string;
    /** Grouping ID for multiple changes applied in a single logical operation */
    batchId?: string;
}
/**
 * Represents a text content change on an element
 */
export interface TextChange {
    /** Discriminator for change type */
    type: 'text';
    /** Unique identifier for this change */
    id: string;
    /** Timestamp when change was made */
    timestamp: number;
    /** Element that was modified */
    elementId: ElementIdentifier;
    /** Full element context (for LLM translation phase) */
    elementContext: ElementContext;
    /** Original text content before change */
    oldText: string;
    /** New text content applied to element */
    newText: string;
    /** Grouping ID for multiple changes applied in a single logical operation */
    batchId?: string;
}
/**
 * Union type for all tracked changes (style or text)
 */
export type TrackedChange = StyleChange | TextChange;
/**
 * Represents the full change history with undo/redo support
 * Stores only the latest change per element+property (style) or element (text) combination
 */
export interface ChangeHistory {
    /** Current state: Map of change key -> TrackedChange */
    current: Map<string, TrackedChange>;
    /** Past states for undo (array of full state snapshots) */
    past: Map<string, TrackedChange>[];
    /** Future states for redo (array of full state snapshots) */
    future: Map<string, TrackedChange>[];
}
/**
 * Creates a unique key for a style change (element + property)
 */
export declare const changeKey: (elementId: string, property: string) => string;
/**
 * Creates a unique key for a text change (element only - one text change per element)
 */
export declare const textChangeKey: (elementId: string) => string;
/**
 * Returns normalized identifiers used to match a tracked element.
 */
export declare const getElementIdentityCandidates: (elementId: ElementIdentifier) => string[];
/**
 * Returns the primary identity key used for map keys.
 */
export declare const getElementIdentityKey: (elementId: ElementIdentifier) => string;
/**
 * Checks whether an element identifier matches a candidate key.
 */
export declare const matchesElementIdentity: (elementId: ElementIdentifier, candidateKey: string) => boolean;
/**
 * Creates a unique key from a TrackedChange object
 */
export declare const changeKeyFromChange: (change: TrackedChange) => string;
/**
 * Error types for DOM manipulation operations
 */
export declare class DOMError extends Error {
    constructor(message: string);
}
export declare class ElementNotFoundError extends DOMError {
    identifier: ElementIdentifier;
    constructor(identifier: ElementIdentifier, message?: string);
}
export declare class StyleApplicationError extends DOMError {
    property: string;
    value: string;
    constructor(property: string, value: string, message?: string);
}
//# sourceMappingURL=style-manipulation-types.d.ts.map