@t007/toast 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +16 -16
- package/dist/index.global.js +6 -9
- package/dist/index.js +3 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -127,16 +127,16 @@ export interface Toast {
|
|
|
127
127
|
/** Create a default toast.
|
|
128
128
|
* @param render Body text for the toast.
|
|
129
129
|
* @param options Toast configuration.
|
|
130
|
-
* @returns Toast id
|
|
130
|
+
* @returns Toast `id`.
|
|
131
131
|
*/
|
|
132
132
|
(render?: string, options?: ToastOptions): string;
|
|
133
|
-
/** Check if a toast is currently active.
|
|
134
|
-
* @param id Toast id
|
|
135
|
-
* @returns True if the toast is active, false otherwise.
|
|
133
|
+
/** Check if a toast is currently active with the id or any toast if no `id` provided.
|
|
134
|
+
* @param id Toast `id`.
|
|
135
|
+
* @returns True if the toast is visibly active, i.e, not delayed; false otherwise.
|
|
136
136
|
*/
|
|
137
137
|
isActive(id: string): boolean;
|
|
138
|
-
/** Update an existing toast by id
|
|
139
|
-
* @param id Toast id
|
|
138
|
+
/** Update an existing toast by `id`.
|
|
139
|
+
* @param id Toast `id`.
|
|
140
140
|
* @param options Options to apply.
|
|
141
141
|
* @returns Updated toast id or false when no toast was found.
|
|
142
142
|
*/
|
|
@@ -144,31 +144,31 @@ export interface Toast {
|
|
|
144
144
|
/** Show an info toast.
|
|
145
145
|
* @param renderOrId Body text or toast id.
|
|
146
146
|
* @param options Toast configuration.
|
|
147
|
-
* @returns Toast id
|
|
147
|
+
* @returns Toast `id`.
|
|
148
148
|
*/
|
|
149
149
|
info(renderOrId?: string, options?: ToastOptions): string;
|
|
150
150
|
/** Show a success toast.
|
|
151
151
|
* @param renderOrId Body text or toast id.
|
|
152
152
|
* @param options Toast configuration.
|
|
153
|
-
* @returns Toast id
|
|
153
|
+
* @returns Toast `id`.
|
|
154
154
|
*/
|
|
155
155
|
success(renderOrId?: string, options?: ToastOptions): string;
|
|
156
156
|
/** Show a warning toast.
|
|
157
157
|
* @param renderOrId Body text or toast id.
|
|
158
158
|
* @param options Toast configuration.
|
|
159
|
-
* @returns Toast id
|
|
159
|
+
* @returns Toast `id`.
|
|
160
160
|
*/
|
|
161
161
|
warn(renderOrId?: string, options?: ToastOptions): string;
|
|
162
162
|
/** Show an error toast.
|
|
163
163
|
* @param renderOrId Body text or toast id.
|
|
164
164
|
* @param options Toast configuration.
|
|
165
|
-
* @returns Toast id
|
|
165
|
+
* @returns Toast `id`.
|
|
166
166
|
*/
|
|
167
167
|
error(renderOrId?: string, options?: ToastOptions): string;
|
|
168
168
|
/** Show a loading toast.
|
|
169
169
|
* @param renderOrId Body text or toast id.
|
|
170
170
|
* @param options Toast configuration.
|
|
171
|
-
* @returns Toast id
|
|
171
|
+
* @returns Toast `id`.
|
|
172
172
|
*/
|
|
173
173
|
loading(renderOrId?: string, options?: ToastOptions): string;
|
|
174
174
|
/** Bind a promise to the toast lifecycle.
|
|
@@ -178,23 +178,23 @@ export interface Toast {
|
|
|
178
178
|
*/
|
|
179
179
|
promise<T>(promise: Promise<T>, config?: ToastPromiseConfig<T>): Promise<T>;
|
|
180
180
|
/** Dismiss a single toast or the whole stack.
|
|
181
|
-
* @param id Toast id to dismiss.
|
|
181
|
+
* @param id Toast `id` to dismiss.
|
|
182
182
|
* @param manner Removal mode.
|
|
183
183
|
* @param timeElapsed Whether the auto-close timer already elapsed.
|
|
184
184
|
*/
|
|
185
185
|
dismiss(id?: string, manner?: "smooth" | "instant", timeElapsed?: boolean): void;
|
|
186
|
-
/** Dismiss every toast that matches an optional
|
|
187
|
-
* @param groupId Optional id
|
|
186
|
+
/** Dismiss every toast that matches an optional group id or the whole stack.
|
|
187
|
+
* @param groupId Optional group id filter.
|
|
188
188
|
*/
|
|
189
189
|
dismissAll(groupId?: string): void;
|
|
190
190
|
/** Run an action against every matching toast instance.
|
|
191
191
|
* @param action Instance method to invoke.
|
|
192
192
|
* @param options Options forwarded to the instance method.
|
|
193
|
-
* @param groupId Optional id
|
|
193
|
+
* @param groupId Optional group id filter.
|
|
194
194
|
*/
|
|
195
195
|
doForAll(action: string, options?: any, groupId?: string): void;
|
|
196
196
|
/** Return every matching toast instance.
|
|
197
|
-
* @param groupId Optional id
|
|
197
|
+
* @param groupId Optional group id filter.
|
|
198
198
|
* @returns Matching toast instances.
|
|
199
199
|
*/
|
|
200
200
|
getAll(groupId?: string): ToastInstance[];
|
package/dist/index.global.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
return Math.min(Math.max(val, min), max);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
// ../../../sia-reactor/dist/chunk-
|
|
8
|
+
// ../../../sia-reactor/dist/chunk-RI45W4O6.js
|
|
9
9
|
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
10
10
|
return assignEl(el, props, dataset, styles), el;
|
|
11
11
|
}
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
return "object" === typeof obj && obj !== null && (arraycheck ? !Array.isArray(obj) : true);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// ../utils/dist/chunk-
|
|
60
|
-
var INTERACTIVE_SELECTOR =
|
|
59
|
+
// ../utils/dist/chunk-N5KX6IW4.js
|
|
60
|
+
var INTERACTIVE_SELECTOR = ":is(button,[href],input:not([type='hidden']),select,textarea,details>summary,[contenteditable='true'],iframe,audio[controls],video[controls],[tabindex]):not([disabled],[tabindex='-1'],[data-focus-guard],[inert],[inert] *)";
|
|
61
61
|
var isInteractive = (target) => target instanceof HTMLElement && target.matches(INTERACTIVE_SELECTOR);
|
|
62
62
|
var VIRTUAL_RESOURCE = /* @__PURE__ */ Symbol.for("T007_VIRTUAL_RESOURCE");
|
|
63
63
|
function loadResource(req, type = "style", { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts = 3, retryKey = false } = {}, w = window) {
|
|
@@ -405,9 +405,8 @@
|
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
407
|
var toasting = {
|
|
408
|
-
isActive(_, id) {
|
|
409
|
-
|
|
410
|
-
return !!toast2 && !toast2.inactive;
|
|
408
|
+
isActive(_, id, _toast = t007.toasts.get(id)) {
|
|
409
|
+
return isDef(id) ? !!_toast && !_toast.inactive : t007.toasts.size > 0 && [...t007.toasts.values()].some((toast2) => !toast2.inactive);
|
|
411
410
|
},
|
|
412
411
|
update(base, id, options, _toast) {
|
|
413
412
|
const toast2 = _toast ?? t007.toasts.get(id);
|
|
@@ -479,9 +478,7 @@
|
|
|
479
478
|
var toast = toaster();
|
|
480
479
|
var index_default = toast;
|
|
481
480
|
if ("undefined" !== typeof window) {
|
|
482
|
-
t007.toast = toast;
|
|
483
|
-
t007.toasting = toasting;
|
|
484
|
-
t007.toaster = toaster;
|
|
481
|
+
t007.toast = toast, t007.toasting = toasting, t007.toaster = toaster;
|
|
485
482
|
t007.toasts = /* @__PURE__ */ new Map();
|
|
486
483
|
t007.TOAST_DEFAULT_OPTIONS ??= {}, t007.TOAST_DURATIONS ??= {}, t007.TOAST_VIBRATIONS ??= {}, t007.TOAST_ICONS ??= {};
|
|
487
484
|
t007.TOAST_DEFAULT_OPTIONS.render ??= "";
|
package/dist/index.js
CHANGED
|
@@ -280,9 +280,8 @@ var T007_Toast = class {
|
|
|
280
280
|
}
|
|
281
281
|
};
|
|
282
282
|
var toasting = {
|
|
283
|
-
isActive(_, id) {
|
|
284
|
-
|
|
285
|
-
return !!toast2 && !toast2.inactive;
|
|
283
|
+
isActive(_, id, _toast = t007.toasts.get(id)) {
|
|
284
|
+
return isDef(id) ? !!_toast && !_toast.inactive : t007.toasts.size > 0 && [...t007.toasts.values()].some((toast2) => !toast2.inactive);
|
|
286
285
|
},
|
|
287
286
|
update(base, id, options, _toast) {
|
|
288
287
|
const toast2 = _toast ?? t007.toasts.get(id);
|
|
@@ -354,9 +353,7 @@ var toaster = (defOptions = {}, groupId = "t007_toast_") => {
|
|
|
354
353
|
var toast = toaster();
|
|
355
354
|
var index_default = toast;
|
|
356
355
|
if ("undefined" !== typeof window) {
|
|
357
|
-
t007.toast = toast;
|
|
358
|
-
t007.toasting = toasting;
|
|
359
|
-
t007.toaster = toaster;
|
|
356
|
+
t007.toast = toast, t007.toasting = toasting, t007.toaster = toaster;
|
|
360
357
|
t007.toasts = /* @__PURE__ */ new Map();
|
|
361
358
|
t007.TOAST_DEFAULT_OPTIONS ??= {}, t007.TOAST_DURATIONS ??= {}, t007.TOAST_VIBRATIONS ??= {}, t007.TOAST_ICONS ??= {};
|
|
362
359
|
t007.TOAST_DEFAULT_OPTIONS.render ??= "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t007/toast",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "A lightweight, pure JS toast system.",
|
|
5
5
|
"author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"promise"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@t007/utils": "^0.0.
|
|
57
|
+
"@t007/utils": "^0.0.27"
|
|
58
58
|
}
|
|
59
59
|
}
|