fix: address config modal review feedback

This commit is contained in:
2026-05-17 18:23:22 -07:00
parent 7fb1e6d7a5
commit 6f48d4b65b
17 changed files with 333 additions and 43 deletions
+20 -4
View File
@@ -8,6 +8,7 @@ const CLICK_SEEK_OFFSET_SEC = 0.08;
const SNAPSHOT_POLL_INTERVAL_MS = 80;
const EMBEDDED_SIDEBAR_MIN_WIDTH_PX = 240;
const EMBEDDED_SIDEBAR_MAX_RATIO = 0.45;
const appliedSidebarCssKeys = new WeakMap<HTMLElement, Set<string>>();
function nowForUiTiming(): number {
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
@@ -55,22 +56,37 @@ function formatCueTimestamp(seconds: number): string {
return `${String(mins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
}
function applySidebarCssDeclarations(
export function applySidebarCssDeclarations(
target: HTMLElement,
declarations: Record<string, string>,
): void {
const targetStyle = (target as HTMLElement & { style?: CSSStyleDeclaration }).style;
if (!targetStyle) return;
const styleTarget = targetStyle as unknown as Record<string, string>;
const previousKeys = appliedSidebarCssKeys.get(target) ?? new Set<string>();
const nextKeys = new Set<string>();
for (const property of previousKeys) {
if (Object.prototype.hasOwnProperty.call(declarations, property)) continue;
if (property.includes('-')) {
targetStyle.removeProperty(property);
} else {
styleTarget[property] = '';
}
}
for (const [property, rawValue] of Object.entries(declarations)) {
const value = rawValue.trim();
if (value.length === 0) continue;
if (property.includes('-')) {
targetStyle.setProperty(property, value);
continue;
} else {
styleTarget[property] = value;
}
const styleTarget = targetStyle as unknown as Record<string, string>;
styleTarget[property] = value;
nextKeys.add(property);
}
appliedSidebarCssKeys.set(target, nextKeys);
}
export function findActiveSubtitleCueIndex(