api-client/packages/hoppscotch-common/src/modules/tippy.ts

40 lines
914 B
TypeScript

import { HoppModule } from "."
import VueTippy, { roundArrow, setDefaultProps } from "vue-tippy"
import "tippy.js/dist/tippy.css"
import "tippy.js/animations/scale-subtle.css"
import "tippy.js/dist/border.css"
import "tippy.js/dist/svg-arrow.css"
export type TippyState = {
isEnabled: boolean
isVisible: boolean
isDestroyed: boolean
isMounted: boolean
isShown: boolean
}
export default <HoppModule>{
onVueAppInit(app) {
app.use(VueTippy)
setDefaultProps({
animation: "scale-subtle",
appendTo: document.body,
allowHTML: false,
animateFill: false,
arrow: roundArrow + roundArrow,
popperOptions: {
// https://popper.js.org/docs/v2/utils/detect-overflow/
modifiers: [
{
name: "preventOverflow",
options: {
rootBoundary: "document",
},
},
],
},
})
},
}