import { Component, ComponentPublicInstance, MaybeRef, MaybeRefOrGetter, WatchHandle } from 'vue'; import { BModalProps, BPopoverProps, BToastProps, BTooltipProps } from './ComponentProps'; import { ContainerPosition } from './Alignment'; import { BModalSlots, BPopoverSlots, BToastSlots } from './ComponentSlots'; import { BModalEmits, BPopoverEmits, BToastEmits } from './ComponentEmits'; import { BvTriggerableEvent } from '../utils'; import { default as BModal } from '../components/BModal/BModal.vue'; import { default as BToast } from '../components/BToast/BToast.vue'; import { default as BPopover } from '../components/BPopover/BPopover.vue'; import { default as BTooltip } from '../components/BTooltip/BTooltip.vue'; export type ControllerKey = symbol | string; export interface PromiseWithComponent extends Promise, PromiseWithComponentInternal { } export interface ShowPromiseWithComponent extends Promise, PromiseWithComponentInternal { } export interface PromiseWithComponentInternal extends AsyncDisposable { id: ControllerKey; ref: ComponentPublicInstance | null; show: () => ShowPromiseWithComponent; hide: (trigger?: string) => PromiseWithComponent; toggle: () => PromiseWithComponent; set: (val: Partial

) => PromiseWithComponent; get: () => P | undefined; destroy: () => void; } type Prefix

= `${P}${S}`; export type CamelCase = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase}${Uppercase}${CamelCase}` : Lowercase; export type ToastOrchestratorArrayValue = Omit & { /** * Position * @default 'top-end' */ 'position'?: ContainerPosition; /** * Sets whether or not the toast should be appended to the container * @default undefined Implicitly defaults to the BOrchestrator's appendToast value */ 'appendToast'?: boolean; /** * A proxy for the modelValue, essentially, you set this once, and it mimics the modelValue. * * Falsy values default to 5000 * * @default 5000 */ 'modelValue'?: BToastProps['modelValue']; '_self': ControllerKey; 'onUpdate:modelValue'?: (val: boolean) => void; '_component'?: Readonly; 'options': OrchestratorCreateOptions; 'promise': { value: PromiseWithComponent; resolve: (value: BvTriggerableEvent) => void; stop?: WatchHandle; }; 'type': 'toast'; } & { [K in keyof BToastEmits as CamelCase>]?: (e: BToastEmits[K][0]) => void; } & { slots?: { [K in keyof BToastSlots]?: BToastSlots[K] | Readonly; }; } & Record; export type ToastOrchestratorParam> = Omit & { 'title'?: MaybeRefOrGetter; 'body'?: MaybeRefOrGetter; /** * Position * @default 'top-end' * @deprecated */ 'pos'?: ContainerPosition; /** * Position * @default 'top-end' */ 'position'?: ContainerPosition; /** * Sets whether or not the toast should be appended to the container * @default undefined Implicitly defaults to the BOrchestrator's appendToast value */ 'appendToast'?: boolean; /** * A proxy for the modelValue, essentially, you set this once, and it mimics the modelValue. * * Falsy values default to 5000 * * @default 5000 */ 'modelValue'?: MaybeRefOrGetter; 'onUpdate:modelValue'?: (val: boolean) => void; 'component'?: Readonly; /** * @deprecated */ 'props'?: Record; } & { [K in keyof BToastEmits as CamelCase>]?: (e: BToastEmits[K][0]) => void; } & { slots?: { [K in keyof BToastSlots]?: MaybeRefOrGetter>; }; } & ComponentProps; export type ToastOrchestratorCreateParam> = MaybeRef>; export type TooltipOrchestratorArrayValue = BTooltipProps & { 'type': 'tooltip'; '_self': ControllerKey; 'position': 'popover'; 'options': OrchestratorCreateOptions; 'onUpdate:modelValue'?: (val: boolean) => void; '_component'?: Readonly; 'promise': { value: PromiseWithComponent; resolve: (value: BvTriggerableEvent) => void; stop?: WatchHandle; }; 'slots'?: { [K in keyof Omit]?: BPopoverSlots[K] | Readonly; }; } & { [K in keyof BPopoverEmits as CamelCase>]?: (e: BPopoverEmits[K][0]) => void; } & Record; export type TooltipOrchestratorParam> = Omit & { 'onUpdate:modelValue'?: (val: boolean) => void; 'title'?: MaybeRefOrGetter; 'body'?: MaybeRefOrGetter; 'modelValue'?: MaybeRefOrGetter; 'component'?: Readonly; 'slots'?: { [K in keyof Omit]?: MaybeRefOrGetter>; }; } & { [K in keyof BPopoverEmits as CamelCase>]?: (e: BPopoverEmits[K][0]) => void; } & ComponentProps; export type TooltipOrchestratorCreateParam> = MaybeRef>; export type PopoverOrchestratorArrayValue = BPopoverProps & BTooltipProps & { 'type': 'popover'; '_self': ControllerKey; 'position': 'popover'; 'options': OrchestratorCreateOptions; 'onUpdate:modelValue'?: (val: boolean) => void; '_component'?: Readonly; 'promise': { value: PromiseWithComponent; resolve: (value: BvTriggerableEvent) => void; stop?: WatchHandle; }; 'slots'?: { [K in keyof Omit]?: BPopoverSlots[K] | Readonly; }; } & { [K in keyof BPopoverEmits as CamelCase>]?: (e: BPopoverEmits[K][0]) => void; } & Record; export type PopoverOrchestratorParam> = Omit & { 'onUpdate:modelValue'?: (val: boolean) => void; 'title'?: MaybeRefOrGetter; 'body'?: MaybeRefOrGetter; 'modelValue'?: MaybeRefOrGetter; 'component'?: Readonly; 'slots'?: { [K in keyof Omit]?: MaybeRefOrGetter>; }; } & { [K in keyof BPopoverEmits as CamelCase>]?: (e: BPopoverEmits[K][0]) => void; } & ComponentProps; export type PopoverOrchestratorCreateParam> = MaybeRef>; export type ModalOrchestratorArrayValue = BModalProps & { 'type': 'modal'; '_self': ControllerKey; 'position': 'modal'; 'onUpdate:modelValue'?: (val: boolean) => void; 'options': OrchestratorCreateOptions; 'promise': { value: PromiseWithComponent; resolve: (value: BvTriggerableEvent) => void; stop?: WatchHandle; }; '_component'?: Readonly; 'slots'?: { [K in keyof BModalSlots]?: BModalSlots[K] | Readonly; }; } & { [K in keyof BModalEmits as CamelCase>]?: (e: BModalEmits[K][0]) => void; } & Record; export type ModalOrchestratorParam> = Omit & { 'onUpdate:modelValue'?: (val: boolean) => void; 'title'?: MaybeRefOrGetter; 'body'?: MaybeRefOrGetter; 'modelValue'?: MaybeRefOrGetter; 'options'?: OrchestratorCreateOptions; 'component'?: Readonly; /** * @deprecated */ 'props'?: Record; 'slots'?: { [K in keyof BModalSlots]?: MaybeRefOrGetter>; }; } & { [K in keyof BModalEmits as CamelCase>]?: (e: BModalEmits[K][0]) => void; } & ComponentProps; export type ModalOrchestratorCreateParam> = MaybeRef>; export type OrchestratorCreateOptions = { keep?: boolean; resolveOnHide?: boolean; }; export type OrchestratorArrayValue = ToastOrchestratorArrayValue | ModalOrchestratorArrayValue | PopoverOrchestratorArrayValue | TooltipOrchestratorArrayValue; export {};