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

postcss-logical : transition #900

Merged

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Mar 22, 2023

We overlooked transition when refactoring postcss-logical.
I only noticed it now when revisiting all the downsides/benefits of the old plugin.

As far as I can tell we can only safely transform transition.
Changing transition-property is not possible because other transition-* longhands need to have matching indices.

.before {
  transition-property: margin-inline;
  transition-duration: 1s;
}

.after {
  transition-property: margin-left, margin-right;
  transition-duration: 1s; /* missing value for index "1" */
}

I am now using the same transform functions for real declarations and for transition.

For transition I am constructing a new Declaration with the property taken from transition so that it can be passed to the same functions.

@ehoogeveen-medweb
Copy link
Contributor

As far as I can tell we can only safely transform transition. Changing transition-property is not possible because other transition-* longhands need to have matching indices.

.before {
  transition-property: margin-inline;
  transition-duration: 1s;
}

Is it (theoretically) possible to transform this example by realizing that the 1s from transition-duration corresponds to the margin-inline from transition-property and transforming both? I guess it wouldn't be possible to include the original transition-property at that point (for browsers that support margin-inline).

@romainmenke
Copy link
Member Author

@ehoogeveen-medweb This is not possible because a longhand can be defined on multiple rules :

.foo {
  transition-property: margin-inline;
}

.bar {
  transition-duration: 1s;
}

Only with the shorthand are we sure that we have accurate information

@romainmenke romainmenke marked this pull request as ready for review May 14, 2023 20:32
Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@romainmenke romainmenke merged commit cc0975c into main May 15, 2023
7 checks passed
@romainmenke romainmenke deleted the postcss-logical-transition--practical-raccoon-f0c40018d9 branch May 15, 2023 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants