Skip to content

Commit d417eb5

Browse files
committed
feat: v2
1 parent 0264baa commit d417eb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

40 files changed

+5658
-7570
lines changed

.eslintignore

-5
This file was deleted.

.eslintrc

-12
This file was deleted.

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ node_modules
99
.vscode
1010
*.log
1111

12-
docs
13-
.npmrc.dev
12+

.npmrc

-3
This file was deleted.

.prettierrc

-10
This file was deleted.

README.md

-1
This file was deleted.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/vue-notifications/README.md

package.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"private": true,
3+
"type": "module",
34
"scripts": {
45
"dev": "concurrently \"pnpm:dev:*\"",
56
"dev:docs": "pnpm --filter docs dev",
@@ -11,15 +12,13 @@
1112
"release:library": "pnpm --filter @outloud/vue-notifications release",
1213
"lint": "eslint . --ext=.ts,.vue --fix",
1314
"typecheck": "pnpm --parallel typecheck",
14-
"prepare:nuxt": "pnpm --filter @outloud/nuxt-notifications dev:prepare && pnpm --filter @outloud/nuxt-notifications prepack",
15-
"postinstall": "pnpm build:library && pnpm prepare:nuxt"
15+
"prepare:nuxt": "pnpm --filter @outloud/nuxt-notifications dev:prepare && pnpm --filter @outloud/nuxt-notifications prepack"
1616
},
1717
"devDependencies": {
18-
"@antfu/eslint-config": "^0.34.1",
19-
"@types/node": "^20.5.1",
20-
"concurrently": "^7.6.0",
21-
"eslint": "^8.32.0",
22-
"prettier": "^3.0.2",
23-
"typescript": "^5.1.6"
18+
"@types/node": "^22.5.1",
19+
"concurrently": "^8.2.2",
20+
"eslint": "^9.9.1",
21+
"release-it": "^17.6.0",
22+
"typescript": "^5.5.4"
2423
}
2524
}

packages/nuxt-notifications/CHANGELOG.md

-8
This file was deleted.

packages/nuxt-notifications/README.md

-6
This file was deleted.

packages/nuxt-notifications/package.json

-7
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,8 @@
2323
"release": "pnpm prepack && release-it"
2424
},
2525
"dependencies": {
26-
"@nuxt/kit": "^3",
2726
"@outloud/vue-notifications": "^1"
2827
},
2928
"devDependencies": {
30-
"@nuxt/module-builder": "^0.2.1",
31-
"@nuxt/schema": "^3",
32-
"@nuxtjs/eslint-config-typescript": "^12.0.0",
33-
"@release-it/conventional-changelog": "^5.1.1",
34-
"nuxt": "^3",
35-
"release-it": "^15.6.0"
3629
}
3730
}

packages/nuxt-notifications/src/module.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { addComponent, addImports, addPlugin, addTemplate, createResolver, defineNuxtModule } from '@nuxt/kit'
2-
import type { NotificationDefaults, NotificationsConfig } from '@outloud/vue-notifications'
2+
import { packageName, type NotificationDefaults, type NotificationsConfig } from '@outloud/vue-notifications'
33

