magic-pill 9.4.0-next.3 → 9.4.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +10 -7
  3. package/dist/MagicPill/MagicPill.d.mts +2 -1
  4. package/dist/MagicPill/MagicPill.d.ts +2 -1
  5. package/dist/MagicPill/MagicPill.js +11 -3
  6. package/dist/MagicPill/MagicPill.mjs +11 -3
  7. package/dist/Pill/Pill.js +1 -0
  8. package/dist/Pill/Pill.mjs +1 -0
  9. package/dist/Pill/goo.js +90 -37
  10. package/dist/Pill/goo.mjs +90 -37
  11. package/dist/Pill/modal.js +3 -1
  12. package/dist/Pill/modal.mjs +3 -1
  13. package/dist/Pill/morph.js +56 -2
  14. package/dist/Pill/morph.mjs +56 -3
  15. package/dist/PillForm/PillForm.js +6 -1
  16. package/dist/PillForm/PillForm.mjs +7 -2
  17. package/dist/PillForm/dates.js +14 -3
  18. package/dist/PillForm/dates.mjs +14 -3
  19. package/dist/PillForm/room.js +46 -0
  20. package/dist/PillForm/room.mjs +46 -0
  21. package/dist/PillNavbar/PillNavbar.js +3 -1
  22. package/dist/PillNavbar/PillNavbar.mjs +4 -2
  23. package/dist/PillNavbar/room.js +66 -11
  24. package/dist/PillNavbar/room.mjs +66 -12
  25. package/dist/PillNotification/PillNotification.js +2 -4
  26. package/dist/PillNotification/PillNotification.mjs +2 -4
  27. package/dist/PillNotification/RowsBody.js +77 -0
  28. package/dist/PillNotification/RowsBody.mjs +77 -0
  29. package/dist/forms.css +14 -0
  30. package/dist/satellites/Actions.js +269 -16
  31. package/dist/satellites/Actions.mjs +270 -17
  32. package/dist/satellites/Orbitals.js +68 -18
  33. package/dist/satellites/Orbitals.mjs +70 -20
  34. package/dist/satellites/Satellites.js +404 -190
  35. package/dist/satellites/Satellites.mjs +404 -192
  36. package/dist/satellites/handoff.js +36 -0
  37. package/dist/satellites/handoff.mjs +34 -0
  38. package/dist/satellites/measure.js +22 -0
  39. package/dist/satellites/measure.mjs +22 -1
  40. package/dist/satellites/orbits.js +12 -0
  41. package/dist/satellites/orbits.mjs +12 -1
  42. package/dist/satellites/types.d.mts +9 -1
  43. package/dist/satellites/types.d.ts +9 -1
  44. package/dist/styles.css +78 -15
  45. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  ## [Unreleased]
4
4
 
5
5
  ### Added
6
+ - `--mp-focus-ring`: the keyboard focus ring's colour on the pill's actions, electrons and orbitals
7
+ - `--mp-radius`: the pill's corners (half the one-line pill's height by default). Smaller gives a rounded rectangle at any size, a sidebar or a toolbox included; a pill closed to a circle, an electron and its orbitals stay round
8
+ - `--mp-rows-actions-align`: where a notification in rows (`layout="rows"`) puts its actions under the message: `start`, `center` (the default) or `end`, following the text direction
6
9
  - **Beta:** the Electron, in an optional entry, `magic-pill/satellites`: a small round pill that splits out of the host to keep a background activity in reach. `pill().electron()`, `updateElectron()` and `endElectron()`; on `<MagicPill>`, `satellites`, `pathname`, `electronSide`, `electronLine`, `keepElectronsOut`, `electronEnding` and `arrange`. It's tucked into the pill on the page that started it and while a notification has the pill, a tap goes back to that page, and the pill and its electrons stay centred as a group
7
10
  - **Beta:** an electron's orbitals, its quick actions fanned out around it (`orbitals` on `pill().electron()`): opened by a long press (slide to one and release to run it), hovering with a mouse, or a tap (`orbitalsOpenOn`, with a first orbital going back), and the keyboard as a menu. On an arc away from the screen's edge, clear of the pill and the other electrons; when they don't all fit, a wheel that turns with the mouse wheel, a drag along it or the arrow keys, and stays open until a tap away. `orbitalLabels`, `orbitalsStayOpen`, `backLabel`, and the tokens `--mp-orbital-size`, `--mp-orbital-distance`, `--mp-orbital-spread`, `--mp-orbital-stagger`, `--mp-hover-delay` and `--mp-long-press`
8
11
  - **Beta:** the page's actions, the design's wide atom: `usePillActions()` (from `magic-pill/satellites`) and `pill().setActions()` set one or more actions for the current page, next to the pill. `actionsStyle` (`"detached"`, a pill of their own that comes out of the host with the goo, or `"inside"`, after a divider), `actionsSide` (`"start"`, `"end"` or `"beside"`), `actionsOrientation` (`"auto"`, turning across when room runs out, `"horizontal"`, `"vertical"`) and `actionsLabel` on `<MagicPill>`
@@ -14,6 +17,41 @@
14
17
  - The split's tokens, for a sidebar's flag: `--mp-duration-split` and `--mp-duration-join` (the enter and exit durations by default), `--mp-ease-split` (`bouncy`, the default, `pop`, `smooth` or any CSS easing), `--mp-goo` (`12`; `0` for no neck) and `--mp-electron-start` (`0.15`, a droplet)
15
18
 
16
19
  ### Fixed
