mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 12:55:16 -07:00
style: format config settings changes
This commit is contained in:
@@ -350,9 +350,7 @@ export function applySubtitleDomainConfig(context: ResolveContext): void {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nPlusOneColor = asColor(
|
const nPlusOneColor = asColor((src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor);
|
||||||
(src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor,
|
|
||||||
);
|
|
||||||
if (nPlusOneColor !== undefined) {
|
if (nPlusOneColor !== undefined) {
|
||||||
resolved.subtitleStyle.nPlusOneColor = nPlusOneColor;
|
resolved.subtitleStyle.nPlusOneColor = nPlusOneColor;
|
||||||
} else if ((src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor !== undefined) {
|
} else if ((src.subtitleStyle as { nPlusOneColor?: unknown }).nPlusOneColor !== undefined) {
|
||||||
|
|||||||
@@ -199,8 +199,7 @@ test('subtitleStyle nPlusOneColor accepts valid values and warns on invalid', ()
|
|||||||
assert.ok(
|
assert.ok(
|
||||||
invalid.warnings.some(
|
invalid.warnings.some(
|
||||||
(warning) =>
|
(warning) =>
|
||||||
warning.path === 'subtitleStyle.nPlusOneColor' &&
|
warning.path === 'subtitleStyle.nPlusOneColor' && warning.message === 'Expected hex color.',
|
||||||
warning.message === 'Expected hex color.',
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,13 +80,7 @@ const JSON_OBJECT_FIELDS = new Set([
|
|||||||
|
|
||||||
const SECRET_PATHS = new Set(['ai.apiKey', 'jimaku.apiKey', 'anilist.accessToken']);
|
const SECRET_PATHS = new Set(['ai.apiKey', 'jimaku.apiKey', 'anilist.accessToken']);
|
||||||
|
|
||||||
const COLOR_SUFFIXES = new Set([
|
const COLOR_SUFFIXES = new Set(['Color', 'color', 'backgroundColor', 'singleColor', 'nPlusOne']);
|
||||||
'Color',
|
|
||||||
'color',
|
|
||||||
'backgroundColor',
|
|
||||||
'singleColor',
|
|
||||||
'nPlusOne',
|
|
||||||
]);
|
|
||||||
|
|
||||||
const OPTION_BY_PATH = new Map(CONFIG_OPTION_REGISTRY.map((entry) => [entry.path, entry]));
|
const OPTION_BY_PATH = new Map(CONFIG_OPTION_REGISTRY.map((entry) => [entry.path, entry]));
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export function isSecretSnapshotValue(
|
|||||||
): value is { configured: boolean } {
|
): value is { configured: boolean } {
|
||||||
return Boolean(
|
return Boolean(
|
||||||
value &&
|
value &&
|
||||||
typeof value === 'object' &&
|
typeof value === 'object' &&
|
||||||
'configured' in value &&
|
'configured' in value &&
|
||||||
typeof (value as { configured?: unknown }).configured === 'boolean',
|
typeof (value as { configured?: unknown }).configured === 'boolean',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,9 @@ function renderField(field: ConfigSettingsField): HTMLElement {
|
|||||||
header.append(label, description, createFieldMeta(field));
|
header.append(label, description, createFieldMeta(field));
|
||||||
|
|
||||||
const controlWrap = createElement('div', 'field-control');
|
const controlWrap = createElement('div', 'field-control');
|
||||||
controlWrap.append(renderControl(field, { setFieldError, updateDraft, valueForField, valueForPath }));
|
controlWrap.append(
|
||||||
|
renderControl(field, { setFieldError, updateDraft, valueForField, valueForPath }),
|
||||||
|
);
|
||||||
const resetButton = createElement('button', 'reset-button') as HTMLButtonElement;
|
const resetButton = createElement('button', 'reset-button') as HTMLButtonElement;
|
||||||
resetButton.type = 'button';
|
resetButton.type = 'button';
|
||||||
resetButton.textContent = 'Reset';
|
resetButton.textContent = 'Reset';
|
||||||
|
|||||||
@@ -87,10 +87,7 @@ export interface ConfigSettingsAPI {
|
|||||||
openSettingsFile(): Promise<boolean>;
|
openSettingsFile(): Promise<boolean>;
|
||||||
openSettingsWindow(): Promise<boolean>;
|
openSettingsWindow(): Promise<boolean>;
|
||||||
getAnkiDeckNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
getAnkiDeckNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
||||||
getAnkiDeckFieldNames(
|
getAnkiDeckFieldNames(deckName: string, draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
||||||
deckName: string,
|
|
||||||
draftUrl?: string,
|
|
||||||
): Promise<ConfigSettingsAnkiListResult>;
|
|
||||||
getAnkiModelNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
getAnkiModelNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
||||||
getAnkiModelFieldNames(
|
getAnkiModelFieldNames(
|
||||||
modelName: string,
|
modelName: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user