File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
packages/vue-primitives/src/hover-card Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { onBeforeUnmount } from ' vue'
2+ import { onBeforeUnmount , shallowRef } from ' vue'
33import { useControllableState , useRef } from ' ../hooks/index.ts'
4- import { PopoverRoot } from ' ../popover/index .ts'
4+ import { type Measurable , providePopperContext } from ' ../popper/PopperRoot .ts'
55import { type HoverCardRootEmits , type HoverCardRootProps , provideHoverCardContext } from ' ./HoverCardRoot.ts'
66
77defineOptions ({
@@ -24,6 +24,7 @@ let closeTimerRef = 0
2424const hasSelectionRef = useRef (false )
2525const isPointerDownOnContentRef = useRef (false )
2626
27+ // cleanup any queued state updates on unmount
2728onBeforeUnmount (() => {
2829 clearTimeout (openTimerRef )
2930 clearTimeout (closeTimerRef )
@@ -56,10 +57,20 @@ provideHoverCardContext({
5657 hasSelectionRef ,
5758 isPointerDownOnContentRef ,
5859})
60+
61+ // COMP::PopperRoot
62+
63+ const anchor = shallowRef <Measurable >()
64+
65+ providePopperContext ({
66+ content: shallowRef (),
67+ anchor ,
68+ onAnchorChange(newAnchor ) {
69+ anchor .value = newAnchor
70+ },
71+ })
5972 </script >
6073
6174<template >
62- <PopoverRoot >
63- <slot />
64- </PopoverRoot >
75+ <slot />
6576</template >
You can’t perform that action at this time.
0 commit comments