bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
1 lines • 10.6 kB
Source Map (JSON)
{"version":3,"file":"keys-CQKrwmvN.mjs","names":[],"sources":["../src/utils/keys.ts"],"sourcesContent":["import type {ComponentInternalInstance, ComputedRef, InjectionKey, Ref, ShallowRef} from 'vue'\nimport type {TabType} from '../types/Tab'\nimport type {ClassValue} from '../types/AnyValuedAttributes'\nimport type {Numberish, ValidationState} from '../types/CommonTypes'\nimport type {LiteralUnion} from '../types/LiteralUnion'\nimport type {Size} from '../types/Size'\nimport type {RadiusElement} from '../types/RadiusElement'\nimport type {\n BgColorVariant,\n ButtonVariant,\n ColorVariant,\n TextColorVariant,\n} from '../types/ColorTypes'\nimport type {CheckboxValue} from '../types/CheckboxTypes'\nimport type {RadioValue} from '../types/RadioTypes'\nimport type {BreadcrumbItemRaw} from '../types/BreadcrumbTypes'\nimport type {OrchestratorArrayValue} from '../types/ComponentOrchestratorTypes'\nimport type {BvnComponentProps} from '../types/BootstrapVueOptions'\n\nexport const genericBvnPrefix = 'BootstrapVueNext__'\n\nexport const withBvnPrefix = (value: string, suffix: string = '') => {\n const suffixWithTrail = `${suffix}___`\n return `${genericBvnPrefix}ID__${value}__${suffix ? suffixWithTrail : ''}`\n}\n\nconst createBvnInjectionKey = (name: string) => withBvnPrefix(name) as unknown as symbol // Type cast to symbol, these should be static\nconst createBvnRegistryInjectionKey = (name: string) =>\n withBvnPrefix(`${name}__registry`) as unknown as symbol\n\n// BCarousel\nexport const carouselInjectionKey: InjectionKey<{\n background: Readonly<Ref<string | undefined>>\n width: Readonly<Ref<string | undefined>>\n height: Readonly<Ref<string | undefined>>\n}> = createBvnInjectionKey('carousel')\n\n// BTabs\nexport const tabsInjectionKey: InjectionKey<{\n lazy: Readonly<Ref<boolean>>\n card: Readonly<Ref<boolean>>\n noFade: Readonly<Ref<boolean>>\n registerTab: (tab: ComputedRef<TabType>) => string\n unregisterTab: (id: string) => void\n activateTab: (id: string | undefined) => void\n activeTabClass: Readonly<Ref<ClassValue>>\n inactiveTabClass: Readonly<Ref<ClassValue>>\n tabClass: Readonly<Ref<ClassValue>>\n activeId: Readonly<Ref<string | undefined>>\n}> = createBvnInjectionKey('tabs')\n\n// BProgress\nexport const progressInjectionKey: InjectionKey<{\n animated: Readonly<Ref<boolean | undefined>>\n max: Readonly<Ref<Numberish>>\n showProgress: Readonly<Ref<boolean | undefined>>\n showValue: Readonly<Ref<boolean | undefined>>\n striped: Readonly<Ref<boolean | undefined>>\n}> = createBvnInjectionKey('progress')\n\n// BListGroup\nexport const listGroupInjectionKey: InjectionKey<{\n numbered: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('listGroup')\n\n// BAvatarGroup\nexport const avatarGroupInjectionKey: InjectionKey<{\n overlapScale: Readonly<Ref<number>>\n size: Readonly<Ref<LiteralUnion<Size, Numberish> | undefined>>\n square: Readonly<Ref<boolean>>\n rounded: Readonly<Ref<RadiusElement | boolean>>\n roundedTop: Readonly<Ref<RadiusElement | boolean | undefined>>\n roundedBottom: Readonly<Ref<RadiusElement | boolean | undefined>>\n roundedStart: Readonly<Ref<RadiusElement | boolean | undefined>>\n roundedEnd: Readonly<Ref<RadiusElement | boolean | undefined>>\n variant: Readonly<Ref<ColorVariant | null>>\n bgVariant: Readonly<Ref<BgColorVariant | null>>\n textVariant: Readonly<Ref<TextColorVariant | null>>\n}> = createBvnInjectionKey('avatarGroup')\n\n// BAccordion\nexport const accordionInjectionKey: InjectionKey<{\n openItem: Readonly<Ref<string | readonly string[] | undefined>>\n free: Readonly<Ref<boolean>>\n initialAnimation: Readonly<Ref<boolean>>\n lazy: Readonly<Ref<boolean>>\n unmountLazy: Readonly<Ref<boolean>>\n setOpenItem: (id: string) => void\n setCloseItem: (id: string) => void\n registerAccordionItem: (id: string, el: Readonly<ShallowRef<HTMLElement | null>>) => void\n unregisterAccordionItem: (id: string) => void\n}> = createBvnInjectionKey('accordion')\n\n// BFormCheckboxGroup\nexport const checkboxGroupKey: InjectionKey<{\n modelValue: Ref<readonly CheckboxValue[]>\n switch: Readonly<Ref<boolean>>\n buttonVariant: Readonly<Ref<ButtonVariant | null>>\n form: Readonly<Ref<string | undefined>>\n name: Readonly<Ref<string>>\n state: Readonly<Ref<ValidationState | undefined>>\n plain: Readonly<Ref<boolean>>\n size: Readonly<Ref<Size>>\n inline: Readonly<Ref<boolean>>\n reverse: Readonly<Ref<boolean>>\n required: Readonly<Ref<boolean>>\n buttons: Readonly<Ref<boolean>>\n disabled: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('checkboxGroup')\n\nexport const radioGroupKey: InjectionKey<{\n modelValue: Ref<RadioValue>\n buttonVariant: Readonly<Ref<ButtonVariant | null>>\n form: Readonly<Ref<string | undefined>>\n name: Readonly<Ref<string>>\n buttons: Readonly<Ref<boolean>>\n state: Readonly<Ref<ValidationState | undefined>>\n plain: Readonly<Ref<boolean>>\n size: Readonly<Ref<Size>>\n inline: Readonly<Ref<boolean>>\n reverse: Readonly<Ref<boolean>>\n required: Readonly<Ref<boolean>>\n disabled: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('radioGroup')\n\n// Collapse\nexport const collapseInjectionKey: InjectionKey<{\n id?: Readonly<Ref<string>>\n readonly hide?: () => void\n readonly show?: () => void\n readonly toggle?: () => void\n visible?: Readonly<Ref<boolean>>\n isNav?: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('collapse')\n\n// Show/Hide components\nexport type RegisterShowHideFnInput = {\n id: string\n component: ComponentInternalInstance\n value: Ref<boolean>\n toggle: (resolveOnHide?: boolean) => Promise<boolean | string>\n show: (resolveOnHide?: boolean) => Promise<boolean | string>\n hide: (trigger?: string) => Promise<boolean | string>\n registerTrigger: (trigger: string, el: Element) => void\n unregisterTrigger: (trigger: string, el: Element, clean: boolean) => void\n}\n\nexport interface RegisterShowHideMapValue {\n id: string\n component: ComponentInternalInstance\n value: Readonly<Ref<boolean>>\n toggle: (resolveOnHide?: boolean) => Promise<boolean | string | null>\n show: (resolveOnHide?: boolean) => Promise<boolean | string | null>\n hide: (trigger?: string, noTraverse?: boolean) => Promise<boolean | string | null>\n registerTrigger: (trigger: string, el: Element) => void\n unregisterTrigger: (trigger: string, el: Element, clean: boolean) => void\n}\n\n/**\n * Represents an array of component instances with the same ID\n * Used to handle race conditions where multiple instances mount/unmount out of order\n */\nexport interface RegisterShowHideInstances {\n instances: RegisterShowHideMapValue[]\n getActive: () => RegisterShowHideMapValue | undefined\n}\n\nexport interface RegisterShowHideValue {\n register: (input: RegisterShowHideFnInput) => {\n unregister: () => void\n updateId: (newId: string, oldId: string) => void\n }\n values: Ref<Map<string, RegisterShowHideInstances>>\n}\nexport const showHideRegistryKey: InjectionKey<RegisterShowHideValue> =\n createBvnRegistryInjectionKey('showHide')\n\nexport const dropdownInjectionKey: InjectionKey<{\n id?: Readonly<Ref<string>>\n readonly hide?: () => void\n readonly show?: () => void\n readonly toggle?: () => void\n visible?: Readonly<Ref<boolean>>\n isNav?: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('dropdown')\n\nexport const navbarInjectionKey: InjectionKey<{\n tag?: Readonly<Ref<string>>\n noAutoClose?: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('navbar')\n\nexport const rtlRegistryKey: InjectionKey<{\n isRtl: Ref<boolean>\n locale: Ref<string | undefined>\n}> = createBvnRegistryInjectionKey('rtl')\n\nexport const breadcrumbGlobalIndexKey = `${genericBvnPrefix}global_breadcrumb`\nexport const breadcrumbRegistryKey: InjectionKey<{\n items: Ref<Record<string, BreadcrumbItemRaw[]>>\n reset: (key?: string) => void\n}> = createBvnRegistryInjectionKey('breadcrumb')\n\nexport const modalManagerKey: InjectionKey<{\n stack: ComputedRef<readonly ComponentInternalInstance[]>\n countStack: ComputedRef<number>\n lastStack: ComputedRef<ComponentInternalInstance | undefined>\n pushStack: (modal: Readonly<ComponentInternalInstance>) => void\n removeStack: (modal: Readonly<ComponentInternalInstance>) => void\n registry: Readonly<Ref<Map<number, ComponentInternalInstance>>>\n pushRegistry: (modal: Readonly<ComponentInternalInstance>) => void\n removeRegistry: (modal: Readonly<ComponentInternalInstance>) => void\n}> = createBvnRegistryInjectionKey('modalManager')\n\nexport const defaultsKey: InjectionKey<Ref<Partial<BvnComponentProps>>> =\n createBvnRegistryInjectionKey('defaults')\n\nexport const inputGroupKey: InjectionKey<boolean> = createBvnInjectionKey('inputGroup')\nexport const buttonGroupKey: InjectionKey<boolean> = createBvnInjectionKey('buttonGroup')\n\nexport const orchestratorRegistryKey: InjectionKey<{\n store: Ref<OrchestratorArrayValue[]>\n _isToastAppend: Ref<boolean>\n _isOrchestratorInstalled: Ref<boolean>\n}> = createBvnRegistryInjectionKey('orchestrator')\n\nexport const formGroupKey: InjectionKey<\n (id: Ref<string>) => {\n state: Readonly<Ref<ValidationState | undefined>>\n disabled: Readonly<Ref<boolean>>\n }\n> = createBvnInjectionKey('formGroupPlugin')\n\nexport const formSelectKey: InjectionKey<{\n modelValue: Readonly<Ref<unknown>>\n}> = createBvnInjectionKey('formSelect')\n// BTable keyboard navigation\nexport const tableKeyboardNavigationKey: InjectionKey<{\n rowNavigation: Readonly<Ref<boolean>>\n headerNavigation: Readonly<Ref<boolean>>\n}> = createBvnInjectionKey('tableKeyboardNavigation')\n"],"mappings":";AAmBA,IAAa,mBAAmB;AAEhC,IAAa,iBAAiB,OAAe,SAAiB,OAAO;CACnE,MAAM,kBAAkB,GAAG,OAAO;AAClC,QAAO,GAAG,iBAAiB,MAAM,MAAM,IAAI,SAAS,kBAAkB;;AAGxE,IAAM,yBAAyB,SAAiB,cAAc,KAAK;AACnE,IAAM,iCAAiC,SACrC,cAAc,GAAG,KAAK,YAAY;AAGpC,IAAa,uBAIR,sBAAsB,WAAW;AAGtC,IAAa,mBAWR,sBAAsB,OAAO;AAGlC,IAAa,uBAMR,sBAAsB,WAAW;AAGtC,IAAa,wBAER,sBAAsB,YAAY;AAGvC,IAAa,0BAYR,sBAAsB,cAAc;AAGzC,IAAa,wBAUR,sBAAsB,YAAY;AAGvC,IAAa,mBAcR,sBAAsB,gBAAgB;AAE3C,IAAa,gBAaR,sBAAsB,aAAa;AAGxC,IAAa,uBAOR,sBAAsB,WAAW;AAyCtC,IAAa,sBACX,8BAA8B,WAAW;AAE3C,IAAa,uBAOR,sBAAsB,WAAW;AAEtC,IAAa,qBAGR,sBAAsB,SAAS;AAEpC,IAAa,iBAGR,8BAA8B,MAAM;AAEzC,IAAa,2BAA2B,GAAG,iBAAiB;AAC5D,IAAa,wBAGR,8BAA8B,aAAa;AAEhD,IAAa,kBASR,8BAA8B,eAAe;AAElD,IAAa,cACX,8BAA8B,WAAW;AAE3C,IAAa,gBAAuC,sBAAsB,aAAa;AACvF,IAAa,iBAAwC,sBAAsB,cAAc;AAEzF,IAAa,0BAIR,8BAA8B,eAAe;AAElD,IAAa,eAKT,sBAAsB,kBAAkB;AAE5C,IAAa,gBAER,sBAAsB,aAAa;AAExC,IAAa,6BAGR,sBAAsB,0BAA0B"}