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

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.
package/CHANGELOG.md CHANGED
@@ -7,15 +7,17 @@
7
7
  - **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
8
  - **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>`
9
9
  - **Beta:** `actionsWheel` on `<MagicPill>`: short of room, the page's actions show what fits 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, the cut starts right at the divider. And `nearestToPill` (`"actions"`, the default, or `"electrons"`): which are nearer the pill on a side they share
10
+ - **Beta:** `avoidPills` on `<MagicPill>` (`true` by default): the satellites keep clear of the other pills on the screen. Over one (on a phone, the docs' sidebar), the page's actions go to the other side of the pill, then turn across, then (with `actionsWheel`) show fewer; when none of these is clear, the layout that covers them least
11
+ - **Beta:** `orbitalsMore` on `<MagicPill>`: how a wheel of orbitals says there are more past its ends. `"peek"` (the default, as before: the next one peeks out faintly where there's room), `"dots"` (small dots by the end orbital, one per orbital past it, up to three) or `"count"` (a small pill with how many, which turns the wheel a page that way when pressed)
10
12
  - `labels` on `<PillNavbar>`: which labels show at rest. `"auto"` (the default) shows the current page's while the pill has room for it and folds it when it doesn't, `"current"` always shows it, `"closed"` shows none. An electron stays in the pill's row when the navbar can fold to make room, and only goes above it when it still doesn't fit
11
13
  - `PillProgress`: a progress ring around a value or an icon, in the text colour (`--mp-progress-size`, `--mp-progress-width`)
12
- - 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` (`1`)
14
+ - 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)
13
15
 
14
16
  ### Fixed
15
17
  - 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)
16
18
  - Two electrons given an empty `id` are two electrons, instead of one flickering between them
17
19
  - The page's actions grow away from the pill when an action's label opens on hover, instead of over it
18
- - When the host changes placement or turns, its electrons and actions tuck in while it travels and come out at its new place; one that changes side or row (or actions that turn) goes back into the pill and out again, instead of sliding across it or jumping
20
+ - When the host changes placement or turns, its electrons and actions tuck in while it travels and come out at its new place; one that changes side or row goes back into the pill and out again, instead of sliding across it or jumping; the page's actions turning (across or back) close to a circle at the pill's level, turn, and open again the other way, as the pill does when it changes placement
19
21
  - An electron's orbitals bulge out of its centre one after the other and fold back into it, quicker than they came and in the other order, as the design drew them. Next to another electron, two of them used to slide sideways into each other above it, merge and vanish; the electron's shadow flickered as they opened, and on the glass themes they switched colour at the end. On their way back, they're out of reach (a pointer over them can't hold them); when their electron ends from one of them, they're in at once; on their way out, one under the pointer doesn't light up
20
22
  - With the orbitals open (they stay open after an action), a press on the electron slides onto one at once, instead of waiting for a long press again: it only worked once until a tap away
21
23
  - For a notification, the electrons and the actions go into the pill with it, once their content has faded, instead of staying out while it closes and then chasing it; back from the notification, they come out once the pill has grown back, not out of a half-grown pill
@@ -26,6 +28,14 @@
26
28
  - 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
27
29
  - 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
28
30
  - An electron's orbitals keep clear of the page's actions, as they do of the other electrons
