eefd7abf83
Reorganize components into category folders (forms/canvas/overlays/etc.); add the media-editor headless family (timeline, curve-editor, waveform, crop, color picker, etc.); apply perf fixes (O(1) collection lookups, plain-object drag state, gesture-leak teardown, shallowRef color state, rect caching) and replace source `any` with proper types.
43 lines
1.5 KiB
Vue
43 lines
1.5 KiB
Vue
<script lang="ts">
|
|
import type { HoverCardContentImplEmits, HoverCardContentImplProps } from './HoverCardContentImpl.vue';
|
|
|
|
/**
|
|
* The floating panel that holds the previewed content. It is positioned against
|
|
* the trigger and is mounted only while the card is open (gated by `Presence`),
|
|
* unless `forceMount` is set so you can drive enter/exit animations yourself.
|
|
*/
|
|
export interface HoverCardContentProps extends HoverCardContentImplProps {
|
|
/** Keep mounted for CSS exit animations. */
|
|
forceMount?: boolean;
|
|
}
|
|
|
|
export type HoverCardContentEmits = HoverCardContentImplEmits;
|
|
</script>
|
|
|
|
<script setup lang="ts">
|
|
import HoverCardContentImpl from './HoverCardContentImpl.vue';
|
|
import { Presence } from '../../utilities/presence';
|
|
import { useForwardExpose } from '@robonen/vue';
|
|
import { useHoverCardContext } from './context';
|
|
|
|
const { forceMount = false, ...contentProps } = defineProps<HoverCardContentProps>();
|
|
const emit = defineEmits<HoverCardContentEmits>();
|
|
const ctx = useHoverCardContext();
|
|
const { forwardRef } = useForwardExpose();
|
|
</script>
|
|
|
|
<template>
|
|
<Presence :present="ctx.open.value" :force-mount="forceMount">
|
|
<HoverCardContentImpl
|
|
v-bind="contentProps"
|
|
:ref="forwardRef"
|
|
@escape-key-down="emit('escapeKeyDown', $event)"
|
|
@pointer-down-outside="emit('pointerDownOutside', $event)"
|
|
@focus-outside="emit('focusOutside', $event)"
|
|
@interact-outside="emit('interactOutside', $event)"
|
|
>
|
|
<slot />
|
|
</HoverCardContentImpl>
|
|
</Presence>
|
|
</template>
|