feat(web): pluggable web renderer with vaul support#639
Draft
feat(web): pluggable web renderer with vaul support#639
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Strip to bare present/dismiss with overlay, content, and handle.
Move vaul source into src/web/vaul as the sole web drawer. Remove renderer registry, setWebRenderer, and /gorhom and /vaul subpath exports. Scaffold provider context in TrueSheetProvider.web.tsx for direct implementation.
Drop the src/web/vaul ignore rules from prettier and eslint, run prettier across the directory, and trim the README to basic fork attribution.
|
Hey @lodev09, this PR is missing a changelog entry. Add the following under the Unreleased section in See CONTRIBUTING.md for more details. |
Default to 0 for native parity (always dimmed). Fix vaul's getPercentageDragged to handle fadeFromIndex === 0: at the lowest detent dismiss drag returns null so the default distance-based fade-out applies; all other positions return 0 to stay opaque.
Drive the RAF only while the drawer is actually moving (drag, CSS transition, CSS animation) so idle sheets cost zero frames. Move tracking into Content so listeners live for the drawer element's lifetime, including the close animation before Radix unmounts the portal.
Define TrueSheetMethods and TrueSheetStaticMethods in TrueSheet.types, have the native class and web component implement them. Support the index/animated params on web by controlling vaul's activeSnapPoint. Wire the dimmed prop to vaul's modal, and fix the dim overlay not appearing on non-fade snap presents by firing snapToPoint on every open transition.
When the active snap is below fadeFromIndex the overlay is transparent and we want the sheet to behave as non-modal: clicks reach the content behind the drawer and outside-clicks don't dismiss. Drive this off the current snap index so crossing the fade threshold flips modal behavior without unmounting the overlay.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Make the web sheet renderer explicit and pluggable via
TrueSheet.setWebRenderer(). Both gorhom and vaul are now opt-in through sub-path imports — no default renderer, error with instructions if unset on web.Consumer usage:
Key changes:
TrueSheet.web.tsx,TrueSheetProvider.web.tsx) are now thin delegators with zero renderer-specific importssrc/web/(constants, utils, types, registry, SheetContext)src/gorhom/sub-path exportsrc/vaul/sub-path exportsetWebRendereris a no-op on nativeType of Change
Test Plan
setWebRendererno-opChecklist