Something went wrong. Try again.
A local-first note taking app
Something went wrong. Try again.
TypeScript
123456789101112131415161718192021222324252627import type { ActionSet, ActionDefinition } from '../types';
/** * ActionSet for theme switching actions. */export class ThemeActionSet implements ActionSet { readonly id = 'theme';
constructor( private setTheme: ( theme: 'light' | 'dark' | ((prev: 'light' | 'dark') => 'light' | 'dark'), ) => void, ) {}
getActions(): ActionDefinition[] { return [ { id: 'toggle', name: 'Toggle theme', description: 'Switch between light and dark mode', execute: () => this.setTheme((prev) => (prev === 'light' ? 'dark' : 'light')), }, ]; }}