@zag-js/toast 2.0.0-next.3 → 2.0.0-next.4

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 (45) hide show
  1. package/dist/index.d.mts +10 -17
  2. package/dist/index.d.ts +10 -17
  3. package/dist/index.js +18 -45
  4. package/dist/index.mjs +5 -11
  5. package/dist/toast-group.connect.d.mts +4 -8
  6. package/dist/toast-group.connect.d.ts +4 -8
  7. package/dist/toast-group.connect.js +82 -103
  8. package/dist/toast-group.connect.mjs +77 -67
  9. package/dist/toast-group.machine.d.mts +2 -8
  10. package/dist/toast-group.machine.d.ts +2 -8
  11. package/dist/toast-group.machine.js +295 -290
  12. package/dist/toast-group.machine.mjs +290 -254
  13. package/dist/toast.anatomy.d.mts +2 -6
  14. package/dist/toast.anatomy.d.ts +2 -6
  15. package/dist/toast.anatomy.js +8 -40
  16. package/dist/toast.anatomy.mjs +4 -14
  17. package/dist/toast.connect.d.mts +4 -8
  18. package/dist/toast.connect.d.ts +4 -8
  19. package/dist/toast.connect.js +176 -160
  20. package/dist/toast.connect.mjs +171 -124
  21. package/dist/toast.dom.d.mts +21 -14
  22. package/dist/toast.dom.d.ts +21 -14
  23. package/dist/toast.dom.js +50 -48
  24. package/dist/toast.dom.mjs +35 -17
  25. package/dist/toast.machine.d.mts +2 -8
  26. package/dist/toast.machine.d.ts +2 -8
  27. package/dist/toast.machine.js +404 -288
  28. package/dist/toast.machine.mjs +400 -253
  29. package/dist/toast.store.d.mts +2 -8
  30. package/dist/toast.store.d.ts +2 -8
  31. package/dist/toast.store.js +345 -263
  32. package/dist/toast.store.mjs +341 -238
  33. package/dist/toast.types.d.mts +460 -427
  34. package/dist/toast.types.d.ts +460 -427
  35. package/dist/toast.types.js +4 -18
  36. package/dist/toast.types.mjs +1 -0
  37. package/dist/toast.utils.d.mts +10 -13
  38. package/dist/toast.utils.d.ts +10 -13
  39. package/dist/toast.utils.js +185 -198
  40. package/dist/toast.utils.mjs +175 -168
  41. package/dist/utils/swipe.d.mts +16 -0
  42. package/dist/utils/swipe.d.ts +16 -0
  43. package/dist/utils/swipe.js +100 -0
  44. package/dist/utils/swipe.mjs +93 -0
  45. package/package.json +8 -8
@@ -1,257 +1,293 @@
1
- // src/toast-group.machine.ts
1
+ import { getRegionEl, getToastEls } from "./toast.dom.mjs";
2
+ import { AnimationFrame, addDomEvent, contains, getEventTarget } from "@zag-js/dom-query";
3
+ import { uuid } from "@zag-js/utils";
2
4
  import { setup } from "@zag-js/core";
3
5
  import { trackDismissableBranch } from "@zag-js/dismissable";
