Line data Source code
1 16 : <script setup lang="ts">
2 : import type { ContextMenuContentEmits, ContextMenuContentProps } from 'reka-ui'
3 : import {
4 : ContextMenuContent,
5 : ContextMenuPortal,
6 : injectContextMenuRootContext,
7 : useForwardPropsEmits
8 : } from 'reka-ui'
9 : import type { HTMLAttributes } from 'vue'
10 :
11 : import { cn } from '@comfyorg/tailwind-utils'
12 :
13 : import { menuContentClass } from './menuStyles'
14 :
15 : defineOptions({ inheritAttrs: false })
16 :
17 16126 : const { class: className, ...restProps } = defineProps<
18 : ContextMenuContentProps & { class?: HTMLAttributes['class'] }
19 : >()
20 : const emits = defineEmits<ContextMenuContentEmits>()
21 16126 : const forwarded = useForwardPropsEmits(restProps, emits)
22 16126 : const rootContext = injectContextMenuRootContext()
23 16126 : </script>
24 :
25 : <template>
26 20931 : <ContextMenuPortal :key="Number(rootContext.open.value)">
27 : <ContextMenuContent
28 : v-bind="{ ...forwarded, ...$attrs }"
29 : :class="cn(menuContentClass, className)"
30 : >
31 : <slot />
32 : </ContextMenuContent>
33 : </ContextMenuPortal>
34 : </template>
|