You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.0 KiB
1 lines
2.0 KiB
{"ast":null,"code":"const composeEventHandlers = (theirsHandler, oursHandler, {\n checkForDefaultPrevented = true\n} = {}) => {\n const handleEvent = event => {\n const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);\n if (checkForDefaultPrevented === false || !shouldPrevent) {\n return oursHandler == null ? void 0 : oursHandler(event);\n }\n };\n return handleEvent;\n};\nconst whenMouse = handler => {\n return e => e.pointerType === \"mouse\" ? handler(e) : void 0;\n};\nexport { composeEventHandlers, whenMouse };","map":{"version":3,"names":["composeEventHandlers","theirsHandler","oursHandler","checkForDefaultPrevented","handleEvent","event","shouldPrevent","whenMouse","handler","e","pointerType"],"sources":["../../../../../packages/utils/dom/event.ts"],"sourcesContent":["export const composeEventHandlers = <E>(\n theirsHandler?: (event: E) => boolean | void,\n oursHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {}\n) => {\n const handleEvent = (event: E) => {\n const shouldPrevent = theirsHandler?.(event)\n\n if (checkForDefaultPrevented === false || !shouldPrevent) {\n return oursHandler?.(event)\n }\n }\n return handleEvent\n}\n\ntype WhenMouseHandler = (e: PointerEvent) => any\nexport const whenMouse = (handler: WhenMouseHandler): WhenMouseHandler => {\n return (e: PointerEvent) =>\n e.pointerType === 'mouse' ? handler(e) : undefined\n}\n"],"mappings":"AAAY,MAACA,oBAAoB,GAAGA,CAACC,aAAa,EAAEC,WAAW,EAAE;EAAEC,wBAAwB,GAAG;AAAI,CAAE,GAAG,EAAE,KAAK;EAC5G,MAAMC,WAAW,GAAIC,KAAK,IAAK;IAC7B,MAAMC,aAAa,GAAGL,aAAa,IAAI,IAAI,GAAG,KAAK,CAAC,GAAGA,aAAa,CAACI,KAAK,CAAC;IAC3E,IAAIF,wBAAwB,KAAK,KAAK,IAAI,CAACG,aAAa,EAAE;MACxD,OAAOJ,WAAW,IAAI,IAAI,GAAG,KAAK,CAAC,GAAGA,WAAW,CAACG,KAAK,CAAC;IAC9D;EACA,CAAG;EACD,OAAOD,WAAW;AACpB;AACY,MAACG,SAAS,GAAIC,OAAO,IAAK;EACpC,OAAQC,CAAC,IAAKA,CAAC,CAACC,WAAW,KAAK,OAAO,GAAGF,OAAO,CAACC,CAAC,CAAC,GAAG,KAAK,CAAC;AAC/D","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|