1 line
4.1 KiB
JSON
1 line
4.1 KiB
JSON
{"ast":null,"code":"import { press, frame } from 'motion-dom';\nimport { extractEventInfo } from '../events/event-info.mjs';\nimport { Feature } from '../motion/features/Feature.mjs';\nfunction handlePressEvent(node, event, lifecycle) {\n const {\n props\n } = node;\n if (node.current instanceof HTMLButtonElement && node.current.disabled) {\n return;\n }\n if (node.animationState && props.whileTap) {\n node.animationState.setActive(\"whileTap\", lifecycle === \"Start\");\n }\n const eventName = \"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle);\n const callback = props[eventName];\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)));\n }\n}\nclass PressGesture extends Feature {\n mount() {\n const {\n current\n } = this.node;\n if (!current) return;\n this.unmount = press(current, (_element, startEvent) => {\n handlePressEvent(this.node, startEvent, \"Start\");\n return (endEvent, {\n success\n }) => handlePressEvent(this.node, endEvent, success ? \"End\" : \"Cancel\");\n }, {\n useGlobalTarget: this.node.props.globalTapTarget\n });\n }\n unmount() {}\n}\nexport { PressGesture };","map":{"version":3,"names":["press","frame","extractEventInfo","Feature","handlePressEvent","node","event","lifecycle","props","current","HTMLButtonElement","disabled","animationState","whileTap","setActive","eventName","callback","postRender","PressGesture","mount","unmount","_element","startEvent","endEvent","success","useGlobalTarget","globalTapTarget"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/framer-motion/dist/es/gestures/press.mjs"],"sourcesContent":["import { press, frame } from 'motion-dom';\nimport { extractEventInfo } from '../events/event-info.mjs';\nimport { Feature } from '../motion/features/Feature.mjs';\n\nfunction handlePressEvent(node, event, lifecycle) {\n const { props } = node;\n if (node.current instanceof HTMLButtonElement && node.current.disabled) {\n return;\n }\n if (node.animationState && props.whileTap) {\n node.animationState.setActive(\"whileTap\", lifecycle === \"Start\");\n }\n const eventName = (\"onTap\" + (lifecycle === \"End\" ? \"\" : lifecycle));\n const callback = props[eventName];\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)));\n }\n}\nclass PressGesture extends Feature {\n mount() {\n const { current } = this.node;\n if (!current)\n return;\n this.unmount = press(current, (_element, startEvent) => {\n handlePressEvent(this.node, startEvent, \"Start\");\n return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? \"End\" : \"Cancel\");\n }, { useGlobalTarget: this.node.props.globalTapTarget });\n }\n unmount() { }\n}\n\nexport { PressGesture };\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,YAAY;AACzC,SAASC,gBAAgB,QAAQ,0BAA0B;AAC3D,SAASC,OAAO,QAAQ,gCAAgC;AAExD,SAASC,gBAAgBA,CAACC,IAAI,EAAEC,KAAK,EAAEC,SAAS,EAAE;EAC9C,MAAM;IAAEC;EAAM,CAAC,GAAGH,IAAI;EACtB,IAAIA,IAAI,CAACI,OAAO,YAAYC,iBAAiB,IAAIL,IAAI,CAACI,OAAO,CAACE,QAAQ,EAAE;IACpE;EACJ;EACA,IAAIN,IAAI,CAACO,cAAc,IAAIJ,KAAK,CAACK,QAAQ,EAAE;IACvCR,IAAI,CAACO,cAAc,CAACE,SAAS,CAAC,UAAU,EAAEP,SAAS,KAAK,OAAO,CAAC;EACpE;EACA,MAAMQ,SAAS,GAAI,OAAO,IAAIR,SAAS,KAAK,KAAK,GAAG,EAAE,GAAGA,SAAS,CAAE;EACpE,MAAMS,QAAQ,GAAGR,KAAK,CAACO,SAAS,CAAC;EACjC,IAAIC,QAAQ,EAAE;IACVf,KAAK,CAACgB,UAAU,CAAC,MAAMD,QAAQ,CAACV,KAAK,EAAEJ,gBAAgB,CAACI,KAAK,CAAC,CAAC,CAAC;EACpE;AACJ;AACA,MAAMY,YAAY,SAASf,OAAO,CAAC;EAC/BgB,KAAKA,CAAA,EAAG;IACJ,MAAM;MAAEV;IAAQ,CAAC,GAAG,IAAI,CAACJ,IAAI;IAC7B,IAAI,CAACI,OAAO,EACR;IACJ,IAAI,CAACW,OAAO,GAAGpB,KAAK,CAACS,OAAO,EAAE,CAACY,QAAQ,EA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