magic-pill 9.4.0-rc.3 → 9.4.0
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 +3 -0
- package/README.md +13 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [9.4.0] - 2026-12-05
|
|
6
|
+
The Electron, in beta (`magic-pill/satellites`): electrons, their orbitals and the page's actions around the pill. Also a navbar that folds its label when the pill has no room for it, `--mp-radius`, `PillProgress`, and a sidebar's flag that comes out as a droplet. Nothing to change in your code.
|
|
7
|
+
|
|
5
8
|
### Added
|
|
6
9
|
- `--mp-focus-ring`: the keyboard focus ring's colour on the pill's actions, electrons and orbitals
|
|
7
10
|
- `--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
|
package/README.md
CHANGED
|
@@ -24,13 +24,13 @@ On top of it come ready-made **templates** (a notification, a navbar, a form pan
|
|
|
24
24
|
- [X] Anything inside: messages, icons and panels are React content; build your own templates from the same parts
|
|
25
25
|
- [X] Shape-changing animations (circle ↔ pill ↔ panel) at the pill's real size, notifications that slide into each other, a pill that travels when its placement changes, all respecting reduced motion
|
|
26
26
|
- [X] Notifications laid out the way the pill is: in one row, in rows, and in a sidebar as cards or as a flag out of its edge
|
|
27
|
-
- [X] **Beta:** the Electron, a small round pill that splits out of the main one to keep a background activity (a timer, an upload) in reach anywhere in the app (optional)
|
|
27
|
+
- [X] **Beta:** the Electron, a small round pill that splits out of the main one to keep a background activity (a timer, an upload) in reach anywhere in the app, with its quick actions fanned out around it; and the page's own actions next to the pill (optional)
|
|
28
28
|
- [X] Forms: fields on native controls, in a panel or in the pill, validated by the browser, and a calendar (optional)
|
|
29
29
|
- [X] Themes (optional): glass and Liquid Glass, with refraction, a pointer light and adaptive tinting, or a theme of your own from the tokens
|
|
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 **
|
|
33
|
+
- [X] Tiny: the quick start adds about **22 kB gzipped** to your app (17.4 kB of JavaScript + 4.6 kB of CSS, minified by your bundler), checked in CI; the Electron's optional entry about 20 kB more. Unused parts are tree-shaken.
|
|
34
34
|
- [X] Written in TypeScript, zero runtime dependencies
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
@@ -270,7 +270,7 @@ A sidebar's notifications are pills like the others: it turns horizontal for the
|
|
|
270
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
|
-
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
|
|
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** since 9.4.0: its API may still change in a minor version.
|
|
274
274
|
|
|
275
275
|
It's optional: import `satellites` and give it to the host, with the current path.
|
|
276
276
|
|
|
@@ -378,6 +378,8 @@ export function InboxPage() {
|
|
|
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).
|
|
380
380
|
|
|
381
|
+
They go into the host and come out of it as a circle: their icons fade, they close to a circle at the pill's level (a column beside a bottom pill closes down to it), then the circle goes in. Leaving their page, the pill waits for them before it takes the next page's shape; a panel with no room for them beside it waits for them before it opens. Coming out, a circle opens to their pill, then their icons show. Changing sides, they go in and come out on the other side the same way; in the pill, they fold away on one side before they open on the other.
|
|
382
|
+
|
|
381
383
|
## The primitive
|
|
382
384
|
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.
|
|
383
385
|
|
|
@@ -414,6 +416,7 @@ Any other prop (`className`, `aria-label`, `ref`…) goes to the element.
|
|
|
414
416
|
- `PillIcon`: the leading icon. Decorative unless you give it a `label`.
|
|
415
417
|
- `PillDivider`: the thin line after the icon.
|
|
416
418
|
- `PillMessage`: the message, in the italic serif.
|
|
419
|
+
- `PillProgress`: a progress ring around a value or an icon, in the text colour (`--mp-progress-size`, `--mp-progress-width`).
|
|
417
420
|
- `PillActions` and `PillAction`: round buttons. `label` is required: it's the accessible name, and it shows on hover, on focus, with `expanded`, or at the `expanded` level. A `PillAction` is a `<button>` with `onClick`, or a link with `href` (through `linkComponent` if you pass one).
|
|
418
421
|
- `PillPanel` and `PillPanelTrigger`: content shown at the `panel` level, and the action that opens it. The panel takes the focus when it opens, closes on Escape or with its close button (`closeLabel`, `closeIcon`, and `closeExpanded` to always show the label), and gives the focus back to the trigger. `titleAction` goes at the end of the title's row and `footer` before the close button, which is then quieter (an outline, `--mp-close`). **Several panels in one pill:** give each a `name`, and its trigger the same `panel`.
|
|
419
422
|
|
|
@@ -762,7 +765,7 @@ import { MagicPill, PillOptics } from "magic-pill";
|
|
|
762
765
|
- **Safe links:** links only render relative, `http(s):`, `mailto:` and `tel:` URLs. Anything else, such as `javascript:`, renders without a link (with a warning in development). React 18 doesn't block those URLs by itself.
|
|
763
766
|
|
|
764
767
|
## TypeScript
|
|
765
|
-
Everything is typed, and every component's props are exported as `<Component>Props` (`MagicPillProps`, `PillProps`, `PillFormPanelProps`, `PillInputProps`…). The other main types are `NotifyOptions`, `NotifyInput`, `PillController`, `PillPresence`, `PillPlacement`, `PillVariant`, `PillTheme`, `NotificationLayout`, `NavItem`, `LinkComponent` and `SendHandler`.
|
|
768
|
+
Everything is typed, and every component's props are exported as `<Component>Props` (`MagicPillProps`, `PillProps`, `PillFormPanelProps`, `PillInputProps`…). The other main types are `NotifyOptions`, `NotifyInput`, `PillController`, `PillPresence`, `PillPlacement`, `PillVariant`, `PillTheme`, `NotificationLayout`, `NavItem`, `LinkComponent` and `SendHandler`. For the Electron (beta): `ElectronOptions`, `Orbital` and `PillActionItem`, and from `magic-pill/satellites`, `PillSatellites` and the host props' values (`ActionsStyle`, `ActionsSide`, `ElectronSide`…).
|
|
766
769
|
|
|
767
770
|
## Build your own
|
|
768
771
|
Maybe what I brought to the table wasn't enough but you like the idea behind it, that's why Magic Pill is under [MIT License](https://www.tldrlegal.com/license/mit-license), which means you can pretty much do whatever you want and build upon my own version of Magic Pill to bring it to new heights or just make it your own.
|
|
@@ -809,10 +812,11 @@ Magic Pill is distributed under the [MIT License](https://www.tldrlegal.com/lice
|
|
|
809
812
|
## What's next?
|
|
810
813
|
| Coming next | Done in 9.x |
|
|
811
814
|
|-----------|-----------|
|
|
812
|
-
|
|
|
813
|
-
|
|
|
814
|
-
| More layouts for vertical pills |
|
|
815
|
-
| Performance presets for the glass |
|
|
816
|
-
| Usage from a CDN |
|
|
815
|
+
| Smoother motion on every device, and a lighter, cleaner core | **Beta:** the Electron, its orbitals and the page's actions |
|
|
816
|
+
| Carousel indicator templates | A documentation site with live examples |
|
|
817
|
+
| More layouts for vertical pills | Themes: glass, Liquid Glass, your own |
|
|
818
|
+
| Performance presets for the glass | Forms and a calendar |
|
|
819
|
+
| Usage from a CDN | Notification layouts: rows, cards, flags |
|
|
820
|
+
| | Pills that share a spot line up instead of overlapping |
|
|
817
821
|
| | Animated morphing between contents, panels and placements, through the circle |
|
|
818
822
|
| | Any icon (any React content), actions with `onClick` or `href`, full documentation, tests |
|