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: rewrite the preset #24

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

feat: rewrite the preset #24

wants to merge 31 commits into from

Conversation

awwwdev
Copy link

@awwwdev awwwdev commented Sep 4, 2024

This is a complete rewrite of the preset and many missing features are added.

Instead of adding all 12 shades of a color at the start, this adds color shades as they are used, unless they are safeListed. So always, the minimum amount of css is added to your project.

Mechanism:
There is a colorsInUse object that keeps track of colors used.
There is a unocss shortcut that runs when a radix color is used in a utility token, and add the color to colorsInUse.
In preflight, based on colorsInUse, it add css variables.

palette option is removed.

new options are introduced.

useP3Colors (boolean)
to use P3 colors with fallbacks

safeListColors:
a list of colors or color-shades to preserve

safeListAliases:
a list of aliases to preserve

onlyOneTheme ('dark' | 'light' | undefined):
if your app has only one theme, you can indicate with this, so only 'dark' or 'light' colors are added to css.

awwwdev

This comment was marked as duplicate.

@endigma
Copy link
Owner

endigma commented Sep 16, 2024

Hey, I'd be willing to review and accept this, but you'd need to update docs to reflect your changes and increment the major version in package.json. From an initial review, there's also a bunch of typescript errors that should be fixed before merge.

@awwwdev
Copy link
Author

awwwdev commented Oct 4, 2024

Sorry for late response. I'll address those. Thanks.

@awwwdev
Copy link
Author

awwwdev commented Oct 12, 2024

Hello again 👋

So I refactored it, fixed the Typescript errors, and wrote docs for changed features, plus a migrations guide from v2.

Please review and let me know what you think.
I'm open to discuss and change things.

Thanks

@endigma
Copy link
Owner

endigma commented Oct 18, 2024

Hey, I understand I'm being annoying here but could you maybe git rebase --fixup all the repetitive commits and maybe set up SSH or GPG commit signing? I'll review the actual changes soon.

I don't mind many small commits, but series of the same commit message is bad imo
{BD7B82DD-BA1E-40A3-9E8B-36286A09374F}

@awwwdev awwwdev force-pushed the rewrite branch 4 times, most recently from aa93674 to c132f44 Compare October 20, 2024 10:18
@awwwdev
Copy link
Author

awwwdev commented Oct 20, 2024

Hey @endigma ! Not at all. I learned things!
I added ssh commit signing.
Didn't know about commit --fixup.
I will use it later on. But for fixing this, I rebased the branch to squash the commits with same message to one. Sorry if it's not clean. I'm new with this. Later I found out I could do it in one run!

Note, if you follow commits the changes on docs might confuse you. I tried to move current doc to a V2 folder and add my doc to V3 folder, but couldn't figure out how to handle things (like in colors page, v2 use radix-colors v2 and v3 radix-colors v3, I didn't know how to use two version of a radix-colors in same time). So, eventually, I gave up and overwrite your docs (v2) with my docs (v3).

Let me know if there is anything confusion, or any suggestion you have.

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.

2 participants