Multi-value genres for FLAC/Ogg/MP4, readable tinted and error text, no missing-track seeds #143

Merged
bvandeusen merged 5 commits from dev into main 2026-10-07 23:53:09 -04:00
12 changed files with 56 additions and 21 deletions
Showing only changes of commit 743b6f5eac - Show all commits
+22 -1
View File
@@ -64,6 +64,27 @@ export function findCss(source) {
return found; return found;
} }
// Hues that fail AA as text even on a plain surface, so the raw hue is never
// text at all: error measures 2.64:1 on slate and 3.23 on iron in dark mode,
// against 4.5; error-fg measures 5.30 at worst. A border or outline in the
// hue is a graphic with a 3:1 floor and stays allowed.
export const TEXT_NEVER_RAW = ['error'];
/** Raw text-X classes and color: var(--fs-X) for the hues above. */
export function findRawText(source) {
const found = [];
for (const hue of TEXT_NEVER_RAW) {
const patterns = [
[new RegExp(`(?<=^|[\\s'"\`:])text-${hue}(?=$|[\\s'"\`=])`, 'g'), `text-${hue}-fg`],
[new RegExp(`(?<![-\\w])color\\s*:\\s*var\\(--fs-${hue}\\)`, 'g'), `var(--fs-${HUES[hue]})`]
];
for (const [re, fix] of patterns) {
for (const m of source.matchAll(re)) found.push({ hue, index: m.index, fix });
}
}
return found;
}
function lineOf(source, index) { function lineOf(source, index) {
return source.slice(0, index).split('\n').length; return source.slice(0, index).split('\n').length;
} }
@@ -81,7 +102,7 @@ export function scan(root, base = root) {
const out = []; const out = [];
for (const path of walk(root)) { for (const path of walk(root)) {
const source = readFileSync(path, 'utf8'); const source = readFileSync(path, 'utf8');
for (const f of [...findTailwind(source), ...findCss(source)]) { for (const f of [...findTailwind(source), ...findCss(source), ...findRawText(source)]) {
out.push(`${relative(base, path)}:${lineOf(source, f.index)} ${f.hue} → ${f.fix}`); out.push(`${relative(base, path)}:${lineOf(source, f.index)} ${f.hue} → ${f.fix}`);
} }
} }
+15 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, test } from 'vitest'; import { describe, expect, test } from 'vitest';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path'; import { dirname, resolve } from 'node:path';
import { findCss, findTailwind, scan } from './check-tint-contrast.js'; import { findCss, findRawText, findTailwind, scan } from './check-tint-contrast.js';
const web = resolve(dirname(fileURLToPath(import.meta.url)), '..'); const web = resolve(dirname(fileURLToPath(import.meta.url)), '..');
@@ -35,6 +35,20 @@ describe('hue-on-own-tint check (#3150)', () => {
}); });
}); });
describe('raw error text, on any surface', () => {
test('finds text-error, class:text-error and color: var(--fs-error)', () => {
expect(findRawText(`<p class="text-sm text-error">x</p>`)).toHaveLength(1);
expect(findRawText(`<div class:text-error={bad}>`)).toHaveLength(1);
expect(findRawText(`.msg { color: var(--fs-error); }`)[0].fix).toBe('var(--fs-error-fg)');
});
test('passes error-fg, and error as a border or outline', () => {
expect(findRawText(`<p class="text-error-fg">x</p>`)).toEqual([]);
expect(findRawText(`<div class="border-error" class:border-error={bad}>`)).toEqual([]);
expect(findRawText(`.a { border-color: var(--fs-error); outline-color: var(--fs-error); }`)).toEqual([]);
});
});
describe('CSS', () => { describe('CSS', () => {
const tinted = (color) => const tinted = (color) =>
`.pill { background: color-mix(in srgb, var(--fs-warning) 15%, transparent); ${color} }`; `.pill { background: color-mix(in srgb, var(--fs-warning) 15%, transparent); ${color} }`;
+1 -1
View File
@@ -79,7 +79,7 @@
></textarea> ></textarea>
</label> </label>
{#if error} {#if error}
<p class="mt-2 text-xs text-error">Couldn't save flag — {error}</p> <p class="mt-2 text-xs text-error-fg">Couldn't save flag — {error}</p>
{/if} {/if}
<div class="mt-3 flex justify-end gap-2"> <div class="mt-3 flex justify-end gap-2">
<button <button
+1 -1
View File
@@ -15,7 +15,7 @@
class:border-border={toast.value.variant === 'info'} class:border-border={toast.value.variant === 'info'}
class:text-text-primary={toast.value.variant === 'info'} class:text-text-primary={toast.value.variant === 'info'}
class:border-error={toast.value.variant === 'error'} class:border-error={toast.value.variant === 'error'}
class:text-error={toast.value.variant === 'error'} class:text-error-fg={toast.value.variant === 'error'}
> >
{toast.value.message} {toast.value.message}
</div> </div>
@@ -325,7 +325,7 @@
<!-- Timeline --> <!-- Timeline -->
{#if diagQuery.isError} {#if diagQuery.isError}
<p class="text-error">Couldn't load: {errMessage(diagQuery.error)}</p> <p class="text-error-fg">Couldn't load: {errMessage(diagQuery.error)}</p>
{:else if diagQuery.isPending} {:else if diagQuery.isPending}
<p class="text-text-secondary">Loading…</p> <p class="text-text-secondary">Loading…</p>
{:else if rows.length === 0} {:else if rows.length === 0}
+1 -1
View File
@@ -188,7 +188,7 @@
{#if query.isPending} {#if query.isPending}
<p class="text-text-secondary">Loading duplicates…</p> <p class="text-text-secondary">Loading duplicates…</p>
{:else if query.isError} {:else if query.isError}
<p class="text-error">Couldn't load the duplicates report.</p> <p class="text-error-fg">Couldn't load the duplicates report.</p>
{:else if groups.length === 0} {:else if groups.length === 0}
<!-- Three states all show zero groups and mean different things. Telling <!-- Three states all show zero groups and mean different things. Telling
them apart is what stops an empty page reading as a broken feature. --> them apart is what stops an empty page reading as a broken feature. -->
@@ -463,7 +463,7 @@
{/each} {/each}
</select> </select>
{#if testListErrors.quality_profiles} {#if testListErrors.quality_profiles}
<p class="mt-1 text-xs text-error"> <p class="mt-1 text-xs text-error-fg">
Couldn't fetch quality profiles — {testListErrors.quality_profiles} Couldn't fetch quality profiles — {testListErrors.quality_profiles}
</p> </p>
{/if} {/if}
@@ -481,7 +481,7 @@
{/each} {/each}
</select> </select>
{#if testListErrors.metadata_profiles} {#if testListErrors.metadata_profiles}
<p class="mt-1 text-xs text-error"> <p class="mt-1 text-xs text-error-fg">
Couldn't fetch metadata profiles — {testListErrors.metadata_profiles} Couldn't fetch metadata profiles — {testListErrors.metadata_profiles}
</p> </p>
{/if} {/if}
@@ -501,7 +501,7 @@
{/each} {/each}
</select> </select>
{#if testListErrors.root_folders} {#if testListErrors.root_folders}
<p class="mt-1 text-xs text-error"> <p class="mt-1 text-xs text-error-fg">
Couldn't fetch root folders — {testListErrors.root_folders} Couldn't fetch root folders — {testListErrors.root_folders}
</p> </p>
{/if} {/if}
@@ -513,11 +513,11 @@
Connected — Lidarr {testResult.version} Connected — Lidarr {testResult.version}
</p> </p>
{:else} {:else}
<p class="text-sm text-error">Connection failed — {testResult.error}</p> <p class="text-sm text-error-fg">Connection failed — {testResult.error}</p>
{/if} {/if}
{/if} {/if}
{#if saveError} {#if saveError}
<p class="text-sm text-error">Save failed — {saveError}</p> <p class="text-sm text-error-fg">Save failed — {saveError}</p>
{/if} {/if}
<div class="flex items-center gap-2 pt-2"> <div class="flex items-center gap-2 pt-2">
@@ -625,7 +625,7 @@
OK{coverTestResults[provider.id].duration_ms ? ` (${coverTestResults[provider.id].duration_ms}ms)` : ''} OK{coverTestResults[provider.id].duration_ms ? ` (${coverTestResults[provider.id].duration_ms}ms)` : ''}
</p> </p>
{:else} {:else}
<p class="text-sm text-error"> <p class="text-sm text-error-fg">
Failed — {coverTestResults[provider.id].error} Failed — {coverTestResults[provider.id].error}
</p> </p>
{/if} {/if}
@@ -722,7 +722,7 @@
OK{tagTestResults[provider.id].duration_ms ? ` (${tagTestResults[provider.id].duration_ms}ms)` : ''} OK{tagTestResults[provider.id].duration_ms ? ` (${tagTestResults[provider.id].duration_ms}ms)` : ''}
</p> </p>
{:else} {:else}
<p class="text-sm text-error"> <p class="text-sm text-error-fg">
Failed — {tagTestResults[provider.id].error} Failed — {tagTestResults[provider.id].error}
</p> </p>
{/if} {/if}
@@ -837,7 +837,7 @@
class="mt-3 w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent" class="mt-3 w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent"
/> />
{#if disconnectError} {#if disconnectError}
<p class="mt-2 text-sm text-error">Disconnect failed — {disconnectError}</p> <p class="mt-2 text-sm text-error-fg">Disconnect failed — {disconnectError}</p>
{/if} {/if}
<div class="mt-5 flex justify-end gap-2"> <div class="mt-5 flex justify-end gap-2">
<button <button
@@ -74,7 +74,7 @@
{#if query.isPending} {#if query.isPending}
<p class="text-text-secondary">Checking what's missing…</p> <p class="text-text-secondary">Checking what's missing…</p>
{:else if query.isError} {:else if query.isError}
<p class="text-error">Couldn't load the missing-files list.</p> <p class="text-error-fg">Couldn't load the missing-files list.</p>
{:else if groups.length === 0} {:else if groups.length === 0}
<!-- Empty state explains the feature, not just the emptiness: an operator <!-- Empty state explains the feature, not just the emptiness: an operator
who has never seen this page shouldn't have to guess what would put a who has never seen this page shouldn't have to guess what would put a
@@ -197,7 +197,7 @@
</div> </div>
{#if query.isError} {#if query.isError}
<p class="text-error">Couldn't load: {errMessage(query.error)}</p> <p class="text-error-fg">Couldn't load: {errMessage(query.error)}</p>
{:else if query.isPending} {:else if query.isPending}
<p class="text-text-secondary">Loading…</p> <p class="text-text-secondary">Loading…</p>
{:else if rows.length === 0} {:else if rows.length === 0}
+2 -2
View File
@@ -163,7 +163,7 @@
{#if query.isPending} {#if query.isPending}
<p class="text-text-secondary">Reading the queue…</p> <p class="text-text-secondary">Reading the queue…</p>
{:else if query.isError} {:else if query.isError}
<p class="text-error">Couldn't load the quarantine queue.</p> <p class="text-error-fg">Couldn't load the quarantine queue.</p>
{:else if rows.length === 0} {:else if rows.length === 0}
<p class="text-text-secondary">Nothing to triage right now.</p> <p class="text-text-secondary">Nothing to triage right now.</p>
{:else} {:else}
@@ -356,7 +356,7 @@
/> />
</label> </label>
{#if deleteLidarrError} {#if deleteLidarrError}
<p class="mt-3 text-sm text-error" data-testid="delete-lidarr-error"> <p class="mt-3 text-sm text-error-fg" data-testid="delete-lidarr-error">
{deleteLidarrError} {deleteLidarrError}
</p> </p>
{/if} {/if}
+1 -1
View File
@@ -198,7 +198,7 @@
{#if query.isPending} {#if query.isPending}
<p class="text-text-secondary">Reading the queue…</p> <p class="text-text-secondary">Reading the queue…</p>
{:else if query.isError} {:else if query.isError}
<p class="text-error">Couldn't load requests.</p> <p class="text-error-fg">Couldn't load requests.</p>
{:else if rows.length === 0} {:else if rows.length === 0}
<p class="text-text-secondary">Nothing here.</p> <p class="text-text-secondary">Nothing here.</p>
{:else} {:else}
+2 -2
View File
@@ -229,7 +229,7 @@
{#if usersQuery.isPending} {#if usersQuery.isPending}
<p class="text-text-secondary">Reading users…</p> <p class="text-text-secondary">Reading users…</p>
{:else if usersQuery.isError} {:else if usersQuery.isError}
<p class="text-error">Couldn't load users.</p> <p class="text-error-fg">Couldn't load users.</p>
{:else if users.length === 0} {:else if users.length === 0}
<p class="text-text-secondary">No users yet.</p> <p class="text-text-secondary">No users yet.</p>
{:else} {:else}
@@ -318,7 +318,7 @@
{#if invitesQuery.isPending} {#if invitesQuery.isPending}
<p class="text-text-secondary">Reading invites…</p> <p class="text-text-secondary">Reading invites…</p>
{:else if invitesQuery.isError} {:else if invitesQuery.isError}
<p class="text-error">Couldn't load invites.</p> <p class="text-error-fg">Couldn't load invites.</p>
{:else if invites.length === 0} {:else if invites.length === 0}
<p class="text-sm text-text-secondary">No active invites.</p> <p class="text-sm text-text-secondary">No active invites.</p>
{:else} {:else}