- Added coverage reporting for Vitest with configuration in vitest.config.mjs - Updated package.json to include new scripts for JS coverage, linting, and formatting - Modified run_quality_gate.py to allow skipping ESLint and Prettier checks - Introduced .prettierrc for consistent code formatting - Created .prettierignore to exclude specific files and directories from formatting
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import { createDefaultViewerState } from "./state.js";
|
|
import { SettingsStore } from "../../app/settings/SettingsStore.js";
|
|
|
|
const VIEWER_PREFS_KEY = "mjr_viewer_prefs_v1";
|
|
|
|
export { createDefaultViewerState };
|
|
|
|
export function loadViewerPrefs() {
|
|
try {
|
|
const raw = SettingsStore.get(VIEWER_PREFS_KEY);
|
|
if (!raw) return {};
|
|
const parsed = JSON.parse(raw);
|
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
} catch {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
export function saveViewerPrefs(state) {
|
|
try {
|
|
if (!state) return;
|
|
const prefs = {
|
|
analysisMode: String(state.analysisMode || "none"),
|
|
loupeEnabled: !!state.loupeEnabled,
|
|
probeEnabled: !!state.probeEnabled,
|
|
hudEnabled: !!state.hudEnabled,
|
|
genInfoOpen: !!state.genInfoOpen,
|
|
audioVisualizerMode: String(state.audioVisualizerMode || "artistic"),
|
|
abWipePercent: Number.isFinite(Number(state._abWipePercent))
|
|
? Number(state._abWipePercent)
|
|
: 50,
|
|
};
|
|
SettingsStore.set(VIEWER_PREFS_KEY, JSON.stringify(prefs));
|
|
} catch (e) {
|
|
console.debug?.(e);
|
|
}
|
|
}
|