Skip to content

v0.9.6

Latest
Compare
Choose a tag to compare
@zerodevx zerodevx released this 21 Sep 09:01

This is a maintenance update that brings tooling and dependencies in sync with the latest Svelte decisions.

Changelog

  • onpop() callback returns a details object as its second param containing the close event, if any (#104):
toast.push('foo', {
  onpop: (id, details) => {
    const { event } = details
    // `undefined` if closed by timeout; 
    // `MouseEvent|KeyboardEvent` if closed by dismiss button
    console.log(event)
  }
})
<script lang="ts">
import { toast, type SvelteToastOptions } from '@zerodevx/svelte-toast'

function stub(msg: string, options: SvelteToastOptions) {
  toast.push(msg, options)
}
</script>
  • Support Svelte v5 since it's backward compatible

Roadmap

The next minor v0.10.0 will contain breaking changes - strictly speaking, semver allows that between minor increments of the v0 branch. Changes include:

  • onpop(): callback deprecated in favour of a promise-based implementation;
  • component: decoupling of ToastItem into a Controller and View - this allows greater control on how a toast looks;
  • pausable: none|hover|hidden|all - finer control on when toasts pause (#103);
  • reverse: applies to container-level only;
  • and probably some other stuff.

These changes prepare us for v1.0.0 where codebase will be refactored to Svelte v5 only - this repo greatly benefits from v5's fine-grained reactivity and snippet runes. Work on this begins when v5 stable ships.

Moving forward, the v0 branch will be maintained based on Svelte v4 (can be used in both v4 and v5 projects), while the v1 branch will be written in Svelte v5 and can only be used in v5 projects.