31
+ - 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
+ - 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
+ - An electron's orbitals come out from behind it and go back in behind it, instead of over what it shows
34
+ - When the screen changes (a phone turned), satellites with a new side or row (keeping clear of another pill, or for lack of room) go there through the pill once it has settled, instead of jumping there as it resized; and a phone turned back upright no longer leaves the pill squeezed by the room its satellites had taken in landscape
35
+ - With electrons or actions out, a pill changing placement keeps the room and the spot it has with them through the trip, at its new placement: it opens there at its size, and they come out with nothing else moving. It used to slide to the centre as it closed, open wide, then shrink and slide as they came out (and, at a -start or -end placement, travel without its shift and jump by it at the end)
36
+ - A navbar's current label no longer folds while the pill is a circle on its way to another placement: the pill opened at its new place with the label folded, and grew by it with a jump once open
37
+ - An electron (or the page's actions) going back into the pill as the group gathers again goes to the pill's end where it now is, instead of where it was when it set off: it ended inside the pill, over its last item, with a doubled shadow at its end
38
+ - 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
29
39
 
30
40
  ### Changed
31
41
  - 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
package/README.md CHANGED
@@ -30,7 +30,7 @@ On top of it come ready-made **templates** (a notification, a navbar, a form pan
30
30
  - [X] Accessible: screen reader announcements, keyboard focus pauses the countdown, focus handling for panels and modals
31
31
  - [X] Works in any React 18+ app, including React Server Components (Next.js App Router), with any router
32
32
  - [X] Styles you can override without `!important`, design tokens, no fonts loaded behind your back
33
- - [X] Tiny: the quick start adds about **19 kB gzipped** to your app (15.5 kB of JavaScript + 3.7 kB of CSS, minified by your bundler), checked in CI. Unused parts are tree-shaken.
33
+ - [X] Tiny: the quick start adds about **20 kB gzipped** to your app (16 kB of JavaScript + 4.4 kB of CSS, minified by your bundler), checked in CI. Unused parts are tree-shaken.
34
34
  - [X] Written in TypeScript, zero runtime dependencies
35
35
 
36
36
  ## Installation
@@ -233,7 +233,7 @@ export function AppPill() {
233
233
  </MagicPill>
234
234
  ```
235
235
 
236
- - **The active link** shows its label and gets `aria-current="page"`. `labels` says which labels show at rest: `"auto"` (the default) shows the current page's while the pill has room for it, and folds it when it doesn't (next to an electron on a phone, or on a very narrow screen, where the pill used to cut its last items off); `"current"` always shows it; `"closed"` shows none. An item pointed at or focused shows its label in every case. A folded navbar has `data-folded`.
236
+ - **The active link** shows its label and gets `aria-current="page"`. `labels` says which labels show at rest: `"auto"` (the default) shows the current page's while the pill has room for it, and folds it when it doesn't (next to an electron on a phone, or on a very narrow screen, where the pill used to cut its last items off); `"current"` always shows it; `"closed"` shows none. An item pointed at or focused shows its label in every case. A folded navbar has `data-folded`. Too long for its pill even then (many items on a narrow phone, a sidebar on a short screen), it scrolls inside it, and where the browser has scroll-driven animations, the ends that hide some fade out.
237
237
  - **Without `pathname`**, the navbar reads `window.location.pathname` after mounting and on back/forward navigation. That misses client-side navigations, so pass `pathname` when you use a client-side router.
238
238
  - **On a narrow screen**, when there's no room for the current page's label and the one you point at (or focus), the current one folds meanwhile. A label that still has no room ends with an ellipsis.
239
239
  - **`aria-label`** defaults to `"Main"`.
@@ -267,7 +267,7 @@ pill("assistant").notify({ icon: <HelpIcon />, message: "Need a hand?", duration
267
267
  ```
268
268
  A sidebar's notifications are pills like the others: it turns horizontal for them while it's a circle, and back once they're gone. Between its base layer and a notification it goes through the circle, even with `swap="always"`, unless the notification is in `rows` (it slides, turning as it goes) or a `card`: a card stays in the sidebar's column, and slides like any other content.
269
269
 
270
- **A flag** (`notificationLayout="flag"`, `left`/`right` sidebars) leaves the sidebar where it is, usable: the notification comes out of its edge as a pill of its own (`[data-layout="flag"]`), next to the section it's about (`at`), and goes back into it. Pointing at it or focusing it pauses it; the next one slides in it, and it moves to its own section. Its panel opens beside the sidebar, in the middle of the screen. It comes out of the sidebar's edge as a droplet (a neck forms between them, stretches and snaps) and goes back into it the same way: `--mp-duration-split` and `--mp-duration-join` time it, `--mp-ease-split` picks its curve (`bouncy`, the default, `pop`, `smooth` or any CSS easing), `--mp-goo` how sticky it is (`0`: no neck), `--mp-electron-start` the size it starts at.
270
+ **A flag** (`notificationLayout="flag"`, `left`/`right` sidebars) leaves the sidebar where it is, usable: the notification comes out of its edge as a pill of its own (`[data-layout="flag"]`), next to the section it's about (`at`), and goes back into it. Pointing at it or focusing it pauses it; the next one slides in it, and it moves to its own section. Its panel opens beside the sidebar, in the middle of the screen. It comes out of the sidebar's edge as a droplet, as an electron does (drawn out small on a neck, growing to its size as it comes free, then showing its content), and goes back into it the same way played backwards: `--mp-duration-split` and `--mp-duration-join` time it, `--mp-ease-split` can pick another curve (`bouncy`, `pop`, `smooth` or any CSS easing), `--mp-goo` how sticky it is (`0`: no neck), `--mp-electron-start` the size it starts at.
271
271
 
272
272
  ## The Electron (beta)
273
273
  A small round pill that splits out of the host to keep a background activity in reach while the person goes elsewhere in the app: a timer, a call, an upload. It's tucked into the pill on the page that started it, and comes out as a droplet (with the goo, like a sidebar's flag) anywhere else; a tap goes back to that page. **Beta:** it ships in `9.4.0-next` releases, and its API may still change.
@@ -318,10 +318,11 @@ pill().endElectron(id); // it goes back into the pill
318
318
  | `electronEnding` | `"join"` | `"join"` or `"pop"`. |
319
319
  | `arrange` | `"gather"` | `"gather"`: the pill and its electrons are centred as a group (or at the edge, for a `-start` or `-end` placement). `"spread"`: the pill stays where it is, the electrons go to the screen's edge (under the thumb on a tablet). |
320
320
  | `orbitalsOpenOn` | `"press-hover"` | What opens an electron's orbitals: a long press, or hovering it with a mouse; `"press"`, a long press only; `"tap"`, a tap, with a first orbital going back. |
321
- | `orbitalLabels` | `true` | The orbital under the finger, the pointer or the focus shows its label next to it. |
321
+ | `orbitalLabels` | `true` | The orbital under the finger, the pointer or the focus shows its label next to it, in a small pill of the electron's look (its theme and colours). |
322
322
  | `orbitalsStayOpen` | `true` | They stay open after one of them runs (Pause becomes Resume in place). |
323
+ | `orbitalsMore` | `"peek"` | How a wheel of orbitals says there are more past its ends: the next one peeks out faintly where there's room; `"dots"`, small dots by the end orbital instead, one per orbital past it (up to three); `"count"`, a small pill there with how many, which turns the wheel a page that way when pressed. |
323
324
 
324
- **Orbitals** are an electron's quick actions, small round pills that bulge out of it with the goo:
325
+ **Orbitals** are an electron's quick actions, small round pills that bud out of its centre with the goo, one after the other, and fold back into it (quicker, the other way round):
325
326
 
326
327
  ```ts
327
328
  pill().electron({
@@ -335,13 +336,14 @@ pill().electron({
335
336
  });
336
337
  ```
337
338
 
338
- - 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. With a mouse, hovering opens them too, and they close once the pointer leaves them.
339
- - They fan out on an arc away from the screen's edge, clear of the pill, the other electrons 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.
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
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.
341
342
 
342
343
  **How it behaves:**
343
- - **Short of room** (the pill and its electrons wider than the screen), a navbar folds its labels first (`labels="auto"`, its default); if they still don't fit, the last ones go beside the pill, one row towards the page, like the ladder.
344
- - It splits and joins with the goo, on the split's tokens (`--mp-duration-split`, `--mp-duration-join`, `--mp-ease-split`, `--mp-goo`, `--mp-electron-start`, see [Styling](#styling)); `--mp-electron-gap` (`--mp-gap` by default) keeps it apart from the pill. With reduced motion, it fades.
344
+ - **Short of room** (the pill and its electrons wider than the screen), a navbar folds its labels first (`labels="auto"`, its default); if they still don't fit, the last ones go beside the pill, one row towards the page, like the ladder. There they make a row of their own, clear of each other and on the screen, wrapping into a further row as a last resort.
345
+ - It comes out of the pill as a droplet, drawn out small on the goo's neck, growing to its size as it comes free, then showing its content, and goes back into it the same way played backwards, drawing itself the whole way (its glass too), on the split's tokens (`--mp-duration-split`, `--mp-duration-join`, `--mp-ease-split`, `--mp-goo`, `--mp-electron-start`, see [Styling](#styling)); `--mp-electron-gap` (`--mp-gap` by default) keeps it apart from the pill. With reduced motion, it fades.
346
+ - While a notification has the pill (or it travels to another placement), it goes into the pill's centre as the pill closes to a circle, and comes out once the pill has grown back. Changing sides or rows, it goes back in, the pill waiting until it is, then comes out at its new spot as the pill moves. Two satellites passing each other melt together as they meet.
345
347
  - It's a link (or a button, or an image for neither) named after its `label` and `valueText`, with its own focus ring.
346
348
 
347
349
  ### The page's actions (beta)
@@ -366,12 +368,15 @@ export function InboxPage() {
366
368
 
367
369
  | Host prop | Default | Notes |
368
370
  |---|---|---|
369
- | `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. |
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. |
370
372
  | `actionsSide` | `"start"` | `"start"` or `"end"` (following the text direction: under the thumb you want), or `"beside"` (one row towards the page). |
371
- | `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), and back once they're beside it. `"horizontal"` or `"vertical"`, always. |
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. |
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. |
372
377
  | `actionsLabel` | `"Page actions"` | Their accessible name. |
373
378
 
374
- Short of room, the actions turn across first (`"auto"`), then the last electrons, the actions and the first electron go beside the pill, in that order.
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).
375
380
 
376
381
  ## The primitive
377
382
  Everything above is built from `<Pill>` and its parts, and you can use them directly. A `<Pill>` you write yourself isn't connected to `pill()`: you control it with props.
@@ -660,9 +665,9 @@ An `<img>` keeps its file's colours: `currentColor` only reaches inline SVGs and
660
665
  | `--mp-duration-enter` / `--mp-duration-change` / `--mp-duration-exit` | `500ms` / `250ms` / `300ms` |
661
666
  | `--mp-duration-fade` | `150ms`: the content fades out before the pill shrinks, and in once it has grown |
662
667
  | `--mp-duration-split` / `--mp-duration-join` | `--mp-duration-enter` / `--mp-duration-exit`: a sidebar's flag coming out of the sidebar and going back |
663
- | `--mp-ease-split` | `bouncy`: the split's curve, `bouncy`, `pop`, `smooth` or any CSS easing (the join is always smooth) |
668
+ | `--mp-ease-split` | The split's curve. Unset: a flag, an electron and the page's actions follow the droplet's (drawn out slowly, then growing), orbitals bounce (`bouncy`). Or `bouncy`, `pop`, `smooth` or any CSS easing, for all of them. The join follows the droplet's backwards (orbitals: smooth) |
664
669
  | `--mp-goo` | `12`: how sticky the split is, the blur behind the neck in px. `0`: a plain split, no neck |
665
- | `--mp-electron-start` | `1`: the size a flag or an electron starts at as it comes out. `1`: full size, hidden behind the pill's edge. Lower: it starts small and grows on its way out |
670
+ | `--mp-electron-start` | `0.15`: the size a flag, an electron or the page's actions start at as they come out of the pill's edge, a droplet drawn out of it, growing to its size, then showing its content (and the same played backwards going back in). `1`: full size, hidden behind the pill's edge |
666
671
  | `--mp-electron-gap` | `--mp-gap`: between the pill and its electrons (beta) |
667
672
  | `--mp-progress-size` / `--mp-progress-width` | `3.375rem` / `3.5`: `PillProgress`'s ring, and its stroke |
668
673
  | `--mp-scale-origin` | `center`: where the pill pops in from and scales out to (e.g. `bottom` to come out of the edge) |
@@ -2,7 +2,7 @@ import { ReactNode } from "react";
2
2
  import { LinkComponent, PillProps } from "../Pill/types.mjs";
3
3
  import { NotificationLayout, PillNotificationClassNames } from "../PillNotification/PillNotification.mjs";
4
4
  import { SwapMode } from "./choreography.mjs";
5
- import { ActionsOrientation, ActionsSide, ActionsStyle, ElectronEnding, ElectronLine, ElectronSide, NearestToPill, OrbitalsOpenOn, PillSatellites, SatelliteArrangement } from "../satellites/types.mjs";
5
+ import { ActionsOrientation, ActionsSide, ActionsStyle, ElectronEnding, ElectronLine, ElectronSide, NearestToPill, OrbitalsMore, OrbitalsOpenOn, PillSatellites, SatelliteArrangement } from "../satellites/types.mjs";
6
6
  export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPresence" | "onPresenceChange" | "children" | "scene" | "sceneChange"> {
7
7
  /** Default "main". Two hosts with the same name warn in development. */
8
8
  name?: string;
@@ -68,6 +68,13 @@ export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPre
68
68
  orbitalsOpenOn?: OrbitalsOpenOn;
69
69
  /** The label of the orbital under the finger, the pointer or the focus shows next to it. Default true (beta). */
70
70
  orbitalLabels?: boolean;
71
+ /**
72
+ * How a wheel of orbitals says there are more past its ends: the next one
73
+ * peeking out faintly where there's room (`"peek"`, default), small dots by
74
+ * the end orbital, one per orbital past it, up to three (`"dots"`), or a
75
+ * count that turns the wheel a page when pressed (`"count"`) (beta).
76
+ */
77
+ orbitalsMore?: OrbitalsMore;
71
78
  /** Orbitals stay open after one of them runs. Default true (beta). */
72
79
  orbitalsStayOpen?: boolean;
73
80
  /**
@@ -87,6 +94,12 @@ export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPre
87
94
  actionsWheel?: boolean;
88
95
  /** On a side they share, the page's actions are nearer the pill (default), or the electrons (beta). */
89
96
  nearestToPill?: NearestToPill;
97
+ /**
98
+ * The satellites keep clear of the other pills on the screen (a sidebar, a
99
+ * help pill): over one, the page's actions go to the other side, then turn
100
+ * across, then (with `actionsWheel`) show fewer. Default true (beta).
101
+ */
102
+ avoidPills?: boolean;
90
103
  /** The page's actions' accessible name. Default "Page actions" (beta). */
91
104
  actionsLabel?: string;
92
105
  }
@@ -2,7 +2,7 @@ import { ReactNode } from "react";
2
2
  import { LinkComponent, PillProps } from "../Pill/types.js";
3
3
  import { NotificationLayout, PillNotificationClassNames } from "../PillNotification/PillNotification.js";
4
4
  import { SwapMode } from "./choreography.js";
5
- import { ActionsOrientation, ActionsSide, ActionsStyle, ElectronEnding, ElectronLine, ElectronSide, NearestToPill, OrbitalsOpenOn, PillSatellites, SatelliteArrangement } from "../satellites/types.js";
5
+ import { ActionsOrientation, ActionsSide, ActionsStyle, ElectronEnding, ElectronLine, ElectronSide, NearestToPill, OrbitalsMore, OrbitalsOpenOn, PillSatellites, SatelliteArrangement } from "../satellites/types.js";
6
6
  export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPresence" | "onPresenceChange" | "children" | "scene" | "sceneChange"> {
7
7
  /** Default "main". Two hosts with the same name warn in development. */
8
8
  name?: string;
@@ -68,6 +68,13 @@ export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPre
68
68
  orbitalsOpenOn?: OrbitalsOpenOn;
69
69
  /** The label of the orbital under the finger, the pointer or the focus shows next to it. Default true (beta). */
70
70
  orbitalLabels?: boolean;
71
+ /**
72
+ * How a wheel of orbitals says there are more past its ends: the next one
73
+ * peeking out faintly where there's room (`"peek"`, default), small dots by
74
+ * the end orbital, one per orbital past it, up to three (`"dots"`), or a
75
+ * count that turns the wheel a page when pressed (`"count"`) (beta).
76
+ */
77
+ orbitalsMore?: OrbitalsMore;
71
78
  /** Orbitals stay open after one of them runs. Default true (beta). */
72
79
  orbitalsStayOpen?: boolean;
73
80
  /**
@@ -87,6 +94,12 @@ export interface MagicPillProps extends Omit<PillProps, "presence" | "defaultPre
87
94
  actionsWheel?: boolean;
88
95
  /** On a side they share, the page's actions are nearer the pill (default), or the electrons (beta). */
89
96
  nearestToPill?: NearestToPill;
97
+ /**
98
+ * The satellites keep clear of the other pills on the screen (a sidebar, a
99
+ * help pill): over one, the page's actions go to the other side, then turn
100
+ * across, then (with `actionsWheel`) show fewer. Default true (beta).
101
+ */
102
+ avoidPills?: boolean;
90
103
  /** The page's actions' accessible name. Default "Page actions" (beta). */
91
104
  actionsLabel?: string;
92
105
  }
@@ -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, orbitalsStayOpen = true, actionsStyle = "detached", actionsSide = "start", actionsOrientation = "auto", actionsWheel = false, nearestToPill = "actions", 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 = false, 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);
@@ -270,12 +270,14 @@ const MagicPill = (0, react.forwardRef)(function MagicPill({ name = "main", chil
270
270
  arrange,
271
271
  orbitalsOpenOn,
272
272
  orbitalLabels,
273
+ orbitalsMore,
273
274
  orbitalsStayOpen,
274
275
  actionsStyle,
275
276
  actionsSide,
276
277
  actionsOrientation,
277
278
  actionsWheel,
278
279
  nearestToPill,
280
+ avoidPills,
279
281
  actionsLabel
280
282
  } : void 0;
281
283
  const inside = satellites && satelliteHost && actionsStyle === "inside" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(satellites.Inside, { host: satelliteHost }) : null;
@@ -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, orbitalsStayOpen = true, actionsStyle = "detached", actionsSide = "start", actionsOrientation = "auto", actionsWheel = false, nearestToPill = "actions", 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 = false, 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);
@@ -270,12 +270,14 @@ const MagicPill = forwardRef(function MagicPill({ name = "main", children, scene
270
270
  arrange,
271
271
  orbitalsOpenOn,
272
272
  orbitalLabels,
273
+ orbitalsMore,
273
274
  orbitalsStayOpen,
274
275
  actionsStyle,
275
276
  actionsSide,
276
277
  actionsOrientation,
277
278
  actionsWheel,
278
279
  nearestToPill,
280
+ avoidPills,
279
281
  actionsLabel
280
282
  } : void 0;
281
283
  const inside = satellites && satelliteHost && actionsStyle === "inside" ? /* @__PURE__ */ jsx(satellites.Inside, { host: satelliteHost }) : null;
package/dist/Pill/goo.js CHANGED
@@ -29,6 +29,14 @@ function splitEasing(token) {
29
29
  if (value === "smooth") return SMOOTH;
30
30
  return value;
31
31
  }
32
+ /**
33
+ * A droplet's curve (its position and its size together): drawn out slowly, then growing (`DROPLET_GROW`),
34
+ * or the same backwards. `--mp-ease-split`, when an app sets it, picks the curve out instead.
35
+ */
36
+ function dropletEasing(token, kind) {
37
+ if (kind === "in") return DROPLET_SHRINK;
38
+ return token.trim() ? splitEasing(token) : DROPLET_GROW;
39
+ }
32
40
  /** How much goo the motion needs at progress `k` (0 to 1): none at the ends, all of it while the neck forms. */
33
41
  function gooAmount(k) {
34
42
  const step = (from, to, x) => {
@@ -55,7 +63,7 @@ function tuckedOffset(anchor, moving, start = 1) {
55
63
  let scale = start;
56
64
  if (!fits(moving.width, anchor.width)) scale = Math.min(scale, anchor.width / moving.width);
57
65
  if (!fits(moving.height, anchor.height)) scale = Math.min(scale, anchor.height / moving.height);
58
- scale = Math.max(.2, scale);
66
+ scale = Math.max(.1, scale);
59
67
  if (Math.abs(dx) / (anchor.width / 2 + moving.width / 2) >= Math.abs(dy) / (anchor.height / 2 + moving.height / 2)) {
60
68
  const sign = Math.sign(dx) || 1;
61
69
  return {
@@ -200,8 +208,9 @@ const readNumber = (style, name, fallback) => {
200
208
  };
201
209
  /**
202
210
  * Plays a split (the moving pill comes out of the anchor's edge, from where
203
- * it's tucked in to where it sits) or a join (the other way, after `delay`).
204
- * Reads `--mp-goo`, `--mp-electron-start` and `--mp-ease-split` on the
211
+ * it's tucked in to where it sits) or a join (the other way, after `delay`),
212
+ * as a droplet: drawn out small, growing to its size, its content showing once
213
+ * it's out. Reads `--mp-goo`, `--mp-electron-start` and `--mp-ease-split` on the
205
214
  * moving pill. Does nothing with reduced motion. Returns a function that
206
215
  * stops it at once.
207
216
  */
@@ -211,9 +220,9 @@ function playSplit(anchor, moving, kind, timing) {
211
220
  if (timing.duration <= 0 || require_timing.prefersReducedMotion() || typeof moving.animate !== "function") return () => {};
212
221
  const style = getComputedStyle(moving);
213
222
  const goo = readNumber(style, "--mp-goo", DEFAULT_GOO);
214
- const start = readNumber(style, "--mp-electron-start", 1);
223
+ const start = readNumber(style, "--mp-electron-start", DROPLET);
215
224
  const fade = require_timing.parseDuration(style.getPropertyValue("--_mp-fade"), 150);
216
- const easing = kind === "split" ? splitEasing(style.getPropertyValue("--mp-ease-split")) : SMOOTH;
225
+ const easing = dropletEasing(style.getPropertyValue("--mp-ease-split"), kind === "split" ? "out" : "in");
217
226
  let overlay = null;
218
227
  const radii = {
219
228
  anchor: 0,
@@ -313,11 +322,14 @@ function playSplit(anchor, moving, kind, timing) {
313
322
  id: SPLIT,
314
323
  duration: total
315
324
  });
316
- else child.animate([{ opacity: 1 }, { opacity: 0 }], {
317
- id: SPLIT,
318
- duration: Math.max(1, fade),
319
- fill: "forwards"
320
- });
325
+ else {
326
+ const now = Number.parseFloat(getComputedStyle(child).opacity);
327
+ child.animate([{ opacity: Number.isFinite(now) ? now : 1 }, { opacity: 0 }], {
328
+ id: SPLIT,
329
+ duration: Math.max(1, fade),
330
+ fill: "forwards"
331
+ });
332
+ }
321
333
  };
322
334
  const begin = () => {
323
335
  begun = true;
@@ -370,8 +382,16 @@ function playSplit(anchor, moving, kind, timing) {
370
382
  running.set(moving, stop);
371
383
  return stop;
372
384
  }
373
- /** Inside the anchor at its nearest edge, as a flag goes into its sidebar (`--mp-electron-start`). */
374
- const atEdgeOf = (anchor) => (rect, element) => tuckedOffset(anchor.getBoundingClientRect(), rect, readNumber(getComputedStyle(element), "--mp-electron-start", 1));
385
+ /** The size an electron and the page's actions start at as they come out (a droplet), unless `--mp-electron-start` says */
386
+ const DROPLET = .15;
387
+ /** A droplet's size on its way out: drawn out small, then growing to its size; going back, the same backwards */
388
+ const DROPLET_GROW = "cubic-bezier(0.6, 0, 0.35, 1)";
389
+ const DROPLET_SHRINK = "cubic-bezier(0.65, 0, 0.4, 1)";
390
+ /**
391
+ * Inside the anchor at its nearest edge, as a flag goes into its sidebar, at `--mp-electron-start` of
392
+ * its size (`start` by default). `at`: where the anchor is going, if it's moving.
393
+ */
394
+ const atEdgeOf = (anchor, at, start = 1) => (rect, element) => tuckedOffset(at?.() ?? anchor.getBoundingClientRect(), rect, readNumber(getComputedStyle(element), "--mp-electron-start", start));
375
395
  /** Inside the anchor at a point of the screen (where a pill closing to a circle ends), small. */
376
396
  const atPoint = (x, y, scale = .3) => (rect) => ({
377
397
  x: x - (rect.left + rect.width / 2),
@@ -391,7 +411,7 @@ const budding = /* @__PURE__ */ new WeakMap();
391
411
  function playOrbit(electron, items, kind, timing) {
392
412
  for (const { element } of items) {
393
413
  budding.get(element)?.();
394
- for (const animation of element.getAnimations?.() ?? []) if (animation.id === "mp-split") animation.cancel();
414
+ for (const animation of element.getAnimations?.({ subtree: true }) ?? []) if (animation.id === "mp-split") animation.cancel();
395
415
  }
396
416
  if (timing.duration <= 0 || require_timing.prefersReducedMotion() || typeof electron.animate !== "function" || items.length === 0) return () => {};
397
417
  const style = getComputedStyle(electron);
@@ -400,7 +420,7 @@ function playOrbit(electron, items, kind, timing) {
400
420
  const cx = centre.left + centre.width / 2;
401
421
  const cy = centre.top + centre.height / 2;
402
422
  const longest = Math.max(...items.map(({ delay }) => delay)) + timing.duration;
403
- for (const { element, delay, shown = 1, from = atPoint(cx, cy), opaque = false } of items) {
423
+ for (const { element, delay, shown = 1, from = atPoint(cx, cy), droplet = false, opaque = droplet } of items) {
404
424
  if (shown <= 0) continue;
405
425
  const start = from(element.getBoundingClientRect(), element);
406
426
  const end = getComputedStyle(element).scale;
@@ -439,10 +459,11 @@ function playOrbit(electron, items, kind, timing) {
439
459
  translate,
440
460
  scale
441
461
  }));
462
+ const curve = droplet ? dropletEasing(style.getPropertyValue("--mp-ease-split"), kind === "open" ? "out" : "in") : easing;
442
463
  try {
443
464
  element.animate(ends, {
444
465
  ...options,
445
- easing
466
+ easing: curve
446
467
  });
447
468
  } catch {
448
469
  element.animate(ends, {
@@ -468,6 +489,27 @@ function playOrbit(electron, items, kind, timing) {
468
489
  ...options,
469
490
  easing: "linear"
470
491
  });
492
+ if (droplet) {
493
+ const content = kind === "open" ? [
494
+ { opacity: 0 },
495
+ {
496
+ opacity: 0,
497
+ offset: .7
498
+ },
499
+ { opacity: 1 }
500
+ ] : [
501
+ { opacity: 1 },
502
+ {
503
+ opacity: 0,
504
+ offset: .3
505
+ },
506
+ { opacity: 0 }
507
+ ];
508
+ for (const child of element.children) child.animate(content, {
509
+ ...options,
510
+ easing: "linear"
511
+ });
512
+ }
471
513
  }
472
514
  const stop = playNecks([electron, ...items.filter(({ shown = 1 }) => shown > 0).map(({ element }) => element)], longest);
473
515
  const stopAll = () => {
@@ -563,6 +605,7 @@ function playNecks(pills, duration) {
563
605
  return stop;
564
606
  }
565
607
 
608
+ exports.DROPLET = DROPLET;
566
609
  exports.SPLIT = SPLIT;
567
610
  exports.atEdgeOf = atEdgeOf;
568
611
  exports.atPoint = atPoint;
package/dist/Pill/goo.mjs CHANGED
@@ -29,6 +29,14 @@ function splitEasing(token) {
29
29
  if (value === "smooth") return SMOOTH;
30
30
  return value;
31
31
  }
32
+ /**
33
+ * A droplet's curve (its position and its size together): drawn out slowly, then growing (`DROPLET_GROW`),
34
+ * or the same backwards. `--mp-ease-split`, when an app sets it, picks the curve out instead.
35
+ */
36
+ function dropletEasing(token, kind) {
37
+ if (kind === "in") return DROPLET_SHRINK;
38
+ return token.trim() ? splitEasing(token) : DROPLET_GROW;
39
+ }
32
40
  /** How much goo the motion needs at progress `k` (0 to 1): none at the ends, all of it while the neck forms. */
33
41
  function gooAmount(k) {
34
42
  const step = (from, to, x) => {
@@ -55,7 +63,7 @@ function tuckedOffset(anchor, moving, start = 1) {
55
63
  let scale = start;
56
64
  if (!fits(moving.width, anchor.width)) scale = Math.min(scale, anchor.width / moving.width);
57
65
  if (!fits(moving.height, anchor.height)) scale = Math.min(scale, anchor.height / moving.height);
58
- scale = Math.max(.2, scale);
66
+ scale = Math.max(.1, scale);
59
67
  if (Math.abs(dx) / (anchor.width / 2 + moving.width / 2) >= Math.abs(dy) / (anchor.height / 2 + moving.height / 2)) {
60
68
  const sign = Math.sign(dx) || 1;
61
69
  return {
@@ -200,8 +208,9 @@ const readNumber = (style, name, fallback) => {
200
208
  };
201
209
  /**
202
210
  * Plays a split (the moving pill comes out of the anchor's edge, from where
203
- * it's tucked in to where it sits) or a join (the other way, after `delay`).
204
- * Reads `--mp-goo`, `--mp-electron-start` and `--mp-ease-split` on the
211
+ * it's tucked in to where it sits) or a join (the other way, after `delay`),
212
+ * as a droplet: drawn out small, growing to its size, its content showing once
213
+ * it's out. Reads `--mp-goo`, `--mp-electron-start` and `--mp-ease-split` on the
205
214
  * moving pill. Does nothing with reduced motion. Returns a function that
206
215
  * stops it at once.
207
216
  */
@@ -211,9 +220,9 @@ function playSplit(anchor, moving, kind, timing) {
211
220
  if (timing.duration <= 0 || prefersReducedMotion() || typeof moving.animate !== "function") return () => {};
212
221
  const style = getComputedStyle(moving);
213
222
  const goo = readNumber(style, "--mp-goo", DEFAULT_GOO);
214
- const start = readNumber(style, "--mp-electron-start", 1);
223
+ const start = readNumber(style, "--mp-electron-start", DROPLET);
215
224
  const fade = parseDuration(style.getPropertyValue("--_mp-fade"), 150);
216
- const easing = kind === "split" ? splitEasing(style.getPropertyValue("--mp-ease-split")) : SMOOTH;
225
+ const easing = dropletEasing(style.getPropertyValue("--mp-ease-split"), kind === "split" ? "out" : "in");
217
226
  let overlay = null;
218
227
  const radii = {
219
228
  anchor: 0,
@@ -313,11 +322,14 @@ function playSplit(anchor, moving, kind, timing) {
313
322
  id: SPLIT,
314
323
  duration: total
315
324
  });
316
- else child.animate([{ opacity: 1 }, { opacity: 0 }], {
317
- id: SPLIT,
318
- duration: Math.max(1, fade),
319
- fill: "forwards"
320
- });
325
+ else {
326
+ const now = Number.parseFloat(getComputedStyle(child).opacity);
327
+ child.animate([{ opacity: Number.isFinite(now) ? now : 1 }, { opacity: 0 }], {
328
+ id: SPLIT,
329
+ duration: Math.max(1, fade),
330
+ fill: "forwards"
331
+ });
332
+ }
321
333
  };
322
334
  const begin = () => {
323
335
  begun = true;
@@ -370,8 +382,16 @@ function playSplit(anchor, moving, kind, timing) {
370
382
  running.set(moving, stop);
371
383
  return stop;
372
384
  }
373
- /** Inside the anchor at its nearest edge, as a flag goes into its sidebar (`--mp-electron-start`). */
374
- const atEdgeOf = (anchor) => (rect, element) => tuckedOffset(anchor.getBoundingClientRect(), rect, readNumber(getComputedStyle(element), "--mp-electron-start", 1));
385
+ /** The size an electron and the page's actions start at as they come out (a droplet), unless `--mp-electron-start` says */
386
+ const DROPLET = .15;
387
+ /** A droplet's size on its way out: drawn out small, then growing to its size; going back, the same backwards */
388
+ const DROPLET_GROW = "cubic-bezier(0.6, 0, 0.35, 1)";
389
+ const DROPLET_SHRINK = "cubic-bezier(0.65, 0, 0.4, 1)";
390
+ /**
391
+ * Inside the anchor at its nearest edge, as a flag goes into its sidebar, at `--mp-electron-start` of
392
+ * its size (`start` by default). `at`: where the anchor is going, if it's moving.
393
+ */
394
+ const atEdgeOf = (anchor, at, start = 1) => (rect, element) => tuckedOffset(at?.() ?? anchor.getBoundingClientRect(), rect, readNumber(getComputedStyle(element), "--mp-electron-start", start));
375
395
  /** Inside the anchor at a point of the screen (where a pill closing to a circle ends), small. */
376
396
  const atPoint = (x, y, scale = .3) => (rect) => ({
377
397
  x: x - (rect.left + rect.width / 2),
@@ -391,7 +411,7 @@ const budding = /* @__PURE__ */ new WeakMap();
391
411
  function playOrbit(electron, items, kind, timing) {
392
412
  for (const { element } of items) {
393
413
  budding.get(element)?.();
394
- for (const animation of element.getAnimations?.() ?? []) if (animation.id === "mp-split") animation.cancel();
414
+ for (const animation of element.getAnimations?.({ subtree: true }) ?? []) if (animation.id === "mp-split") animation.cancel();
395
415
  }
396
416
  if (timing.duration <= 0 || prefersReducedMotion() || typeof electron.animate !== "function" || items.length === 0) return () => {};
397
417
  const style = getComputedStyle(electron);
@@ -400,7 +420,7 @@ function playOrbit(electron, items, kind, timing) {
400
420
  const cx = centre.left + centre.width / 2;
401
421
  const cy = centre.top + centre.height / 2;
402
422
  const longest = Math.max(...items.map(({ delay }) => delay)) + timing.duration;
403
- for (const { element, delay, shown = 1, from = atPoint(cx, cy), opaque = false } of items) {
423
+ for (const { element, delay, shown = 1, from = atPoint(cx, cy), droplet = false, opaque = droplet } of items) {
404
424
  if (shown <= 0) continue;
405
425
  const start = from(element.getBoundingClientRect(), element);
406
426
  const end = getComputedStyle(element).scale;
@@ -439,10 +459,11 @@ function playOrbit(electron, items, kind, timing) {
439
459
  translate,
440
460
  scale
441
461
  }));
462
+ const curve = droplet ? dropletEasing(style.getPropertyValue("--mp-ease-split"), kind === "open" ? "out" : "in") : easing;
442
463
  try {
443
464
  element.animate(ends, {
444
465
  ...options,
445
- easing
466
+ easing: curve
446
467
  });
447
468
  } catch {
448
469
  element.animate(ends, {
@@ -468,6 +489,27 @@ function playOrbit(electron, items, kind, timing) {
468
489
  ...options,
469
490
  easing: "linear"
470
491
  });
492
+ if (droplet) {
493
+ const content = kind === "open" ? [
494
+ { opacity: 0 },
495
+ {
496
+ opacity: 0,
497
+ offset: .7
498
+ },
499
+ { opacity: 1 }
500
+ ] : [
501
+ { opacity: 1 },
502
+ {
503
+ opacity: 0,
504
+ offset: .3
505
+ },
506
+ { opacity: 0 }
507
+ ];
508
+ for (const child of element.children) child.animate(content, {
509
+ ...options,
510
+ easing: "linear"
511
+ });
512
+ }
471
513
  }
472
514
  const stop = playNecks([electron, ...items.filter(({ shown = 1 }) => shown > 0).map(({ element }) => element)], longest);
473
515
  const stopAll = () => {
@@ -563,4 +605,4 @@ function playNecks(pills, duration) {
563
605
  return stop;
564
606
  }
565
607
 
566
- export { SPLIT, atEdgeOf, atPoint, dropShadow, gooAmount, playNecks, playOrbit, playSplit, splitEasing, springEasing, tuckedOffset };
608
+ export { DROPLET, SPLIT, atEdgeOf, atPoint, dropShadow, gooAmount, playNecks, playOrbit, playSplit, splitEasing, springEasing, tuckedOffset };
@@ -539,14 +539,14 @@ function animateMove(element, from) {
539
539
  duration: fade + change,
540
540
  easing: EASING
541
541
  };
542
- element.animate([{
543
- translate: shift,
544
- ...resized && sized(from)
545
- }, {
546
- translate: "0px 0px",
547
- ...resized && sized(to)
548
- }], options);
549
- if (resized) hold(options);
542
+ element.animate([{ translate: shift }, { translate: "0px 0px" }], {
543
+ ...options,
544
+ composite: "add"
545
+ });
546
+ if (resized) {
547
+ element.animate([sized(from), sized(to)], options);
548
+ hold(options);
549
+ }
550
550
  }
551
551
  /**
552
552
  * Remembers where the pill is just before its placement changes (React calls
@@ -539,14 +539,14 @@ function animateMove(element, from) {
539
539
  duration: fade + change,
540
540
  easing: EASING
541
541
  };
542
- element.animate([{
543
- translate: shift,
544
- ...resized && sized(from)
545
- }, {
546
- translate: "0px 0px",
547
- ...resized && sized(to)
548
- }], options);
549
- if (resized) hold(options);
542
+ element.animate([{ translate: shift }, { translate: "0px 0px" }], {
543
+ ...options,
544
+ composite: "add"
545
+ });
546
+ if (resized) {
547
+ element.animate([sized(from), sized(to)], options);
548
+ hold(options);
549
+ }
550
550
  }
551
551
  /**
552
552
  * Remembers where the pill is just before its placement changes (React calls