Skip to content

fix(showcase): render Badge/Card/Loader/Stack demos correctly + bump @civitai/* 0.2.0 - #23

Merged
ZacxDev merged 1 commit into
mainfrom
zach/showcase-render-fixes
Jul 23, 2026
Merged

fix(showcase): render Badge/Card/Loader/Stack demos correctly + bump @civitai/* 0.2.0#23
ZacxDev merged 1 commit into
mainfrom
zach/showcase-render-fixes

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Four visual bugs a maintainer reported on the live design-system showcase
(developer.civitai.com/apps/showcase) — all invisible to the existing E2E,
which passed 21/21 while these shipped because it asserted only
background / radius / font, never padding / border / rendered-size. Also
bumps the showcase's @civitai/* pins 0.1.2 → 0.2.0 and adds demos for the
components 0.2.0 introduces (Select / Checkbox / Radio).

Root cause per bug (inspected in a headless build, not guessed)

Shared root cause for 3 of the 4 — a stripped border. Tailwind Preflight,
pulled in transitively by vitepress-openapi, ships an UNLAYERED
*,::before,::after { border-width:0; border-style:solid; border-color:#e4e4e7 }.
Every @civitai/components rule lives in @layer civitai.components, and
unlayered CSS beats a layer — so that reset zeroes every component border
inside .cds-preview
. The pre-existing all: revert-layer preview fix only
covered [data-civitai-ui='button'] + [data-civitai-ui-control], leaving the
presentational components stripped.

  1. Badge — no padding + outline has no outline. Two causes: (a) the demo
    badges omitted data-variant / data-size, and the published CSS applies
    padding + fill only for an explicit variant/size; (b) the outline
    border was zeroed by the Preflight reset. Fix: give every demo badge an
    explicit data-variant + data-size; revert-layer restores the outline
    border. outline is a real Badge variant (not a package gap).
  2. Card data-with-border shows no border. The 1px border was zeroed by
    the Preflight reset (card padding survived — border-specific). Fixed by the
    broadened revert-layer; the 0.2.0 bump additionally gives borderless cards a
    subtle default hairline.
  3. Stack/Group demos too basic. Pure demo weakness (badges/buttons as filler
    didn't show direction or gap). Redesigned — see below.
  4. Loader demo empty. The spinner is a CSS border ring; the Preflight
    reset zeroed its border-width, so it rendered as a 0-width invisible circle
    (the box had size, just no ring). Fixed by the broadened revert-layer.

None of the four is a @civitai/components code bug — all are showcase-side
(preview scoping + demo markup). One package doc/impl mismatch flagged, not
fixed here:
MARKUP.md documents data-variant: filled (default) and
data-size: md (default) for Badge, but the published CSS implements neither
default (a bare <span data-civitai-ui="badge"> — including MARKUP's own minimal
example — renders fully unstyled). Worth a follow-up package fix so the
documented defaults actually apply.

Fix

  • .vitepress/theme/design-system.css — broaden the preview
    all: revert-layer from button+-control to every [data-civitai-ui]
    (still .cds-preview-scoped; the VitePress chrome has no [data-civitai-ui]
    and is untouched — asserted by the existing chrome-non-regression checks).
  • apps/showcase.md — Badge rows carry explicit variant+size; Card copy
    reflects 0.2.0's default hairline vs explicit border; Stack/Group redesigned
    with numbered filled chips laid out vertically (Stack) vs horizontally (Group)
    with clear labels + visible gap; added Select / Checkbox / Radio+RadioGroup
    demos; pin reference → 0.2.0.
  • package.json / lockfile@civitai/{components,components-react,theme}
    0.1.2 → 0.2.0.

New E2E coverage (closes the gap)

scripts/test-showcase-e2e.mjs gains 8 render-integrity assertions (light
and dark) that fail on the old build and pass on this one:

  • Badge has non-zero horizontal padding; outline variant has a >=1px
    primary-colored border (not the reset #e4e4e7).
  • Card data-with-border has a non-zero, token-colored border (light + dark).
  • Loader preview renders a non-empty box and a non-zero ring border.
  • Stack/Group demo contains >=6 visible, non-transparent child chips.

Verbatim result (all green):

Showcase E2E: 29 checks · 29 passed · 0 failed   (was 21; snippet accuracy now 12 demos)
App Blocks snippets: 21 found · 21 passed · 0 skipped · 0 failed
TokenGallery drift: 27 exported · 27 rendered — ✓ matches @civitai/theme exactly

Verified

Reproduced all four bugs on the pre-fix build and confirmed each fixed on the
post-fix build via headless Chromium, light + dark: Badge → padded pills with
a visible outline + solid intent colors; Card → both cards bordered; Loader → four
visible spinner rings (was blank); Stack/Group → obvious vertical-vs-horizontal
numbered chips.

🤖 Generated with Claude Code

…@civitai/* 0.2.0

The live design-system showcase (developer.civitai.com/apps/showcase) had four
visual bugs the existing 21/21 E2E never caught (it asserted only background /
radius / font, never padding / border / rendered-size).

Root cause (two independent issues):
- Tailwind Preflight, pulled in transitively by `vitepress-openapi`, ships an
  UNLAYERED `*,::before,::after { border-width:0; border-style:solid }`. Every
  @civitai/components rule lives in `@layer civitai.components`, so that unlayered
  reset WINS and ZEROES all component borders inside `.cds-preview`. The existing
  `all: revert-layer` fix only covered `button` + `-control`, leaving badge /
  card / loader / alert borders stripped → invisible Card `data-with-border`,
  empty Loader (its spinner ring IS a border), no Badge `outline`.
  Fix: broaden the preview `all: revert-layer` scope to every `[data-civitai-ui]`.
- The Badge demo omitted `data-variant` / `data-size`; the published CSS applies
  padding + fill only for explicit variant/size (the MARKUP-documented "md"/
  "filled" defaults are NOT implemented in the CSS — a package doc/impl gap,
  reported separately). Fix: give every demo badge an explicit variant + size.

Changes:
- design-system.css: `all: revert-layer` now covers all `[data-civitai-ui]`
  (still `.cds-preview`-scoped; chrome untouched — asserted by the E2E).
- showcase.md: Badge rows carry explicit variant+size; Card copy reflects the
  0.2.0 default hairline vs explicit border; Stack/Group redesigned with numbered
  filled chips that make vertical-vs-horizontal + gap obvious at a glance; add
  Select / Checkbox / Radio+RadioGroup demos (new in 0.2.0); pin ref → 0.2.0.
- Bump @civitai/{components,components-react,theme} 0.1.2 → 0.2.0 (adds the Card
  default hairline + the new form components).
- test-showcase-e2e.mjs: +8 render-integrity assertions (light+dark) that would
  have caught these — Badge non-zero padding + visible outline border, Card
  `data-with-border` non-zero border, Loader non-empty ring, Stack/Group visible
  child chips. 29/29 green; snippet typecheck 21/21; token drift clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ZacxDev
ZacxDev merged commit 2310b3c into main Jul 23, 2026
7 checks passed
@ZacxDev
ZacxDev deleted the zach/showcase-render-fixes branch July 23, 2026 19:16
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.

1 participant