Files
KohakuHub/scripts/dev
narugo1992 fcfa6f9383 fix(ui/tar-thumbnail): fit-don't-crop + match grid-card width, add flat-images seed
Visual feedback after wiring up the lazy thumbnails:

- The container used `object-cover`, which center-cropped the
  preview. Switched to `object-contain` so the full image fits
  inside the square area (letterboxed when not square). Drops
  the "interesting bit got cut off" surprise on tall illustrations.

- The grid-card thumbnail used a fixed 56-px wrapper, so the image
  was always smaller than the card. Now the wrapper auto-stretches
  to the card's inner width via `aspect-square w-full`, and the
  image inside uses `w-full h-full object-contain` so the bitmap
  scales up to the card edges with proper letterboxing.

- Bumped THUMB_MAX_DIM from 128 → 256 px (and quality 0.7 → 0.78).
  At 128 px the rendered <img> still showed an empty halo inside
  the larger grid card (a 128-px source can't fill a 200+ px slot
  without being upscaled). 256 px keeps caches small (~25 KB per
  thumbnail) while feeding the larger grid layout.

- List-view fixed-size mode also bumped from 28 → 48 px so the
  thumbnail is actually identifiable at a glance.

- Component now exposes a no-`size`-prop "auto" mode that the
  panel uses for grid view (parent picks the width); the explicit
  pixel size mode is retained for list rows.

Seed:

- New `archives/gallery/flat-images.tar` + sidecar carrying all 24
  Danbooru showcase images flat at the tar root. Lives next to
  `bundle.tar` so a single folder visit produces a long
  scroll-driven listing — the right shape for hand-checking the
  IntersectionObserver lazy-load + concurrency-pool drain
  behaviour. SEED_VERSION → v7.

Visual verification: drove Chromium via Playwright through the
flat-images.tar listing (list mode + grid mode + toggle off);
24/24 thumbnails load, fill the squares without cropping, and the
toggle correctly reverts every row to the placeholder icon.

UI suite remains 366/40 green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 20:32:52 +08:00
..
2026-04-21 12:50:30 +08:00