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(preset-typography): compatibility mode(#2051) #2064

Merged
merged 14 commits into from Jan 20, 2023

Conversation

BeiyanYunyi
Copy link
Contributor

@BeiyanYunyi BeiyanYunyi commented Jan 10, 2023

See #2051

@netlify
Copy link

netlify bot commented Jan 10, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7d7691f
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/63ca34cb8c9ed400086fb58e
😎 Deploy Preview https://deploy-preview-2064--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 settings.

@zyyv
Copy link
Member

zyyv commented Jan 10, 2023

Hi, it seems to not support for not-prose with use compatibility mode.
Playground

@BeiyanYunyi
Copy link
Contributor Author

BeiyanYunyi commented Jan 10, 2023

Hi, it seems to not support for not-prose with use compatibility mode.

This is expected and is explained in the jsdoc and README. The reason is the :where() selector, which is not supported under chrome 88 and make the whole prose unavailable. The compatibility mode is introduced to make prose work, at least.

@zyyv zyyv linked an issue Jan 10, 2023 that may be closed by this pull request
@zyyv
Copy link
Member

zyyv commented Jan 10, 2023

@lixiang810 I modified the code a bit and removed :is. I think we should drop all pseudo-classes when using compatibility mode, what do you think?

@BeiyanYunyi
Copy link
Contributor Author

@lixiang810 I modified the code a bit and removed :is. I think we should drop all pseudo-classes when using compatibility mode, what do you think?

Nice, I forgot it. The :is() selector is also unavaliable before Chrome 88.

@zyyv
Copy link
Member

zyyv commented Jan 10, 2023

@lixiang810 I modified the code a bit and removed :is. I think we should drop all pseudo-classes when using compatibility mode, what do you think?

Nice, I forgot it. The :is() selector is also unavaliable before Chrome 88.

Let me check it again, it seems that the wrong code was i changed.😅

@zyyv zyyv marked this pull request as draft January 10, 2023 14:45
@antfu
Copy link
Member

antfu commented Jan 10, 2023

I am a bit hesitant about the name. compatibility is a relevant term, anything could be incompatible if their browsers are old enough. While browser list is probably too heavy for us, I think we could have an object instead:

compatibility: {
  noColonWhere: true,
  noColonIs: true
}

@BeiyanYunyi
Copy link
Contributor Author

BeiyanYunyi commented Jan 10, 2023

compatibility: {
  noColonWhere: true,
  noColonIs: true
}

The compatibility of :where() and :is() is the same. Browsers that do not support :where() also do not support :is(), and vice versa. It seems that it is unnecessary for these two pseudo-classes.

:not is an exception, as it have a little difference to :where() in firefox. But the not-prose classname will not work without :where() and :not(), it makes no sense to remove only one of them.

Maybe we can call this option disableNotUtility and describe the purpose (compatibility) in jsdoc and readme instead.

@zyyv zyyv marked this pull request as ready for review January 10, 2023 15:41
@antfu
Copy link
Member

antfu commented Jan 12, 2023

The compatibility of :where() and :is() is the same. Browsers that do not support :where() also do not support :is(), and vice versa. It seems that it is unnecessary for these two pseudo-classes.

This statement is only true in the context of the current existing browsers you are aware of. This may not always be the case, as you mentioned the exception. Users could also use a custom browser engine or anything, that does not always support them at the same time. Also in the future, there could be :foo :bar or anything. Having them in a single options is not practical.

@BeiyanYunyi BeiyanYunyi marked this pull request as draft January 12, 2023 13:41
@BeiyanYunyi BeiyanYunyi marked this pull request as ready for review January 12, 2023 14:06
@BeiyanYunyi
Copy link
Contributor Author

OK. Now we have a fine-grained control.

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.

[Feature Request] "Compatibility Mode" for preset-typography
4 participants