@txstate-mws/svelte-components 1.6.7 → 1.6.8

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.
@@ -1,4 +1,4 @@
1
- <script>import { randomid } from 'txstate-utils';
1
+ <script lang="ts">import { randomid } from 'txstate-utils';
2
2
  import { Store } from '@txstate-mws/svelte-store';
3
3
  import PopupMenu from './PopupMenu.svelte';
4
4
  export let buttonelement;
@@ -5,27 +5,27 @@ import type { PopupMenuTypes } from '../types';
5
5
  declare const __propDef: {
6
6
  props: {
7
7
  buttonelement: HTMLButtonElement;
8
- items?: PopupMenuTypes[] | undefined;
9
- menushown?: boolean | undefined;
8
+ items?: PopupMenuTypes[];
9
+ menushown?: boolean;
10
10
  value?: string | undefined;
11
- align?: GlueAlignOpts | undefined;
12
- cover?: boolean | undefined;
13
- showSelected?: boolean | undefined;
11
+ align?: GlueAlignOpts;
12
+ cover?: boolean;
13
+ showSelected?: boolean;
14
14
  width?: string | undefined;
15
- computedalign?: Store<GlueAlignStore> | undefined;
16
- gap?: number | undefined;
17
- adjustparentheight?: boolean | undefined;
15
+ computedalign?: Store<GlueAlignStore>;
16
+ gap?: number;
17
+ adjustparentheight?: boolean;
18
18
  usePortal?: HTMLElement | true | undefined;
19
- loading?: boolean | undefined;
19
+ loading?: boolean;
20
20
  hilited?: number | undefined;
21
- menuid?: string | undefined;
21
+ menuid?: string;
22
22
  emptyText?: string | undefined;
23
- menuContainerClass?: string | undefined;
24
- menuClass?: string | undefined;
25
- menuItemClass?: string | undefined;
26
- menuItemHilitedClass?: string | undefined;
27
- menuItemSelectedClass?: string | undefined;
28
- menuDividerClass?: string | undefined;
23
+ menuContainerClass?: string;
24
+ menuClass?: string;
25
+ menuItemClass?: string;
26
+ menuItemHilitedClass?: string;
27
+ menuItemSelectedClass?: string;
28
+ menuDividerClass?: string;
29
29
  };
30
30
  events: {
31
31
  [evt: string]: CustomEvent<any>;
@@ -1,7 +1,7 @@
1
1
  <!-- @component
2
2
  [`Card`](https://github.com/txstate-etc/svelte-components/blob/main/src/lib/components/Card.svelte)
3
3
  -->
4
- <script>export let className = '';
4
+ <script lang="ts">export let className = '';
5
5
  import { getContext } from 'svelte';
6
6
  import { resize, passActions } from '../actions';
7
7
  import { CARDLAYOUT } from '../types';
@@ -2,8 +2,8 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import { type HTMLActionEntry } from '../actions';
3
3
  declare const __propDef: {
4
4
  props: {
5
- className?: string | undefined;
6
- use?: HTMLActionEntry[] | undefined;
5
+ className?: string;
6
+ use?: HTMLActionEntry[];
7
7
  };
8
8
  events: {
9
9
  [evt: string]: CustomEvent<any>;
@@ -1,7 +1,7 @@
1
1
  <!-- @component
2
2
  [`CardLayout`](https://github.com/txstate-etc/svelte-components/blob/main/src/lib/components/CardLayout.svelte)
3
3
  -->
4
- <script>import { onDestroy, tick, setContext, onMount } from 'svelte';
4
+ <script lang="ts">import { onDestroy, tick, setContext, onMount } from 'svelte';
5
5
  import { writable } from 'svelte/store';
6
6
  import { resize, passActions } from '../actions';
7
7
  import { CARDLAYOUT } from '../types';
@@ -2,11 +2,11 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import { type HTMLActionEntry } from '../actions';
3
3
  declare const __propDef: {
4
4
  props: {
5
- maxwidth?: number | undefined;
6
- preserveorder?: boolean | undefined;
7
- gutter?: number | undefined;
8
- className?: string | undefined;
9
- use?: HTMLActionEntry[] | undefined;
5
+ maxwidth?: number;
6
+ preserveorder?: boolean;
7
+ gutter?: number;
8
+ className?: string;
9
+ use?: HTMLActionEntry[];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -5,7 +5,7 @@ This component is meant to help make tables responsive by eliminating columns (f
5
5
  When there are hidden columns, the last column header becomes a dropdown button allowing the selection of another column
6
6
  to be displayed instead.
7
7
  -->
8
- <script>import { Store } from '@txstate-mws/svelte-store';
8
+ <script lang="ts">import { Store } from '@txstate-mws/svelte-store';
9
9
  import { derived } from 'svelte/store';
10
10
  import { classes } from '../util';
11
11
  import DefaultPopupMenu from './PopupMenu.svelte';
@@ -3,21 +3,21 @@ import type { CollapsingTableColumn } from '../types';
3
3
  import DefaultPopupMenu from './PopupMenu.svelte';
4
4
  declare const __propDef: {
5
5
  props: {
6
- tableClass?: string | undefined;
7
- bodyRowClass?: string | undefined;
8
- bodyCellClass?: string | undefined;
9
- headerRowClass?: string | undefined;
10
- headerCellClass?: string | undefined;
11
- menuContainerClass?: string | undefined;
12
- menuClass?: string | undefined;
13
- menuItemClass?: string | undefined;
14
- menuItemHilitedClass?: string | undefined;
6
+ tableClass?: string;
7
+ bodyRowClass?: string;
8
+ bodyCellClass?: string;
9
+ headerRowClass?: string;
10
+ headerCellClass?: string;
11
+ menuContainerClass?: string;
12
+ menuClass?: string;
13
+ menuItemClass?: string;
14
+ menuItemHilitedClass?: string;
15
15
  items: any[];
16
16
  config?: CollapsingTableColumn[] | undefined;
17
- defaultCellWidth?: number | undefined;
18
- PopupMenu?: typeof DefaultPopupMenu | undefined;
19
- slots?: Record<string, boolean> | undefined;
20
- stickyheader?: boolean | undefined;
17
+ defaultCellWidth?: number;
18
+ PopupMenu?: typeof DefaultPopupMenu;
19
+ slots?: Record<string, boolean>;
20
+ stickyheader?: boolean;
21
21
  };
22
22
  events: {
23
23
  [evt: string]: CustomEvent<any>;
@@ -25,7 +25,7 @@ declare const __propDef: {
25
25
  slots: {
26
26
  headercell: {
27
27
  column: CollapsingTableColumn & {
28
- widthPercent?: number | undefined;
28
+ widthPercent?: number;
29
29
  };
30
30
  key: string;
31
31
  title: string;
@@ -34,7 +34,7 @@ declare const __propDef: {
34
34
  };
35
35
  dropicon: {
36
36
  column: CollapsingTableColumn & {
37
- widthPercent?: number | undefined;
37
+ widthPercent?: number;
38
38
  };
39
39
  item: undefined;
40
40
  value: undefined;
@@ -22,7 +22,7 @@ With this component, you can de-duplicate like this:
22
22
  Any props you provide (except the ConditionalWrapper props like `condition`) will pass through
23
23
  to the wrapper element/component, if it gets inserted.
24
24
  -->
25
- <script>export let condition;
25
+ <script lang="ts">export let condition;
26
26
  export let component = undefined;
27
27
  export let a = false;
28
28
  export let span = false;
@@ -12,11 +12,11 @@ When they do, the escape event will be fired, allowing you to remove the dialog.
12
12
  `FocusLock`s can be nested. The user will be trapped inside the deepest `FocusLock` present in the DOM.
13
13
  When it goes away, they'll be trapped inside the previous `FocusLock`, and so on.
14
14
  -->
15
- <script context="module">export const FocusLockStack = [];
15
+ <script context="module" lang="ts">export const FocusLockStack = [];
16
16
  const waitAtick = typeof requestAnimationFrame !== 'undefined' ? (resolve) => requestAnimationFrame(resolve) : resolve => resolve(0);
17
17
  </script>
18
18
 
19
- <script>import { onMount, onDestroy, createEventDispatcher } from 'svelte';
19
+ <script lang="ts">import { onMount, onDestroy, createEventDispatcher } from 'svelte';
20
20
  import { tabbable } from 'tabbable';
21
21
  import { randomid, sleep } from 'txstate-utils';
22
22
  import { buttonify } from '../actions';
@@ -7,16 +7,16 @@ export declare const FocusLockStack: {
7
7
  }[];
8
8
  declare const __propDef: {
9
9
  props: {
10
- escapable?: boolean | undefined;
11
- hidefocus?: boolean | undefined;
12
- hidefocuslabel?: string | undefined;
10
+ escapable?: boolean;
11
+ hidefocus?: boolean;
12
+ hidefocuslabel?: string;
13
13
  initialfocus?: string | undefined;
14
14
  returnfocusto?: HTMLElement | undefined;
15
15
  /** If you expect any popup menus to be added to the body, we need to know that they
16
16
  are considered to be part of the focus lock, or else the modal will be dismissed
17
17
  when the user clicks inside. Use commas to include multiple selectors. */ includeselector?: string | undefined;
18
- class?: string | undefined;
19
- focusId?: string | undefined;
18
+ class?: string;
19
+ focusId?: string;
20
20
  };
21
21
  events: {
22
22
  click: MouseEvent;
@@ -3,7 +3,7 @@
3
3
  until the slotted content is signals it is done loading via the `loading` boolean bind at which point the slotted content
4
4
  will be rendered.
5
5
  -->
6
- <script>import { afterUpdate } from 'svelte';
6
+ <script lang="ts">import { afterUpdate } from 'svelte';
7
7
  import ScreenReaderOnly from './ScreenReaderOnly.svelte';
8
8
  import { resize, ResizeStore } from '../actions';
9
9
  export let loading;
@@ -2,7 +2,7 @@
2
2
  The purpose of `Lottie` is to provide a [Lottie](https://www.npmjs.com/package/lottie-web) player element
3
3
  with Screen Reader compatible attributes and lables readily available through the `alt` prop.
4
4
  -->
5
- <script>import { onMount } from 'svelte';
5
+ <script lang="ts">import { onMount } from 'svelte';
6
6
  import { isBlank } from 'txstate-utils';
7
7
  import ScreenReaderOnly from './ScreenReaderOnly.svelte';
8
8
  export let animationData;
@@ -2,14 +2,14 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  animationData: any;
5
- loop?: boolean | undefined;
5
+ loop?: boolean;
6
6
  name?: string | undefined;
7
- speed?: number | undefined;
8
- direction?: 1 | -1 | undefined;
9
- paused?: boolean | undefined;
7
+ speed?: number;
8
+ direction?: 1 | -1;
9
+ paused?: boolean;
10
10
  width?: string | undefined;
11
11
  height?: string | undefined;
12
- /** `<ScreenReaderOnly>` lable to be applied. */ alt?: string | undefined;
12
+ /** `<ScreenReaderOnly>` lable to be applied. */ alt?: string;
13
13
  };
14
14
  events: {
15
15
  [evt: string]: CustomEvent<any>;
@@ -5,7 +5,7 @@ It provides only the backdrop and a scrollable container for your content. If yo
5
5
 
6
6
  Any time the Modal is in the DOM, it will take over the screen. You make it go away by removing it from the DOM.
7
7
  -->
8
- <script>import { createEventDispatcher, onMount } from 'svelte';
8
+ <script lang="ts">import { createEventDispatcher, onMount } from 'svelte';
9
9
  import { randomid } from 'txstate-utils';
10
10
  import FocusLock, { FocusLockStack } from './FocusLock.svelte';
11
11
  import { portal } from '../actions';
@@ -1,10 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- opaque?: boolean | undefined;
5
- containerClass?: string | undefined;
6
- escapable?: boolean | undefined;
7
- hidefocus?: boolean | undefined;
4
+ opaque?: boolean;
5
+ containerClass?: string;
6
+ escapable?: boolean;
7
+ hidefocus?: boolean;
8
8
  hidefocuslabel?: string | undefined;
9
9
  initialfocus?: string | undefined;
10
10
  returnfocusto?: HTMLElement | undefined;
@@ -12,7 +12,7 @@ declare const __propDef: {
12
12
  /** If you expect any popup menus to be added to the body, we need to know that they
13
13
  are considered to be part of the focus lock, or else the modal will be dismissed
14
14
  when the user clicks inside. Use commas to include multiple selectors. */ includeselector?: string | undefined;
15
- focusId?: string | undefined;
15
+ focusId?: string;
16
16
  };
17
17
  events: {
18
18
  escape: CustomEvent<any>;
@@ -6,7 +6,7 @@
6
6
  controlled by the parent component via the `getOptions` function that will be used as a
7
7
  debounced callback on the contents of the text input.
8
8
  -->
9
- <script>import { createEventDispatcher, onMount } from 'svelte';
9
+ <script lang="ts">import { createEventDispatcher, onMount } from 'svelte';
10
10
  import { randomid, Cache, isNotBlank } from 'txstate-utils';
11
11
  import ScreenReaderOnly from './ScreenReaderOnly.svelte';
12
12
  import DefaultPopupMenu from './PopupMenu.svelte';
@@ -8,24 +8,24 @@ declare const __propDef: {
8
8
  * Function to pass to the component that tells it how to use the text in the text input to determine what
9
9
  * `PopupMenuItem[]` should be displayed in the `PopupMenu`. Items already 'selected' from the popup menu will
10
10
  * be tracked and automatically filtered from the popup if returned as one of the `PopupMenuItem[]` by `getOptions`. */ getOptions: (search: string) => Promise<PopupMenuTypes[]> | PopupMenuTypes[];
11
- id?: string | undefined;
12
- disabled?: boolean | undefined;
13
- menuContainerClass?: string | undefined;
14
- menuClass?: string | undefined;
15
- menuItemClass?: string | undefined;
16
- menuItemHilitedClass?: string | undefined;
17
- inputClass?: string | undefined;
18
- menuDividerClass?: string | undefined;
19
- /** The maximum number of selections allowed before making new selections is disabled. Default of 0 is unlimited. */ maxSelections?: number | undefined;
11
+ id?: string;
12
+ disabled?: boolean;
13
+ menuContainerClass?: string;
14
+ menuClass?: string;
15
+ menuItemClass?: string;
16
+ menuItemHilitedClass?: string;
17
+ inputClass?: string;
18
+ menuDividerClass?: string;
19
+ /** The maximum number of selections allowed before making new selections is disabled. Default of 0 is unlimited. */ maxSelections?: number;
20
20
  /** Consuming components may need to make decisions about what to display or return as options in the popup based
21
21
  * on what's already selected. This component property can be used to both pass an initial set of selections but
22
- * it can also be bound to provide a means to inspect what's selected. */ selected?: PopupMenuItem[] | undefined;
23
- /** The text to be displayed in the input text box for contextual feedback on what the input text is expecting. */ placeholder?: string | undefined;
22
+ * it can also be bound to provide a means to inspect what's selected. */ selected?: PopupMenuItem[];
23
+ /** The text to be displayed in the input text box for contextual feedback on what the input text is expecting. */ placeholder?: string;
24
24
  /** When there are no items (e.g. it's a filtered search and there were no results), we still display one
25
25
  disabled item in the menu to let the user know what is going on. Use this prop to specify the message. */ emptyText?: string | undefined;
26
26
  usePortal?: HTMLElement | true | undefined;
27
27
  descid?: string | undefined;
28
- /** You can define your own PopupMenu and pass for that to be used or accept DefaultPopupMenu. */ PopupMenu?: typeof DefaultPopupMenu | undefined;
28
+ /** You can define your own PopupMenu and pass for that to be used or accept DefaultPopupMenu. */ PopupMenu?: typeof DefaultPopupMenu;
29
29
  };
30
30
  events: {
31
31
  change: CustomEvent<any>;
@@ -2,7 +2,7 @@
2
2
  The purpose of [`PopupMenu`](https://github.com/txstate-etc/svelte-components/blob/main/docs/PopupMenu.md) is to display a menu of options to the user, activated by clicking any element
3
3
  bound to `buttonelement`. It can also be controlled from the parent, by binding the `menushown` boolean.
4
4
  -->
5
- <script>import { createEventDispatcher, onDestroy, tick } from 'svelte';
5
+ <script lang="ts">import { createEventDispatcher, onDestroy, tick } from 'svelte';
6
6
  import { isNotBlank, randomid } from 'txstate-utils';
7
7
  import { Store } from '@txstate-mws/svelte-store';
8
8
  import { glue, portal } from '../actions';
@@ -7,44 +7,44 @@ declare const __propDef: {
7
7
  /** The DOM element that will act as the "button" for this menu. The menu will be placed next to the
8
8
  button and be controlled by the button. Keyboard access will be enabled when the button has focus.
9
9
  This component adds all appropriate attributes (tabindex, roles, and aria) automatically. */ buttonelement: HTMLElement;
10
- /** The list of menu items to be shown. Parent may change this at any time based on user activity. */ items?: PopupMenuTypes[] | undefined;
11
- menushown?: boolean | undefined;
10
+ /** The list of menu items to be shown. Parent may change this at any time based on user activity. */ items?: PopupMenuTypes[];
11
+ menushown?: boolean;
12
12
  value?: string | undefined;
13
13
  /** Control where the menu will appear. Default is to use the current viewport to make a decision to
14
- maximize potential for menu growth. */ align?: GlueAlignOpts | undefined;
15
- /** When the menu is active, should it cover the button or be rendered above/below it? */ cover?: boolean | undefined;
14
+ maximize potential for menu growth. */ align?: GlueAlignOpts;
15
+ /** When the menu is active, should it cover the button or be rendered above/below it? */ cover?: boolean;
16
16
  /** When an item is currently selected, should it appear in the menu (with a visual indicator), or
17
- simply be removed from the list (`showSelected: false`). */ showSelected?: boolean | undefined;
17
+ simply be removed from the list (`showSelected: false`). */ showSelected?: boolean;
18
18
  /** When defined, this width will be passed through to the menu's CSS width. Use a valid CSS dimension
19
19
  such as 33em or 159px. Generally this will be used when you need to match the menu width to something
20
20
  else, like the button. If the width is static like 100% a simple CSS rule is likely more efficient. */ width?: string | undefined;
21
21
  /** Bind this prop to receive a store that is updated each time a menu placement decision is made. Example
22
22
  of when this is useful is when you are trying to round corners of your button and need to know whether the
23
23
  menu is above or below your button so you know which corners to round and which to leave square. Note that
24
- the values do not update when the menu is hidden, so you may need to rely on `menushown` as well. */ computedalign?: Store<GlueAlignStore> | undefined;
25
- /** Create some spacing between the specified button element and the menu, in pixels */ gap?: number | undefined;
24
+ the values do not update when the menu is hidden, so you may need to rely on `menushown` as well. */ computedalign?: Store<GlueAlignStore>;
25
+ /** Create some spacing between the specified button element and the menu, in pixels */ gap?: number;
26
26
  /** Set to `true` if you want the parent element's styling to increase its minHeight when necessary. Useful
27
- for parent elements not styled for variable size children and which you want override the the size of. */ adjustparentheight?: boolean | undefined;
27
+ for parent elements not styled for variable size children and which you want override the the size of. */ adjustparentheight?: boolean;
28
28
  /** If the menu would be clipped by an `overflow: hidden`, you can set this prop and it will be placed in
29
29
  the specified container, or the `document.body` if you simply say `true`. Placement will still be calculated
30
30
  correctly since it uses positon fixed for placement. */ usePortal?: HTMLElement | true | undefined;
31
31
  /** Useful for when your `items` need to be fetched but you want the associated element shown. Set to loading
32
- until they're ready to be displayed and the popup menu will not be shown until the `loading` bind is `true`. */ loading?: boolean | undefined;
32
+ until they're ready to be displayed and the popup menu will not be shown until the `loading` bind is `true`. */ loading?: boolean;
33
33
  /** A bindable value for inspecting which item in `items` is currently highlighted as the item currently
34
34
  active in the list. This is not the same as `value` and the highlighted item may or may not be selected as
35
35
  for the `value` of the field. */ hilited?: number | undefined;
36
- /** The id of the <ul> element that is the displayed list of items. */ menuid?: string | undefined;
36
+ /** The id of the <ul> element that is the displayed list of items. */ menuid?: string;
37
37
  /** When there are no items (e.g. it's a filtered search and there were no results), we still display one
38
38
  disabled item in the menu to let the user know what is going on. Use this prop to specify the message. */ emptyText?: string | undefined;
39
- menuContainerClass?: string | undefined;
40
- menuClass?: string | undefined;
41
- menuItemClass?: string | undefined;
42
- menuItemHilitedClass?: string | undefined;
43
- menuItemSelectedClass?: string | undefined;
44
- menuDividerClass?: string | undefined;
45
- hideSelectedIndicator?: boolean | undefined;
46
- hideEmptyText?: boolean | undefined;
47
- usemenurole?: boolean | undefined;
39
+ menuContainerClass?: string;
40
+ menuClass?: string;
41
+ menuItemClass?: string;
42
+ menuItemHilitedClass?: string;
43
+ menuItemSelectedClass?: string;
44
+ menuDividerClass?: string;
45
+ hideSelectedIndicator?: boolean;
46
+ hideEmptyText?: boolean;
47
+ usemenurole?: boolean;
48
48
  };
49
49
  slots: {
50
50
  default: {
@@ -2,7 +2,7 @@
2
2
  This component is for adding text that can be read by screen readers while remaining invisible to regular users.
3
3
  Useful for when aria-label isn't supported with the drawback that it can show up in copy/paste selections.
4
4
  -->
5
- <script>/** An id to bind with the `<span>` used to implement this component. */
5
+ <script lang="ts">/** An id to bind with the `<span>` used to implement this component. */
6
6
  export let id = undefined;
7
7
  export let arialive = undefined;
8
8
  export let ariaatomic = undefined;
@@ -2,8 +2,8 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  /** An id to bind with the `<span>` used to implement this component. */ id?: string | undefined;
5
- arialive?: 'off' | 'assertive' | 'polite' | undefined;
6
- ariaatomic?: boolean | 'false' | 'true' | undefined;
5
+ arialive?: "off" | "assertive" | "polite" | undefined;
6
+ ariaatomic?: boolean | "false" | "true" | undefined;
7
7
  };
8
8
  events: {
9
9
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,6 @@
1
1
  import { Store } from '@txstate-mws/svelte-store';
2
2
  export interface Toast {
3
+ title?: string;
3
4
  message: string;
4
5
  /** default is error */
5
6
  type?: 'error' | 'warning' | 'info' | 'success';
@@ -10,7 +11,11 @@ export interface Toast {
10
11
  */
11
12
  ttlMs?: number;
12
13
  }
13
- export interface ToastStorage extends Required<Toast> {
14
+ export interface ToastStorage {
15
+ title?: string;
16
+ message: string;
17
+ type: 'error' | 'warning' | 'info' | 'success';
18
+ ttlMs: number;
14
19
  /** each toast gets a random id so it can be dismissed by user interaction */
15
20
  id: string;
16
21
  /** when the toast was created, so we know when it expires */
@@ -19,7 +24,8 @@ export interface ToastStorage extends Required<Toast> {
19
24
  suspended: boolean;
20
25
  }
21
26
  export declare class ToastStore extends Store<ToastStorage[]> {
22
- add(msg: string, type?: Toast['type'], ttlMs?: number): void;
27
+ add(toast: Toast): any;
28
+ add(msg: string, type?: Toast['type'], ttlMs?: number): any;
23
29
  close(id: string): void;
24
30
  suspend(id: string): void;
25
31
  resume(id: string): void;
@@ -1,18 +1,26 @@
1
1
  import { Store } from '@txstate-mws/svelte-store';
2
2
  import { randomid } from 'txstate-utils';
3
3
  export class ToastStore extends Store {
4
- add(msg, type, ttlMs) {
5
- const resolvedType = type ?? 'error';
4
+ add(msgOrToast, type, ttlMs) {
5
+ const toast = typeof msgOrToast === 'string'
6
+ ? {
7
+ message: msgOrToast,
8
+ type,
9
+ ttlMs
10
+ }
11
+ : msgOrToast;
12
+ const resolvedType = toast.type ?? 'error';
6
13
  const id = randomid();
7
14
  const stored = {
8
15
  id,
9
16
  stamp: new Date(),
10
- message: msg,
17
+ title: toast.title,
18
+ message: toast.message,
11
19
  type: resolvedType,
12
20
  suspended: false,
13
- ttlMs: ttlMs ?? (['error', 'warning'].includes(resolvedType) ? 8000 : 5000)
21
+ ttlMs: toast.ttlMs ?? (['error', 'warning'].includes(resolvedType) ? 8000 : 5000)
14
22
  };
15
- this.update(v => [...v.filter(t => t.message !== stored.message), stored]);
23
+ this.update(v => [...v.filter(t => t.message !== stored.message || t.title !== stored.title), stored]);
16
24
  setTimeout(() => { this.clean(); }, stored.ttlMs);
17
25
  }
18
26
  close(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@txstate-mws/svelte-components",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "Svelte components that are generically useful.",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",