@neuroequality/neuroadapt-core
Version:
Core sensory, cognitive, and preference management for NeuroAdapt SDK
110 lines (109 loc) • 3.26 kB
TypeScript
import { EventEmitter } from 'eventemitter3';
import { Preferences, PreferencesUpdate, ValidationError } from './schemas.js';
import { PreferenceStorage } from './storage.js';
import { MigrationRegistry } from './migration.js';
/**
* Events emitted by PreferenceStore
*/
export interface PreferenceStoreEvents {
change: (diff: Partial<Preferences>, previousState: Preferences) => void;
invalid: (errors: ValidationError[]) => void;
loaded: (preferences: Preferences) => void;
saved: (preferences: Preferences) => void;
error: (error: Error) => void;
}
/**
* Configuration for PreferenceStore
*/
export interface PreferenceStoreConfig {
storage?: PreferenceStorage;
migrationRegistry?: MigrationRegistry;
autoSave?: boolean;
storageKey?: string;
}
/**
* Main preference store with validation, events, and persistence
*/
export declare class PreferenceStore extends EventEmitter<PreferenceStoreEvents> {
private readonly storage;
private readonly migrationRegistry;
private readonly autoSave;
private readonly storageKey;
private preferences;
private isInitialized;
constructor(config?: PreferenceStoreConfig);
/**
* Initialize the store by loading preferences from storage
*/
initialize(): Promise<void>;
/**
* Get current preferences
*/
getPreferences(): Preferences;
/**
* Update preferences with validation
*/
updatePreferences(updates: PreferencesUpdate): Promise<void>;
/**
* Save preferences to storage
*/
save(): Promise<void>;
/**
* Reset preferences to defaults
*/
reset(): Promise<void>;
/**
* Export preferences as JSON
*/
export(): string;
/**
* Import preferences from JSON
*/
import(json: string): Promise<void>;
/**
* Get specific preference section
*/
getSensoryPreferences(): {
motionReduction: boolean;
highContrast: boolean;
colorVisionFilter: "none" | "protanopia" | "deuteranopia" | "tritanopia";
fontSize: number;
reducedFlashing: boolean;
darkMode: boolean;
};
getCognitivePreferences(): {
readingSpeed: "slow" | "medium" | "fast";
explanationLevel: "simple" | "detailed" | "expert";
processingPace: "relaxed" | "standard" | "quick";
chunkSize: number;
allowInterruptions: boolean;
preferVisualCues: boolean;
};
getAIPreferences(): {
tone: "calm-supportive" | "neutral" | "enthusiastic" | "professional";
responseLength: "detailed" | "standard" | "brief";
consistencyLevel: "adaptive" | "moderate" | "high";
useAnalogies: boolean;
allowUndo: boolean;
};
getVRPreferences(): {
comfortRadius: number;
safeSpaceEnabled: boolean;
locomotionType: "teleport" | "smooth" | "comfort";
personalSpace: number;
panicButtonEnabled: boolean;
};
/**
* Check if store is initialized
*/
isReady(): boolean;
/**
* Deep merge preferences with updates
*/
private mergePreferences;
/**
* Get default preferences
*/
private getDefaultPreferences;
}
//# sourceMappingURL=store.d.ts.map