Skip to content

Commit

Permalink
Notivue, NotivueKeyboard - Force unmount when not running
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Apr 14, 2024
1 parent e41bf3b commit 7dceff6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/notivue/Notivue/Notivue.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script setup lang="ts">
import { useNotivueInstance } from '@/core/useStore'
import { DEFAULT_PROPS } from './constants'
import { NotivueClientOnly } from '@/shared/ClientOnly'
import NotivueImpl from './NotivueImpl.vue'
Expand All @@ -8,12 +10,14 @@ import type { NotivueComponentSlot, NotivueProps } from 'notivue'
const props = withDefaults(defineProps<NotivueProps>(), DEFAULT_PROPS)
const { isRunning } = useNotivueInstance()
defineSlots<NotivueComponentSlot>()
</script>

<template>
<NotivueClientOnly>
<NotivueImpl v-bind="props" v-slot="item">
<NotivueImpl v-bind="props" v-slot="item" v-if="isRunning">
<slot v-bind="item" />
</NotivueImpl>
</NotivueClientOnly>
Expand Down
14 changes: 11 additions & 3 deletions packages/notivue/NotivueKeyboard/NotivueKeyboard.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
<script setup lang="ts">
import { NotivueClientOnly } from '@/shared/ClientOnly'
import { useNotivueInstance } from '@/core/useStore'
import { DEFAULT_PROPS } from './constants'
import { NotivueClientOnly } from '@/shared/ClientOnly'
import NotivueKeyboardImpl from './NotivueKeyboardImpl.vue'
import type { NotivueKeyboardSlot, NotivueKeyboardProps } from 'notivue'
import { type NotivueKeyboardSlot, type NotivueKeyboardProps } from 'notivue'
const props = withDefaults(defineProps<NotivueKeyboardProps>(), DEFAULT_PROPS)
const { isRunning } = useNotivueInstance()
defineSlots<NotivueKeyboardSlot>()
</script>

<template>
<NotivueClientOnly>
<NotivueKeyboardImpl v-bind="props" v-slot="{ containersTabIndex, elementsTabIndex }">
<NotivueKeyboardImpl
v-bind="props"
v-slot="{ containersTabIndex, elementsTabIndex }"
v-if="isRunning"
>
<slot v-bind="{ containersTabIndex, elementsTabIndex }" />
</NotivueKeyboardImpl>
</NotivueClientOnly>
Expand Down

0 comments on commit 7dceff6

Please sign in to comment.