foldkit 0.100.1 → 0.102.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 (217) hide show
  1. package/README.md +3 -2
  2. package/dist/canvas/view.d.ts +1 -1
  3. package/dist/canvas/view.d.ts.map +1 -1
  4. package/dist/canvas/view.js +5 -5
  5. package/dist/command/index.d.ts +71 -0
  6. package/dist/command/index.d.ts.map +1 -1
  7. package/dist/command/index.js +34 -1
  8. package/dist/command/public.d.ts +1 -1
  9. package/dist/command/public.d.ts.map +1 -1
  10. package/dist/command/public.js +1 -1
  11. package/dist/devTools/overlay.d.ts.map +1 -1
  12. package/dist/devTools/overlay.js +156 -149
  13. package/dist/dom/dom.d.ts +8 -11
  14. package/dist/dom/dom.d.ts.map +1 -1
  15. package/dist/dom/dom.js +8 -11
  16. package/dist/dom/elementMovement.d.ts +1 -3
  17. package/dist/dom/elementMovement.d.ts.map +1 -1
  18. package/dist/dom/elementMovement.js +1 -3
  19. package/dist/dom/inert.d.ts +2 -4
  20. package/dist/dom/inert.d.ts.map +1 -1
  21. package/dist/dom/inert.js +2 -4
  22. package/dist/dom/scrollLock.d.ts +2 -2
  23. package/dist/dom/scrollLock.js +2 -2
  24. package/dist/dom/waitForAnimation.d.ts +1 -1
  25. package/dist/dom/waitForAnimation.js +1 -1
  26. package/dist/html/boundary.d.ts +98 -0
  27. package/dist/html/boundary.d.ts.map +1 -0
  28. package/dist/html/boundary.js +176 -0
  29. package/dist/html/childAttribute.d.ts +44 -0
  30. package/dist/html/childAttribute.d.ts.map +1 -0
  31. package/dist/html/childAttribute.js +34 -0
  32. package/dist/html/index.d.ts +70 -23
  33. package/dist/html/index.d.ts.map +1 -1
  34. package/dist/html/index.js +639 -575
  35. package/dist/html/lazy.d.ts +12 -7
  36. package/dist/html/lazy.d.ts.map +1 -1
  37. package/dist/html/lazy.js +30 -11
  38. package/dist/html/public.d.ts +2 -2
  39. package/dist/html/public.d.ts.map +1 -1
  40. package/dist/html/public.js +1 -1
  41. package/dist/html/runtimeSingleton.d.ts +72 -0
  42. package/dist/html/runtimeSingleton.d.ts.map +1 -0
  43. package/dist/html/runtimeSingleton.js +112 -0
  44. package/dist/html/submodel.d.ts +98 -0
  45. package/dist/html/submodel.d.ts.map +1 -0
  46. package/dist/html/submodel.js +190 -0
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +1 -0
  50. package/dist/render/render.d.ts +1 -1
  51. package/dist/render/render.js +1 -1
  52. package/dist/runtime/messagePriority.d.ts +5 -1
  53. package/dist/runtime/messagePriority.d.ts.map +1 -1
  54. package/dist/runtime/messagePriority.js +25 -4
  55. package/dist/runtime/runtime.d.ts +11 -11
  56. package/dist/runtime/runtime.d.ts.map +1 -1
  57. package/dist/runtime/runtime.js +118 -63
  58. package/dist/runtime/subscription.d.ts +139 -19
  59. package/dist/runtime/subscription.d.ts.map +1 -1
  60. package/dist/runtime/subscription.js +90 -9
  61. package/dist/submodel/public.d.ts +4 -0
  62. package/dist/submodel/public.d.ts.map +1 -0
  63. package/dist/submodel/public.js +1 -0
  64. package/dist/submodel/submodel.d.ts +32 -0
  65. package/dist/submodel/submodel.d.ts.map +1 -0
  66. package/dist/submodel/submodel.js +1 -0
  67. package/dist/subscription/animationFrame.d.ts +23 -26
  68. package/dist/subscription/animationFrame.d.ts.map +1 -1
  69. package/dist/subscription/animationFrame.js +17 -18
  70. package/dist/subscription/public.d.ts +2 -2
  71. package/dist/subscription/public.d.ts.map +1 -1
  72. package/dist/subscription/public.js +1 -1
  73. package/dist/test/apps/disabledButton.d.ts +4 -5
  74. package/dist/test/apps/disabledButton.d.ts.map +1 -1
  75. package/dist/test/apps/disabledButton.js +16 -16
  76. package/dist/test/scene.d.ts +8 -8
  77. package/dist/test/scene.d.ts.map +1 -1
  78. package/dist/test/scene.js +25 -13
  79. package/dist/test/story.d.ts +15 -8
  80. package/dist/test/story.d.ts.map +1 -1
  81. package/dist/test/story.js +21 -9
  82. package/dist/ui/animation/index.d.ts +30 -14
  83. package/dist/ui/animation/index.d.ts.map +1 -1
  84. package/dist/ui/animation/index.js +9 -19
  85. package/dist/ui/animation/public.d.ts +2 -2
  86. package/dist/ui/animation/public.d.ts.map +1 -1
  87. package/dist/ui/animation/public.js +1 -1
  88. package/dist/ui/calendar/index.d.ts +199 -84
  89. package/dist/ui/calendar/index.d.ts.map +1 -1
  90. package/dist/ui/calendar/index.js +129 -140
  91. package/dist/ui/calendar/public.d.ts +2 -2
  92. package/dist/ui/calendar/public.d.ts.map +1 -1
  93. package/dist/ui/calendar/public.js +1 -1
  94. package/dist/ui/checkbox/index.d.ts +93 -21
  95. package/dist/ui/checkbox/index.d.ts.map +1 -1
  96. package/dist/ui/checkbox/index.js +62 -33
  97. package/dist/ui/checkbox/public.d.ts +2 -2
  98. package/dist/ui/checkbox/public.d.ts.map +1 -1
  99. package/dist/ui/checkbox/public.js +1 -1
  100. package/dist/ui/combobox/multi.d.ts +35 -91
  101. package/dist/ui/combobox/multi.d.ts.map +1 -1
  102. package/dist/ui/combobox/multi.js +34 -17
  103. package/dist/ui/combobox/multiPublic.d.ts +2 -2
  104. package/dist/ui/combobox/multiPublic.d.ts.map +1 -1
  105. package/dist/ui/combobox/multiPublic.js +1 -1
  106. package/dist/ui/combobox/public.d.ts +3 -3
  107. package/dist/ui/combobox/public.d.ts.map +1 -1
  108. package/dist/ui/combobox/public.js +2 -2
  109. package/dist/ui/combobox/shared.d.ts +56 -31
  110. package/dist/ui/combobox/shared.d.ts.map +1 -1
  111. package/dist/ui/combobox/shared.js +333 -322
  112. package/dist/ui/combobox/single.d.ts +46 -93
  113. package/dist/ui/combobox/single.d.ts.map +1 -1
  114. package/dist/ui/combobox/single.js +44 -17
  115. package/dist/ui/datePicker/index.d.ts +256 -48
  116. package/dist/ui/datePicker/index.d.ts.map +1 -1
  117. package/dist/ui/datePicker/index.js +149 -104
  118. package/dist/ui/datePicker/public.d.ts +2 -2
  119. package/dist/ui/datePicker/public.d.ts.map +1 -1
  120. package/dist/ui/datePicker/public.js +1 -1
  121. package/dist/ui/dialog/index.d.ts +95 -39
  122. package/dist/ui/dialog/index.d.ts.map +1 -1
  123. package/dist/ui/dialog/index.js +71 -62
  124. package/dist/ui/dialog/public.d.ts +2 -2
  125. package/dist/ui/dialog/public.d.ts.map +1 -1
  126. package/dist/ui/dialog/public.js +1 -1
  127. package/dist/ui/disclosure/index.d.ts +71 -31
  128. package/dist/ui/disclosure/index.d.ts.map +1 -1
  129. package/dist/ui/disclosure/index.js +57 -62
  130. package/dist/ui/disclosure/public.d.ts +2 -2
  131. package/dist/ui/disclosure/public.d.ts.map +1 -1
  132. package/dist/ui/disclosure/public.js +1 -1
  133. package/dist/ui/dragAndDrop/index.d.ts +385 -103
  134. package/dist/ui/dragAndDrop/index.d.ts.map +1 -1
  135. package/dist/ui/dragAndDrop/index.js +26 -31
  136. package/dist/ui/dragAndDrop/public.d.ts +1 -1
  137. package/dist/ui/dragAndDrop/public.d.ts.map +1 -1
  138. package/dist/ui/dragAndDrop/public.js +1 -1
  139. package/dist/ui/fileDrop/index.d.ts +42 -46
  140. package/dist/ui/fileDrop/index.d.ts.map +1 -1
  141. package/dist/ui/fileDrop/index.js +30 -46
  142. package/dist/ui/fileDrop/public.d.ts +2 -2
  143. package/dist/ui/fileDrop/public.d.ts.map +1 -1
  144. package/dist/ui/fileDrop/public.js +1 -1
  145. package/dist/ui/listbox/multi.d.ts +39 -84
  146. package/dist/ui/listbox/multi.d.ts.map +1 -1
  147. package/dist/ui/listbox/multi.js +38 -20
  148. package/dist/ui/listbox/multiPublic.d.ts +2 -2
  149. package/dist/ui/listbox/multiPublic.d.ts.map +1 -1
  150. package/dist/ui/listbox/multiPublic.js +1 -1
  151. package/dist/ui/listbox/public.d.ts +3 -3
  152. package/dist/ui/listbox/public.d.ts.map +1 -1
  153. package/dist/ui/listbox/public.js +2 -2
  154. package/dist/ui/listbox/shared.d.ts +71 -30
  155. package/dist/ui/listbox/shared.d.ts.map +1 -1
  156. package/dist/ui/listbox/shared.js +319 -296
  157. package/dist/ui/listbox/single.d.ts +57 -85
  158. package/dist/ui/listbox/single.d.ts.map +1 -1
  159. package/dist/ui/listbox/single.js +48 -24
  160. package/dist/ui/menu/index.d.ts +80 -36
  161. package/dist/ui/menu/index.d.ts.map +1 -1
  162. package/dist/ui/menu/index.js +117 -86
  163. package/dist/ui/menu/public.d.ts +2 -2
  164. package/dist/ui/menu/public.d.ts.map +1 -1
  165. package/dist/ui/menu/public.js +1 -1
  166. package/dist/ui/popover/index.d.ts +117 -44
  167. package/dist/ui/popover/index.d.ts.map +1 -1
  168. package/dist/ui/popover/index.js +88 -101
  169. package/dist/ui/popover/public.d.ts +2 -2
  170. package/dist/ui/popover/public.d.ts.map +1 -1
  171. package/dist/ui/popover/public.js +1 -1
  172. package/dist/ui/radioGroup/index.d.ts +122 -45
  173. package/dist/ui/radioGroup/index.d.ts.map +1 -1
  174. package/dist/ui/radioGroup/index.js +111 -72
  175. package/dist/ui/radioGroup/public.d.ts +2 -2
  176. package/dist/ui/radioGroup/public.d.ts.map +1 -1
  177. package/dist/ui/radioGroup/public.js +1 -1
  178. package/dist/ui/slider/index.d.ts +247 -103
  179. package/dist/ui/slider/index.d.ts.map +1 -1
  180. package/dist/ui/slider/index.js +52 -68
  181. package/dist/ui/slider/public.d.ts +2 -2
  182. package/dist/ui/slider/public.d.ts.map +1 -1
  183. package/dist/ui/slider/public.js +1 -1
  184. package/dist/ui/switch/index.d.ts +74 -21
  185. package/dist/ui/switch/index.d.ts.map +1 -1
  186. package/dist/ui/switch/index.js +62 -33
  187. package/dist/ui/switch/public.d.ts +2 -2
  188. package/dist/ui/switch/public.d.ts.map +1 -1
  189. package/dist/ui/switch/public.js +1 -1
  190. package/dist/ui/tabs/index.d.ts +107 -45
  191. package/dist/ui/tabs/index.d.ts.map +1 -1
  192. package/dist/ui/tabs/index.js +99 -81
  193. package/dist/ui/tabs/public.d.ts +2 -2
  194. package/dist/ui/tabs/public.d.ts.map +1 -1
  195. package/dist/ui/tabs/public.js +1 -1
  196. package/dist/ui/toast/index.d.ts +93 -109
  197. package/dist/ui/toast/index.d.ts.map +1 -1
  198. package/dist/ui/toast/index.js +16 -29
  199. package/dist/ui/toast/schema.d.ts +15 -4
  200. package/dist/ui/toast/schema.d.ts.map +1 -1
  201. package/dist/ui/toast/schema.js +11 -4
  202. package/dist/ui/toast/update.d.ts +36 -18
  203. package/dist/ui/toast/update.d.ts.map +1 -1
  204. package/dist/ui/toast/update.js +33 -14
  205. package/dist/ui/tooltip/index.d.ts +94 -42
  206. package/dist/ui/tooltip/index.d.ts.map +1 -1
  207. package/dist/ui/tooltip/index.js +64 -73
  208. package/dist/ui/tooltip/public.d.ts +2 -2
  209. package/dist/ui/tooltip/public.d.ts.map +1 -1
  210. package/dist/ui/tooltip/public.js +1 -1
  211. package/dist/ui/virtualList/index.d.ts +63 -80
  212. package/dist/ui/virtualList/index.d.ts.map +1 -1
  213. package/dist/ui/virtualList/index.js +22 -49
  214. package/dist/ui/virtualList/public.d.ts +2 -2
  215. package/dist/ui/virtualList/public.d.ts.map +1 -1
  216. package/dist/ui/virtualList/public.js +1 -1
  217. package/package.json +1 -1
