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.
38 lines
1.1 KiB
Vue
38 lines
1.1 KiB
Vue
<script lang="ts">
|
|
import type { DialogOverlayProps } from '../dialog';
|
|
|
|
/**
|
|
* The dimming layer behind the drawer. Wraps Dialog's Overlay and exposes the
|
|
* `data-drawer-overlay` hooks so its opacity can fade in step with the drag and
|
|
* with snap points. Only renders for modal drawers.
|
|
*/
|
|
export interface DrawerOverlayProps extends DialogOverlayProps {}
|
|
</script>
|
|
|
|
<script setup lang="ts">
|
|
import { watch } from 'vue';
|
|
import { useForwardExpose } from '@robonen/vue';
|
|
import { DialogOverlay } from '../dialog';
|
|
import { injectDrawerRootContext } from './context';
|
|
|
|
defineProps<DrawerOverlayProps>();
|
|
|
|
const { overlayRef, hasSnapPoints, isOpen, shouldFade } = injectDrawerRootContext();
|
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
|
|
watch(currentElement, (el) => {
|
|
overlayRef.value = el as HTMLElement | undefined;
|
|
}, { immediate: true, flush: 'post' });
|
|
</script>
|
|
|
|
<template>
|
|
<DialogOverlay
|
|
:ref="forwardRef"
|
|
data-drawer-overlay
|
|
:data-drawer-snap-points="isOpen && hasSnapPoints ? 'true' : 'false'"
|
|
:data-drawer-snap-points-overlay="isOpen && shouldFade ? 'true' : 'false'"
|
|
>
|
|
<slot />
|
|
</DialogOverlay>
|
|
</template>
|