Files
Auto_Bangumi/webui/unocss.config.ts
Estrella Pan 6c6425d033 fix(webui): address code-review findings before beta
- Nest ab-edit-rule's delete confirmation inside the main ab-modal so
  headlessui suspends the outer dialog's Escape/outside-click while the
  inner one is open (clicking the delete-files checkbox no longer
  closes both layers); regression-tested with a nested-modal vitest.
- Restore autocomplete passthrough (ab-input prop + ab-setting wiring)
  so downloader/proxy password fields keep autocomplete=off.
- Guarantee 44px touch targets for ab-button sm on touch; repoint or
  remove the dead .n-button deep selectors in wizard/config/downloader/
  log left over from the sweep.
- a11y labels: modal X and search closes announce 'Close', tag remove
  announces 'Remove' (new common.close/common.remove i18n pairs);
  ab-field renders label[for] only when the control adopts the id,
  span + aria-labelledby otherwise.
- Convert the last NPopconfirms (passkey/search-provider/update-card)
  to useConfirm with danger icon buttons; drop legacy
  .notification-action CSS that fought ab-button variants.
- Fix missing homepage.rule.offset key (→ episode_offset), normalize
  test names to the should-convention, run prettier over the branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FAxVyRwrY7z5NotTtgnwVs
2026-07-06 12:38:23 +02:00

140 lines
3.2 KiB
TypeScript

import {
defineConfig,
presetAttributify,
presetIcons,
presetUno,
} from 'unocss';
import presetRemToPx from '@unocss/preset-rem-to-px';
export default defineConfig({
presets: [
presetUno({
dark: 'class',
}),
presetRemToPx({
baseFontSize: 4,
}),
presetAttributify(),
presetIcons({ cdn: 'https://esm.sh/' }),
],
preflights: [
{
getCSS: () => `
:root {
font-size: 4px;
}
body {
font-size: 4rem;
}
`,
},
],
theme: {
breakpoints: {
sm: '640px',
pc: '1024px',
},
colors: {
// Semantic colors via CSS variables (support light/dark)
primary: 'var(--color-primary)',
'primary-hover': 'var(--color-primary-hover)',
'primary-light': 'var(--color-primary-light)',
accent: 'var(--color-accent)',
success: 'var(--color-success)',
danger: 'var(--color-danger)',
warning: 'var(--color-warning)',
surface: 'var(--color-surface)',
'surface-hover': 'var(--color-surface-hover)',
'surface-2': 'var(--color-surface-2)',
'text-primary': 'var(--color-text)',
'text-secondary': 'var(--color-text-secondary)',
'text-muted': 'var(--color-text-muted)',
border: 'var(--color-border)',
'border-hover': 'var(--color-border-hover)',
page: 'var(--color-bg)',
// Legacy aliases (for gradual migration)
running: 'var(--color-success)',
stopped: 'var(--color-danger)',
},
},
rules: [
[
'bg-theme-row',
{
background:
'linear-gradient(90.5deg, var(--color-primary) 1.53%, var(--color-primary-hover) 96.48%)',
},
],
[
'bg-theme-col',
{
background:
'linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-hover) 100%)',
},
],
[
'poster-shandow',
{
filter:
'drop-shadow(2px 2px 2px var(--shadow-color, rgba(0, 0, 0, 0.1)))',
},
],
[
'poster-pen-active',
{
background: 'var(--color-primary-light)',
'box-shadow': '2px 2px 4px var(--shadow-color, rgba(0, 0, 0, 0.25))',
},
],
// Shadows
['shadow-sm', { 'box-shadow': 'var(--shadow-sm)' }],
['shadow-md', { 'box-shadow': 'var(--shadow-md)' }],
['shadow-lg', { 'box-shadow': 'var(--shadow-lg)' }],
],
shortcuts: [
[/^wh-(.*)$/, ([, t]) => `w-${t} h-${t}`],
[/^text-limit-(\d{0,})$/, ([, n]) => `line-clamp-${n}`],
// position
{
rel: 'relative',
abs: 'absolute',
},
// flex
{
'fx-cer': 'flex items-center',
'f-cer': 'flex items-center justify-center',
},
// font size
{
'text-h1': 'text-24',
'text-h2': 'text-20',
'text-h3': 'text-16',
'text-main': 'text-12',
'text-body': 'text-14',
'text-sm': 'text-12',
'text-xs': 'text-10',
},
// input
{
'input-reset': 'bg-transparent min-w-0 flex-1 outline-none',
},
// status
{
'is-btn': 'cursor-pointer select-none',
'btn-click': 'hover:scale-110 active:scale-100',
'is-disabled': 'cursor-not-allowed select-none opacity-50',
},
// other
{
line: 'w-full h-1 bg-border',
},
],
});