@cloudlet/toast 1.4.0 → 1.5.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/README.md +3 -0
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +19 -15
  5. package/dist/agent.js.map +1 -1
  6. package/dist/center-react.d.ts +286 -0
  7. package/dist/center-react.d.ts.map +1 -0
  8. package/dist/center-react.js +2 -0
  9. package/dist/center.d.ts +3 -0
  10. package/dist/center.d.ts.map +1 -0
  11. package/dist/center.js +1 -0
  12. package/dist/core/agent-port.d.ts +2 -0
  13. package/dist/core/agent-port.d.ts.map +1 -1
  14. package/dist/core/agent-port.js +3 -0
  15. package/dist/core/agent-port.js.map +1 -1
  16. package/dist/react/card.d.ts +4 -0
  17. package/dist/react/card.d.ts.map +1 -1
  18. package/dist/react/card.js +3 -8
  19. package/dist/react/card.js.map +1 -1
  20. package/dist/react/center-backdrop.d.ts +69 -0
  21. package/dist/react/center-backdrop.d.ts.map +1 -0
  22. package/dist/react/center-backdrop.js +81 -0
  23. package/dist/react/center-backdrop.js.map +1 -0
  24. package/dist/react/center-clear.d.ts +16 -0
  25. package/dist/react/center-clear.d.ts.map +1 -0
  26. package/dist/react/center-clear.js +24 -0
  27. package/dist/react/center-clear.js.map +1 -0
  28. package/dist/react/center-gestures.d.ts +47 -0
  29. package/dist/react/center-gestures.d.ts.map +1 -0
  30. package/dist/react/center-gestures.js +74 -0
  31. package/dist/react/center-gestures.js.map +1 -0
  32. package/dist/react/center-motion.d.ts +174 -0
  33. package/dist/react/center-motion.d.ts.map +1 -0
  34. package/dist/react/center-motion.js +344 -0
  35. package/dist/react/center-motion.js.map +1 -0
  36. package/dist/react/center.d.ts +15 -0
  37. package/dist/react/center.d.ts.map +1 -0
  38. package/dist/react/center.js +1287 -0
  39. package/dist/react/center.js.map +1 -0
  40. package/dist/react/focus.d.ts +7 -0
  41. package/dist/react/focus.d.ts.map +1 -0
  42. package/dist/react/focus.js +14 -0
  43. package/dist/react/focus.js.map +1 -0
  44. package/dist/react/gestures.d.ts +33 -2
  45. package/dist/react/gestures.d.ts.map +1 -1
  46. package/dist/react/gestures.js +181 -149
  47. package/dist/react/gestures.js.map +1 -1
  48. package/dist/react/host.d.ts.map +1 -1
  49. package/dist/react/host.js +287 -283
  50. package/dist/react/host.js.map +1 -1
  51. package/dist/react/motion.d.ts +18 -11
  52. package/dist/react/motion.d.ts.map +1 -1
  53. package/dist/react/motion.js +6 -3
  54. package/dist/react/motion.js.map +1 -1
  55. package/dist/react/reduced.d.ts +24 -0
  56. package/dist/react/reduced.d.ts.map +1 -0
  57. package/dist/react/reduced.js +35 -0
  58. package/dist/react/reduced.js.map +1 -0
  59. package/dist/react/zoom.d.ts +12 -0
  60. package/dist/react/zoom.d.ts.map +1 -0
  61. package/dist/react/zoom.js +21 -0
  62. package/dist/react/zoom.js.map +1 -0
  63. package/dist/react.d.ts +4 -0
  64. package/dist/react.d.ts.map +1 -1
  65. package/dist/styles.css +1 -1
  66. package/package.json +2 -1
  67. package/src/agent.ts +11 -6
  68. package/src/center-react.ts +300 -0
  69. package/src/center.ts +27 -0
  70. package/src/core/agent-port.ts +3 -0
  71. package/src/react/card.tsx +5 -6
  72. package/src/react/center-backdrop.tsx +151 -0
  73. package/src/react/center-clear.ts +56 -0
  74. package/src/react/center-gestures.ts +143 -0
  75. package/src/react/center-motion.ts +504 -0
  76. package/src/react/center.tsx +1557 -0
  77. package/src/react/focus.ts +18 -0
  78. package/src/react/gestures.ts +127 -37
  79. package/src/react/host.tsx +17 -5
  80. package/src/react/motion.ts +16 -9
  81. package/src/react/reduced.ts +52 -0
  82. package/src/react/zoom.ts +26 -0
  83. package/src/react.ts +4 -0
