2024-10-13 17:37:01 +00:00
|
|
|
import type { Ref } from 'vue'
|
2022-11-19 18:04:21 +00:00
|
|
|
import { requireInjection } from '@/utils'
|
|
|
|
import { OverlayKey } from '@/symbols'
|
2024-10-13 17:37:01 +00:00
|
|
|
import type Overlay from '@/components/ui/Overlay.vue'
|
2022-11-19 18:04:21 +00:00
|
|
|
|
2024-04-23 21:01:27 +00:00
|
|
|
export const useOverlay = (overlay?: Ref<InstanceType<typeof Overlay>> | null) => {
|
2022-11-19 18:04:21 +00:00
|
|
|
overlay = overlay || requireInjection(OverlayKey)
|
|
|
|
|
|
|
|
return {
|
|
|
|
showOverlay: overlay.value.show.bind(overlay.value),
|
2024-10-13 17:37:01 +00:00
|
|
|
hideOverlay: overlay.value.hide.bind(overlay.value),
|
2022-11-19 18:04:21 +00:00
|
|
|
}
|
|
|
|
}
|