varsel 0.3.0 → 0.5.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 +46 -25
- package/dist/VarselItem.svelte.d.ts +6 -10
- package/dist/VarselItem.svelte.d.ts.map +1 -1
- package/dist/VarselManager.svelte +31 -8
- package/dist/VarselManager.svelte.d.ts +9 -4
- package/dist/VarselManager.svelte.d.ts.map +1 -1
- package/dist/VarselToaster.svelte +42 -7
- package/dist/VarselToaster.svelte.d.ts +17 -0
- package/dist/VarselToaster.svelte.d.ts.map +1 -1
- package/dist/core/toast-factory.d.ts.map +1 -1
- package/dist/core/toast-factory.js +9 -0
- package/dist/core/types.d.ts +8 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/variants.d.ts +2 -2
- package/dist/core/variants.d.ts.map +1 -1
- package/dist/core/variants.js +2 -0
- package/dist/styles.css +3 -0
- package/dist/variant-icons.d.ts +23 -1
- package/dist/variant-icons.d.ts.map +1 -1
- package/dist/variant-icons.js +9 -1
- package/package.json +1 -1
package/dist/VarselItem.svelte
CHANGED
|
@@ -39,34 +39,36 @@ let {
|
|
|
39
39
|
onHeightChange = undefined,
|
|
40
40
|
onGroupHoverEnter = undefined,
|
|
41
41
|
onGroupHoldChange = undefined,
|
|
42
|
+
defaultDuration = 5000,
|
|
43
|
+
defaultShowClose = true,
|
|
44
|
+
pauseOnHover = true,
|
|
45
|
+
offset = undefined,
|
|
46
|
+
expand = true,
|
|
47
|
+
visibleToasts = ANIMATION_CONFIG.MAX_VISIBLE_TOASTS
|
|
42
48
|
}: {
|
|
43
|
-
/** The toast data object containing all content and state. */
|
|
44
49
|
toast: PositionedToast;
|
|
45
|
-
/** Callback to remove the toast from the DOM after exit animation. */
|
|
46
50
|
onRemove: (id: string) => void;
|
|
47
|
-
/** Whether the parent group (stack) is currently hovered. */
|
|
48
51
|
isGroupHovered?: boolean;
|
|
49
|
-
/** The vertical offset for this toast when the stack is expanded. */
|
|
50
52
|
expandedOffset?: number;
|
|
51
|
-
/** The gap between toasts when expanded. */
|
|
52
53
|
expandedGap?: number;
|
|
53
|
-
/** The vertical offset for this toast when the stack is collapsed. */
|
|
54
54
|
collapsedOffset?: number;
|
|
55
|
-
/** The offset to use when the toast is hidden in the stack. */
|
|
56
55
|
hiddenCollapsedOffset?: number;
|
|
57
|
-
/** Callback to report the height of the toast to the manager. */
|
|
58
56
|
onHeightChange?: (id: string, height: number) => void;
|
|
59
|
-
/** Callback to notify the manager that the user has entered the toast area. */
|
|
60
57
|
onGroupHoverEnter?: () => void;
|
|
61
|
-
/** Callback to notify the manager that the user is interacting (holding) the toast. */
|
|
62
58
|
onGroupHoldChange?: (holding: boolean) => void;
|
|
59
|
+
defaultDuration?: number;
|
|
60
|
+
defaultShowClose?: boolean;
|
|
61
|
+
pauseOnHover?: boolean;
|
|
62
|
+
offset?: number | string;
|
|
63
|
+
expand?: boolean;
|
|
64
|
+
visibleToasts?: number;
|
|
63
65
|
} = $props();
|
|
64
66
|
|
|
65
67
|
let id = $derived(toast.id);
|
|
66
68
|
let title = $derived(toast.title);
|
|
67
69
|
let description = $derived(toast.description);
|
|
68
70
|
let variant = $derived(toast.variant || "default");
|
|
69
|
-
let duration = $derived(toast.duration ||
|
|
71
|
+
let duration = $derived(toast.duration || defaultDuration);
|
|
70
72
|
let action = $derived(toast.action);
|
|
71
73
|
let isLoading = $derived(toast.isLoading || false);
|
|
72
74
|
let index = $derived(toast.index);
|
|
@@ -74,8 +76,9 @@ let renderIndex = $derived(toast.renderIndex);
|
|
|
74
76
|
let shouldClose = $derived(toast.shouldClose);
|
|
75
77
|
let position = $derived(toast.position || "bottom-center");
|
|
76
78
|
let className = $derived(toast.className || "");
|
|
77
|
-
let
|
|
78
|
-
let
|
|
79
|
+
let onAutoClose = $derived(toast.onAutoClose);
|
|
80
|
+
let onDismiss = $derived(toast.onDismiss);
|
|
81
|
+
let showClose = $derived(toast.showClose ?? defaultShowClose);
|
|
79
82
|
|
|
80
83
|
let toastRef = $state<HTMLDivElement | null>(null);
|
|
81
84
|
let isItemHovered = $state(false);
|
|
@@ -170,6 +173,9 @@ const getFocusableElements = () => {
|
|
|
170
173
|
);
|
|
171
174
|
};
|
|
172
175
|
|
|
176
|
+
type CloseReason = "auto" | "dismiss" | null;
|
|
177
|
+
let closeReason: CloseReason = null;
|
|
178
|
+
|
|
173
179
|
const handleTransitionEnd = (event: TransitionEvent) => {
|
|
174
180
|
if (event.target !== toastRef) return;
|
|
175
181
|
if (event.propertyName !== "opacity" && event.propertyName !== "transform")
|
|
@@ -178,15 +184,20 @@ const handleTransitionEnd = (event: TransitionEvent) => {
|
|
|
178
184
|
if (exitAnimationComplete) return;
|
|
179
185
|
|
|
180
186
|
exitAnimationComplete = true;
|
|
181
|
-
|
|
187
|
+
if (closeReason === "auto") {
|
|
188
|
+
onAutoClose?.();
|
|
189
|
+
} else if (closeReason === "dismiss") {
|
|
190
|
+
onDismiss?.();
|
|
191
|
+
}
|
|
182
192
|
onRemove(id);
|
|
183
193
|
};
|
|
184
194
|
|
|
185
|
-
const handleClose = () => {
|
|
195
|
+
const handleClose = (reason: Exclude<CloseReason, null> = "dismiss") => {
|
|
186
196
|
if (!toastRef || isExiting) return;
|
|
187
197
|
|
|
188
198
|
isExiting = true;
|
|
189
199
|
exitAnimationComplete = false;
|
|
200
|
+
closeReason = reason;
|
|
190
201
|
|
|
191
202
|
toastState.update(id, { shouldClose: true });
|
|
192
203
|
|
|
@@ -312,8 +323,9 @@ $effect(() => {
|
|
|
312
323
|
remainingTime = duration;
|
|
313
324
|
}
|
|
314
325
|
|
|
326
|
+
const isHovering = isGroupHovered || isItemHovered;
|
|
315
327
|
const isPaused =
|
|
316
|
-
|
|
328
|
+
(pauseOnHover && isHovering) || isSwiping || hiddenByStacking;
|
|
317
329
|
|
|
318
330
|
if (isPaused) {
|
|
319
331
|
if (timeoutRef) {
|
|
@@ -331,11 +343,11 @@ $effect(() => {
|
|
|
331
343
|
if (!Number.isFinite(ms)) {
|
|
332
344
|
// Do not set timeout for infinite duration
|
|
333
345
|
} else if (ms === 0) {
|
|
334
|
-
handleClose();
|
|
346
|
+
handleClose("auto");
|
|
335
347
|
} else {
|
|
336
348
|
timerStartRef = Date.now();
|
|
337
349
|
timeoutRef = setTimeout(() => {
|
|
338
|
-
handleClose();
|
|
350
|
+
handleClose("auto");
|
|
339
351
|
}, ms);
|
|
340
352
|
}
|
|
341
353
|
}
|
|
@@ -520,7 +532,7 @@ const zIndexBase = Number(ANIMATION_CONFIG.Z_INDEX_BASE);
|
|
|
520
532
|
|
|
521
533
|
let isTopPosition = $derived(position?.startsWith("top-") ?? false);
|
|
522
534
|
let maxVisibleIndex = $derived(
|
|
523
|
-
Math.max(0,
|
|
535
|
+
Math.max(0, visibleToasts - 1),
|
|
524
536
|
);
|
|
525
537
|
let visibleIndex = $derived(Math.min(index, maxVisibleIndex));
|
|
526
538
|
let defaultCollapsedOffset = $derived(
|
|
@@ -549,7 +561,7 @@ let visibleScale = $derived(
|
|
|
549
561
|
),
|
|
550
562
|
);
|
|
551
563
|
let zIndex = $derived(zIndexBase - renderIndex);
|
|
552
|
-
let stackHidden = $derived(index >=
|
|
564
|
+
let stackHidden = $derived(index >= visibleToasts);
|
|
553
565
|
let hiddenByStacking = $derived(stackHidden && animationState !== "exiting");
|
|
554
566
|
let isStackLeader = $derived(index === 0);
|
|
555
567
|
let isLatest = $derived(isStackLeader && !shouldClose);
|
|
@@ -581,12 +593,12 @@ let transformStyle = $derived.by(() => {
|
|
|
581
593
|
let opacityValue = stackHidden ? 0 : 1;
|
|
582
594
|
|
|
583
595
|
if (stackHidden) {
|
|
584
|
-
if (isGroupHovered && animationState !== "exiting") {
|
|
596
|
+
if (expand && isGroupHovered && animationState !== "exiting") {
|
|
585
597
|
translateX = 0;
|
|
586
598
|
translateY = hiddenExpandedTranslateY;
|
|
587
599
|
scaleValue = 1;
|
|
588
600
|
}
|
|
589
|
-
} else if (isGroupHovered && animationState !== "exiting") {
|
|
601
|
+
} else if (expand && isGroupHovered && animationState !== "exiting") {
|
|
590
602
|
translateX = 0;
|
|
591
603
|
translateY = expandedTranslateY;
|
|
592
604
|
scaleValue = 1;
|
|
@@ -684,6 +696,14 @@ let livePoliteness = $derived(
|
|
|
684
696
|
(variant === "destructive" ? "assertive" : "polite") as "assertive" | "polite",
|
|
685
697
|
);
|
|
686
698
|
|
|
699
|
+
let offsetStyle = $derived.by(() => {
|
|
700
|
+
if (offset === undefined) return undefined;
|
|
701
|
+
const val = typeof offset === "number" ? `${offset}px` : offset;
|
|
702
|
+
if (position.startsWith("top")) return `top: ${val};`;
|
|
703
|
+
if (position.startsWith("bottom")) return `bottom: ${val};`;
|
|
704
|
+
return undefined;
|
|
705
|
+
});
|
|
706
|
+
|
|
687
707
|
const handleBlurCapture = (event: FocusEvent) => {
|
|
688
708
|
const next = event.relatedTarget as Node | null;
|
|
689
709
|
if (!toastRef || !next || !toastRef.contains(next)) {
|
|
@@ -709,6 +729,7 @@ const handleBlurCapture = (event: FocusEvent) => {
|
|
|
709
729
|
: `transform ${transitionDuration} ${transitionTimingFunction}, opacity ${transitionDuration} ${transitionTimingFunction}`}
|
|
710
730
|
style:transform={transformStyle.transform}
|
|
711
731
|
style:opacity={transformStyle.opacity}
|
|
732
|
+
style={offsetStyle}
|
|
712
733
|
role={stackHidden ? undefined : liveRole}
|
|
713
734
|
aria-live={stackHidden ? undefined : livePoliteness}
|
|
714
735
|
aria-atomic={stackHidden ? undefined : "true"}
|
|
@@ -742,9 +763,9 @@ const handleBlurCapture = (event: FocusEvent) => {
|
|
|
742
763
|
{#if showClose}
|
|
743
764
|
<button
|
|
744
765
|
type="button"
|
|
745
|
-
onclick={handleClose}
|
|
766
|
+
onclick={() => handleClose()}
|
|
746
767
|
class={cn(
|
|
747
|
-
"absolute top-2
|
|
768
|
+
"absolute top-2 end-2 cursor-pointer rounded-vs-sm p-1 text-vs-foreground/45 hover:bg-vs-popover-muted hover:text-vs-foreground/70 transition-[background-color,color,box-shadow] ease-vs-button duration-100 focus-visible:ring-1 focus-visible:ring-vs-ring/50 focus-visible:outline-none",
|
|
748
769
|
)}
|
|
749
770
|
aria-label="Close toast"
|
|
750
771
|
>
|
|
@@ -764,7 +785,7 @@ const handleBlurCapture = (event: FocusEvent) => {
|
|
|
764
785
|
</button>
|
|
765
786
|
{/if}
|
|
766
787
|
|
|
767
|
-
<div class="p-4
|
|
788
|
+
<div class="p-4 pe-8">
|
|
768
789
|
<div class="flex gap-3">
|
|
769
790
|
{#if showStatusIcon}
|
|
770
791
|
<span class="relative inline-flex h-4 w-4 shrink-0 items-center justify-center">
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { type PositionedToast } from "./internals";
|
|
2
2
|
type $$ComponentProps = {
|
|
3
|
-
/** The toast data object containing all content and state. */
|
|
4
3
|
toast: PositionedToast;
|
|
5
|
-
/** Callback to remove the toast from the DOM after exit animation. */
|
|
6
4
|
onRemove: (id: string) => void;
|
|
7
|
-
/** Whether the parent group (stack) is currently hovered. */
|
|
8
5
|
isGroupHovered?: boolean;
|
|
9
|
-
/** The vertical offset for this toast when the stack is expanded. */
|
|
10
6
|
expandedOffset?: number;
|
|
11
|
-
/** The gap between toasts when expanded. */
|
|
12
7
|
expandedGap?: number;
|
|
13
|
-
/** The vertical offset for this toast when the stack is collapsed. */
|
|
14
8
|
collapsedOffset?: number;
|
|
15
|
-
/** The offset to use when the toast is hidden in the stack. */
|
|
16
9
|
hiddenCollapsedOffset?: number;
|
|
17
|
-
/** Callback to report the height of the toast to the manager. */
|
|
18
10
|
onHeightChange?: (id: string, height: number) => void;
|
|
19
|
-
/** Callback to notify the manager that the user has entered the toast area. */
|
|
20
11
|
onGroupHoverEnter?: () => void;
|
|
21
|
-
/** Callback to notify the manager that the user is interacting (holding) the toast. */
|
|
22
12
|
onGroupHoldChange?: (holding: boolean) => void;
|
|
13
|
+
defaultDuration?: number;
|
|
14
|
+
defaultShowClose?: boolean;
|
|
15
|
+
pauseOnHover?: boolean;
|
|
16
|
+
offset?: number | string;
|
|
17
|
+
expand?: boolean;
|
|
18
|
+
visibleToasts?: number;
|
|
23
19
|
};
|
|
24
20
|
declare const VarselItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
25
21
|
type VarselItem = ReturnType<typeof VarselItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarselItem.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselItem.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,EAYN,KAAK,eAAe,EAIpB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"VarselItem.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselItem.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,EAYN,KAAK,eAAe,EAIpB,MAAM,aAAa,CAAC;AAUpB,KAAK,gBAAgB,GAAI;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAywBF,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -18,13 +18,26 @@ let {
|
|
|
18
18
|
toasts = [],
|
|
19
19
|
onRemove,
|
|
20
20
|
expandedGap = ANIMATION_CONFIG.EXPANDED_GAP,
|
|
21
|
+
position: defaultPosition = 'bottom-center',
|
|
22
|
+
visibleToasts = 3,
|
|
23
|
+
expand = true,
|
|
24
|
+
duration = 5000,
|
|
25
|
+
closeButton = true,
|
|
26
|
+
pauseOnHover = true,
|
|
27
|
+
offset = undefined,
|
|
28
|
+
dir = 'auto'
|
|
21
29
|
}: {
|
|
22
|
-
/** The list of all active toasts from the global state. */
|
|
23
30
|
toasts?: ToastData[];
|
|
24
|
-
/** Callback to remove a toast from the state. */
|
|
25
31
|
onRemove: (id: string) => void;
|
|
26
|
-
/** The gap in pixels between toasts when expanded. */
|
|
27
32
|
expandedGap?: number;
|
|
33
|
+
position?: ToastPosition;
|
|
34
|
+
visibleToasts?: number;
|
|
35
|
+
expand?: boolean;
|
|
36
|
+
duration?: number;
|
|
37
|
+
closeButton?: boolean;
|
|
38
|
+
pauseOnHover?: boolean;
|
|
39
|
+
offset?: number | string;
|
|
40
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
28
41
|
} = $props();
|
|
29
42
|
|
|
30
43
|
const createPositionMap = <T>(value: () => T): Record<ToastPosition, T> => ({
|
|
@@ -90,7 +103,7 @@ const updateHoldState = (
|
|
|
90
103
|
$effect(() => {
|
|
91
104
|
const grouped = createPositionMap<ToastData[]>(() => []);
|
|
92
105
|
for (const toast of toasts) {
|
|
93
|
-
const pos = toast.position ||
|
|
106
|
+
const pos = toast.position || defaultPosition;
|
|
94
107
|
grouped[pos].push(toast);
|
|
95
108
|
}
|
|
96
109
|
|
|
@@ -118,6 +131,7 @@ $effect(() => {
|
|
|
118
131
|
|
|
119
132
|
return {
|
|
120
133
|
...toast,
|
|
134
|
+
position: position,
|
|
121
135
|
index: stackIndex,
|
|
122
136
|
renderIndex: orderIndex,
|
|
123
137
|
total: list.length,
|
|
@@ -289,7 +303,7 @@ $effect(() => {
|
|
|
289
303
|
let bottom = Number.NEGATIVE_INFINITY;
|
|
290
304
|
let any = false;
|
|
291
305
|
for (const t of group) {
|
|
292
|
-
if (t.index >=
|
|
306
|
+
if (t.index >= visibleToasts) continue;
|
|
293
307
|
const el = document.querySelector(
|
|
294
308
|
`[data-toast-id="${t.id}"]`,
|
|
295
309
|
) as HTMLElement | null;
|
|
@@ -356,7 +370,10 @@ const handleHeightChange = (id: string, height: number) => {
|
|
|
356
370
|
</script>
|
|
357
371
|
|
|
358
372
|
{#if toasts.length > 0}
|
|
359
|
-
<div
|
|
373
|
+
<div
|
|
374
|
+
class="pointer-events-none fixed inset-0 z-50"
|
|
375
|
+
{dir}
|
|
376
|
+
>
|
|
360
377
|
{#each positionEntries as [position, positionToasts]}
|
|
361
378
|
{@const pos = position}
|
|
362
379
|
{@const expandedOffsets = expandedOffsetData.byPosition[pos]}
|
|
@@ -365,7 +382,7 @@ const handleHeightChange = (id: string, height: number) => {
|
|
|
365
382
|
{@const isHeld = (heldToasts[pos]?.size ?? 0) > 0}
|
|
366
383
|
{@const isGroupActive = isHovered || isHeld}
|
|
367
384
|
{@const activeToasts = positionToasts.filter((toast) => !toast.shouldClose)}
|
|
368
|
-
{@const visibleStackLimit = Math.max(
|
|
385
|
+
{@const visibleStackLimit = Math.max(visibleToasts - 1, 0)}
|
|
369
386
|
{@const maxVisibleStackIndex = Math.min(
|
|
370
387
|
Math.max(activeToasts.length - 1, 0),
|
|
371
388
|
visibleStackLimit,
|
|
@@ -382,7 +399,7 @@ const handleHeightChange = (id: string, height: number) => {
|
|
|
382
399
|
: undefined}
|
|
383
400
|
{#each positionToasts as toast, idx (toast.id)}
|
|
384
401
|
{@const toastIsHidden =
|
|
385
|
-
toast.index >=
|
|
402
|
+
toast.index >= visibleToasts}
|
|
386
403
|
{@const hiddenCollapsedOffset = toastIsHidden
|
|
387
404
|
? sharedHiddenCollapsedOffset ?? collapsedOffsets?.[idx]
|
|
388
405
|
: collapsedOffsets?.[idx]}
|
|
@@ -401,6 +418,12 @@ const handleHeightChange = (id: string, height: number) => {
|
|
|
401
418
|
updateHoldState(pos, toast.id, holding)}
|
|
402
419
|
collapsedOffset={collapsedOffsetValue}
|
|
403
420
|
hiddenCollapsedOffset={hiddenCollapsedOffset}
|
|
421
|
+
defaultDuration={duration}
|
|
422
|
+
defaultShowClose={closeButton}
|
|
423
|
+
{pauseOnHover}
|
|
424
|
+
{offset}
|
|
425
|
+
{expand}
|
|
426
|
+
{visibleToasts}
|
|
404
427
|
/>
|
|
405
428
|
{/each}
|
|
406
429
|
{/each}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { type ToastData } from "./internals";
|
|
1
|
+
import { type ToastData, type ToastPosition } from "./internals";
|
|
2
2
|
type $$ComponentProps = {
|
|
3
|
-
/** The list of all active toasts from the global state. */
|
|
4
3
|
toasts?: ToastData[];
|
|
5
|
-
/** Callback to remove a toast from the state. */
|
|
6
4
|
onRemove: (id: string) => void;
|
|
7
|
-
/** The gap in pixels between toasts when expanded. */
|
|
8
5
|
expandedGap?: number;
|
|
6
|
+
position?: ToastPosition;
|
|
7
|
+
visibleToasts?: number;
|
|
8
|
+
expand?: boolean;
|
|
9
|
+
duration?: number;
|
|
10
|
+
closeButton?: boolean;
|
|
11
|
+
pauseOnHover?: boolean;
|
|
12
|
+
offset?: number | string;
|
|
13
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
9
14
|
};
|
|
10
15
|
declare const VarselManager: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
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,EAGN,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"VarselManager.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselManager.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,EAGN,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,MAAM,aAAa,CAAC;AAEpB,KAAK,gBAAgB,GAAI;IACzB,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;AAuYF,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -25,14 +25,41 @@ export {
|
|
|
25
25
|
toastState,
|
|
26
26
|
toasterInstanceManager,
|
|
27
27
|
type ToastData,
|
|
28
|
+
type ToastPosition,
|
|
28
29
|
} from './internals';
|
|
29
30
|
|
|
30
|
-
let {
|
|
31
|
+
let {
|
|
32
|
+
expandedGap = undefined,
|
|
33
|
+
position = 'bottom-center',
|
|
34
|
+
visibleToasts = 3,
|
|
35
|
+
expand = true,
|
|
36
|
+
duration = 5000,
|
|
37
|
+
closeButton = true,
|
|
38
|
+
pauseOnHover = true,
|
|
39
|
+
offset = undefined,
|
|
40
|
+
dir = 'auto'
|
|
41
|
+
}: {
|
|
31
42
|
/**
|
|
32
43
|
* The gap (in pixels) between expanded toasts when hovering over the stack.
|
|
33
44
|
* If undefined, uses the default value from animation config.
|
|
34
45
|
*/
|
|
35
|
-
expandedGap?: number
|
|
46
|
+
expandedGap?: number;
|
|
47
|
+
/** Default position for toasts. */
|
|
48
|
+
position?: ToastPosition;
|
|
49
|
+
/** Maximum number of visible toasts in the stack. */
|
|
50
|
+
visibleToasts?: number;
|
|
51
|
+
/** Whether to expand the stack on hover. */
|
|
52
|
+
expand?: boolean;
|
|
53
|
+
/** Default duration in milliseconds. */
|
|
54
|
+
duration?: number;
|
|
55
|
+
/** Whether to show the close button by default. */
|
|
56
|
+
closeButton?: boolean;
|
|
57
|
+
/** Whether to pause the timer on hover. */
|
|
58
|
+
pauseOnHover?: boolean;
|
|
59
|
+
/** Offset from the edge of the screen. */
|
|
60
|
+
offset?: number | string;
|
|
61
|
+
/** Directionality of the text. */
|
|
62
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
36
63
|
} = $props();
|
|
37
64
|
|
|
38
65
|
let toasts = $state<ToastData[]>([]);
|
|
@@ -55,9 +82,17 @@ export {
|
|
|
55
82
|
</script>
|
|
56
83
|
|
|
57
84
|
{#if toasterInstanceManager.isActiveInstance(instanceId)}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
<VarselManager
|
|
86
|
+
{toasts}
|
|
87
|
+
onRemove={handleRemove}
|
|
88
|
+
{expandedGap}
|
|
89
|
+
{position}
|
|
90
|
+
{visibleToasts}
|
|
91
|
+
{expand}
|
|
92
|
+
{duration}
|
|
93
|
+
{closeButton}
|
|
94
|
+
{pauseOnHover}
|
|
95
|
+
{offset}
|
|
96
|
+
{dir}
|
|
97
|
+
/>
|
|
63
98
|
{/if}
|
|
@@ -2,12 +2,29 @@
|
|
|
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 './internals';
|
|
5
6
|
type $$ComponentProps = {
|
|
6
7
|
/**
|
|
7
8
|
* The gap (in pixels) between expanded toasts when hovering over the stack.
|
|
8
9
|
* If undefined, uses the default value from animation config.
|
|
9
10
|
*/
|
|
10
11
|
expandedGap?: number;
|
|
12
|
+
/** Default position for toasts. */
|
|
13
|
+
position?: ToastPosition;
|
|
14
|
+
/** Maximum number of visible toasts in the stack. */
|
|
15
|
+
visibleToasts?: number;
|
|
16
|
+
/** Whether to expand the stack on hover. */
|
|
17
|
+
expand?: boolean;
|
|
18
|
+
/** Default duration in milliseconds. */
|
|
19
|
+
duration?: number;
|
|
20
|
+
/** Whether to show the close button by default. */
|
|
21
|
+
closeButton?: boolean;
|
|
22
|
+
/** Whether to pause the timer on hover. */
|
|
23
|
+
pauseOnHover?: boolean;
|
|
24
|
+
/** Offset from the edge of the screen. */
|
|
25
|
+
offset?: number | string;
|
|
26
|
+
/** Directionality of the text. */
|
|
27
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
11
28
|
};
|
|
12
29
|
declare const VarselToaster: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
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":"AAGA;;GAEG;AACH,OAAO,EACN,KAAK,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,GAClB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"VarselToaster.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VarselToaster.svelte.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,OAAO,EACN,KAAK,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,GAClB,MAAM,aAAa,CAAC;AAarB,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;AA6CH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-factory.d.ts","sourceRoot":"","sources":["../../src/lib/core/toast-factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGX,YAAY,EAEZ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"toast-factory.d.ts","sourceRoot":"","sources":["../../src/lib/core/toast-factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGX,YAAY,EAEZ,MAAM,SAAS,CAAC;AAgKjB,eAAO,MAAM,KAAK,cAAc,CAAC"}
|
|
@@ -41,6 +41,15 @@ createToast.warning = (data) => {
|
|
|
41
41
|
}
|
|
42
42
|
return toastState.add({ ...data, variant: "warning" });
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Creates an info variant toast.
|
|
46
|
+
*/
|
|
47
|
+
createToast.info = (data) => {
|
|
48
|
+
if (typeof data === "string") {
|
|
49
|
+
return toastState.add({ description: data, variant: "info" });
|
|
50
|
+
}
|
|
51
|
+
return toastState.add({ ...data, variant: "info" });
|
|
52
|
+
};
|
|
44
53
|
/**
|
|
45
54
|
* Creates an error (destructive) variant toast.
|
|
46
55
|
*/
|
package/dist/core/types.d.ts
CHANGED
|
@@ -31,8 +31,10 @@ export interface ToastData extends VariantProps<typeof toastContainerVariants> {
|
|
|
31
31
|
/** Callback function executed when the action button is clicked. */
|
|
32
32
|
onClick: () => void;
|
|
33
33
|
};
|
|
34
|
-
/** Callback
|
|
35
|
-
|
|
34
|
+
/** Callback fired when the toast finishes its auto-close timer. */
|
|
35
|
+
onAutoClose?: () => void;
|
|
36
|
+
/** Callback fired when the toast is dismissed manually (button, swipe, `toast.dismiss`, etc.). */
|
|
37
|
+
onDismiss?: () => void;
|
|
36
38
|
/** Internal flag: signals that the toast should begin its closing animation. */
|
|
37
39
|
shouldClose?: boolean;
|
|
38
40
|
/** Internal flag: signals that the toast is currently leaving the DOM. */
|
|
@@ -78,6 +80,10 @@ export type ToastInvoker = {
|
|
|
78
80
|
* Creates a warning toast notification.
|
|
79
81
|
*/
|
|
80
82
|
warning: (data: Omit<ToastData, "id" | "variant"> | string) => string;
|
|
83
|
+
/**
|
|
84
|
+
* Creates an info toast notification.
|
|
85
|
+
*/
|
|
86
|
+
info: (data: Omit<ToastData, "id" | "variant"> | string) => string;
|
|
81
87
|
/**
|
|
82
88
|
* Creates an error toast notification.
|
|
83
89
|
*/
|
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,E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ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const toastContainerVariants: (props?: ({
|
|
7
7
|
position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
|
|
8
|
-
variant?: "default" | "success" | "warning" | "destructive" | "custom" | null | undefined;
|
|
8
|
+
variant?: "default" | "success" | "warning" | "destructive" | "info" | "custom" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
/**
|
|
11
11
|
* CVA definition for the inner content wrapper of the toast.
|
|
@@ -13,6 +13,6 @@ export declare const toastContainerVariants: (props?: ({
|
|
|
13
13
|
* separate from the structural container.
|
|
14
14
|
*/
|
|
15
15
|
export declare const toastContentVariants: (props?: ({
|
|
16
|
-
variant?: "default" | "success" | "warning" | "destructive" | "custom" | null | undefined;
|
|
16
|
+
variant?: "default" | "success" | "warning" | "destructive" | "info" | "custom" | null | undefined;
|
|
17
17
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
18
|
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -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;;;8EAsClC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;8EAc/B,CAAC"}
|
package/dist/core/variants.js
CHANGED
|
@@ -25,6 +25,7 @@ export const toastContainerVariants = cva("pointer-events-auto fixed will-change
|
|
|
25
25
|
success: "rounded-vs-lg border shadow-vs-toast border-vs-border bg-vs-popover text-vs-success/90",
|
|
26
26
|
warning: "rounded-vs-lg border shadow-vs-toast border-vs-border bg-vs-popover text-vs-warning/90",
|
|
27
27
|
destructive: "rounded-vs-lg border shadow-vs-toast border-vs-border bg-vs-popover text-vs-destructive/90",
|
|
28
|
+
info: "rounded-vs-lg border shadow-vs-toast border-vs-border bg-vs-popover text-vs-info/90",
|
|
28
29
|
custom: "",
|
|
29
30
|
},
|
|
30
31
|
},
|
|
@@ -45,6 +46,7 @@ export const toastContentVariants = cva("relative overflow-hidden rounded-vs-lg"
|
|
|
45
46
|
success: "",
|
|
46
47
|
warning: "",
|
|
47
48
|
destructive: "",
|
|
49
|
+
info: "",
|
|
48
50
|
custom: "",
|
|
49
51
|
},
|
|
50
52
|
},
|
package/dist/styles.css
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
--color-vs-destructive: oklch(0.62 0.21 25);
|
|
24
24
|
--color-vs-warning: oklch(0.8 0.2 75);
|
|
25
25
|
--color-vs-success: oklch(0.7 0.18 155);
|
|
26
|
+
--color-vs-info: oklch(0.7 0.18 240);
|
|
26
27
|
|
|
27
28
|
/* Shadows */
|
|
28
29
|
--shadow-vs-button:
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
--color-vs-destructive: oklch(0.72 0.27 25);
|
|
54
55
|
--color-vs-warning: oklch(0.82 0.24 85);
|
|
55
56
|
--color-vs-success: oklch(0.78 0.25 155);
|
|
57
|
+
--color-vs-info: oklch(0.78 0.18 240);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
@theme {
|
|
@@ -65,6 +67,7 @@
|
|
|
65
67
|
--color-vs-destructive: var(--vs-destructive);
|
|
66
68
|
--color-vs-warning: var(--vs-warning);
|
|
67
69
|
--color-vs-success: var(--vs-success);
|
|
70
|
+
--color-vs-info: var(--vs-info);
|
|
68
71
|
--shadow-vs-button: var(--shadow-vs-button);
|
|
69
72
|
--shadow-vs-toast: var(--shadow-vs-toast);
|
|
70
73
|
--radius-vs-sm: calc(var(--radius-base) * 2);
|
package/dist/variant-icons.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* These are lightweight SVG path data objects rendered by the toast component.
|
|
4
4
|
*/
|
|
5
5
|
import type { ToastData } from "./internals";
|
|
6
|
-
declare const ICON_VARIANTS: readonly ["success", "warning", "destructive"];
|
|
6
|
+
declare const ICON_VARIANTS: readonly ["success", "warning", "destructive", "info"];
|
|
7
7
|
export type IconVariant = (typeof ICON_VARIANTS)[number];
|
|
8
8
|
type IconElement = {
|
|
9
9
|
tag: "path";
|
|
@@ -75,6 +75,28 @@ export declare const variantIconMap: {
|
|
|
75
75
|
r?: undefined;
|
|
76
76
|
})[];
|
|
77
77
|
};
|
|
78
|
+
info: {
|
|
79
|
+
viewBox: string;
|
|
80
|
+
elements: ({
|
|
81
|
+
tag: "circle";
|
|
82
|
+
cx: number;
|
|
83
|
+
cy: number;
|
|
84
|
+
r: number;
|
|
85
|
+
x1?: undefined;
|
|
86
|
+
y1?: undefined;
|
|
87
|
+
x2?: undefined;
|
|
88
|
+
y2?: undefined;
|
|
89
|
+
} | {
|
|
90
|
+
tag: "line";
|
|
91
|
+
x1: number;
|
|
92
|
+
y1: number;
|
|
93
|
+
x2: number;
|
|
94
|
+
y2: number;
|
|
95
|
+
cx?: undefined;
|
|
96
|
+
cy?: undefined;
|
|
97
|
+
r?: undefined;
|
|
98
|
+
})[];
|
|
99
|
+
};
|
|
78
100
|
};
|
|
79
101
|
/**
|
|
80
102
|
* Checks if a given toast variant has an associated icon.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variant-icons.d.ts","sourceRoot":"","sources":["../src/lib/variant-icons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"variant-icons.d.ts","sourceRoot":"","sources":["../src/lib/variant-icons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,QAAA,MAAM,aAAa,wDAAyD,CAAC;AAE7E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,KAAK,WAAW,GACb;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,GAAG,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC2B,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAC1B,UAAU,SAAS,CAAC,SAAS,CAAC,KAC5B,OAAO,IAAI,WAEb,CAAC"}
|
package/dist/variant-icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const ICON_VARIANTS = ["success", "warning", "destructive"];
|
|
1
|
+
const ICON_VARIANTS = ["success", "warning", "destructive", "info"];
|
|
2
2
|
export const variantIconMap = {
|
|
3
3
|
success: {
|
|
4
4
|
viewBox: "0 0 24 24",
|
|
@@ -26,6 +26,14 @@ export const variantIconMap = {
|
|
|
26
26
|
{ tag: "path", d: "m9 9 6 6" },
|
|
27
27
|
],
|
|
28
28
|
},
|
|
29
|
+
info: {
|
|
30
|
+
viewBox: "0 0 24 24",
|
|
31
|
+
elements: [
|
|
32
|
+
{ tag: "circle", cx: 12, cy: 12, r: 10 },
|
|
33
|
+
{ tag: "line", x1: 12, y1: 16, x2: 12, y2: 12 },
|
|
34
|
+
{ tag: "line", x1: 12, y1: 8, x2: 12.01, y2: 8 },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
29
37
|
};
|
|
30
38
|
/**
|
|
31
39
|
* Checks if a given toast variant has an associated icon.
|