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: Add support for class list #11299
base: main
Are you sure you want to change the base?
Feat: Add support for class list #11299
Conversation
|
eda555e
to
1d81ca4
Compare
I’ll be the first to tell you that syntax is rubbing me the wrong way. |
I can relate @Antonio-Bennett generally |
Just forgive me in advance |
Continuing the yesterday, I figured if new csr: approach will be to toggle the ssr: the
And this was kind of achievable after transforming the AST from Object expression to Template literal
|
I'm wondering how breaking this is: Will everyone need to update everywhere where classes are used to now use object expressions? And in case of tailwind (where it is not uncommon to have 10+ classes on an element), wouldn't this get too bulky if this needs to be changed to |
No, it doesn't break the existing structure, and why would it be, it just check if the class value is object expression or not and according iterate over key value |
Not sure if this is really needed, you can use class:whatever={true} already and for more advanced cases you could create a little helper or make use of a library that does what you describe. |
Svelte 5 rewrite
Fixes: #7294
Proposing to support classList feature inside the class of svelte.
After digging solid.js I realized there are two ways to support this
classlist
attribute in the element and then remove it after these classlist is set in theDOMTokenList
set_class
for csr andattr
for ssr, I just to modify both where csr support DOMTokenList toggle and for ssr it can simply be evaluated string, that means, there is no change in the current structureBut now it will also support the object syntax
But again, is this valid syntax ?, it feels like mixing
jsx
here and I feel few bottles neck is the hydration process.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint