import { ComputedRef } from 'vue'; import { BaseSurfaceMode } from './types'; /** Pointer speed, in px/ms, above which a drag counts as fast motion. */ export declare const SURFACE_POINTER_SPEED_THRESHOLD = 1.2; /** How long an inferred motion signal has to stay quiet before it ends, in ms. */ export declare const SURFACE_MOTION_SETTLE_MS = 140; /** On battery power, the charge level at or below which surfaces save power (Windows' Battery Saver default). */ export declare const SURFACE_LOW_BATTERY_LEVEL = 0.2; /** * How the frame-budget probe rates the page. * - `ok`: frames keep to the display's budget. * - `reduced`: a third or more of the frames overran one frame's budget (a dropped frame). * - `minimal`: the median frame overran two budgets. */ export type SurfaceFrameTier = 'ok' | 'reduced' | 'minimal'; /** A probe's reading: a tier, or `throttled` when the browser held the frames back. */ type SurfaceFrameReading = SurfaceFrameTier | 'throttled'; export interface SurfaceMotionGuardOptions { /** Quiet time before the motion ends, in ms; 140 by default. 0 ends it synchronously. */ settleMs?: number; } export interface SurfaceMotionGuard { /** Motion started: falls back at once, and cancels a pending end. */ onMotionStart: () => void; /** Motion stopped: recovers once nothing has started again for `settleMs`. */ onMotionEnd: () => void; /** Cancels a pending end. Called on its own when the guard was created inside an effect scope. */ dispose: () => void; } /** * The asymmetric clock behind every inferred motion signal: falling back takes 0ms, * recovering waits until the motion has been quiet for `settleMs`, so a gesture that * trembles around its threshold does not flip the material back and forth. * * `emitFallback` is called only when the state changes. Hosts that know when their * surface moves can drive `TxBaseSurface`'s `moving` prop through it. */ export declare function useSurfaceMotionGuard(emitFallback: (isFallback: boolean) => void, options?: SurfaceMotionGuardOptions): SurfaceMotionGuard; /** * Reports that the window is moving or resizing. Surfaces with `autoDetect` treat the * window as moving until no report has arrived for 140ms. * * A page receives no event when its window moves, so the host forwards one: in Electron, * relay the `BrowserWindow`'s `move` (and `will-move`) events to the renderer and call this. * Resizes are picked up from the page's own `resize` event. */ export declare function notifySurfaceWindowMotion(): void; /** * Overrides the power-saving signal: `true` or `false` from the host (in Electron, * `powerMonitor`'s battery events, say); `null` hands it back to the Battery Status API. */ export declare function setSurfacePowerSaving(value: boolean | null): void; /** * What surfaces may spend on their material. `max` gives every surface on the page, with * `autoDetect` or without, a solid fill in place of a material that samples the backdrop * (refraction, glass, acrylic, blur) or repaints with each scroll (mica). A surface over a system * backdrop keeps its material: the system draws it. */ export type SurfacePerformanceMode = 'default' | 'max'; /** Switches the page-wide performance mode; an app can bind it to a user setting. */ export declare function setSurfacePerformanceMode(mode: SurfacePerformanceMode): void; /** The current performance mode; reactive when read inside a computed or a render. */ export declare function getSurfacePerformanceMode(): SurfacePerformanceMode; /** The material a surface renders under a performance mode. */ export declare function applySurfacePerformance(mode: BaseSurfaceMode, performance: SurfacePerformanceMode): BaseSurfaceMode; /** The environment as surfaces with `autoDetect` see it, read-only. */ export declare function getSurfaceEnvironment(): { pointerMoving: Readonly>; windowMoving: Readonly>; powerSaving: Readonly>; frameTier: Readonly>; performanceMode: Readonly>; }; /** Rates sampled frame intervals against the display's budget, which is unknown and estimated. */ export declare function classifySurfaceFrames(intervals: number[]): SurfaceFrameReading; export interface SurfaceEnvironment { /** A fast drag or a moving window, each held for 140ms after it stops. */ moving: ComputedRef; powerSaving: ComputedRef; frameTier: ComputedRef; } /** * Subscribes a mounted component to the page-wide environment while `enabled()` holds. * The listeners, the battery and the frame probe exist only while some component subscribes. */ export declare function useSurfaceEnvironment(enabled: () => boolean): SurfaceEnvironment; /** * The material a surface renders in its environment: a power-saving device, or a page that * drops frames, swaps refraction, glass and acrylic for plain backdrop blur; a page whose * median frame overruns two budgets drops every backdrop material for a solid fill. */ export declare function degradeSurfaceMode(mode: BaseSurfaceMode, tier: SurfaceFrameTier, saving: boolean): BaseSurfaceMode; export {};