bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
1 lines • 1.51 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../src/directives/BScrollspy/index.ts"],"sourcesContent":["import {type Directive, type DirectiveBinding} from 'vue'\nimport {useScrollspy} from '../../composables/useScrollspy'\nimport {omit} from '../../utils/object'\n\nexport interface ElementWithScrollspy extends HTMLElement {\n $__scrollspy?: ReturnType<typeof useScrollspy>\n}\n\nconst bind = (el: ElementWithScrollspy, binding: Readonly<DirectiveBinding>) => {\n if (el.$__scrollspy) el.$__scrollspy.cleanup()\n const {arg, value} = binding\n const isObject = typeof value === 'object' && value !== null\n const content = arg\n ? arg\n : typeof value === 'string'\n ? value\n : isObject\n ? value.content || value.element\n : null\n el.$__scrollspy = useScrollspy(content, el, isObject ? omit(value, ['content', 'element']) : {})\n}\n\nexport const vBScrollspy: Directive<ElementWithScrollspy> = {\n mounted: bind,\n updated: bind,\n beforeUnmount(el) {\n if (el.$__scrollspy) el.$__scrollspy.cleanup()\n },\n}\n"],"names":[],"mappings":";;;AAQA,MAAM,OAAO,CAAC,IAA0B,YAAwC;AAC9E,MAAI,GAAG,aAAiB,IAAA,aAAa,QAAQ;AACvC,QAAA,EAAC,KAAK,MAAA,IAAS;AACrB,QAAM,WAAW,OAAO,UAAU,YAAY,UAAU;AAClD,QAAA,UAAU,MACZ,MACA,OAAO,UAAU,WACf,QACA,WACE,MAAM,WAAW,MAAM,UACvB;AACR,KAAG,eAAe,aAAa,SAAS,IAAI,WAAW,KAAK,OAAO,CAAC,WAAW,SAAS,CAAC,IAAI,CAAA,CAAE;AACjG;AAEO,MAAM,cAA+C;AAAA,EAC1D,SAAS;AAAA,EACT,SAAS;AAAA,EACT,cAAc,IAAI;AAChB,QAAI,GAAG,aAAiB,IAAA,aAAa,QAAQ;AAAA,EAAA;AAEjD;"}