Revert "chore: move to tsup"

This reverts commit 65a6aa5fda.
This commit is contained in:
Benjamin Canac
2021-11-24 16:13:44 +01:00
parent b2690d9d3f
commit 457f5c4215
35 changed files with 16 additions and 132 deletions

5
src/utils/index.ts Normal file
View File

@@ -0,0 +1,5 @@
export * from './popper'
export function classNames (...classes: any[string]) {
return classes.filter(Boolean).join(' ')
}

26
src/utils/popper.ts Normal file
View File

@@ -0,0 +1,26 @@
import { ref, onMounted, watchEffect } from 'vue'
import { createPopper } from '@popperjs/core'
export function usePopper (options: object) {
const reference = ref(null)
const popper = ref(null)
onMounted(() => {
watchEffect((onInvalidate) => {
if (!popper.value) { return }
if (!reference.value) { return }
const popperEl = popper.value.el || popper.value
const referenceEl = reference.value.el || reference.value
if (!(referenceEl instanceof HTMLElement)) { return }
if (!(popperEl instanceof HTMLElement)) { return }
const { destroy } = createPopper(referenceEl, popperEl, options)
onInvalidate(destroy)
})
})
return [reference, popper]
}