varsel 0.3.0 → 0.4.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.
@@ -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 || 5000);
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);
@@ -75,7 +77,7 @@ let shouldClose = $derived(toast.shouldClose);
75
77
  let position = $derived(toast.position || "bottom-center");
76
78
  let className = $derived(toast.className || "");
77
79
  let onClose = $derived(toast.onClose);
78
- let showClose = $derived(toast.showClose ?? true);
80
+ let showClose = $derived(toast.showClose ?? defaultShowClose);
79
81
 
80
82
  let toastRef = $state<HTMLDivElement | null>(null);
81
83
  let isItemHovered = $state(false);
@@ -312,8 +314,9 @@ $effect(() => {
312
314
  remainingTime = duration;
313
315
  }
314
316
 
317
+ const isHovering = isGroupHovered || isItemHovered;
315
318
  const isPaused =
316
- isGroupHovered || isItemHovered || isSwiping || hiddenByStacking;
319
+ (pauseOnHover && isHovering) || isSwiping || hiddenByStacking;
317
320
 
318
321
  if (isPaused) {
319
322
  if (timeoutRef) {
@@ -520,7 +523,7 @@ const zIndexBase = Number(ANIMATION_CONFIG.Z_INDEX_BASE);
520
523
 
521
524
  let isTopPosition = $derived(position?.startsWith("top-") ?? false);
522
525
  let maxVisibleIndex = $derived(
523
- Math.max(0, ANIMATION_CONFIG.MAX_VISIBLE_TOASTS - 1),
526
+ Math.max(0, visibleToasts - 1),
524
527
  );
525
528
  let visibleIndex = $derived(Math.min(index, maxVisibleIndex));
526
529
  let defaultCollapsedOffset = $derived(
@@ -549,7 +552,7 @@ let visibleScale = $derived(
549
552
  ),
550
553
  );
551
554
  let zIndex = $derived(zIndexBase - renderIndex);
552
- let stackHidden = $derived(index >= ANIMATION_CONFIG.MAX_VISIBLE_TOASTS);
555
+ let stackHidden = $derived(index >= visibleToasts);
553
556
  let hiddenByStacking = $derived(stackHidden && animationState !== "exiting");
554
557
  let isStackLeader = $derived(index === 0);
555
558
  let isLatest = $derived(isStackLeader && !shouldClose);
@@ -581,12 +584,12 @@ let transformStyle = $derived.by(() => {
581
584
  let opacityValue = stackHidden ? 0 : 1;
582
585
 
583
586
  if (stackHidden) {
584
- if (isGroupHovered && animationState !== "exiting") {
587
+ if (expand && isGroupHovered && animationState !== "exiting") {
585
588
  translateX = 0;
586
589
  translateY = hiddenExpandedTranslateY;
587
590
  scaleValue = 1;
588
591
  }
589
- } else if (isGroupHovered && animationState !== "exiting") {
592
+ } else if (expand && isGroupHovered && animationState !== "exiting") {
590
593
  translateX = 0;
591
594
  translateY = expandedTranslateY;
592
595
  scaleValue = 1;
@@ -684,6 +687,14 @@ let livePoliteness = $derived(
684
687
  (variant === "destructive" ? "assertive" : "polite") as "assertive" | "polite",
685
688
  );
686
689
 
690
+ let offsetStyle = $derived.by(() => {
691
+ if (offset === undefined) return undefined;
692
+ const val = typeof offset === "number" ? `${offset}px` : offset;
693
+ if (position.startsWith("top")) return `top: ${val};`;
694
+ if (position.startsWith("bottom")) return `bottom: ${val};`;
695
+ return undefined;
696
+ });
697
+
687
698
  const handleBlurCapture = (event: FocusEvent) => {
688
699
  const next = event.relatedTarget as Node | null;
689
700
  if (!toastRef || !next || !toastRef.contains(next)) {
@@ -709,6 +720,7 @@ const handleBlurCapture = (event: FocusEvent) => {
709
720
  : `transform ${transitionDuration} ${transitionTimingFunction}, opacity ${transitionDuration} ${transitionTimingFunction}`}
710
721
  style:transform={transformStyle.transform}
711
722
  style:opacity={transformStyle.opacity}
723
+ style={offsetStyle}
712
724
  role={stackHidden ? undefined : liveRole}
713
725
  aria-live={stackHidden ? undefined : livePoliteness}
714
726
  aria-atomic={stackHidden ? undefined : "true"}
@@ -744,7 +756,7 @@ const handleBlurCapture = (event: FocusEvent) => {
744
756
  type="button"
745
757
  onclick={handleClose}
746
758
  class={cn(
747
- "absolute top-2 right-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",
759
+ "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
760
  )}
749
761
  aria-label="Close toast"
750
762
  >
@@ -764,7 +776,7 @@ const handleBlurCapture = (event: FocusEvent) => {
764
776
  </button>
765
777
  {/if}
766
778
 
767
- <div class="p-4 pr-8">
779
+ <div class="p-4 pe-8">
768
780
  <div class="flex gap-3">
769
781
  {#if showStatusIcon}
770
782
  <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;AAQpB,KAAK,gBAAgB,GAAI;IACzB,8DAA8D;IAC9D,KAAK,EAAE,eAAe,CAAC;IACvB,sEAAsE;IACtE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iEAAiE;IACjE,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C,CAAC;AAkvBF,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,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;AAQpB,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;AAiwBF,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 || "bottom-center";
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 >= ANIMATION_CONFIG.MAX_VISIBLE_TOASTS) continue;
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 class="pointer-events-none fixed inset-0 z-50">
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(ANIMATION_CONFIG.MAX_VISIBLE_TOASTS - 1, 0)}
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 >= ANIMATION_CONFIG.MAX_VISIBLE_TOASTS}
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,EAEd,MAAM,aAAa,CAAC;AAEpB,KAAK,gBAAgB,GAAI;IACzB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,iDAAiD;IACjD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA8XF,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
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 { expandedGap = undefined }: {
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
- {#if expandedGap === undefined}
59
- <VarselManager {toasts} onRemove={handleRemove} />
60
- {:else}
61
- <VarselManager {toasts} onRemove={handleRemove} {expandedGap} />
62
- {/if}
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;AAmBpB,KAAK,gBAAgB,GAAI;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB,CAAC;AAuCH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varsel",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Headless yet opinionated toast notifications for Svelte apps.",
5
5
  "type": "module",
6
6
  "license": "MIT",