Skip to content

Conversation

@metkm
Copy link

@metkm metkm commented Aug 20, 2025

Wanted to work on this PR because of performance reasons. Tested it on Nuxt UI's page with a strong physical device, and the performance was bad. So I forked the PR that looked interesting by anoesj. That also came with other problems; CSS variables were causing performance issues, even though I liked the approach. So this approach is back to manually adding translate style. This means you probably can't do weird effects.

This PR also clears everything up. I've found that the old code was hard to read because everything was cramped into controls.ts. I've split some stuff up with different composables.

Also switched a lot of variables to use computed because they are cached, which means we don't lose performance, and pass values to slots, which users can do whatever they want with them. This also means everything should be updated accordingly with any changes. E.g.: changing and resizing the content size of the drawer, window, or ref variables, etc.

There are also some features that didn't exist before, like the scroll implementation I've done so that the drawer drags when scrolling content at the top. Just like any native drawer would do on mobile. This can be done using data-vaul-scrollable and nothing else is needed.

Removed the NestedDrawer component. Now you can use the same components with just nesting them, see tests/NestedDrawer.vue. You don't need to do anything else. This is because I use Stacks to keep track of open drawers. see composables/useStacks. I'm not sure if you could do this before, but now you can open 30 different drawers with all having different props, etc. There should not be any problems.

There might be some missing props or bugs. This PR is ready to review, but I wouldn't merge it yet before testing it.

Anoesj and others added 30 commits March 22, 2025 13:55
…ration and easing and border radius configurable using CSS vars, deprecate `defaultOpen` (use `open` or `:open="true"`, update deps
… `v-if` and initially open, make sure latest `drawerEl` element is re-retrieved in `setTimeout`, fix broken `onNestedOpenChange` call
@metkm
Copy link
Author

metkm commented Aug 22, 2025

also closes #95. example

@metkm metkm marked this pull request as ready for review August 27, 2025 16:43
@metkm
Copy link
Author

metkm commented Aug 28, 2025

Note:
We need a wrapper / composable around updating styles and then removing those styles applied (after waiting for transitionend). It would clean up the code a lot.

Or not that but a better way of setting styles.

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