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,OAAwB,IAAI;AAChC,wBAAM,aAAyB,CAA/B;AACA,wBAAI,aAAa,MAAb,KAAwB,SAAxB,IAAsC,WAAW,OAAX,GAAqB,CAArB,IAA0B,WAAW,MAAX,KAAsB,aAAa,MAAvG,EAAgH;AAC9G,4BAAI,aAAa,OAAjB,EAA0B;AACxB,8BAAE,cAAF;AACD;AACD,4BAAI,aAAa,IAAjB,EAAuB;AACrB,8BAAE,eAAF;AACD;AACD,8BAAK,KAAL,CAAW,KAAX,EAAkB,SAAS,CAAT,CAAlB;AACD;AAED,2BAAO,aAAa,MAApB;AACD,iBAbD;AAeA,oBAAI,OAAO,EAAX,EAAe;AACb,wBAAI,MAAM,OAAN,CAAc,GAAG,GAAH,CAAd,CAAJ,EAA4B;AACzB,2BAAG,GAAH,EAA2B,IAA3B,CAAgC,OAAhC;AACF,qBAFD,MAEO;AACL,2BAAG,GAAH,IAAU,CAAC,GAAG,GAAH,CAAD,EAAU,OAAV,CAAV;AACD;AACF,iBAND,MAMO;AACL,uBAAG,GAAH,IAAU,OAAV;AACD;AApC6D;;AAGhE,iBAAK,IAAM,KAAX,IAAoB,MAApB,EAA4B;AAAA,iCAAjB,KAAiB;;AAAA,yCAGG;AA+B9B;AAED,mBAAO,EAAP;AACD;AAvDM;AAHe,CAAX,C","sourcesContent":["import Vue from 'vue'\n\nexport type MouseHandler = (e: MouseEvent | TouchEvent) => any\n\nexport type MouseEvents = {\n [event: string]: {\n event: string\n passive?: boolean\n capture?: boolean\n once?: boolean\n stop?: boolean\n prevent?: boolean\n button?: number\n result?: any\n }\n}\n\nexport type MouseEventsMap = {\n [event: string]: MouseHandler | MouseHandler[]\n}\n\nexport default Vue.extend({\n name: 'mouse',\n\n methods: {\n getDefaultMouseEventHandlers (suffix: string, getEvent: MouseHandler): MouseEventsMap {\n return this.getMouseEventHandlers({\n ['click' + suffix]: { event: 'click' },\n ['contextmenu' + suffix]: { event: 'contextmenu', prevent: true, result: false },\n ['mousedown' + suffix]: { event: 'mousedown' },\n ['mousemove' + suffix]: { event: 'mousemove' },\n ['mouseup' + suffix]: { event: 'mouseup' },\n ['mouseenter' + suffix]: { event: 'mouseenter' },\n ['mouseleave' + suffix]: { event: 'mouseleave' },\n ['touchstart' + suffix]: { event: 'touchstart' },\n ['touchmove' + suffix]: { event: 'touchmove' },\n ['touchend' + suffix]: { event: 'touchend' }\n }, getEvent)\n },\n getMouseEventHandlers (events: MouseEvents, getEvent: MouseHandler): MouseEventsMap {\n const on: MouseEventsMap = {}\n\n for (const event in events) {\n const eventOptions = events[event]\n\n if (!this.$listeners[event]) continue\n\n // TODO somehow pull in modifiers\n\n const prefix = eventOptions.passive ? '&' : ((eventOptions.once ? '~' : '') + (eventOptions.capture ? '!' : ''))\n const key = prefix + eventOptions.event\n\n const handler: MouseHandler = e => {\n const mouseEvent: MouseEvent = e as MouseEvent\n if (eventOptions.button === undefined || (mouseEvent.buttons > 0 && mouseEvent.button === eventOptions.button)) {\n if (eventOptions.prevent) {\n e.preventDefault()\n }\n if (eventOptions.stop) {\n e.stopPropagation()\n }\n this.$emit(event, getEvent(e))\n }\n\n return eventOptions.result\n }\n\n if (key in on) {\n if (Array.isArray(on[key])) {\n (on[key] as MouseHandler[]).push(handler)\n } else {\n on[key] = [on[key], handler] as MouseHandler[]\n }\n } else {\n on[key] = handler\n }\n }\n\n return on\n }\n }\n})\n"],"sourceRoot":""}
|