@solid2-aria/sonner 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/NOTICE.txt +27 -0
- package/README.md +75 -2
- package/SOLID-SONNER-LICENSE.md +21 -0
- package/SONNER-LICENSE.md +21 -0
- package/dist/browser/index.d.ts +219 -0
- package/dist/browser/index.js +1375 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/server/index.js +1682 -0
- package/dist/server/index.js.map +1 -0
- package/dist/styles.css +784 -0
- package/package.json +69 -4
|
@@ -0,0 +1,1682 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Derived from solid-sonner (https://github.com/wobsoriano/solid-sonner), src/.
|
|
3
|
+
* Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
4
|
+
* Derived from Sonner (https://github.com/emilkowalski/sonner), src/.
|
|
5
|
+
* Copyright (c) 2023 Emil Kowalski
|
|
6
|
+
* Modified for Solid Aria: Solid 2 reactivity, rendering, lifecycle, and packaging.
|
|
7
|
+
* MIT licensed. See LICENSE, SOLID-SONNER-LICENSE.md, SONNER-LICENSE.md, and NOTICE.txt in the package root.
|
|
8
|
+
*/
|
|
9
|
+
import { escape, memo, scope, ssr, ssrAttribute, ssrClassName, ssrGroup, ssrHydrationKey, ssrStyle } from "@solidjs/web";
|
|
10
|
+
import { For, Show, createEffect, createMemo, createRenderEffect, createSignal, createStore, merge, onCleanup, onSettled, untrack } from "solid-js";
|
|
11
|
+
// src/assets.tsx
|
|
12
|
+
var _tmpl$$1 = [
|
|
13
|
+
"<div",
|
|
14
|
+
"",
|
|
15
|
+
"",
|
|
16
|
+
"><div class=\"sonner-spinner\">",
|
|
17
|
+
"</div></div>"
|
|
18
|
+
];
|
|
19
|
+
var _tmpl$2$1 = [
|
|
20
|
+
"<div",
|
|
21
|
+
" class=\"sonner-loading-bar\"",
|
|
22
|
+
"></div>"
|
|
23
|
+
];
|
|
24
|
+
var _tmpl$3$1 = ["<svg", " aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" height=\"20\" width=\"20\"><path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\" clip-rule=\"evenodd\"></path></svg>"];
|
|
25
|
+
var _tmpl$4$1 = ["<svg", " aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" height=\"20\" width=\"20\"><path fill-rule=\"evenodd\" d=\"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z\" clip-rule=\"evenodd\"></path></svg>"];
|
|
26
|
+
var _tmpl$5$1 = ["<svg", " aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" height=\"20\" width=\"20\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z\" clip-rule=\"evenodd\"></path></svg>"];
|
|
27
|
+
var _tmpl$6$1 = ["<svg", " aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" height=\"20\" width=\"20\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>"];
|
|
28
|
+
var _tmpl$7$1 = ["<svg", " aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line></svg>"];
|
|
29
|
+
/*!
|
|
30
|
+
* Derived from solid-sonner (https://github.com/wobsoriano/solid-sonner), src/assets.tsx.
|
|
31
|
+
* Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
32
|
+
* Derived from Sonner (https://github.com/emilkowalski/sonner), src/assets.tsx.
|
|
33
|
+
* Copyright (c) 2023 Emil Kowalski
|
|
34
|
+
* Modified for Solid Aria: Solid 2 types, reactivity, lifecycle, and package integration.
|
|
35
|
+
* MIT licensed. See LICENSE, SOLID-SONNER-LICENSE.md, SONNER-LICENSE.md, and NOTICE.txt in the package root.
|
|
36
|
+
*/
|
|
37
|
+
const bars = Array.from({ length: 12 }, () => 0);
|
|
38
|
+
function Loader(props) {
|
|
39
|
+
var _v$ = ssrHydrationKey(), _g$ = ssrGroup(() => {
|
|
40
|
+
return [((_v$2) => _v$2 == null ? "" : ssrAttribute("class", ssrClassName(_v$2)))(["sonner-loading-wrapper", props.class ?? props.className]), ssrAttribute("data-visible", escape(String(props.visible), true))];
|
|
41
|
+
}, 2), _v$5 = escape(For({
|
|
42
|
+
each: bars,
|
|
43
|
+
keyed: false,
|
|
44
|
+
children: (_, i) => {
|
|
45
|
+
var _v$6 = ssrHydrationKey();
|
|
46
|
+
return ssr(_tmpl$2$1, _v$6, ssrAttribute("data-index", escape(i, true)));
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
return ssr(_tmpl$$1, _v$, _g$, _g$, _v$5);
|
|
50
|
+
}
|
|
51
|
+
function SuccessIcon() {
|
|
52
|
+
var _v$7 = ssrHydrationKey();
|
|
53
|
+
return ssr(_tmpl$3$1, _v$7);
|
|
54
|
+
}
|
|
55
|
+
function WarningIcon() {
|
|
56
|
+
var _v$8 = ssrHydrationKey();
|
|
57
|
+
return ssr(_tmpl$4$1, _v$8);
|
|
58
|
+
}
|
|
59
|
+
function InfoIcon() {
|
|
60
|
+
var _v$9 = ssrHydrationKey();
|
|
61
|
+
return ssr(_tmpl$5$1, _v$9);
|
|
62
|
+
}
|
|
63
|
+
function ErrorIcon() {
|
|
64
|
+
var _v$10 = ssrHydrationKey();
|
|
65
|
+
return ssr(_tmpl$6$1, _v$10);
|
|
66
|
+
}
|
|
67
|
+
function getAsset(type) {
|
|
68
|
+
switch (type) {
|
|
69
|
+
case "success": return SuccessIcon({});
|
|
70
|
+
case "info": return InfoIcon({});
|
|
71
|
+
case "warning": return WarningIcon({});
|
|
72
|
+
case "error": return ErrorIcon({});
|
|
73
|
+
case void 0:
|
|
74
|
+
case "action":
|
|
75
|
+
case "default":
|
|
76
|
+
case "loading":
|
|
77
|
+
case "normal": return null;
|
|
78
|
+
default: return type;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function CloseIcon() {
|
|
82
|
+
var _v$11 = ssrHydrationKey();
|
|
83
|
+
return ssr(_tmpl$7$1, _v$11);
|
|
84
|
+
}
|
|
85
|
+
// src/primitives.ts
|
|
86
|
+
/*!
|
|
87
|
+
* Derived from solid-sonner (https://github.com/wobsoriano/solid-sonner), src/primitives.ts.
|
|
88
|
+
* Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
89
|
+
* Modified for Solid Aria: Solid 2 types, reactivity, lifecycle, and package integration.
|
|
90
|
+
* MIT licensed. See LICENSE, SOLID-SONNER-LICENSE.md, SONNER-LICENSE.md, and NOTICE.txt in the package root.
|
|
91
|
+
*/
|
|
92
|
+
function createIsDocumentHidden() {
|
|
93
|
+
const [isDocumentHidden, setIsDocumentHidden] = createSignal(globalThis.document?.hidden ?? false);
|
|
94
|
+
const callback = () => {
|
|
95
|
+
setIsDocumentHidden(document.hidden);
|
|
96
|
+
};
|
|
97
|
+
onSettled(() => {
|
|
98
|
+
document.addEventListener("visibilitychange", callback);
|
|
99
|
+
return () => {
|
|
100
|
+
document.removeEventListener("visibilitychange", callback);
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
return isDocumentHidden;
|
|
104
|
+
}
|
|
105
|
+
// src/state.ts
|
|
106
|
+
/*!
|
|
107
|
+
* Derived from solid-sonner (https://github.com/wobsoriano/solid-sonner), src/state.ts.
|
|
108
|
+
* Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
109
|
+
* Derived from Sonner (https://github.com/emilkowalski/sonner), src/state.ts.
|
|
110
|
+
* Copyright (c) 2023 Emil Kowalski
|
|
111
|
+
* Modified for Solid Aria: Solid 2 types, reactivity, lifecycle, and package integration.
|
|
112
|
+
* MIT licensed. See LICENSE, SOLID-SONNER-LICENSE.md, SONNER-LICENSE.md, and NOTICE.txt in the package root.
|
|
113
|
+
*/
|
|
114
|
+
let toastsCounter = 1;
|
|
115
|
+
const MAX_HISTORY_SIZE = 100;
|
|
116
|
+
function getToastId(data) {
|
|
117
|
+
if (data?.id !== void 0 && data.id !== "") return data.id;
|
|
118
|
+
const id = toastsCounter;
|
|
119
|
+
toastsCounter += 1;
|
|
120
|
+
return id;
|
|
121
|
+
}
|
|
122
|
+
function isHttpResponse(data) {
|
|
123
|
+
return typeof data === "object" && data !== null && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
124
|
+
}
|
|
125
|
+
function getPromiseSettings(value) {
|
|
126
|
+
return typeof value === "object" && value !== null && "message" in value ? value : { message: value };
|
|
127
|
+
}
|
|
128
|
+
function isValidElement(value) {
|
|
129
|
+
return globalThis.Node !== void 0 && value instanceof Node;
|
|
130
|
+
}
|
|
131
|
+
var Observer = class {
|
|
132
|
+
subscribers;
|
|
133
|
+
toasts;
|
|
134
|
+
dismissedToasts;
|
|
135
|
+
pendingDismissals;
|
|
136
|
+
constructor() {
|
|
137
|
+
this.subscribers = [];
|
|
138
|
+
this.toasts = [];
|
|
139
|
+
this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
140
|
+
this.pendingDismissals = /* @__PURE__ */ new Map();
|
|
141
|
+
}
|
|
142
|
+
subscribe = (subscriber) => {
|
|
143
|
+
this.subscribers.push(subscriber);
|
|
144
|
+
for (const activeToast of this.getActiveToasts()) subscriber(activeToast);
|
|
145
|
+
return () => {
|
|
146
|
+
const index = this.subscribers.indexOf(subscriber);
|
|
147
|
+
this.subscribers.splice(index, 1);
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
publish = (data) => {
|
|
151
|
+
for (const subscriber of this.subscribers) subscriber(data);
|
|
152
|
+
};
|
|
153
|
+
addToast = (data) => {
|
|
154
|
+
this.publish(data);
|
|
155
|
+
this.toasts = [...this.toasts, data];
|
|
156
|
+
this.trimHistory();
|
|
157
|
+
};
|
|
158
|
+
trimHistory = () => {
|
|
159
|
+
let toRemove = this.toasts.length - MAX_HISTORY_SIZE;
|
|
160
|
+
if (toRemove <= 0) return;
|
|
161
|
+
this.toasts = this.toasts.filter((toast) => {
|
|
162
|
+
if (toRemove > 0 && this.dismissedToasts.has(toast.id)) {
|
|
163
|
+
this.dismissedToasts.delete(toast.id);
|
|
164
|
+
toRemove -= 1;
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
create = (data) => {
|
|
171
|
+
const { message, ...rest } = data;
|
|
172
|
+
const id = getToastId(data);
|
|
173
|
+
const pendingDismissal = this.pendingDismissals.get(id);
|
|
174
|
+
if (pendingDismissal !== void 0) {
|
|
175
|
+
cancelAnimationFrame(pendingDismissal);
|
|
176
|
+
this.pendingDismissals.delete(id);
|
|
177
|
+
this.dismissedToasts.delete(id);
|
|
178
|
+
}
|
|
179
|
+
const wasDismissed = this.dismissedToasts.has(id);
|
|
180
|
+
const dismissible = data.dismissible ?? true;
|
|
181
|
+
if (wasDismissed) {
|
|
182
|
+
this.dismissedToasts.delete(id);
|
|
183
|
+
this.toasts = this.toasts.filter((toast) => toast.id !== id);
|
|
184
|
+
}
|
|
185
|
+
if (wasDismissed ? void 0 : this.toasts.find((toast) => toast.id === id)) this.toasts = this.toasts.map((toast) => {
|
|
186
|
+
if (toast.id === id) {
|
|
187
|
+
this.publish({
|
|
188
|
+
...toast,
|
|
189
|
+
...data,
|
|
190
|
+
dismissible,
|
|
191
|
+
id,
|
|
192
|
+
title: message
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
...toast,
|
|
196
|
+
...data,
|
|
197
|
+
dismissible,
|
|
198
|
+
id,
|
|
199
|
+
title: message
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return toast;
|
|
203
|
+
});
|
|
204
|
+
else this.addToast({
|
|
205
|
+
title: message,
|
|
206
|
+
...rest,
|
|
207
|
+
dismissible,
|
|
208
|
+
id
|
|
209
|
+
});
|
|
210
|
+
return id;
|
|
211
|
+
};
|
|
212
|
+
dismiss = (id) => {
|
|
213
|
+
if (id === void 0 || id === null) {
|
|
214
|
+
for (const activeToast of this.getActiveToasts()) {
|
|
215
|
+
this.dismissedToasts.add(activeToast.id);
|
|
216
|
+
for (const subscriber of this.subscribers) subscriber({
|
|
217
|
+
dismiss: true,
|
|
218
|
+
id: activeToast.id
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return id;
|
|
222
|
+
}
|
|
223
|
+
this.dismissedToasts.add(id);
|
|
224
|
+
const alreadyPending = this.pendingDismissals.get(id);
|
|
225
|
+
if (alreadyPending !== void 0) cancelAnimationFrame(alreadyPending);
|
|
226
|
+
this.pendingDismissals.set(id, requestAnimationFrame(() => {
|
|
227
|
+
this.pendingDismissals.delete(id);
|
|
228
|
+
for (const subscriber of this.subscribers) subscriber({
|
|
229
|
+
dismiss: true,
|
|
230
|
+
id
|
|
231
|
+
});
|
|
232
|
+
}));
|
|
233
|
+
return id;
|
|
234
|
+
};
|
|
235
|
+
message = (message, data) => this.create({
|
|
236
|
+
...data,
|
|
237
|
+
message,
|
|
238
|
+
type: void 0
|
|
239
|
+
});
|
|
240
|
+
error = (message, data) => this.create({
|
|
241
|
+
...data,
|
|
242
|
+
message,
|
|
243
|
+
type: "error"
|
|
244
|
+
});
|
|
245
|
+
success = (message, data) => this.create({
|
|
246
|
+
...data,
|
|
247
|
+
message,
|
|
248
|
+
type: "success"
|
|
249
|
+
});
|
|
250
|
+
info = (message, data) => this.create({
|
|
251
|
+
...data,
|
|
252
|
+
message,
|
|
253
|
+
type: "info"
|
|
254
|
+
});
|
|
255
|
+
warning = (message, data) => this.create({
|
|
256
|
+
...data,
|
|
257
|
+
message,
|
|
258
|
+
type: "warning"
|
|
259
|
+
});
|
|
260
|
+
loading = (message, data) => this.create({
|
|
261
|
+
...data,
|
|
262
|
+
message,
|
|
263
|
+
type: "loading"
|
|
264
|
+
});
|
|
265
|
+
promise = (promise, data) => {
|
|
266
|
+
if (!data) return;
|
|
267
|
+
let id;
|
|
268
|
+
if (data.loading !== void 0) id = this.create({
|
|
269
|
+
...data,
|
|
270
|
+
description: typeof data.description === "function" ? void 0 : data.description,
|
|
271
|
+
message: data.loading,
|
|
272
|
+
promise,
|
|
273
|
+
type: "loading"
|
|
274
|
+
});
|
|
275
|
+
const { finally: onFinally } = data;
|
|
276
|
+
const pending = Promise.resolve(typeof promise === "function" ? promise() : promise);
|
|
277
|
+
let shouldDismiss = id !== void 0;
|
|
278
|
+
const originalPromise = (async () => {
|
|
279
|
+
let result;
|
|
280
|
+
try {
|
|
281
|
+
const response = await pending;
|
|
282
|
+
result = ["resolve", response];
|
|
283
|
+
if (isValidElement(response)) {
|
|
284
|
+
shouldDismiss = false;
|
|
285
|
+
this.create({
|
|
286
|
+
id,
|
|
287
|
+
message: response,
|
|
288
|
+
type: "default"
|
|
289
|
+
});
|
|
290
|
+
} else if (isHttpResponse(response) && !response.ok) {
|
|
291
|
+
shouldDismiss = false;
|
|
292
|
+
const error = `HTTP error! status: ${response.status}`;
|
|
293
|
+
const message = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
294
|
+
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
295
|
+
this.create({
|
|
296
|
+
description,
|
|
297
|
+
id,
|
|
298
|
+
type: "error",
|
|
299
|
+
...getPromiseSettings(message)
|
|
300
|
+
});
|
|
301
|
+
} else if (response instanceof Error) {
|
|
302
|
+
shouldDismiss = false;
|
|
303
|
+
const message = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
304
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
305
|
+
this.create({
|
|
306
|
+
description,
|
|
307
|
+
id,
|
|
308
|
+
type: "error",
|
|
309
|
+
...getPromiseSettings(message)
|
|
310
|
+
});
|
|
311
|
+
} else if (data.success !== void 0) {
|
|
312
|
+
shouldDismiss = false;
|
|
313
|
+
const message = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
314
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
315
|
+
this.create({
|
|
316
|
+
description,
|
|
317
|
+
id,
|
|
318
|
+
type: "success",
|
|
319
|
+
...getPromiseSettings(message)
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
} catch (error) {
|
|
323
|
+
result = ["reject", error];
|
|
324
|
+
if (data.error !== void 0) {
|
|
325
|
+
shouldDismiss = false;
|
|
326
|
+
const message = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
327
|
+
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
328
|
+
this.create({
|
|
329
|
+
description,
|
|
330
|
+
id,
|
|
331
|
+
type: "error",
|
|
332
|
+
...getPromiseSettings(message)
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
} finally {
|
|
336
|
+
if (shouldDismiss) {
|
|
337
|
+
this.dismiss(id);
|
|
338
|
+
id = void 0;
|
|
339
|
+
}
|
|
340
|
+
onFinally?.();
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
})();
|
|
344
|
+
const unwrap = async () => {
|
|
345
|
+
const result = await originalPromise;
|
|
346
|
+
if (result[0] === "reject") throw result[1];
|
|
347
|
+
return result[1];
|
|
348
|
+
};
|
|
349
|
+
if (id === void 0) return { unwrap };
|
|
350
|
+
return Object.assign(id, { unwrap });
|
|
351
|
+
};
|
|
352
|
+
custom = (jsx, data) => {
|
|
353
|
+
const id = getToastId(data);
|
|
354
|
+
this.create({
|
|
355
|
+
...data,
|
|
356
|
+
id,
|
|
357
|
+
jsx: jsx(id),
|
|
358
|
+
type: void 0
|
|
359
|
+
});
|
|
360
|
+
return id;
|
|
361
|
+
};
|
|
362
|
+
getActiveToasts = () => this.toasts.filter((toast) => !this.dismissedToasts.has(toast.id));
|
|
363
|
+
};
|
|
364
|
+
const ToastState = new Observer();
|
|
365
|
+
function toastFunction(message, data) {
|
|
366
|
+
return ToastState.message(message, data);
|
|
367
|
+
}
|
|
368
|
+
const basicToast = toastFunction;
|
|
369
|
+
const getHistory = () => ToastState.toasts;
|
|
370
|
+
const getToasts = () => ToastState.getActiveToasts();
|
|
371
|
+
const toast = Object.assign(basicToast, {
|
|
372
|
+
custom: ToastState.custom,
|
|
373
|
+
dismiss: ToastState.dismiss,
|
|
374
|
+
error: ToastState.error,
|
|
375
|
+
info: ToastState.info,
|
|
376
|
+
loading: ToastState.loading,
|
|
377
|
+
message: ToastState.message,
|
|
378
|
+
promise: ToastState.promise,
|
|
379
|
+
success: ToastState.success,
|
|
380
|
+
warning: ToastState.warning
|
|
381
|
+
}, {
|
|
382
|
+
getHistory,
|
|
383
|
+
getToasts
|
|
384
|
+
});
|
|
385
|
+
// src/types.ts
|
|
386
|
+
/*!
|
|
387
|
+
* Derived from solid-sonner (https://github.com/wobsoriano/solid-sonner), src/types.ts.
|
|
388
|
+
* Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
389
|
+
* Derived from Sonner (https://github.com/emilkowalski/sonner), src/types.ts.
|
|
390
|
+
* Copyright (c) 2023 Emil Kowalski
|
|
391
|
+
* Modified for Solid Aria: Solid 2 types, reactivity, lifecycle, and package integration.
|
|
392
|
+
* MIT licensed. See LICENSE, SOLID-SONNER-LICENSE.md, SONNER-LICENSE.md, and NOTICE.txt in the package root.
|
|
393
|
+
*/
|
|
394
|
+
function isAction(action) {
|
|
395
|
+
return typeof action === "object" && action !== null && "label" in action;
|
|
396
|
+
}
|
|
397
|
+
// src/index.tsx
|
|
398
|
+
var _tmpl$ = [
|
|
399
|
+
"<button",
|
|
400
|
+
" data-button",
|
|
401
|
+
"",
|
|
402
|
+
"",
|
|
403
|
+
"",
|
|
404
|
+
">",
|
|
405
|
+
"</button>"
|
|
406
|
+
];
|
|
407
|
+
var _tmpl$2 = [
|
|
408
|
+
"<button",
|
|
409
|
+
"",
|
|
410
|
+
"",
|
|
411
|
+
" data-close-button",
|
|
412
|
+
">",
|
|
413
|
+
"</button>"
|
|
414
|
+
];
|
|
415
|
+
var _tmpl$3 = [
|
|
416
|
+
"<div",
|
|
417
|
+
" data-icon",
|
|
418
|
+
"><!--$-->",
|
|
419
|
+
"<!--/--><!--$-->",
|
|
420
|
+
"<!--/--></div>"
|
|
421
|
+
];
|
|
422
|
+
var _tmpl$4 = [
|
|
423
|
+
"<div",
|
|
424
|
+
" data-description",
|
|
425
|
+
">",
|
|
426
|
+
"</div>"
|
|
427
|
+
];
|
|
428
|
+
var _tmpl$5 = [
|
|
429
|
+
"<div",
|
|
430
|
+
" data-content",
|
|
431
|
+
"><div data-title",
|
|
432
|
+
">",
|
|
433
|
+
"</div><!--$-->",
|
|
434
|
+
"<!--/--></div>"
|
|
435
|
+
];
|
|
436
|
+
var _tmpl$6 = [
|
|
437
|
+
"<div",
|
|
438
|
+
"",
|
|
439
|
+
"",
|
|
440
|
+
">",
|
|
441
|
+
"</div>"
|
|
442
|
+
];
|
|
443
|
+
var _tmpl$7 = [
|
|
444
|
+
"<li",
|
|
445
|
+
" tabindex=\"0\"",
|
|
446
|
+
" data-sonner-toast",
|
|
447
|
+
"",
|
|
448
|
+
"",
|
|
449
|
+
"",
|
|
450
|
+
"",
|
|
451
|
+
"",
|
|
452
|
+
"",
|
|
453
|
+
"",
|
|
454
|
+
"",
|
|
455
|
+
"",
|
|
456
|
+
"",
|
|
457
|
+
"",
|
|
458
|
+
"",
|
|
459
|
+
"",
|
|
460
|
+
"",
|
|
461
|
+
"",
|
|
462
|
+
"",
|
|
463
|
+
"",
|
|
464
|
+
"",
|
|
465
|
+
" style=\"",
|
|
466
|
+
"\">",
|
|
467
|
+
"</li>"
|
|
468
|
+
];
|
|
469
|
+
var _tmpl$8 = [
|
|
470
|
+
"<section",
|
|
471
|
+
"",
|
|
472
|
+
" tabindex=\"-1\" aria-live=\"polite\" aria-relevant=\"additions text\" aria-atomic=\"false\" data-react-aria-top-layer>",
|
|
473
|
+
"</section>"
|
|
474
|
+
];
|
|
475
|
+
var _tmpl$9 = [
|
|
476
|
+
"<ol",
|
|
477
|
+
" tabindex=\"-1\"",
|
|
478
|
+
"",
|
|
479
|
+
" data-sonner-toaster",
|
|
480
|
+
"",
|
|
481
|
+
"",
|
|
482
|
+
" style=\"",
|
|
483
|
+
"\">",
|
|
484
|
+
"</ol>"
|
|
485
|
+
];
|
|
486
|
+
var _m$ = Symbol();
|
|
487
|
+
var _m$2 = Symbol();
|
|
488
|
+
var _m$3 = Symbol();
|
|
489
|
+
var _m$4 = Symbol();
|
|
490
|
+
var _m$5 = Symbol();
|
|
491
|
+
var _m$6 = Symbol();
|
|
492
|
+
var _m$7 = Symbol();
|
|
493
|
+
var _m$8 = Symbol();
|
|
494
|
+
var _m$9 = Symbol();
|
|
495
|
+
var _m$10 = Symbol();
|
|
496
|
+
var _d$ = {
|
|
497
|
+
get() {
|
|
498
|
+
const props = this[_m$];
|
|
499
|
+
/*!
|
|
500
|
+
* Derived from solid-sonner (https://github.com/wobsoriano/solid-sonner), src/index.tsx.
|
|
501
|
+
* Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
502
|
+
* Derived from Sonner (https://github.com/emilkowalski/sonner), src/index.tsx.
|
|
503
|
+
* Copyright (c) 2023 Emil Kowalski
|
|
504
|
+
* Modified for Solid Aria: Solid 2 types, reactivity, lifecycle, and package integration.
|
|
505
|
+
* MIT licensed. See LICENSE, SOLID-SONNER-LICENSE.md, SONNER-LICENSE.md, and NOTICE.txt in the package root.
|
|
506
|
+
*/
|
|
507
|
+
/*!
|
|
508
|
+
* Original code by Emil Kowalski
|
|
509
|
+
* MIT Licensed, Copyright 2023 Emil Kowalski, see https://github.com/emilkowalski/sonner/blob/main/LICENSE.md for details
|
|
510
|
+
*
|
|
511
|
+
* Credits:
|
|
512
|
+
* https://github.com/emilkowalski/sonner/blob/main/src/index.tsx
|
|
513
|
+
*/
|
|
514
|
+
return memo(() => {
|
|
515
|
+
return !!isAction(props.content);
|
|
516
|
+
})() ? props.content : false;
|
|
517
|
+
},
|
|
518
|
+
enumerable: true,
|
|
519
|
+
configurable: true
|
|
520
|
+
};
|
|
521
|
+
var _d$2 = {
|
|
522
|
+
get() {
|
|
523
|
+
return this[_m$].content;
|
|
524
|
+
},
|
|
525
|
+
enumerable: true,
|
|
526
|
+
configurable: true
|
|
527
|
+
};
|
|
528
|
+
function _P$(_p, _p2) {
|
|
529
|
+
this[_m$] = _p;
|
|
530
|
+
Object.defineProperty(this, "when", _d$);
|
|
531
|
+
Object.defineProperty(this, "fallback", _d$2);
|
|
532
|
+
this.children = _p2;
|
|
533
|
+
}
|
|
534
|
+
_P$.prototype = Object.prototype;
|
|
535
|
+
var _d$3 = {
|
|
536
|
+
get() {
|
|
537
|
+
const props = this[_m$];
|
|
538
|
+
const hasCustomContent = this[_m$2];
|
|
539
|
+
const toastType = this[_m$3];
|
|
540
|
+
return memo(() => {
|
|
541
|
+
return !!(props.closeButton && !hasCustomContent());
|
|
542
|
+
})() ? toastType() !== "loading" : props.closeButton && !hasCustomContent();
|
|
543
|
+
},
|
|
544
|
+
enumerable: true,
|
|
545
|
+
configurable: true
|
|
546
|
+
};
|
|
547
|
+
var _d$4 = {
|
|
548
|
+
get() {
|
|
549
|
+
const props = this[_m$];
|
|
550
|
+
const classNames = this[_m$4];
|
|
551
|
+
const toastClassNames = this[_m$5];
|
|
552
|
+
var _v$9 = ssrHydrationKey(), _g$2 = ssrGroup(() => {
|
|
553
|
+
return [
|
|
554
|
+
ssrAttribute("aria-label", escape(props.closeButtonAriaLabel ?? "Close toast", true)),
|
|
555
|
+
ssrAttribute("data-disabled", escape(String(props.disabled), true)),
|
|
556
|
+
((_v$12) => _v$12 == null ? "" : ssrAttribute("class", ssrClassName(_v$12)))(cn(classNames()?.closeButton, toastClassNames()?.closeButton))
|
|
557
|
+
];
|
|
558
|
+
}, 3), _v$14 = scope(() => {
|
|
559
|
+
return escape(props.icons?.close ?? CloseIcon({}));
|
|
560
|
+
});
|
|
561
|
+
return ssr(_tmpl$2, _v$9, _g$2, _g$2, _g$2, _v$14);
|
|
562
|
+
},
|
|
563
|
+
enumerable: true,
|
|
564
|
+
configurable: true
|
|
565
|
+
};
|
|
566
|
+
function _P$2(_p3, _p4, _p5, _p6, _p7) {
|
|
567
|
+
this[_m$] = _p3;
|
|
568
|
+
this[_m$2] = _p4;
|
|
569
|
+
this[_m$3] = _p5;
|
|
570
|
+
this[_m$4] = _p6;
|
|
571
|
+
this[_m$5] = _p7;
|
|
572
|
+
Object.defineProperty(this, "when", _d$3);
|
|
573
|
+
Object.defineProperty(this, "children", _d$4);
|
|
574
|
+
}
|
|
575
|
+
_P$2.prototype = Object.prototype;
|
|
576
|
+
var _d$5 = {
|
|
577
|
+
get() {
|
|
578
|
+
const hasIcon = this[_m$];
|
|
579
|
+
return hasIcon();
|
|
580
|
+
},
|
|
581
|
+
enumerable: true,
|
|
582
|
+
configurable: true
|
|
583
|
+
};
|
|
584
|
+
var _d$6 = {
|
|
585
|
+
get() {
|
|
586
|
+
const classNames = this[_m$2];
|
|
587
|
+
const toastClassNames = this[_m$3];
|
|
588
|
+
const loadingIconContent = this[_m$4];
|
|
589
|
+
const toastType = this[_m$5];
|
|
590
|
+
const props = this[_m$6];
|
|
591
|
+
var _v$15 = ssrHydrationKey(), _v$17 = () => {
|
|
592
|
+
return ((_v$16) => _v$16 == null ? "" : ssrAttribute("class", ssrClassName(_v$16)))(cn(classNames()?.icon, toastClassNames()?.icon));
|
|
593
|
+
}, _v$18 = scope(() => {
|
|
594
|
+
return escape(loadingIconContent());
|
|
595
|
+
}), _v$19 = scope((() => {
|
|
596
|
+
var _c$ = memo(() => {
|
|
597
|
+
return toastType() === "loading";
|
|
598
|
+
});
|
|
599
|
+
return () => {
|
|
600
|
+
return _c$() ? escape(null) : escape(props.getIcon());
|
|
601
|
+
};
|
|
602
|
+
})());
|
|
603
|
+
return ssr(_tmpl$3, _v$15, _v$17, _v$18, _v$19);
|
|
604
|
+
},
|
|
605
|
+
enumerable: true,
|
|
606
|
+
configurable: true
|
|
607
|
+
};
|
|
608
|
+
function _P$3(_p8, _p9, _p0, _p1, _p10, _p11) {
|
|
609
|
+
this[_m$] = _p8;
|
|
610
|
+
this[_m$2] = _p9;
|
|
611
|
+
this[_m$3] = _p0;
|
|
612
|
+
this[_m$4] = _p1;
|
|
613
|
+
this[_m$5] = _p10;
|
|
614
|
+
this[_m$6] = _p11;
|
|
615
|
+
Object.defineProperty(this, "when", _d$5);
|
|
616
|
+
Object.defineProperty(this, "children", _d$6);
|
|
617
|
+
}
|
|
618
|
+
_P$3.prototype = Object.prototype;
|
|
619
|
+
var _d$7 = {
|
|
620
|
+
get() {
|
|
621
|
+
return this[_m$].toast.description;
|
|
622
|
+
},
|
|
623
|
+
enumerable: true,
|
|
624
|
+
configurable: true
|
|
625
|
+
};
|
|
626
|
+
var _d$8 = {
|
|
627
|
+
get() {
|
|
628
|
+
const props = this[_m$];
|
|
629
|
+
const classNames = this[_m$2];
|
|
630
|
+
const toastClassNames = this[_m$3];
|
|
631
|
+
var _v$26 = ssrHydrationKey(), _v$28 = () => {
|
|
632
|
+
return ((_v$27) => _v$27 == null ? "" : ssrAttribute("class", ssrClassName(_v$27)))(cn(props.descriptionClassName, props.toastDescriptionClassName, classNames()?.description, toastClassNames()?.description));
|
|
633
|
+
}, _v$29 = scope(() => {
|
|
634
|
+
return escape(resolveContent(props.toast.description));
|
|
635
|
+
});
|
|
636
|
+
return ssr(_tmpl$4, _v$26, _v$28, _v$29);
|
|
637
|
+
},
|
|
638
|
+
enumerable: true,
|
|
639
|
+
configurable: true
|
|
640
|
+
};
|
|
641
|
+
function _P$4(_p12, _p13, _p14) {
|
|
642
|
+
this[_m$] = _p12;
|
|
643
|
+
this[_m$2] = _p13;
|
|
644
|
+
this[_m$3] = _p14;
|
|
645
|
+
Object.defineProperty(this, "when", _d$7);
|
|
646
|
+
Object.defineProperty(this, "children", _d$8);
|
|
647
|
+
}
|
|
648
|
+
_P$4.prototype = Object.prototype;
|
|
649
|
+
var _d$9 = {
|
|
650
|
+
get() {
|
|
651
|
+
const cancel = this[_m$];
|
|
652
|
+
return cancel();
|
|
653
|
+
},
|
|
654
|
+
enumerable: true,
|
|
655
|
+
configurable: true
|
|
656
|
+
};
|
|
657
|
+
var _d$10 = {
|
|
658
|
+
get() {
|
|
659
|
+
const props = this[_m$2];
|
|
660
|
+
return props.toast.cancelButtonStyle ?? props.cancelButtonStyle;
|
|
661
|
+
},
|
|
662
|
+
enumerable: true,
|
|
663
|
+
configurable: true
|
|
664
|
+
};
|
|
665
|
+
var _d$11 = {
|
|
666
|
+
get() {
|
|
667
|
+
const classNames = this[_m$3];
|
|
668
|
+
const toastClassNames = this[_m$4];
|
|
669
|
+
return cn(classNames()?.cancelButton, toastClassNames()?.cancelButton);
|
|
670
|
+
},
|
|
671
|
+
enumerable: true,
|
|
672
|
+
configurable: true
|
|
673
|
+
};
|
|
674
|
+
function _P$5(_p15, _p16, _p17, _p18, _p19, _p20) {
|
|
675
|
+
this[_m$] = _p15;
|
|
676
|
+
this[_m$2] = _p16;
|
|
677
|
+
this[_m$3] = _p17;
|
|
678
|
+
this[_m$4] = _p18;
|
|
679
|
+
Object.defineProperty(this, "content", _d$9);
|
|
680
|
+
this.kind = _p19;
|
|
681
|
+
Object.defineProperty(this, "style", _d$10);
|
|
682
|
+
Object.defineProperty(this, "class", _d$11);
|
|
683
|
+
this.onClick = _p20;
|
|
684
|
+
}
|
|
685
|
+
_P$5.prototype = Object.prototype;
|
|
686
|
+
var _d$12 = {
|
|
687
|
+
get() {
|
|
688
|
+
const cancel = this[_m$];
|
|
689
|
+
return !isAction(cancel());
|
|
690
|
+
},
|
|
691
|
+
enumerable: true,
|
|
692
|
+
configurable: true
|
|
693
|
+
};
|
|
694
|
+
var _d$13 = {
|
|
695
|
+
get() {
|
|
696
|
+
const cancel = this[_m$];
|
|
697
|
+
const props = this[_m$2];
|
|
698
|
+
const classNames = this[_m$3];
|
|
699
|
+
const toastClassNames = this[_m$4];
|
|
700
|
+
return ToastActionButton(new _P$5(cancel, props, classNames, toastClassNames, "cancel", (event) => {
|
|
701
|
+
if (!props.dismissible) return;
|
|
702
|
+
const currentCancel = cancel();
|
|
703
|
+
if (!isAction(currentCancel)) return;
|
|
704
|
+
currentCancel.onClick?.(event);
|
|
705
|
+
props.onDelete();
|
|
706
|
+
}));
|
|
707
|
+
},
|
|
708
|
+
enumerable: true,
|
|
709
|
+
configurable: true
|
|
710
|
+
};
|
|
711
|
+
var _d$14 = {
|
|
712
|
+
get() {
|
|
713
|
+
const cancel = this[_m$];
|
|
714
|
+
return getNonActionContent(cancel());
|
|
715
|
+
},
|
|
716
|
+
enumerable: true,
|
|
717
|
+
configurable: true
|
|
718
|
+
};
|
|
719
|
+
function _P$6(_p21, _p22, _p23, _p24) {
|
|
720
|
+
this[_m$] = _p21;
|
|
721
|
+
this[_m$2] = _p22;
|
|
722
|
+
this[_m$3] = _p23;
|
|
723
|
+
this[_m$4] = _p24;
|
|
724
|
+
Object.defineProperty(this, "when", _d$12);
|
|
725
|
+
Object.defineProperty(this, "fallback", _d$13);
|
|
726
|
+
Object.defineProperty(this, "children", _d$14);
|
|
727
|
+
}
|
|
728
|
+
_P$6.prototype = Object.prototype;
|
|
729
|
+
var _d$15 = {
|
|
730
|
+
get() {
|
|
731
|
+
return this[_m$].toast.cancel;
|
|
732
|
+
},
|
|
733
|
+
enumerable: true,
|
|
734
|
+
configurable: true
|
|
735
|
+
};
|
|
736
|
+
function _P$7(_p25, _p26) {
|
|
737
|
+
this[_m$] = _p25;
|
|
738
|
+
Object.defineProperty(this, "when", _d$15);
|
|
739
|
+
this.children = _p26;
|
|
740
|
+
}
|
|
741
|
+
_P$7.prototype = Object.prototype;
|
|
742
|
+
var _d$16 = {
|
|
743
|
+
get() {
|
|
744
|
+
const action = this[_m$];
|
|
745
|
+
return action();
|
|
746
|
+
},
|
|
747
|
+
enumerable: true,
|
|
748
|
+
configurable: true
|
|
749
|
+
};
|
|
750
|
+
var _d$17 = {
|
|
751
|
+
get() {
|
|
752
|
+
const props = this[_m$2];
|
|
753
|
+
return props.toast.actionButtonStyle ?? props.actionButtonStyle;
|
|
754
|
+
},
|
|
755
|
+
enumerable: true,
|
|
756
|
+
configurable: true
|
|
757
|
+
};
|
|
758
|
+
var _d$18 = {
|
|
759
|
+
get() {
|
|
760
|
+
const classNames = this[_m$3];
|
|
761
|
+
const toastClassNames = this[_m$4];
|
|
762
|
+
return cn(classNames()?.actionButton, toastClassNames()?.actionButton);
|
|
763
|
+
},
|
|
764
|
+
enumerable: true,
|
|
765
|
+
configurable: true
|
|
766
|
+
};
|
|
767
|
+
function _P$8(_p27, _p28, _p29, _p30, _p31, _p32) {
|
|
768
|
+
this[_m$] = _p27;
|
|
769
|
+
this[_m$2] = _p28;
|
|
770
|
+
this[_m$3] = _p29;
|
|
771
|
+
this[_m$4] = _p30;
|
|
772
|
+
Object.defineProperty(this, "content", _d$16);
|
|
773
|
+
this.kind = _p31;
|
|
774
|
+
Object.defineProperty(this, "style", _d$17);
|
|
775
|
+
Object.defineProperty(this, "class", _d$18);
|
|
776
|
+
this.onClick = _p32;
|
|
777
|
+
}
|
|
778
|
+
_P$8.prototype = Object.prototype;
|
|
779
|
+
var _d$19 = {
|
|
780
|
+
get() {
|
|
781
|
+
const action = this[_m$];
|
|
782
|
+
return !isAction(action());
|
|
783
|
+
},
|
|
784
|
+
enumerable: true,
|
|
785
|
+
configurable: true
|
|
786
|
+
};
|
|
787
|
+
var _d$20 = {
|
|
788
|
+
get() {
|
|
789
|
+
const action = this[_m$];
|
|
790
|
+
const props = this[_m$2];
|
|
791
|
+
const classNames = this[_m$3];
|
|
792
|
+
const toastClassNames = this[_m$4];
|
|
793
|
+
return ToastActionButton(new _P$8(action, props, classNames, toastClassNames, "action", (event) => {
|
|
794
|
+
const currentAction = action();
|
|
795
|
+
if (!isAction(currentAction)) return;
|
|
796
|
+
currentAction.onClick?.(event);
|
|
797
|
+
if (event.defaultPrevented) return;
|
|
798
|
+
props.onDelete();
|
|
799
|
+
}));
|
|
800
|
+
},
|
|
801
|
+
enumerable: true,
|
|
802
|
+
configurable: true
|
|
803
|
+
};
|
|
804
|
+
var _d$21 = {
|
|
805
|
+
get() {
|
|
806
|
+
const action = this[_m$];
|
|
807
|
+
return getNonActionContent(action());
|
|
808
|
+
},
|
|
809
|
+
enumerable: true,
|
|
810
|
+
configurable: true
|
|
811
|
+
};
|
|
812
|
+
function _P$9(_p33, _p34, _p35, _p36) {
|
|
813
|
+
this[_m$] = _p33;
|
|
814
|
+
this[_m$2] = _p34;
|
|
815
|
+
this[_m$3] = _p35;
|
|
816
|
+
this[_m$4] = _p36;
|
|
817
|
+
Object.defineProperty(this, "when", _d$19);
|
|
818
|
+
Object.defineProperty(this, "fallback", _d$20);
|
|
819
|
+
Object.defineProperty(this, "children", _d$21);
|
|
820
|
+
}
|
|
821
|
+
_P$9.prototype = Object.prototype;
|
|
822
|
+
var _d$22 = {
|
|
823
|
+
get() {
|
|
824
|
+
return this[_m$].toast.action;
|
|
825
|
+
},
|
|
826
|
+
enumerable: true,
|
|
827
|
+
configurable: true
|
|
828
|
+
};
|
|
829
|
+
function _P$10(_p37, _p38) {
|
|
830
|
+
this[_m$] = _p37;
|
|
831
|
+
Object.defineProperty(this, "when", _d$22);
|
|
832
|
+
this.children = _p38;
|
|
833
|
+
}
|
|
834
|
+
_P$10.prototype = Object.prototype;
|
|
835
|
+
var _d$23 = {
|
|
836
|
+
get() {
|
|
837
|
+
const classNames = this[_m$];
|
|
838
|
+
const toastClassNames = this[_m$2];
|
|
839
|
+
return cn(classNames()?.loader, toastClassNames()?.loader);
|
|
840
|
+
},
|
|
841
|
+
enumerable: true,
|
|
842
|
+
configurable: true
|
|
843
|
+
};
|
|
844
|
+
var _d$24 = {
|
|
845
|
+
get() {
|
|
846
|
+
const toastType = this[_m$3];
|
|
847
|
+
return toastType() === "loading";
|
|
848
|
+
},
|
|
849
|
+
enumerable: true,
|
|
850
|
+
configurable: true
|
|
851
|
+
};
|
|
852
|
+
function _P$11(_p39, _p40, _p41) {
|
|
853
|
+
this[_m$] = _p39;
|
|
854
|
+
this[_m$2] = _p40;
|
|
855
|
+
this[_m$3] = _p41;
|
|
856
|
+
Object.defineProperty(this, "class", _d$23);
|
|
857
|
+
Object.defineProperty(this, "visible", _d$24);
|
|
858
|
+
}
|
|
859
|
+
_P$11.prototype = Object.prototype;
|
|
860
|
+
var _d$25 = {
|
|
861
|
+
get() {
|
|
862
|
+
return this[_m$].actionButtonStyle;
|
|
863
|
+
},
|
|
864
|
+
enumerable: true,
|
|
865
|
+
configurable: true
|
|
866
|
+
};
|
|
867
|
+
var _d$26 = {
|
|
868
|
+
get() {
|
|
869
|
+
return this[_m$].cancelButtonStyle;
|
|
870
|
+
},
|
|
871
|
+
enumerable: true,
|
|
872
|
+
configurable: true
|
|
873
|
+
};
|
|
874
|
+
var _d$27 = {
|
|
875
|
+
get() {
|
|
876
|
+
const classNames = this[_m$2];
|
|
877
|
+
return classNames();
|
|
878
|
+
},
|
|
879
|
+
enumerable: true,
|
|
880
|
+
configurable: true
|
|
881
|
+
};
|
|
882
|
+
var _d$28 = {
|
|
883
|
+
get() {
|
|
884
|
+
const closeButton = this[_m$3];
|
|
885
|
+
return closeButton();
|
|
886
|
+
},
|
|
887
|
+
enumerable: true,
|
|
888
|
+
configurable: true
|
|
889
|
+
};
|
|
890
|
+
var _d$29 = {
|
|
891
|
+
get() {
|
|
892
|
+
return this[_m$].closeButtonAriaLabel;
|
|
893
|
+
},
|
|
894
|
+
enumerable: true,
|
|
895
|
+
configurable: true
|
|
896
|
+
};
|
|
897
|
+
var _d$30 = {
|
|
898
|
+
get() {
|
|
899
|
+
const descriptionClassName = this[_m$4];
|
|
900
|
+
return descriptionClassName();
|
|
901
|
+
},
|
|
902
|
+
enumerable: true,
|
|
903
|
+
configurable: true
|
|
904
|
+
};
|
|
905
|
+
var _d$31 = {
|
|
906
|
+
get() {
|
|
907
|
+
const disabled = this[_m$5];
|
|
908
|
+
return disabled();
|
|
909
|
+
},
|
|
910
|
+
enumerable: true,
|
|
911
|
+
configurable: true
|
|
912
|
+
};
|
|
913
|
+
var _d$32 = {
|
|
914
|
+
get() {
|
|
915
|
+
const dismissible = this[_m$6];
|
|
916
|
+
return dismissible();
|
|
917
|
+
},
|
|
918
|
+
enumerable: true,
|
|
919
|
+
configurable: true
|
|
920
|
+
};
|
|
921
|
+
var _d$33 = {
|
|
922
|
+
get() {
|
|
923
|
+
return this[_m$].icons;
|
|
924
|
+
},
|
|
925
|
+
enumerable: true,
|
|
926
|
+
configurable: true
|
|
927
|
+
};
|
|
928
|
+
var _d$34 = {
|
|
929
|
+
get() {
|
|
930
|
+
return this[_m$].toast;
|
|
931
|
+
},
|
|
932
|
+
enumerable: true,
|
|
933
|
+
configurable: true
|
|
934
|
+
};
|
|
935
|
+
var _d$35 = {
|
|
936
|
+
get() {
|
|
937
|
+
const toastClassNames = this[_m$7];
|
|
938
|
+
return toastClassNames();
|
|
939
|
+
},
|
|
940
|
+
enumerable: true,
|
|
941
|
+
configurable: true
|
|
942
|
+
};
|
|
943
|
+
var _d$36 = {
|
|
944
|
+
get() {
|
|
945
|
+
const toastDescriptionClassName = this[_m$8];
|
|
946
|
+
return toastDescriptionClassName();
|
|
947
|
+
},
|
|
948
|
+
enumerable: true,
|
|
949
|
+
configurable: true
|
|
950
|
+
};
|
|
951
|
+
function _P$12(_p42, _p43, _p44, _p45, _p46, _p47, _p48, _p49, _p50, _p51, _p52, _p53) {
|
|
952
|
+
this[_m$] = _p42;
|
|
953
|
+
this[_m$2] = _p43;
|
|
954
|
+
this[_m$3] = _p44;
|
|
955
|
+
this[_m$4] = _p45;
|
|
956
|
+
this[_m$5] = _p46;
|
|
957
|
+
this[_m$6] = _p47;
|
|
958
|
+
this[_m$7] = _p48;
|
|
959
|
+
this[_m$8] = _p49;
|
|
960
|
+
Object.defineProperty(this, "actionButtonStyle", _d$25);
|
|
961
|
+
Object.defineProperty(this, "cancelButtonStyle", _d$26);
|
|
962
|
+
Object.defineProperty(this, "classNames", _d$27);
|
|
963
|
+
Object.defineProperty(this, "closeButton", _d$28);
|
|
964
|
+
Object.defineProperty(this, "closeButtonAriaLabel", _d$29);
|
|
965
|
+
Object.defineProperty(this, "descriptionClassName", _d$30);
|
|
966
|
+
Object.defineProperty(this, "disabled", _d$31);
|
|
967
|
+
Object.defineProperty(this, "dismissible", _d$32);
|
|
968
|
+
this.getIcon = _p50;
|
|
969
|
+
this.getLoadingIcon = _p51;
|
|
970
|
+
Object.defineProperty(this, "icons", _d$33);
|
|
971
|
+
this.onDelete = _p52;
|
|
972
|
+
this.onDismiss = _p53;
|
|
973
|
+
Object.defineProperty(this, "toast", _d$34);
|
|
974
|
+
Object.defineProperty(this, "toastClassNames", _d$35);
|
|
975
|
+
Object.defineProperty(this, "toastDescriptionClassName", _d$36);
|
|
976
|
+
}
|
|
977
|
+
_P$12.prototype = Object.prototype;
|
|
978
|
+
var _d$37 = {
|
|
979
|
+
get() {
|
|
980
|
+
return this[_m$].icons;
|
|
981
|
+
},
|
|
982
|
+
enumerable: true,
|
|
983
|
+
configurable: true
|
|
984
|
+
};
|
|
985
|
+
var _d$38 = {
|
|
986
|
+
get() {
|
|
987
|
+
const toastIndex = this[_m$2];
|
|
988
|
+
return toastIndex();
|
|
989
|
+
},
|
|
990
|
+
enumerable: true,
|
|
991
|
+
configurable: true
|
|
992
|
+
};
|
|
993
|
+
var _d$39 = {
|
|
994
|
+
get() {
|
|
995
|
+
return this[_m$].richColors;
|
|
996
|
+
},
|
|
997
|
+
enumerable: true,
|
|
998
|
+
configurable: true
|
|
999
|
+
};
|
|
1000
|
+
var _d$40 = {
|
|
1001
|
+
get() {
|
|
1002
|
+
const toastOptions = this[_m$3];
|
|
1003
|
+
const propsWithDefaults = this[_m$];
|
|
1004
|
+
return toastOptions()?.duration ?? propsWithDefaults.duration;
|
|
1005
|
+
},
|
|
1006
|
+
enumerable: true,
|
|
1007
|
+
configurable: true
|
|
1008
|
+
};
|
|
1009
|
+
var _d$41 = {
|
|
1010
|
+
get() {
|
|
1011
|
+
const toastClassName = this[_m$4];
|
|
1012
|
+
return toastClassName();
|
|
1013
|
+
},
|
|
1014
|
+
enumerable: true,
|
|
1015
|
+
configurable: true
|
|
1016
|
+
};
|
|
1017
|
+
var _d$42 = {
|
|
1018
|
+
get() {
|
|
1019
|
+
const toastDescriptionClassName = this[_m$5];
|
|
1020
|
+
return toastDescriptionClassName();
|
|
1021
|
+
},
|
|
1022
|
+
enumerable: true,
|
|
1023
|
+
configurable: true
|
|
1024
|
+
};
|
|
1025
|
+
var _d$43 = {
|
|
1026
|
+
get() {
|
|
1027
|
+
const propsWithDefaults = this[_m$];
|
|
1028
|
+
return Boolean(propsWithDefaults.invert);
|
|
1029
|
+
},
|
|
1030
|
+
enumerable: true,
|
|
1031
|
+
configurable: true
|
|
1032
|
+
};
|
|
1033
|
+
var _d$44 = {
|
|
1034
|
+
get() {
|
|
1035
|
+
return this[_m$].visibleToasts;
|
|
1036
|
+
},
|
|
1037
|
+
enumerable: true,
|
|
1038
|
+
configurable: true
|
|
1039
|
+
};
|
|
1040
|
+
var _d$45 = {
|
|
1041
|
+
get() {
|
|
1042
|
+
const toastOptions = this[_m$3];
|
|
1043
|
+
const propsWithDefaults = this[_m$];
|
|
1044
|
+
return toastOptions()?.closeButton ?? propsWithDefaults.closeButton ?? false;
|
|
1045
|
+
},
|
|
1046
|
+
enumerable: true,
|
|
1047
|
+
configurable: true
|
|
1048
|
+
};
|
|
1049
|
+
var _d$46 = {
|
|
1050
|
+
get() {
|
|
1051
|
+
const interacting = this[_m$6];
|
|
1052
|
+
return interacting();
|
|
1053
|
+
},
|
|
1054
|
+
enumerable: true,
|
|
1055
|
+
configurable: true
|
|
1056
|
+
};
|
|
1057
|
+
var _d$47 = {
|
|
1058
|
+
get() {
|
|
1059
|
+
const toastOptions = this[_m$3];
|
|
1060
|
+
return toastOptions()?.style;
|
|
1061
|
+
},
|
|
1062
|
+
enumerable: true,
|
|
1063
|
+
configurable: true
|
|
1064
|
+
};
|
|
1065
|
+
var _d$48 = {
|
|
1066
|
+
get() {
|
|
1067
|
+
const toastOptions = this[_m$3];
|
|
1068
|
+
return toastOptions()?.unstyled;
|
|
1069
|
+
},
|
|
1070
|
+
enumerable: true,
|
|
1071
|
+
configurable: true
|
|
1072
|
+
};
|
|
1073
|
+
var _d$49 = {
|
|
1074
|
+
get() {
|
|
1075
|
+
const toastClassNames = this[_m$7];
|
|
1076
|
+
return toastClassNames();
|
|
1077
|
+
},
|
|
1078
|
+
enumerable: true,
|
|
1079
|
+
configurable: true
|
|
1080
|
+
};
|
|
1081
|
+
var _d$50 = {
|
|
1082
|
+
get() {
|
|
1083
|
+
const toastOptions = this[_m$3];
|
|
1084
|
+
return toastOptions()?.cancelButtonStyle;
|
|
1085
|
+
},
|
|
1086
|
+
enumerable: true,
|
|
1087
|
+
configurable: true
|
|
1088
|
+
};
|
|
1089
|
+
var _d$51 = {
|
|
1090
|
+
get() {
|
|
1091
|
+
const toastOptions = this[_m$3];
|
|
1092
|
+
return toastOptions()?.actionButtonStyle;
|
|
1093
|
+
},
|
|
1094
|
+
enumerable: true,
|
|
1095
|
+
configurable: true
|
|
1096
|
+
};
|
|
1097
|
+
var _d$52 = {
|
|
1098
|
+
get() {
|
|
1099
|
+
const toastOptions = this[_m$3];
|
|
1100
|
+
return toastOptions()?.closeButtonAriaLabel;
|
|
1101
|
+
},
|
|
1102
|
+
enumerable: true,
|
|
1103
|
+
configurable: true
|
|
1104
|
+
};
|
|
1105
|
+
var _d$53 = {
|
|
1106
|
+
get() {
|
|
1107
|
+
const toastsByPosition = this[_m$8];
|
|
1108
|
+
return toastsByPosition();
|
|
1109
|
+
},
|
|
1110
|
+
enumerable: true,
|
|
1111
|
+
configurable: true
|
|
1112
|
+
};
|
|
1113
|
+
var _d$54 = {
|
|
1114
|
+
get() {
|
|
1115
|
+
const heightsByPosition = this[_m$9];
|
|
1116
|
+
return heightsByPosition();
|
|
1117
|
+
},
|
|
1118
|
+
enumerable: true,
|
|
1119
|
+
configurable: true
|
|
1120
|
+
};
|
|
1121
|
+
var _d$55 = {
|
|
1122
|
+
get() {
|
|
1123
|
+
const propsWithDefaults = this[_m$];
|
|
1124
|
+
return Boolean(propsWithDefaults.expand);
|
|
1125
|
+
},
|
|
1126
|
+
enumerable: true,
|
|
1127
|
+
configurable: true
|
|
1128
|
+
};
|
|
1129
|
+
var _d$56 = {
|
|
1130
|
+
get() {
|
|
1131
|
+
return this[_m$].gap;
|
|
1132
|
+
},
|
|
1133
|
+
enumerable: true,
|
|
1134
|
+
configurable: true
|
|
1135
|
+
};
|
|
1136
|
+
var _d$57 = {
|
|
1137
|
+
get() {
|
|
1138
|
+
const expanded = this[_m$10];
|
|
1139
|
+
return expanded();
|
|
1140
|
+
},
|
|
1141
|
+
enumerable: true,
|
|
1142
|
+
configurable: true
|
|
1143
|
+
};
|
|
1144
|
+
var _d$58 = {
|
|
1145
|
+
get() {
|
|
1146
|
+
return this[_m$].swipeDirections;
|
|
1147
|
+
},
|
|
1148
|
+
enumerable: true,
|
|
1149
|
+
configurable: true
|
|
1150
|
+
};
|
|
1151
|
+
var _d$59 = {
|
|
1152
|
+
get() {
|
|
1153
|
+
return this[_m$].pauseWhenPageIsHidden;
|
|
1154
|
+
},
|
|
1155
|
+
enumerable: true,
|
|
1156
|
+
configurable: true
|
|
1157
|
+
};
|
|
1158
|
+
function _P$13(_p54, _p55, _p56, _p57, _p58, _p59, _p60, _p61, _p62, _p63, _p64, _p65, _p66, _p67) {
|
|
1159
|
+
this[_m$] = _p54;
|
|
1160
|
+
this[_m$2] = _p55;
|
|
1161
|
+
this[_m$3] = _p56;
|
|
1162
|
+
this[_m$4] = _p57;
|
|
1163
|
+
this[_m$5] = _p58;
|
|
1164
|
+
this[_m$6] = _p59;
|
|
1165
|
+
this[_m$7] = _p60;
|
|
1166
|
+
this[_m$8] = _p61;
|
|
1167
|
+
this[_m$9] = _p62;
|
|
1168
|
+
this[_m$10] = _p63;
|
|
1169
|
+
Object.defineProperty(this, "icons", _d$37);
|
|
1170
|
+
Object.defineProperty(this, "index", _d$38);
|
|
1171
|
+
this.toast = _p64;
|
|
1172
|
+
Object.defineProperty(this, "defaultRichColors", _d$39);
|
|
1173
|
+
Object.defineProperty(this, "duration", _d$40);
|
|
1174
|
+
Object.defineProperty(this, "class", _d$41);
|
|
1175
|
+
Object.defineProperty(this, "descriptionClassName", _d$42);
|
|
1176
|
+
Object.defineProperty(this, "invert", _d$43);
|
|
1177
|
+
Object.defineProperty(this, "visibleToasts", _d$44);
|
|
1178
|
+
Object.defineProperty(this, "closeButton", _d$45);
|
|
1179
|
+
Object.defineProperty(this, "interacting", _d$46);
|
|
1180
|
+
this.position = _p65;
|
|
1181
|
+
Object.defineProperty(this, "style", _d$47);
|
|
1182
|
+
Object.defineProperty(this, "unstyled", _d$48);
|
|
1183
|
+
Object.defineProperty(this, "classNames", _d$49);
|
|
1184
|
+
Object.defineProperty(this, "cancelButtonStyle", _d$50);
|
|
1185
|
+
Object.defineProperty(this, "actionButtonStyle", _d$51);
|
|
1186
|
+
Object.defineProperty(this, "closeButtonAriaLabel", _d$52);
|
|
1187
|
+
this.removeToast = _p66;
|
|
1188
|
+
Object.defineProperty(this, "toasts", _d$53);
|
|
1189
|
+
Object.defineProperty(this, "heights", _d$54);
|
|
1190
|
+
this.setHeights = _p67;
|
|
1191
|
+
Object.defineProperty(this, "expandByDefault", _d$55);
|
|
1192
|
+
Object.defineProperty(this, "gap", _d$56);
|
|
1193
|
+
Object.defineProperty(this, "expanded", _d$57);
|
|
1194
|
+
Object.defineProperty(this, "swipeDirections", _d$58);
|
|
1195
|
+
Object.defineProperty(this, "pauseWhenPageIsHidden", _d$59);
|
|
1196
|
+
}
|
|
1197
|
+
_P$13.prototype = Object.prototype;
|
|
1198
|
+
var _d$60 = {
|
|
1199
|
+
get() {
|
|
1200
|
+
const toastsByPosition = this[_m$];
|
|
1201
|
+
return toastsByPosition();
|
|
1202
|
+
},
|
|
1203
|
+
enumerable: true,
|
|
1204
|
+
configurable: true
|
|
1205
|
+
};
|
|
1206
|
+
function _P$14(_p68, _p69) {
|
|
1207
|
+
this[_m$] = _p68;
|
|
1208
|
+
Object.defineProperty(this, "each", _d$60);
|
|
1209
|
+
this.children = _p69;
|
|
1210
|
+
}
|
|
1211
|
+
_P$14.prototype = Object.prototype;
|
|
1212
|
+
var _d$61 = {
|
|
1213
|
+
get() {
|
|
1214
|
+
const possiblePositions = this[_m$];
|
|
1215
|
+
return possiblePositions();
|
|
1216
|
+
},
|
|
1217
|
+
enumerable: true,
|
|
1218
|
+
configurable: true
|
|
1219
|
+
};
|
|
1220
|
+
function _P$15(_p70, _p71) {
|
|
1221
|
+
this[_m$] = _p70;
|
|
1222
|
+
Object.defineProperty(this, "each", _d$61);
|
|
1223
|
+
this.children = _p71;
|
|
1224
|
+
}
|
|
1225
|
+
_P$15.prototype = Object.prototype;
|
|
1226
|
+
const VISIBLE_TOASTS_AMOUNT = 3;
|
|
1227
|
+
const VIEWPORT_OFFSET = "24px";
|
|
1228
|
+
const MOBILE_VIEWPORT_OFFSET = "16px";
|
|
1229
|
+
const TOAST_LIFETIME = 4e3;
|
|
1230
|
+
const GAP = 14;
|
|
1231
|
+
const TIME_BEFORE_UNMOUNT = 200;
|
|
1232
|
+
function cn(...classes) {
|
|
1233
|
+
return classes;
|
|
1234
|
+
}
|
|
1235
|
+
function resolveContent(content) {
|
|
1236
|
+
return typeof content === "function" ? content() : content;
|
|
1237
|
+
}
|
|
1238
|
+
function isToastIconType(type) {
|
|
1239
|
+
return type === "success" || type === "info" || type === "warning" || type === "error" || type === "loading";
|
|
1240
|
+
}
|
|
1241
|
+
function isToastClassNameType(type) {
|
|
1242
|
+
return type === "success" || type === "info" || type === "warning" || type === "error" || type === "loading" || type === "default";
|
|
1243
|
+
}
|
|
1244
|
+
function isDirection(value) {
|
|
1245
|
+
return value === "ltr" || value === "rtl" || value === "auto";
|
|
1246
|
+
}
|
|
1247
|
+
function getNonActionContent(content) {
|
|
1248
|
+
return isAction(content) ? null : content;
|
|
1249
|
+
}
|
|
1250
|
+
function ToastActionButton(props) {
|
|
1251
|
+
return Show(new _P$(props, (action) => {
|
|
1252
|
+
var _v$ = ssrHydrationKey(), _g$ = ssrGroup(() => {
|
|
1253
|
+
return [
|
|
1254
|
+
ssrAttribute("data-action", props.kind === "action" ? "" : escape(void 0, true)),
|
|
1255
|
+
ssrAttribute("data-cancel", props.kind === "cancel" ? "" : escape(void 0, true)),
|
|
1256
|
+
((_v$4) => _v$4 == null ? "" : ssrAttribute("style", ssrStyle(_v$4)))(props.style),
|
|
1257
|
+
((_v$6) => _v$6 == null ? "" : ssrAttribute("class", ssrClassName(_v$6)))(props.class)
|
|
1258
|
+
];
|
|
1259
|
+
}, 4), _v$8 = scope(() => {
|
|
1260
|
+
return escape(action().label);
|
|
1261
|
+
});
|
|
1262
|
+
return ssr(_tmpl$, _v$, _g$, _g$, _g$, _g$, _v$8);
|
|
1263
|
+
}));
|
|
1264
|
+
}
|
|
1265
|
+
function getDocumentDirection() {
|
|
1266
|
+
if (typeof window === "undefined") return "ltr";
|
|
1267
|
+
if (typeof document === "undefined") return "ltr";
|
|
1268
|
+
const dirAttribute = document.documentElement.getAttribute("dir");
|
|
1269
|
+
if (dirAttribute !== null && isDirection(dirAttribute)) return dirAttribute;
|
|
1270
|
+
const { direction } = window.getComputedStyle(document.documentElement);
|
|
1271
|
+
return isDirection(direction) ? direction : "ltr";
|
|
1272
|
+
}
|
|
1273
|
+
function formatOffset(value) {
|
|
1274
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
1275
|
+
}
|
|
1276
|
+
function assignOffset(defaultOffset, mobileOffset) {
|
|
1277
|
+
const styles = {};
|
|
1278
|
+
for (const [index, offset] of [defaultOffset, mobileOffset].entries()) {
|
|
1279
|
+
const isMobile = index === 1;
|
|
1280
|
+
const prefix = isMobile ? "--mobile-offset" : "--offset";
|
|
1281
|
+
const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
|
|
1282
|
+
const assignAll = (value) => {
|
|
1283
|
+
for (const key of [
|
|
1284
|
+
"top",
|
|
1285
|
+
"right",
|
|
1286
|
+
"bottom",
|
|
1287
|
+
"left"
|
|
1288
|
+
]) styles[`${prefix}-${key}`] = typeof value === "number" ? `${value}px` : value;
|
|
1289
|
+
};
|
|
1290
|
+
if (typeof offset === "number" || typeof offset === "string") {
|
|
1291
|
+
assignAll(offset);
|
|
1292
|
+
continue;
|
|
1293
|
+
}
|
|
1294
|
+
if (typeof offset === "object" && offset !== null) {
|
|
1295
|
+
for (const key of [
|
|
1296
|
+
"top",
|
|
1297
|
+
"right",
|
|
1298
|
+
"bottom",
|
|
1299
|
+
"left"
|
|
1300
|
+
]) {
|
|
1301
|
+
const value = offset[key];
|
|
1302
|
+
styles[`${prefix}-${key}`] = value === void 0 ? defaultValue : formatOffset(value);
|
|
1303
|
+
}
|
|
1304
|
+
continue;
|
|
1305
|
+
}
|
|
1306
|
+
assignAll(defaultValue);
|
|
1307
|
+
}
|
|
1308
|
+
return styles;
|
|
1309
|
+
}
|
|
1310
|
+
function mergeClassNames(classNames, legacy) {
|
|
1311
|
+
return classNames ?? legacy;
|
|
1312
|
+
}
|
|
1313
|
+
function mergeDescriptionClassName(descriptionClassName, legacy) {
|
|
1314
|
+
return descriptionClassName ?? legacy ?? "";
|
|
1315
|
+
}
|
|
1316
|
+
function mergeClassName(className, legacy) {
|
|
1317
|
+
return className ?? legacy ?? "";
|
|
1318
|
+
}
|
|
1319
|
+
function useSonner() {
|
|
1320
|
+
const [activeToasts, setActiveToasts] = createSignal([]);
|
|
1321
|
+
onSettled(() => {
|
|
1322
|
+
return ToastState.subscribe((toastItem) => {
|
|
1323
|
+
if ("dismiss" in toastItem) {
|
|
1324
|
+
setActiveToasts((toasts) => toasts.filter((t) => t.id !== toastItem.id));
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
setActiveToasts((toasts) => {
|
|
1328
|
+
const indexOfExistingToast = toasts.findIndex((t) => t.id === toastItem.id);
|
|
1329
|
+
if (indexOfExistingToast !== -1) return [
|
|
1330
|
+
...toasts.slice(0, indexOfExistingToast),
|
|
1331
|
+
{
|
|
1332
|
+
...toasts[indexOfExistingToast],
|
|
1333
|
+
...toastItem
|
|
1334
|
+
},
|
|
1335
|
+
...toasts.slice(indexOfExistingToast + 1)
|
|
1336
|
+
];
|
|
1337
|
+
return [toastItem, ...toasts];
|
|
1338
|
+
});
|
|
1339
|
+
});
|
|
1340
|
+
});
|
|
1341
|
+
return { toasts: activeToasts };
|
|
1342
|
+
}
|
|
1343
|
+
function createToastTheme(theme) {
|
|
1344
|
+
if (theme !== "system") return theme;
|
|
1345
|
+
return typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1346
|
+
}
|
|
1347
|
+
function ToastBody(props) {
|
|
1348
|
+
var _v$20, _g$3, _v$25, _v$30;
|
|
1349
|
+
const classNames = () => props.classNames;
|
|
1350
|
+
const toastClassNames = () => props.toastClassNames;
|
|
1351
|
+
const toastType = () => props.toast.type;
|
|
1352
|
+
const hasCustomContent = () => Boolean(props.toast.jsx);
|
|
1353
|
+
const hasIcon = () => {
|
|
1354
|
+
const type = toastType();
|
|
1355
|
+
const typeIcon = isToastIconType(type) ? props.icons?.[type] : void 0;
|
|
1356
|
+
return (type !== void 0 || Boolean(props.toast.icon) || props.toast.promise !== void 0) && props.toast.icon !== null && (typeIcon !== null || Boolean(props.toast.icon));
|
|
1357
|
+
};
|
|
1358
|
+
const loadingIconContent = () => {
|
|
1359
|
+
if (toastType() === "loading") return props.toast.icon ?? props.getLoadingIcon();
|
|
1360
|
+
if (props.toast.promise) return props.getLoadingIcon();
|
|
1361
|
+
return null;
|
|
1362
|
+
};
|
|
1363
|
+
return [
|
|
1364
|
+
Show(new _P$2(props, hasCustomContent, toastType, classNames, toastClassNames)),
|
|
1365
|
+
Show(new _P$3(hasIcon, classNames, toastClassNames, loadingIconContent, toastType, props)),
|
|
1366
|
+
(_v$20 = ssrHydrationKey(), _g$3 = ssrGroup(() => {
|
|
1367
|
+
return [((_v$21) => _v$21 == null ? "" : ssrAttribute("class", ssrClassName(_v$21)))(cn(classNames()?.content, toastClassNames()?.content)), ((_v$23) => _v$23 == null ? "" : ssrAttribute("class", ssrClassName(_v$23)))(cn(classNames()?.title, toastClassNames()?.title))];
|
|
1368
|
+
}, 2), _v$25 = scope(() => {
|
|
1369
|
+
return escape(props.toast.jsx ?? resolveContent(props.toast.title));
|
|
1370
|
+
}), _v$30 = escape(Show(new _P$4(props, classNames, toastClassNames))), ssr(_tmpl$5, _v$20, _g$3, _g$3, _v$25, _v$30)),
|
|
1371
|
+
Show(new _P$7(props, (cancel) => Show(new _P$6(cancel, props, classNames, toastClassNames)))),
|
|
1372
|
+
Show(new _P$10(props, (action) => Show(new _P$9(action, props, classNames, toastClassNames))))
|
|
1373
|
+
];
|
|
1374
|
+
}
|
|
1375
|
+
function setupToastEffects({ props, mounted, getToastElement, isRemoving, isDocumentHidden, duration, removed, deleteToast, setInitialHeight }) {
|
|
1376
|
+
let remainingTime = TOAST_LIFETIME;
|
|
1377
|
+
createRenderEffect(() => ({
|
|
1378
|
+
mounted: mounted(),
|
|
1379
|
+
position: props.toast.position,
|
|
1380
|
+
toastId: props.toast.id,
|
|
1381
|
+
toasterId: props.toast.toasterId
|
|
1382
|
+
}), (metadata) => {
|
|
1383
|
+
const toastElement = getToastElement();
|
|
1384
|
+
if (!metadata.mounted || !toastElement) return;
|
|
1385
|
+
const measure = () => {
|
|
1386
|
+
const currentElement = getToastElement();
|
|
1387
|
+
if (!currentElement || isRemoving()) return;
|
|
1388
|
+
const originalHeight = currentElement.style.height;
|
|
1389
|
+
currentElement.style.height = "auto";
|
|
1390
|
+
const { height } = currentElement.getBoundingClientRect();
|
|
1391
|
+
currentElement.style.height = originalHeight;
|
|
1392
|
+
setInitialHeight(height);
|
|
1393
|
+
props.setHeights((heights) => {
|
|
1394
|
+
const entry = {
|
|
1395
|
+
height,
|
|
1396
|
+
position: metadata.position,
|
|
1397
|
+
toastId: metadata.toastId,
|
|
1398
|
+
toasterId: metadata.toasterId
|
|
1399
|
+
};
|
|
1400
|
+
return heights.some((item) => item.toastId === entry.toastId) ? heights.map((item) => item.toastId === entry.toastId ? entry : item) : [entry, ...heights];
|
|
1401
|
+
});
|
|
1402
|
+
};
|
|
1403
|
+
measure();
|
|
1404
|
+
const observer = new ResizeObserver(measure);
|
|
1405
|
+
observer.observe(toastElement);
|
|
1406
|
+
return () => {
|
|
1407
|
+
observer.disconnect();
|
|
1408
|
+
};
|
|
1409
|
+
});
|
|
1410
|
+
createEffect(() => [
|
|
1411
|
+
props.expanded,
|
|
1412
|
+
props.interacting,
|
|
1413
|
+
props.toast.type,
|
|
1414
|
+
isDocumentHidden(),
|
|
1415
|
+
duration(),
|
|
1416
|
+
props.pauseWhenPageIsHidden ?? true,
|
|
1417
|
+
props.toast.title,
|
|
1418
|
+
removed()
|
|
1419
|
+
], ([expanded, interacting, type, hidden, lifetime, pauseWhenHidden, title, isRemoved], previous) => {
|
|
1420
|
+
if (isRemoved || type === "loading" || lifetime === Number.POSITIVE_INFINITY) return;
|
|
1421
|
+
if (!previous || previous[2] !== type || previous[4] !== lifetime || previous[6] !== title) remainingTime = lifetime;
|
|
1422
|
+
if (expanded || interacting || pauseWhenHidden && hidden) return;
|
|
1423
|
+
const startedAt = Date.now();
|
|
1424
|
+
const timer = setTimeout(() => {
|
|
1425
|
+
props.toast.onAutoClose?.(props.toast);
|
|
1426
|
+
deleteToast();
|
|
1427
|
+
}, Math.max(0, remainingTime));
|
|
1428
|
+
return () => {
|
|
1429
|
+
clearTimeout(timer);
|
|
1430
|
+
remainingTime -= Date.now() - startedAt;
|
|
1431
|
+
};
|
|
1432
|
+
});
|
|
1433
|
+
createEffect(() => props.toast.delete, (shouldDelete) => {
|
|
1434
|
+
if (shouldDelete !== true) return;
|
|
1435
|
+
untrack(() => {
|
|
1436
|
+
deleteToast();
|
|
1437
|
+
props.toast.onDismiss?.(props.toast);
|
|
1438
|
+
});
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
function Toast(props) {
|
|
1442
|
+
const [mounted, setMounted] = createSignal(false);
|
|
1443
|
+
const [removed, setRemoved] = createSignal(false);
|
|
1444
|
+
const [swiping, setSwiping] = createSignal(false);
|
|
1445
|
+
const [swipeOut, setSwipeOut] = createSignal(false);
|
|
1446
|
+
const [isSwiped, setIsSwiped] = createSignal(false);
|
|
1447
|
+
const [swipeOutDirection, setSwipeOutDirection] = createSignal(null);
|
|
1448
|
+
const [offsetBeforeRemove, setOffsetBeforeRemove] = createSignal(0);
|
|
1449
|
+
const [initialHeight, setInitialHeight] = createSignal(0);
|
|
1450
|
+
let toastRef;
|
|
1451
|
+
let removalTimer;
|
|
1452
|
+
onCleanup(() => {
|
|
1453
|
+
clearTimeout(removalTimer);
|
|
1454
|
+
});
|
|
1455
|
+
const isFront = () => props.index === 0;
|
|
1456
|
+
const isVisible = () => props.index + 1 <= props.visibleToasts;
|
|
1457
|
+
const toastType = () => props.toast.type;
|
|
1458
|
+
const dismissible = () => props.toast.dismissible !== false;
|
|
1459
|
+
const classNames = () => mergeClassNames(props.classNames, props.classes);
|
|
1460
|
+
const className = () => mergeClassName(props.className, props.class);
|
|
1461
|
+
const descriptionClassName = () => mergeDescriptionClassName(props.descriptionClassName, props.descriptionClass);
|
|
1462
|
+
const toastClassName = () => mergeClassName(props.toast.className, props.toast.class);
|
|
1463
|
+
const toastDescriptionClassName = () => mergeDescriptionClassName(props.toast.descriptionClassName, props.toast.descriptionClass);
|
|
1464
|
+
const toastClassNames = () => mergeClassNames(props.toast.classNames, props.toast.classes);
|
|
1465
|
+
const closeButton = () => props.toast.closeButton ?? props.closeButton;
|
|
1466
|
+
const duration = () => props.toast.duration ?? props.duration ?? TOAST_LIFETIME;
|
|
1467
|
+
const invert = () => props.toast.invert ?? props.invert;
|
|
1468
|
+
const disabled = () => toastType() === "loading";
|
|
1469
|
+
const toastTypeKey = () => {
|
|
1470
|
+
const type = toastType();
|
|
1471
|
+
return isToastClassNameType(type) ? type : "default";
|
|
1472
|
+
};
|
|
1473
|
+
const y = createMemo(() => props.position.split("-")[0]);
|
|
1474
|
+
const x = createMemo(() => props.position.split("-")[1]);
|
|
1475
|
+
const heightIndex = createMemo(() => Math.max(0, props.heights.findIndex((height) => height.toastId === props.toast.id)));
|
|
1476
|
+
const toastsHeightBefore = createMemo(() => {
|
|
1477
|
+
let total = 0;
|
|
1478
|
+
for (const [index, height] of props.heights.entries()) {
|
|
1479
|
+
if (index >= heightIndex()) break;
|
|
1480
|
+
total += height.height;
|
|
1481
|
+
}
|
|
1482
|
+
return total;
|
|
1483
|
+
});
|
|
1484
|
+
const offset = createMemo(() => heightIndex() * (props.gap ?? GAP) + toastsHeightBefore());
|
|
1485
|
+
const isDocumentHidden = createIsDocumentHidden();
|
|
1486
|
+
function deleteToast() {
|
|
1487
|
+
if (removalTimer !== void 0) return;
|
|
1488
|
+
setRemoved(true);
|
|
1489
|
+
setOffsetBeforeRemove(offset());
|
|
1490
|
+
props.setHeights((heights) => heights.filter((height) => height.toastId !== props.toast.id));
|
|
1491
|
+
removalTimer = setTimeout(() => {
|
|
1492
|
+
props.removeToast(props.toast);
|
|
1493
|
+
}, TIME_BEFORE_UNMOUNT);
|
|
1494
|
+
}
|
|
1495
|
+
function getLoadingIcon() {
|
|
1496
|
+
if (props.icons?.loading !== void 0 && props.icons.loading !== null && props.icons.loading !== false) {
|
|
1497
|
+
var _v$31 = ssrHydrationKey(), _g$4 = ssrGroup(() => {
|
|
1498
|
+
return [((_v$32) => _v$32 == null ? "" : ssrAttribute("class", ssrClassName(_v$32)))(cn(classNames()?.loader, toastClassNames()?.loader, "sonner-loader")), ssrAttribute("data-visible", escape(String(toastType() === "loading"), true))];
|
|
1499
|
+
}, 2), _v$35 = scope(() => {
|
|
1500
|
+
return escape(props.icons.loading);
|
|
1501
|
+
});
|
|
1502
|
+
return ssr(_tmpl$6, _v$31, _g$4, _g$4, _v$35);
|
|
1503
|
+
}
|
|
1504
|
+
return Loader(new _P$11(classNames, toastClassNames, toastType));
|
|
1505
|
+
}
|
|
1506
|
+
const icon = () => {
|
|
1507
|
+
const type = toastType();
|
|
1508
|
+
return props.toast.icon ?? (isToastIconType(type) ? props.icons?.[type] : void 0) ?? getAsset(type);
|
|
1509
|
+
};
|
|
1510
|
+
onSettled(() => {
|
|
1511
|
+
setMounted(true);
|
|
1512
|
+
});
|
|
1513
|
+
setupToastEffects({
|
|
1514
|
+
deleteToast,
|
|
1515
|
+
duration,
|
|
1516
|
+
getToastElement: () => toastRef,
|
|
1517
|
+
isDocumentHidden,
|
|
1518
|
+
isRemoving: () => removalTimer !== void 0,
|
|
1519
|
+
mounted,
|
|
1520
|
+
props,
|
|
1521
|
+
removed,
|
|
1522
|
+
setInitialHeight
|
|
1523
|
+
});
|
|
1524
|
+
var _v$36 = ssrHydrationKey(), _g$5 = ssrGroup(() => {
|
|
1525
|
+
return [
|
|
1526
|
+
((_v$37) => _v$37 == null ? "" : ssrAttribute("class", ssrClassName(_v$37)))(cn(className(), toastClassName(), classNames()?.toast, toastClassNames()?.toast, classNames()?.[toastTypeKey()], toastClassNames()?.[toastTypeKey()])),
|
|
1527
|
+
ssrAttribute("data-rich-colors", escape(String(Boolean(props.toast.richColors ?? props.defaultRichColors)), true)),
|
|
1528
|
+
ssrAttribute("data-styled", escape(String((props.toast.jsx === void 0 || props.toast.jsx === null || props.toast.jsx === false || props.toast.jsx === 0 || props.toast.jsx === "") && props.toast.unstyled !== true && props.unstyled !== true), true)),
|
|
1529
|
+
ssrAttribute("data-mounted", escape(String(mounted()), true)),
|
|
1530
|
+
ssrAttribute("data-promise", escape(String(Boolean(props.toast.promise)), true)),
|
|
1531
|
+
ssrAttribute("data-swiped", escape(String(isSwiped()), true)),
|
|
1532
|
+
ssrAttribute("data-removed", escape(String(removed()), true)),
|
|
1533
|
+
ssrAttribute("data-visible", escape(String(isVisible()), true)),
|
|
1534
|
+
ssrAttribute("data-y-position", escape(y(), true)),
|
|
1535
|
+
ssrAttribute("data-x-position", escape(x(), true)),
|
|
1536
|
+
ssrAttribute("data-index", escape(props.index, true)),
|
|
1537
|
+
ssrAttribute("data-front", escape(String(isFront()), true)),
|
|
1538
|
+
ssrAttribute("data-swiping", escape(String(swiping()), true)),
|
|
1539
|
+
ssrAttribute("data-dismissible", escape(String(dismissible()), true)),
|
|
1540
|
+
ssrAttribute("data-type", escape(toastType(), true)),
|
|
1541
|
+
ssrAttribute("data-invert", escape(String(invert()), true)),
|
|
1542
|
+
ssrAttribute("data-swipe-out", escape(String(swipeOut()), true)),
|
|
1543
|
+
ssrAttribute("data-swipe-direction", escape(swipeOutDirection(), true)),
|
|
1544
|
+
ssrAttribute("data-expanded", escape(String(props.expanded || props.expandByDefault && mounted()), true)),
|
|
1545
|
+
ssrAttribute("data-testid", escape(props.toast.testId, true)),
|
|
1546
|
+
ssrStyle({
|
|
1547
|
+
"--index": props.index,
|
|
1548
|
+
"--initial-height": props.expandByDefault ? "auto" : `${initialHeight()}px`,
|
|
1549
|
+
"--offset": `${removed() ? offsetBeforeRemove() : offset()}px`,
|
|
1550
|
+
"--toasts-before": props.index,
|
|
1551
|
+
"--z-index": props.toasts.length - props.index,
|
|
1552
|
+
...props.style,
|
|
1553
|
+
...props.toast.style
|
|
1554
|
+
})
|
|
1555
|
+
];
|
|
1556
|
+
}, 21), _v$59 = escape(ToastBody(new _P$12(props, classNames, closeButton, descriptionClassName, disabled, dismissible, toastClassNames, toastDescriptionClassName, icon, getLoadingIcon, deleteToast, () => props.toast.onDismiss?.(props.toast))));
|
|
1557
|
+
return ssr(_tmpl$7, _v$36, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _g$5, _v$59);
|
|
1558
|
+
}
|
|
1559
|
+
function Toaster(props) {
|
|
1560
|
+
const propsWithDefaults = merge({
|
|
1561
|
+
containerAriaLabel: "Notifications",
|
|
1562
|
+
dir: getDocumentDirection(),
|
|
1563
|
+
gap: GAP,
|
|
1564
|
+
hotkey: ["altKey", "KeyT"],
|
|
1565
|
+
position: "bottom-right",
|
|
1566
|
+
theme: "light",
|
|
1567
|
+
visibleToasts: VISIBLE_TOASTS_AMOUNT
|
|
1568
|
+
}, props);
|
|
1569
|
+
const initialTheme = untrack(() => createToastTheme(propsWithDefaults.theme));
|
|
1570
|
+
const [toastsStore, setToastsStore] = createStore({ toasts: [] });
|
|
1571
|
+
const filteredToasts = createMemo(() => {
|
|
1572
|
+
const { toasts } = toastsStore;
|
|
1573
|
+
if (propsWithDefaults.id !== void 0 && propsWithDefaults.id !== "") return toasts.filter((toast) => toast.toasterId === propsWithDefaults.id);
|
|
1574
|
+
return toasts.filter((toast) => toast.toasterId === void 0 || toast.toasterId === "");
|
|
1575
|
+
});
|
|
1576
|
+
const possiblePositions = createMemo(() => [.../* @__PURE__ */ new Set([propsWithDefaults.position, ...filteredToasts().filter((toast) => toast.position !== void 0).map((toast) => toast.position)])]);
|
|
1577
|
+
const [heights, setHeights] = createSignal([]);
|
|
1578
|
+
const [expanded, setExpanded] = createSignal(false);
|
|
1579
|
+
const [interacting, setInteracting] = createSignal(false);
|
|
1580
|
+
const [actualTheme, setActualTheme] = createSignal(initialTheme);
|
|
1581
|
+
const [lastFocusedElementRef, setLastFocusedElementRef] = createSignal(null);
|
|
1582
|
+
const [isFocusWithinRef, setIsFocusWithinRef] = createSignal(false);
|
|
1583
|
+
let listRef;
|
|
1584
|
+
const hotkeyLabel = () => propsWithDefaults.hotkey.join("+").replaceAll("Key", "").replaceAll("Digit", "");
|
|
1585
|
+
const className = () => mergeClassName(propsWithDefaults.className, propsWithDefaults.class);
|
|
1586
|
+
const toastOptions = () => propsWithDefaults.toastOptions;
|
|
1587
|
+
const toastClassNames = () => mergeClassNames(toastOptions()?.classNames, toastOptions()?.classes);
|
|
1588
|
+
const toastDescriptionClassName = () => mergeDescriptionClassName(toastOptions()?.descriptionClassName, toastOptions()?.descriptionClass);
|
|
1589
|
+
const toastClassName = () => mergeClassName(toastOptions()?.className, toastOptions()?.class);
|
|
1590
|
+
const removeToast = (toastToRemove) => {
|
|
1591
|
+
if (!untrack(() => toastsStore.toasts.find((toast) => toast.id === toastToRemove.id)?.delete === true)) ToastState.dismiss(toastToRemove.id);
|
|
1592
|
+
setToastsStore((draft) => {
|
|
1593
|
+
draft.toasts = draft.toasts.filter(({ id }) => id !== toastToRemove.id);
|
|
1594
|
+
});
|
|
1595
|
+
};
|
|
1596
|
+
onSettled(() => ToastState.subscribe((toastItem) => {
|
|
1597
|
+
setToastsStore((draft) => {
|
|
1598
|
+
if ("dismiss" in toastItem) {
|
|
1599
|
+
const existing = draft.toasts.find((toast) => toast.id === toastItem.id);
|
|
1600
|
+
if (existing) existing.delete = true;
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
const index = draft.toasts.findIndex((toast) => toast.id === toastItem.id);
|
|
1604
|
+
const existing = draft.toasts[index];
|
|
1605
|
+
if (existing === void 0) draft.toasts.unshift(toastItem);
|
|
1606
|
+
else if (existing.delete === true) draft.toasts[index] = toastItem;
|
|
1607
|
+
else Object.assign(existing, toastItem);
|
|
1608
|
+
});
|
|
1609
|
+
}));
|
|
1610
|
+
createEffect(() => propsWithDefaults.theme, (theme) => {
|
|
1611
|
+
if (theme !== "system") {
|
|
1612
|
+
setActualTheme(theme);
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
if (typeof window === "undefined") return;
|
|
1616
|
+
const query = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1617
|
+
const updateTheme = () => {
|
|
1618
|
+
setActualTheme(query.matches ? "dark" : "light");
|
|
1619
|
+
};
|
|
1620
|
+
updateTheme();
|
|
1621
|
+
query.addEventListener("change", updateTheme);
|
|
1622
|
+
return () => {
|
|
1623
|
+
query.removeEventListener("change", updateTheme);
|
|
1624
|
+
};
|
|
1625
|
+
});
|
|
1626
|
+
createEffect(() => filteredToasts().length, (length) => {
|
|
1627
|
+
if (length <= 1) setExpanded(false);
|
|
1628
|
+
});
|
|
1629
|
+
function handleKeyDown(event) {
|
|
1630
|
+
const modifierKeys = /* @__PURE__ */ new Map([
|
|
1631
|
+
["altKey", event.altKey],
|
|
1632
|
+
["ctrlKey", event.ctrlKey],
|
|
1633
|
+
["metaKey", event.metaKey],
|
|
1634
|
+
["shiftKey", event.shiftKey]
|
|
1635
|
+
]);
|
|
1636
|
+
if (propsWithDefaults.hotkey.length > 0 && propsWithDefaults.hotkey.every((key) => modifierKeys.get(key) === true || event.code === key)) setExpanded(true);
|
|
1637
|
+
if (event.code === "Escape" && (document.activeElement === listRef || false)) setExpanded(false);
|
|
1638
|
+
}
|
|
1639
|
+
onSettled(() => {
|
|
1640
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1641
|
+
return () => {
|
|
1642
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
1643
|
+
};
|
|
1644
|
+
});
|
|
1645
|
+
onCleanup(() => {
|
|
1646
|
+
if (lastFocusedElementRef()) lastFocusedElementRef()?.focus({ preventScroll: true });
|
|
1647
|
+
});
|
|
1648
|
+
var _v$60 = ssrHydrationKey(), _v$61 = () => {
|
|
1649
|
+
return ssrAttribute("aria-label", escape(propsWithDefaults.customAriaLabel ?? `${propsWithDefaults.containerAriaLabel} ${hotkeyLabel()}`, true));
|
|
1650
|
+
}, _v$62 = escape(For(new _P$15(possiblePositions, (position, index) => {
|
|
1651
|
+
var _v$63, _g$6, _v$68, _v$69;
|
|
1652
|
+
const [y, x] = position.split("-");
|
|
1653
|
+
const toastsByPosition = createMemo(() => filteredToasts().filter((toast) => !toast.position && index() === 0 || toast.position === position));
|
|
1654
|
+
const heightsByPosition = createMemo(() => heights().filter((height) => index() === 0 && !height.position || height.position === position));
|
|
1655
|
+
return Show({
|
|
1656
|
+
get when() {
|
|
1657
|
+
return filteredToasts().length > 0;
|
|
1658
|
+
},
|
|
1659
|
+
get children() {
|
|
1660
|
+
return _v$63 = ssrHydrationKey(), _g$6 = ssrGroup(() => {
|
|
1661
|
+
return [
|
|
1662
|
+
ssrAttribute("dir", propsWithDefaults.dir === "auto" ? escape(getDocumentDirection(), true) : escape(propsWithDefaults.dir, true)),
|
|
1663
|
+
((_v$65) => _v$65 == null ? "" : ssrAttribute("class", ssrClassName(_v$65)))(className()),
|
|
1664
|
+
ssrAttribute("data-sonner-theme", escape(actualTheme(), true))
|
|
1665
|
+
];
|
|
1666
|
+
}, 3), _v$68 = () => {
|
|
1667
|
+
return ssrStyle({
|
|
1668
|
+
"--front-toast-height": `${heightsByPosition()[0]?.height ?? 0}px`,
|
|
1669
|
+
"--gap": `${propsWithDefaults.gap}px`,
|
|
1670
|
+
"--width": "356px",
|
|
1671
|
+
...propsWithDefaults.style,
|
|
1672
|
+
...assignOffset(propsWithDefaults.offset, propsWithDefaults.mobileOffset)
|
|
1673
|
+
});
|
|
1674
|
+
}, _v$69 = escape(For(new _P$14(toastsByPosition, (toastItem, toastIndex) => Toast(new _P$13(propsWithDefaults, toastIndex, toastOptions, toastClassName, toastDescriptionClassName, interacting, toastClassNames, toastsByPosition, heightsByPosition, expanded, toastItem, position, removeToast, setHeights))))), ssr(_tmpl$9, _v$63, _g$6, _g$6, _g$6, ssrAttribute("data-y-position", escape(y, true)), ssrAttribute("data-x-position", escape(x, true)), _v$68, _v$69);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
})));
|
|
1678
|
+
return ssr(_tmpl$8, _v$60, _v$61, _v$62);
|
|
1679
|
+
}
|
|
1680
|
+
export { Toaster, toast, useSonner };
|
|
1681
|
+
|
|
1682
|
+
//# sourceMappingURL=index.js.map
|