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

[Feature Proposal] duration class should apply default duration theme value when no value is specified #3540

Open
4 tasks done
AndrewBogdanovTSS opened this issue Jan 29, 2024 · 4 comments

Comments

@AndrewBogdanovTSS
Copy link
Contributor

AndrewBogdanovTSS commented Jan 29, 2024

Clear and concise description of the problem

Similarly to how it was working inside WindiCSS and to be better aligned with other utilities I suggest applying default theme duration value when no value was provided, so instead of duration-DEFAULT I could just write duration

Suggested solution

[
    /^(?:transition-)?duration(?:-(.+))$/,
    ([, d], { theme }) => ({ 'transition-duration': theme.duration?.[d || 'DEFAULT'] ?? h.bracket.cssvar.time(d) }),
    { autocomplete: ['transition-duration-$duration', 'duration-$duration'] },
  ],

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the README.md of using the package.
  • Already used the Interactive Docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@henrikvilhelmberglund
Copy link
Contributor

Could you explain further what you mean, including a playground link? When using for example transition-all the default duration (from the theme) is already included so there is no need to add duration- unless you want something other than the default duration.

@AndrewBogdanovTSS
Copy link
Contributor Author

I think it's quite straightforward even with no playground link. transition-all is a different property that cannot serve as a replacement for what is requested here. Just check how it works in WindiCSS. duration class applies default duration

@henrikvilhelmberglund
Copy link
Contributor

I think it's quite straightforward even with no playground link. transition-all is a different property that cannot serve as a replacement for what is requested here. Just check how it works in WindiCSS. duration class applies default duration

If you use a transition class in UnoCSS you get your duration for free so I don't see the point of adding it, the only time you should want to use duration-x is when you don't want the default duration.

The playground link isn't for you, it's to make me or anyone else who might implement the feature see how this feature would improve things. And if it doesn't improve things it's unlikely to be added as a feature.

@AndrewBogdanovTSS
Copy link
Contributor Author

AndrewBogdanovTSS commented Mar 15, 2024

If you use a transition class in UnoCSS you get your duration for free

If you use flex-1 class you get flex-grow for free. Why then we have flex-grow inside UnoCSS? Do you think we should remove it?

I don't see the point of adding it

It's your absolute right. I didn't ask you to look into this issue, leave any comments, or do any implementation about it. Just ignore this issue if you don't see a point in it.

It's to make me or anyone else who might implement the feature see how this feature would improve things.

What kind of playground do you need to understand that duration class should generate transition-duration: .15s; ?
You can go to WindiCSS docs https://windicss.org/utilities/animations/transitions.html#transition-duration , remove 150 from duration and see how it works
image

Moreover, I provided a complete implementation in my initial message. This is a 5-minute change but for some reason, you are trying to make this request look way more significant than it really is.

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

No branches or pull requests

2 participants