import type { StoryboardEnvironment } from './designImport.js'; import { type DesignFrameHeightMode } from './frameHeight.js'; import { type LivePreviewInstances } from './livePreviewInstances.js'; import { type PreviewIntent } from './previewIntent.js'; import type { StoryboardGraph } from './storyboardGraph.js'; import type { StoryboardGraphRuntime } from './storyboardGraphRuntime.js'; /** The page facts warmup planning reads; a store PageModel satisfies it. */ export interface PreviewWarmupPage { id: string; importPageId?: string; session?: string; route?: string | null; previewRoute?: string | null; width?: number; height?: number; heightMode?: DesignFrameHeightMode; maxHeight?: number; resolvedDocumentHeight?: number; environment?: StoryboardEnvironment; preset?: Readonly>; interactions?: readonly unknown[]; layersImported?: boolean; } export interface PreviewWarmupTarget { key: string; url: string; width: number; height: number; } /** How many groups are warmed on open. One on purpose: each warm boot is a full app document (see module comment). */ export declare const PREVIEW_WARMUP_GROUP_LIMIT = 1; /** Below this reported device memory (GB), warming is skipped entirely. */ export declare const PREVIEW_WARMUP_MIN_DEVICE_MEMORY_GB = 4; /** * Picks the instance groups worth booting before any frame asks. * * Pool-eligible pages are grouped by their shared-instance key; groups are * ranked by member count because one boot amortizes across every member, and * ties keep page order so the plan is deterministic. The key and boot URL both * carry the effective pre-mount environment, exactly like a FrameView lease. */ export declare function planLivePreviewWarmup(pages: readonly PreviewWarmupPage[], appOrigin: string, baselineEnvironment?: StoryboardEnvironment, groupLimit?: number): PreviewWarmupTarget[]; /** * Frame ids of the storyboard successors of the active page. * * A successor node is represented by one frame — its canonical screen when * that frame exists, otherwise the first declared alias — and only frames the * hover-intent path would accept qualify: a route is present and the layers * were not imported. */ export declare function storyboardSuccessorPageIds(graph: StoryboardGraph | null, pages: readonly PreviewWarmupPage[], activePageId: string): string[]; export interface StartPreviewWarmupOptions { /** The observable selection source; only activePageId is tracked. */ editor: { activePageId: string; }; getPages: () => readonly PreviewWarmupPage[]; appOrigin: string; baselineEnvironment?: StoryboardEnvironment; /** Test seam — defaults to the published storyboard graph. */ getGraph?: () => StoryboardGraph | null; /** Test seam — defaults to navigator.deviceMemory. */ deviceMemoryGb?: number; } /** * Warms the top instance group once and, from then on, prepares the * storyboard successors of whichever screen becomes active. * * `livePreviews` is the pool of the runtime this warmup serves — the one its * frames lease from, so the first real lease of a warmed group finds the * running document. * * Returns a dispose function that stops the selection reaction. Warm boots * already in flight finish on their own; the pool treats them as ordinary * instances afterwards. * * On devices reporting less than PREVIEW_WARMUP_MIN_DEVICE_MEMORY_GB of * memory the whole feature is inert: no pool boot and no successor intents, * because both end in an offscreen application document the device cannot * spare (see the module comment for the measured cost). */ /** What a warmup needs from the runtime it serves. */ export interface PreviewWarmupRuntime { readonly schedulers: { readonly livePreviews: LivePreviewInstances; readonly previewIntent: PreviewIntent; }; readonly declarations: Pick; } export declare function startPreviewWarmup(runtime: PreviewWarmupRuntime, options: StartPreviewWarmupOptions): () => void;