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AAC,SAAL;AACD,SAHD,EAGG,KAHH;AAID;;AAED,WAAK,QAAL,GAAgB,IAAhB;AACD,KAjBM;AAkBP,IAAA,SAlBO,uBAkBE;AACP,aAAO,KAAK,KAAL,CAAW,GAAX,CAAe,aAAtB;AACD;AApBM,GAjCwC;AAwDjD,EAAA,MAxDiD,kBAwDzC,CAxDyC,EAwDxC;AACP,QAAM,OAAO,GAAc;AACzB,MAAA,WAAW,EAAE,mBADY;AAEzB,MAAA,KAAK,EAAE,KAAK,MAFa;AAGzB,MAAA,KAAK,EAAE;AACL,QAAA,GAAG,EAAE,KAAK,GADL;AAEL,QAAA,GAAG,EAAE,KAAK;AAFL,OAHkB;AAOzB,MAAA,GAAG,EAAE;AAPoB,KAA3B;AAUA,QAAM,SAAS,GAAG,CAAC,CAAC,KAAD,EAAQ;AACzB,MAAA,WAAW,EAAE;AADY,KAAR,EAEhB,CACD,CAAC,CAAC,KAAD,EAAQ,OAAR,CADA,CAFgB,CAAnB;AAMA,QAAM,OAAO,GAAG,CAAC,CAAC,KAAD,EAAQ;AACvB,MAAA,WAAW,EAAE;AADU,KAAR,EAEd,KAAK,MAAL,CAAY,OAFE,CAAjB;AAIA,WAAO,CAAC,CAAC,KAAD,EAAQ;AACd,MAAA,WAAW,EAAE,YADC;AAEd,MAAA,KAAK,EAAE;AACL,QAAA,MAAM,YAAK,KAAK,MAAV;AADD,OAFO;AAKd,MAAA,EAAE,EAAE,KAAK;AALK,KAAR,EAML,CAAC,SAAD,EAAY,OAAZ,CANK,CAAR;AAOD;AApFgD,CAApC,C","sourcesContent":["// Style\nimport './VParallax.sass'\n\n// Mixins\nimport Translatable from '../../mixins/translatable'\n\n// Types\nimport { VNode, VNodeData } from 'vue/types/vnode'\nimport mixins from '../../util/mixins'\n\nconst baseMixins = mixins(\n Translatable\n)\ninterface options extends InstanceType<typeof baseMixins> {\n $refs: {\n img: HTMLImageElement\n }\n}\n\n/* @vue/component */\nexport default baseMixins.extend<options>().extend({\n name: 'v-parallax',\n\n props: {\n alt: {\n type: String,\n default: '',\n },\n height: {\n type: [String, Number],\n default: 500,\n },\n src: String,\n },\n\n data: () => ({\n isBooted: false,\n }),\n\n computed: {\n styles (): object {\n return {\n display: 'block',\n opacity: this.isBooted ? 1 : 0,\n transform: `translate(-50%, ${this.parallax}px)`,\n }\n },\n },\n\n mounted () {\n this.init()\n },\n\n methods: {\n init () {\n const img = this.$refs.img\n\n if (!img) return\n\n if (img.complete) {\n this.translate()\n this.listeners()\n } else {\n img.addEventListener('load', () => {\n this.translate()\n this.listeners()\n }, false)\n }\n\n this.isBooted = true\n },\n objHeight () {\n return this.$refs.img.naturalHeight\n },\n },\n\n render (h): VNode {\n const imgData: VNodeData = {\n staticClass: 'v-parallax__image',\n style: this.styles,\n attrs: {\n src: this.src,\n alt: this.alt,\n },\n ref: 'img',\n }\n\n const container = h('div', {\n staticClass: 'v-parallax__image-container',\n }, [\n h('img', imgData),\n ])\n\n const content = h('div', {\n staticClass: 'v-parallax__content',\n }, this.$slots.default)\n\n return h('div', {\n staticClass: 'v-parallax',\n style: {\n height: `${this.height}px`,\n },\n on: this.$listeners,\n }, [container, content])\n },\n})\n"],"sourceRoot":"","file":"VParallax.js"} |