# Phase 2: Calendar State ## Added - `src/calendar/calendar-state.ts` — observable state container for the calendar view ## Details - `CalendarState` class with private fields: `displayedMonth`, `today`, `activeFileDate`, `noteIndex` - Read-only getters for all state fields - `subscribe(cb)` / unsubscribe pattern using a `Set<() => void>` - `setDisplayedMonth(m)` — clones and normalizes to start-of-month - `setActiveFile(file, rootFolder)` — delegates to `getDateFromDailyNote()` from Phase 1 - `reindex(app, rootFolder)` — delegates to `indexDailyNotes()` from Phase 1 - `tick()` — heartbeat that notifies only on day rollover - `rootFolder` passed as parameter (not stored) for consistency across methods - No framework dependencies; strict TypeScript, no `any`