fix(json-render-ui): add the missing CSS reset to the SPA and Storybook - #284
Open
SaKaNa-Y wants to merge 1 commit into
Open
fix(json-render-ui): add the missing CSS reset to the SPA and Storybook#284SaKaNa-Y wants to merge 1 commit into
SaKaNa-Y wants to merge 1 commit into
Conversation
`btn-action` / `btn-action-sm` (what `Button.ts` maps the `secondary` and
`ghost` variants onto) set a border and `op75` but no base
`background-color` — only one on `:hover`. Without a CSS reset the UA
default `button { background-color: buttonface }` therefore wins, and every
non-primary button renders as a solid light-grey box on the dark canvas.
`scripts/build-css.ts` prepends `@unocss/reset/tailwind.css` to the
shadow-root stylesheet, so the dock renderer was never affected. The two
light-DOM surfaces have to import the reset themselves and neither did:
the shipped SPA bundle and the Storybook canvas both contained zero reset
rules (`-webkit-appearance:button`, `background-image:none`,
`box-sizing:border-box` all absent from the built CSS).
`packages/hub-ui/.storybook/preview.ts` already does exactly this, with a
comment describing the same symptom; `json-render-ui` simply never got the
same line. `hub-ui` ships no light-DOM SPA, so it is not affected.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
Problem
btn-action/btn-action-sm— whatButton.tsmaps thesecondaryandghostvariants onto — set a border andop75but no basebackground-color, only one on:hover:That is correct only if a CSS reset has neutralised the UA's
button { background-color: buttonface }. Without one, the browser default wins and every non-primary button renders as a solid light-grey box with dark text on the dark canvas.design/build-shadow-css.tsprepends@unocss/reset/tailwind.cssto the shadow-root stylesheet, so the dock renderer was never affected — which is why this went unnoticed. The two light-DOM surfaces have to import the reset themselves, and neither did.Evidence
Reset markers present in each pipeline's built CSS, before this change:
-webkit-appearance:buttonbackground-image:nonebox-sizing:border-boxsrc/.generated/css.ts)dist/spa/assets/*.css)iframe-*.css)After this change all three rows read
1.Note the middle row: this affects the shipped SPA bundle, not just the Storybook canvas.
Prior art in this repo
packages/hub-ui/.storybook/preview.tsalready does exactly this, and its comment describes this precise symptom:json-render-uisimply never got the same line.@unocss/resetis already in the catalog (pnpm-workspace.yaml:155) and already declared by the rootpackage.jsonand byhub-ui; this adds the third declaration.hub-uiitself is not affected — it ships no light-DOM SPA (virtual:uno.cssappears only in its Storybook preview), so its two surfaces both already have the reset.Changes
src/spa/main.ts— import@unocss/reset/tailwind.cssbeforevirtual:uno.css, matching the shadow build's[reset, userStyle, unoCss]order, with the rationale inline..storybook/preview.ts— same import, pointing at the SPA entry for the explanation.package.json— declare@unocss/reset: catalog:frontendrather than relying on transitive hoisting.JsonRender.stories.ts— comment onInShadowRootnoting it rendersgallerySpecand should therefore look the same asGallery; divergence means a pipeline drifted. The two stories now act as a cheap visual regression pair.Verification
tsc --noEmitpasses;eslintclean on all changed files.pnpm install --frozen-lockfilepasses; the lockfile diff is three lines (the added dependency) and nothing else.before:
now: