{"version":3,"file":"index.mjs","sources":["../../../../../packages/directives/mousewheel/index.ts"],"sourcesContent":["import normalizeWheel from 'normalize-wheel-es'\r\nimport { isFirefox } from '@sgui-plus/utils/util'\r\nimport type { ObjectDirective, DirectiveBinding } from 'vue'\r\n\r\nconst mousewheel = function (element, callback) {\r\n  if (element && element.addEventListener) {\r\n    const fn = function (this: any, event) {\r\n      const normalized = normalizeWheel(event)\r\n      callback && callback.apply(this, [event, normalized])\r\n    }\r\n    if (isFirefox()) {\r\n      element.addEventListener('DOMMouseScroll', fn)\r\n    } else {\r\n      element.onmousewheel = fn\r\n    }\r\n  }\r\n}\r\n\r\nconst Mousewheel: ObjectDirective = {\r\n  beforeMount(el: HTMLElement, binding: DirectiveBinding) {\r\n    mousewheel(el, binding.value)\r\n  },\r\n}\r\n\r\nexport default Mousewheel\r\n"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,SAAS,OAAO,EAAE,QAAQ,EAAE;AAC/C,EAAE,IAAI,OAAO,IAAI,OAAO,CAAC,gBAAgB,EAAE;AAC3C,IAAI,MAAM,EAAE,GAAG,SAAS,KAAK,EAAE;AAC/B,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/C,MAAM,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AAC5D,KAAK,CAAC;AACN,IAAI,IAAI,SAAS,EAAE,EAAE;AACrB,MAAM,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AACrD,KAAK,MAAM;AACX,MAAM,OAAO,CAAC,YAAY,GAAG,EAAE,CAAC;AAChC,KAAK;AACL,GAAG;AACH,CAAC,CAAC;AACG,MAAC,UAAU,GAAG;AACnB,EAAE,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE;AAC3B,IAAI,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAClC,GAAG;AACH;;;;"}