Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had originally thought we would develop this in a separate repo but that ends up being a bit of a pain to deal with from an NPM install perspective, so this moves the package into our
packages/folder for the moment. I'm thinking it will stay there at least while it's in development. That waynpm installworks as you'd expect and you don't have to mess withnpm linkor anything.This establishes an
@craftcms/cppackage that will hold the majority of the javascript and CSS for the CP. The core of that package is a suite of web components largely based on Lion Why Lion? Lion is a component library focused on accessibilty and intended to be extended and themed. It's pretty much the exact use case we're after. Lion lets us focus on the things we care about and avoid getting lost too far in the weeds.A few components (tooltip, dialog, and drawer to name a few) lean on Web Awesome's components instead as they're more full featured. The bummer there is that they're a bit harder and more awkward to customize. This PR has some basic styling for them, but we'll be revisiting that as we go along.
There are parts of this that are quite messy, but the core of the idea is in place. The full suite of components can be imported into your javascript.
Development
To work on the components, you'll need to start two dev servers. One for the package and another for the CP itself.
The development script for the package just runs a vite build in watch mode (no dev server) so you probably will need to refresh like the olden days, but hopefully that can be improved with time.
If you prefer, you can also develop against the storybook
Usage
You'll also need to import the styles
Once those are in place, you can use the components as you see fit.
This PR imports the components into the main
cp.tsfile, so in most cases you shouldn't have to mess with anything and can just use the components.