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

feat: support svelte 5.16.0 class value #2142

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

calvo-jp
Copy link

Closes #

📝 Description

In Svelte 5.16.0, the class attribute accepts objects and arrays as values using clsx under the hood. This PR adds support for this feature. (code taken from clsx)

⛳️ Current behavior (updates)

Input:

mergeProps(
  {class: {class1: true}},
  {class: ['class2', 'class3', null, undefined]},
  {class: 'class4'},
  {class: {class5: false, class6: true}},
)

Output:

{ class: 'class3' }

🚀 New behavior

Input:

mergeProps(
  { class: null },
  { class: undefined },
  { class: ["class1", "class2", null, undefined] },
  { class: "class3" },
  { class: { class4: false, class5: true } },
)

Output:

{ class: 'class1 class2 class3 class5' }

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Copy link

changeset-bot bot commented Dec 29, 2024

⚠️ No Changeset found

Latest commit: ee61e65

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
zag-solid ✅ Ready (Inspect) Visit Preview Dec 29, 2024 10:03am
zag-svelte ✅ Ready (Inspect) Visit Preview Dec 29, 2024 10:03am
zag-vue ✅ Ready (Inspect) Visit Preview Dec 29, 2024 10:03am
zag-website ✅ Ready (Inspect) Visit Preview Dec 29, 2024 10:03am

Copy link

vercel bot commented Dec 29, 2024

@calvo-jp is attempting to deploy a commit to the Chakra UI Team on Vercel.

A member of the Team first needs to authorize it.

@anubra266
Copy link
Collaborator

@calvo-jp It's probably better to make this change in the svelte adapter

https://github.com/chakra-ui/zag/blob/main/packages/frameworks/svelte/src/merge-props.ts

@calvo-jp
Copy link
Author

calvo-jp commented Dec 29, 2024

@calvo-jp It's probably better to make this change in the svelte adapter

https://github.com/chakra-ui/zag/blob/main/packages/frameworks/svelte/src/merge-props.ts

Hi @anubra266. Will update my PR once I get back. Thank you!

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.

2 participants