Toast updates - #16
Merged
Merged
Conversation
…ight horizontal moment
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an app-wide toast queuing system for DisplayToast via a new useToastQueue composable and a single DisplayToastProvider renderer component, plus updated demo/docs and added test/story coverage.
Changes:
- Added
useToastQueuesingleton composable andToastQueueEntry/Statustypes to drive an app-level toast queue. - Added
DisplayToastProviderto render queued toasts with Teleport + TransitionGroup (stacking, maxVisible gating, timers, Escape/close dismissal, FLIP-style movement). - Updated the UI demo page and internal docs; added Storybook stories and a comprehensive provider test suite.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| app/types/components/display-toast.d.ts | Adds toast queue entry/status types to the shared component type exports. |
| app/composables/useToastQueue.ts | Implements singleton reactive queue API (show/dismiss/clear + currently promote). |
| app/components/01.atoms/toast/DisplayToastProvider.vue | New provider that renders queued toasts and manages promotion/timers/animations. |
| app/components/01.atoms/toast/tests/DisplayToastProvider.spec.ts | Adds provider tests (rendering, ARIA, maxVisible, dismiss paths, timers, clear). |
| app/components/01.atoms/toast/stories/DisplayToastProvider.stories.ts | Adds Storybook stories for provider positions/stacking/fullWidth. |
| app/pages/ui/display-toast.vue | Updates demo page to use provider + queue and adds a dev QA panel. |
| .claude/skills/index.md | Updates skills index entry to reflect new provider/queue pattern. |
| .claude/skills/components/display-toast.md | Expands docs to cover both standalone and queue/provider patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Add app-wide toast queue infrastructure (
DisplayToastProvider+useToastQueue)Summary
useToastQueuecomposable — module-level singleton reactive queue (no Pinia).show()returns an ID,dismiss(id)removes a specific toast,clear()flushes all. Usescrypto.randomUUID()with atoast-prefix for guaranteed unique IDs. The queue is exposed asreadonlyto consumers.DisplayToastProvidercomponent — placed once in the app layout. Consumes the queue and renders visible entries viaTeleport to="body"+TransitionGroup. Supportsposition,alignment,fullWidth, andmaxVisibleprops. Promotes pending entries to visible up tomaxVisible, starts per-entry auto-dismiss timers, and handles Escape-key and close-button dismissal.Queue-driven stacking — toasts queue as
pendingand are promoted sequentially as visible slots open. When a visible toast is dismissed, the next pending entry enters immediately.FLIP animation for stack dismissal —
@before-leavepins each departing toast'stop/widthbefore it becomesposition: absolute, removing it from flex flow so remaining toasts FLIP-animate (viav-move) into their new positions smoothly rather than snapping.min-widthis pinned on the container during each leave and released in@after-leaveto prevent the right-anchoredwidth: max-contentcontainer from collapsing and causing horizontal jitter.Enter animation fix —
DisplayToastProvidernow uses explicitshowTop/showBottomkeyframes (withfromstates) instead of relying onv-enter-frombeing captured by the animation engine, ensuring the slide-in is always visible.Updated demo page (
pages/ui/display-toast.vue) — simplified to two trigger buttons ("Trigger Toast", "Queue Multiple") with a dev-only QA panel for all position/alignment/theme/auto-dismiss/maxVisible controls.New Storybook stories (
DisplayToastProvider.stories.ts) — Default, BottomLeft, Stacked (maxVisible: 3), FullWidth stories with grouped arg controls for provider and toast config.35 tests covering mount, empty state, show/promote, content rendering, data-theme, ARIA roles/live/describedby, tabindex, position/alignment/fullWidth classes, maxVisible gating, close-button dismiss, Escape-key dismiss, auto-dismiss timer, no-auto-dismiss, queue progression, progress bar, and
clear().Skills updated —
display-toast.mdexpanded to document both the standaloneDisplayToastpattern and the new queue-based pattern side-by-side.Test plan
npm run test:run— all 35 tests pass