UNPKG

wave-roll

Version:

JavaScript Library for Comparative MIDI Piano-Roll Visualization

63 lines 3.15 kB
import { AppState, StateManagerConfig } from "./types"; import type { OnsetMarkerStyle } from "@/types"; export declare class StateManager { private state; private config; private readonly listeners; private fileVisibilityManager; private readonly updateUI; private readonly updatePlayback; private readonly updateFileVisibility; private readonly updateLoopPoints; private readonly updatePanVolume; private readonly updateVisual; private readonly updateEvaluation; constructor(config?: Partial<StateManagerConfig>); private createInitialState; getState: () => AppState; getUIState: () => AppState["ui"]; getConfig: () => StateManagerConfig; getFilePanValuesRef: () => Record<string, number>; getFilePanStateHandlersRef: () => Record<string, (pan: number | null) => void>; getFileMuteStatesRef: () => Record<string, boolean>; updateUIState: (updates: Partial<AppState["ui"]>) => void; updatePlaybackState: (updates: Partial<AppState["playback"]>) => void; updateFileVisibilityState: (updates: Partial<AppState["fileVisibility"]>) => void; updateLoopPointsState: (updates: Partial<AppState["loopPoints"]>) => void; updatePanVolumeState: (updates: Partial<AppState["panVolume"]>) => void; updateVisualState: (updates: Partial<AppState["visual"]>) => void; updateEvaluationState: (updates: Partial<AppState["evaluation"]>) => void; /** Assign or update the onset marker style for a file. */ setOnsetMarkerForFile: (fileId: string, style: OnsetMarkerStyle) => void; /** Get the onset marker style for a file, if any. */ getOnsetMarkerForFile: (fileId: string) => OnsetMarkerStyle | undefined; /** * Ensure a unique marker is assigned to the given file if missing. * Uses shape → variant fallback strategy across loaded files. */ ensureOnsetMarkerForFile: (fileId: string) => OnsetMarkerStyle; preserveStateForBatch<T>(operation: () => T): T; syncFileVisibility: (fileIds: string[]) => void; addFileToVisibility: (fileId: string) => void; removeFileFromVisibility: (fileId: string) => void; toggleFileVisibility: (fileId: string) => boolean; setFilePanValue(fileId: string, panValue: number): void; registerFilePanHandler(fileId: string, handler: (pan: number | null) => void): void; unregisterFilePanHandler(fileId: string): void; syncPanValues(panValue: number | null): void; setFileMuteState(fileId: string, muted: boolean): void; getFileMuteState(fileId: string): boolean; setLoopPoints(a: number | null, b: number | null): void; clearLoopPoints(): void; setLoopPointsFromPercentages(aPercent: number | null, bPercent: number | null): void; updateConfig(updates: Partial<StateManagerConfig>): void; resetState(): void; onStateChange: (callback: () => void) => void; offStateChange: (callback: () => void) => void; private notify; } /** * Create a new state manager instance */ export declare function createStateManager(config?: Partial<StateManagerConfig>): StateManager; //# sourceMappingURL=state-manager-refactored.d.ts.map