fix(showcase): render Badge/Card/Loader/Stack demos correctly + bump @civitai/* 0.2.0 - #23
Merged
Merged
Conversation
…@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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thecomponents 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/componentsrule lives in@layer civitai.components, andunlayered CSS beats a layer — so that reset zeroes every component border
inside
.cds-preview. The pre-existingall: revert-layerpreview fix onlycovered
[data-civitai-ui='button']+[data-civitai-ui-control], leaving thepresentational components stripped.
outlinehas no outline. Two causes: (a) the demobadges omitted
data-variant/data-size, and the published CSS appliespadding + fill only for an explicit variant/size; (b) the
outlineborder was zeroed by the Preflight reset. Fix: give every demo badge an
explicit
data-variant+data-size;revert-layerrestores the outlineborder.
outlineis a real Badge variant (not a package gap).data-with-bordershows no border. The1pxborder was zeroed bythe Preflight reset (card padding survived — border-specific). Fixed by the
broadened
revert-layer; the 0.2.0 bump additionally gives borderless cards asubtle default hairline.
didn't show direction or gap). Redesigned — see below.
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/componentscode bug — all are showcase-side(preview scoping + demo markup). One package doc/impl mismatch flagged, not
fixed here:
MARKUP.mddocumentsdata-variant: filled (default)anddata-size: md (default)for Badge, but the published CSS implements neitherdefault (a bare
<span data-civitai-ui="badge">— including MARKUP's own minimalexample — renders fully unstyled). Worth a follow-up package fix so the
documented defaults actually apply.
Fix
.vitepress/theme/design-system.css— broaden the previewall: revert-layerfrombutton+-controlto 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 explicitvariant+size; Card copyreflects 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.mjsgains 8 render-integrity assertions (lightand dark) that fail on the old build and pass on this one:
outlinevariant has a>=1pxprimary-colored border (not the reset
#e4e4e7).data-with-borderhas a non-zero, token-colored border (light + dark).>=6visible, non-transparent child chips.Verbatim result (all green):
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