refactor(web): consolidate CSS ownership - #40
Merged
Conversation
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.
Summary
admin.css,admin-forms.css, andresponsive/mobile.csscascade dependenciesindex.cssimport-only andtokens.cssvariable/theme-token-onlyCloses #39.
Root cause
The original CSS architecture mixed component ownership with import-order ownership. The single entry point loaded
admin-forms.cssbeforeadmin.cssand loadedresponsive/mobile.csslast, while component dark rules also lived intokens.css. Equal-specificity declarations therefore depended on global source order, and higher-specificity dark selectors sometimes overrode later mobile rules.The refactor preserves those existing computed winners explicitly in the relevant owner instead of relying on unrelated files loading later. Examples include the mobile form padding, 360px two-column archive grid, dark mobile archive search background, dark admin sidebar states, and the currently ineffective admin-import result accent.
Ownership map
admin.css/tokens/mobileadmin-layout.cssadmin.css/mobileadmin-collections.cssadmin-projects.cssadmin-exhibitions.cssadmin-import.csscomponents/forms.cssadmin-project-editor.cssproject-submission.cssupload.csscomponents/feedback.cssarchive.cssproject.cssproject-modal.csshome-archive-landing.csssite-shell.cssindex.cssnow contains 25 imports and no declarations.tokens.csscontains only 31 custom properties pluscolor-scheme. Cross-file selector ownership duplicates are zero.Removed duplication and dead CSS
responsive/mobile.cssafter moving every live override to its owneradmin.cssandadmin-forms.cssownership model!important; the dropzone dashed border and member editor sizing now win through explicit owner-local selectors/orderhome-core.css,home-hero.css,home-sections.css,home-showcase.css,home-theme.css, and theirhome.cssaggregator after retaining the live landing selectors/tokensNavLink.active, mappedbadge--*, and dynamic export status classesThe directly managed CSS total decreases from 7,143 to 5,472 lines. The new files follow actual component/feature boundaries rather than a line-count target.
Preserved computed behavior
0.6rem 0.75rem; textareamin-height: 120px#131315.main--home:0 16px 014.72px / 26.496px; project-detail mobile prose remains distinct!importantValidation
npm test -w apps/web— 26 files, 111 tests passednpm run lint -w apps/web— passednpm run build -w apps/web— passedgit diff --check— passedfrom/toparser artifacts)!important— 0Visual regression
Compared latest-master baseline CSS with this branch on the same mock DOM/data in Chromium. The matrix covered home, years, archive, project detail, admin projects, and admin new form at exact
360×800,768×1024, and1280×800viewports in light and dark themes: 36 baseline/after pairs.All key computed styles and layout geometry matched. Most screenshots had zero differing pixels. A few light screenshots differed by 12–73 anti-aliased text pixels (at most about 0.015%) with no position, size, color, or border changes. Async form data was awaited and the affected six pairs were recaptured before comparison. Dark mode was forced with the existing
data-themehook because the UI toggle is currently inactive.An independent reviewer reran test/lint/build, duplicate/import/unused checks, the full visual matrix, and the targeted cascade assertions and returned Approve with no blocking findings.
GitHub Actions
verify— passedintegration— passed on failed-job rerunThe first integration attempt failed two unrelated
apps/apiPostgreSQL+Garage storage-recovery assertions even though this PR changes CSS only. The same API state had passed on the immediately preceding PR. No API or test code was changed; rerunning the failed job completed successfully.