nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
3.9k stars 485 forks source link

Better app config theme auto-complete #1869

Closed davestewart closed 2 months ago

davestewart commented 3 months ago

Description

Hello.

It seems the auto-complete for the global component ui theming is shallow.

We solved this in our own project with a that more accurately deeply-nests, whilst also allowing optional string properties (for variants and such like)

CleanShot 2024-06-13 at 11 01 50

It also navigates to the source on a Cmd+Click which is great!

I had a dig into the source and it seems it can be solved at source actually-deep DeepPartial implementation:

type UI = {
  primary?: string
  gray?: string
  colors?: string[]
  strategy?: Strategy
  [key: string]: any
} & FullyDeepPartial<typeof config> // <-- fix this one here

I'm happy to PR this fix.

Additional context

No response

benjamincanac commented 3 months ago

I'm not sure to fully understand what you fixed, everything seems to work fine for me 🤔 CleanShot 2024-06-13 at 12.43.26@2x.png CleanShot 2024-06-13 at 12.43.19@2x.png

davestewart commented 3 months ago

Hi Ben,

Oh! We're not getting that in our project, and there's a few of us working on this.

Thanks for clarifying; let me check with the others and see.

benjamincanac commented 3 months ago

Can it be caused by your defineThemeConfig wrapper? 🤔

davestewart commented 3 months ago

I mean, that was why we added it.

Top level:

CleanShot 2024-06-13 at 12 04 38

Button props:

CleanShot 2024-06-13 at 12 05 16

benjamincanac commented 3 months ago

This is indeed really strange as it should work out of the box. Would you be able to create a small reproduction? 😬

davestewart commented 3 months ago

So I just tried it out in my Nuxt UI fork, and you are right – it does work with the original DeepPartial type.

Sorry to waste your time on this. Maybe it is a tooling / IDE thing?