@silentsheet/core
Version:
a quiet space to write.
50 lines (47 loc) • 1.51 kB
text/typescript
type Font = 'serif' | 'sans-serif' | 'monospace';
type Theme = 'light' | 'sepia' | 'night';
type Size = 'small' | 'medium' | 'large' | 'full';
interface UIState {
font: Font;
fontSize: number;
theme: Theme;
size: Size;
timerRunning: boolean;
timerSeconds: number;
hemingwayMode: boolean;
}
interface SilentSheetState extends UIState {
content: string;
}
interface SilentSheetActions {
setContent: (content: string) => void;
setFont: (font: Font) => void;
setFontSize: (size: number) => void;
setTheme: (theme: Theme) => void;
setSize: (size: Size) => void;
saveContent: () => void;
clearContent: () => void;
toggleTimer: () => void;
resetTimer: () => void;
toggleHemingwayMode: () => void;
}
interface SilentSheetAPI {
getState: () => SilentSheetState;
getActions: () => SilentSheetActions;
subscribeToUI: (callback: () => void) => () => void;
}
declare class SilentSheet implements SilentSheetAPI {
private state;
private subscribers;
private timerInterval;
constructor(initialState?: Partial<SilentSheetState>);
private loadState;
private saveState;
private startTimer;
private stopTimer;
getState(): SilentSheetState;
getActions(): SilentSheetActions;
subscribeToUI(callback: () => void): () => void;
private notifySubscribers;
}
export { type Font, SilentSheet, type SilentSheetAPI, type SilentSheetActions, type SilentSheetState, type Size, type Theme, type UIState };