@@ -0,0 +1,286 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { CloudletSpring, CloudletTimedSpring } from './react.js';
3
+ /** A button of a notification; a press calls `onAction(item.id, action.id)`. */
4
+ export interface NotificationItemAction {
5
+ /** Unique among the notification's actions. */
6
+ readonly id: string;
7
+ readonly label: string;
8
+ }
9
+ /**
10
+ * One notification of the app's list. The app owns the list: it loads it from wherever it likes (a
11
+ * REST endpoint, a WebSocket, local state) and gives the center a new array whenever it changes;
12
+ * the center never changes it itself.
13
+ */
14
+ export interface NotificationItem {
15
+ /** Stable and unique in the list: the center follows a notification by its id across arrays. */
16
+ readonly id: string;
17
+ readonly title: ReactNode;
18
+ readonly description?: ReactNode;
19
+ /** When it happened: a `Date` or milliseconds since the epoch. The list shows the newest first. */
20
+ readonly time: Date | number;
21
+ /** Notifications with the same nonempty `group` stack into one group; without it one stands alone. */
22
+ readonly group?: string;
23
+ /**
24
+ * `success`, `error`, `info`, `warning` or `loading` draw the Toaster's status icon and tint; any
25
+ * other string is the app's own kind (`data-kind` on the card) and draws no icon of its own.
26
+ */
27
+ readonly kind?: string;
28
+ /** `false` marks the notification unread (`data-read="false"` and a dot); omitted, it reads as read. */
29
+ readonly read?: boolean;
30
+ /** Replaces the kind's icon. */
31
+ readonly icon?: ReactNode;
32
+ readonly actions?: readonly NotificationItemAction[];
33
+ /** The app's own data, passed back untouched in `renderNotification`. */
34
+ readonly data?: unknown;
35
+ }
36
+ /**
37
+ * The parts of the default card, for `renderNotification` to place as it likes. The center keeps
38
+ * the card's frame (`li`, its motion and swipe); what the function returns is its content.
39
+ */
40
+ export interface NotificationParts {
41
+ /** The status icon or `item.icon`; null without either. */
42
+ readonly icon: ReactNode;
43
+ /** The title as the card's heading, with `titleId`. */
44
+ readonly title: ReactElement;
45
+ /** The description in its part; null without one. */
46
+ readonly description: ReactNode;
47
+ /** The action buttons in their row; null without actions. */
48
+ readonly actions: ReactNode;
49
+ /**
50
+ * The time and, in its place on hover and focus, the clear button. Leave it out and the card has
51
+ * no clear button: it still clears by swipe and with its group.
52
+ */
53
+ readonly time: ReactElement;
54
+ /** The id of the title's heading, for the app's own `aria-labelledby`. */
55
+ readonly titleId: string;
56
+ /** Asks the app to dismiss this notification, as its clear button does (`onDismiss`). */
57
+ readonly dismiss: () => void;
58
+ /** Runs an action of this notification, as its button does (`onAction`). */
59
+ readonly action: (actionId: string) => void;
60
+ /** The default content: the head (icon, title, time) and the body (description, actions). */
61
+ readonly content: ReactElement;
62
+ }
63
+ export interface NotificationCenterLabels {
64
+ /** The panel's visible heading and accessible name, "Notifications" by default. */
65
+ readonly title: string;
66
+ /** The panel's close button. */
67
+ readonly close: string;
68
+ /** The button that clears one card, in place of its time. */
69
+ readonly clear: string;
70
+ /** The line of an open center without notifications. */
71
+ readonly empty: string;
72
+ /** The hidden word before a card's title that tells a screen reader its kind; an empty string says nothing. */
73
+ readonly kind: (kind: string) => string;
74
+ /** The hidden word before the title of an unread notification, "Unread" by default. */
75
+ readonly unread: string;
76
+ /** A card's time: `time` and `now` are milliseconds since the epoch. "now", "2m", "1h", "3d", then a date, by default. */
77
+ readonly time: (time: number, now: number) => string;
78
+ /** A group's name from its key (the notifications' `group`): the key as it is by default. */
79
+ readonly group: (key: string) => string;
80
+ /** The button under a collapsed stack that expands it: "Deploys · 2 more" by default; `count` is the notifications under the top one. */
81
+ readonly more: (label: string, count: number) => string;
82
+ /** The accessible name of a group of `count` notifications: "Deploys, 3 notifications" by default. */
83
+ readonly stack: (label: string, count: number) => string;
84
+ /** The button that collapses an expanded group, beside its name. */
85
+ readonly showLess: string;
86
+ /** The two-step button in an expanded group's heading row that clears the group: "Clear" by default. */
87
+ readonly clearGroup: string;
88
+ /** The same button armed, and the polite status then: "Clear 3" by default; `count` is the group's notifications. */
89
+ readonly clearGroupConfirm: (count: number) => string;
90
+ /**
91
+ * The accessible name of a collapsed stack's clear button, in place of its top card's time: "Clear
92
+ * Deploys" by default. Armed, it reads `clearGroupConfirm`.
93
+ */
94
+ readonly clearStack: (label: string) => string;
95
+ /** The two-step button in the panel's header that clears every notification, shown from two: "Clear all" by default. */
96
+ readonly clearAll: string;
97
+ /** The same button armed, and the polite status then: "Clear 5" by default; `count` is every notification of the list. */
98
+ readonly clearAllConfirm: (count: number) => string;
99
+ }
100
+ /** Styling hooks of the notification center; see `NotificationCenterProps.classNames`. */
101
+ export type NotificationCenterPart = 'center' | 'header' | 'heading' | 'dismiss' | 'list' | 'card' | 'time' | 'clear' | 'empty' | 'group' | 'group-header' | 'group-title' | 'show-less' | 'group-list' | 'edge' | 'more' | 'clear-all' | 'group-clear' | 'stack-clear' | 'icon' | 'title' | 'body' | 'description' | 'actions' | 'action' | 'unread';
102
+ /**
103
+ * The notification center's motion constants: durations in ms at `timeScale: 1`, offsets and blur
104
+ * in CSS px. Reported by the laboratory's tuning panel; see `NotificationCenterMotion.overrides`.
105
+ */
106
+ export interface NotificationCenterMotionConstants {
107
+ /** The drawer's position spring opening. */
108
+ readonly open: CloudletSpring;
109
+ /** The drawer's position spring closing. */
110
+ readonly close: CloudletSpring;
111
+ /** How far past the column's width a closed card lies, in px. */
112
+ readonly travel: number;
113
+ /** The share of the way each next card trails the previous one by (0.12 = 12 %), up to the eighth card. */
114
+ readonly lag: number;
115
+ /** A card arriving in the open center: scale from `scale` on the spring, opacity over `fade` ms. */
116
+ readonly enter: CloudletTimedSpring & {
117
+ readonly scale: number;
118
+ readonly fade: number;
119
+ };
120
+ /** A card leaving the list. */
121
+ readonly exit: CloudletTimedSpring;
122
+ /** The other cards moving to their new places. */
123
+ readonly reflow: CloudletSpring;
124
+ /** The time and the clear button in its place: swap duration and blur radius in px. */
125
+ readonly swap: number;
126
+ readonly swapBlur: number;
127
+ /** Reduced motion: opening, closing and the list change opacity only, for this long. */
128
+ readonly reduced: number;
129
+ /**
130
+ * A group of two notifications or more. Collapsed, up to two edges lie under its top card, each
131
+ * `step` px lower than the one above and narrower by `shrink` of the card's width (0.06 = 6 %, so
132
+ * 0.94 and 0.88). Its cards move between the stack and the list on `expand` and `collapse`; an
133
+ * edge's content shows over `reveal` ms from a `blur` px blur, as the group's heading row and the
134
+ * button under the stack swap; the n-th card of the group starts once the first has covered
135
+ * n × `cascade` of its way (0.06 = 6 % per card, up to the eighth; 0 moves them together).
136
+ */
137
+ readonly stack: {
138
+ readonly expand: CloudletSpring;
139
+ readonly collapse: CloudletSpring;
140
+ readonly step: number;
141
+ readonly shrink: number;
142
+ readonly reveal: number;
143
+ readonly blur: number;
144
+ readonly cascade: number;
145
+ };
146
+ }
147
+ /**
148
+ * The notification center's backdrop constants for `backdrop="blur"`; see
149
+ * `NotificationCenterMotion.overrides`. `layers` is how many blur layers stand under the tone: from
150
+ * the strongest (`--cloudlet-center-blur`, at the edge) each next one, nearer the column's inner
151
+ * side, has half the radius; one layer is a single blur of 0.7 × `--cloudlet-center-blur` fading in
152
+ * from the band's inner edge. Without an override, an Apple engine (`navigator.vendor`) gets one.
153
+ * `scrollTint` shows the tone alone while the page scrolls under the open center: a scroll anywhere
154
+ * in the document but the panel's own list fades the blur layers out over 120 ms, and 150 ms without
155
+ * one fades them back (at once under reduced motion).
156
+ */
157
+ export interface NotificationCenterBackdropConstants {
158
+ /** An integer from 1 to 8; 4 by default. */
159
+ readonly layers: number;
160
+ /** `false` by default. */
161
+ readonly scrollTint: boolean;
162
+ }
163
+ type PartialMotion<T> = {
164
+ readonly [K in keyof T]?: T[K] extends number ? number : PartialMotion<T[K]>;
165
+ };
166
+ /**
167
+ * Partial `NotificationCenterMotionConstants`; nested springs and the stack's fields may be partial
168
+ * too. `backdrop` takes `NotificationCenterBackdropConstants` fields: `layers` an integer from 1 to
169
+ * 8, `scrollTint` a boolean; any other value keeps the default.
170
+ */
171
+ export type NotificationCenterMotionOverrides = PartialMotion<NotificationCenterMotionConstants> & {
172
+ readonly backdrop?: Partial<NotificationCenterBackdropConstants>;
173
+ };
174
+ export interface NotificationCenterMotion {
175
+ /**
176
+ * Debugging and laboratory aid: slows every transition (0.5 = twice as slow).
177
+ * Default 1; a non-finite or nonpositive value falls back to 1. Not recommended in production.
178
+ */
179
+ readonly timeScale?: number;
180
+ /**
181
+ * Debugging and laboratory channel: replaces the motion constants live, for transitions started
182
+ * after the change. A field that is not a finite number in range (stiffness and mass > 0, the rest
183
+ * ≥ 0) keeps its default. Not a styling API: the values may change between releases.
184
+ */
185
+ readonly overrides?: NotificationCenterMotionOverrides;
186
+ }
187
+ /** Whether the center is open, uncontrolled or controlled; for `useNotificationCenter` and the panel. */
188
+ export interface NotificationCenterOpenOptions {
189
+ /** Controls the open state; pair it with `onOpenChange`. */
190
+ readonly open?: boolean | undefined;
191
+ /** The first open state of an uncontrolled center; `false` by default. */
192
+ readonly defaultOpen?: boolean | undefined;
193
+ /** Called with the next state when a trigger, Escape, a press outside, the close button or a swipe asks to open or close. */
194
+ readonly onOpenChange?: ((open: boolean) => void) | undefined;
195
+ }
196
+ export interface NotificationCenterProps extends NotificationCenterOpenOptions {
197
+ /**
198
+ * The center's open state and its triggers, from `useNotificationCenter()`. Without it the panel
199
+ * keeps its own state from `open`, `defaultOpen` and `onOpenChange`, and has no trigger of its own.
200
+ */
201
+ readonly center?: UseNotificationCenterResult;
202
+ /**
203
+ * The app's notifications, in any order (the panel shows the newest first). Give a new array when
204
+ * it changes: the panel animates what arrived, left and moved. Of two with one id the first counts.
205
+ */
206
+ readonly notifications: readonly NotificationItem[];
207
+ /**
208
+ * A card's clear button or a swipe asks to dismiss it. Without it a card has no clear button and
209
+ * does not swipe; with only `onClear`, these call `onClear([id])`.
210
+ */
211
+ readonly onDismiss?: ((id: string) => void) | undefined;
212
+ /**
213
+ * A group's two-step Clear (its ids) or the header's Clear all (every id of the list) asks to clear
214
+ * these notifications. Without it the two-step buttons call `onDismiss` for each id, and with
215
+ * neither callback there are none.
216
+ */
217
+ readonly onClear?: ((ids: readonly string[]) => void) | undefined;
218
+ /** A press of one of a notification's `actions`. The card stays: the app removes it if it wants. */
219
+ readonly onAction?: ((id: string, actionId: string) => void) | undefined;
220
+ /**
221
+ * Unread notifications (`read: false`) the person has seen: those listed when the panel opens and
222
+ * those that arrive while it is open (on a visible page), each id once per opening.
223
+ */
224
+ readonly onRead?: ((ids: readonly string[]) => void) | undefined;
225
+ /** Draws a card's content from the default parts; the center keeps its frame, motion and swipe. */
226
+ readonly renderNotification?: ((item: NotificationItem, parts: NotificationParts) => ReactNode) | undefined;
227
+ /** Physical: the panel stays at that edge in RTL too. Default `right`. */
228
+ readonly side?: 'left' | 'right';
229
+ readonly theme?: 'system' | 'light' | 'dark';
230
+ readonly dir?: 'ltr' | 'rtl';
231
+ readonly labels?: Partial<NotificationCenterLabels>;
232
+ /** Extra classes per part, added to the own `cloudlet-*` classes (never replacing them). */
233
+ readonly classNames?: Partial<Record<NotificationCenterPart, string>>;
234
+ /**
235
+ * What lies under the panel's column and a band past it, at its edge: `blur` (the default: the
236
+ * page blurred progressively, strongest at the edge, under a tone of `--cloudlet-center-blur-tint`;
237
+ * one blur layer in Safari and other Apple engines; the tone of `tint` in a window narrower than
238
+ * 48rem and where `backdrop-filter` is unsupported), `tint` (a tone, `--cloudlet-center-tint` of
239
+ * `--cloudlet-background`, even under the column and fading out across the band) or `none` (nothing: the panel's header and
240
+ * empty line then stand on the page, whose contrast is the app's). Any other value is `blur`.
241
+ * Reduced transparency draws the tone of `tint` in place of `blur`: `data-reduced-transparency` on
242
+ * an ancestor of the panel (it is portalled into the body, so on `<body>` or `<html>`; by presence,
243
+ * live) and the system's `prefers-reduced-transparency: reduce`; an app cannot turn the blur on
244
+ * against the system. The panel's root says the app's result in `data-backdrop` (`tint` under the
245
+ * attribute; the system's setting is CSS and stays out of it), and with `blur` how many blur layers
246
+ * it has in `data-backdrop-layers`. Read on every render.
247
+ */
248
+ readonly backdrop?: 'blur' | 'tint' | 'none';
249
+ /** Read on every render. */
250
+ readonly motion?: NotificationCenterMotion;
251
+ /**
252
+ * The app's own reduced-motion setting. `true` removes motion whatever the system says; `false`
253
+ * and omitting it follow the system and `data-reduced-motion` on an ancestor of the panel (it is
254
+ * portalled into the body, so on `<body>` or `<html>`; the attribute counts by presence). An app
255
+ * cannot turn motion on against the system's `prefers-reduced-motion: reduce`. Read on every render.
256
+ */
257
+ readonly reducedMotion?: boolean;
258
+ /** The nonce of the panel's own `<style>`, whose CSSOM rules carry its motion under a strict CSP. Read when the panel opens. */
259
+ readonly nonce?: string;
260
+ }
261
+ /**
262
+ * Spread on the app's own button: it opens and closes the center. A center takes as many buttons
263
+ * as these props are spread on; focus returns to the one that opened it.
264
+ */
265
+ export interface NotificationCenterTriggerProps {
266
+ /** Returns a cleanup for the element under React 19 and later, which call it in place of `null`. */
267
+ readonly ref: (element: HTMLElement | null) => (() => void) | undefined;
268
+ readonly 'aria-expanded': boolean;
269
+ /** The panel's id while it is open. */
270
+ readonly 'aria-controls': string | undefined;
271
+ readonly 'aria-haspopup': 'dialog';
272
+ readonly onClick: (event?: {
273
+ readonly currentTarget: EventTarget | null;
274
+ }) => void;
275
+ }
276
+ export interface UseNotificationCenterResult {
277
+ readonly open: boolean;
278
+ /** Opens or closes the center, as the app; a controlled center asks through `onOpenChange`. The same function every render. */
279
+ readonly setOpen: (open: boolean) => void;
280
+ readonly triggerProps: NotificationCenterTriggerProps;
281
+ }
282
+ /** Public component and hook signatures. */
283
+ export type NotificationCenterComponent = (props: NotificationCenterProps) => ReactElement | null;
284
+ export type UseNotificationCenter = (options?: NotificationCenterOpenOptions) => UseNotificationCenterResult;
285
+ export { NotificationCenter, useNotificationCenter } from './react/center.js';
286
+ //# sourceMappingURL=center-react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"center-react.d.ts","sourceRoot":"","sources":["../src/center-react.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKtE,gFAAgF;AAChF,MAAM,WAAW,sBAAsB;IACrC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;G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AO,CAAC,EAAE,6BAA6B,KAAK,2BAA2B,CAAC;AAE7G,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { NotificationCenter, useNotificationCenter } from "./react/center.js";
@@ -0,0 +1,3 @@
1
+ export { NotificationCenter, useNotificationCenter } from './center-react.js';
2
+ export type { NotificationCenterBackdropConstants, NotificationCenterComponent, NotificationCenterLabels, NotificationCenterMotion, NotificationCenterMotionConstants, NotificationCenterMotionOverrides, NotificationCenterOpenOptions, NotificationCenterPart, NotificationCenterProps, NotificationCenterTriggerProps, NotificationItem, NotificationItemAction, NotificationParts, UseNotificationCenter, UseNotificationCenterResult, } from './center-react.js';
3
+ //# sourceMappingURL=center.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"center.d.ts","sourceRoot":"","sources":["../src/center.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,YAAY,EACV,mCAAmC,EACnC,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,iCAAiC,EACjC,iCAAiC,EACjC,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC"}
package/dist/center.js ADDED
@@ -0,0 +1 @@
1
+ export { NotificationCenter, useNotificationCenter } from "./center-react.js";
@@ -79,6 +79,8 @@ export interface ToasterPort<Slot> {
79
79
  * events themselves only after its state listeners.
80
80
  */
81
81
  readonly subscribe: (listener: (commit: PortCommit<Slot>) => void) => () => void;
82
+ /** Hands an error of the reader's own listeners to the controller's diagnostics, one each. */
83
+ readonly report: (error: unknown) => void;
82
84
  /** Opens the Island on the top notification, unless a person is busy with the Toaster. */
83
85
  readonly open: () => Changed | Rejection<'disposed' | 'no-host' | 'empty' | 'busy'>;
84
86
  /** Collapses the Island, unless it holds a draft. */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-port.d.ts","sourceRoot":"","sources":["../../src/core/agent-port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAiE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAoB,MAAM,iBAAiB,CAAC;AAUvJ,+GAA+G;AAC/G,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC9C,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;CAC9D;AAED,yGAAyG;AACzG,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI;IAC9B,QAAQ,C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MAAM,KAClE,OAAO,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,GAAG,eAAe,GAAG,iBAAiB,GAAG,UAAU,GAAG,cAAc,CAAC,CAAC;IACvH;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,KACpF,OAAO,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,GAAG,YAAY,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC;CACnG;AAID,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CA2E7E"}
@@ -38,6 +38,9 @@ function s(i) {
38
38
  closedBy: t.closedBy
39
39
  });
