Conversation
…ct selectors that select nothing A nested rule without & in a template became a global rule, content lost the quotes of its strings, params of a group selector went after the class, and a selector key or string value that selects nothing gave dead CSS or vanished. Nested rules are now relative to their rule as in styled-components and Emotion, content keeps its strings, params go on the pseudo-class that takes them, and unknown selector names and strings that are not CSS text are build errors. Refs #685 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Bare selectors keys no longer reach SelectorSeparator::Space through StyleSelector::from, so test it where it is defined. 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.
문제
selector와 관련해 CSS가 잘못 나오거나 아무 효과 없는 CSS가 나오는 문제 5건(#685 필수 항목)입니다.
.child { },> p { }가 컴포넌트 class 없이 전역 규칙.child{…},> p{…}로 나왔습니다. 관계없는 요소까지 스타일이 적용되고,> p처럼 결합자로 시작하는 규칙은 무효입니다.content: "x"가content:x로,content: ""가content:로 따옴표를 잃었습니다. 둘 다 브라우저가 버리는 값입니다. font-family용 따옴표 제거 최적화가content에도 적용된 것이 원인입니다._groupNthChild={{ params: ['2n'] }}가:is(...):nth-child .a(2n)처럼 params를 class 뒤에 붙여 무효 selector가 됐습니다._hover="external-class")이 아무 오류 없이 사라졌습니다.selectors={{ definitelyNotASelector: … }}가.a:definitely-not-a-selector처럼 아무것도 선택하지 않는 CSS를 만들었습니다.조사하면서 같은 원인으로 생기는 문제를 추가로 발견해 함께 고쳤습니다.
selectors의'div p','> p'키가&:div p,&:> p처럼 무효 selector가 됐습니다.hover,[data-x])가 부모를 잃고 전역 selector가 됐습니다.groupHover,themeDark같은 camelCase bare 키가:group-hover로 나왔습니다.'.myClass'키가.my-class로 바뀌었습니다.h1, div { span {} })._part,_slotted등 pseudo-element가 콜론 하나로 나왔습니다.변경
&가 없는 selector는 규칙 기준으로 해석합니다.:·::로 시작하면 해당 요소 자신에 적용합니다(.a:hover)..a .child,.a > p).h1, &:after→.a h1,.a:after).content: 따옴표 제거 최적화 대상에서 뺐습니다. 작성한 문자열이 그대로 나옵니다.params: 인자를 받는 pseudo 중 아직 인자가 없는 마지막 것에 붙입니다._hover안에 중첩한 group 형태나_not(.x)뒤의_nthChild에도 맞게 붙습니다.selectorsbare 키hover,focusVisible같은 이름은 pseudo-class입니다. 알려지지 않은 이름은 빌드 에러입니다.:·[로 시작하면 요소 자신에 적용합니다._nameprops,selectors의_name키, globalCss의_name키가 CSS pseudo-class·pseudo-element(csstype-extra 기준), 그 group 형태,theme-*, 미디어 축약형 중 하나인지 확인합니다.false·null은 기존처럼 "없음"으로 처리합니다.params,selectors의 키 규칙, 중첩 규칙, 문자열 값 규칙을 추가했습니다.새로 생기는 오류
모두
파일:줄:열과 해당 코드를 함께 알려줍니다.<Box _notASelector={…}>,selectors={{ definitelyNotASelector: … }},selectors={{ div: … }},globalCss({ _nope: … })cannot use `_notASelector` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`'& div','& > p'처럼 selector로 씁니다. vendor pseudo는'&:-webkit-autofill'처럼 씁니다._hover="external-class",_hover={[{ … }, 'external-class']},css({ _focus: 'red' })cannot use `"external-class"` at build time: a selector takes styles, an object such as `{ color: 'red' }` or CSS text such as `color: red`저장소의 앱·컴포넌트·벤치마크·e2e 소스 202개를 새 WASM으로 추출했을 때 새 오류가 난 파일은 없습니다.
출력 변화
&없이 쓴 중첩 규칙이 전역에서 컴포넌트 범위로 바뀝니다. 이전에는 관계없는 요소에도 적용됐습니다.content값이 작성한 따옴표 그대로 나옵니다('hello world'는 작은따옴표를 유지).검증
cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --check,cargo test --workspace통과test_nested_selector_pipeline: 중첩·목록·content·params·selectors키·false값의 CSS 출력test_selectors_that_select_nothing_are_errors: 9개 경우의 오류 메시지와 위치test_split_selector_list,test_is_selector_name,test_nest_selector(목록 부모),test_add_selector_params(5개 경우)bun test5474 pass, 커버리지 100%70-child-selector.tsx:.b .child{color:red}.a > p{color:blue}39-before-content.tsx:content:"→",content:'hello world'28-advanced-selectors.tsx::is([role=group],[data-group]):nth-child(2n) .g30-selector-values.tsx: 클래스 문자열 두 곳이 빌드 에러,false는 오류 없음Refs #685