@zag-js/toast 0.0.0-dev-20221212111455 → 0.0.0-dev-20221213123137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +22 -22
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as _zag_js_core from '@zag-js/core';
|
|
|
2
2
|
import { Machine, StateMachine } from '@zag-js/core';
|
|
3
3
|
import { RootProperties, CommonProperties, Direction, DirectionProperty, Context, RequiredBy, PropTypes, NormalizeProps } from '@zag-js/types';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type Type = "success" | "error" | "loading" | "info" | "custom";
|
|
6
|
+
type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
|
|
7
|
+
type SharedContext = {
|
|
8
8
|
/**
|
|
9
9
|
* Whether to pause toast when the user leaves the browser tab
|
|
10
10
|
*/
|
|
@@ -14,7 +14,7 @@ declare type SharedContext = {
|
|
|
14
14
|
*/
|
|
15
15
|
pauseOnInteraction?: boolean;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
type ToastOptions = {
|
|
18
18
|
/**
|
|
19
19
|
* The unique id of the toast
|
|
20
20
|
*/
|
|
@@ -65,11 +65,11 @@ declare type ToastOptions = {
|
|
|
65
65
|
*/
|
|
66
66
|
onUpdate?: VoidFunction;
|
|
67
67
|
};
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
type Options = Partial<ToastOptions>;
|
|
69
|
+
type RenderOptions = Omit<ToastOptions, "render"> & {
|
|
70
70
|
dismiss(): void;
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
type MachineContext = SharedContext & RootProperties & CommonProperties & Omit<ToastOptions, "removeDelay"> & {
|
|
73
73
|
/**
|
|
74
74
|
* The duration for the toast to kept alive before it is removed.
|
|
75
75
|
* Useful for exit transitions.
|
|
@@ -88,14 +88,14 @@ declare type MachineContext = SharedContext & RootProperties & CommonProperties
|
|
|
88
88
|
*/
|
|
89
89
|
remaining: number;
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
type MachineState = {
|
|
92
92
|
value: "active" | "active:temp" | "dismissing" | "inactive" | "persist";
|
|
93
93
|
tags: "visible" | "paused" | "updating";
|
|
94
94
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
type State = StateMachine.State<MachineContext, MachineState>;
|
|
96
|
+
type Send = StateMachine.Send;
|
|
97
|
+
type Service = Machine<MachineContext, MachineState>;
|
|
98
|
+
type GroupPublicContext = SharedContext & DirectionProperty & CommonProperties & {
|
|
99
99
|
/**
|
|
100
100
|
* The gutter or spacing between toasts
|
|
101
101
|
*/
|
|
@@ -113,29 +113,29 @@ declare type GroupPublicContext = SharedContext & DirectionProperty & CommonProp
|
|
|
113
113
|
*/
|
|
114
114
|
offsets: string | Record<"left" | "right" | "bottom" | "top", string>;
|
|
115
115
|
};
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">;
|
|
117
|
+
type GroupComputedContext = Readonly<{
|
|
118
118
|
/**
|
|
119
119
|
* @computed
|
|
120
120
|
* The total number of toasts in the group
|
|
121
121
|
*/
|
|
122
122
|
readonly count: number;
|
|
123
123
|
}>;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
type GroupPrivateContext = Context<{}>;
|
|
125
|
+
type GroupMachineContext = GroupPublicContext & GroupComputedContext & GroupPrivateContext;
|
|
126
|
+
type GroupState = StateMachine.State<GroupMachineContext>;
|
|
127
|
+
type GroupSend = (event: StateMachine.Event<StateMachine.AnyEventObject>) => void;
|
|
128
|
+
type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
|
|
129
|
+
type PromiseOptions<Value> = {
|
|
130
130
|
loading: ToastOptions;
|
|
131
131
|
success: MaybeFunction<ToastOptions, Value>;
|
|
132
132
|
error: MaybeFunction<ToastOptions, Error>;
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
type GroupProps = {
|
|
135
135
|
placement: Placement;
|
|
136
136
|
label?: string;
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
type Toaster = {
|
|
139
139
|
count: number;
|
|
140
140
|
isVisible(id: string): boolean;
|
|
141
141
|
upsert(options: ToastOptions): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/toast",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20221213123137",
|
|
4
4
|
"description": "Core logic for the toast widget implemented as a state machine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@zag-js/anatomy": "0.1.1",
|
|
33
|
-
"@zag-js/core": "0.
|
|
33
|
+
"@zag-js/core": "0.0.0-dev-20221213123137",
|
|
34
34
|
"@zag-js/types": "0.3.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|