@nuxt/devtools-ui-kit 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { onMounted, ref, watch } from 'vue'
2
+ import { computed, nextTick, ref, watchEffect } from 'vue'
3
3
  import { useVModel } from '@vueuse/core'
4
4
  import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
5
5
 
@@ -13,6 +13,7 @@ const props = withDefaults(
13
13
  dim: true,
14
14
  },
15
15
  )
16
+
16
17
  const emit = defineEmits<{
17
18
  (event: 'close'): void
18
19
  (event: 'update:modelValue', value: boolean): void
@@ -20,17 +21,21 @@ const emit = defineEmits<{
20
21
 
21
22
  const show = useVModel(props, 'modelValue', emit, { passive: true })
22
23
  const card = ref(null)
24
+ const shown = ref(false)
25
+
26
+ const { activate, deactivate } = useFocusTrap(computed(() => card.value || document.body), { immediate: false })
23
27
 
24
- const { activate, deactivate } = useFocusTrap(card, { immediate: false })
28
+ watchEffect(
29
+ () => {
30
+ if (!shown.value && show.value)
31
+ shown.value = true
25
32
 
26
- onMounted(() => {
27
- watch(show, (v) => {
28
- if (v)
29
- activate()
33
+ if (show.value && card.value)
34
+ nextTick(activate)
30
35
  else
31
36
  deactivate()
32
- }, { immediate: true })
33
- })
37
+ },
38
+ )
34
39
 
35
40
  function close() {
36
41
  show.value = false
@@ -45,8 +50,9 @@ export default {
45
50
  </script>
46
51
 
47
52
  <template>
48
- <Teleport v-if="show" to="body">
53
+ <Teleport v-if="shown" to="body">
49
54
  <div
55
+ v-show="show"
50
56
  class="n-dialog fixed inset-0 z-100 flex items-center justify-center n-transition"
51
57
  :class="[
52
58
  show ? '' : 'op0 pointer-events-none visibility-none',
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "devtools-ui-kit",
3
3
  "configKey": "devtoolsUIKit",
4
- "version": "0.5.3"
4
+ "version": "0.5.5"
5
5
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-ui-kit",
3
3
  "type": "module",
4
- "version": "0.5.3",
4
+ "version": "0.5.5",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -23,7 +23,7 @@
23
23
  "*.cjs"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@nuxt/devtools": "0.5.3"
26
+ "@nuxt/devtools": "0.5.5"
27
27
  },
28
28
  "dependencies": {
29
29
  "@iconify-json/carbon": "^1.1.16",
@@ -42,8 +42,8 @@
42
42
  "focus-trap": "^7.4.3",
43
43
  "unocss": "^0.52.3",
44
44
  "v-lazy-show": "^0.2.3",
45
- "@nuxt/devtools": "0.5.3",
46
- "@nuxt/devtools-kit": "0.5.3"
45
+ "@nuxt/devtools": "0.5.5",
46
+ "@nuxt/devtools-kit": "0.5.5"
47
47
  },
48
48
  "devDependencies": {
49
49
  "nuxt": "^3.5.1"