import { useActor } from '@xstate/react'; import { createInspector } from '@statelyai/sdk'; const inspector = createInspector(); import { effectiveTheme, settingsMachine, type Density, type ThemePreference } from './settingsMachine'; const THEMES: ThemePreference[] = ['light', 'dark', 'system']; export default function App() { const [state, send] = useActor(settingsMachine, { inspect: inspector.inspect }); const { theme, density, reducedMotion, systemDark } = state.context; return (

Settings

e.preventDefault()}>

Effective theme:{' '} {effectiveTheme(state.context.theme, state.context.systemDark)}

The OS currently prefers {systemDark ? 'dark' : 'light'}. Change it while this page is open — with system selected, the effective theme follows along.

Every change is written to localStorage. Reload the page to see it restored.

); }