This project has been created using webpack-cli, you can now run
npm i ph-position
import getPosition from 'ph-position'
const {offsetWidth,offsetHeight} = dom
const {x,y} = PhPosition({offsetWidth,offsetHeight},target.getBoundingClientRect(),{top:boolean,dir:vt|hr|''})
dom.style.cssText = `left:${x}px,top:${y}px`