Skip to content

v2.0.0 - v2.0.1

Compare
Choose a tag to compare
@smastrom smastrom released this 26 Dec 15:44
· 23 commits to main since this release

Before wishing happy new year to everyone and going for a bit off until the beginning of January, I wanted to release Notivue v2.0.0.

Release notes

This release unifies usage between Vite, Nuxt and Astro setups by bringing an isomorphic API that deprecates usePush and exports push from notivue by finally allowing it to be called from anywhere no matter what framework is being used.

Upgrade guide

While usePush has been deprecated, it is still exported from notivue to facilitate the migration. For Nuxt setups, upgrading to v2.0.0 shouldn't break your code at all.

Unfortunately, for Vite-based setups an edit in both your main.js and any file where you imported push is required.

Vite

main.js

import { createNotivue }聽from 'notivue'
import {聽createApp } from 'vue'

import App from './App.vue'

+ const notivue = createNotivue(/* options */)
const app = createApp(App)

- export const push = createNotivue(app, /* options */)
+ app.use(notivue)

app.mount('#app')

In any of your files:

- import {聽push } from '@/main'
+ import {聽push } from 'notivue'

push.success('Hello from Notivue 2.0.0')

Nuxt

All you have to do is to remove this statement from anywhere in your code:

- const push = usePush()

push is now auto-imported directly from notivue and can be called from anywhere without worrying about the setup context.


What's new

notivue/astro

This package now exports Astro-dedicated versions of Notivue and push from notivue/astro meant to connect the Notivue store to Astro client code using Custom Events.

This makes possible to push notifications from anywhere: script tags, React components, Vue components, you name it. Persistence of the notification stream across page navigation is also supported when using View Transitions.

Check the installation guide in the docs.

Promise Aliases

Promise-based notifications can now be pushed using the load method alternatively to the promise one and updated using success and error methods alternatively to resolve聽and reject. After using this package for a bit in my professional work, I realized that calling promise, resolve and reject was a bit odd.

let notification = push.promise('Loading...')
notification.resolve('Done!')

// Same
let notification = push.load('Loading...')
notification.success('Done!')
let notification = push.promise('Loading...')
notification.reject('Error!')

// Same
let notification = push.load('Loading...')
notification.error('Error!')

What's fixed

  • Improve repositioning performance by avoiding calling triggerRef when not necessary
  • Remove animation enterClass when completed. This prevents the enter animation to be played again when navigating between pages using Astro View Transitions.

What's changed

  • Definitely remove deprecated notivue plugin. The compatibility fallback released in v1 is not anymore exported.
  • Definitely remove deprecated useNotivueConfig composable alias.
  • Remove popIn animation applied to built-in notifications icon.