varsel 0.5.4 → 0.6.0
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/VarselItem.svelte +825 -735
- package/dist/VarselItem.svelte.d.ts +1 -0
- package/dist/VarselItem.svelte.d.ts.map +1 -1
- package/dist/VarselManager.svelte +473 -360
- package/dist/VarselManager.svelte.d.ts +1 -1
- package/dist/VarselManager.svelte.d.ts.map +1 -1
- package/dist/VarselToaster.svelte +22 -22
- package/dist/VarselToaster.svelte.d.ts +2 -2
- package/dist/VarselToaster.svelte.d.ts.map +1 -1
- package/dist/core/accessibility.d.ts +14 -0
- package/dist/core/accessibility.d.ts.map +1 -1
- package/dist/core/accessibility.js +64 -0
- package/dist/core/swipe.d.ts +6 -0
- package/dist/core/swipe.d.ts.map +1 -1
- package/dist/core/swipe.js +6 -0
- package/dist/core/toast-factory.d.ts.map +1 -1
- package/dist/core/toast-factory.js +15 -9
- package/dist/core/toast-state.d.ts +8 -4
- package/dist/core/toast-state.d.ts.map +1 -1
- package/dist/core/toast-state.js +19 -5
- package/dist/core/toaster-instances.d.ts.map +1 -1
- package/dist/core/toaster-instances.js +1 -2
- package/dist/core/types.d.ts +42 -9
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/variants.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internals.d.ts +4 -4
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +3 -3
- package/dist/styles.css +49 -49
- package/dist/variant-icons.d.ts +25 -51
- package/dist/variant-icons.d.ts.map +1 -1
- package/dist/variant-icons.js +27 -17
- package/package.json +1 -2
|
@@ -10,7 +10,7 @@ type $$ComponentProps = {
|
|
|
10
10
|
closeButton?: boolean;
|
|
11
11
|
pauseOnHover?: boolean;
|
|
12
12
|
offset?: number | string;
|
|
13
|
-
dir?:
|
|
13
|
+
dir?: "ltr" | "rtl" | "auto";
|
|
14
14
|
};
|
|
15
15
|
declare const VarselManager: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
16
|
type VarselManager = ReturnType<typeof VarselManager>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarselManager.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselManager.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,
|
|
1
|
+
{"version":3,"file":"VarselManager.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselManager.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,MAAM,aAAa,CAAC;AAErB,KAAK,gBAAgB,GAAI;IACxB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CAC7B,CAAC;AAmgBH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./internals";
|
|
2
|
+
/**
|
|
3
|
+
* Main module exports for the Varsel library.
|
|
4
|
+
*/
|
|
5
|
+
export {
|
|
6
|
+
toast,
|
|
7
|
+
type ToastData,
|
|
8
|
+
type ToastInvoker,
|
|
9
|
+
type ToastPosition,
|
|
10
|
+
} from "./internals";
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
@@ -18,28 +18,28 @@ export {
|
|
|
18
18
|
* It subscribes to the global toast state and renders the `VarselManager`
|
|
19
19
|
* which handles the positioning and layout of individual toasts.
|
|
20
20
|
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import { onMount } from
|
|
24
|
-
import VarselManager from
|
|
21
|
+
* Place this component once in your application's root layout (e.g., `+layout.svelte`).
|
|
22
|
+
*/
|
|
23
|
+
import { onMount } from "svelte";
|
|
24
|
+
import VarselManager from "./VarselManager.svelte";
|
|
25
25
|
import {
|
|
26
26
|
toastState,
|
|
27
27
|
toasterInstanceManager,
|
|
28
28
|
type ToastData,
|
|
29
29
|
type ToastPosition,
|
|
30
|
-
} from
|
|
30
|
+
} from "./internals";
|
|
31
31
|
|
|
32
|
-
let {
|
|
32
|
+
let {
|
|
33
33
|
expandedGap = undefined,
|
|
34
|
-
position =
|
|
34
|
+
position = "bottom-center",
|
|
35
35
|
visibleToasts = 3,
|
|
36
36
|
expand = true,
|
|
37
37
|
duration = 5000,
|
|
38
38
|
closeButton = true,
|
|
39
39
|
pauseOnHover = true,
|
|
40
40
|
offset = undefined,
|
|
41
|
-
dir =
|
|
42
|
-
}: {
|
|
41
|
+
dir = "auto",
|
|
42
|
+
}: {
|
|
43
43
|
/**
|
|
44
44
|
* The gap (in pixels) between expanded toasts when hovering over the stack.
|
|
45
45
|
* If undefined, uses the default value from animation config.
|
|
@@ -60,7 +60,7 @@ export {
|
|
|
60
60
|
/** Offset from the edge of the screen. */
|
|
61
61
|
offset?: number | string;
|
|
62
62
|
/** Directionality of the text. */
|
|
63
|
-
dir?:
|
|
63
|
+
dir?: "ltr" | "rtl" | "auto";
|
|
64
64
|
} = $props();
|
|
65
65
|
|
|
66
66
|
let toasts = $state<ToastData[]>([]);
|
|
@@ -88,9 +88,9 @@ export {
|
|
|
88
88
|
</script>
|
|
89
89
|
|
|
90
90
|
{#if instanceId && toasterInstanceManager.isActiveInstance(instanceId)}
|
|
91
|
-
<VarselManager
|
|
92
|
-
{toasts}
|
|
93
|
-
onRemove={handleRemove}
|
|
91
|
+
<VarselManager
|
|
92
|
+
{toasts}
|
|
93
|
+
onRemove={handleRemove}
|
|
94
94
|
{expandedGap}
|
|
95
95
|
{position}
|
|
96
96
|
{visibleToasts}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Main module exports for the Varsel library.
|
|
3
3
|
*/
|
|
4
4
|
export { toast, type ToastData, type ToastInvoker, type ToastPosition, } from "./internals";
|
|
5
|
-
import { type ToastPosition } from
|
|
5
|
+
import { type ToastPosition } from "./internals";
|
|
6
6
|
type $$ComponentProps = {
|
|
7
7
|
/**
|
|
8
8
|
* The gap (in pixels) between expanded toasts when hovering over the stack.
|
|
@@ -24,7 +24,7 @@ type $$ComponentProps = {
|
|
|
24
24
|
/** Offset from the edge of the screen. */
|
|
25
25
|
offset?: number | string;
|
|
26
26
|
/** Directionality of the text. */
|
|
27
|
-
dir?:
|
|
27
|
+
dir?: "ltr" | "rtl" | "auto";
|
|
28
28
|
};
|
|
29
29
|
declare const VarselToaster: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
30
30
|
type VarselToaster = ReturnType<typeof VarselToaster>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarselToaster.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselToaster.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VarselToaster.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselToaster.svelte.ts"],"names":[],"mappings":"AAGC;;GAEG;AACH,OAAO,EACN,KAAK,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,GAClB,MAAM,aAAa,CAAC;AActB,OAAO,EAIL,KAAK,aAAa,EAClB,MAAM,aAAa,CAAC;AAErB,KAAK,gBAAgB,GAAI;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,kCAAkC;IAClC,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CAC7B,CAAC;AAmDH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -3,4 +3,18 @@
|
|
|
3
3
|
* Used for managing keyboard focus when interacting with toasts containing actions.
|
|
4
4
|
*/
|
|
5
5
|
export declare const FOCUSABLE_SELECTORS: string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns true when the element currently matches `:focus-visible`, i.e. focus
|
|
8
|
+
* was acquired via keyboard or another mechanism the user agent considers
|
|
9
|
+
* keyboard-equivalent. Used to gate behaviors (such as pausing toast timers)
|
|
10
|
+
* that should only respond to keyboard focus, not mouse-induced focus.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isFocusVisible: (el: Element | null | undefined) => boolean;
|
|
13
|
+
export declare const focusManager: {
|
|
14
|
+
savePrevFocus(): void;
|
|
15
|
+
restoreFocusToPrevElement(): void;
|
|
16
|
+
getPrevFocus(): HTMLElement | null;
|
|
17
|
+
isClaimed(): boolean;
|
|
18
|
+
releaseClaim(): void;
|
|
19
|
+
};
|
|
6
20
|
//# sourceMappingURL=accessibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/lib/core/accessibility.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAOpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../src/lib/core/accessibility.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAOpB,CAAC;AAEb;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,OAAO,GAAG,IAAI,GAAG,SAAS,KAAG,OAO/D,CAAC;AAcF,eAAO,MAAM,YAAY;qBACP,IAAI;iCAUQ,IAAI;oBAYjB,WAAW,GAAG,IAAI;iBAGrB,OAAO;oBAGJ,IAAI;CAIpB,CAAC"}
|
|
@@ -10,3 +10,67 @@ export const FOCUSABLE_SELECTORS = [
|
|
|
10
10
|
"a[href]",
|
|
11
11
|
'[tabindex]:not([tabindex="-1"])',
|
|
12
12
|
].join(", ");
|
|
13
|
+
/**
|
|
14
|
+
* Returns true when the element currently matches `:focus-visible`, i.e. focus
|
|
15
|
+
* was acquired via keyboard or another mechanism the user agent considers
|
|
16
|
+
* keyboard-equivalent. Used to gate behaviors (such as pausing toast timers)
|
|
17
|
+
* that should only respond to keyboard focus, not mouse-induced focus.
|
|
18
|
+
*/
|
|
19
|
+
export const isFocusVisible = (el) => {
|
|
20
|
+
if (!el || typeof el.matches !== "function")
|
|
21
|
+
return false;
|
|
22
|
+
try {
|
|
23
|
+
return el.matches(":focus-visible");
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Module-level focus bookkeeping shared by the toaster. Tracks the element
|
|
31
|
+
* that held focus before the user jumped into the toast region (via `F6`),
|
|
32
|
+
* so that leaving the region (via `Tab` past a focus guard or by dismissing
|
|
33
|
+
* the focused toast) can restore focus to where the user was before.
|
|
34
|
+
*
|
|
35
|
+
* Only one toaster instance is active at a time (see `toasterInstanceManager`),
|
|
36
|
+
* which is why a module-level singleton is acceptable here.
|
|
37
|
+
*/
|
|
38
|
+
let prevFocusElement = null;
|
|
39
|
+
let toastRegionClaimed = false;
|
|
40
|
+
export const focusManager = {
|
|
41
|
+
savePrevFocus() {
|
|
42
|
+
if (typeof document === "undefined")
|
|
43
|
+
return;
|
|
44
|
+
const active = document.activeElement;
|
|
45
|
+
if (active instanceof HTMLElement && active !== document.body) {
|
|
46
|
+
prevFocusElement = active;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
prevFocusElement = null;
|
|
50
|
+
}
|
|
51
|
+
toastRegionClaimed = true;
|
|
52
|
+
},
|
|
53
|
+
restoreFocusToPrevElement() {
|
|
54
|
+
toastRegionClaimed = false;
|
|
55
|
+
const target = prevFocusElement;
|
|
56
|
+
prevFocusElement = null;
|
|
57
|
+
if (target && typeof document !== "undefined" && document.contains(target)) {
|
|
58
|
+
try {
|
|
59
|
+
target.focus({ preventScroll: true });
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
target.focus();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
getPrevFocus() {
|
|
67
|
+
return prevFocusElement;
|
|
68
|
+
},
|
|
69
|
+
isClaimed() {
|
|
70
|
+
return toastRegionClaimed;
|
|
71
|
+
},
|
|
72
|
+
releaseClaim() {
|
|
73
|
+
toastRegionClaimed = false;
|
|
74
|
+
prevFocusElement = null;
|
|
75
|
+
},
|
|
76
|
+
};
|
package/dist/core/swipe.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export declare const SWIPE_DISMISS_THRESHOLD = 45;
|
|
|
9
9
|
export declare const SWIPE_DISMISS_VELOCITY = 0.11;
|
|
10
10
|
/** Distance in pixels to move the toast during the exit animation after a swipe. */
|
|
11
11
|
export declare const SWIPE_EXIT_DISTANCE = 600;
|
|
12
|
+
/**
|
|
13
|
+
* Distance the pointer must travel back from the furthest swipe position before
|
|
14
|
+
* the in-progress swipe is treated as cancelled (a "change of mind"). Once
|
|
15
|
+
* cancelled, releasing the pointer snaps the toast back instead of dismissing it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SWIPE_REVERSE_CANCEL_THRESHOLD = 10;
|
|
12
18
|
/**
|
|
13
19
|
* Determines the allowed swipe directions based on the toast's position.
|
|
14
20
|
* For example, a "top-right" toast can be swiped "top" or "right".
|
package/dist/core/swipe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swipe.d.ts","sourceRoot":"","sources":["../../src/lib/core/swipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AACjE,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,CAAC;AAElC,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,oFAAoF;AACpF,eAAO,MAAM,mBAAmB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"swipe.d.ts","sourceRoot":"","sources":["../../src/lib/core/swipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AACjE,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,CAAC;AAElC,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,oFAAoF;AACpF,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,WAAW,aAAa,GAAG,IAAI,KAC7B,cAAc,EAqBhB,CAAC"}
|
package/dist/core/swipe.js
CHANGED
|
@@ -4,6 +4,12 @@ export const SWIPE_DISMISS_THRESHOLD = 45;
|
|
|
4
4
|
export const SWIPE_DISMISS_VELOCITY = 0.11;
|
|
5
5
|
/** Distance in pixels to move the toast during the exit animation after a swipe. */
|
|
6
6
|
export const SWIPE_EXIT_DISTANCE = 600;
|
|
7
|
+
/**
|
|
8
|
+
* Distance the pointer must travel back from the furthest swipe position before
|
|
9
|
+
* the in-progress swipe is treated as cancelled (a "change of mind"). Once
|
|
10
|
+
* cancelled, releasing the pointer snaps the toast back instead of dismissing it.
|
|
11
|
+
*/
|
|
12
|
+
export const SWIPE_REVERSE_CANCEL_THRESHOLD = 10;
|
|
7
13
|
/**
|
|
8
14
|
* Determines the allowed swipe directions based on the toast's position.
|
|
9
15
|
* For example, a "top-right" toast can be swiped "top" or "right".
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-factory.d.ts","sourceRoot":"","sources":["../../src/lib/core/toast-factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"toast-factory.d.ts","sourceRoot":"","sources":["../../src/lib/core/toast-factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIX,YAAY,EAGZ,MAAM,SAAS,CAAC;AAuLjB,eAAO,MAAM,KAAK,cAAc,CAAC"}
|
|
@@ -87,7 +87,8 @@ options) => {
|
|
|
87
87
|
*
|
|
88
88
|
* @param promise - The promise to observe.
|
|
89
89
|
* @param options - Configuration for loading, success, and error states.
|
|
90
|
-
* @returns
|
|
90
|
+
* @returns A promise that resolves with the original value or rejects with
|
|
91
|
+
* the original error, so callers can `await` the underlying work.
|
|
91
92
|
*/
|
|
92
93
|
createToast.promise = (promise, options) => {
|
|
93
94
|
const loadingData = normalizeToastData(options.loading);
|
|
@@ -117,17 +118,22 @@ createToast.promise = (promise, options) => {
|
|
|
117
118
|
duration: 5000,
|
|
118
119
|
});
|
|
119
120
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.catch((error) => {
|
|
125
|
-
return handleResult(options.error, error, "destructive");
|
|
126
|
-
})
|
|
121
|
+
const source = Promise.resolve(promise);
|
|
122
|
+
void source
|
|
123
|
+
.then((value) => handleResult(options.success, value, "success"))
|
|
124
|
+
.catch((error) => handleResult(options.error, error, "destructive"))
|
|
127
125
|
.catch((error) => {
|
|
128
126
|
applyPromiseFallback(error);
|
|
129
127
|
});
|
|
130
|
-
return
|
|
128
|
+
return source;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Updates an existing toast in place.
|
|
132
|
+
* Accepts a string (shorthand for `{ description }`) or a partial data object.
|
|
133
|
+
*/
|
|
134
|
+
createToast.update = (id, data) => {
|
|
135
|
+
const payload = typeof data === "string" ? { description: data } : data;
|
|
136
|
+
toastState.update(id, payload);
|
|
131
137
|
};
|
|
132
138
|
/**
|
|
133
139
|
* Dismisses a toast by ID.
|
|
@@ -16,11 +16,15 @@ declare class ToastState {
|
|
|
16
16
|
private notify;
|
|
17
17
|
private generateId;
|
|
18
18
|
/**
|
|
19
|
-
* Adds a new toast to the state
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
19
|
+
* Adds a new toast to the state, or updates an existing one in place
|
|
20
|
+
* when `data.id` matches a toast that is still active.
|
|
21
|
+
* @param data - The toast configuration. If `id` is provided and refers
|
|
22
|
+
* to an active toast, the call performs an upsert and returns that id.
|
|
23
|
+
* @returns The id of the created or updated toast.
|
|
22
24
|
*/
|
|
23
|
-
add(data: Omit<ToastData, "id">
|
|
25
|
+
add(data: Omit<ToastData, "id"> & {
|
|
26
|
+
id?: string;
|
|
27
|
+
}): string;
|
|
24
28
|
/**
|
|
25
29
|
* Removes a toast from the state by its ID.
|
|
26
30
|
* @param id - The ID of the toast to remove.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-state.d.ts","sourceRoot":"","sources":["../../src/lib/core/toast-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;;GAGG;AACH,cAAM,UAAU;IACf,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,SAAS,CAAK;IAEtB;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAOhD,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,UAAU;IAIlB
|
|
1
|
+
{"version":3,"file":"toast-state.d.ts","sourceRoot":"","sources":["../../src/lib/core/toast-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;;GAGG;AACH,cAAM,UAAU;IACf,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,SAAS,CAAK;IAEtB;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAOhD,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,UAAU;IAIlB;;;;;;OAMG;IACH,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAsB1D;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;IAOlD;;;OAGG;IACH,UAAU,IAAI,IAAI;IASlB;;;OAGG;IACH,SAAS,IAAI,SAAS,EAAE;CAGxB;AAED,oDAAoD;AACpD,eAAO,MAAM,UAAU,YAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/core/toast-state.js
CHANGED
|
@@ -26,13 +26,27 @@ class ToastState {
|
|
|
26
26
|
return `toast-${Date.now()}-${++this.idCounter}`;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Adds a new toast to the state
|
|
30
|
-
*
|
|
31
|
-
* @
|
|
29
|
+
* Adds a new toast to the state, or updates an existing one in place
|
|
30
|
+
* when `data.id` matches a toast that is still active.
|
|
31
|
+
* @param data - The toast configuration. If `id` is provided and refers
|
|
32
|
+
* to an active toast, the call performs an upsert and returns that id.
|
|
33
|
+
* @returns The id of the created or updated toast.
|
|
32
34
|
*/
|
|
33
35
|
add(data) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
+
const requestedId = data.id;
|
|
37
|
+
if (requestedId) {
|
|
38
|
+
const existing = this.toasts.find((toast) => toast.id === requestedId);
|
|
39
|
+
if (existing && !existing.shouldClose && !existing.isLeaving) {
|
|
40
|
+
const { id: _ignored, ...updates } = data;
|
|
41
|
+
void _ignored;
|
|
42
|
+
this.update(requestedId, updates);
|
|
43
|
+
return requestedId;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const id = requestedId ?? this.generateId();
|
|
47
|
+
const { id: _ignored, ...rest } = data;
|
|
48
|
+
void _ignored;
|
|
49
|
+
const newToast = { ...rest, id };
|
|
36
50
|
// Add new toasts to the beginning of the array (stack LIFO visually for some positions, logic handled in manager)
|
|
37
51
|
this.toasts = [newToast, ...this.toasts];
|
|
38
52
|
this.notify();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster-instances.d.ts","sourceRoot":"","sources":["../../src/lib/core/toaster-instances.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAM,sBAAsB;IAC3B,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,WAAW,CAAgB;IAEnC;;;OAGG;IACH,gBAAgB,IAAI,MAAM;
|
|
1
|
+
{"version":3,"file":"toaster-instances.d.ts","sourceRoot":"","sources":["../../src/lib/core/toaster-instances.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAM,sBAAsB;IAC3B,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,WAAW,CAAgB;IAEnC;;;OAGG;IACH,gBAAgB,IAAI,MAAM;IAS1B;;;OAGG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAY5C;;;;OAIG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAG7C;AAED,eAAO,MAAM,sBAAsB,wBAA+B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -13,8 +13,7 @@ class ToasterInstanceManager {
|
|
|
13
13
|
registerInstance() {
|
|
14
14
|
const instanceId = `toaster-${++this.instanceCounter}`;
|
|
15
15
|
this.instanceIds.push(instanceId);
|
|
16
|
-
if (!this.activeInstanceId ||
|
|
17
|
-
!this.instanceIds.includes(this.activeInstanceId)) {
|
|
16
|
+
if (!this.activeInstanceId || !this.instanceIds.includes(this.activeInstanceId)) {
|
|
18
17
|
this.activeInstanceId = instanceId;
|
|
19
18
|
}
|
|
20
19
|
return instanceId;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -41,6 +41,16 @@ export interface ToastData extends VariantProps<typeof toastContainerVariants> {
|
|
|
41
41
|
isLeaving?: boolean;
|
|
42
42
|
/** The position on the screen where this toast should appear. */
|
|
43
43
|
position?: ToastPosition;
|
|
44
|
+
/**
|
|
45
|
+
* Announcement priority for assistive technology.
|
|
46
|
+
* - `"low"` (default) renders the toast as a `dialog` (or `alertdialog` for
|
|
47
|
+
* the destructive variant) and relies on the existing `aria-live` region
|
|
48
|
+
* for announcements.
|
|
49
|
+
* - `"high"` additionally mounts a visually-hidden `role="alert"` mirror
|
|
50
|
+
* alongside the toast, so screen readers announce the message
|
|
51
|
+
* immediately even while the main toast has not received focus.
|
|
52
|
+
*/
|
|
53
|
+
priority?: "low" | "high";
|
|
44
54
|
/** Custom Svelte component to render instead of the default toast layout. */
|
|
45
55
|
component?: Component<any>;
|
|
46
56
|
/** Props to pass to the custom component. */
|
|
@@ -65,44 +75,67 @@ export type ToastPromiseOptions<SuccessValue = unknown, ErrorValue = unknown> =
|
|
|
65
75
|
/**
|
|
66
76
|
* The interface for the main `toast` function and its utility methods.
|
|
67
77
|
*/
|
|
78
|
+
/**
|
|
79
|
+
* Optional shape passed to the `toast()` invoker. `id` is optional and,
|
|
80
|
+
* when provided, makes the call upsert the matching toast in place
|
|
81
|
+
* instead of creating a new one.
|
|
82
|
+
*/
|
|
83
|
+
export type ToastInput = Omit<ToastData, "id"> & {
|
|
84
|
+
id?: string;
|
|
85
|
+
};
|
|
86
|
+
/** Same as {@link ToastInput} for variant helpers — `variant` is fixed by the helper. */
|
|
87
|
+
export type ToastVariantInput = Omit<ToastData, "id" | "variant"> & {
|
|
88
|
+
id?: string;
|
|
89
|
+
};
|
|
68
90
|
export type ToastInvoker = {
|
|
69
91
|
/**
|
|
70
|
-
* Creates a default toast notification
|
|
92
|
+
* Creates a default toast notification, or updates an existing one when
|
|
93
|
+
* `data.id` matches an active toast.
|
|
71
94
|
* @param data - The toast options or description string.
|
|
72
|
-
* @returns The ID of the created toast.
|
|
95
|
+
* @returns The ID of the created or updated toast.
|
|
73
96
|
*/
|
|
74
|
-
(data:
|
|
97
|
+
(data: ToastInput | string): string;
|
|
75
98
|
/**
|
|
76
99
|
* Creates a success toast notification.
|
|
77
100
|
*/
|
|
78
|
-
success: (data:
|
|
101
|
+
success: (data: ToastVariantInput | string) => string;
|
|
79
102
|
/**
|
|
80
103
|
* Creates a warning toast notification.
|
|
81
104
|
*/
|
|
82
|
-
warning: (data:
|
|
105
|
+
warning: (data: ToastVariantInput | string) => string;
|
|
83
106
|
/**
|
|
84
107
|
* Creates an info toast notification.
|
|
85
108
|
*/
|
|
86
|
-
info: (data:
|
|
109
|
+
info: (data: ToastVariantInput | string) => string;
|
|
87
110
|
/**
|
|
88
111
|
* Creates an error toast notification.
|
|
89
112
|
*/
|
|
90
|
-
error: (data:
|
|
113
|
+
error: (data: ToastVariantInput | string) => string;
|
|
91
114
|
/**
|
|
92
115
|
* Creates a custom component toast.
|
|
93
116
|
* @param component - The Svelte component to render.
|
|
94
117
|
* @param options - Additional options and props for the component.
|
|
95
118
|
*/
|
|
96
119
|
custom: <Props extends Record<string, any> = Record<string, any>>(component: Component<Props>, options?: Omit<ToastData, "id" | "component" | "variant" | "componentProps"> & {
|
|
120
|
+
id?: string;
|
|
97
121
|
componentProps?: Omit<Props, "id" | "toast">;
|
|
98
122
|
}) => string;
|
|
99
123
|
/**
|
|
100
124
|
* Creates a toast that updates based on the state of a Promise.
|
|
101
125
|
* @param promise - The promise to track.
|
|
102
126
|
* @param options - Configuration for loading, success, and error states.
|
|
103
|
-
* @returns
|
|
127
|
+
* @returns A promise that resolves with the original value or rejects with
|
|
128
|
+
* the original error, so callers can `await` the underlying work.
|
|
129
|
+
*/
|
|
130
|
+
promise: <T, E = unknown>(promise: PromiseLike<T>, options: ToastPromiseOptions<T, E>) => Promise<T>;
|
|
131
|
+
/**
|
|
132
|
+
* Updates an existing toast in place. Useful for streaming progress
|
|
133
|
+
* messages or replacing a loading toast without flicker.
|
|
134
|
+
* @param id - The ID returned when the toast was created.
|
|
135
|
+
* @param data - Partial data to merge into the existing toast. Pass a
|
|
136
|
+
* string as shorthand for `{ description }`.
|
|
104
137
|
*/
|
|
105
|
-
|
|
138
|
+
update: (id: string, data: Partial<Omit<ToastData, "id">> | string) => void;
|
|
106
139
|
/**
|
|
107
140
|
* Dismisses a specific toast by its ID.
|
|
108
141
|
* @param id - The ID of the toast to dismiss.
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7E,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,MAAM,CAAC,EAAE;QACR,mCAAmC;QACnC,KAAK,EAAE,MAAM,CAAC;QACd,oEAAoE;QACpE,OAAO,EAAE,MAAM,IAAI,CAAC;KACpB,CAAC;IACF,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,kGA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S,EAAE,KAAK,IAAI,CAAC;AAE5D,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/lib/core/variants.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/lib/core/variants.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;8EAoClC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;8EAc/B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { default as VarselToaster } from "./VarselToaster.svelte";
|
|
8
8
|
export { toast } from "./internals";
|
|
9
|
-
export type { ToastData, ToastInvoker, ToastPosition, SwipeAxis, SwipeDirection, PositionedToast, VarselItemContext, ToastPromiseOptions, } from "./internals";
|
|
9
|
+
export type { ToastData, ToastInput, ToastInvoker, ToastPosition, ToastVariantInput, SwipeAxis, SwipeDirection, PositionedToast, VarselItemContext, ToastPromiseOptions, } from "./internals";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,SAAS,EACT,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,aAAa,CAAC"}
|
package/dist/internals.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* This file is meant for internal package usage and shouldn't generally be imported directly by consumers.
|
|
5
5
|
*/
|
|
6
6
|
export { ANIMATION_CONFIG } from "./core/animations";
|
|
7
|
-
export { FOCUSABLE_SELECTORS } from "./core/accessibility";
|
|
7
|
+
export { FOCUSABLE_SELECTORS, focusManager, isFocusVisible, } from "./core/accessibility";
|
|
8
8
|
export { POSITION_CONFIGS, type ToastPosition } from "./core/positions";
|
|
9
|
-
export { SWIPE_DISMISS_THRESHOLD, SWIPE_DISMISS_VELOCITY, SWIPE_EXIT_DISTANCE, getDefaultSwipeDirections, type SwipeAxis, type SwipeDirection, } from "./core/swipe";
|
|
10
|
-
export { toastContainerVariants, toastContentVariants
|
|
9
|
+
export { SWIPE_DISMISS_THRESHOLD, SWIPE_DISMISS_VELOCITY, SWIPE_EXIT_DISTANCE, SWIPE_REVERSE_CANCEL_THRESHOLD, getDefaultSwipeDirections, type SwipeAxis, type SwipeDirection, } from "./core/swipe";
|
|
10
|
+
export { toastContainerVariants, toastContentVariants } from "./core/variants";
|
|
11
11
|
export { cn } from "./core/utils";
|
|
12
12
|
export { toast } from "./core/toast-factory";
|
|
13
13
|
export { toastState } from "./core/toast-state";
|
|
14
14
|
export { toasterInstanceManager } from "./core/toaster-instances";
|
|
15
|
-
export type { ToastData, ToastInvoker, ToastPromiseOptions, PositionedToast, VarselItemContext, } from "./core/types";
|
|
15
|
+
export type { ToastData, ToastInput, ToastInvoker, ToastPromiseOptions, ToastVariantInput, PositionedToast, VarselItemContext, } from "./core/types";
|
|
16
16
|
//# sourceMappingURL=internals.d.ts.map
|
package/dist/internals.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../src/lib/internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../src/lib/internals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,SAAS,EACd,KAAK,cAAc,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GACjB,MAAM,cAAc,CAAC"}
|
package/dist/internals.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* This file is meant for internal package usage and shouldn't generally be imported directly by consumers.
|
|
5
5
|
*/
|
|
6
6
|
export { ANIMATION_CONFIG } from "./core/animations";
|
|
7
|
-
export { FOCUSABLE_SELECTORS } from "./core/accessibility";
|
|
7
|
+
export { FOCUSABLE_SELECTORS, focusManager, isFocusVisible, } from "./core/accessibility";
|
|
8
8
|
export { POSITION_CONFIGS } from "./core/positions";
|
|
9
|
-
export { SWIPE_DISMISS_THRESHOLD, SWIPE_DISMISS_VELOCITY, SWIPE_EXIT_DISTANCE, getDefaultSwipeDirections, } from "./core/swipe";
|
|
10
|
-
export { toastContainerVariants, toastContentVariants
|
|
9
|
+
export { SWIPE_DISMISS_THRESHOLD, SWIPE_DISMISS_VELOCITY, SWIPE_EXIT_DISTANCE, SWIPE_REVERSE_CANCEL_THRESHOLD, getDefaultSwipeDirections, } from "./core/swipe";
|
|
10
|
+
export { toastContainerVariants, toastContentVariants } from "./core/variants";
|
|
11
11
|
export { cn } from "./core/utils";
|
|
12
12
|
export { toast } from "./core/toast-factory";
|
|
13
13
|
export { toastState } from "./core/toast-state";
|