4
- import { addDomEvent, AnimationFrame } from "@zag-js/dom-query";
5
- import { uuid } from "@zag-js/utils";
6
- import * as dom from "./toast.dom.mjs";
7
- var { guards, createMachine } = setup();
8
- var { and } = guards;
9
- var groupMachine = createMachine({
10
- props({ props }) {
11
- return {
12
- dir: "ltr",
13
- id: uuid(),
14
- ...props,
15
- store: props.store
16
- };
17
- },
18
- initialState({ prop }) {
19
- return prop("store").attrs.overlap ? "overlap" : "stack";
20
- },
21
- refs() {
22
- return {
23
- lastFocusedEl: null,
24
- isFocusWithin: false,
25
- isPointerWithin: false,
26
- ignoreMouseTimer: AnimationFrame.create(),
27
- dismissableCleanup: void 0
28
- };
29
- },
30
- context({ bindable }) {
31
- return {
32
- toasts: bindable(() => ({
33
- defaultValue: [],
34
- sync: true,
35
- hash: (toasts) => toasts.map((t) => t.id).join(",")
36
- })),
37
- heights: bindable(() => ({
38
- defaultValue: [],
39
- sync: true
40
- }))
41
- };
42
- },
43
- computed: {
44
- count: ({ context }) => context.get("toasts").length,
45
- overlap: ({ prop }) => prop("store").attrs.overlap,
46
- placement: ({ prop }) => prop("store").attrs.placement
47
- },
48
- effects: ["subscribeToStore", "trackDocumentVisibility", "trackHotKeyPress"],
49
- watch({ track, context, action }) {
50
- track([() => context.hash("toasts")], () => {
51
- queueMicrotask(() => {
52
- action(["collapsedIfEmpty", "setDismissableBranch"]);
53
- });
54
- });
55
- },
56
- exit: ["clearDismissableBranch", "clearLastFocusedEl", "clearMouseEventTimer"],
57
- on: {
58
- "DOC.HOTKEY": {
59
- actions: ["focusRegionEl"]
60
- },
61
- "REGION.BLUR": [
62
- {
63
- guard: and("isOverlapping", "isPointerOut"),
64
- target: "overlap",
65
- actions: ["collapseToasts", "resumeToasts", "restoreFocusIfPointerOut"]
66
- },
67
- {
68
- guard: "isPointerOut",
69
- target: "stack",
70
- actions: ["resumeToasts", "restoreFocusIfPointerOut"]
71
- },
72
- {
73
- actions: ["clearFocusWithin"]
74
- }
75
- ],
76
- "TOAST.REMOVE": {
77
- actions: ["removeToast", "removeHeight", "ignoreMouseEventsTemporarily"]
78
- },
79
- "TOAST.PAUSE": {
80
- actions: ["pauseToasts"]
81
- }
82
- },
83
- states: {
84
- stack: {
85
- on: {
86
- "REGION.POINTER_LEAVE": [
87
- {
88
- guard: "isOverlapping",
89
- target: "overlap",
90
- actions: ["clearPointerWithin", "resumeToasts", "collapseToasts"]
91
- },
92
- {
93
- actions: ["clearPointerWithin", "resumeToasts"]
94
- }
95
- ],
96
- "REGION.OVERLAP": {
97
- target: "overlap",
98
- actions: ["collapseToasts"]
99
- },
100
- "REGION.FOCUS": {
101
- actions: ["setLastFocusedEl", "pauseToasts"]
102
- },
103
- "REGION.POINTER_ENTER": {
104
- actions: ["setPointerWithin", "pauseToasts"]
105
- }
106
- }
107
- },
108
- overlap: {
109
- on: {
110
- "REGION.STACK": {
111
- target: "stack",
112
- actions: ["expandToasts"]
113
- },
114
- "REGION.POINTER_ENTER": {
115
- target: "stack",
116
- actions: ["setPointerWithin", "pauseToasts", "expandToasts"]
117
- },
118
- "REGION.FOCUS": {
119
- target: "stack",
120
- actions: ["setLastFocusedEl", "pauseToasts", "expandToasts"]
121
- }
122
- }
123
- }
124
- },
125
- implementations: {
126
- guards: {
127
- isOverlapping: ({ computed }) => computed("overlap"),
128
- isPointerOut: ({ refs }) => !refs.get("isPointerWithin")
129
- },
130
- effects: {
131
- subscribeToStore({ context, prop }) {
132
- const store = prop("store");
133
- context.set("toasts", store.getVisibleToasts());
134
- return store.subscribe((toast) => {
135
- if (toast.dismiss) {
136
- context.set("toasts", (prev) => prev.filter((t) => t.id !== toast.id));
137
- return;
138
- }
139
- context.set("toasts", (prev) => {
140
- const index = prev.findIndex((t) => t.id === toast.id);
141
- if (index !== -1) {
142
- return [...prev.slice(0, index), { ...prev[index], ...toast }, ...prev.slice(index + 1)];
143
- }
144
- return [toast, ...prev];
145
- });
146
- });
147
- },
148
- trackHotKeyPress({ prop, send }) {
149
- const handleKeyDown = (event) => {
150
- const { hotkey } = prop("store").attrs;
151
- const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
152
- if (!isHotkeyPressed) return;
153
- send({ type: "DOC.HOTKEY" });
154
- };
155
- return addDomEvent(document, "keydown", handleKeyDown, { capture: true });
156
- },
157
- trackDocumentVisibility({ prop, send, scope }) {
158
- const { pauseOnPageIdle } = prop("store").attrs;
159
- if (!pauseOnPageIdle) return;
160
- const doc = scope.getDoc();
161
- return addDomEvent(doc, "visibilitychange", () => {
162
- const isHidden = doc.visibilityState === "hidden";
163
- send({ type: isHidden ? "PAUSE_ALL" : "RESUME_ALL" });
164
- });
165
- }
166
- },
167
- actions: {
168
- setDismissableBranch({ refs, context, computed, scope }) {
169
- const toasts = context.get("toasts");
170
- const placement = computed("placement");
171
- const hasToasts = toasts.length > 0;
172
- if (!hasToasts) {
173
- refs.get("dismissableCleanup")?.();
174
- return;
175
- }
176
- if (hasToasts && refs.get("dismissableCleanup")) {
177
- return;
178
- }
179
- const groupEl = () => dom.getRegionEl(scope, placement);
180
- const cleanup = trackDismissableBranch(groupEl, { defer: true });
181
- refs.set("dismissableCleanup", cleanup);
182
- },
183
- clearDismissableBranch({ refs }) {
184
- refs.get("dismissableCleanup")?.();
185
- },
186
- focusRegionEl({ scope, computed }) {
187
- queueMicrotask(() => {
188
- dom.getRegionEl(scope, computed("placement"))?.focus();
189
- });
190
- },
191
- pauseToasts({ prop }) {
192
- prop("store").pause();
193
- },
194
- resumeToasts({ prop }) {
195
- prop("store").resume();
196
- },
197
- expandToasts({ prop }) {
198
- prop("store").expand();
199
- },
200
- collapseToasts({ prop }) {
201
- prop("store").collapse();
202
- },
203
- removeToast({ prop, event }) {
204
- prop("store").remove(event.id);
205
- },
206
- removeHeight({ event, context }) {
207
- if (event?.id == null) return;
208
- queueMicrotask(() => {
209
- context.set("heights", (heights) => heights.filter((height) => height.id !== event.id));
210
- });
211
- },
212
- collapsedIfEmpty({ send, computed }) {
213
- if (!computed("overlap") || computed("count") > 1) return;
214
- send({ type: "REGION.OVERLAP" });
215
- },
216
- setLastFocusedEl({ refs, event }) {
217
- if (refs.get("isFocusWithin") || !event.target) return;
218
- refs.set("isFocusWithin", true);
219
- refs.set("lastFocusedEl", event.target);
220
- },
221
- restoreFocusIfPointerOut({ refs }) {
222
- if (!refs.get("lastFocusedEl") || refs.get("isPointerWithin")) return;
223
- refs.get("lastFocusedEl")?.focus({ preventScroll: true });
224
- refs.set("lastFocusedEl", null);
225
- refs.set("isFocusWithin", false);
226
- },
227
- setPointerWithin({ refs }) {
228
- refs.set("isPointerWithin", true);
229
- },
230
- clearPointerWithin({ refs }) {
231
- refs.set("isPointerWithin", false);
232
- if (refs.get("lastFocusedEl") && !refs.get("isFocusWithin")) {
233
- refs.get("lastFocusedEl")?.focus({ preventScroll: true });
234
- refs.set("lastFocusedEl", null);
235
- }
236
- },
237
- clearFocusWithin({ refs }) {
238
- refs.set("isFocusWithin", false);
239
- },
240
- clearLastFocusedEl({ refs }) {
241
- if (!refs.get("lastFocusedEl")) return;
242
- refs.get("lastFocusedEl")?.focus({ preventScroll: true });
243
- refs.set("lastFocusedEl", null);
244
- refs.set("isFocusWithin", false);
245
- },
246
- ignoreMouseEventsTemporarily({ refs }) {
247
- refs.get("ignoreMouseTimer").request();
248
- },
249
- clearMouseEventTimer({ refs }) {
250
- refs.get("ignoreMouseTimer").cancel();
251
- }
252
- }
253
- }
6
+ // src/toast-group.machine.ts
7
+ const { guards, createMachine } = setup();
8
+ const { and } = guards;
9
+ const groupMachine = createMachine({
10
+ props({ props }) {
11
+ return {
12
+ dir: "ltr",
13
+ id: uuid(),
14
+ ...props,
15
+ store: props.store
16
+ };
17
+ },
18
+ initialState({ prop }) {
19
+ return prop("store").attrs.overlap ? "overlap" : "stack";
20
+ },
21
+ refs() {
22
+ return {
23
+ lastFocusedEl: null,
24
+ isFocusWithin: false,
25
+ isPointerWithin: false,
26
+ ignoreMouseTimer: AnimationFrame.create(),
27
+ dismissableCleanup: void 0
28
+ };
29
+ },
30
+ context({ bindable }) {
31
+ return {
32
+ toasts: bindable(() => ({
33
+ defaultValue: [],
34
+ sync: true,
35
+ hash: (toasts) => toasts.map((t) => t.id).join(",")
36
+ })),
37
+ heights: bindable(() => ({
38
+ defaultValue: [],
39
+ sync: true
40
+ }))
41
+ };
42
+ },
43
+ computed: {
44
+ count: ({ context }) => context.get("toasts").length,
45
+ overlap: ({ prop }) => prop("store").attrs.overlap,
46
+ placement: ({ prop }) => prop("store").attrs.placement
47
+ },
48
+ effects: [
49
+ "subscribeToStore",
50
+ "subscribeToLayout",
51
+ "trackDocumentVisibility",
52
+ "trackHotKeyPress"
53
+ ],
54
+ watch({ track, context, action }) {
55
+ track([() => context.hash("toasts")], () => {
56
+ queueMicrotask(() => {
57
+ action([
58
+ "collapsedIfEmpty",
59
+ "setDismissableBranch",
60
+ "resetInteractionIfEmpty"
61
+ ]);
62
+ });
63
+ });
64
+ },
65
+ exit: [
66
+ "clearDismissableBranch",
67
+ "clearLastFocusedEl",
68
+ "clearMouseEventTimer"
69
+ ],
70
+ on: {
71
+ PAUSE_ALL: { actions: ["pauseToasts"] },
72
+ RESUME_ALL: { actions: ["resumeToasts"] },
73
+ "DOC.HOTKEY": { actions: ["focusRegionEl"] },
74
+ "REGION.BLUR": [
75
+ {
76
+ guard: and("isOverlapping", "isPointerOut"),
77
+ target: "overlap",
78
+ actions: ["resumeToasts", "restoreFocusIfPointerOut"]
79
+ },
80
+ {
81
+ guard: "isPointerOut",
82
+ target: "stack",
83
+ actions: ["resumeToasts", "restoreFocusIfPointerOut"]
84
+ },
85
+ { actions: ["clearFocusWithin"] }
86
+ ],
87
+ "TOAST.DISMISS": { actions: ["moveFocusOnDismiss"] },
88
+ "TOAST.REMOVE": { actions: [
89
+ "removeToast",
90
+ "removeHeight",
91
+ "ignoreMouseEventsTemporarily"
92
+ ] },
93
+ "TOAST.PAUSE": { actions: ["pauseToasts"] },
94
+ "TOAST.SWIPE_END": { actions: ["resumeToasts"] }
95
+ },
96
+ states: {
97
+ stack: { on: {
98
+ "REGION.POINTER_LEAVE": [{
99
+ guard: "isOverlapping",
100
+ target: "overlap",
101
+ actions: ["clearPointerWithin", "resumeToasts"]
102
+ }, { actions: ["clearPointerWithin", "resumeToasts"] }],
103
+ "REGION.OVERLAP": { target: "overlap" },
104
+ "REGION.FOCUS": { actions: ["setLastFocusedEl", "pauseToasts"] },
105
+ "REGION.POINTER_ENTER": { actions: ["setPointerWithin", "pauseToasts"] }
106
+ } },
107
+ overlap: { on: {
108
+ "REGION.STACK": { target: "stack" },
109
+ "REGION.POINTER_ENTER": {
110
+ target: "stack",
111
+ actions: ["setPointerWithin", "pauseToasts"]
112
+ },
113
+ "REGION.POINTER_LEAVE": { actions: ["clearPointerWithin", "resumeToasts"] },
114
+ "REGION.FOCUS": {
115
+ target: "stack",
116
+ actions: ["setLastFocusedEl", "pauseToasts"]
117
+ }
118
+ } }
119
+ },
120
+ implementations: {
121
+ guards: {
122
+ isOverlapping: ({ computed }) => computed("overlap"),
123
+ isPointerOut: ({ refs }) => !refs.get("isPointerWithin")
124
+ },
125
+ effects: {
126
+ subscribeToStore({ context, prop }) {
127
+ const store = prop("store");
128
+ context.set("toasts", store.getVisibleToasts());
129
+ return store.subscribe((toast) => {
130
+ if (toast.dismiss) {
131
+ context.set("toasts", (prev) => prev.filter((t) => t.id !== toast.id));
132
+ return;
133
+ }
134
+ context.set("toasts", (prev) => {
135
+ const index = prev.findIndex((t) => t.id === toast.id);
136
+ if (index !== -1) return [
137
+ ...prev.slice(0, index),
138
+ {
139
+ ...prev[index],
140
+ ...toast
141
+ },
142
+ ...prev.slice(index + 1)
143
+ ];
144
+ return [toast, ...prev];
145
+ });
146
+ });
147
+ },
148
+ subscribeToLayout({ prop, send }) {
149
+ return prop("store").subscribeLayout((stacked) => {
150
+ send({ type: stacked ? "REGION.STACK" : "REGION.OVERLAP" });
151
+ });
152
+ },
153
+ trackHotKeyPress({ prop, send }) {
154
+ const handleKeyDown = (event) => {
155
+ const { hotkey } = prop("store").attrs;
156
+ if (!hotkey.every((key) => event[key] || event.code === key)) return;
157
+ send({ type: "DOC.HOTKEY" });
158
+ };
159
+ return addDomEvent(document, "keydown", handleKeyDown, { capture: true });
160
+ },
161
+ trackDocumentVisibility({ prop, send, scope }) {
162
+ const { pauseOnPageIdle } = prop("store").attrs;
163
+ if (!pauseOnPageIdle) return;
164
+ const doc = scope.getDoc();
165
+ if (doc.visibilityState === "hidden") send({ type: "PAUSE_ALL" });
166
+ return addDomEvent(doc, "visibilitychange", () => {
167
+ send({ type: doc.visibilityState === "hidden" ? "PAUSE_ALL" : "RESUME_ALL" });
168
+ });
169
+ }
170
+ },
171
+ actions: {
172
+ setDismissableBranch({ refs, context, computed, scope }) {
173
+ const toasts = context.get("toasts");
174
+ const placement = computed("placement");
175
+ const hasToasts = toasts.length > 0;
176
+ if (!hasToasts) {
177
+ refs.get("dismissableCleanup")?.();
178
+ refs.set("dismissableCleanup", void 0);
179
+ return;
180
+ }
181
+ if (hasToasts && refs.get("dismissableCleanup")) return;
182
+ const groupEl = () => getRegionEl(scope, placement);
183
+ const cleanup = trackDismissableBranch(groupEl, {
184
+ defer: true,
185
+ getRootNode: scope.getRootNode
186
+ });
187
+ refs.set("dismissableCleanup", cleanup);
188
+ },
189
+ clearDismissableBranch({ refs }) {
190
+ refs.get("dismissableCleanup")?.();
191
+ refs.set("dismissableCleanup", void 0);
192
+ },
193
+ focusRegionEl({ scope, computed }) {
194
+ queueMicrotask(() => {
195
+ getRegionEl(scope, computed("placement"))?.focus();
196
+ });
197
+ },
198
+ pauseToasts({ prop }) {
199
+ prop("store").pause();
200
+ },
201
+ resumeToasts({ prop, refs, scope, event }) {
202
+ if (event.type === "REGION.BLUR") refs.set("isFocusWithin", false);
203
+ if (prop("store").attrs.pauseOnPageIdle && scope.getDoc().visibilityState === "hidden" || refs.get("isPointerWithin") || refs.get("isFocusWithin")) return;
204
+ prop("store").resume();
205
+ },
206
+ removeToast({ prop, event }) {
207
+ prop("store").remove(event.id);
208
+ },
209
+ removeHeight({ event, context }) {
210
+ if (event?.id == null) return;
211
+ queueMicrotask(() => {
212
+ context.set("heights", (heights) => heights.filter((height) => height.id !== event.id));
213
+ });
214
+ },
215
+ collapsedIfEmpty({ send, computed }) {
216
+ if (!computed("overlap") || computed("count") > 1) return;
217
+ send({ type: "REGION.OVERLAP" });
218
+ },
219
+ setLastFocusedEl({ refs, event }) {
220
+ if (refs.get("isFocusWithin")) return;
221
+ refs.set("isFocusWithin", true);
222
+ refs.set("lastFocusedEl", event.target ?? null);
223
+ },
224
+ moveFocusOnDismiss({ refs, scope, computed, event }) {
225
+ if (event.focusVisible) {
226
+ const toastEls = getToastEls(scope, computed("placement"));
227
+ const index = toastEls.findIndex((el) => contains(el, scope.getActiveElement()));
228
+ const nextEl = findOpenToast(toastEls, index + 1, 1) ?? findOpenToast(toastEls, index - 1, -1);
229
+ if (nextEl) {
230
+ nextEl.focus({ preventScroll: true });
231
+ return;
232
+ }
233
+ }
234
+ const lastFocusedEl = refs.get("lastFocusedEl");
235
+ if (event.focusVisible && lastFocusedEl) lastFocusedEl.focus({ preventScroll: true });
236
+ else scope.getActiveElement()?.blur();
237
+ },
238
+ resetInteractionIfEmpty({ refs, prop, scope, computed }) {
239
+ if (computed("count") > 0) return;
240
+ refs.set("isFocusWithin", false);
241
+ refs.set("isPointerWithin", false);
242
+ refs.set("lastFocusedEl", null);
243
+ if (!(prop("store").attrs.pauseOnPageIdle && scope.getDoc().visibilityState === "hidden")) prop("store").resume();
244
+ },
245
+ restoreFocusIfPointerOut({ refs }) {
246
+ if (!refs.get("lastFocusedEl") || refs.get("isPointerWithin")) return;
247
+ refs.get("lastFocusedEl")?.focus({ preventScroll: true });
248
+ refs.set("lastFocusedEl", null);
249
+ refs.set("isFocusWithin", false);
250
+ },
251
+ setPointerWithin({ refs }) {
252
+ refs.set("isPointerWithin", true);
253
+ },
254
+ clearPointerWithin({ refs }) {
255
+ refs.set("isPointerWithin", false);
256
+ if (refs.get("lastFocusedEl") && !refs.get("isFocusWithin")) {
257
+ refs.get("lastFocusedEl")?.focus({ preventScroll: true });
258
+ refs.set("lastFocusedEl", null);
259
+ }
260
+ },
261
+ clearFocusWithin({ refs }) {
262
+ refs.set("isFocusWithin", false);
263
+ },
264
+ clearLastFocusedEl({ refs }) {
265
+ if (!refs.get("lastFocusedEl")) return;
266
+ refs.get("lastFocusedEl")?.focus({ preventScroll: true });
267
+ refs.set("lastFocusedEl", null);
268
+ refs.set("isFocusWithin", false);
269
+ },
270
+ ignoreMouseEventsTemporarily({ refs, scope, computed, send }) {
271
+ refs.get("ignoreMouseTimer").request(() => {
272
+ return addDomEvent(scope.getDoc(), "pointermove", (event) => {
273
+ if (!refs.get("isPointerWithin")) return;
274
+ const regionEl = getRegionEl(scope, computed("placement"));
275
+ if (contains(regionEl, getEventTarget(event))) return;
276
+ send({
277
+ type: "REGION.POINTER_LEAVE",
278
+ placement: computed("placement")
279
+ });
280
+ }, { once: true });
281
+ });
282
+ },
283
+ clearMouseEventTimer({ refs }) {
284
+ refs.get("ignoreMouseTimer").cancel();
285
+ }
286
+ }
287
+ }
254
288
  });
255
- export {
256
- groupMachine
257
- };
289
+ function findOpenToast(toastEls, from, step) {
290
+ for (let i = from; i >= 0 && i < toastEls.length; i += step) if (toastEls[i].dataset.state === "open") return toastEls[i];
291
+ return null;
292
+ }
293
+ export { groupMachine };
@@ -1,6 +1,2 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
-
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger">;
4
- declare const parts: Record<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
5
-
6
- export { anatomy, parts };
1
+ export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"actionTrigger" | "closeTrigger" | "content" | "description" | "group" | "root" | "title">;
2
+ export declare const parts: Record<"actionTrigger" | "closeTrigger" | "content" | "description" | "group" | "root" | "title", import("@zag-js/anatomy").AnatomyPart>;
@@ -1,6 +1,2 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
-
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger">;
4
- declare const parts: Record<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
5
-
6
- export { anatomy, parts };
1
+ export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"actionTrigger" | "closeTrigger" | "content" | "description" | "group" | "root" | "title">;
2
+ export declare const parts: Record<"actionTrigger" | "closeTrigger" | "content" | "description" | "group" | "root" | "title", import("@zag-js/anatomy").AnatomyPart>;
@@ -1,41 +1,9 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/toast.anatomy.ts
21
- var toast_anatomy_exports = {};
22
- __export(toast_anatomy_exports, {
23
- anatomy: () => anatomy,
24
- parts: () => parts
25
- });
26
- module.exports = __toCommonJS(toast_anatomy_exports);
27
- var import_anatomy = require("@zag-js/anatomy");
28
- var anatomy = (0, import_anatomy.createAnatomy)("toast").parts(
29
- "group",
30
- "root",
31
- "title",
32
- "description",
33
- "actionTrigger",
34
- "closeTrigger"
35
- );
36
- var parts = anatomy.build();
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- anatomy,
40
- parts
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
41
4
  });
5
+ // src/toast.anatomy.ts
6
+ const anatomy = (0, require("@zag-js/anatomy").createAnatomy)("toast").parts("group", "root", "content", "title", "description", "actionTrigger", "closeTrigger");
7
+ const parts = anatomy.build();
8
+ exports.anatomy = anatomy;
9
+ exports.parts = parts;