UNPKG

@retanaar/vi-calendar

Version:

Fork of v-calendar 3.1.2 with Vue 3.5 fix

18 lines (13 loc) 462 B
import { type SetupContext, inject, provide } from 'vue'; type Slots = SetupContext['slots']; function contextKey(slotKey: string) { return `__vc_slot_${slotKey}__`; } export function provideSlots(slots: Slots, remap: Record<string, string> = {}) { Object.keys(slots).forEach(slotKey => { provide(contextKey(remap[slotKey] ?? slotKey), slots[slotKey]); }); } export function useSlot(slotKey: string) { return inject(contextKey(slotKey), null); }