feat(styles): add longhand modifier to force longhand CSS output#94
Merged
feat(styles): add longhand modifier to force longhand CSS output#94
longhand modifier to force longhand CSS output#94Conversation
Allow users to explicitly expand shorthand CSS properties into individual longhands (e.g. `radius: '10px longhand'` outputs four `border-*-radius` properties). Supports radius, padding, margin, scroll-margin, inset, and border handlers. Made-with: Cursor
Contributor
📦 Snapshot releasePublished |
… in AGENTS.md Made-with: Cursor
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
Adds a
longhandmodifier to style handlers that use CSS shorthand properties. When present, the handler outputs individual CSS longhand properties instead of the shorthand form.This is useful when parent elements need to set styles in a way that allows children to selectively inherit individual directions/corners — e.g., a parent uses
radius: '10px longhand'so a child can doradius: 'inherit left'without shorthand/longhand specificity conflicts.Affected handlers
border-radiusexpands toborder-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radiuspaddingexpands topadding-top,padding-right,padding-bottom,padding-leftmarginexpands tomargin-top,margin-right,margin-bottom,margin-leftscroll-marginexpands toscroll-margin-top, etc.insetexpands totop,right,bottom,leftborderexpands toborder-top,border-right,border-bottom,border-leftExamples
Changes
src/styles/radius.ts— detectlonghandmod, output per-corner propertiessrc/styles/directional.ts— detectlonghandmod, bypassoptimizeShorthandand output individual direction properties (affects padding, margin, scroll-margin, inset)src/styles/border.ts— detectlonghandmod, output per-side border properties; also addedextractCSSWideKeywordhandling for parsed groupssrc/styles/radius.test.ts— new test file (14 tests)src/styles/{padding,margin,border,inset}.test.ts— added longhand modifier test sectionsdocs/styles.md— documentedlonghandoutput modifier for all affected handlersTest plan
inherit), shape mods (round,ellipse,leaf), directional combos, multi-group, and priority overrides withlonghandMade with Cursor