Repository navigation
fix(sheet): write a longhand after every shorthand that covers it - #974
Merged
Merged
Conversation
Atomic rules of one selector and breakpoint were sorted by property name, so `border-width` came after `border-top-width` and `place-items` after `align-items`, and the shorthand won. StyleX's default property-specificity policy, and atomic CSS generally, let a longhand win regardless of order. css::property_order lists each CSS shorthand and the properties it sets. A property sorts under the greatest name among itself and its covering shorthands, then by how deeply it is covered, so it lands right after its last shorthand while unrelated properties keep their alphabetical order. `all` sorts first. The sheet uses this order for class and at-rule declarations of every source, not only StyleX. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This was referenced Nov 15, 2026
No conflicts. main's sheet changes (rm_file and the stylesheet stack from #951) merge beside the property_order sort in prop_cmp; the css, sheet, binding-core, wasm and extractor tests pass unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 15, 2026
…-wins No conflicts. Brings in main through #974's merge; the shorthand composition in the extractor merges beside main's stylesheet stack and removeFile changes, and the css, sheet, extractor, binding-core and wasm tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 16, 2026
Brings in main through #974 and #978. In the vite, rsbuild, webpack and bun plugins, the setupWarning (#945) imports and main's createNodeModulesExcludeRegex sit beside normalizeStylexOptions, and styleResolution is still set next to registerShorthands wherever main configures the engine. The ABI now has 31 names: main's removeFile plus setStylexStyleResolution. Updated the count in script.js, the consumer, the native README and typings, and compiler-types (30 without Output). Validation covers 47 positions in 20 functions (276 cases), and the summary reports 20 functions. The e2e host lists both names and counts 27 corpus scenarios. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
…overs The lint sorts JSX attributes by name (perfectionist/sort-jsx-props), so their order is not the order the author chose: `backgroundClip` always comes before `bg`. Treating it as written order dropped the `background-clip: text` atom of `<Text backgroundClip="text" bg="linear-gradient(...)" />`, which broke the gradient text of the landing DevupUICard and its mobile benchmark screenshot. Attributes between two spreads now replace none of each other's longhands, and the sheet order (a longhand after its shorthands) decides as in #974. A spread keeps its place: a shorthand in a later spread or in the attributes after a spread still replaces an earlier longhand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
#974 landed on main as a squash, so its files came in as add/add conflicts. property_order.rs keeps this branch's version (#974's table plus covers()); sheet/lib.rs keeps main (with #961's token tests) and only re-sorts the Box test props. extract_style_from_expression.rs imports both main's descendants and this branch's LaterDeclarations. The style_results_read_as_values snapshot takes main's __devupStyled wrapper (#958) on top of this branch's dropped animation-name atoms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Brings in main through the base branch. Its merge with main (0e409e3, 9f46158) already resolved property_order.rs, extract_style_from_expression.rs, the style_results_read_as_values snapshot and sheet/lib.rs against #974, so this merge applies cleanly and origin/main adds nothing beyond it. Co-Authored-By: Claude Opus 5.5 <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.
Summary
Changed the sheet ordering so that, within the same selector and the same breakpoint, a longhand rule always comes after the shorthands that cover it.
Problem
property-specificity), a longhand beats a shorthand regardless of order.border-widthcame afterborder-top-widthplace-itemscame afteralign-itemspadding/padding-top.prop_cmp), so it was not a StyleX-only problem. Box props,css(), styled and the compat APIs all had the same problem. There was no existing code that ordered by a shorthand's "level".Changes
css::property_order.allgoes first.prop_cmp(ordering of class rules and at-rule rules) uses this order.@layer oN) and breakpoint groups are unchanged. The order changes only within those groups.globalCssfollows authoring order, so it was not changed.Output changes
align-itemsrule moves afterdisplay, right afterplace-items.Out of scope
css({ borderTopWidth: 2, borderWidth: 1 })[stylex] WARNING: Shorthand property ...warning the StyleX extractor emits for shorthands was left as is, because fix(extractor): compile StyleX contextual, typed and named-rule APIs as StyleX defines them #915 heavily changes the same file.Overlapping PRs
Test plan
border-width/border-top-widthandplace-items/align-itemscases oflonghand_rule_follows_its_shorthandfailed.sheet::longhand_rule_follows_its_shorthand@layer o1.sheet::extracted_longhands_win_over_shorthands: checked by actually extracting StyleXprops()and Box props.css::property_ordercargo test -p css -p sheet -p devup-ui-binding-core -p devup-ui-wasm --tests -j 2passescargo clippy -p css -p sheet --all-targets -- -D warnings,cargo fmt --all요약
같은 selector, 같은 breakpoint 안에서 longhand 규칙이 그것을 덮는 shorthand보다 항상 뒤에 오도록 sheet의 정렬을 바꿨습니다.
문제
property-specificity)에서는 순서와 관계없이 longhand가 shorthand를 이깁니다.border-width가border-top-width뒤에 옴place-items가align-items뒤에 옴padding/padding-top처럼 알파벳 순이 우연히 맞는 경우만 동작했습니다.prop_cmp)라서 StyleX만의 문제가 아니었습니다. Box props,css(), styled, compat API 모두 같은 문제가 있었습니다. 기존에 shorthand의 "level"에 따라 정렬하는 코드는 없었습니다.변경
css::property_order를 새로 추가했습니다.all은 맨 앞에 둡니다.prop_cmp(class 규칙과 at-rule 규칙 정렬)가 이 순서를 씁니다.@layer oN)와 breakpoint 묶음은 그대로입니다. 순서는 그 묶음 안에서만 바뀝니다.globalCss는 작성 순서를 따르므로 바꾸지 않았습니다.출력 변화
align-items규칙이display뒤,place-items바로 뒤로 갑니다.범위 밖
css({ borderTopWidth: 2, borderWidth: 1 })[stylex] WARNING: Shorthand property ...경고는 그대로 뒀습니다. #915가 같은 파일을 크게 바꾸기 때문입니다.겹치는 PR
테스트 계획
longhand_rule_follows_its_shorthand의border-width/border-top-width,place-items/align-items케이스가 실패했습니다.sheet::longhand_rule_follows_its_shorthand@layer o1안의 breakpoint에서 확인합니다.sheet::extracted_longhands_win_over_shorthands: StyleXprops()와 Box props를 실제로 추출해서 확인합니다.css::property_ordercargo test -p css -p sheet -p devup-ui-binding-core -p devup-ui-wasm --tests -j 2통과cargo clippy -p css -p sheet --all-targets -- -D warnings,cargo fmt --allRefs #690
Refs #688
🤖 Generated with Claude Code