25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
export interface BackgroundFrame {
|
|
url: string;
|
|
blurredUrl?: string;
|
|
overlay: number;
|
|
position: 'center' | 'top left' | 'top' | 'top right' | 'left' | 'right' | 'bottom left' | 'bottom' | 'bottom right';
|
|
size: 'cover' | 'contain' | 'auto';
|
|
previous?: Omit<BackgroundFrame, 'previous' | 'transitionMs'>;
|
|
transitionMs?: number;
|
|
}
|
|
|
|
export interface BackgroundApi {
|
|
readonly version: 1;
|
|
chooseFolder(): Promise<string | null>;
|
|
defaultFolder?(): Promise<string>;
|
|
list(folder: string): Promise<{ name: string }[]>;
|
|
read(folder: string, name: string): Promise<Uint8Array>;
|
|
readImageSettings?(folder: string): Promise<string | null>;
|
|
writeImageSettings?(folder: string, contents: string, expected: string | null): Promise<void>;
|
|
set(target: string, frame: BackgroundFrame | null): void;
|
|
get(target: string): BackgroundFrame | null;
|
|
subscribe(listener: (target: string) => void): () => void;
|
|
}
|
|
|
|
export type BackgroundFiles = Pick<BackgroundApi, 'chooseFolder' | 'defaultFolder' | 'list' | 'read' | 'readImageSettings' | 'writeImageSettings'>;
|