tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Add `list-style-image` utility

Open neupauer opened this issue 2 years ago β€’ 2 comments

This PR will add the list-style-image utilities.

This PR also fix the ambiguity of the list utility by introducing the string: type for the arbitrary values, so: .list-['πŸ‘‰'] will generatelist-style-type: 'πŸ‘‰' .list-[url(...)] will generate list-style-image: url(...)

πŸ’₯This also introduces breaking change to the list-style-type utility:

- list-[var(--value)]
+ list-[string:var(--value)]

neupauer avatar Nov 29 '21 18:11 neupauer

Thanks! I think to avoid the breaking change we are going to want to come up with some clever internal way to make list-[var(--value)] still work, maybe like a preferred: true or preferred: somePrivateSymbol option or something.

I think this would be good to add though so going to leave this open so we can look into it soon β€” just going through PRs today as we're trying to clean up before tagging v3.1. Will try to dig into this more for v3.2 πŸ‘πŸ»

adamwathan avatar May 23 '22 14:05 adamwathan

I updated the PR to use list-style-type for otherwise unknown types (the any type) which fixes the issue with var(…) and the need for the additional string data type β€” which I have removed it as well.

ping @adamwathan

thecrypticace avatar Oct 07 '22 17:10 thecrypticace

@thecrypticace Can you review this again tomorrow if you have time and see if we need to incorporate any of the preferOnConflict stuff we added for ambiguous types before merging?

I'm a bit hesitant to add this in general at this point since we have arbitrary property support β€” it might just be simpler to recommend typing <div class="[list-style-image:url(...)] ..."> since there are no sensible default values we can include for this anyways. Makes it a pretty weird one to document in the documentation.

Anyone following this PR have any thoughts?

adamwathan avatar Feb 07 '23 03:02 adamwathan

@adamwathan I've updated the PR. So preferOnConflict is unnecessary here. That is only necessary when multiple sets of utilities can take the same arbitrary value "types" and share the same prefix. In this case the url(…) is typed separately and therefore not ambiguous. The use of any is what bypasses the problem with the use of var(--my-var-name-here).

thecrypticace avatar Feb 07 '23 14:02 thecrypticace

Thinking about this more, I think the best solution here is actually to drop list-style-type and just use list-style for all this stuff, then the same plugin can handle both type and image and we don't have the weird documentation issue.

So going to close this one, and we'll plan to make it possible to use URLs with the existing listStyleType core plugin instead. Just a bit of work because we'll want to make it a smooth deprecation process from listStyleType to listStyle that automatically normalizes your config file and stuff.

Thanks either way!

adamwathan avatar Feb 08 '23 16:02 adamwathan