44
export default defineNuxtModule({
55
meta: {
@@ -14,9 +14,9 @@ export default defineNuxtModule({
1414
nuxt.options.build.transpile.push(resolver.resolve('./runtime'))
1515

1616
// https://github.com/nuxt/framework/pull/8544
17-
nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {}
18-
nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || []
19-
nuxt.options.vite.optimizeDeps.include.push('@outloud/vue-notifications')
17+
// nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {}
18+
// nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || []
19+
// nuxt.options.vite.optimizeDeps.include.push('@outloud/vue-notifications')
2020

2121
nuxt.hook('prepare:types', ({ references }) => {
2222
references.push({ types: '@outloud/vue-notifications' }, { types: '@outloud/nuxt-notifications' })
@@ -29,13 +29,9 @@ export default defineNuxtModule({
2929
},
3030
})
3131

32-
// Add runtime plugin before the router plugin
33-
// https://github.com/nuxt/framework/issues/9130
34-
nuxt.hook('modules:done', () => {
35-
addPlugin(resolver.resolve('./runtime/plugin'))
36-
})
32+
addPlugin(resolver.resolve('./runtime/plugin'))
3733

38-
nuxt.options.css.unshift('@outloud/vue-notifications/style.css')
34+
nuxt.options.css.push(`${packageName}/style.css`)
3935

4036
addImports({
4137
name: 'useNotifications',

packages/nuxt-notifications/src/runtime/plugin.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createNotifications } from '@outloud/vue-notifications'
1+
import { createNotifications, type ExtendedNotificationManager } from '@outloud/vue-notifications'
22
import { defineNuxtPlugin } from '#app'
33
// @ts-expect-error this file will be created by module
44
import { options } from '#build/nuxt-notifications.options'
@@ -24,6 +24,10 @@ export default defineNuxtPlugin(({ vueApp }) => {
2424

2525
declare module '#app' {
2626
interface NuxtApp {
27-
$notifications: import('@outloud/vue-notifications').ExtendedNotificationManager
27+
/**
28+
* Notifications global state for the list and also provides
29+
* functions that can be used to control it. {@link ExtendedNotificationManager}
30+
*/
31+
$notifications: ExtendedNotificationManager
2832
}
2933
}

packages/vue-notifications/.gitignore

Whitespace-only changes.

packages/vue-notifications/CHANGELOG.md

-29
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @ts-check
2+
import { createConfig } from '@outloud/eslint-config-vue'
3+
4+
export default createConfig()

packages/vue-notifications/index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="preconnect" href="https://fonts.googleapis.com">
7+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8+
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
9+
</head>
10+
<body>
11+
<div id="app"></div>
12+
<script type="module" src="/playground/main.ts"></script>
13+
</body>
14+
</html>

packages/vue-notifications/package.json

+22-15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "",
44
"private": false,
55
"version": "1.0.3",
6+
"type": "module",
67
"source": "src/index.ts",
78
"main": "./dist/index.umd.js",
89
"module": "./dist/index.es.js",
@@ -18,31 +19,37 @@
1819
"require": "./dist/style.css"
1920
}
2021
},
22+
"imports": {
23+
"~/*": "./src/*.js"
24+
},
2125
"files": [
2226
"dist"
2327
],
2428
"scripts": {
25-
"dev": "vue-tsc --noEmit && vite build -w",
26-
"build": "vue-tsc --noEmit && vite build",
29+
"dev": "vite",
30+
"build": "vite build --mode lib",
2731
"test": "vitest run",
32+
"test:dev": "vitest",
2833
"typecheck": "vue-tsc --noEmit",
2934
"release": "pnpm build && release-it"
3035
},
3136
"devDependencies": {
32-
"@release-it/conventional-changelog": "^5.1.1",
33-
"@vitejs/plugin-vue": "^4.3.1",
34-
"@vueuse/core": "^10.3.0",
35-
"release-it": "^15.6.0",
36-
"sass": "^1.56.0",
37-
"sass-loader": "^13.1.0",
38-
"unplugin-vue-define-options": "^1.1.4",
39-
"vite": "^4.4.9",
40-
"vite-plugin-dts": "^3.5.2",
41-
"vue": "^3.3.4",
42-
"vue-tsc": "^1.8.8"
37+
"@iconify/vue": "^4.1.2",
38+
"@outloud/eslint-config-vue": "^1.1.2",
39+
"@unocss/reset": "^0.62.3",
40+
"@vitejs/plugin-vue": "^5.1.3",
41+
"@vue/test-utils": "^2.4.6",
42+
"happy-dom": "^15.7.2",
43+
"sass-embedded": "^1.77.8",
44+
"sass-loader": "^16.0.1",
45+
"unocss": "^0.62.3",
46+
"vite": "^5.4.2",
47+
"vite-plugin-dts": "^4.0.3",
48+
"vitest": "^2.0.5",
49+
"vue": "^3.4.38",
50+
"vue-tsc": "^2.1.2"
4351
},
4452
"peerDependencies": {
45-
"@vueuse/core": ">= 9",
46-
"vue": "^3"
53+
"vue": "^3.0.0"
4754
}
4855
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<template>
2+
<div class="w-full h-full min-h-screen bg-neutral-50 dark:bg-neutral-900">
3+
<h1>App</h1>
4+
5+
<div class="flex">
6+
<input
7+
id="title"
8+
v-model="options.title"
9+
type="checkbox"
10+
>
11+
12+
<label for="title">Title</label>
13+
</div>
14+
15+
<div class="flex">
16+
<input
17+
id="text"
18+
v-model="options.text"
19+
type="checkbox"
20+
>
21+
22+
<label for="text">Text</label>
23+
</div>
24+
25+
<div class="flex">
26+
<input
27+
id="icon"
28+
v-model="options.icon"
29+
type="checkbox"
30+
>
31+
32+
<label for="icon">Icon</label>
33+
</div>
34+
35+
<button type="button" @click="open">
36+
Open
37+
</button>
38+
39+
<ONotificationsContainer />
40+
</div>
41+
</template>
42+
43+
<script lang="ts" setup>
44+
import { reactive } from 'vue'
45+
import { ONotificationsContainer, useNotifications } from '~/index'
46+
47+
const notifications = useNotifications()
48+
49+
const options = reactive({
50+
title: true,
51+
text: true,
52+
icon: true,
53+
})
54+
55+
function open() {
56+
notifications.open({
57+
title: options.title ? 'My notification title' : undefined,
58+
text: options.text ? 'My notification message' : undefined,
59+
icon: options.icon ? 'mdi:account' : undefined,
60+
// duration: 0,
61+
})
62+
}
63+
</script>
64+
65+
<style lang="scss">
66+
67+
</style>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<Icon :icon="name" />
3+
</template>
4+
5+
<script lang="ts" setup>
6+
import { Icon } from '@iconify/vue'
7+
8+
defineProps<{
9+
name: string
10+
}>()
11+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
import Icon from './Icon.vue'
4+
import { createNotifications } from '~/index.js'
5+
6+
import 'uno.css'
7+
import '@unocss/reset/tailwind-compat.css'
8+
import './style.scss'
9+
10+
const app = createApp(App)
11+
12+
app.use(createNotifications({
13+
stacked: true,
14+
}))
15+
app.component('Icon', Icon)
16+
app.mount('#app')

0 commit comments

Comments
 (0)