()
| 7477 | * as files change. Safe to call on web (no bridge → no-op). |
| 7478 | */ |
| 7479 | export function initCustomThemes(): void { |
| 7480 | const bridge = typeof window !== 'undefined' ? window.zen : undefined |
| 7481 | if (!bridge || typeof bridge.listCustomThemes !== 'function') return |
| 7482 | refreshCustomThemes() |
| 7483 | if (typeof bridge.onCustomThemesChange === 'function') { |
| 7484 | try { |
| 7485 | bridge.onCustomThemesChange(applyCustomThemes) |
| 7486 | } catch { |
| 7487 | /* ignore */ |
| 7488 | } |
| 7489 | } |
| 7490 | } |
| 7491 | |
| 7492 | let themeTweaksSaveTimer: ReturnType<typeof setTimeout> | null = null |
| 7493 | /** Debounce persistence of theme tweaks so dragging a color picker (which fires |
no test coverage detected