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

feature(tailwindcss-transformer,ui): Scaffold packages #3402

Merged
merged 18 commits into from
May 28, 2024

Conversation

alexcarpenter
Copy link
Contributor

@alexcarpenter alexcarpenter commented May 17, 2024

Description

In this PR we introduce two new private experimental packages.

tailwindcss-transformer

The goal of this package is to enable authoring components using Tailwind CSS and exporting a component with hashed classNames with accompanying stylesheet.

Example

Input:

export function Example({ flag }) {
  let className = cn('absolute inset-0', flag && 'uppercase');
  return <div className={cn('flex items-center text-sm', className)} />;
}

Output:

export function Example({ flag }) {
  let className = cn('cl-7601190e', flag && 'cl-d2cf63c7');
  return <div className={cn('cl-f64ae6a6', className)} />;
}
.cl-7601190e {
  position: absolute;
  inset: 0;
}

.cl-d2cf63c7 {
  text-transform: uppercase;
}

.cl-f64ae6a6 {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

Utilities

  • transform - transforms a React component with TW classes into hashed classNames
  • generateStylesheet - generates a single stylesheet based on classNames extracted from transform utility

ui

The ui package is where we will be rebuilding the AIO components. We run the components through tsup with the tailwindcss-transformer as an esbuild plugin.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented May 17, 2024

🦋 Changeset detected

Latest commit: 8da7586

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@panteliselef
Copy link
Member

panteliselef commented May 19, 2024

Will this be used to move the ui components out of clerk-js, or this is intended for a complete rewrite ?

@kylemac
Copy link
Contributor

kylemac commented May 19, 2024

@panteliselef no firm decisions on where files will live long term (wasn't sure if that was part of your question or not) - but the plan is to do a complete rebuild using elements under the hood. that said, this is all experimental/poc atm

@alexcarpenter alexcarpenter changed the base branch from alexcarpenter/scaffold-tailwindcss-transformer-package to main May 21, 2024 20:36
@alexcarpenter alexcarpenter changed the title feature(ui): Scaffold package feature(tailwindcss-transformer,ui): Scaffold packages May 22, 2024
@alexcarpenter alexcarpenter marked this pull request as ready for review May 22, 2024 20:24
@tmilewski tmilewski closed this May 23, 2024
@tmilewski tmilewski reopened this May 23, 2024
@alexcarpenter alexcarpenter force-pushed the alexcarpenter/scaffold-ui-package branch 3 times, most recently from ceec653 to a90bdf7 Compare May 23, 2024 21:49
.changeset/grumpy-plants-think.md Outdated Show resolved Hide resolved
packages/tailwindcss-transformer/README.md Outdated Show resolved Hide resolved
packages/tailwindcss-transformer/package.json Show resolved Hide resolved
packages/tailwindcss-transformer/package.json Outdated Show resolved Hide resolved
packages/tailwindcss-transformer/src/index.ts Show resolved Hide resolved
packages/ui/README.md Outdated Show resolved Hide resolved
packages/ui/example/public/next.svg Outdated Show resolved Hide resolved
packages/ui/example/public/vercel.svg Outdated Show resolved Hide resolved
packages/ui/tsconfig.build.json Outdated Show resolved Hide resolved
packages/ui/package.json Show resolved Hide resolved
@alexcarpenter alexcarpenter force-pushed the alexcarpenter/scaffold-ui-package branch from 1710e7a to 8807825 Compare May 24, 2024 18:12
Copy link
Member

@BRKalow BRKalow left a comment

Choose a reason for hiding this comment

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

🚢

@BRKalow BRKalow dismissed LekoArts’s stale review May 28, 2024 19:52

Most feedback addressed, additional items can be addressed in followup PRs

@BRKalow BRKalow force-pushed the alexcarpenter/scaffold-ui-package branch from 3325bf2 to 8da7586 Compare May 28, 2024 19:52
@alexcarpenter alexcarpenter merged commit a6f297e into main May 28, 2024
11 checks passed
@alexcarpenter alexcarpenter deleted the alexcarpenter/scaffold-ui-package branch May 28, 2024 20:01
panteliselef added a commit that referenced this pull request May 29, 2024
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.

None yet

6 participants