Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(preset-mini): support composite props #3810

Merged
merged 12 commits into from
Jun 11, 2024
Merged

fix(preset-mini): support composite props #3810

merged 12 commits into from
Jun 11, 2024

Conversation

zyyv
Copy link
Member

@zyyv zyyv commented May 16, 2024

close #3807.

@zyyv zyyv requested a review from antfu as a code owner May 16, 2024 02:33
Copy link

netlify bot commented May 16, 2024

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit 9c5976f
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/666868ab9484db0008266092
😎 Deploy Preview https://deploy-preview-3810--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Curstantine
Copy link

Curstantine commented May 16, 2024

Wouldn't this break anything that depended on h.properties?
For an example, transition-height and etc would completely break.

This is why the `targets' test is failing.

image
image

@Curstantine
Copy link

Curstantine commented May 16, 2024

Since this PR adds a composite prop to the CSS props array in handler utils, it more or less breaks the whole prop resolving mechanism.

I think the better approach is to remove the composite prop from that handler array, and guard the h.properties value like the codebase has done before. Moreover, since h.properties only returns valid CSS values, we don't have to transform it further.

So an approach like this passes the test cases. Though for some odd reason the snapshot matching fails.

  1. Early return when properties are valid CSS properties.
  2. Transform the "custom" properties, filter undefined ones, and only return a valid string when the array itself is populated.
function transitionProperty(prop: string): string | undefined {
  const cssProps = h.properties(prop)
  if (cssProps !== undefined)
    return cssProps

  const transformed = prop.split(',').flatMap(x => transitionPropertyGroup[x]).filter(x => x !== undefined)
  return transformed.length > 0 ? transformed.join(',') : undefined
}

image

Curstantine added a commit to Curstantine/rxrcd that referenced this pull request May 16, 2024
@antfu antfu enabled auto-merge June 11, 2024 15:09
@antfu antfu added this pull request to the merge queue Jun 11, 2024
Merged via the queue into unocss:main with commit f7ad520 Jun 11, 2024
9 checks passed
@zyyv zyyv deleted the issue-3807 branch June 12, 2024 01:59
ramackersjp added a commit to ramackersjp/Piped that referenced this pull request Jun 16, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@unocss/eslint-config](https://togithub.com/unocss/unocss/tree/main/packages/eslint-config#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/eslint-config))
| [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2feslint-config/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2feslint-config/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2feslint-config/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2feslint-config/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2feslint-config/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/preset-icons](https://togithub.com/unocss/unocss/tree/main/packages/preset-icons#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/preset-icons))
| [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2fpreset-icons/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2fpreset-icons/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2fpreset-icons/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2fpreset-icons/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2fpreset-icons/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/preset-uno](https://togithub.com/unocss/unocss/tree/main/packages/preset-uno#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/preset-uno))
| [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2fpreset-uno/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2fpreset-uno/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2fpreset-uno/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2fpreset-uno/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2fpreset-uno/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/preset-web-fonts](https://togithub.com/unocss/unocss/tree/main/packages/preset-web-fonts#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/preset-web-fonts))
| [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2fpreset-web-fonts/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2fpreset-web-fonts/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2fpreset-web-fonts/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2fpreset-web-fonts/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2fpreset-web-fonts/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@unocss/reset](https://togithub.com/unocss/unocss) | [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2freset/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2freset/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2freset/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2freset/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2freset/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/transformer-directives](https://togithub.com/unocss/unocss/tree/main/packages/transformer-directives#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/transformer-directives))
| [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2ftransformer-directives/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2ftransformer-directives/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2ftransformer-directives/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2ftransformer-directives/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2ftransformer-directives/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@unocss/transformer-variant-group](https://togithub.com/unocss/unocss/tree/main/packages/transformer-variant-group#readme)
([source](https://togithub.com/unocss/unocss/tree/HEAD/packages/transformer-variant-group))
| [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/@unocss%2ftransformer-variant-group/0.60.4/0.61.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@unocss%2ftransformer-variant-group/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@unocss%2ftransformer-variant-group/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@unocss%2ftransformer-variant-group/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@unocss%2ftransformer-variant-group/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [unocss](https://togithub.com/unocss/unocss) | [`0.60.4` ->
`0.61.0`](https://renovatebot.com/diffs/npm/unocss/0.60.4/0.61.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/unocss/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/unocss/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/unocss/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/unocss/0.60.4/0.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>unocss/unocss (@&#8203;unocss/eslint-config)</summary>

### [`v0.61.0`](https://togithub.com/unocss/unocss/releases/tag/v0.61.0)

[Compare
Source](https://togithub.com/unocss/unocss/compare/v0.60.4...v0.61.0)

#####    🚀 Features

-   **core**:
- Support generator in rule matcher  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3884
[<samp>(7e156)</samp>](https://togithub.com/unocss/unocss/commit/7e15633b)
- Introduce special symbols for applying custom variants  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3885
[<samp>(d80f6)</samp>](https://togithub.com/unocss/unocss/commit/d80f6cad)
-   **preset-mini**:
- Add support for peer and group variants on aria-\* variants to
Preset-Mini  -  by [@&#8203;Johnkat-Mj](https://togithub.com/Johnkat-Mj)
and [@&#8203;Simon-He95](https://togithub.com/Simon-He95) in
[unocss/unocss#3692
[<samp>(c3265)</samp>](https://togithub.com/unocss/unocss/commit/c3265cc2)
-   **vscode**:
- Add borderRadius to control color cube  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3872
[<samp>(ad294)</samp>](https://togithub.com/unocss/unocss/commit/ad294ffd)

#####    🐞 Bug Fixes

-   **extractor-arbitrary-variants**:
- Quote in \[]  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3875
[<samp>(cd529)</samp>](https://togithub.com/unocss/unocss/commit/cd5296f5)
-   **preset-mini**:
- ColorableShadows with cssvar  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) in
[unocss/unocss#3878
[<samp>(1ac22)</samp>](https://togithub.com/unocss/unocss/commit/1ac223a4)
- Support composite props  -  by
[@&#8203;zyyv](https://togithub.com/zyyv) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3810
[<samp>(f7ad5)</samp>](https://togithub.com/unocss/unocss/commit/f7ad5200)
- `transform-cpu` should not include `rotate-x` and `rotate-y`  -  by
[@&#8203;zzc6332](https://togithub.com/zzc6332) in
[unocss/unocss#3813
[<samp>(ae072)</samp>](https://togithub.com/unocss/unocss/commit/ae072a54)
-   **transformer-attributify-jsx**:
- With prefix  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) in
[unocss/unocss#3867
[<samp>(83728)</samp>](https://togithub.com/unocss/unocss/commit/83728748)
-   **vite**:
- Legacy chunks build  -  by
[@&#8203;Simon-He95](https://togithub.com/Simon-He95) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unocss/unocss#3879
[<samp>(c7f63)</samp>](https://togithub.com/unocss/unocss/commit/c7f63118)

#####     [View changes on
GitHub](https://togithub.com/unocss/unocss/compare/v0.60.4...v0.61.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ramackersjp/Piped).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Properties with multiple values are not matched against shortcuts.
3 participants