histoire
Version:
A fast story book powered by Vite
55 lines • 2.44 kB
TypeScript
import type { ViteDevServer } from 'vite';
import type { Context } from '../context.js';
import type { ExecutionService } from '../runtime/execution-service.js';
/** Retire captures for every dependency HMR, even when catalog metadata is identical. */
export declare function retireVisualSource(server: ViteDevServer): void;
/** Observe render retirement through existing server ownership. */
export declare function onVisualSourceRetired(server: ViteDevServer, listener: () => void): () => void;
/** Ready generation and completed catalog captured before asynchronous work. */
export interface VisualSource {
/** Exact server-side configuration and story inventory. */
ctx: Context;
/** Existing dev HTTP source. */
server: ViteDevServer;
/** Existing source-owned execution lane. */
execution: ExecutionService;
/** Preview host generation token. */
epoch: string;
/** Current generation and completed publication remain authoritative. */
isActive: () => boolean;
}
/** Bind one ready completed catalog revision; no second collector or launcher. */
export declare function resolveVisualSource(ctx: Context, server: ViteDevServer, execution: ExecutionService, active: () => boolean, epoch?: string): VisualSource;
/** Exact private render input, independent of workbench preferences. */
export declare function visualSession(source: VisualSource, storyId: string, variantId: string, spec: import('@histoire/shared').HistoireVisualCaptureSpec): {
root: string;
host: {
prefix: string;
open(target: import("../runtime/browser/preview-host.js").PreviewHostTarget): {
nonce: string;
url: string;
close: () => boolean;
};
render(path: string): string | undefined;
close(): void;
};
setupOwner: import("../runtime/browser/setup/types.js").ScreenshotSetupOwner;
stableCapture: boolean;
target: {
id: string;
width: number;
height: number;
deviceScaleFactor: 1 | 2 | 3;
colorScheme: 'light' | 'dark';
backgroundColor: string;
textDirection: 'ltr' | 'rtl';
globals: Record<string, string | number | boolean | null>;
propsOverride?: Record<string, unknown>;
origin: string;
epoch: string;
storyId: string;
variantId: string;
isActive: () => boolean;
};
};
//# sourceMappingURL=source.d.ts.map