|
1 |
- {"version":3,"sources":["../../../../src/components/Vuetify/goTo/util.ts"],"names":[],"mappings":";AAGA,OAAM,SAAU,SAAV,CAAqB,MAArB,EAAgC;AACpC,QAAI,OAAO,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAO,MAAP;AACD;AAED,QAAI,KAAK,EAAE,MAAF,CAAT;AACA,QAAI,CAAC,EAAL,EAAS;AACP,cAAM,OAAO,MAAP,KAAkB,QAAlB,GACF,IAAI,KAAJ,sBAA6B,MAA7B,kBADE,GAEF,IAAI,SAAJ,0EAAqF,KAAK,MAAL,CAArF,eAFJ;AAGD;AAED,QAAI,cAAc,CAAlB;AACA,WAAO,EAAP,EAAW;AACT,uBAAe,GAAG,SAAlB;AACA,aAAK,GAAG,YAAR;AACD;AAED,WAAO,WAAP;AACD;AAED,OAAM,SAAU,YAAV,CAAwB,SAAxB,EAAsC;AAC1C,QAAM,KAAK,EAAE,SAAF,CAAX;AAEA,QAAI,EAAJ,EAAQ,OAAO,EAAP;AAER,UAAM,OAAO,SAAP,KAAqB,QAArB,GACF,IAAI,KAAJ,yBAAgC,SAAhC,kBADE,GAEF,IAAI,SAAJ,sEAAiF,KAAK,SAAL,CAAjF,eAFJ;AAGD;AAED,SAAS,IAAT,CAAe,EAAf,EAAsB;AACpB,WAAO,MAAM,IAAN,GAAa,EAAb,GAAkB,GAAG,WAAH,CAAe,IAAxC;AACD;AAED,SAAS,CAAT,CAAY,EAAZ,EAAmB;AACjB,QAAI,OAAO,EAAP,KAAc,QAAlB,EAA4B;AAC1B,eAAO,SAAS,aAAT,CAAoC,EAApC,CAAP;AACD,KAFD,MAEO,IAAI,MAAM,GAAG,MAAb,EAAqB;AAC1B,eAAQ,GAAW,GAAnB;AACD,KAFM,MAEA,IAAI,cAAc,WAAlB,EAA+B;AACpC,eAAO,EAAP;AACD,KAFM,MAEA;AACL,eAAO,IAAP;AACD;AACF","sourcesContent":["import Vue from 'vue'\n\n// Return target's cumulative offset from the top\nexport function getOffset (target: any): number {\n if (typeof target === 'number') {\n return target\n }\n\n let el = $(target)\n if (!el) {\n throw typeof target === 'string'\n ? new Error(`Target element \"${target}\" not found.`)\n : new TypeError(`Target must be a Number/Selector/HTMLElement/VueComponent, received ${type(target)} instead.`)\n }\n\n let totalOffset = 0\n while (el) {\n totalOffset += el.offsetTop\n el = el.offsetParent as HTMLElement\n }\n\n return totalOffset\n}\n\nexport function getContainer (container: any): HTMLElement {\n const el = $(container)\n\n if (el) return el\n\n throw typeof container === 'string'\n ? new Error(`Container element \"${container}\" not found.`)\n : new TypeError(`Container must be a Selector/HTMLElement/VueComponent, received ${type(container)} instead.`)\n}\n\nfunction type (el: any) {\n return el == null ? el : el.constructor.name\n}\n\nfunction $ (el: any): HTMLElement | null {\n if (typeof el === 'string') {\n return document.querySelector<HTMLElement>(el)\n } else if (el && el._isVue) {\n return (el as Vue).$el as HTMLElement\n } else if (el instanceof HTMLElement) {\n return el\n } else {\n return null\n }\n}\n"],"sourceRoot":""}
|