20
+ - A notification in rows whose message just fits on one line keeps it there: its body took the message's width rounded to the pixel, a hair short, and the message wrapped into two short lines in a box as wide as the one line (a sidebar's notification)
21
+ - A flag's goo has less to draw at every frame: the sidebar's shape under it is cut short around the flag, instead of the sidebar's full height that the filter could still run over, clipped or not (Safari)
22
+ - A sidebar's flag no longer wraps its text as it comes out: out of the sidebar as a circle, its message faded in squeezed to nothing, a word a line, before the flag opened to its width
23
+ - From a longer list of the page's actions to a shorter one (four to two), their pill shrinks over the ones leaving, then they go. They used to vanish at once, the pill shrinking after
24
+ - The page's actions no longer flicker as they go from one list to another (two actions to four, and back): for a frame, they sat by their other edge, as long as the size difference
25
+ - The goo between pills fades with them: orbitals fading into their electron (and an upload going back into its pill) drew their necks to each other at full strength, left over for a moment once they had gone
26
+ - An electron's orbitals close once, from where they are: closed while still coming out (the page scrolling, the pointer leaving), they used to jump to their spots first; asked to close again while closing (the pointer moving, a tap away), they started over and sprang back out each time
27
+ - Beside a pill at the bottom of the screen, the satellites are held by their bottom edge, as the pill is: Safari's toolbar moving the pill (scrolling, a new page coming) moves them with it at once. They stayed where they were, under the address bar, until the next pass, then caught up
28
+ - The page's actions switched into the pill go into it at their size, shrinking only as the droplet, and the pill then grows to hold them, the satellites that stay out waiting and then moving once (an electron no longer changes spot twice, planned from the pill before they had opened in it). Switched out, the pill folds them away in step with its slide, its far edge staying put, and they come out of it once it has settled: it used to slide over an electron beside it, and the electron moved twice
29
+ - Opening a panel next to the satellites: they go beside the panel, sliding along as it opens, or, when the room they take would cut it short (on a phone), into the pill, and the panel then takes that room, centred. They used to be placed beside the navbar under the panel, and the panel covered them
30
+ - The satellites slide along their side whenever they move in their row (the group gathering or spreading, the pill resizing, Safari's toolbar): they used to go down to a circle or a droplet and back past a few pixels, as if they were leaving
31
+ - A satellite going back into the pill (an electron on its own page, the page's actions hidden) goes into it where it is: the pill and the other satellites wait, and move once it's in. The pill used to open its label and slide at once, over it, and it shrank behind the pill
32
+ - A satellite coming out of a pill that's still changing size (its navbar folding its label for it, on a phone) waits for the pill to settle and comes out of its edge then, with the goo: it used to come out at once under the pill still long, and grow on its own once the pill had shrunk away
33
+ - A navbar's label opened by the pointer or the keyboard no longer covers the satellites: the electrons and the page's actions make room as it grows and come back as it closes, the group staying centred (with `labels="auto"` they were planned from the pill with its current page's label only, and it grew over them). They also keep their gap at rest: the pill with its label open measured its end padding twice, 7 px too far on each side
34
+ - An electron coming out next to a navbar that folds its label for it (`labels="auto"`, on a phone) stays in the pill's row again, the label folding as the electron grows out of it: the pill used to jump shorter before the electron was there (its room capped it before the label had folded), and since the satellites plan from the pill open or folded, an electron that would fit beside the folded pill went above it instead
35
+ - Switching the page's actions into the pill (`actionsStyle`) no longer shows them twice: their own pill goes back into the host as when they hide, then they open in the pill. Out of it, they fold away in the pill before their own pill comes out of it, from the pill's edge (it showed at full size at once). In the pill, they open out of nothing as they come and fold away before they go, the pill following its content: it used to jump to its new length at once, and the navbar takes their room back as they fold away
36
+ - An electron's orbitals follow it while they're out: when it moves with the pill (on a phone, Safari's toolbar folding as the page scrolls; the group re-centring), they stayed where they had opened, apart from it, and went back in towards where it had been. They move with it at every frame, on the same arc, their opening or closing going on
37
+ - Placement changes run lighter: as the pill closed and opened, a navbar that folds by itself and the satellites laid out up to three hidden copies of it at every frame, for answers that don't change while it morphs (125 copies per change in the demo, now 27). The navbar checks again only when something it depends on changed (the pill's markup, the screen's size, the page's root, fonts loading); the satellites measure the host's open size once per placement and screen size on its way
38
+ - Turning a phone sideways, the satellites come out of the host in one go: they came out as the host slid to its new spot, followed it one way, then went back the other way to theirs (the electron 642 → 491 → 675 px). Out of a host that slides against their way out, they now wait for it to get there, then come out of its edge
39
+ - The satellites re-plan sooner once the window stops changing size: they waited 200 ms after its last change, a pause you could feel once you let go; now 120 ms, still after a drag (one change per frame)
40
+ - A sidebar's flag comes out with lighter goo: its overlay covered the whole sidebar (as tall as the screen) and its filter worked on four times that, at every frame, slow on a phone. It now covers the flag and the part of the sidebar a neck can reach (about nine times fewer pixels filtered), and every goo filter works on its overlay, not twice its width and height
41
+ - A wheel of orbitals turns from anywhere on its track on a phone: a finger had to land on an orbital (44 px) to turn it, and a swipe starting between two of them closed them, or scrolled the page. A finger now turns it from anywhere on the arc, between the orbitals and a little outside them, and neither the track nor the orbitals scroll the page; a tap on the track, off the orbitals, still closes them. With a mouse, nothing changes
42
+ - A form in the pill itself keeps its field usable on a phone: its submit button's label took the room, and the field was squeezed to a few letters (an e-mail subscription, 60 px on a 393 px screen, nothing at all in a narrow card). Short of room, the button folds its label to its icon, still its name; the field gets it back (184 px). Not while the pill is still growing (out of a circle)
43
+ - A notification in rows (`layout="rows"`) is as wide as what it shows: a wrapped message kept its box as wide as a message can be (`--mp-message-width`), so the pill looked too wide for it, with a gap after its lines. The message fits its longest line, measured on a copy of the pill as it ends up. The actions under it are centred in the pill, instead of lining up with the text; `--mp-rows-actions-align` (`start`, `center` or `end`) lines them up elsewhere
44
+ - The calendar's and `PillDate`'s labels start with a capital in languages that write days and months in lowercase: "Jeudi 24 décembre 2026", "Décembre 2026", "Déc." (was all lowercase in French)
45
+ - A modal no longer shows a focus ring on its first button as it opens after a click or a tap ("Delete", in a question about deleting): the dialog itself takes the focus, as a panel does, and the first Tab reaches the button, with its ring
46
+ - The page's actions in the pill, with their wheel, leave the navbar its room first: they show what fits next to it with its label open (or, when not even one does, next to it folded), the rest in their wheel. A navbar now folds its label when what's beside it in the pill leaves it no room, instead of being squeezed
47
+ - An electron, its orbitals and the page's actions take the tokens set in the host's `style`: the adaptive glass, the light following the pointer, the readability veil and the rest applied to the main pill only (they're pills of their own beside it, so they didn't inherit them)
48
+ - A navbar with `labels="auto"` and satellites could fold and unfold its label every frame, the satellites moving back and forth with it until a phone's page crashed (two electrons and four actions with a wheel, next to the docs' sidebar): they now plan from the host open, if they fit beside it so, or folded, never from the length it has as the label moves
49
+ - Another list of page actions resizes their pill where it is, sliding with the host as the group re-centres: it used to close to a circle, open with the new list, then close again to follow the host. A column of actions next to a bottom pill grows up from the pill's level, instead of jumping up and growing down; actions that turn for a new list close to a circle from where they were, not off to one side over the host
50
+ - Scrolling on a phone no longer sends the electrons back into the pill and out again: Safari's toolbar shrinking moves the pill and every satellite's row with it, which was taken for a new spot
51
+ - An electron that ends as a notification comes (an upload that ends with "Your file is uploaded") goes back into the pill's centre with the others as the pill closes, instead of shrinking on its own next to it as if it popped
52
+ - An electron and the page's actions come out from behind the pill and go back in behind it: they were drawn over it, so an electron's face (its ring, its time) showed on top of the pill as it joined. Their orbitals stay under them, and the goo's necks under them all. An electron's face fades once as it goes back in, instead of fading, showing again and fading a second time
53
+ - An electron shows its keyboard focus ring in apps with their own global `:focus-visible` rule: the app's ring was drawn outside it, in its colour, and the pill hid it. The rings on the pill's actions, electrons and orbitals now stay the library's, and `--mp-focus-ring` sets their colour
54
+ - A pill closing its panel goes to its size in one motion when its navbar folds its labels for the room it has: it shrank, then jumped as the labels folded. The navbar decides as the pill's presence changes, and the pill measures where it's going as it ends up (on a copy with no transitions); if its content still changes size meanwhile (a label opening under the pointer), it gets there smoothly instead of jumping
17
55
  - Opening an electron's orbitals no longer stutters: each orbital's goo ran an SVG filter over the whole screen; it now only covers the two pills it joins (60 frames a second where it fell to about 30, with frames of up to 180 ms)
18
56
  - Two electrons given an empty `id` are two electrons, instead of one flickering between them
19
57
  - The page's actions grow away from the pill when an action's label opens on hover, instead of over it
@@ -28,6 +66,7 @@
28
66
  - An electron and the page's actions come out of the pill and go back into it as the orbitals do, drawing themselves the whole way: on the glass themes they no longer switch colour at the end; changing sides, they no longer flicker between going in and coming out. For a notification, they go into the pill's centre as it closes to a circle
29
67
  - The actions go into the pill and come out of it with the goo when `actionsStyle` changes, instead of disappearing; turned while they were in, they come out turned, instead of at their old shape first. Two satellites passing each other (`nearestToPill` changed) melt together as they meet
30
68
  - An electron's orbitals keep clear of the page's actions, as they do of the other electrons
69
+ - With `avoidPills`, an electron's orbitals also keep clear of the other pills on the screen, as the electrons and the actions do: on a phone, the timer's orbitals no longer open over the docs' sidebar
31
70
  - When the group gathers again (an electron coming or going, the actions changing), the satellites no longer slide across whole: the page's actions close to a circle where they are, move, and open at their new spot; an electron goes down to a droplet, moves, and grows back (a nudge of a few pixels still slides)
32
71
  - An electron and the page's actions come out of the pill as a droplet, as the design drew it: drawn out small on the goo's neck (following the pill as it slides to make room), growing to their size as they come free, then showing their content; going back in, the same played backwards. A sidebar's flag does the same, out of the sidebar's edge. `--mp-electron-start` is now `0.15` (a droplet); `--mp-ease-split`, when set, still picks the curve
33
72
  - An electron's orbitals come out from behind it and go back in behind it, instead of over what it shows
@@ -38,6 +77,7 @@
38
77
  - With electrons or actions out, a pill changing placement goes there through the circle in one movement, from and to any placement: it used to jump across the screen as it closed (to or from the top and bottom, the start and end placements, between the bottom and a side), laid out for its new placement while still at its old one. Next to another pill of the same side, it no longer flashes aside as it sets off
39
78
 
40
79
  ### Changed
80
+ - **Beta:** `actionsWheel` is on by default for the page's actions in the pill (`actionsStyle="inside"`): short of room, they show what fits next to the navbar and turn the rest in their wheel; `false` shows them all. Still off by default for a pill of their own
41
81
  - A navbar whose current page's label has no room folds it (`labels="auto"`, the new default), instead of the pill cutting its last items off. `labels="current"` keeps the old behaviour
42
82
  - A sidebar's flag comes out of the sidebar's edge as a droplet, with goo: a neck forms between them, stretches and snaps, on a bouncy curve, and it goes back into the sidebar the same way. It no longer pops in at its spot with a short bridge, nor scales in and out. With reduced motion it still fades. On the glass themes, its blur waits until it's clear of the sidebar
43
83
 
package/README.md CHANGED
@@ -119,7 +119,7 @@ const id = pill().notify({
119
119
  | `panel` | `{ title?, titleAction?, content, footer?, trigger?, closeLabel?, closeExpanded? }` | A "Learn more" action that grows the pill into a panel. `trigger` defaults to `{ icon: <PlusIcon />, label: "Learn more" }` and takes `expanded` too, `closeLabel` to `"Close"`: like the other labels, it shows on hover and focus, or all the time with `closeExpanded`. `titleAction` and `footer`: see [the panel](#the-primitive). |
120
120
  | `variant` | `"neutral"` · `"success"` · `"danger"` · any string | Defaults to the host's variant. |
121
121
  | `duration` | `number` (ms) | Defaults to the host's (5000). `Infinity` keeps it until dismissed. |
122
- | `layout` | `"pill"` · `"rows"` · `"card"` · `"flag"` | Defaults to the host's `notificationLayout`. `"rows"` puts the actions under the message when they need the room: when the message wraps, or with an action and a panel. Under it, they line up with the message. `"card"`, in a sidebar: a column of the sidebar's width (at least `--mp-card-width`, `12.5rem`), the icon on top, the actions full width with their labels; a horizontal host shows it in one row. `"flag"`, in a `left` or `right` sidebar with a base layer: a pill of its own out of the sidebar's edge, while the sidebar stays (see below). |
122
+ | `layout` | `"pill"` · `"rows"` · `"card"` · `"flag"` | Defaults to the host's `notificationLayout`. `"rows"` puts the actions under the message when they need the room: when the message wraps, or with an action and a panel. Under it, they're centred in the pill (`--mp-rows-actions-align` lines them up at the `start` or the `end` instead), and the pill is as wide as the message's longest line. `"card"`, in a sidebar: a column of the sidebar's width (at least `--mp-card-width`, `12.5rem`), the icon on top, the actions full width with their labels; a horizontal host shows it in one row. `"flag"`, in a `left` or `right` sidebar with a base layer: a pill of its own out of the sidebar's edge, while the sidebar stays (see below). |
123
123
  | `at` | `string` | `"flag"` only: the `href` of the navbar item it's about, to come out next to it (matched as the navbar matches the current page). Default: the middle of the sidebar. |
124
124
  | `id` | `string` | Notifying again with the same id updates the notification in place. |
125
125
  | `announce` | `string` · `false` | What screen readers hear. Defaults to the message's text. |
@@ -337,7 +337,7 @@ pill().electron({
337
337
  ```
338
338
 
339
339
  - A long press opens them. Keep pressing, slide to one (it's picked by its angle from the electron) and release to run it; released on none, they stay open until a tap away. While they're open, a press slides onto one at once. With a mouse, hovering opens them too, and they close once the pointer leaves them; on their way back in, they're out of reach.
340
- - They fan out on an arc away from the screen's edge, clear of the pill, the other electrons, the page's actions and the screen's edges, moving out a little if they must. **When they don't all fit, they're a wheel:** the arc shows what fits and turns to show the others, with the mouse wheel, a drag along it, or the arrow keys (it brings the focused one into view). One past an end fades out (it peeks out faintly where its spot is clear). A wheel stays open until a tap away or Escape. `--mp-orbital-size` (an action's size), `--mp-orbital-distance` (`0.875rem`), `--mp-orbital-spread` (`auto`, or an angle such as `120deg`), `--mp-orbital-stagger` (`30ms`), `--mp-hover-delay` (`300ms`) and `--mp-long-press` (`450ms`) tune them.
340
+ - They fan out on an arc away from the screen's edge, clear of the pill, the other electrons, the page's actions and the screen's edges, moving out a little if they must. **When they don't all fit, they're a wheel:** the arc shows what fits and turns to show the others, with the mouse wheel, a drag along it, or the arrow keys (it brings the focused one into view). On a touchscreen, a finger turns it from anywhere on its track, between the orbitals and a little outside them too, and the page doesn't scroll under it; a tap on the track, off the orbitals, closes them. One past an end fades out (it peeks out faintly where its spot is clear). A wheel stays open until a tap away or Escape. `--mp-orbital-size` (an action's size), `--mp-orbital-distance` (`0.875rem`), `--mp-orbital-spread` (`auto`, or an angle such as `120deg`), `--mp-orbital-stagger` (`30ms`), `--mp-hover-delay` (`300ms`) and `--mp-long-press` (`450ms`) tune them.
341
341
  - The keyboard opens them with the arrow pointing away from the edge, Shift+F10 or the context-menu key, and goes round them with the arrows, Home and End; Escape closes them and gives the focus back. An ARIA menu named after the electron.
342
342
 
343
343
  **How it behaves:**
@@ -368,12 +368,12 @@ export function InboxPage() {
368
368
 
369
369
  | Host prop | Default | Notes |
370
370
  |---|---|---|
371
- | `actionsStyle` | `"detached"` | `"detached"`: a pill of their own, which comes out of the host with the goo and goes back into it when the page has none (or while a notification has the pill). `"inside"`: in the pill itself, after a divider. Changing it, they go into the pill (or out of it) with the goo. |
371
+ | `actionsStyle` | `"detached"` | `"detached"`: a pill of their own, which comes out of the host with the goo and goes back into it when the page has none (or while a notification has the pill). `"inside"`: in the pill itself, after a divider, opening out of nothing as they come and folding away before they go. Changing it, their own pill goes back into the host before they open in it; the other way, they fold away in the pill before their own pill comes out of it. |
372
372
  | `actionsSide` | `"start"` | `"start"` or `"end"` (following the text direction: under the thumb you want), or `"beside"` (one row towards the page). |
373
373
  | `actionsOrientation` | `"auto"` | `"auto"`: like the pill, turning across it when they'd leave the pill too little room (a column next to a bottom pill), in its row or in the row beside it; decided again once a resize settles. `"horizontal"` or `"vertical"`, always. Turning, they close to a circle where they are and open again the other way, as the pill does when it changes placement. |
374
- | `actionsWheel` | `false` | Short of room, they show what fits (two at least in the pill's row) and the others turn in, like the orbitals' wheel: a mouse wheel, a drag, a swipe or the arrow keys, each one snapping into place, the ends that hide some fading out. Instead of turning across. In the pill (`"inside"`), the cut starts at the divider. |
374
+ | `actionsWheel` | `true` in the pill, `false` in a pill of their own | Short of room, they show what fits (two at least in the pill's row) and the others turn in, like the orbitals' wheel: a mouse wheel, a drag, a swipe or the arrow keys, each one snapping into place, the ends that hide some fading out. Instead of turning across. In the pill (`"inside"`), the cut starts at the divider, and the navbar keeps its room first: `false` there shows them all. |
375
375
  | `nearestToPill` | `"actions"` | On a side they share, the page's actions are nearer the pill, or `"electrons"` are. |
376
- | `avoidPills` | `true` | The satellites keep clear of the other pills on the screen (a sidebar, a help pill): over one, the actions go to the other side, then turn across, then (with `actionsWheel`) show fewer; the layout that covers them least when none is clear. `false`: they go where the props say. |
376
+ | `avoidPills` | `true` | The satellites keep clear of the other pills on the screen (a sidebar, a help pill): over one, the actions go to the other side, then turn across, then (with `actionsWheel`) show fewer; the layout that covers them least when none is clear. An electron's orbitals turn away from them too (a wheel shows what fits clear of them). `false`: they go where the props say. |
377
377
  | `actionsLabel` | `"Page actions"` | Their accessible name. |
378
378
 
379
379
  Short of room, the actions turn across first (`"auto"`, or show what fits with `actionsWheel`), then the farthest ones go beside the pill: the last electrons, then the first electron and the actions, the nearer of them last. They slide with the group as it changes (gathered or spread, another one coming or going).
@@ -542,7 +542,7 @@ async function send(data: FormData) {
542
542
  | `disabled` / `busy` | `false` | Disables every field (`busy`: while something is being sent; `onSend` does it for you) |
543
543
 
544
544
  - **Validation** is the browser's own (`required`, `type`, `pattern`, `min`…), in the reader's language: on an attempt to submit, which focuses the first wrong field, or on leaving a field that was changed and is wrong. A message goes as soon as the value is right.
545
- - **In the pill itself**, a `<PillForm>` is a row, with fields as tall as the actions: one field, one action.
545
+ - **In the pill itself**, a `<PillForm>` is a row, with fields as tall as the actions: one field, one action. Short of room (a phone), its `expanded` submit button folds its label to its icon (still its name, read out), so the field keeps room to type in.
546
546
  - **On phones**, the pill stays above the keyboard while one of its fields has the focus.
547
547
  - **Escape** closes an open list, not the panel.
548
548
  - **Notifications wait** while a form of the base layer is open, so what's being typed isn't taken away. The base layer unmounts while a notification shows: keep what must last in your own state.
@@ -658,8 +658,11 @@ An `<img>` keeps its file's colours: `currentColor` only reaches inline SVGs and
658
658
  | `--mp-text-size` / `--mp-title-size` | fluid, about 1rem / 1.5–2rem |
659
659
  | `--mp-padding` / `--mp-gap` / `--mp-action-size` | `0.875rem` / `1rem` / `2.75rem` |
660
660
  | `--mp-max-width` / `--mp-message-width` / `--mp-panel-width` | `48rem` / `24rem` / `32rem` |
661
+ | `--mp-rows-actions-align` | `center`: where a notification in `rows` puts its actions on their own line under the message: `start`, `center` or `end` (following the text direction) |
661
662
  | `--mp-card-width` | `12.5rem`: a sidebar's notification card, at the least (it keeps the sidebar's width if that's wider) |
663
+ | `--mp-radius` | Half the one-line pill's height: the pill's corners. Smaller makes a rounded rectangle at any size (a sidebar, a toolbox); a pill closed to a circle, an electron and its orbitals stay round |
662
664
  | `--mp-radius-panel` / `--mp-shadow` | `2.5rem` / a soft drop shadow |
665
+ | `--mp-focus-ring` | The keyboard focus ring's colour on the pill's actions, an electron and its orbitals: the text's colour by default. Drawn by the stylesheet even over an app's own global `:focus-visible` rule, which would draw it outside the item, where the pill hides it |
663
666
  | `--mp-offset` / `--mp-z-index` | `1.5rem` from the viewport edges (plus safe areas) / `50` |
664
667
  | `--mp-backdrop` / `--mp-backdrop-blur` | the overlay's backdrop: `rgb(20 20 20 / 0.4)` / no blur |
665
668
  | `--mp-duration-enter` / `--mp-duration-change` / `--mp-duration-exit` | `500ms` / `250ms` / `300ms` |
@@ -677,7 +680,7 @@ The pill fits small screens: sizes are in `rem`, fixed pills stay inside the vie
677
680
 
678
681
  **Sidebars:** a `left` or `right` pill lines its items up along the screen edge, and on the right-hand side its labels open towards the middle of the screen, so the icons stay in line (mirrored in right-to-left pages). Set `--mp-align` to change the alignment.
679
682
 
680
- **Shape and motion:** the pill animates its real size whenever its presence changes (a script measures it; with `unstyled` or reduced motion it doesn't). Its corners are half the one-line pill's height, so a taller pill, such as a wrapped message, is a rounded rectangle; a panel's corners are `--mp-radius-panel`.
683
+ **Shape and motion:** the pill animates its real size whenever its presence changes (a script measures it; with `unstyled` or reduced motion it doesn't). Its corners are half the one-line pill's height (`--mp-radius` makes them smaller), so a taller pill, such as a wrapped message, is a rounded rectangle; a panel's corners are `--mp-radius-panel`.
681
684
 
682
685
  ### Themes
683
686
  A theme is the pill's material. `glass` (frosted glass) and `liquid` (clearer, thicker Liquid Glass) come in a second stylesheet, so plain pills don't load them. Import it once, before or after `styles.css`:
@@ -89,7 +89,8 @@ export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPre
89
89
  /**
90
90
  * Short of room, the page's actions show what fits and turn the rest in a
91
91
  * wheel (a mouse wheel, a drag, the arrow keys), instead of turning across.
92
- * Default false (beta).
92
+ * Default: true in the pill (`actionsStyle="inside"`: the navbar keeps its
93
+ * room), false in a pill of their own (beta).
93
94
  */
94
95
  actionsWheel?: boolean;
95
96
  /** On a side they share, the page's actions are nearer the pill (default), or the electrons (beta). */
@@ -89,7 +89,8 @@ export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPre
89
89
  /**
90
90
  * Short of room, the page's actions show what fits and turn the rest in a
91
91
  * wheel (a mouse wheel, a drag, the arrow keys), instead of turning across.
92
- * Default false (beta).
92
+ * Default: true in the pill (`actionsStyle="inside"`: the navbar keeps its
93
+ * room), false in a pill of their own (beta).
93
94
  */
94
95
  actionsWheel?: boolean;
95
96
  /** On a side they share, the page's actions are nearer the pill (default), or the electrons (beta). */
@@ -83,7 +83,7 @@ const notificationIn = ({ scene, presence }) => scene.kind === "notification" &&
83
83
  * The batteries-included pill: a <Pill> with a base layer, a queue of
84
84
  * notifications fed by pill(name), and a live region that announces them.
85
85
  */
86
- const MagicPill = (0, react.forwardRef)(function MagicPill({ name = "main", children, scene, duration = DEFAULT_DURATION, idle = "hidden", idleIcon, swap = "queue", notificationLayout = "pill", linkComponent, classNames, pathname, satellites, electronSide = "after", electronLine = "along", keepElectronsOut = false, electronEnding = "join", arrange = "gather", orbitalsOpenOn = "press-hover", orbitalLabels = true, orbitalsMore = "peek", orbitalsStayOpen = true, actionsStyle = "detached", actionsSide = "start", actionsOrientation = "auto", actionsWheel = false, nearestToPill = "actions", avoidPills = true, actionsLabel = "Page actions", placement = "bottom", orientation, moveThroughCircle, variant, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }, forwardedRef) {
86
+ const MagicPill = (0, react.forwardRef)(function MagicPill({ name = "main", children, scene, duration = DEFAULT_DURATION, idle = "hidden", idleIcon, swap = "queue", notificationLayout = "pill", linkComponent, classNames, pathname, satellites, electronSide = "after", electronLine = "along", keepElectronsOut = false, electronEnding = "join", arrange = "gather", orbitalsOpenOn = "press-hover", orbitalLabels = true, orbitalsMore = "peek", orbitalsStayOpen = true, actionsStyle = "detached", actionsSide = "start", actionsOrientation = "auto", actionsWheel: actionsWheelProp, nearestToPill = "actions", avoidPills = true, actionsLabel = "Page actions", placement = "bottom", orientation, moveThroughCircle, variant, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }, forwardedRef) {
87
87
  const store = require_store.getStore(name);
88
88
  const { current } = require_usePillQueue.usePillQueue(name);
89
89
  const rootRef = (0, react.useRef)(null);
@@ -260,9 +260,11 @@ const MagicPill = (0, react.forwardRef)(function MagicPill({ name = "main", chil
260
260
  vertical: isVertical,
261
261
  pathname,
262
262
  notifying: target.kind === "notification" || displayed.scene.kind === "notification" || hasBase && !require_choreography.isOpen(displayed.presence),
263
+ panel: displayed.presence === "panel",
263
264
  linkComponent,
264
265
  variant,
265
266
  theme: rest.theme,
267
+ tokens: hostTokens(rest.style),
266
268
  electronSide,
267
269
  electronLine,
268
270
  keepElectronsOut,
@@ -275,12 +277,12 @@ const MagicPill = (0, react.forwardRef)(function MagicPill({ name = "main", chil
275
277
  actionsStyle,
276
278
  actionsSide,
277
279
  actionsOrientation,
278
- actionsWheel,
280
+ actionsWheel: actionsWheelProp ?? actionsStyle === "inside",
279
281
  nearestToPill,
280
282
  avoidPills,
281
283
  actionsLabel
282
284
  } : void 0;
283
- const inside = satellites && satelliteHost && actionsStyle === "inside" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(satellites.Inside, { host: satelliteHost }) : null;
285
+ const inside = satellites && satelliteHost ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(satellites.Inside, { host: satelliteHost }) : null;
284
286
  const renderScene = (shownScene) => {
285
287
  switch (shownScene.kind) {
286
288
  case "base": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [
@@ -380,5 +382,11 @@ const MagicPill = (0, react.forwardRef)(function MagicPill({ name = "main", chil
380
382
  })
381
383
  ] });
382
384
  });
385
+ /** The tokens (`--mp-*`) in a style, for the satellites: undefined when there are none. */
386
+ function hostTokens(style) {
387
+ if (!style) return void 0;
388
+ const entries = Object.entries(style).filter(([name]) => name.startsWith("--mp-"));
389
+ return entries.length > 0 ? Object.fromEntries(entries) : void 0;
390
+ }
383
391
 
384
392
  module.exports = MagicPill;
@@ -83,7 +83,7 @@ const notificationIn = ({ scene, presence }) => scene.kind === "notification" &&
83
83
  * The batteries-included pill: a <Pill> with a base layer, a queue of
84
84
  * notifications fed by pill(name), and a live region that announces them.
85
85
  */
86
- const MagicPill = forwardRef(function MagicPill({ name = "main", children, scene, duration = DEFAULT_DURATION, idle = "hidden", idleIcon, swap = "queue", notificationLayout = "pill", linkComponent, classNames, pathname, satellites, electronSide = "after", electronLine = "along", keepElectronsOut = false, electronEnding = "join", arrange = "gather", orbitalsOpenOn = "press-hover", orbitalLabels = true, orbitalsMore = "peek", orbitalsStayOpen = true, actionsStyle = "detached", actionsSide = "start", actionsOrientation = "auto", actionsWheel = false, nearestToPill = "actions", avoidPills = true, actionsLabel = "Page actions", placement = "bottom", orientation, moveThroughCircle, variant, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }, forwardedRef) {
86
+ const MagicPill = forwardRef(function MagicPill({ name = "main", children, scene, duration = DEFAULT_DURATION, idle = "hidden", idleIcon, swap = "queue", notificationLayout = "pill", linkComponent, classNames, pathname, satellites, electronSide = "after", electronLine = "along", keepElectronsOut = false, electronEnding = "join", arrange = "gather", orbitalsOpenOn = "press-hover", orbitalLabels = true, orbitalsMore = "peek", orbitalsStayOpen = true, actionsStyle = "detached", actionsSide = "start", actionsOrientation = "auto", actionsWheel: actionsWheelProp, nearestToPill = "actions", avoidPills = true, actionsLabel = "Page actions", placement = "bottom", orientation, moveThroughCircle, variant, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }, forwardedRef) {
87
87
  const store = getStore(name);
88
88
  const { current } = usePillQueue(name);
89
89
  const rootRef = useRef(null);
@@ -260,9 +260,11 @@ const MagicPill = forwardRef(function MagicPill({ name = "main", children, scene
260
260
  vertical: isVertical,
261
261
  pathname,
262
262
  notifying: target.kind === "notification" || displayed.scene.kind === "notification" || hasBase && !isOpen(displayed.presence),
263
+ panel: displayed.presence === "panel",
263
264
  linkComponent,
264
265
  variant,
265
266
  theme: rest.theme,
267
+ tokens: hostTokens(rest.style),
266
268
  electronSide,
267
269
  electronLine,
268
270
  keepElectronsOut,
@@ -275,12 +277,12 @@ const MagicPill = forwardRef(function MagicPill({ name = "main", children, scene
275
277
  actionsStyle,
276
278
  actionsSide,
277
279
  actionsOrientation,
278
- actionsWheel,
280
+ actionsWheel: actionsWheelProp ?? actionsStyle === "inside",
279
281
  nearestToPill,
280
282
  avoidPills,
281
283
  actionsLabel
282
284
  } : void 0;
283
- const inside = satellites && satelliteHost && actionsStyle === "inside" ? /* @__PURE__ */ jsx(satellites.Inside, { host: satelliteHost }) : null;
285
+ const inside = satellites && satelliteHost ? /* @__PURE__ */ jsx(satellites.Inside, { host: satelliteHost }) : null;
284
286
  const renderScene = (shownScene) => {
285
287
  switch (shownScene.kind) {
286
288
  case "base": return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -380,5 +382,11 @@ const MagicPill = forwardRef(function MagicPill({ name = "main", children, scene
380
382
  })
381
383
  ] });
382
384
  });
385
+ /** The tokens (`--mp-*`) in a style, for the satellites: undefined when there are none. */
386
+ function hostTokens(style) {
387
+ if (!style) return void 0;
388
+ const entries = Object.entries(style).filter(([name]) => name.startsWith("--mp-"));
389
+ return entries.length > 0 ? Object.fromEntries(entries) : void 0;
390
+ }
383
391
 
384
392
  export { MagicPill as default };
package/dist/Pill/Pill.js CHANGED
@@ -140,6 +140,7 @@ const Pill = (0, react.forwardRef)(function Pill({ presence: presenceProp, defau
140
140
  ...require_react.inertProps(!isVisible),
141
141
  onKeyDown: handleKeyDown,
142
142
  ...isOverlay && {
143
+ tabIndex: -1,
143
144
  onCancel: handleCancel,
144
145
  onClose: handleClose,
145
146
  ...closeOnBackdropClick && {
@@ -140,6 +140,7 @@ const Pill = forwardRef(function Pill({ presence: presenceProp, defaultPresence
140
140
  ...inertProps(!isVisible),
141
141
  onKeyDown: handleKeyDown,
142
142
  ...isOverlay && {
143
+ tabIndex: -1,
143
144
  onCancel: handleCancel,
144
145
  onClose: handleClose,
145
146
  ...closeOnBackdropClick && {
package/dist/Pill/goo.js CHANGED
@@ -111,26 +111,43 @@ function dropShadow(boxShadow) {
111
111
  const running = /* @__PURE__ */ new WeakMap();
112
112
  let overlays = 0;
113
113
  const SVG = "http://www.w3.org/2000/svg";
114
+ /**
115
+ * The z-index a pill is drawn at: its own, or the one of the nearest element around it that has one
116
+ * (an orbital's menu). 50 (the library's default) when none says.
117
+ */
118
+ function stackLevel(element) {
119
+ for (let node = element; node; node = node.parentElement) {
120
+ const level = Number.parseInt(getComputedStyle(node).zIndex, 10);
121
+ if (Number.isFinite(level)) return level;
122
+ }
123
+ return 50;
124
+ }
125
+ /**
126
+ * The area a goo filter works on: its layer, a little past it. The layer leaves room for the blur and
127
+ * the shadow already (`margin`); the filter worked on twice its width and height, four times its area,
128
+ * at every frame, and filters cost by the pixel (WebKit's most of all)
129
+ */
130
+ const FILTER_REGION = {
131
+ x: "-10%",
132
+ y: "-10%",
133
+ width: "120%",
134
+ height: "120%",
135
+ "color-interpolation-filters": "sRGB"
136
+ };
114
137
  /** The overlay: a filter (blur, threshold, the anchor's inside cut out, a fill, a shadow) and two shapes. */
115
138
  function createOverlay(zIndex, color, shadow) {
116
139
  const id = `mp-goo-${++overlays}`;
117
140
  const root = document.createElement("div");
118
141
  root.setAttribute("data-mp", "goo");
119
142
  root.setAttribute("aria-hidden", "true");
120
- root.style.cssText = `position:fixed;left:0;top:0;width:0;height:0;pointer-events:none;z-index:${zIndex};`;
143
+ root.style.cssText = `position:fixed;left:0;top:0;width:0;height:0;overflow:hidden;pointer-events:none;z-index:${zIndex};`;
121
144
  const svg = document.createElementNS(SVG, "svg");
122
145
  svg.setAttribute("width", "0");
123
146
  svg.setAttribute("height", "0");
124
147
  svg.style.position = "absolute";
125
148
  const filter = document.createElementNS(SVG, "filter");
126
149
  filter.id = id;
127
- for (const [name, value] of Object.entries({
128
- x: "-50%",
129
- y: "-50%",
130
- width: "200%",
131
- height: "200%",
132
- "color-interpolation-filters": "sRGB"
133
- })) filter.setAttribute(name, value);
150
+ for (const [name, value] of Object.entries(FILTER_REGION)) filter.setAttribute(name, value);
134
151
  filter.innerHTML = `
135
152
  <feGaussianBlur in="SourceAlpha" stdDeviation="0" result="blur"/>
136
153
  <feComponentTransfer in="blur" result="goo"><feFuncA type="linear" slope="24" intercept="-12"/></feComponentTransfer>
@@ -173,24 +190,38 @@ function createOverlay(zIndex, color, shadow) {
173
190
  * Puts the overlay around the two pills (with `margin` for the blur and the
174
191
  * shadow), and each shape where its pill is, with its rounded corners at its
175
192
  * current scale (`radius`: read once, at its full size).
193
+ *
194
+ * Around the moving pill only, as far as a neck can reach: a sidebar a flag
195
+ * comes out of is as tall as the screen, and the filter ran over all of it at
196
+ * every frame (slow on a phone). Its shape still runs past the overlay, which
197
+ * clips it, so its ends (rounded by the blur) never show.
176
198
  */
177
199
  function placeAll(overlay, pills, radii, margin) {
178
200
  const a = pills.anchor.getBoundingClientRect();
179
201
  const m = pills.moving.getBoundingClientRect();
180
- const left = Math.min(a.left, m.left) - margin;
181
- const top = Math.min(a.top, m.top) - margin;
202
+ const reach = margin;
203
+ const left = Math.max(Math.min(a.left, m.left), m.left - reach) - margin;
204
+ const top = Math.max(Math.min(a.top, m.top), m.top - reach) - margin;
205
+ const right = Math.min(Math.max(a.right, m.right), m.right + reach) + margin;
206
+ const bottom = Math.min(Math.max(a.bottom, m.bottom), m.bottom + reach) + margin;
182
207
  const root = overlay.root.style;
183
208
  root.transform = `translate(${left}px, ${top}px)`;
184
- root.width = `${Math.max(a.right, m.right) + margin - left}px`;
185
- root.height = `${Math.max(a.bottom, m.bottom) + margin - top}px`;
186
- const put = (shape, rect, element, radius) => {
209
+ root.width = `${right - left}px`;
210
+ root.height = `${bottom - top}px`;
211
+ const put = (shape, rect, element, radius, cut = false) => {
187
212
  const scale = element.offsetWidth > 0 ? rect.width / element.offsetWidth : 1;
188
- shape.style.width = `${rect.width}px`;
189
- shape.style.height = `${rect.height}px`;
190
- shape.style.transform = `translate(${rect.left - left}px, ${rect.top - top}px)`;
191
- shape.style.borderRadius = `${Math.min(radius * scale, rect.width / 2, rect.height / 2)}px`;
213
+ const corner = Math.min(radius * scale, rect.width / 2, rect.height / 2);
214
+ const spare = cut ? margin + corner : Number.POSITIVE_INFINITY;
215
+ const x = Math.max(rect.left, left - spare);
216
+ const y = Math.max(rect.top, top - spare);
217
+ const width = Math.max(0, Math.min(rect.right, right + spare) - x);
218
+ const height = Math.max(0, Math.min(rect.bottom, bottom + spare) - y);
219
+ shape.style.width = `${width}px`;
220
+ shape.style.height = `${height}px`;
221
+ shape.style.transform = `translate(${x - left}px, ${y - top}px)`;
222
+ shape.style.borderRadius = `${corner}px`;
192
223
  };
193
- put(overlay.anchor, a, pills.anchor, radii.anchor);
224
+ put(overlay.anchor, a, pills.anchor, radii.anchor, true);
194
225
  put(overlay.moving, m, pills.moving, radii.moving);
195
226
  }
196
227
  const OWN_LOOK = {
@@ -309,7 +340,11 @@ function playSplit(anchor, moving, kind, timing) {
309
340
  easing: POP
310
341
  });
311
342
  }
312
- const content = [...moving.children].filter((child) => !["panel", "outgoing"].includes(child.getAttribute("data-mp") ?? ""));
343
+ const circle = kind === "split" && ["rest", "hidden"].includes(moving.dataset.presence ?? "");
344
+ const content = [...moving.children].filter((child) => {
345
+ const part = child.getAttribute("data-mp") ?? "";
346
+ return !["panel", "outgoing"].includes(part) && (!circle || part === "icon");
347
+ });
313
348
  const total = timing.duration + fade;
314
349
  for (const child of content) if (kind === "split") child.animate([
315
350
  { opacity: 0 },
@@ -409,6 +444,16 @@ const budding = /* @__PURE__ */ new WeakMap();
409
444
  * electron out of its host or out of the one next to it, the page's actions.
410
445
  */
411
446
  function playOrbit(electron, items, kind, timing) {
447
+ const drawn = /* @__PURE__ */ new Map();
448
+ for (const { element } of items) {
449
+ if (kind !== "close" || !(element.getAnimations?.() ?? []).some((animation) => animation.id === "mp-split" && animation.playState === "running")) continue;
450
+ const now = getComputedStyle(element);
451
+ drawn.set(element, {
452
+ translate: !now.translate || now.translate === "none" ? "0px 0px" : now.translate,
453
+ scale: !now.scale || now.scale === "none" ? "1" : now.scale,
454
+ opacity: Number.parseFloat(now.opacity) || 0
455
+ });
456
+ }
412
457
  for (const { element } of items) {
413
458
  budding.get(element)?.();
414
459
  for (const animation of element.getAnimations?.({ subtree: true }) ?? []) if (animation.id === "mp-split") animation.cancel();
@@ -420,6 +465,21 @@ function playOrbit(electron, items, kind, timing) {
420
465
  const cx = centre.left + centre.width / 2;
421
466
  const cy = centre.top + centre.height / 2;
422
467
  const longest = Math.max(...items.map(({ delay }) => delay)) + timing.duration;
468
+ const anchorLevel = stackLevel(electron);
469
+ const lowered = [];
470
+ for (const { element } of items) {
471
+ if (stackLevel(element) < anchorLevel) continue;
472
+ lowered.push([element, element.style.zIndex]);
473
+ element.style.zIndex = String(anchorLevel - 1);
474
+ }
475
+ let restored = false;
476
+ const restore = () => {
477
+ if (restored) return;
478
+ restored = true;
479
+ clearTimeout(timer);
480
+ for (const [element, zIndex] of lowered) element.style.zIndex = zIndex;
481
+ };
482
+ const timer = lowered.length > 0 ? setTimeout(restore, longest) : void 0;
423
483
  for (const { element, delay, shown = 1, from = atPoint(cx, cy), droplet = false, opaque = droplet } of items) {
424
484
  if (shown <= 0) continue;
425
485
  const start = from(element.getBoundingClientRect(), element);
@@ -429,7 +489,7 @@ function playOrbit(electron, items, kind, timing) {
429
489
  scale: String(start.scale),
430
490
  opacity: opaque ? shown : 0
431
491
  };
432
- const out = {
492
+ const out = drawn.get(element) ?? {
433
493
  translate: "0px 0px",
434
494
  scale: end === "none" ? "1" : end,
435
495
  opacity: shown
@@ -453,7 +513,7 @@ function playOrbit(electron, items, kind, timing) {
453
513
  id: SPLIT,
454
514
  duration: timing.duration,
455
515
  delay,
456
- fill: kind === "open" ? "backwards" : "forwards"
516
+ fill: kind === "open" ? "backwards" : "both"
457
517
  };
458
518
  const ends = (kind === "open" ? [inside, out] : [out, inside]).map(({ translate, scale }) => ({
459
519
  translate,
@@ -497,14 +557,10 @@ function playOrbit(electron, items, kind, timing) {
497
557
  offset: .7
498
558
  },
499
559
  { opacity: 1 }
500
- ] : [
501
- { opacity: 1 },
502
- {
503
- opacity: 0,
504
- offset: .3
505
- },
506
- { opacity: 0 }
507
- ];
560
+ ] : [{
561
+ opacity: 0,
562
+ offset: .3
563
+ }, { opacity: 0 }];
508
564
  for (const child of element.children) child.animate(content, {
509
565
  ...options,
510
566
  easing: "linear"
@@ -514,6 +570,7 @@ function playOrbit(electron, items, kind, timing) {
514
570
  const stop = playNecks([electron, ...items.filter(({ shown = 1 }) => shown > 0).map(({ element }) => element)], longest);
515
571
  const stopAll = () => {
516
572
  stop();
573
+ restore();
517
574
  for (const { element } of items) if (budding.get(element) === stopAll) budding.delete(element);
518
575
  };
519
576
  for (const { element } of items) budding.set(element, stopAll);
@@ -535,20 +592,15 @@ function playNecks(pills, duration) {
535
592
  const root = document.createElement("div");
536
593
  root.setAttribute("data-mp", "goo");
537
594
  root.setAttribute("aria-hidden", "true");
538
- root.style.cssText = `position:fixed;left:0;top:0;width:0;height:0;pointer-events:none;z-index:${(Number.parseInt(style.zIndex, 10) || 50) - 1};`;
595
+ const level = Math.min(...pills.map(stackLevel)) - 1;
596
+ root.style.cssText = `position:fixed;left:0;top:0;width:0;height:0;pointer-events:none;z-index:${level};`;
539
597
  const svg = document.createElementNS(SVG, "svg");
540
598
  svg.setAttribute("width", "0");
541
599
  svg.setAttribute("height", "0");
542
600
  svg.style.position = "absolute";
543
601
  const filter = document.createElementNS(SVG, "filter");
544
602
  filter.id = id;
545
- for (const [name, value] of Object.entries({
546
- x: "-50%",
547
- y: "-50%",
548
- width: "200%",
549
- height: "200%",
550
- "color-interpolation-filters": "sRGB"
551
- })) filter.setAttribute(name, value);
603
+ for (const [name, value] of Object.entries(FILTER_REGION)) filter.setAttribute(name, value);
552
604
  filter.innerHTML = `
553
605
  <feGaussianBlur in="SourceAlpha" stdDeviation="0" result="blur"/>
554
606
  <feComponentTransfer in="blur" result="goo"><feFuncA type="linear" slope="24" intercept="-12"/></feComponentTransfer>
@@ -596,6 +648,7 @@ function playNecks(pills, duration) {
596
648
  shape.height = `${rect.height}px`;
597
649
  shape.transform = `translate(${rect.left - left}px, ${rect.top - top}px)`;
598
650
  shape.borderRadius = `${Math.min(radii[index] * scale, rect.width / 2, rect.height / 2)}px`;
651
+ shape.opacity = getComputedStyle(pills[index]).opacity;
599
652
  });
600
653
  blur.setAttribute("stdDeviation", (goo * gooAmount(Math.min(1, elapsed / longest))).toFixed(2));
601
654
  if (elapsed >= longest) return stop();