vUX / MessageBox / v4.1.0
Notifications that drop in from the top, stack without jumping, wait while you read them, and leave on their own.
Every control below sets a config property on one live instance, so each message you post
uses what is set at that moment. Messages already on screen keep the settings they arrived with.
drop, slideLeft and slideRight are driven by the core slide utility,
$$.sm(el).slide. Each leaves the way it came. The space a message takes in its lane opens and
closes with the same utility, which is why the others never jump.
Starts just above the window and drops to its place in the lane. On close it rises back out. This is the default.
Travels leftwards to wherever its alignment puts it. A centred one stops in the middle. It leaves back out to the right.
The mirror image of slideLeft: comes in from the left and leaves back out through it.
A short fade and settle in place. Every other effect falls back to this one when the visitor asks for reduced motion.
No animation at all. A speed of 0 means the same thing with any effect.
show() returns a handle. Use it to close a message when you decide, rather than when the timer does.
Content can also be an element, so a message can carry your own controls.
A sticky "Saving…" message that stays up until the work it reports on finishes, then gives way to the result.
The message body is a node of the page's own, with an Undo button wired by the page. Pressing it closes the message through the handle.
Every config property and every per-call option is checked when it is set, by the same rule, so a typo throws to your code instead of producing a message that silently ignores it.