Repository navigation
toast-v1.7.0
·
5 commits
to main
since this release
New: the @cloudlet/toast/guide subpath, which lets your app hold the Toaster's Island with its
own content, such as the steps of a product tour, while notifications wait in the stack and open
after it. The root entry does not load it, and nothing changes for an app that does not use it:
upgrade from 1.6.0 in place. Published to npm as latest (npm install @cloudlet/toast); this
section takes in the trial prerelease 1.7.0-rc.1 (2026-12-02, npm next) and the change made after
it.
Since 1.7.0-rc.1
IslandGuideContent.refnames the guide for agents apart fromlabel:toasterAgentreports
the Island as held byguest: { ref }with thisref(else thelabel), so a guide can point
agents at its own record on the bridge while screen readers keep reading itslabel. A nonempty
string; anything else is refused asinvalid-input. In 1.7.0-rc.1 thelabelnamed both.
The Island guide
useIslandGuide(controller?)from@cloudlet/toast/guide(the provider's controller when called
without one) returnsshow(content, options?),hide(),active,frameandsubscribeFrame.
The content is data, not a component:title,body,counter(a short position such as2/5),
actions(id,label,variantprimary,quietordefault,disabled,role),
pending,label(the landmark's name),ref(its name for agents), and the callbacks
onAction(id)andonDismiss()(Escape inside the guide; the guide stays untilhide()). Eachshowtakes the whole step and replaces the previous one.- The Toaster draws the guide in its own theme in place of the stack: a dot, the title, the counter
in monospace figures at the end of the row, the text and a row of buttons (a quiet one at the
start, the rest at the end), with no close button. A title without text or buttons draws a compact
pill, for a tour's last word. NewCloudletPartnames reach its parts throughclassNames:
guide,guide-header,guide-title,guide-counter,guide-body,guide-actionsand
guide-action; its badge takesbadge. The host carriesdata-guidemeanwhile. showanswers{ status: 'shown' };{ status: 'waiting', reason: 'no-host' }when noToaster
of the controller is mounted (the guide holds the Island and appears once one mounts); or
{ status: 'rejected' }withoccupied(anotheruseIslandGuideholds the Island: one guide per
controller),no-controller,disposedorinvalid-input(also aninvalid-inputdiagnostic).
A callback that throws is reported as acallback-errordiagnostic.hide(), or unmounting the
component that holds the hook, gives the Island back.frameis where the guide comes to rest, in viewport pixels, and changes with the content or the
layout, not per frame.subscribeFrame(listener)follows the shape as it is drawn: the frame at
once, then on every animation frame in which it moves, outside React, so a pointer or an outline
can follow the guide without a render per frame. It returns the function that stops listening.
Notifications while the guide is there
- Notifications still arrive into the stack and the guide's badge counts them, but none opens the
Island, even withattention: 'open': the attention queue waits for the guide as it waits for a
busy person. Afterhide()the waiting notification opens after the attention delay, as after
any interaction. - Showing a guide collapses an open Island; the controller's snapshot reports the Island collapsed
and the stack presenting its newest notification, so time budgets run by their own rules. While
the guide covers the stack, the presented notification is not read and its time stands still. toasterAgent(@cloudlet/toast/agent) reports the Island as held (guest, named by the
guide'sref, else itslabel, when it has one), and refuses an agent'sopenandshowwith "A tour is in
progress in the Island". The controller's public API and the root entry's types do not change.
Motion
- The guide moves as the Island does. With an empty stack it grows out of a dot in the Island's
place; with notifications waiting it opens out of the stack's pill. A new step springs to its new
size on interruptible springs (a quick change continues from the current shape and speed), and its
title, counter and text blur-swap.hide()folds it back into the pill, or into the Island that a
waiting notification opens, or into the dot when the stack is empty. - A waiting guide's counter (
pending) pulses; the badge springs in and out on the shape's corner;
the stack's flight to a newpositioncarries the guide. Under reduced motion nothing moves in
space: the shape is at its end at once and content changes its opacity for 80 ms, without blur.
Keyboard and screen readers
- The guide is a landmark (
role="region") named by itslabel, else its title, andaria-busy
whilepending. Tab reaches it in its place on the page; F6 or Shift+F6 jumps to its primary
button (else its first enabled one) and, pressed again inside the guide, back to where focus came
from. Without a guide F6 is left to the browser. - Focus never moves into the guide on its own:
show(content, { focus: true })asks for it once,
for a guide the person has just asked for, such as a tour started by a button. - An action with
role: 'next'orrole: 'back'(at most one of each) answers the arrow keys
while focus is in the guide: → pressesnextand ← pressesbackin a left-to-right document,
mirrored in RTL, never a disabled button. - A step that arrives or changes its title, counter or text is read as "title. counter. text" in
the Toaster's polite live region.hide()with focus in the guide returns focus to where it was
before it entered the guide.