feat(View): support inset="center" for both-axis centering#652
Open
blvdmitry wants to merge 1 commit into
Open
feat(View): support inset="center" for both-axis centering#652blvdmitry wants to merge 1 commit into
blvdmitry wants to merge 1 commit into
Conversation
PR #650 added the "center" keyword to insetInline/insetBlock for single-axis centering. This extends it to the all-sides `inset` prop so `inset="center"` centers an absolutely positioned element on both axes without manual CSS transforms. The all-sides `inset` resolver is now sugar for insetting both axes: it emits the same per-axis inline/block classes and variables, letting "center" reuse the existing centering classes for both directions. The now-dead all-sides `inset` rule is removed from inset.css. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
size-limit report 📦
|
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
Follow-up to #650, which added the
"center"keyword toinsetInline/insetBlockfor single-axis centering of absolutely positioned elements.This extends
"center"to the all-sidesinsetprop, so the common case — centering an element on both axes — is a single value:How it works
The all-sides
insetresolver is now sugar for insetting both axes: it emits the same per-axis inline/block classes and CSS variables thatinsetInline/insetBlockuse, which letsinset="center"reuse the existing centering classes for both directions. The now-dead all-sides rule is removed frominset.css.Centering itself relies on the mechanism introduced in #650 — physical
left/top: 50%plus atranslatecomposed from@property-typed--rs-inset-translate-*variables — so it composes cleanly with responsive values (e.g.inset={{ s: "center", l: 4 }}centers on small and switches to a numeric inset fromlup).Testing
inset("center")and the responsive{ s: "center", m: 4 }handoff.inset: centerstory to the Viewinsetexample set (visual coverage via Chromatic).tsc,oxlint,stylelint, and the fulltest:unitproject (183 tests) pass. Verified the module CSS compiles cleanly through the responsive PostCSS plugin.🤖 Generated with Claude Code