40
40
  }),
41
+ report: (e) => {
42
+ o.failure("listener-error", "subscribe", e);
43
+ },
41
44
  open() {
42
45
  if (o.disposed) return n("disposed");
43
46
  if (o.lease === null) return n("no-host");
@@ -1 +1 @@
1
- {"version":3,"file":"agent-port.js","names":["freeze","STRICTNESS","createToasterPort","k","getControllerKernel","controller","source","mounted","reading","read","next","lease","forms","form","filled","name","withRecord","commit","listener","delivery","reject","record","UNCHANGED","handle","result","fillFormValue","value","press","grant","signal","action","settled","token","finish","stopState","stopEvents","abort","resolve","outcome","event","state","started","invokeAction"],"sources":["../../src/core/agent-port.ts"],"sourcesContent":["import type { ChangeSource } from '../contracts/events.js';\nimport type { NotificationHandle } from '../contracts/identity.js';\nimport type { FormErrors, RendererSnapshot } from '../contracts/internal.js';\nimport type { CancellationSignal, CancelResult } from '../contracts/operations.js';\nimport type { ControllerSnapshot } from '../contracts/snapshots.js';\nimport { fillFormValue, invokeAction } from './actions.js';\nimport { UNCHANGED, getControllerKernel, reject, type ControllerKernel, type EventPayload, type FieldAuthor, type RecordState } from './controller.js';\n\n// The agent adapter's way into a controller. Only the `agent` entry imports it, so the root entry\n// and the renderer chunk never carry it. It hands out no lease: a step that needs a screen only\n// checks that a `Toaster` holds one, and no step asks for focus. Form values reach the adapter only\n// as \"holds text\" and who wrote them: `forms` is reduced here, and `controller` is typed as the\n// public snapshot, although at runtime it is the renderer's object with its form drafts.\n\nconst freeze = Object.freeze;\n\n/** What a reader may know about a form: which fields hold text, who wrote them, the last submit's messages. */\nexport interface FormReading {\n /** Names of the fields whose value has non-blank text, the same test `required` uses. */\n readonly filled: ReadonlySet<string>;\n /** Who wrote each field last; a field nobody wrote and without a default is missing. */\n readonly authors: ReadonlyMap<string, FieldAuthor>;\n readonly errors: FormErrors;\n}\n\nexport interface ToasterReading<Slot> {\n readonly controller: ControllerSnapshot<Slot>;\n /** A `Toaster` holds the controller's host lease. */\n readonly mounted: boolean;\n /** A person is on the Toaster: hover, focus, a gesture, or a draft in the open Island. */\n readonly busy: boolean;\n /** One entry per record with a form action. */\n readonly forms: ReadonlyMap<NotificationHandle, FormReading>;\n}\n\n/** An event as the commit queued it: its type, source and fields, before it is stamped and delivered. */\nexport type PortEvent = EventPayload;\n\n/**\n * One committed change: its events and the state it left. A listener of an earlier commit may have\n * committed again, so `read()` can be ahead of this state.\n */\nexport interface PortCommit<Slot> {\n readonly events: readonly PortEvent[];\n readonly controller: ControllerSnapshot<Slot>;\n /** Who wrote each field of each form last; never a value. */\n readonly authors: ReadonlyMap<NotificationHandle, ReadonlyMap<string, FieldAuthor>>;\n /** Who closed the Island last; null before the first close. */\n readonly closedBy: ChangeSource | null;\n}\n\n/** The grant a step was approved under; a marker stricter than it stops the step. */\nexport type StepGrant = 'allow' | 'confirm';\n\ntype Rejection<Reason extends string> = { readonly status: 'rejected'; readonly reason: Reason };\ntype HandleReason = 'disposed' | 'invalid-handle' | 'foreign-controller' | 'stale-handle';\ntype Changed = { readonly status: 'applied' | 'unchanged' };\n\n/** How a pressed command or a submitted form ended, as far as the step waited for it. */\nexport type PressOutcome =\n /** The action succeeded and closed its notification. */\n | { readonly status: 'done' }\n /** The action failed; `message` is what the person sees. */\n | { readonly status: 'failed'; readonly message: string }\n /** The form did not pass its checks and was not sent; the person sees the same messages. */\n | { readonly status: 'invalid'; readonly errors: FormErrors }\n /** The form's `validate` replaced the action it was checking; neither ran. */\n | { readonly status: 'replaced' }\n /** The step stopped waiting: the notification closed otherwise, the action was replaced, or the signal ended the wait. */\n | { readonly status: 'pending'; readonly gone: boolean };\n\nexport interface ToasterPort<Slot> {\n /** The same object until the controller publishes again. */\n readonly read: () => ToasterReading<Slot>;\n /**\n * Calls `listener` after every committed change with that commit's events and state, so a reader\n * learns what happened and who did it together with the new state. The controller delivers the\n * events themselves only after its state listeners.\n */\n readonly subscribe: (listener: (commit: PortCommit<Slot>) => void) => () => void;\n /** Opens the Island on the top notification, unless a person is busy with the Toaster. */\n readonly open: () => Changed | Rejection<'disposed' | 'no-host' | 'empty' | 'busy'>;\n /** Collapses the Island, unless it holds a draft. */\n readonly close: () => Changed | Rejection<'disposed' | 'busy'>;\n /** Opens the Island on the notification or moves the open one to it, unless a person is busy. */\n readonly show: (handle: NotificationHandle) => Changed | Rejection<HandleReason | 'no-host' | 'busy'>;\n /**\n * Brings the notification in front of the person for a step only they may take: opens the Island\n * on it now, or once they stop interacting (`waiting`). Never moves focus.\n */\n readonly summon: (handle: NotificationHandle) => { readonly status: 'shown' | 'waiting' | 'unchanged' } | Rejection<HandleReason | 'no-host'>;\n readonly dismiss: (handle: NotificationHandle) => Changed | Rejection<HandleReason>;\n readonly clear: () => { readonly status: 'cleared'; readonly count: number } | Rejection<'disposed'>;\n readonly acknowledge: () => Changed | Rejection<'disposed'>;\n readonly cancel: (handle: NotificationHandle) => CancelResult | Rejection<HandleReason | 'no-operation'>;\n readonly retry: (handle: NotificationHandle) => { readonly status: 'started' } | Rejection<HandleReason | 'no-operation' | 'not-retryable' | 'already-pending'>;\n /** Writes a form field as an agent, never over what the person typed. */\n readonly fill: (handle: NotificationHandle, name: string, value: string)\n => Changed | Rejection<HandleReason | 'no-form' | 'invalid-input' | 'already-pending' | 'too-long' | 'person-typed'>;\n /**\n * Starts the command or submits the form, and waits until it settles, its notification closes or\n * `signal` aborts.\n */\n readonly press: (handle: NotificationHandle, grant: StepGrant, signal: CancellationSignal)\n => Promise<PressOutcome> | Rejection<HandleReason | 'no-command' | 'already-pending' | 'stale'>;\n}\n\nconst STRICTNESS = { allow: 0, confirm: 1, deny: 2 } as const;\n\n/** Throws a TypeError for a controller this package instance did not create. */\nexport function createToasterPort<Slot>(controller: object): ToasterPort<Slot> {\n const k = getControllerKernel<Slot>(controller);\n let source: RendererSnapshot<Slot> | undefined;\n let mounted = false;\n let reading: ToasterReading<Slot> | undefined;\n\n const read = (): ToasterReading<Slot> => {\n // Every change of the lease or of what `interacting` reads publishes a new renderer snapshot.\n const next = k.rendererSnapshot;\n const lease = k.lease !== null;\n if (reading && next === source && lease === mounted) return reading;\n source = next;\n mounted = lease;\n const forms = new Map<NotificationHandle, FormReading>();\n for (const form of next.forms) {\n const filled = new Set(Object.keys(form.values).filter((name) => form.values[name]!.trim() !== ''));\n forms.set(form.handle, freeze({ filled, authors: new Map(Object.entries(form.authors)), errors: form.errors }));\n }\n reading = freeze({ controller: next, mounted, busy: k.interacting(), forms });\n return reading;\n };\n\n const withRecord = k.withRecord;\n\n return freeze<ToasterPort<Slot>>({\n read,\n subscribe: (listener) => k.subscribe(() => {\n const commit = k.announced;\n if (!commit) return;\n listener({\n events: commit.deliveries.filter((delivery): delivery is PortEvent => !('callback' in delivery)),\n controller: commit.snapshot,\n authors: new Map(commit.snapshot.forms.map((form) => [form.handle, new Map(Object.entries(form.authors))])),\n closedBy: commit.closedBy,\n });\n }),\n open() {\n if (k.disposed) return reject('disposed');\n if (k.lease === null) return reject('no-host');\n const record = k.newest();\n if (!record) return reject('empty');\n if (k.island) return UNCHANGED;\n if (k.interacting()) return reject('busy');\n return k.mutate(() => { k.island = { reason: 'attention', current: record, source: 'agent' }; });\n },\n close() {\n if (k.disposed) return reject('disposed');\n if (!k.island) return UNCHANGED;\n // A person's Escape collapses an Island with a draft; an agent is not that person.\n if (k.dirty(k.island.current)) return reject('busy');\n return k.mutate(() => { k.collapse('agent'); });\n },\n show: withRecord((record) => {\n if (k.lease === null) return reject('no-host');\n if (k.island?.current === record) return UNCHANGED;\n if (k.interacting()) return reject('busy');\n // Showing is navigation, as in the renderer: reaching the pending auto-open's record fulfils\n // it, and any other pending auto-open restarts its delay.\n return k.mutate(() => k.reach(record, 'agent'));\n }),\n summon: withRecord((record) => k.lease === null ? reject('no-host') : freeze({ status: k.summon(record) })),\n dismiss: (handle) => k.dismiss(handle, 'programmatic', 'agent'),\n clear: () => k.clear('clear', 'agent'),\n acknowledge: () => k.acknowledgeOverflow('agent'),\n // The current attempt's own capability: no token leaves the port.\n cancel: withRecord((record) => record.operation ? record.operation.cancel(undefined, 'agent') : reject('no-operation')),\n retry: withRecord((record) => {\n if (!record.operation) return reject('no-operation');\n const result = record.operation.retry('agent');\n return result.status === 'started' ? freeze({ status: 'started' as const }) : reject(result.reason);\n }),\n fill: withRecord((record, name: string, value: string) => fillFormValue(k, record, name, value)),\n press: withRecord((record, grant: StepGrant, signal: CancellationSignal) => press(k, record, grant, signal)),\n });\n}\n\nfunction press<Slot>(k: ControllerKernel<Slot>, record: RecordState<Slot>, grant: StepGrant, signal: CancellationSignal) {\n const action = record.content.action;\n if (!action || action.kind === 'link') return reject('no-command');\n // The marker is read from the record's content right before the action runs: one the app made\n // stricter after the step was approved stops it.\n if (STRICTNESS[action.agent ?? 'confirm'] > STRICTNESS[grant]) return reject('stale');\n if (record.action.status === 'pending') return reject('already-pending');\n // A wait that has already ended starts nothing.\n if (signal.aborted) return Promise.resolve<PressOutcome>(freeze({ status: 'pending', gone: false }));\n const handle = record.handle;\n return new Promise<PressOutcome>((resolve) => {\n let settled = false;\n let token: string | undefined;\n const finish = (outcome: PressOutcome): void => {\n if (settled) return;\n settled = true;\n stopState();\n stopEvents();\n signal.removeEventListener('abort', abort);\n resolve(freeze(outcome));\n };\n const abort = (): void => { finish({ status: 'pending', gone: k.records.get(handle.id) !== record }); };\n // Only the closing event says why the notification closed; state listeners run before it.\n const stopEvents = k.onEvent((event) => {\n if (event.type === 'closed' && event.handle === handle) {\n finish(event.reason === 'action-success' ? { status: 'done' } : { status: 'pending', gone: true });\n }\n });\n const stopState = k.subscribe(() => {\n if (token === undefined || k.records.get(handle.id) !== record) return;\n const state = record.action;\n if (state.status === 'failed' && state.token === token) finish({ status: 'failed', message: state.message });\n else if (state.status === 'idle' || state.token !== token) finish({ status: 'pending', gone: false });\n });\n signal.addEventListener('abort', abort, { once: true });\n // Listeners first: the command may close or replace its notification synchronously.\n const started = invokeAction(k, record, 'agent');\n if (started.status === 'invalid') { finish({ status: 'invalid', errors: started.errors }); return; }\n if (started.status !== 'started') {\n finish(started.reason === 'action-replaced' ? { status: 'replaced' } : { status: 'pending', gone: k.records.get(handle.id) !== record });\n return;\n }\n if (settled) return;\n // This press's own attempt: a listener of `action-started` may already have begun another one.\n token = started.token;\n const state = record.action;\n if (state.status === 'failed' && state.token === token) finish({ status: 'failed', message: state.message });\n else if (state.status === 'idle' || state.token !== token) finish({ status: 'pending', gone: false });\n else if (signal.aborted) abort();\n });\n}\n"],"mappings":";;;AAcA,IAAMA,IAAS,OAAO,QA6FhBC,IAAa;CAAE,OAAO;CAAG,SAAS;CAAG,MAAM;AAAE;AAGnD,SAAgBC,EAAwB,GAAuC;CAC7E,IAAMC,IAAIC,EAA0BC,CAAU,GAC1CC,GACAC,IAAU,IACVC,GAEEC,UAAmC;EAEvC,IAAMC,IAAOP,EAAE,kBACTQ,IAAQR,EAAE,UAAU;EAC1B,IAAIK,KAAWE,MAASJ,KAAUK,MAAUJ,GAAS,OAAOC;EAE5D,AADA,IAASE,GACT,IAAUC;EACV,IAAMC,oBAAQ,IAAI,IAAqC;EACvD,KAAK,IAAMC,KAAQH,EAAK,OAAO;GAC7B,IAAMI,IAAS,IAAI,IAAI,OAAO,KAAKD,EAAK,MAAM,CAAC,CAAC,QAAQ,MA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W,WAAW;GAChC,EAAOA,EAAQ,WAAW,oBAAoB,EAAE,QAAQ,WAAW,IAAI;IAAE,QAAQ;IAAW,MAAMtC,EAAE,QAAQ,IAAIoB,EAAO,EAAE,MAAMF;GAAO,CAAC;GACvI;EACF;EACA,IAAIU,GAAS;EAEb,IAAQU,EAAQ;EAChB,IAAMD,IAAQnB,EAAO;EACrB,AAAImB,EAAM,WAAW,YAAYA,EAAM,UAAUR,IAAOC,EAAO;GAAE,QAAQ;GAAU,SAASO,EAAM;EAAQ,CAAC,IAClGA,EAAM,WAAW,UAAUA,EAAM,UAAUR,IAAOC,EAAO;GAAE,QAAQ;GAAW,MAAM;EAAM,CAAC,IAC3FJ,EAAO,WAASO,EAAM;CACjC,CAAC;AACH"}
1
+ {"version":3,"file":"agent-port.js","names":["freeze","STRICTNESS","createToasterPort","k","getControllerKernel","controller","source","mounted","reading","read","next","lease","forms","form","filled","name","withRecord","commit","listener","delivery","error","reject","record","UNCHANGED","handle","result","fillFormValue","value","press","grant","signal","action","settled","token","finish","stopState","stopEvents","abort","resolve","outcome","event","state","started","invokeAction"],"sources":["../../src/core/agent-port.ts"],"sourcesContent":["import type { ChangeSource } from '../contracts/events.js';\nimport type { NotificationHandle } from '../contracts/identity.js';\nimport type { FormErrors, RendererSnapshot } from '../contracts/internal.js';\nimport type { CancellationSignal, CancelResult } from '../contracts/operations.js';\nimport type { ControllerSnapshot } from '../contracts/snapshots.js';\nimport { fillFormValue, invokeAction } from './actions.js';\nimport { UNCHANGED, getControllerKernel, reject, type ControllerKernel, type EventPayload, type FieldAuthor, type RecordState } from './controller.js';\n\n// The agent adapter's way into a controller. Only the `agent` entry imports it, so the root entry\n// and the renderer chunk never carry it. It hands out no lease: a step that needs a screen only\n// checks that a `Toaster` holds one, and no step asks for focus. Form values reach the adapter only\n// as \"holds text\" and who wrote them: `forms` is reduced here, and `controller` is typed as the\n// public snapshot, although at runtime it is the renderer's object with its form drafts.\n\nconst freeze = Object.freeze;\n\n/** What a reader may know about a form: which fields hold text, who wrote them, the last submit's messages. */\nexport interface FormReading {\n /** Names of the fields whose value has non-blank text, the same test `required` uses. */\n readonly filled: ReadonlySet<string>;\n /** Who wrote each field last; a field nobody wrote and without a default is missing. */\n readonly authors: ReadonlyMap<string, FieldAuthor>;\n readonly errors: FormErrors;\n}\n\nexport interface ToasterReading<Slot> {\n readonly controller: ControllerSnapshot<Slot>;\n /** A `Toaster` holds the controller's host lease. */\n readonly mounted: boolean;\n /** A person is on the Toaster: hover, focus, a gesture, or a draft in the open Island. */\n readonly busy: boolean;\n /** One entry per record with a form action. */\n readonly forms: ReadonlyMap<NotificationHandle, FormReading>;\n}\n\n/** An event as the commit queued it: its type, source and fields, before it is stamped and delivered. */\nexport type PortEvent = EventPayload;\n\n/**\n * One committed change: its events and the state it left. A listener of an earlier commit may have\n * committed again, so `read()` can be ahead of this state.\n */\nexport interface PortCommit<Slot> {\n readonly events: readonly PortEvent[];\n readonly controller: ControllerSnapshot<Slot>;\n /** Who wrote each field of each form last; never a value. */\n readonly authors: ReadonlyMap<NotificationHandle, ReadonlyMap<string, FieldAuthor>>;\n /** Who closed the Island last; null before the first close. */\n readonly closedBy: ChangeSource | null;\n}\n\n/** The grant a step was approved under; a marker stricter than it stops the step. */\nexport type StepGrant = 'allow' | 'confirm';\n\ntype Rejection<Reason extends string> = { readonly status: 'rejected'; readonly reason: Reason };\ntype HandleReason = 'disposed' | 'invalid-handle' | 'foreign-controller' | 'stale-handle';\ntype Changed = { readonly status: 'applied' | 'unchanged' };\n\n/** How a pressed command or a submitted form ended, as far as the step waited for it. */\nexport type PressOutcome =\n /** The action succeeded and closed its notification. */\n | { readonly status: 'done' }\n /** The action failed; `message` is what the person sees. */\n | { readonly status: 'failed'; readonly message: string }\n /** The form did not pass its checks and was not sent; the person sees the same messages. */\n | { readonly status: 'invalid'; readonly errors: FormErrors }\n /** The form's `validate` replaced the action it was checking; neither ran. */\n | { readonly status: 'replaced' }\n /** The step stopped waiting: the notification closed otherwise, the action was replaced, or the signal ended the wait. */\n | { readonly status: 'pending'; readonly gone: boolean };\n\nexport interface ToasterPort<Slot> {\n /** The same object until the controller publishes again. */\n readonly read: () => ToasterReading<Slot>;\n /**\n * Calls `listener` after every committed change with that commit's events and state, so a reader\n * learns what happened and who did it together with the new state. The controller delivers the\n * events themselves only after its state listeners.\n */\n readonly subscribe: (listener: (commit: PortCommit<Slot>) => void) => () => void;\n /** Hands an error of the reader's own listeners to the controller's diagnostics, one each. */\n readonly report: (error: unknown) => void;\n /** Opens the Island on the top notification, unless a person is busy with the Toaster. */\n readonly open: () => Changed | Rejection<'disposed' | 'no-host' | 'empty' | 'busy'>;\n /** Collapses the Island, unless it holds a draft. */\n readonly close: () => Changed | Rejection<'disposed' | 'busy'>;\n /** Opens the Island on the notification or moves the open one to it, unless a person is busy. */\n readonly show: (handle: NotificationHandle) => Changed | Rejection<HandleReason | 'no-host' | 'busy'>;\n /**\n * Brings the notification in front of the person for a step only they may take: opens the Island\n * on it now, or once they stop interacting (`waiting`). Never moves focus.\n */\n readonly summon: (handle: NotificationHandle) => { readonly status: 'shown' | 'waiting' | 'unchanged' } | Rejection<HandleReason | 'no-host'>;\n readonly dismiss: (handle: NotificationHandle) => Changed | Rejection<HandleReason>;\n readonly clear: () => { readonly status: 'cleared'; readonly count: number } | Rejection<'disposed'>;\n readonly acknowledge: () => Changed | Rejection<'disposed'>;\n readonly cancel: (handle: NotificationHandle) => CancelResult | Rejection<HandleReason | 'no-operation'>;\n readonly retry: (handle: NotificationHandle) => { readonly status: 'started' } | Rejection<HandleReason | 'no-operation' | 'not-retryable' | 'already-pending'>;\n /** Writes a form field as an agent, never over what the person typed. */\n readonly fill: (handle: NotificationHandle, name: string, value: string)\n => Changed | Rejection<HandleReason | 'no-form' | 'invalid-input' | 'already-pending' | 'too-long' | 'person-typed'>;\n /**\n * Starts the command or submits the form, and waits until it settles, its notification closes or\n * `signal` aborts.\n */\n readonly press: (handle: NotificationHandle, grant: StepGrant, signal: CancellationSignal)\n => Promise<PressOutcome> | Rejection<HandleReason | 'no-command' | 'already-pending' | 'stale'>;\n}\n\nconst STRICTNESS = { allow: 0, confirm: 1, deny: 2 } as const;\n\n/** Throws a TypeError for a controller this package instance did not create. */\nexport function createToasterPort<Slot>(controller: object): ToasterPort<Slot> {\n const k = getControllerKernel<Slot>(controller);\n let source: RendererSnapshot<Slot> | undefined;\n let mounted = false;\n let reading: ToasterReading<Slot> | undefined;\n\n const read = (): ToasterReading<Slot> => {\n // Every change of the lease or of what `interacting` reads publishes a new renderer snapshot.\n const next = k.rendererSnapshot;\n const lease = k.lease !== null;\n if (reading && next === source && lease === mounted) return reading;\n source = next;\n mounted = lease;\n const forms = new Map<NotificationHandle, FormReading>();\n for (const form of next.forms) {\n const filled = new Set(Object.keys(form.values).filter((name) => form.values[name]!.trim() !== ''));\n forms.set(form.handle, freeze({ filled, authors: new Map(Object.entries(form.authors)), errors: form.errors }));\n }\n reading = freeze({ controller: next, mounted, busy: k.interacting(), forms });\n return reading;\n };\n\n const withRecord = k.withRecord;\n\n return freeze<ToasterPort<Slot>>({\n read,\n subscribe: (listener) => k.subscribe(() => {\n const commit = k.announced;\n if (!commit) return;\n listener({\n events: commit.deliveries.filter((delivery): delivery is PortEvent => !('callback' in delivery)),\n controller: commit.snapshot,\n authors: new Map(commit.snapshot.forms.map((form) => [form.handle, new Map(Object.entries(form.authors))])),\n closedBy: commit.closedBy,\n });\n }),\n report: (error) => { k.failure('listener-error', 'subscribe', error); },\n open() {\n if (k.disposed) return reject('disposed');\n if (k.lease === null) return reject('no-host');\n const record = k.newest();\n if (!record) return reject('empty');\n if (k.island) return UNCHANGED;\n if (k.interacting()) return reject('busy');\n return k.mutate(() => { k.island = { reason: 'attention', current: record, source: 'agent' }; });\n },\n close() {\n if (k.disposed) return reject('disposed');\n if (!k.island) return UNCHANGED;\n // A person's Escape collapses an Island with a draft; an agent is not that person.\n if (k.dirty(k.island.current)) return reject('busy');\n return k.mutate(() => { k.collapse('agent'); });\n },\n show: withRecord((record) => {\n if (k.lease === null) return reject('no-host');\n if (k.island?.current === record) return UNCHANGED;\n if (k.interacting()) return reject('busy');\n // Showing is navigation, as in the renderer: reaching the pending auto-open's record fulfils\n // it, and any other pending auto-open restarts its delay.\n return k.mutate(() => k.reach(record, 'agent'));\n }),\n summon: withRecord((record) => k.lease === null ? reject('no-host') : freeze({ status: k.summon(record) })),\n dismiss: (handle) => k.dismiss(handle, 'programmatic', 'agent'),\n clear: () => k.clear('clear', 'agent'),\n acknowledge: () => k.acknowledgeOverflow('agent'),\n // The current attempt's own capability: no token leaves the port.\n cancel: withRecord((record) => record.operation ? record.operation.cancel(undefined, 'agent') : reject('no-operation')),\n retry: withRecord((record) => {\n if (!record.operation) return reject('no-operation');\n const result = record.operation.retry('agent');\n return result.status === 'started' ? freeze({ status: 'started' as const }) : reject(result.reason);\n }),\n fill: withRecord((record, name: string, value: string) => fillFormValue(k, record, name, value)),\n press: withRecord((record, grant: StepGrant, signal: CancellationSignal) => press(k, record, grant, signal)),\n });\n}\n\nfunction press<Slot>(k: ControllerKernel<Slot>, record: RecordState<Slot>, grant: StepGrant, signal: CancellationSignal) {\n const action = record.content.action;\n if (!action || action.kind === 'link') return reject('no-command');\n // The marker is read from the record's content right before the action runs: one the app made\n // stricter after the step was approved stops it.\n if (STRICTNESS[action.agent ?? 'confirm'] > STRICTNESS[grant]) return reject('stale');\n if (record.action.status === 'pending') return reject('already-pending');\n // A wait that has already ended starts nothing.\n if (signal.aborted) return Promise.resolve<PressOutcome>(freeze({ status: 'pending', gone: false }));\n const handle = record.handle;\n return new Promise<PressOutcome>((resolve) => {\n let settled = false;\n let token: string | undefined;\n const finish = (outcome: PressOutcome): void => {\n if (settled) return;\n settled = true;\n stopState();\n stopEvents();\n signal.removeEventListener('abort', abort);\n resolve(freeze(outcome));\n };\n const abort = (): void => { finish({ status: 'pending', gone: k.records.get(handle.id) !== record }); };\n // Only the closing event says why the notification closed; state listeners run before it.\n const stopEvents = k.onEvent((event) => {\n if (event.type === 'closed' && event.handle === handle) {\n finish(event.reason === 'action-success' ? { status: 'done' } : { status: 'pending', gone: true });\n }\n });\n const stopState = k.subscribe(() => {\n if (token === undefined || k.records.get(handle.id) !== record) return;\n const state = record.action;\n if (state.status === 'failed' && state.token === token) finish({ status: 'failed', message: state.message });\n else if (state.status === 'idle' || state.token !== token) finish({ status: 'pending', gone: false });\n });\n signal.addEventListener('abort', abort, { once: true });\n // Listeners first: the command may close or replace its notification synchronously.\n const started = invokeAction(k, record, 'agent');\n if (started.status === 'invalid') { finish({ status: 'invalid', errors: started.errors }); return; }\n if (started.status !== 'started') {\n finish(started.reason === 'action-replaced' ? { status: 'replaced' } : { status: 'pending', gone: k.records.get(handle.id) !== record });\n return;\n }\n if (settled) return;\n // This press's own attempt: a listener of `action-started` may already have begun another one.\n token = started.token;\n const state = record.action;\n if (state.status === 'failed' && state.token === token) finish({ status: 'failed', message: state.message });\n else if (state.status === 'idle' || state.token !== token) finish({ status: 'pending', gone: false });\n else if (signal.aborted) abort();\n });\n}\n"],"mappings":";;;AAcA,IAAMA,IAAS,OAAO,QA+FhBC,IAAa;CAAE,OAAO;CAAG,SAAS;CAAG,MAAM;AAAE;AAGnD,SAAgBC,EAAwB,GAAuC;CAC7E,IAAMC,IAAIC,EAA0BC,CAAU,GAC1CC,GACAC,IAAU,IACVC,GAEEC,UAAmC;EAEvC,IAAMC,IAAOP,EAAE,kBACTQ,IAAQR,EAAE,UAAU;EAC1B,IAAIK,KAAWE,MAASJ,KAAUK,MAAUJ,GAAS,OAAOC;EAE5D,AADA,IAASE,GACT,IAAUC;EACV,IAAMC,oBAAQ,IAAI,IAAqC;EACvD,KAAK,IAAMC,KAAQH,EAAK,OAAO;GAC7B,IAAMI,IAAS,IAAI,IAAI,OAAO,KAAKD,EAAK,MAAM,CAAC,CAAC,QAAQ,MAASA,EAAK,OAAOE,EAAK,CAAE,KAAK,MAAM,EAAE,CAAC;GAClG,EAAM,IAAIF,EAAK,QAAQb,EAA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AAQ,WAAW,oBAAoB,EAAE,QAAQ,WAAW,IAAI;IAAE,QAAQ;IAAW,MAAMvC,EAAE,QAAQ,IAAIqB,EAAO,EAAE,MAAMF;GAAO,CAAC;GACvI;EACF;EACA,IAAIU,GAAS;EAEb,IAAQU,EAAQ;EAChB,IAAMD,IAAQnB,EAAO;EACrB,AAAImB,EAAM,WAAW,YAAYA,EAAM,UAAUR,IAAOC,EAAO;GAAE,QAAQ;GAAU,SAASO,EAAM;EAAQ,CAAC,IAClGA,EAAM,WAAW,UAAUA,EAAM,UAAUR,IAAOC,EAAO;GAAE,QAAQ;GAAW,MAAM;EAAM,CAAC,IAC3FJ,EAAO,WAASO,EAAM;CACjC,CAAC;AACH"}
@@ -1,12 +1,16 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { FormDraft, HostLease, RendererBridge } from '../contracts/internal.js';
3
3
  import type { NotificationHandle } from '../contracts/identity.js';
4
+ import type { NotificationKind } from '../contracts/notifications.js';
4
5
  import type { NotificationSnapshot } from '../contracts/snapshots.js';
5
6
  import type { CloudletLabels, CloudletPart, ToasterProps } from '../react.js';
6
7
  export declare const defaultLabels: CloudletLabels;
8
+ export declare function glyph(path: string): import("react").JSX.Element;
7
9
  /** Adds the application's `classNames` part to an own `cloudlet-*` class, never replacing it. */
8
10
  export type PartClass = (part: CloudletPart, own: string) => string;
9
11
  export declare function partClasses(classNames: ToasterProps['classNames']): PartClass;
12
+ /** 16 px stroke glyphs drawn in the status colour. */
13
+ export declare const glyphs: Record<Exclude<NotificationKind, 'loading'>, string>;
10
14
  /**
11
15
  * The status icon: a 24 px tinted circle with a glyph, the loading spinner or the
12
16
  * notification's own icon, and the 2 px progress ring around it (pill and Island
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/react/card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA8D,SAAS,EAAE,MAAM,OAAO,CAAC;AACnG,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,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228
  y(i) && l(t.retry),
229
- i?.canCancel && l(i.cancelRequested ? t.cancellationRequested : t.cancel)
229
+ i?.canCancel && l(t.cancel)
230
230
  ]
231
231
  }),
232
232
  e.action.status === "failed" && /* @__PURE__ */ o("p", {
@@ -285,12 +285,7 @@ function x({ notification: e, form: t, bridge: n, lease: i, labels: a, navigate:
285
285
  children: S.label
286
286
  }),
287
287
  y(h) && d("retry", a.retry, () => n.retryOperation(i, p, h.token), { className: v }),
288
- h?.canCancel && d("cancel", h.cancelRequested ? a.cancellationRequested : a.cancel, () => {
289
- h.cancelRequested || n.cancelOperation(i, p, h.token);
290
- }, {
291
- className: v,
292
- "aria-disabled": h.cancelRequested
293
- })
288
+ h?.canCancel && d("cancel", a.cancel, () => n.cancelOperation(i, p, h.token), { className: v })
294
289
  ]
295
290
  }),
296
291
  g.status === "failed" && /* @__PURE__ */ o("p", {
@@ -409,6 +404,6 @@ function O(e, t, n) {
409
404
  });
410
405
  }
411
406
  //#endregion
412
- export { x as Body, _ as Heading, b as SlidePreview, h as StatusIcon, O as closeButton, c as defaultLabels, p as partClasses, v as previewSlot, g as slotRenderer };
407
+ export { x as Body, _ as Heading, b as SlidePreview, h as StatusIcon, O as closeButton, c as defaultLabels, f as glyph, m as glyphs, p as partClasses, v as previewSlot, g as slotRenderer };
413
408
 
414
409
  //# sourceMappingURL=card.js.map