feat(config): add configuration window (#70)

This commit is contained in:
2026-05-21 04:16:21 -07:00
committed by GitHub
parent a54f03f0cd
commit dc52bc2fba
287 changed files with 14507 additions and 8134 deletions
+34
View File
@@ -0,0 +1,34 @@
import type { ConfigSettingsSnapshotValue } from '../types/settings';
export function createElement<K extends keyof HTMLElementTagNameMap>(
tagName: K,
className?: string,
): HTMLElementTagNameMap[K] {
const element = document.createElement(tagName);
if (className) {
element.className = className;
}
return element;
}
export function addOption(select: HTMLSelectElement, value: string, label = value): void {
const option = createElement('option') as HTMLOptionElement;
option.value = value;
option.textContent = label;
select.append(option);
}
export function uniqueSorted(values: Iterable<string>): string[] {
return [...new Set([...values].filter(Boolean))].sort((a, b) => a.localeCompare(b));
}
export function isSecretSnapshotValue(
value: ConfigSettingsSnapshotValue,
): value is { configured: boolean } {
return Boolean(
value &&
typeof value === 'object' &&
'configured' in value &&
typeof (value as { configured?: unknown }).configured === 'boolean',
);
}