Conversation
Global rules, @import and @font-face were stored in sorted sets and custom layers were declared alphabetically, so a later rule or layer could lose to an earlier one. The extractor now numbers global rules and records the first-use order of layers; the sheet emits them in that order. Refs #685 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Refs #685 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
CI reformats sources to one-line calls before tarpaulin, which put the reported misses on the repeated add_css early return and a font-face struct field. Cover the repeated add_css/add_import/add_font_face calls and build the font face in one statement. Refs #685 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
Changepacks@devup-ui/wasm@1.0.82 → 1.0.83 - bindings/devup-ui-wasm/package.jsonPatch
@devup-ui/bun-plugin@1.0.21 → 1.0.22 - packages/bun-plugin/package.jsonPatch
@devup-ui/components@0.1.59 → 0.1.60 - packages/components/package.jsonPatch
@devup-ui/eslint-plugin@1.0.21 → 1.0.22 - packages/eslint-plugin/package.jsonPatch
@devup-ui/next-plugin@1.0.89 → 1.0.90 - packages/next-plugin/package.jsonPatch
@devup-ui/plugin-utils@1.0.16 → 1.0.17 - packages/plugin-utils/package.jsonPatch
@devup-ui/rsbuild-plugin@1.0.66 → 1.0.67 - packages/rsbuild-plugin/package.jsonPatch
@devup-ui/vite-plugin@1.0.72 → 1.0.73 - packages/vite-plugin/package.jsonPatch
@devup-ui/webpack-plugin@1.0.70 → 1.0.71 - packages/webpack-plugin/package.jsonPatch
|
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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.
문제
CSS에서는 명시도가 같으면 나중에 쓴 규칙이 이기고, 먼저 선언한 layer가 약합니다. 그런데 전역 CSS가 작성 순서가 아니라 텍스트 정렬 순서로 출력되어, 작성자의 의도와 반대 결과가 나왔습니다.
globalCss`body{color:red}`→globalCss`body{color:blue}`가body{color:blue}body{color:red}로 출력되어 red가 이겼습니다.@import(z.css,a.css→a.css,z.css)와@font-face도 같은 문제였습니다.reset을base보다 먼저 썼는데@layer base,reset;이 출력되어 layer 우선순위가 뒤집혔습니다.globalCss({ body: { color: 'red' } })뒤에globalCss({ body: { color: 'blue' } })를 쓰면body{color:blue;color:red}로 출력되었고, 같은 명시도의 selector(.z,.a)도 알파벳 순으로 재배열되었습니다.변경
StyleCollector가 파일의 스타일을 받으면서 전역 규칙(ExtractCss,ExtractImport,ExtractFontFace, 전역 selector 선언)에 작성 순번을 매기고, layer를 처음 쓰인 순서대로 기록합니다. 중첩 layer는 부모 뒤에 옵니다. 기록한 순서는 새ExtractStyleValue::LayerOrder로 sheet에 전달됩니다.@import,@font-face를 작성 순서의 목록으로 저장합니다. 파일을 다시 추출하면 해당 파일의 목록을 교체합니다.red, blue, red→ 마지막 red가 이김). 중복된@import와@font-face는 마지막 위치 하나만 남깁니다. 동일한 규칙이므로 cascade 결과는 같습니다.새로 생기는 오류
없음. 빌드 에러를 새로 추가하지 않았습니다.
출력 변화
@layer reset,base;)가 앞에 추가됩니다.검증
cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace통과test_global_rules_keep_written_order,test_global_rules_and_layers_update_per_file,style_collector단위 테스트,test_layer_pipeline의 layer 순서 케이스bun test5474 pass, 커버리지 100%global-order.tsx:body{color:red}body{color:blue}layers.tsx:@layer reset,base,utilities;body{color:red;color:blue}.z{...}.a{...},@layer zz,aa;Refs #685