@zag-js/toast 0.2.5 → 0.2.7
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/chunk-2E56V7D3.mjs +104 -0
- package/dist/chunk-6MVNQK7B.mjs +144 -0
- package/dist/chunk-GQHI2OMI.mjs +9 -0
- package/dist/chunk-IEPKBUZZ.mjs +116 -0
- package/dist/chunk-KHVXQ4ZE.mjs +75 -0
- package/dist/chunk-LOJTIJID.mjs +66 -0
- package/dist/chunk-YVNTR4MK.mjs +202 -0
- package/dist/chunk-YVYADWQR.mjs +19 -0
- package/dist/index.d.ts +11 -1043
- package/dist/index.js +44 -32
- package/dist/index.mjs +23 -656
- package/dist/toast-group.connect.d.ts +28 -0
- package/dist/toast-group.connect.js +296 -0
- package/dist/toast-group.connect.mjs +12 -0
- package/dist/toast-group.machine.d.ts +7 -0
- package/dist/toast-group.machine.js +401 -0
- package/dist/toast-group.machine.mjs +10 -0
- package/dist/toast.anatomy.d.ts +6 -0
- package/dist/toast.anatomy.js +34 -0
- package/dist/toast.anatomy.mjs +8 -0
- package/dist/toast.connect.d.ts +23 -0
- package/dist/toast.connect.js +212 -0
- package/dist/toast.connect.mjs +8 -0
- package/dist/toast.dom.d.ts +36 -0
- package/dist/toast.dom.js +101 -0
- package/dist/toast.dom.mjs +6 -0
- package/dist/toast.machine.d.ts +7 -0
- package/dist/toast.machine.js +305 -0
- package/dist/toast.machine.mjs +9 -0
- package/dist/toast.types.d.ts +150 -0
- package/dist/toast.types.js +18 -0
- package/dist/toast.types.mjs +0 -0
- package/dist/toast.utils.d.ts +10 -0
- package/dist/toast.utils.js +93 -0
- package/dist/toast.utils.mjs +12 -0
- package/package.json +21 -11
package/dist/index.js
CHANGED
|
@@ -28,18 +28,55 @@ __export(src_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(src_exports);
|
|
30
30
|
|
|
31
|
-
// ../../utilities/dom/
|
|
31
|
+
// ../../utilities/dom/src/attrs.ts
|
|
32
32
|
var dataAttr = (guard) => {
|
|
33
33
|
return guard ? "" : void 0;
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
// ../../utilities/dom/src/constants.ts
|
|
35
37
|
var MAX_Z_INDEX = 2147483647;
|
|
38
|
+
|
|
39
|
+
// ../../utilities/core/src/functions.ts
|
|
36
40
|
var runIfFn = (v, ...a) => {
|
|
37
41
|
const res = typeof v === "function" ? v(...a) : v;
|
|
38
42
|
return res != null ? res : void 0;
|
|
39
43
|
};
|
|
40
44
|
var cast = (v) => v;
|
|
45
|
+
var uuid = /* @__PURE__ */ (() => {
|
|
46
|
+
let id = 0;
|
|
47
|
+
return () => {
|
|
48
|
+
id++;
|
|
49
|
+
return id.toString(36);
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
|
|
53
|
+
// ../../utilities/core/src/guard.ts
|
|
54
|
+
var isArray = (v) => Array.isArray(v);
|
|
55
|
+
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
41
56
|
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
57
|
+
|
|
58
|
+
// ../../utilities/core/src/object.ts
|
|
59
|
+
function compact(obj) {
|
|
60
|
+
if (obj === void 0)
|
|
61
|
+
return obj;
|
|
62
|
+
return Object.fromEntries(
|
|
63
|
+
Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ../../utilities/core/src/warning.ts
|
|
68
|
+
function warn(...a) {
|
|
69
|
+
const m = a.length === 1 ? a[0] : a[1];
|
|
70
|
+
const c = a.length === 2 ? a[0] : true;
|
|
71
|
+
if (c && process.env.NODE_ENV !== "production") {
|
|
72
|
+
console.warn(m);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ../../utilities/dom/src/platform.ts
|
|
42
77
|
var isDom = () => typeof window !== "undefined";
|
|
78
|
+
|
|
79
|
+
// ../../utilities/dom/src/query.ts
|
|
43
80
|
function isDocument(el) {
|
|
44
81
|
return el.nodeType === Node.DOCUMENT_NODE;
|
|
45
82
|
}
|
|
@@ -91,6 +128,8 @@ function defineDomHelpers(helpers) {
|
|
|
91
128
|
...helpers
|
|
92
129
|
};
|
|
93
130
|
}
|
|
131
|
+
|
|
132
|
+
// ../../utilities/dom/src/listener.ts
|
|
94
133
|
var isRef = (v) => hasProp(v, "current");
|
|
95
134
|
function addDomEvent(target, eventName, handler, options) {
|
|
96
135
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
@@ -99,6 +138,8 @@ function addDomEvent(target, eventName, handler, options) {
|
|
|
99
138
|
node == null ? void 0 : node.removeEventListener(eventName, handler, options);
|
|
100
139
|
};
|
|
101
140
|
}
|
|
141
|
+
|
|
142
|
+
// ../../utilities/dom/src/visibility-event.ts
|
|
102
143
|
function trackDocumentVisibility(_doc, callback) {
|
|
103
144
|
const doc = cast(_doc);
|
|
104
145
|
return addDomEvent(doc, "visibilitychange", () => {
|
|
@@ -107,35 +148,6 @@ function trackDocumentVisibility(_doc, callback) {
|
|
|
107
148
|
});
|
|
108
149
|
}
|
|
109
150
|
|
|
110
|
-
// ../../utilities/core/dist/index.mjs
|
|
111
|
-
var runIfFn2 = (v, ...a) => {
|
|
112
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
113
|
-
return res != null ? res : void 0;
|
|
114
|
-
};
|
|
115
|
-
var uuid = /* @__PURE__ */ (() => {
|
|
116
|
-
let id = 0;
|
|
117
|
-
return () => {
|
|
118
|
-
id++;
|
|
119
|
-
return id.toString(36);
|
|
120
|
-
};
|
|
121
|
-
})();
|
|
122
|
-
var isArray = (v) => Array.isArray(v);
|
|
123
|
-
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
124
|
-
function compact(obj) {
|
|
125
|
-
if (obj === void 0)
|
|
126
|
-
return obj;
|
|
127
|
-
return Object.fromEntries(
|
|
128
|
-
Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
function warn(...a) {
|
|
132
|
-
const m = a.length === 1 ? a[0] : a[1];
|
|
133
|
-
const c = a.length === 2 ? a[0] : true;
|
|
134
|
-
if (c && process.env.NODE_ENV !== "production") {
|
|
135
|
-
console.warn(m);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
151
|
// src/toast-group.connect.ts
|
|
140
152
|
var import_core = require("@zag-js/core");
|
|
141
153
|
|
|
@@ -293,10 +305,10 @@ function groupConnect(state, send, normalize) {
|
|
|
293
305
|
promise(promise, options, shared = {}) {
|
|
294
306
|
const id = group2.loading({ ...shared, ...options.loading });
|
|
295
307
|
promise.then((response) => {
|
|
296
|
-
const successOptions =
|
|
308
|
+
const successOptions = runIfFn(options.success, response);
|
|
297
309
|
group2.success({ ...shared, ...successOptions, id });
|
|
298
310
|
}).catch((error) => {
|
|
299
|
-
const errorOptions =
|
|
311
|
+
const errorOptions = runIfFn(options.error, error);
|
|
300
312
|
group2.error({ ...shared, ...errorOptions, id });
|
|
301
313
|
});
|
|
302
314
|
return promise;
|