Bring apps/desktop and ui-tui to a clean state for typecheck, eslint,
and prettier:
- Run prettier across both trees (printWidth/wrap drift; prettier is not
CI-enforced for these JS projects, so main had accumulated drift).
- Apply eslint --fix for padding-line-between-statements and perfectionist
import/export sorting.
- Manual fixes for non-auto-fixable rules:
- remove unused node:net import in electron/main.cjs (uses Electron net)
- replace inline `typeof import(...)` annotations with top-level
`import type * as EnvModule` in two ui-tui test files
- scoped eslint-disable no-control-regex on intentional sentinel/ANSI
regexes (mathUnicode.ts, text.ts)
- resolve react-hooks/exhaustive-deps per-case: correct swapped/missing
deps, collapse redundant session.* members, and justified disables on
settings mount-only data-load effects to preserve run-once behavior
No behavior changes; test pass/fail counts are unchanged from the main
baseline.
15 lines
524 B
TypeScript
15 lines
524 B
TypeScript
import { atom } from 'nanostores'
|
|
|
|
import type { PetState } from './usePet.js'
|
|
|
|
interface PetFlash {
|
|
state: PetState
|
|
until: number
|
|
}
|
|
|
|
// Transient reaction beats (wave/jump/failed) the pet shows for a moment at
|
|
// turn end before falling back to its steady state. The gateway event handler
|
|
// sets these; usePet reads them with priority over the derived state.
|
|
export const $petFlash = atom<PetFlash | null>(null)
|
|
|
|
export const flashPet = (state: PetState, ms = 1600) => $petFlash.set({ state, until: Date.now() + ms })
|