Skip to content

Commit

Permalink
bump 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Jul 3, 2023
1 parent ced12ee commit 2975b95
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.0",
"version": "1.0.2",
"private": true,
"packageManager": "pnpm@8.6.3",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/notivue/Notivue/__tests__/SlotGlobalOptions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Global options have higher priority over defaults', () => {
'promise-resolve': newDefaultOptions,
'promise-reject': newDefaultOptions,
},
},
} as any,
}

describe('First-level notifications', () => {
Expand Down
169 changes: 169 additions & 0 deletions packages/notivue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<div align="center">

# Notivue

### Fully-featured notification system for Vue and Nuxt.

[Live Demo](https://notivue.netlify.app) - [Documentation](https://notivuedocs.netlify.app)

**Examples**

[Custom Components](https://stackblitz.com/edit/vitejs-vite-9jkh73?file=src%2Fcomponents%2FPage.vue) -
[Vue Router](https://stackblitz.com/edit/vitejs-vite-kdrtrw?file=src/components/Example.vue) - [Nuxt](https://stackblitz.com/edit/nuxt-starter-fnhcmx?file=pages%2Findex.vue) - [Pinia](https://stackblitz.com/edit/vitejs-vite-knysks?file=src%2FApp.vue) - [TanStack Query](https://stackblitz.com/edit/vitejs-vite-ymjktx?file=src%2FApp.vue)

</div>

<br />

## Features

**🧬 JS and CSS modular**
_Granularly include only the features you need_

**🧚‍♂️ Zero deps and lightweight**
_From ~4 KB (gzipped)_

**🎢 Slick transitions and animations**
_Customize any animation_

**🧩 Custom Components API**
_Use your own components while Notivue handles the rest_

**🌀 Promise API**
_Update pending notifications with ease_

**🔰 Includes a ready-made component with anything you need**
_Themes, icons, animations, rtl support and much more_

**♿️ Fully accessible**
_Built-in screen reader support_

<br />

## Installation

```bash
pnpm add notivue
```

<br />

## Vite / Vue CLI

### 1. Configure

**main.js/ts**

```js
import { createApp } from 'vue'
import { notivue } from 'notivue'

import App from './App.vue'

import 'notivue/notifications.css' // Only needed if using built-in notifications
import 'notivue/animations.css' // Only needed if using built-in animations

const app = createApp(App)

app.use(notivue)
app.mount('#app')
```

**App.vue**

```vue
<script setup>
import { Notivue, Notifications } from 'notivue'
</script>
<template>
<Notivue v-slot="item">
<Notifications :item="item" />
</Notivue>
<!-- ... -->
</template>
```

### 2. Push notifications from any component

```vue
<script setup>
import { usePush } from 'notivue'
const push = usePush()
</script>
<template>
<button @click="push.success('Something good has been pushed!')">Push</button>
</template>
```

<br />

## Nuxt 3

### 1. Configure

**plugins/notivue.client.ts** (create _/plugins_ folder if it doesn't exist)

```ts
import { notivue } from 'notivue'

export default defineNuxtPlugin(({ vueApp }) => {
vueApp.use(notivue)
})
```

**nuxt.config.ts**

```ts
export default defineNuxtConfig({
css: ['notivue/notifications.css', 'notivue/animations.css']
})
```

**App.vue** (wrap `<Notivue />` in a [ClientOnly](https://nuxt.com/docs/api/components/client-only) component)

```vue
<script setup>
import { Notivue, Notifications } from 'notivue'
</script>
<template>
<ClientOnly>
<Notivue v-slot="item">
<Notifications :item="item" />
</Notivue>
</ClientOnly>
<!-- ... -->
</template>
```

### 2. Push notifications from any component

```vue
<script setup>
import { usePush } from 'notivue'
const push = usePush()
</script>
<template>
<button @click="push.success('Something good has been pushed!')">Push</button>
</template>
```

<br />

## Thanks

- [Ionic Team](https://ionic.io/) for the icon sets
- [Uktash Verna](https://github.com/n3r4zzurr0) for the SVG spinner

<br />

## License

MIT Licensed - Simone Mastromattei © 2023
1 change: 1 addition & 0 deletions packages/notivue/core/createStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export function createStore(userConfig: NotivueConfig) {
...notification,
createdAt,
resumedAt,
animationClass: '',
timeoutId: shouldSkipTimeout
? undefined
: this.playLeaveTimeout(notification.id, notification.duration),
Expand Down
2 changes: 1 addition & 1 deletion packages/notivue/cypress/support/commands-notivue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Cypress.Commands.add('clickAllStatic', () => {
Cypress.Commands.add('clickRandomStatic', () => {
const randomSelector = ['.Success', '.Error', '.Info', '.Warning'][Math.floor(Math.random() * 4)]

cy.get(randomSelector).click()
return cy.get(randomSelector).click()
})

Cypress.Commands.add('clickAll', () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/notivue/cypress/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export const RESOLVE_REJECT_DELAY = 1000

export function getRandomOptions() {
return {
title: Math.random().toString(),
message: Math.random().toString(),
title: window.crypto.randomUUID(),
message: window.crypto.randomUUID(),
duration: Math.floor(Math.random() * 10000),
ariaLive: Math.random().toString() as any,
ariaRole: Math.random().toString() as any,
closeAriaLabel: Math.random().toString(),
ariaLive: window.crypto.randomUUID(),
ariaRole: window.crypto.randomUUID(),
closeAriaLabel: window.crypto.randomUUID(),
}
}

Expand Down
5 changes: 3 additions & 2 deletions packages/notivue/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "notivue",
"version": "1.0.0",
"version": "1.0.2",
"private": false,
"description": "Fully-featured notification system for Vue and Nuxt.",
"description": "Fully-featured toast notification system for Vue and Nuxt.",
"keywords": [
"vue",
"vuejs",
Expand Down Expand Up @@ -44,6 +44,7 @@
"scripts": {
"dev": "pnpm --C \"../../demo\" run dev",
"preinstall": "npx only-allow pnpm",
"prebuild": "cp ../../README.md .",
"build": "rimraf dist && vue-tsc && vite build && pnpm run build:css",
"build:css": "esbuild ./Notifications/notifications.css ./core/animations.css --bundle --outdir=dist --minify --target=chrome58,edge16,firefox57,node12,safari11 --log-level=error",
"test": "pnpm run test:chrome && pnpm run test:firefox",
Expand Down

0 comments on commit 2975b95

Please sign in to comment.