@cloudlet/toast 0.0.0-stage → 1.0.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 +271 -0
- package/LICENSE +21 -0
- package/README.md +65 -2
- package/THIRD_PARTY_NOTICES.md +149 -0
- package/dist/contracts/controller.d.ts +71 -0
- package/dist/contracts/controller.d.ts.map +1 -0
- package/dist/contracts/events.d.ts +72 -0
- package/dist/contracts/events.d.ts.map +1 -0
- package/dist/contracts/identity.d.ts +32 -0
- package/dist/contracts/identity.d.ts.map +1 -0
- package/dist/contracts/internal.d.ts +188 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/notifications.d.ts +101 -0
- package/dist/contracts/notifications.d.ts.map +1 -0
- package/dist/contracts/operations.d.ts +76 -0
- package/dist/contracts/operations.d.ts.map +1 -0
- package/dist/contracts/snapshots.d.ts +48 -0
- package/dist/contracts/snapshots.d.ts.map +1 -0
- package/dist/core/bridge.d.ts +5 -0
- package/dist/core/bridge.d.ts.map +1 -0
- package/dist/core/bridge.js +277 -0
- package/dist/core/bridge.js.map +1 -0
- package/dist/core/controller.d.ts +117 -0
- package/dist/core/controller.d.ts.map +1 -0
- package/dist/core/controller.js +787 -0
- package/dist/core/controller.js.map +1 -0
- package/dist/core/validation.d.ts +17 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +298 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/create-cloudlet.d.ts +5 -0
- package/dist/create-cloudlet.d.ts.map +1 -0
- package/dist/create-cloudlet.js +34 -0
- package/dist/create-cloudlet.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/react/announcer.d.ts +15 -0
- package/dist/react/announcer.d.ts.map +1 -0
- package/dist/react/announcer.js +140 -0
- package/dist/react/announcer.js.map +1 -0
- package/dist/react/bindings.d.ts +17 -0
- package/dist/react/bindings.d.ts.map +1 -0
- package/dist/react/bindings.js +47 -0
- package/dist/react/bindings.js.map +1 -0
- package/dist/react/card.d.ts +58 -0
- package/dist/react/card.d.ts.map +1 -0
- package/dist/react/card.js +300 -0
- package/dist/react/card.js.map +1 -0
- package/dist/react/generators.d.ts +46 -0
- package/dist/react/generators.d.ts.map +1 -0
- package/dist/react/generators.js +115 -0
- package/dist/react/generators.js.map +1 -0
- package/dist/react/gestures.d.ts +50 -0
- package/dist/react/gestures.d.ts.map +1 -0
- package/dist/react/gestures.js +239 -0
- package/dist/react/gestures.js.map +1 -0
- package/dist/react/host.d.ts +37 -0
- package/dist/react/host.d.ts.map +1 -0
- package/dist/react/host.js +816 -0
- package/dist/react/host.js.map +1 -0
- package/dist/react/motion.d.ts +206 -0
- package/dist/react/motion.d.ts.map +1 -0
- package/dist/react/motion.js +414 -0
- package/dist/react/motion.js.map +1 -0
- package/dist/react/plan.d.ts +45 -0
- package/dist/react/plan.d.ts.map +1 -0
- package/dist/react/plan.js +58 -0
- package/dist/react/plan.js.map +1 -0
- package/dist/react/renderer.d.ts +7 -0
- package/dist/react/renderer.d.ts.map +1 -0
- package/dist/react/renderer.js +62 -0
- package/dist/react/renderer.js.map +1 -0
- package/dist/react/shape.d.ts +7 -0
- package/dist/react/shape.d.ts.map +1 -0
- package/dist/react/shape.js +21 -0
- package/dist/react/shape.js.map +1 -0
- package/dist/react/viewport.d.ts +15 -0
- package/dist/react/viewport.d.ts.map +1 -0
- package/dist/react/viewport.js +16 -0
- package/dist/react/viewport.js.map +1 -0
- package/dist/react.d.ts +176 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +2 -0
- package/dist/styles.css +1 -0
- package/package.json +19 -4
- package/src/contracts/controller.ts +61 -0
- package/src/contracts/events.ts +48 -0
- package/src/contracts/identity.ts +27 -0
- package/src/contracts/internal.ts +150 -0
- package/src/contracts/notifications.ts +104 -0
- package/src/contracts/operations.ts +71 -0
- package/src/contracts/snapshots.ts +59 -0
- package/src/core/bridge.ts +280 -0
- package/src/core/controller.ts +853 -0
- package/src/core/validation.ts +290 -0
- package/src/create-cloudlet.ts +43 -0
- package/src/index.ts +34 -0
- package/src/react/announcer.ts +198 -0
- package/src/react/bindings.tsx +56 -0
- package/src/react/card.tsx +222 -0
- package/src/react/generators.ts +274 -0
- package/src/react/gestures.ts +296 -0
- package/src/react/host.tsx +953 -0
- package/src/react/motion.ts +484 -0
- package/src/react/plan.ts +101 -0
- package/src/react/renderer.tsx +77 -0
- package/src/react/shape.ts +33 -0
- package/src/react/viewport.ts +10 -0
- package/src/react.ts +190 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
The first stable release, published to npm as `latest` (`npm install @cloudlet/toast`). The API is the
|
|
6
|
+
one of 1.0.0-rc.3 plus one diagnostic code; it follows semantic versioning from here. Not yet checked by
|
|
7
|
+
hand: screen readers beyond VoiceOver on macOS, physical phones and the minimum browser versions
|
|
8
|
+
(listed on the documentation's Accessibility page).
|
|
9
|
+
|
|
10
|
+
### Performance
|
|
11
|
+
|
|
12
|
+
- `Toaster` loads its renderer (host, motion, cards, gestures, announcer) as a separate chunk through
|
|
13
|
+
`import()`, once per page, on the client after mount. The JavaScript an app pays for at start drops
|
|
14
|
+
from 27953 to 8602 B min+gzip; the renderer chunk follows right after. Notifications shown meanwhile
|
|
15
|
+
wait in the controller. No `React.lazy` or `Suspense` is needed in the app, and server rendering is
|
|
16
|
+
unchanged: Toaster renders nothing on the server.
|
|
17
|
+
|
|
18
|
+
### API
|
|
19
|
+
|
|
20
|
+
- New diagnostic `renderer-load-error`: the renderer chunk failed to load (offline, for example). The
|
|
21
|
+
notifications wait in the controller, and the next Toaster mount loads the chunk again.
|
|
22
|
+
|
|
23
|
+
### Fixes
|
|
24
|
+
|
|
25
|
+
- The Island's background no longer counts as layout shift while it morphs at the bottom edge: it is
|
|
26
|
+
placed with a transform instead of `bottom: 0`. Pixels are unchanged.
|
|
27
|
+
- On a slow first frame, the queue aggregate ("2 notifications queued") was spoken alone before the
|
|
28
|
+
newest record's title. The announcer now waits until the pill is readable and speaks the title first
|
|
29
|
+
and the queue after it, as on fast devices.
|
|
30
|
+
|
|
31
|
+
### shadcn item
|
|
32
|
+
|
|
33
|
+
- The wrapper takes a controller that may still be `null` (`ReactCloudletController | null`), so an app
|
|
34
|
+
can render it before its client owner has created the controller.
|
|
35
|
+
|
|
36
|
+
## 1.0.0-rc.3 — 2026-10-25
|
|
37
|
+
|
|
38
|
+
Release candidate, published to npm on 2026-10-27 under the `next` dist-tag
|
|
39
|
+
(`npm install @cloudlet/toast@next`; integrity
|
|
40
|
+
`sha512-iYdZ7n/eH5gtLD4+QQTwQp/mtKCMNoCi89BWwTJw2G+qT86V9OwrK1pE3kwaxModaFO7t4EHvS8wQoS1iOIbFA==`).
|
|
41
|
+
It carries the fixes from the VoiceOver + Safari gate on 1.0.0-rc.2 (slide revisits, assertive text in
|
|
42
|
+
the open Island, repeated messages) and localizable role words, so that gate can be closed on an
|
|
43
|
+
archive.
|
|
44
|
+
|
|
45
|
+
### Migrating from 1.0.0-rc.2
|
|
46
|
+
|
|
47
|
+
- A full `CloudletLabels` object (not a `Partial`) needs the new `carousel` and `slide` strings.
|
|
48
|
+
- The live regions are `div.cloudlet-announcer` elements beside `.cloudlet-host`, created by the
|
|
49
|
+
announcer, instead of children of the host. Code that queried `.cloudlet-host [aria-live]` should use
|
|
50
|
+
`[data-cloudlet-announcer]`.
|
|
51
|
+
|
|
52
|
+
### API
|
|
53
|
+
|
|
54
|
+
- `CloudletLabels` gains `carousel` and `slide`: the spoken roles (`aria-roledescription`) of the open
|
|
55
|
+
Island and of each slide, `'carousel'` and `'slide'` by default. A localized Island no longer speaks
|
|
56
|
+
English role words (found in the VoiceOver + Safari run on 1.0.0-rc.2).
|
|
57
|
+
|
|
58
|
+
### Fixes (VoiceOver + Safari gate on 1.0.0-rc.2)
|
|
59
|
+
|
|
60
|
+
- Moving back to a slide already shown in the open Island (arrow keys, Home/End, the dots, a swipe, or
|
|
61
|
+
the next slide after Close) now announces it once, politely. The title is one element across slides,
|
|
62
|
+
so focus never changed and VoiceOver said nothing.
|
|
63
|
+
- Assertive announcements (a failed operation, for example) are spoken while focus is inside the open
|
|
64
|
+
Island. The announcer now creates its two live regions itself, next to the host, and re-inserts them
|
|
65
|
+
once on the next frame: VoiceOver in Safari ignored assertive changes in regions inserted only once
|
|
66
|
+
(0 of 6 runs) and spoke them after the re-insertion (6 of 6).
|
|
67
|
+
- The same announcement twice in a row (a second failed attempt) is spoken again: the region gets a
|
|
68
|
+
trailing no-break space so it changes.
|
|
69
|
+
- The live regions are now `div.cloudlet-announcer` elements beside `.cloudlet-host` instead of inside it.
|
|
70
|
+
|
|
71
|
+
## 1.0.0-rc.2 — 2026-10-25
|
|
72
|
+
|
|
73
|
+
Local, private release candidate. It closes the library questions collected while building the landing
|
|
74
|
+
page and the documentation site (own motion generators, export map, provider/auto-dismiss/theme API and
|
|
75
|
+
interaction fixes) before the manual accessibility, device and Safari gates, which now run on this
|
|
76
|
+
candidate. Stable release readiness stays **not ready**; nothing has been
|
|
77
|
+
published.
|
|
78
|
+
|
|
79
|
+
### Migrating from 1.0.0-rc.1
|
|
80
|
+
|
|
81
|
+
- `requestFocus({ kind: 'notification', handle, control })` while the Island is collapsed returns
|
|
82
|
+
`{ status: 'rejected', reason: 'not-visible' }` instead of `requested`. Open the Island first, or omit
|
|
83
|
+
`control` to focus the pill.
|
|
84
|
+
- The `--cloudlet-stack-gap` token is gone; it never affected layout, so remove any override.
|
|
85
|
+
- A successful factory attempt shows no Retry button. Call `retry()` on the handle if you offer a
|
|
86
|
+
"run again" elsewhere.
|
|
87
|
+
- `useCloudlet()` now also throws while the provider's controller is `null`; use `useOptionalCloudlet()`
|
|
88
|
+
in components that render before the controller exists.
|
|
89
|
+
|
|
90
|
+
### API (review of open library questions)
|
|
91
|
+
|
|
92
|
+
- `CloudletProvider` accepts `controller={null}` while an effect-owned controller does not exist yet
|
|
93
|
+
(server render, first client render). Under it `Toaster` renders nothing, so an owner can wrap the
|
|
94
|
+
whole application without losing server HTML. `Toaster` outside any Provider still throws.
|
|
95
|
+
- New `useOptionalCloudlet()` (and type `UseOptionalCloudlet`): the controller, or `null` outside a
|
|
96
|
+
Provider and while its controller is `null`. `useCloudlet()` throws in both cases.
|
|
97
|
+
- New `<Toaster autoDismiss>`: overrides `ControllerOptions.autoDismiss` while defined and applies
|
|
98
|
+
without a remount. Off stops every timer; on starts each notification's timer from its full duration;
|
|
99
|
+
removing the prop restores the controller's option. A non-boolean value reports `invalid-input`
|
|
100
|
+
(source `Toaster.autoDismiss`).
|
|
101
|
+
- The host carries `data-resolved-theme="light|dark"`: the theme in effect, following
|
|
102
|
+
`prefers-color-scheme` while `theme` is `system`. `data-theme` still carries the prop's value.
|
|
103
|
+
- `requestFocus({ kind: 'notification', control })` while the Island is collapsed now returns
|
|
104
|
+
`rejected: 'not-visible'` at once. It used to return `requested`, then fail silently, because card
|
|
105
|
+
controls exist only in the Island.
|
|
106
|
+
- Removed the `--cloudlet-stack-gap` token: the host has a single laid-out child, so it never applied.
|
|
107
|
+
|
|
108
|
+
### Fixes
|
|
109
|
+
|
|
110
|
+
- The `hover` pause no longer sticks after the hovered card disappears under a still pointer (Chromium
|
|
111
|
+
and Firefox send no `mouseout`, so React never saw the leave and auto-open waited until the next
|
|
112
|
+
hover). The next `pointerover` outside the host now releases it. Reported by the landing playground.
|
|
113
|
+
- A successful attempt of a factory no longer shows a Retry button. `retry()` and `canRetry` are
|
|
114
|
+
unchanged; the button follows the core rule that only an unsuccessful attempt offers retry.
|
|
115
|
+
- A scrolling Island body is a tab stop (`tabindex=0`, `role=group`, named by the title): Safari never
|
|
116
|
+
makes scrollers focusable, and a focused action below a long description could not scroll back up.
|
|
117
|
+
`Home`/`End` on that body scroll it instead of switching slides.
|
|
118
|
+
- The JS fallbacks of `--cloudlet-tail-offset`/`--cloudlet-tail-scale` match the stylesheet (4 / 0.9).
|
|
119
|
+
|
|
120
|
+
### Size (experiment E1)
|
|
121
|
+
|
|
122
|
+
- `motion` is no longer a dependency of the package: the shell sampler runs on Cloudlet's own numeric
|
|
123
|
+
generators (`src/react/generators.ts`), the spring and two-keyframe `easeOut` tween ported from
|
|
124
|
+
Motion 14.3.0 (MIT, attributed in THIRD_PARTY_NOTICES). A reference test samples both
|
|
125
|
+
implementations every millisecond for every `MOTION` configuration, boundary overrides and release
|
|
126
|
+
velocities: values and velocities match bit for bit, `done` flips on the same frame, so the owner's
|
|
127
|
+
motion (D47) is unchanged. Full consumer delta 34461 → 30690 B gzip; own JS 26089 → 27340 B (the
|
|
128
|
+
generators now count as own code); a consumer that already ships Motion pays 29258 → 30514 B.
|
|
129
|
+
`check-package` now asserts that the package declares no runtime dependencies.
|
|
130
|
+
|
|
131
|
+
### Package
|
|
132
|
+
|
|
133
|
+
- The root export map gains a `default` condition pointing at the same ESM entry as `import`. Resolvers
|
|
134
|
+
that arrive without the `import` condition (CommonJS `require()` on Node 22.12+, `require.resolve`,
|
|
135
|
+
Jest in CommonJS mode, lint import resolvers) reached `ERR_PACKAGE_PATH_NOT_EXPORTED` before; they now
|
|
136
|
+
resolve `dist/index.js`. No second build is added and the package stays ESM-only. `check-package`
|
|
137
|
+
asserts the condition order (`types`, `import`, `default`) and runs a CommonJS `require()` probe.
|
|
138
|
+
|
|
139
|
+
## 1.0.0-rc.1 — 2026-10-22
|
|
140
|
+
|
|
141
|
+
Local, private release candidate of the stack → Island model (DESIGN.md, tasks 12–18). No compatibility
|
|
142
|
+
with rc.0 is promised: see Migrating from 1.0.0-rc.0 below. Stable release readiness stays
|
|
143
|
+
**not ready**; nothing has been published.
|
|
144
|
+
|
|
145
|
+
### Verification (task 18)
|
|
146
|
+
|
|
147
|
+
- The browser end-to-end suites are rewritten for the model: `stack`, `slider`, `accessibility`, `mobile`,
|
|
148
|
+
`surface`, `harness` beside the task 13 `island` and task 16 `lab` specs (tests/README.md). They cover the
|
|
149
|
+
stack, opening/collapsing, the slider, swipes and trackpad, `?fixture=attention` auto-opening on a fake
|
|
150
|
+
clock, the TTL rules of DESIGN §6, overflow, RTL, the bottom edge and mobile viewports, reduced motion, axe,
|
|
151
|
+
strict CSP and `timeScale` samples that prove the shell does not move during a slide.
|
|
152
|
+
- Installed-tarball consumers (`fixtures/integration`) and the shadcn registry check drive the pill, the
|
|
153
|
+
Island, the slide, the swipe and the auto-opening action instead of the removed modes and overview.
|
|
154
|
+
- Documentation (package and root README, API contract, QA and release documents) describes rc.1 only.
|
|
155
|
+
|
|
156
|
+
### Motion (task 17, owner-tuned)
|
|
157
|
+
|
|
158
|
+
- `MOTION` now holds the values accepted on the laboratory (DESIGN §7): the first pill grows from scale 0.25
|
|
159
|
+
with a 160 ms opacity tween (`enter.fade`), shape springs 900/60/2 (open) and 900/45/1 (close), slide
|
|
160
|
+
1200/60/1, progress tween 1000 ms; tails sit 4 px apart at scale 0.9.
|
|
161
|
+
- A new record arriving on a visible stack keeps the shell: the title blur-swaps and the width springs to the
|
|
162
|
+
new text instead of the whole pill fading out and in.
|
|
163
|
+
- Inside the Island only the body slides between notifications; the title and icon blur-swap in place. The
|
|
164
|
+
swipe preview shows the neighbour's body under the live heading.
|
|
165
|
+
- Trackpad swipes commit as soon as the release threshold is crossed; the macOS momentum tail is swallowed
|
|
166
|
+
(`swipe.wheelLock` 400 ms), vertical scrolling stays native, a reversed or faster delta starts a new swipe.
|
|
167
|
+
- Rapid body updates (progress text) change in place once a crossfade ran within `bodyQuiet` (600 ms).
|
|
168
|
+
- The double-click guard (`click.detail > 1`) now covers only `action`, `retry` and `cancel`; fast repeated
|
|
169
|
+
clicks on close, the pill and the dots are accepted.
|
|
170
|
+
|
|
171
|
+
### Breaking changes
|
|
172
|
+
|
|
173
|
+
- One stack replaces the Island/Stack presentation modes and the overview. `ControllerSnapshot.mode`,
|
|
174
|
+
`.slots` and `.queue`, `VisibleSlotSnapshot` and `PresentationMode` are removed. New:
|
|
175
|
+
`ControllerSnapshot.stack` (handles, newest first) and `ControllerSnapshot.island { open, reason, current }`.
|
|
176
|
+
- `NotificationSnapshot.location` is now `'stack' | 'current'`; `current` is the single presented record.
|
|
177
|
+
- `controller.select()`, `SelectOptions` and `SelectResult` are removed. The Island is opened by the user
|
|
178
|
+
from the stack or automatically by `attention`.
|
|
179
|
+
- `priority` no longer affects presentation order; the 3 high : 1 normal fairness queue is gone.
|
|
180
|
+
- The `selection-changed` event is removed. Pause reasons `queued`, `expanded` and `overview` are replaced
|
|
181
|
+
by `inactive` (not presented) and `island` (current slide of an Island the user opened, or one that asks
|
|
182
|
+
for action).
|
|
183
|
+
- `FocusTarget` drops `{ kind: 'overview' }` and `control: 'disclosure'`.
|
|
184
|
+
- `ToasterProps.mode` is removed. Labels `expand`, `overview`, `closeOverview`, `notificationCount` and
|
|
185
|
+
`selectNotification` are replaced by `island`, `stackSummary(title, count, missed)` and `page(index, total)`.
|
|
186
|
+
- CSS tokens `--cloudlet-compact-*`, `--cloudlet-expanded-*`, `--cloudlet-content-padding` and
|
|
187
|
+
`--cloudlet-accent` are removed; the progress bar under the icon (`.cloudlet-progress`) is replaced by a ring.
|
|
188
|
+
|
|
189
|
+
### Migrating from 1.0.0-rc.0
|
|
190
|
+
|
|
191
|
+
rc.0 had two presentation modes and an overview list; rc.1 has one stack that opens into the Island.
|
|
192
|
+
Applications touch only the public API below; the renderer is replaced wholesale.
|
|
193
|
+
|
|
194
|
+
| rc.0 | rc.1 |
|
|
195
|
+
|---|---|
|
|
196
|
+
| `<Toaster mode="island" \| "stack" />` | Remove the prop. The stack is collapsed or opened (`ControllerSnapshot.island`). |
|
|
197
|
+
| `snapshot.mode`, `snapshot.slots`, `snapshot.queue`, `VisibleSlotSnapshot`, `PresentationMode` | `snapshot.stack` (handles, newest first) and `snapshot.island { open, reason, current }`. |
|
|
198
|
+
| `NotificationSnapshot.location: 'queued' \| 'selected'` | `'stack' \| 'current'`; `current` is the single presented record. |
|
|
199
|
+
| `controller.select(handle)`, `SelectOptions`, `SelectResult` | Removed. The user opens the Island from the pill; `attention` opens it automatically. |
|
|
200
|
+
| `priority` ordering, the 3 high : 1 normal fairness queue | `priority` is metadata only; admission order is presentation order. |
|
|
201
|
+
| Event `selection-changed`; pauses `queued`, `expanded`, `overview` | Read `snapshot.island`; pauses `inactive` and `island`. |
|
|
202
|
+
| `requestFocus({ kind: 'overview' })`, `control: 'disclosure'` | `requestFocus({ kind: 'overflow' })` and `control: 'action' \| 'close'`. |
|
|
203
|
+
| Labels `expand`, `overview`, `closeOverview`, `notificationCount`, `selectNotification` | `island`, `collapse`, `stackSummary(title, count, missed)`, `page(index, total)`, `overflowCount(count)`. |
|
|
204
|
+
| CSS tokens `--cloudlet-compact-*`, `--cloudlet-expanded-*`, `--cloudlet-content-padding`, `--cloudlet-accent` | `--cloudlet-pill-*`, `--cloudlet-island-*`, `--cloudlet-tail-*`, `--cloudlet-badge*`; see the geometry tokens under Added. |
|
|
205
|
+
| Progress bar `.cloudlet-progress` | A 2 px ring around the status icon; the icon is the `progressbar`. |
|
|
206
|
+
| Separate overflow card | The badge, the pill name and the Island indicator line with the acknowledgement button. |
|
|
207
|
+
|
|
208
|
+
New in rc.1: `attention` on notifications and `attention.delay` on `Toaster`, `classNames`, `motion`
|
|
209
|
+
(`timeScale`, `overrides` for the laboratory), swipe gestures, the bottom edge and RTL mirroring described
|
|
210
|
+
under Added. The host attributes `data-state`, `data-island-reason`, `data-edge` and `data-dragging` are new
|
|
211
|
+
styling hooks; `data-position`, `data-theme` and `data-reduced-motion` are unchanged.
|
|
212
|
+
|
|
213
|
+
### Added
|
|
214
|
+
|
|
215
|
+
- `attention?: 'auto' | 'open' | 'stack'` on notification content, patches and operation content, with
|
|
216
|
+
validation. Auto-open after `ControllerOptions.attentionDelay` / `ToasterProps.attention.delay`
|
|
217
|
+
(default 600 ms), waiting for hover/focus/gesture, newest candidate wins, cancelled on dismiss/clear/dispose.
|
|
218
|
+
- Visible-time rules: only the top record (collapsed) or the current slide (Island) spends time.
|
|
219
|
+
- One measured shell for the collapsed pill and the Island: an SVG rounded-rect path plus the same
|
|
220
|
+
`clip-path`, up to two tails and a badge, Sileo-style enter/exit, spring morph pill ↔ Island, blur swap
|
|
221
|
+
of title and icon, body crossfade, horizontal slide between notifications inside a fixed shell, reduced
|
|
222
|
+
motion on mount and on the fly. `ToasterProps.motion.timeScale` slows every transition (debugging aid).
|
|
223
|
+
- Geometry tokens `--cloudlet-pill-height`, `--cloudlet-pill-radius`, `--cloudlet-pill-max-width`,
|
|
224
|
+
`--cloudlet-island-radius`, `--cloudlet-island-max-width`, `--cloudlet-tail-offset`, `--cloudlet-tail-scale`,
|
|
225
|
+
`--cloudlet-badge`, `--cloudlet-badge-foreground`.
|
|
226
|
+
- Swipes with release physics: sideways on the collapsed pill dismisses the top record (`reason: 'swipe'`,
|
|
227
|
+
the pill flies out from the release point); sideways in the Island follows the finger with the inert
|
|
228
|
+
neighbour beside it, resists at the ends and navigates on release (also with a horizontal trackpad
|
|
229
|
+
swipe); towards the screen edge on the Island header collapses to the stack. The axis is decided by the
|
|
230
|
+
first 8 px; vertical page/body scrolling stays native; buttons and links never start a swipe; reduced
|
|
231
|
+
motion turns swipes off. The host carries `data-dragging="x|y"` while a swipe owns the input.
|
|
232
|
+
- Missed notifications are part of the badge (shown even for one record) and of the pill name; the
|
|
233
|
+
Island indicator line shows `labels.overflowCount` with the `labels.acknowledgeOverflow` button.
|
|
234
|
+
`requestFocus({ kind: 'overflow' })` focuses that button, or the pill while collapsed.
|
|
235
|
+
- RTL mirrors the badge corner, slide direction and swipe sides. At the bottom edge the tails peek out
|
|
236
|
+
upwards, the Island grows upwards from an anchored bottom and the badge sits in the bottom corner;
|
|
237
|
+
`position="auto"` follows the 48rem breakpoint live.
|
|
238
|
+
- Island navigation counts as interaction for `attention`: a pending auto-open restarts its delay.
|
|
239
|
+
|
|
240
|
+
- The look of DESIGN §8: a light toaster on light pages and a dark one on dark pages (`theme` forces
|
|
241
|
+
either; a 1 px `color-mix` border and the `--cloudlet-shadow` token keep a forced theme readable),
|
|
242
|
+
`--cloudlet-success`/`-error`/`-info`/`-warning`/`-loading` in oklch, the status icon in a tinted 24 px
|
|
243
|
+
circle with 16 px stroke glyphs or a spinner, a 2 px progress ring around it (pill and Island; the icon is
|
|
244
|
+
the `progressbar`), 32 px action pills with a status-tinted primary action, a 32 px close circle with a
|
|
245
|
+
44 px touch target, 14 px / 500 titles, and forced-colors support. `--cloudlet-tail-background` and
|
|
246
|
+
`--cloudlet-tail-border` keep the stack tails visible on dark pages; the far tail lies behind the near one.
|
|
247
|
+
- `ToasterProps.classNames` (`Partial<Record<CloudletPart, string>>`) adds classes to the renderer parts;
|
|
248
|
+
`data-kind`/`data-current` on the current card and `data-state`, `data-island-reason`, `data-position`,
|
|
249
|
+
`data-edge`, `data-theme`, `data-reduced-motion`, `data-dragging` on the host are stable styling hooks.
|
|
250
|
+
- Debugging channel `ToasterProps.motion.overrides` (`CloudletMotionOverrides`, partial
|
|
251
|
+
`CloudletMotionConstants`; `CloudletSpring`, `CloudletTimedSpring`): replaces the DESIGN §7 springs and
|
|
252
|
+
durations live for transitions started after the change; invalid fields keep their defaults. It exists
|
|
253
|
+
for the laboratory and motion tuning and is not a styling API; do not ship overrides to production.
|
|
254
|
+
|
|
255
|
+
### Removed
|
|
256
|
+
|
|
257
|
+
- The separate overflow card under the stack (`.cloudlet-host > .cloudlet-overflow`).
|
|
258
|
+
|
|
259
|
+
## 1.0.0-rc.0 — 2026-10-16
|
|
260
|
+
|
|
261
|
+
Local, private release candidate. Stable release readiness is **not ready** while mandatory manual gates remain open. Nothing has been published.
|
|
262
|
+
|
|
263
|
+
- Island (default), Stack, nonmodal overview, independent controllers and generation-safe notification handles.
|
|
264
|
+
- Readable-time scheduler, cooperative cancellation, retries and token-safe command actions; React 18.2/19 and empty SSR/hydration support.
|
|
265
|
+
- Measured HTML/SVG motion without text scaling, reduced motion, native controls, semantic announcement delivery, viewport bounds and cancellable header gestures.
|
|
266
|
+
- External CSS/strict CSP, ESM/types/maps, installed-tarball Vite/Next and optional shadcn wrapper verification.
|
|
267
|
+
- Fixed thenable assimilation reading a `then` accessor twice and changing the original operation result.
|
|
268
|
+
- Fixed an announcement formatter unmount leaving a new timer after renderer cleanup.
|
|
269
|
+
- Verification now refuses a missing consumer lock unless dependency resolution is explicitly requested; RC archive/version binding is derived from the actual manifest.
|
|
270
|
+
|
|
271
|
+
VoiceOver/NVDA, real Safari/PWA/mobile devices, browser floors, physical latency/frame/memory budgets and release credentials/provenance remain unverified. Size comparisons remain report-only under the existing owner deferral; no new budget is accepted.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cloudlet contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cloudlet — React notifications and operations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@cloudlet/toast` is a notification library for React. Every notification lives in one stack, newest
|
|
4
|
+
first, that is either collapsed to a single pill or opened as the Island: one surface with a slider
|
|
5
|
+
over every notification. Activating the pill opens the Island; a notification that needs attention
|
|
6
|
+
opens it on its own after a short delay, without moving keyboard focus. The same controller follows
|
|
7
|
+
promises from pending to success or failure, with retry and cooperative cancellation.
|
|
8
|
+
|
|
9
|
+
**Status.** `1.0.0` is the first stable release; the API follows semantic versioning from here. The
|
|
10
|
+
checks not yet done by hand (screen readers beyond VoiceOver on macOS, physical phones, the minimum
|
|
11
|
+
browser versions) are listed under
|
|
12
|
+
[What is tested](https://cloudlet.dev/toaster/docs/accessibility#what-is-tested).
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @cloudlet/toast
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
React and React DOM `^18.2.0 || ^19.0.0` are peers; use a matching pair. The package is ESM only, has
|
|
21
|
+
no runtime dependencies and needs neither Tailwind nor shadcn/ui. Import its CSS once, in your
|
|
22
|
+
application's global CSS entry or root layout.
|
|
23
|
+
|
|
24
|
+
## Minimal example
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import '@cloudlet/toast/styles.css';
|
|
28
|
+
import { CloudletProvider, createCloudlet, Toaster, useCloudlet } from '@cloudlet/toast';
|
|
29
|
+
|
|
30
|
+
function SaveNotice() {
|
|
31
|
+
const cloudlet = useCloudlet();
|
|
32
|
+
return <button onClick={() => cloudlet.show({ title: 'Saved', kind: 'success' })}>Notify</button>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The browser application bootstrap creates and owns this controller.
|
|
36
|
+
export function Notifications({ controller }: { controller: ReturnType<typeof createCloudlet> }) {
|
|
37
|
+
return <CloudletProvider controller={controller}>
|
|
38
|
+
<SaveNotice />
|
|
39
|
+
<Toaster />
|
|
40
|
+
</CloudletProvider>;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Who owns the controller
|
|
45
|
+
|
|
46
|
+
Your application creates one stable controller per browser session, or one per request when rendering
|
|
47
|
+
on the server; never share a mutable controller between users. Creating it allocates no timers,
|
|
48
|
+
listeners or DOM. The Provider only passes it down, and unmounting the Toaster pauses visible time
|
|
49
|
+
without losing notifications or running operations. Call `controller.dispose()` once, when the owner
|
|
50
|
+
is permanently finished: in a React effect, clean up exactly the instance that effect created.
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
Full documentation: **https://cloudlet.dev/toaster/docs**
|
|
55
|
+
|
|
56
|
+
- Getting started: Introduction, Installation (npm and the shadcn registry item), Quick start.
|
|
57
|
+
- Guides: Notifications & time, Operations & cancellation, Positioning & offsets, Styling & strict
|
|
58
|
+
CSP, SSR & Next.js, Accessibility (including what is and is not tested).
|
|
59
|
+
- Reference: `createCloudlet`, the controller, Toaster props, labels & announcements, types.
|
|
60
|
+
- The [changelog](CHANGELOG.md) lists every change, including migration from `1.0.0-rc.0`.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
Cloudlet's own code is [MIT](LICENSE). The only ported third-party code is the numeric spring and
|
|
65
|
+
easing of Motion 14.3.0 (MIT); it and the peer dependencies are attributed in
|
|
66
|
+
[THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES.md).
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Generated from the installed lockfile dependency tree by `npm run notices`.
|
|
4
|
+
Cloudlet bundles none of these runtimes and has no runtime dependencies; React/React DOM are peers.
|
|
5
|
+
Versions below describe this development/consumer baseline, not the whole supported peer range.
|
|
6
|
+
The numeric spring and easing generators in `src/react/generators.ts` are ported from Motion
|
|
7
|
+
(motion-dom and motion-utils, MIT) and keep its attribution below; nothing else was copied.
|
|
8
|
+
|
|
9
|
+
## motion-dom@14.3.0
|
|
10
|
+
|
|
11
|
+
License: MIT. Source: installed package LICENSE.md.
|
|
12
|
+
Ported code: src/react/generators.ts: numeric spring generator (animation/generators/spring.mjs) and the two-keyframe tween of keyframes.mjs.
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
The MIT License (MIT)
|
|
16
|
+
|
|
17
|
+
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
in the Software without restriction, including without limitation the rights
|
|
22
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
furnished to do so, subject to the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
SOFTWARE.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## motion-utils@14.1.1
|
|
39
|
+
|
|
40
|
+
License: MIT. Source: installed package LICENSE.md.
|
|
41
|
+
Ported code: src/react/generators.ts: cubicBezier easing (easing/cubic-bezier.mjs).
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
The MIT License (MIT)
|
|
45
|
+
|
|
46
|
+
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
|
|
47
|
+
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
49
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
50
|
+
in the Software without restriction, including without limitation the rights
|
|
51
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
52
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
53
|
+
furnished to do so, subject to the following conditions:
|
|
54
|
+
|
|
55
|
+
The above copyright notice and this permission notice shall be included in all
|
|
56
|
+
copies or substantial portions of the Software.
|
|
57
|
+
|
|
58
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
59
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
60
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
61
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
62
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
63
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
64
|
+
SOFTWARE.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## react-dom@19.3.1
|
|
68
|
+
|
|
69
|
+
License: MIT. Source: installed package LICENSE.
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
MIT License
|
|
73
|
+
|
|
74
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
75
|
+
|
|
76
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
77
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
78
|
+
in the Software without restriction, including without limitation the rights
|
|
79
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
80
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
81
|
+
furnished to do so, subject to the following conditions:
|
|
82
|
+
|
|
83
|
+
The above copyright notice and this permission notice shall be included in all
|
|
84
|
+
copies or substantial portions of the Software.
|
|
85
|
+
|
|
86
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
87
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
88
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
89
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
90
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
91
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
92
|
+
SOFTWARE.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## react@19.3.1
|
|
96
|
+
|
|
97
|
+
License: MIT. Source: installed package LICENSE.
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
MIT License
|
|
101
|
+
|
|
102
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
103
|
+
|
|
104
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
105
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
106
|
+
in the Software without restriction, including without limitation the rights
|
|
107
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
108
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
109
|
+
furnished to do so, subject to the following conditions:
|
|
110
|
+
|
|
111
|
+
The above copyright notice and this permission notice shall be included in all
|
|
112
|
+
copies or substantial portions of the Software.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
115
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
116
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
117
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
118
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
119
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
120
|
+
SOFTWARE.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## scheduler@0.28.0
|
|
124
|
+
|
|
125
|
+
License: MIT. Source: installed package LICENSE.
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
MIT License
|
|
129
|
+
|
|
130
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
131
|
+
|
|
132
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
133
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
134
|
+
in the Software without restriction, including without limitation the rights
|
|
135
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
136
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
137
|
+
furnished to do so, subject to the following conditions:
|
|
138
|
+
|
|
139
|
+
The above copyright notice and this permission notice shall be included in all
|
|
140
|
+
copies or substantial portions of the Software.
|
|
141
|
+
|
|
142
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
143
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
144
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
145
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
146
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
147
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
148
|
+
SOFTWARE.
|
|
149
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Diagnostic, SemanticEvent } from './events.js';
|
|
2
|
+
import type { HandleRejection, InputIssue, NotificationHandle, Unsubscribe } from './identity.js';
|
|
3
|
+
import type { AdmissionResult, NotificationPatch, NotificationSpec, OverflowSnapshot } from './notifications.js';
|
|
4
|
+
import type { CancellationSignal, OperationHandle, OperationSource, TrackOptions } from './operations.js';
|
|
5
|
+
import type { ControllerSnapshot } from './snapshots.js';
|
|
6
|
+
export interface FallbackMessages {
|
|
7
|
+
readonly operationSuccess: string;
|
|
8
|
+
readonly operationError: string;
|
|
9
|
+
readonly operationCancelled: string;
|
|
10
|
+
readonly cancellationRequested: string;
|
|
11
|
+
readonly actionError: string;
|
|
12
|
+
readonly renderError: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ControllerOptions {
|
|
15
|
+
readonly autoDismiss?: boolean;
|
|
16
|
+
/** Auto-open delay after admission, in milliseconds; default 600. A host may override it. */
|
|
17
|
+
readonly attentionDelay?: number;
|
|
18
|
+
readonly messages?: Partial<FallbackMessages>;
|
|
19
|
+
readonly onOverflow?: (overflow: OverflowSnapshot) => void;
|
|
20
|
+
readonly onDiagnostic?: (diagnostic: Diagnostic) => void;
|
|
21
|
+
}
|
|
22
|
+
export type MutationRejection = HandleRejection | 'disposed' | 'invalid-input' | 'action-pending' | 'operation-owned';
|
|
23
|
+
export type MutationResult = {
|
|
24
|
+
readonly status: 'applied';
|
|
25
|
+
} | {
|
|
26
|
+
readonly status: 'unchanged';
|
|
27
|
+
} | {
|
|
28
|
+
readonly status: 'rejected';
|
|
29
|
+
readonly reason: MutationRejection;
|
|
30
|
+
readonly issues?: readonly InputIssue[];
|
|
31
|
+
};
|
|
32
|
+
export type FocusTarget = {
|
|
33
|
+
readonly kind: 'anchor';
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: 'notification';
|
|
36
|
+
readonly handle: NotificationHandle;
|
|
37
|
+
readonly control?: 'action' | 'close';
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'overflow';
|
|
40
|
+
};
|
|
41
|
+
export type FocusResult = {
|
|
42
|
+
readonly status: 'requested';
|
|
43
|
+
} | {
|
|
44
|
+
readonly status: 'rejected';
|
|
45
|
+
readonly reason: HandleRejection | 'disposed' | 'no-host' | 'not-visible' | 'unavailable';
|
|
46
|
+
};
|
|
47
|
+
export type ClearResult = {
|
|
48
|
+
readonly status: 'cleared';
|
|
49
|
+
readonly count: number;
|
|
50
|
+
} | {
|
|
51
|
+
readonly status: 'rejected';
|
|
52
|
+
readonly reason: 'disposed';
|
|
53
|
+
};
|
|
54
|
+
export interface CloudletController<Slot = never, Signal extends CancellationSignal = CancellationSignal> {
|
|
55
|
+
readonly show: (spec: NotificationSpec<Slot>) => AdmissionResult;
|
|
56
|
+
readonly update: (handle: NotificationHandle, patch: NotificationPatch<Slot>) => MutationResult;
|
|
57
|
+
readonly getHandle: (id: string) => NotificationHandle | undefined;
|
|
58
|
+
readonly track: <T>(source: OperationSource<T, Signal>, options: TrackOptions<T, Slot, Signal>) => OperationHandle<T>;
|
|
59
|
+
readonly dismiss: (handle: NotificationHandle) => MutationResult;
|
|
60
|
+
readonly clear: () => ClearResult;
|
|
61
|
+
readonly requestFocus: (target?: FocusTarget) => FocusResult;
|
|
62
|
+
readonly acknowledgeOverflow: () => MutationResult;
|
|
63
|
+
readonly getSnapshot: () => ControllerSnapshot<Slot>;
|
|
64
|
+
readonly getServerSnapshot: () => ControllerSnapshot<Slot>;
|
|
65
|
+
readonly subscribe: (listener: () => void) => Unsubscribe;
|
|
66
|
+
readonly onEvent: (listener: (event: SemanticEvent) => void) => Unsubscribe;
|
|
67
|
+
readonly dispose: () => void;
|
|
68
|
+
}
|
|
69
|
+
/** Notification-only view of a controller, useful to consumers that do not track operations. */
|
|
70
|
+
export type NotificationController<Slot = never> = Omit<CloudletController<Slot>, 'track'>;
|
|
71
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/contracts/controller.ts"],"names":[],"mappings":"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"}
|