@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
65 lines • 1.88 kB
TypeScript
import type { StoryContext } from './types';
/**
* Get snapshot directory
*/
export declare function getSnapshotDir(ctx: StoryContext): string;
/**
* Load snapshot versions
*/
export declare function loadSnapshotVersions(ctx: StoryContext, storyId: string): Promise<VersionedSnapshot | null>;
/**
* Save snapshot version
*/
export declare function saveSnapshotVersion(ctx: StoryContext, storyId: string, description?: string): Promise<SnapshotVersion>;
/**
* Restore snapshot to a previous version
*/
export declare function restoreSnapshotVersion(ctx: StoryContext, storyId: string, version: number): Promise<boolean>;
/**
* Generate diff between two HTML snapshots
* Returns a simple text-based diff (for actual image diff, you'd need canvas/image processing)
*/
export declare function generateTextDiff(oldHtml: string, newHtml: string): DiffResult;
/**
* Generate visual diff HTML
*/
export declare function generateDiffHTML(oldHtml: string, newHtml: string): string;
/**
* Get diff styles
*/
export declare function getDiffStyles(): string;
/**
* List all snapshot versions for a story
*/
export declare function listSnapshotVersions(ctx: StoryContext, storyId: string): Promise<SnapshotVersion[]>;
/**
* Delete old snapshot versions
*/
export declare function pruneSnapshotVersions(ctx: StoryContext, storyId: string, keepCount?: number): Promise<number>;
/**
* Snapshot version info
*/
export declare interface SnapshotVersion {
version: number
timestamp: number
commit?: string
description?: string
}
/**
* Snapshot with version history
*/
export declare interface VersionedSnapshot {
current: SnapshotVersion
history: SnapshotVersion[]
maxVersions: number
}
/**
* Diff result
*/
export declare interface DiffResult {
hasDiff: boolean
percentage: number
diffImagePath?: string
changedPixels: number
totalPixels: number
}