@@ -1,14 +1,17 @@
1
1
  import { Schema as S } from 'effect';
2
- import { type Attribute, type Html } from '../../html/index.js';
2
+ import { type ChildAttribute, type Html } from '../../html/index.js';
3
3
  import { Dismissed, DismissedAll, ElapsedDuration, GotAnimationMessage, HoveredEntry, LeftEntry, Position, Variant } from './schema.js';
4
4
  import { DismissAfter } from './update.js';
5
5
  export type { InitConfig } from './schema.js';
6
6
  export type { ShowInput } from './update.js';
7
7
  export { Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry, GotAnimationMessage, DismissAfter, };
8
- /** Handlers passed to `renderEntry`. Attach `dismiss` to a close button's
9
- * `OnClick` to let users dismiss the entry manually. */
10
- export type EntryHandlers<ParentMessage> = Readonly<{
11
- dismiss: ParentMessage;
8
+ /** Handlers passed to `entryToView`. Spread `dismiss` onto a close
9
+ * button's attribute array (typically inside `h.button([...dismiss])`)
10
+ * to let users dismiss the entry manually. The attribute carries the
11
+ * Toast's dismiss handler bound to this entry's id; it routes through
12
+ * the Toast boundary's wrap chain at click time. */
13
+ export type EntryHandlers = Readonly<{
14
+ dismiss: ReadonlyArray<ChildAttribute>;
12
15
  }>;
13
16
  /** Factory that binds `Ui.Toast` to a user-provided payload schema. The
14
17
  * returned module contains everything needed to wire a toast stack into an
@@ -16,11 +19,11 @@ export type EntryHandlers<ParentMessage> = Readonly<{
16
19
  * `dismiss` / `dismissAll` helpers, and the headless `view`.
17
20
  *
18
21
  * The payload is whatever content shape the consumer supplies via Schema.
19
- * The component never reads it it flows through to `renderEntry`. The
22
+ * The component never reads it. It flows through to `entryToView`. The
20
23
  * component itself owns only lifecycle and a11y fields (id, variant,
21
24
  * animation, dismiss timer, hover state).
22
25
  *
23
- * Consume the bound module's exports everywhere `Toast.Model` in your app
26
+ * Consume the bound module's exports everywhere. `Toast.Model` in your app
24
27
  * Model, `Toast.Message` in your parent Message union, `Toast.show` /
25
28
  * `Toast.dismiss` in your update, `Toast.view` in your view. The top-level
26
29
  * exports (`Variant`, `Position`, static message tags, `DismissAfter`) are
@@ -40,30 +43,12 @@ export type EntryHandlers<ParentMessage> = Readonly<{
40
43
  * ```
41
44
  */
42
45
  export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
43
- readonly view: <ParentMessage>(config: Readonly<{
44
- model: {
45
- readonly id: string;
46
- readonly defaultDuration: import("effect/Duration").Duration;
47
- readonly entries: readonly {
48
- readonly id: string;
49
- readonly variant: "Success" | "Error" | "Info" | "Warning";
50
- readonly animation: {
51
- readonly id: string;
52
- readonly isShowing: boolean;
53
- readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
54
- };
55
- readonly maybeDuration: import("effect/Option").Option<import("effect/Duration").Duration>;
56
- readonly pendingDismissVersion: number;
57
- readonly isHovered: boolean;
58
- readonly payload: A;
59
- }[];
60
- readonly nextEntryKey: number;
61
- };
62
- position: Position;
63
- toParentMessage: (message: Dismissed | HoveredEntry | LeftEntry) => ParentMessage;
64
- renderEntry: (entry: {
46
+ readonly view: import("../../html/submodel.js").SubmodelView<{
47
+ readonly id: string;
48
+ readonly defaultDuration: import("effect/Duration").Duration;
49
+ readonly entries: readonly {
65
50
  readonly id: string;
66
- readonly variant: "Success" | "Error" | "Info" | "Warning";
51
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
67
52
  readonly animation: {
68
53
  readonly id: string;
69
54
  readonly isShowing: boolean;
@@ -73,39 +58,40 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
73
58
  readonly pendingDismissVersion: number;
74
59
  readonly isHovered: boolean;
75
60
  readonly payload: A;
76
- }, handlers: Readonly<{
77
- dismiss: ParentMessage;
78
- }>) => Html;
79
- ariaLabel?: string;
80
- className?: string;
81
- attributes?: readonly Attribute<ParentMessage>[];
82
- entryClassName?: string;
83
- entryAttributes?: readonly Attribute<ParentMessage>[];
84
- }>) => Html;
85
- readonly lazy: <ParentMessage>(staticConfig: Omit<Readonly<{
86
- model: {
87
- readonly id: string;
88
- readonly defaultDuration: import("effect/Duration").Duration;
89
- readonly entries: readonly {
90
- readonly id: string;
91
- readonly variant: "Success" | "Error" | "Info" | "Warning";
92
- readonly animation: {
93
- readonly id: string;
94
- readonly isShowing: boolean;
95
- readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
96
- };
97
- readonly maybeDuration: import("effect/Option").Option<import("effect/Duration").Duration>;
98
- readonly pendingDismissVersion: number;
99
- readonly isHovered: boolean;
100
- readonly payload: A;
101
- }[];
102
- readonly nextEntryKey: number;
61
+ }[];
62
+ readonly nextEntryKey: number;
63
+ }, {
64
+ readonly _tag: "Dismissed";
65
+ readonly entryId: string;
66
+ } | {
67
+ readonly _tag: "DismissedAll";
68
+ } | {
69
+ readonly _tag: "ElapsedDuration";
70
+ readonly entryId: string;
71
+ readonly version: number;
72
+ } | {
73
+ readonly _tag: "HoveredEntry";
74
+ readonly entryId: string;
75
+ } | {
76
+ readonly _tag: "LeftEntry";
77
+ readonly entryId: string;
78
+ } | {
79
+ readonly _tag: "GotAnimationMessage";
80
+ readonly entryId: string;
81
+ readonly message: {
82
+ readonly _tag: "Showed";
83
+ } | {
84
+ readonly _tag: "Hid";
85
+ } | {
86
+ readonly _tag: "AdvancedAnimationFrame";
87
+ } | {
88
+ readonly _tag: "EndedAnimation";
103
89
  };
104
- position: Position;
105
- toParentMessage: (message: Dismissed | HoveredEntry | LeftEntry) => ParentMessage;
106
- renderEntry: (entry: {
90
+ } | {
91
+ readonly _tag: "Added";
92
+ readonly entry: {
107
93
  readonly id: string;
108
- readonly variant: "Success" | "Error" | "Info" | "Warning";
94
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
109
95
  readonly animation: {
110
96
  readonly id: string;
111
97
  readonly isShowing: boolean;
@@ -115,20 +101,12 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
115
101
  readonly pendingDismissVersion: number;
116
102
  readonly isHovered: boolean;
117
103
  readonly payload: A;
118
- }, handlers: Readonly<{
119
- dismiss: ParentMessage;
120
- }>) => Html;
121
- ariaLabel?: string;
122
- className?: string;
123
- attributes?: readonly Attribute<ParentMessage>[];
124
- entryClassName?: string;
125
- entryAttributes?: readonly Attribute<ParentMessage>[];
126
- }>, "model" | "toParentMessage" | "renderEntry">) => ((model: {
127
- readonly id: string;
128
- readonly defaultDuration: import("effect/Duration").Duration;
129
- readonly entries: readonly {
104
+ };
105
+ }, Readonly<{
106
+ position: Position;
107
+ entryToView: (entry: {
130
108
  readonly id: string;
131
- readonly variant: "Success" | "Error" | "Info" | "Warning";
109
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
132
110
  readonly animation: {
133
111
  readonly id: string;
134
112
  readonly isShowing: boolean;
@@ -138,23 +116,11 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
138
116
  readonly pendingDismissVersion: number;
139
117
  readonly isHovered: boolean;
140
118
  readonly payload: A;
141
- }[];
142
- readonly nextEntryKey: number;
143
- }, toParentMessage: (message: Dismissed | HoveredEntry | LeftEntry) => ParentMessage, renderEntry: (entry: {
144
- readonly id: string;
145
- readonly variant: "Success" | "Error" | "Info" | "Warning";
146
- readonly animation: {
147
- readonly id: string;
148
- readonly isShowing: boolean;
149
- readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
150
- };
151
- readonly maybeDuration: import("effect/Option").Option<import("effect/Duration").Duration>;
152
- readonly pendingDismissVersion: number;
153
- readonly isHovered: boolean;
154
- readonly payload: A;
155
- }, handlers: Readonly<{
156
- dismiss: ParentMessage;
157
- }>) => Html) => Html);
119
+ }, handlers: EntryHandlers) => Html;
120
+ ariaLabel?: string;
121
+ containerClassName?: string;
122
+ entryClassName?: string;
123
+ }>>;
158
124
  readonly Entry: S.Struct<{
159
125
  readonly id: S.String;
160
126
  readonly variant: S.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
@@ -213,6 +179,9 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
213
179
  entryId: S.String;
214
180
  message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Showed", {}>, import("../../schema/index.js").CallableTaggedStruct<"Hid", {}>, import("../../schema/index.js").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema/index.js").CallableTaggedStruct<"EndedAnimation", {}>]>;
215
181
  }>]>;
182
+ readonly OutMessage: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"DismissedToast", {
183
+ payload: S.Codec<A, I, never, never>;
184
+ }>]>;
216
185
  readonly Added: import("../../schema/index.js").CallableTaggedStruct<"Added", {
217
186
  entry: S.Struct<{
218
187
  readonly id: S.String;
@@ -228,6 +197,9 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
228
197
  readonly payload: S.Codec<A, I, never, never>;
229
198
  }>;
230
199
  }>;
200
+ readonly DismissedToast: import("../../schema/index.js").CallableTaggedStruct<"DismissedToast", {
201
+ payload: S.Codec<A, I, never, never>;
202
+ }>;
231
203
  readonly init: (config: Readonly<{
232
204
  id: string;
233
205
  defaultDuration?: import("effect/Duration").Input;
@@ -236,7 +208,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
236
208
  readonly defaultDuration: import("effect/Duration").Duration;
237
209
  readonly entries: readonly {
238
210
  readonly id: string;
239
- readonly variant: "Success" | "Error" | "Info" | "Warning";
211
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
240
212
  readonly animation: {
241
213
  readonly id: string;
242
214
  readonly isShowing: boolean;
@@ -254,7 +226,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
254
226
  readonly defaultDuration: import("effect/Duration").Duration;
255
227
  readonly entries: readonly {
256
228
  readonly id: string;
257
- readonly variant: "Success" | "Error" | "Info" | "Warning";
229
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
258
230
  readonly animation: {
259
231
  readonly id: string;
260
232
  readonly isShowing: boolean;
@@ -297,7 +269,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
297
269
  readonly _tag: "Added";
298
270
  readonly entry: {
299
271
  readonly id: string;
300
- readonly variant: "Success" | "Error" | "Info" | "Warning";
272
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
301
273
  readonly animation: {
302
274
  readonly id: string;
303
275
  readonly isShowing: boolean;
@@ -313,7 +285,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
313
285
  readonly defaultDuration: import("effect/Duration").Duration;
314
286
  readonly entries: readonly {
315
287
  readonly id: string;
316
- readonly variant: "Success" | "Error" | "Info" | "Warning";
288
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
317
289
  readonly animation: {
318
290
  readonly id: string;
319
291
  readonly isShowing: boolean;
@@ -359,7 +331,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
359
331
  readonly _tag: "Added";
360
332
  readonly entry: {
361
333
  readonly id: string;
362
- readonly variant: "Success" | "Error" | "Info" | "Warning";
334
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
363
335
  readonly animation: {
364
336
  readonly id: string;
365
337
  readonly isShowing: boolean;
@@ -371,13 +343,16 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
371
343
  readonly payload: A;
372
344
  };
373
345
  }, never, never>;
374
- }>[]];
346
+ }>[], import("effect/Option").Option<{
347
+ readonly _tag: "DismissedToast";
348
+ readonly payload: A;
349
+ }>];
375
350
  readonly show: (model: {
376
351
  readonly id: string;
377
352
  readonly defaultDuration: import("effect/Duration").Duration;
378
353
  readonly entries: readonly {
379
354
  readonly id: string;
380
- readonly variant: "Success" | "Error" | "Info" | "Warning";
355
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
381
356
  readonly animation: {
382
357
  readonly id: string;
383
358
  readonly isShowing: boolean;
@@ -399,7 +374,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
399
374
  readonly defaultDuration: import("effect/Duration").Duration;
400
375
  readonly entries: readonly {
401
376
  readonly id: string;
402
- readonly variant: "Success" | "Error" | "Info" | "Warning";
377
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
403
378
  readonly animation: {
404
379
  readonly id: string;
405
380
  readonly isShowing: boolean;
@@ -445,7 +420,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
445
420
  readonly _tag: "Added";
446
421
  readonly entry: {
447
422
  readonly id: string;
448
- readonly variant: "Success" | "Error" | "Info" | "Warning";
423
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
449
424
  readonly animation: {
450
425
  readonly id: string;
451
426
  readonly isShowing: boolean;
@@ -457,13 +432,16 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
457
432
  readonly payload: A;
458
433
  };
459
434
  }, never, never>;
460
- }>[]];
435
+ }>[], import("effect/Option").Option<{
436
+ readonly _tag: "DismissedToast";
437
+ readonly payload: A;
438
+ }>];
461
439
  readonly dismiss: (model: {
462
440
  readonly id: string;
463
441
  readonly defaultDuration: import("effect/Duration").Duration;
464
442
  readonly entries: readonly {
465
443
  readonly id: string;
466
- readonly variant: "Success" | "Error" | "Info" | "Warning";
444
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
467
445
  readonly animation: {
468
446
  readonly id: string;
469
447
  readonly isShowing: boolean;
@@ -480,7 +458,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
480
458
  readonly defaultDuration: import("effect/Duration").Duration;
481
459
  readonly entries: readonly {
482
460
  readonly id: string;
483
- readonly variant: "Success" | "Error" | "Info" | "Warning";
461
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
484
462
  readonly animation: {
485
463
  readonly id: string;
486
464
  readonly isShowing: boolean;
@@ -526,7 +504,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
526
504
  readonly _tag: "Added";
527
505
  readonly entry: {
528
506
  readonly id: string;
529
- readonly variant: "Success" | "Error" | "Info" | "Warning";
507
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
530
508
  readonly animation: {
531
509
  readonly id: string;
532
510
  readonly isShowing: boolean;
@@ -538,13 +516,16 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
538
516
  readonly payload: A;
539
517
  };
540
518
  }, never, never>;
541
- }>[]];
519
+ }>[], import("effect/Option").Option<{
520
+ readonly _tag: "DismissedToast";
521
+ readonly payload: A;
522
+ }>];
542
523
  readonly dismissAll: (model: {
543
524
  readonly id: string;
544
525
  readonly defaultDuration: import("effect/Duration").Duration;
545
526
  readonly entries: readonly {
546
527
  readonly id: string;
547
- readonly variant: "Success" | "Error" | "Info" | "Warning";
528
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
548
529
  readonly animation: {
549
530
  readonly id: string;
550
531
  readonly isShowing: boolean;
@@ -561,7 +542,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
561
542
  readonly defaultDuration: import("effect/Duration").Duration;
562
543
  readonly entries: readonly {
563
544
  readonly id: string;
564
- readonly variant: "Success" | "Error" | "Info" | "Warning";
545
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
565
546
  readonly animation: {
566
547
  readonly id: string;
567
548
  readonly isShowing: boolean;
@@ -607,7 +588,7 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
607
588
  readonly _tag: "Added";
608
589
  readonly entry: {
609
590
  readonly id: string;
610
- readonly variant: "Success" | "Error" | "Info" | "Warning";
591
+ readonly variant: "Error" | "Success" | "Info" | "Warning";
611
592
  readonly animation: {
612
593
  readonly id: string;
613
594
  readonly isShowing: boolean;
@@ -619,6 +600,9 @@ export declare const make: <A, I>(payloadSchema: S.Codec<A, I>) => {
619
600
  readonly payload: A;
620
601
  };
621
602
  }, never, never>;
622
- }>[]];
603
+ }>[], import("effect/Option").Option<{
604
+ readonly _tag: "DismissedToast";
605
+ readonly payload: A;
606
+ }>];
623
607
  };
624
608
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAGV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAe,MAAM,aAAa,CAAA;AAEvD,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EACL,OAA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;;;;;;;;;;;;;;;;;;;;kBAUzC,QAAQ;qBACL,CAAC,KAAK;;;;;;;;;;;;SAAO,EAAE,QAAQ,EAAE,aAAa,KAAK,IAAI;oBAChD,MAAM;6BACG,MAAM;yBACV,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2F1B,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Match as M } from 'effect';
2
- import { createLazy, html, } from '../../html/index.js';
2
+ import { childAttributes, defineView, html, } from '../../html/index.js';
3
3
  import { Dismissed, DismissedAll, ElapsedDuration, GotAnimationMessage, HoveredEntry, LeftEntry, Position, Variant, } from './schema.js';
4
4
  import { DismissAfter, makeRuntime } from './update.js';
5
5
  export { Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry, GotAnimationMessage, DismissAfter, };
@@ -56,11 +56,11 @@ const DEFAULT_ARIA_LABEL = 'Notifications';
56
56
  * `dismiss` / `dismissAll` helpers, and the headless `view`.
57
57
  *
58
58
  * The payload is whatever content shape the consumer supplies via Schema.
59
- * The component never reads it it flows through to `renderEntry`. The
59
+ * The component never reads it. It flows through to `entryToView`. The
60
60
  * component itself owns only lifecycle and a11y fields (id, variant,
61
61
  * animation, dismiss timer, hover state).
62
62
  *
63
- * Consume the bound module's exports everywhere `Toast.Model` in your app
63
+ * Consume the bound module's exports everywhere. `Toast.Model` in your app
64
64
  * Model, `Toast.Message` in your parent Message union, `Toast.show` /
65
65
  * `Toast.dismiss` in your update, `Toast.view` in your view. The top-level
66
66
  * exports (`Variant`, `Position`, static message tags, `DismissAfter`) are
@@ -87,17 +87,17 @@ export const make = (payloadSchema) => {
87
87
  * animation data attributes (`data-enter`, `data-leave`,
88
88
  * `data-transition`, `data-closed`) and `data-variant` reflecting the
89
89
  * entry's variant. */
90
- const view = (config) => {
90
+ const view = defineView((model, viewInputs) => {
91
91
  const h = html();
92
- const { model: { id, entries }, position, toParentMessage, renderEntry, ariaLabel = DEFAULT_ARIA_LABEL, className, attributes = [], entryClassName, entryAttributes = [], } = config;
92
+ const { id, entries } = model;
93
+ const { position, entryToView, ariaLabel = DEFAULT_ARIA_LABEL, containerClassName, entryClassName, } = viewInputs;
93
94
  const containerAttributes = [
94
95
  h.Id(id),
95
96
  h.Role('region'),
96
97
  h.AriaLabel(ariaLabel),
97
98
  h.AriaLive('polite'),
98
99
  h.Style(positionToContainerStyle(position)),
99
- ...(className ? [h.Class(className)] : []),
100
- ...attributes,
100
+ ...(containerClassName ? [h.Class(containerClassName)] : []),
101
101
  ];
102
102
  const renderEntryItem = (entry) => {
103
103
  const { transitionState } = entry.animation;
@@ -116,43 +116,30 @@ export const make = (payloadSchema) => {
116
116
  h.DataAttribute('leave', ''),
117
117
  h.DataAttribute('transition', ''),
118
118
  ]), M.orElse(() => []));
119
- const handlers = {
120
- dismiss: toParentMessage(Dismissed({ entryId: entry.id })),
121
- };
122
119
  const itemAttributes = [
123
120
  h.Id(entry.id),
124
121
  h.Role(variantToRole(entry.variant)),
125
122
  h.AriaAtomic(true),
126
123
  h.DataAttribute('variant', entry.variant),
127
124
  h.Style({ pointerEvents: 'auto' }),
128
- h.OnMouseEnter(toParentMessage(HoveredEntry({ entryId: entry.id }))),
129
- h.OnMouseLeave(toParentMessage(LeftEntry({ entryId: entry.id }))),
125
+ h.OnMouseEnter(HoveredEntry({ entryId: entry.id })),
126
+ h.OnMouseLeave(LeftEntry({ entryId: entry.id })),
130
127
  ...animationAttributes,
131
128
  ...(entryClassName ? [h.Class(entryClassName)] : []),
132
- ...entryAttributes,
133
129
  ];
130
+ const handlers = {
131
+ dismiss: childAttributes([
132
+ h.OnClick(Dismissed({ entryId: entry.id })),
133
+ ]),
134
+ };
134
135
  return h.keyed('li')(entry.id, itemAttributes, [
135
- renderEntry(entry, handlers),
136
+ entryToView(entry, handlers),
136
137
  ]);
137
138
  };
138
139
  return h.keyed('ol')(id, containerAttributes, entries.map(renderEntryItem));
139
- };
140
- /** Creates a memoized toast container view. Static config (className,
141
- * entryClassName, etc.) is captured in a closure. Dynamic fields —
142
- * `model`, `toParentMessage`, and `renderEntry` — are compared by
143
- * reference per render via `createLazy`. */
144
- const lazy = (staticConfig) => {
145
- const lazyView = createLazy();
146
- return (model, toParentMessage, renderEntry) => lazyView((currentModel, currentToParentMessage, currentRenderEntry) => view({
147
- ...staticConfig,
148
- model: currentModel,
149
- toParentMessage: currentToParentMessage,
150
- renderEntry: currentRenderEntry,
151
- }), [model, toParentMessage, renderEntry]);
152
- };
140
+ });
153
141
  return {
154
142
  ...runtime,
155
143
  view,
156
- lazy,
157
144
  };
158
145
  };
@@ -2,7 +2,7 @@ import { Duration, Schema as S } from 'effect';
2
2
  /** Semantic category of a toast. Drives the default ARIA role: `status` for
3
3
  * `Info` / `Success`, `alert` for `Warning` / `Error`. Also surfaced as
4
4
  * `data-variant` on each entry for per-variant CSS. This is the only
5
- * content-adjacent field the component owns the rest of the entry's
5
+ * content-adjacent field the component owns. The rest of the entry's
6
6
  * content lives in the user-provided payload. */
7
7
  export declare const Variant: S.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
8
8
  export type Variant = typeof Variant.Type;
@@ -10,7 +10,7 @@ export type Variant = typeof Variant.Type;
10
10
  export declare const Position: S.Literals<readonly ["TopLeft", "TopCenter", "TopRight", "BottomLeft", "BottomCenter", "BottomRight"]>;
11
11
  export type Position = typeof Position.Type;
12
12
  /** Schema factory for a single toast entry. `payloadSchema` is user-provided
13
- * and defines the shape of per-entry content whatever the consumer wants
13
+ * and defines the shape of per-entry content, whatever the consumer wants
14
14
  * to encode. The component itself owns only lifecycle + a11y fields: `id`,
15
15
  * `variant` (for ARIA role), `animation`, `maybeDuration`,
16
16
  * `pendingDismissVersion` (for cancellable auto-dismiss), and `isHovered`
@@ -30,8 +30,8 @@ export declare const makeEntry: <A, I>(payloadSchema: S.Codec<A, I>) => S.Struct
30
30
  }>;
31
31
  /** Schema factory for the toast container's state. `nextEntryKey` is a
32
32
  * monotonic counter used to generate unique entry IDs purely from Model
33
- * state. Thread the updated model through successive `show()` calls
34
- * calling `show()` twice against the same pre-update model in the same tick
33
+ * state. Thread the updated model through successive `show()` calls.
34
+ * Calling `show()` twice against the same pre-update model in the same tick
35
35
  * will produce duplicate entry IDs. */
36
36
  export declare const makeModel: <A, I>(payloadSchema: S.Codec<A, I>) => S.Struct<{
37
37
  readonly id: S.String;
@@ -131,6 +131,17 @@ export declare const makeMessage: <A, I>(payloadSchema: S.Codec<A, I>) => S.Unio
131
131
  entryId: S.String;
132
132
  message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Showed", {}>, import("../../schema/index.js").CallableTaggedStruct<"Hid", {}>, import("../../schema/index.js").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema/index.js").CallableTaggedStruct<"EndedAnimation", {}>]>;
133
133
  }>]>;
134
+ /** Factory for `DismissedToast`, the OutMessage emitted once an entry has
135
+ * finished dismissing (leave-animation `TransitionedOut`). Carries the
136
+ * payload so consumers can lift the dismissal into a domain Message
137
+ * without looking the entry up from a stale model. */
138
+ export declare const makeDismissedToast: <A, I>(payloadSchema: S.Codec<A, I>) => import("../../schema/index.js").CallableTaggedStruct<"DismissedToast", {
139
+ payload: S.Codec<A, I, never, never>;
140
+ }>;
141
+ /** Factory for the union of out-messages the toast component can produce. */
142
+ export declare const makeOutMessage: <A, I>(payloadSchema: S.Codec<A, I>) => S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"DismissedToast", {
143
+ payload: S.Codec<A, I, never, never>;
144
+ }>]>;
134
145
  /** Configuration for creating a toast container model. `defaultDuration` is
135
146
  * applied to any `show()` call that doesn't provide its own `duration` or
136
147
  * pass `sticky: true`. Accepts any Effect Duration input; a bare number is
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAU9C;;;;kDAIkD;AAClD,eAAO,MAAM,OAAO,8DAAsD,CAAA;AAC1E,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,gFAAgF;AAChF,eAAO,MAAM,QAAQ,wGAOnB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAI3C;;;;;4BAK4B;AAC5B,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;EASxD,CAAA;AAIJ;;;;wCAIwC;AACxC,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;EAMxD,CAAA;AAIJ;wEACwE;AACxE,eAAO,MAAM,SAAS;;EAAwC,CAAA;AAC9D,uEAAuE;AACvE,eAAO,MAAM,YAAY,0EAAoB,CAAA;AAC7C;;qBAEqB;AACrB,eAAO,MAAM,eAAe;;;EAG1B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ACxD,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;EACX,CAAA;AAEjD,6EAA6E;AAC7E,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;IAS1D,CAAA;AAEJ;;;uDAGuD;AACvD,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;EACpB,CAAA;AAEjD,6EAA6E;AAC7E,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;IACnB,CAAA;AAI9C;;;mCAGmC;AACnC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,eAAe,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;CACjC,CAAC,CAAA;AAEF,eAAO,MAAM,gBAAgB,mBAAsB,CAAA"}
@@ -5,7 +5,7 @@ import { Message as AnimationMessage, Model as AnimationModel, } from '../animat
5
5
  /** Semantic category of a toast. Drives the default ARIA role: `status` for
6
6
  * `Info` / `Success`, `alert` for `Warning` / `Error`. Also surfaced as
7
7
  * `data-variant` on each entry for per-variant CSS. This is the only
8
- * content-adjacent field the component owns the rest of the entry's
8
+ * content-adjacent field the component owns. The rest of the entry's
9
9
  * content lives in the user-provided payload. */
10
10
  export const Variant = S.Literals(['Info', 'Success', 'Warning', 'Error']);
11
11
  // POSITION
@@ -20,7 +20,7 @@ export const Position = S.Literals([
20
20
  ]);
21
21
  // ENTRY
22
22
  /** Schema factory for a single toast entry. `payloadSchema` is user-provided
23
- * and defines the shape of per-entry content whatever the consumer wants
23
+ * and defines the shape of per-entry content, whatever the consumer wants
24
24
  * to encode. The component itself owns only lifecycle + a11y fields: `id`,
25
25
  * `variant` (for ARIA role), `animation`, `maybeDuration`,
26
26
  * `pendingDismissVersion` (for cancellable auto-dismiss), and `isHovered`
@@ -37,8 +37,8 @@ export const makeEntry = (payloadSchema) => S.Struct({
37
37
  // MODEL
38
38
  /** Schema factory for the toast container's state. `nextEntryKey` is a
39
39
  * monotonic counter used to generate unique entry IDs purely from Model
40
- * state. Thread the updated model through successive `show()` calls
41
- * calling `show()` twice against the same pre-update model in the same tick
40
+ * state. Thread the updated model through successive `show()` calls.
41
+ * Calling `show()` twice against the same pre-update model in the same tick
42
42
  * will produce duplicate entry IDs. */
43
43
  export const makeModel = (payloadSchema) => S.Struct({
44
44
  id: S.String,
@@ -83,4 +83,11 @@ export const makeMessage = (payloadSchema) => S.Union([
83
83
  LeftEntry,
84
84
  GotAnimationMessage,
85
85
  ]);
86
+ /** Factory for `DismissedToast`, the OutMessage emitted once an entry has
87
+ * finished dismissing (leave-animation `TransitionedOut`). Carries the
88
+ * payload so consumers can lift the dismissal into a domain Message
89
+ * without looking the entry up from a stale model. */
90
+ export const makeDismissedToast = (payloadSchema) => m('DismissedToast', { payload: payloadSchema });
91
+ /** Factory for the union of out-messages the toast component can produce. */
92
+ export const makeOutMessage = (payloadSchema) => S.Union([makeDismissedToast(payloadSchema)]);
86
93
  export const DEFAULT_DURATION = Duration.seconds(4);