Skip to content

feat(capture): capture box-shadows by computed style, not class-name selectors - #1883

Closed
xuanruli wants to merge 1 commit into
mainfrom
feat/capture-shadow-by-computed-style
Closed

xuanruli wants to merge 1 commit into
mainfrom
feat/capture-shadow-by-computed-style

Conversation

@xuanruli

@xuanruli xuanruli commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The shadow sampler in designStyleExtractor.ts selected elements by class-name substring ([class*='card'], button, [class*='panel'], …). Sites with obfuscated / utility class names carry their card elevation on plain divs that never match those selectors, so shadows: [] came back empty — and the showcase renderer then faked a heavy 0 10px 34px Material drop shadow, the opposite of e.g. Vercel's near-invisible hairline. (Surfaced by reviewers on Stripe + Vercel.)

Fix

Sweep a broad structural set of visible, card-sized boxes and collect their real computed box-shadow; the shadow that recurs on the most boxes is the brand's elevation signature. Skips tiny (icon/inline) elements and full-bleed page wrappers so a body/section shadow can't win.

Verified (live re-capture)

  • Stripe: [] → 5 shadows, incl. the signature rgba(50, 50, 93, 0.12) 0 16px 32px
  • Vercel: [] → 3
  • oxlint/oxfmt clean, bun run build ✓, vitest run src/capture/ 54/54

Output shape unchanged (shadows: Array<{value, count}>), backward compatible. Follow-ups (separate): cards: [] shares the same class-selector root cause; ElevenLabs glass/aura live on pseudo-elements/canvas.

🤖 Generated with Claude Code

…selectors

The shadow sampler selected elements by class-name substring ([class*='card'], …).
Sites with obfuscated / utility class names (Stripe, Vercel) carry their card elevation
on plain divs that never matched, so `shadows: []` and the renderer faked a heavy
off-brand drop shadow. Now sweep a broad structural set of visible, card-sized boxes and
collect their real computed box-shadow; the shadow recurring on the most boxes is the
brand's elevation signature. Skips tiny (icon/inline) and full-bleed page wrappers.

Verified by live re-capture: Stripe [] -> 5 shadows (incl. the signature
rgba(50,50,93,0.12) 0 16px 32px), Vercel [] -> 3.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

xuanruli commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@jrusso1020

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! Computed-style shadow capture is now merged in #3686, with credit to you. The refreshed fix also preserves existing button/header samples and adds browser regression coverage. Closing this older PR as superseded.

@jrusso1020 jrusso1020 closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants