Skip to content

Commit

Permalink
1.2.0 (#16)
Browse files Browse the repository at this point in the history
* begin enqueue logic

* queue feature complete

* rename some store methods, move them to different store slices

* rename some internal property keys

* remove fixed increment constant, refactor timeout handling

* update demo, tests

* add NotivueSwipe

* remove neodrag, emoji examples, edit demo

* move queue inside items store

* finalized queue, add config side effects, rename some methods

* finalize NotivueSwipe.vue

* delete useFocusEvents, begin useKeyboardNavigation

* finalize NotivueSwipe

* add NotivueKeyboard

* refactor useMouseEvents, useTouchEvents and useVisibilityChange to interop with NotivueSwipe and NotivueKeyboard

* disable tabbing on built-in notifications and add new props to Notivue

* rename some NotivueSwipe and NotivueKeboard functions and props

* add skipQueue and ariaLiveOnly to push options

* rename data-notivue-top to data-notivue-align

* add containersTabIndex to NotivueKeyboard slot props

* remove built-in aria-live node

* add clearProxy

* update accessibility tests

* externalize props, edit demo

* migrate demo to nuxt, add proper watch scripts

* add ariaLiveOnly push option and listAriaLabel Notivue prop

* demo migration to nuxt complete

* drop support for cjs output

* add renderMessage prop to NotivueKeyboard

* move notivue tests to project root

* cleanup notivue config, add optional prop to NotivueKeyboard

* add tooltip to queue demo

* moved any test to root tests folder

* add different mount commands per test category, rename some test utils

* add NotivueSwipe tests

* add push-specific options tests

* add config-enqueue tests

* edit included notifications accessibility test

* finalize Notivue / NotivueSwipe tests, remove aria-atomic=true from AriaLive

* drop terser support, remove some useless methods and styles

* add missing cy.wait to slot tests, remove unnecessary NotivueSwipe style test

* try to update node ver in github actions

* edit workflow to skip bugged hanging test on ci

* rename some core types and add prev versions type aliases

* rework NotivueKeyboard

* rename NotivueSlot type to NotivueItem

* cleanup and update deps

* edit dark theme

* edit demo

* edit vite.config.ts, add composables type export

* edit NotivueKeyboard comments, fix NotivueSwipe missing fn call

* improve cy.mount commands, add notivue-keyboard commands

* add NotivueKeyboard tests

* revert deps, edit readme, release 1.2.0

* add verify-tarball postbuild script

* edit build demo script

* migrate demo to cloudflare pages
  • Loading branch information
smastrom committed Aug 15, 2023
1 parent 64eb4ff commit 562bca0
Show file tree
Hide file tree
Showing 135 changed files with 12,811 additions and 3,574 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
Expand All @@ -18,10 +18,14 @@ jobs:
run_install: false
- name: Install dependencies
run: pnpm install
- name: Chrome tests
- name: Build Notivue
run: pnpm build
- name: Cypress run
uses: cypress-io/github-action@v5
timeout-minutes: 10
with:
working-directory: packages/notivue
install: false
env: CYPRESS_SKIP_BUGGED_CI_TEST=true
component: true
install: true
project: ./tests
browser: chrome
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<div align="center">

![notivue](https://i.ibb.co/CJCG2Hq/readme-header.png)

<br />

# Notivue

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

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

**Examples**

Expand All @@ -23,8 +27,11 @@ _Granularly include only the features you need_
**🧚‍♂️ Zero deps and lightweight**
_From ~4 KB (gzipped)_

**💊 Drop-in components to enhance notifications**
_NotivueSwipe, NotivueKeyboard, all optional and customizable_

**🎢 Slick transitions and animations**
_Customize any animation_
_Customize any animation with CSS_

**🧩 Custom Components API**
_Use your own components while Notivue handles the rest_
Expand All @@ -36,7 +43,7 @@ _Update pending notifications with ease_
_Themes, icons, rtl support and much more_

**♿️ Fully accessible**
_Built-in screen reader and reduced motion support_
_Built-in screen reader, reduced motion, and keyboard support_

<br />

Expand Down Expand Up @@ -90,10 +97,16 @@ import { Notivue, Notifications } from 'notivue'
Or roll your own:

```vue
<script setup>
import { Notivue } from 'notivue'
</script>
<template>
<Notivue v-slot="item">
<div class="rounded-full flex py-2 pl-3 bg-slate-700 text-slate-50 text-sm">
{{ item.message }}
<p :role="item.ariaRole" :aria-live="item.ariaLive">
{{ item.message }}
</p>
<button
@click="item.clear"
Expand All @@ -120,7 +133,7 @@ Or roll your own:
</template>
```

Animations, repositioning, pausing, timeouts, and ARIA live regions are always handled by `<Notivue />` when using custom components, so don't worry about anything else besides building the component itself.
Animations, repositioning, queueing, pausing, and clear on swipe are always handled by `<Notivue />` when using custom components, so don't worry about anything else besides building the component itself.

### 2. Push notifications from any component

Expand Down
10 changes: 10 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

node_modules
.DS_Store
2 changes: 2 additions & 0 deletions demo/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true

85 changes: 85 additions & 0 deletions demo/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<script setup lang="ts">
import {
Notifications,
Notivue,
NotivueSwipe,
NotivueKeyboard,
lightTheme,
pastelTheme,
materialTheme,
darkTheme,
slateTheme,
outlinedIcons,
type NotivueItem,
} from 'notivue'
import Nav from '@/components/nav/Nav.vue'
import Background from '@/components/shared/Background.vue'
import CustomStatic from '@/components/custom-notifications/CustomStatic.vue'
import CustomPromise from '@/components/custom-notifications/CustomPromise.vue'
import type { CustomPromiseProps, CustomProps } from '@/components/nav/NavPushCustom.vue'
const { state } = useStore()
!isSSR &&
watchEffect(() => document.documentElement.style.setProperty('--nv-root-width', state.maxWidth))
const themes = { lightTheme, pastelTheme, materialTheme, darkTheme, slateTheme } as const
</script>

<template>
<ClientOnly>
<NotivueKeyboard v-slot="{ containersTabIndex }">
<Notivue
:class="{ CenterOnMobile: state.centerOnMobile }"
:containersTabIndex="containersTabIndex"
v-slot="item"
>
<NotivueSwipe
:item="item"
:disabled="!state.enableSwipe"
v-if="(item.props as CustomProps).isCustom"
>
<CustomStatic :item="item as NotivueItem<CustomProps>" />
</NotivueSwipe>

<NotivueSwipe
:item="item"
:disabled="!state.enableSwipe"
v-else-if="(item.props as CustomPromiseProps).isFileUpload"
>
<CustomPromise :item="item as NotivueItem<CustomPromiseProps>" />
</NotivueSwipe>

<NotivueSwipe :item="item" :disabled="!state.enableSwipe" v-else>
<Notifications
:item="item"
:theme="themes[state.theme]"
:icons="state.outlinedIcons ? outlinedIcons : undefined"
/>
</NotivueSwipe>
</Notivue>
</NotivueKeyboard>
</ClientOnly>

<Background />

<Nav />
</template>

<style>
@media (max-width: 768px) {
.CenterOnMobile {
--nv-root-x-align: center;
}
}
:root {
--nv-root-bottom: 260px;
}
[data-notivue-align='bottom'] {
--nv-root-top: 0px;
}
</style>
35 changes: 25 additions & 10 deletions demo/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
--app-font-family: 'PT Sans Narrow', Avenir, Helvetica, Arial, sans-serif;
}

html {
Expand All @@ -43,23 +44,25 @@ html {
--logo-fill: #455162;
--logo-stroke: #1e2226;
--links-color: #424850;
--divider-color: #b6c5d8;

background: var(--background-color);
background: var(--background-gradient);
}

html[data-theme='dark'] {
--background-color: #343434;
--button-bg-color: #2f2f2f;
--background-color: #171717;
--button-bg-color: #171717;
--button-color: #7f7f7f;
--button-active-bg-color: #545454;
--button-active-color: #fff;
--nav-border-color: #595959;
--nav-bg-color: rgba(86, 86, 86, 0.35);
--legend-title-color: #fff;
--button-active-color: #cacaca;
--nav-border-color: #313131;
--nav-bg-color: rgba(55, 55, 55, 0.36);
--legend-title-color: #d0d0d0;
--logo-fill: #7b7b7b;
--logo-stroke: #141414;
--links-color: #d7d7d7;
--links-color: #d0d0d0;
--divider-color: #313131;

background: var(--background-color);
background-color: var(--background-color);
Expand All @@ -77,6 +80,7 @@ html[data-theme='slate'] {
--logo-fill: #878b92;
--logo-stroke: #141414;
--links-color: #d7d7d7;
--divider-color: #ffffff4a;

background: var(--background-color);
background-color: var(--background-color);
Expand All @@ -90,7 +94,7 @@ body {
}

#app {
font-family: 'PT Sans Narrow', Avenir, Helvetica, Arial, sans-serif;
font-family: var(--app-font-family);
}

* {
Expand All @@ -110,7 +114,7 @@ body {
cursor: pointer;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.03);
transition: transform 100ms ease-in-out;
font-family: 'PT Sans Narrow', Avenir, Helvetica, Arial, sans-serif;
font-family: var(--app-font-family);
font-weight: 700;
color: var(--button-color);
white-space: nowrap;
Expand All @@ -122,7 +126,7 @@ body {
}
}

.ButtonBase_Disabled {
.ButtonBase:disabled {
opacity: 0.5;
cursor: not-allowed;

Expand Down Expand Up @@ -162,3 +166,14 @@ body {
p {
margin: 0;
}

.Tippy {
background-color: white;
padding: 0.5rem 0.75rem;
border-radius: 5px;
font-weight: 600;
line-height: 1.5;
color: var(--button-color);
font-family: var(--app-font-family);
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.03);
}
95 changes: 0 additions & 95 deletions demo/components/App.vue

This file was deleted.

Loading

0 comments on commit 562bca0

Please sign in to comment.