{"version":3,"file":"onInteractionOutside-BWF3fgbX.js","sources":["../../src/lightspeed/composables/onEventOutside.ts","../../src/lightspeed/composables/onFocusOutside.ts","../../src/lightspeed/composables/onPointerDownOutside.ts","../../src/lightspeed/composables/onInteractionOutside.ts"],"sourcesContent":["import type { MaybeElementRef } from \"@vueuse/core\";\nimport { isString } from \"@/common/general\";\nimport { unrefElement, useEventListener } from \"@vueuse/core\";\n\ninterface UseEventOutsideOptions {\n ignore?: (MaybeElementRef | string)[];\n}\n\nfunction createFilteringListener(\n target: MaybeElementRef,\n handler: (event: PointerEvent) => void,\n ignore: Exclude,\n) {\n const shouldIgnore = (event: PointerEvent) => ignore.some(ignoreTarget => {\n if (isString(ignoreTarget)) {\n return Array.from(window.document.querySelectorAll(ignoreTarget))\n .some(el => el === event.target || event.composedPath().includes(el));\n }\n const el = unrefElement(ignoreTarget);\n return el && (event.target === el || event.composedPath().includes(el));\n });\n\n const listener = (event: PointerEvent) => {\n if (shouldIgnore(event)) return;\n\n const el = unrefElement(target);\n if (!el || el === event.target || event.composedPath().includes(el)) return;\n\n handler(event);\n };\n\n return listener;\n}\n\nexport function useEventOutside(\n target: MaybeElementRef,\n event: string,\n handler: (event: PointerEvent) => void,\n options: UseEventOutsideOptions = {},\n) {\n const { ignore = [] } = options;\n if (!window) return;\n\n const listener = createFilteringListener(target, handler, ignore);\n useEventListener(window, event, listener);\n}\n","import type { MaybeElementRef } from \"@vueuse/core\";\nimport { useEventOutside } from \"./onEventOutside\";\n\ninterface OnFocusOutside {\n ignore?: (MaybeElementRef | string)[];\n}\n\nexport function onFocusOutside(\n target: MaybeElementRef,\n handler: (event: PointerEvent) => void,\n options: OnFocusOutside = {},\n) {\n useEventOutside(target, \"focusin\", handler, options);\n}\n","import type { MaybeElementRef } from \"@vueuse/core\";\nimport { useEventOutside } from \"./onEventOutside\";\n\ninterface OnPointerDownOutside {\n ignore?: (MaybeElementRef | string)[];\n}\n\nexport function onPointerDownOutside(\n target: MaybeElementRef,\n handler: (event: PointerEvent) => void,\n options: OnPointerDownOutside = {},\n) {\n useEventOutside(target, \"pointerdown\", handler, options);\n}\n","import type { MaybeElementRef } from \"@vueuse/core\";\nimport { onFocusOutside } from \"./onFocusOutside\";\nimport { onPointerDownOutside } from \"./onPointerDownOutside\";\n\ninterface OnInteractionOutside {\n ignore?: (MaybeElementRef | string)[];\n}\n\nexport function onInteractionOutside(\n target: MaybeElementRef,\n handler: (event: PointerEvent) => void,\n options: OnInteractionOutside = {},\n) {\n onFocusOutside(target, handler, options);\n onPointerDownOutside(target, handler, options);\n}\n"],"names":["createFilteringListener","target","handler","ignore","shouldIgnore","event","ignoreTarget","isString","el","unrefElement","useEventOutside","options","listener","useEventListener","onFocusOutside","onPointerDownOutside","onInteractionOutside"],"mappings":"yDAQA,SAASA,EACPC,EACAC,EACAC,EACA,CACA,MAAMC,EAAgBC,GAAwBF,EAAO,KAAqBG,GAAA,CACpE,GAAAC,EAASD,CAAY,EACvB,OAAO,MAAM,KAAK,OAAO,SAAS,iBAAiBA,CAAY,CAAC,EAC7D,KAAKE,GAAMA,IAAOH,EAAM,QAAUA,EAAM,eAAe,SAASG,CAAE,CAAC,EAElE,MAAAA,EAAKC,EAAaH,CAAY,EAC7B,OAAAE,IAAOH,EAAM,SAAWG,GAAMH,EAAM,aAAa,EAAE,SAASG,CAAE,EAAA,CACtE,EAWM,OATWH,GAAwB,CACpC,GAAAD,EAAaC,CAAK,EAAG,OAEnB,MAAAG,EAAKC,EAAaR,CAAM,EAC1B,CAACO,GAAMA,IAAOH,EAAM,QAAUA,EAAM,aAAa,EAAE,SAASG,CAAE,GAElEN,EAAQG,CAAK,CACf,CAGF,CAEO,SAASK,EACdT,EACAI,EACAH,EACAS,EAAkC,CAAA,EAClC,CACA,KAAM,CAAE,OAAAR,EAAS,CAAC,CAAA,EAAMQ,EACxB,GAAI,CAAC,OAAQ,OAEb,MAAMC,EAAWZ,EAAwBC,EAAQC,EAASC,CAAM,EAC/CU,EAAA,OAAQR,EAAOO,CAAQ,CAC1C,CCtCO,SAASE,EACdb,EACAC,EACAS,EAA0B,CAAA,EAC1B,CACgBD,EAAAT,EAAQ,UAAWC,EAASS,CAAO,CACrD,CCNO,SAASI,EACdd,EACAC,EACAS,EAAgC,CAAA,EAChC,CACgBD,EAAAT,EAAQ,cAAeC,EAASS,CAAO,CACzD,CCLO,SAASK,EACdf,EACAC,EACAS,EAAgC,CAAA,EAChC,CACeG,EAAAb,EAAQC,EAASS,CAAO,EAClBI,EAAAd,EAAQC,EAASS,CAAO,CAC/C"}