Skip to content

Commit 14cb7c7

Browse files
fix: default container id clear
1 parent a96cef3 commit 14cb7c7

File tree

5 files changed

+163
-3
lines changed

5 files changed

+163
-3
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
2222
"eslint": "eslint .",
2323
"eslint:fix": "eslint --fix .",
24+
"test": "run-p test:*",
25+
"test:lint": "run-s eslint",
26+
"test:tsc": "vue-tsc --noEmit",
2427
"release": "standard-version && git push --follow-tags origin main && npm publish"
2528
},
2629
"dependencies": {
@@ -37,8 +40,10 @@
3740
"eslint-plugin-prettier-vue": "4.2.0",
3841
"eslint-plugin-tailwindcss": "3.7.0",
3942
"eslint-plugin-vuejs-accessibility": "2.0.0",
43+
"npm-run-all": "^4.1.5",
4044
"nuxt": "^3.0.0",
4145
"standard-version": "^9.5.0",
42-
"vue": "^3.2.45"
46+
"vue": "^3.2.45",
47+
"vue-tsc": "^1.0.9"
4348
}
4449
}

playground/nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineNuxtConfig } from 'nuxt/config'
2+
// @ts-expect-error - this is a playground
23
import NinjaNuxtToaster from '..'
34

45
export default defineNuxtConfig({

pnpm-lock.yaml

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/composables/useNinjaToasterContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { NinjaToasterTheme } from '../../theme'
55

66
export function useNinjaToasterContainer(theme?: NinjaToasterTheme) {
77
const container = ref<Element | null>(null)
8-
const containerId = theme?.containerId || 'nt-container'
8+
const containerId = theme?.containerId ?? 'nt-container'
99

1010
tryOnBeforeMount(() => {
1111
container.value = document.getElementById(containerId)

src/runtime/create.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ export function createNinjaToaster(
110110
}
111111

112112
function clear(theme: NinjaToasterTheme | string) {
113-
const containerId = typeof theme === 'string' ? theme : theme.containerId
113+
const containerId =
114+
typeof theme === 'string' ? theme : theme.containerId ?? 'nt-container'
114115

115116
events.emit(`clear-${containerId}`)
116117
if (queues.has(containerId)) {

0 commit comments

Comments
 (0)