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

fix(shadcn) arrays and nested deeply nested spread #5711

Merged
merged 9 commits into from
Nov 13, 2024

Conversation

bcorbold
Copy link
Contributor

@bcorbold bcorbold commented Nov 4, 2024

Description

Fixed parseObjectLiteral utilities to account for arrays and deeply nested values, and ensure that spread operators are preserved regardless of the level

Branched from #5587 for the initial fix, added additional for nested support

Example

Input

const config: Config = {
  ...
  theme: {
    extend: {
      fontFamily: {
        sans: [
          "ui-sans-serif",
          "sans-serif",
        ],
      },
      fontSize: {
        sm: ['12px', { lineHeight: '1rem' }]
      }
    }
    ...
  }
  ...
}

Before

const config: Config = {
  ...
  theme: {
    extend: {
      fontFamily: {
        sans: [\n          "ui-sans-serif",\n          "sans-serif",\n        ],
      },
      fontSize: {
        sm: [\\n          '0.875rem',\\n          {\\n            lineHeight: '1.25rem',\n        ]
      }
    }
    ...
  }
  ...
}

After

const config: Config = {
  ...
  theme: {
    extend: {
      fontFamily: {
        sans: [
          "ui-sans-serif",
          "sans-serif",
        ],
      },
      fontSize: {
        sm: ['12px', { lineHeight: '1rem' }]
      }
    }
    ...
  }
  ...
}

Fixes

#4796, #4707, #4717, #4956, #4841, #4675

Copy link

vercel bot commented Nov 4, 2024

@bcorbold is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@bcorbold bcorbold changed the title Fix shadcn arrays and spread fix(shadcn) arrays and nested deeply nested spread Nov 4, 2024
@shadcn shadcn added enhancement New feature or request area: roadmap This looks great. We'll add it to the roadmap, review and merge. area: shadcn labels Nov 4, 2024
Copy link

vercel bot commented Nov 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
ui ⬜️ Ignored (Inspect) Visit Preview Nov 4, 2024 7:10pm

Copy link
Collaborator

@shadcn shadcn left a comment

Choose a reason for hiding this comment

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

Top-notch contribution. Really appreciate this @bcorbold

@shadcn shadcn merged commit 500dbe2 into shadcn-ui:main Nov 13, 2024
9 checks passed
@marketsystems
Copy link

Is this released as just ran into this issue (temporarily deleting the typography part of my tailwind.config.js fixed it)

niktekusho pushed a commit to niktekusho/shadcnui that referenced this pull request Nov 21, 2024
* fix: tailwind config updater parser

* fix: remove quote around spread element

* fix: specify deepmerge option for array

* fix(shadcn): Nested and spread array elements

* add test case for boolean primitive

---------

Co-authored-by: matsuyoshi30 <[email protected]>
Co-authored-by: shadcn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: roadmap This looks great. We'll add it to the roadmap, review and merge. area: shadcn enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants