f1558c99c6ecff5c07494104d1db91851e4efed7666e9801f68450383f7946c2.json 7.4 KB

1
  1. {"ast":null,"code":"/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nimport { writeTask } from '@stencil/core/internal/client';\nimport { h as hapticSelectionEnd, a as hapticSelectionStart, b as hapticSelectionChanged } from './haptic.js';\nimport { createGesture } from './index3.js';\nconst createButtonActiveGesture = (el, isButton) => {\n let currentTouchedButton;\n let initialTouchedButton;\n const activateButtonAtPoint = (x, y, hapticFeedbackFn) => {\n if (typeof document === 'undefined') {\n return;\n }\n const target = document.elementFromPoint(x, y);\n if (!target || !isButton(target) || target.disabled) {\n clearActiveButton();\n return;\n }\n if (target !== currentTouchedButton) {\n clearActiveButton();\n setActiveButton(target, hapticFeedbackFn);\n }\n };\n const setActiveButton = (button, hapticFeedbackFn) => {\n currentTouchedButton = button;\n if (!initialTouchedButton) {\n initialTouchedButton = currentTouchedButton;\n }\n const buttonToModify = currentTouchedButton;\n writeTask(() => buttonToModify.classList.add('ion-activated'));\n hapticFeedbackFn();\n };\n const clearActiveButton = (dispatchClick = false) => {\n if (!currentTouchedButton) {\n return;\n }\n const buttonToModify = currentTouchedButton;\n writeTask(() => buttonToModify.classList.remove('ion-activated'));\n /**\n * Clicking on one button, but releasing on another button\n * does not dispatch a click event in browsers, so we\n * need to do it manually here. Some browsers will\n * dispatch a click if clicking on one button, dragging over\n * another button, and releasing on the original button. In that\n * case, we need to make sure we do not cause a double click there.\n */\n if (dispatchClick && initialTouchedButton !== currentTouchedButton) {\n currentTouchedButton.click();\n }\n currentTouchedButton = undefined;\n };\n return createGesture({\n el,\n gestureName: 'buttonActiveDrag',\n threshold: 0,\n onStart: ev => activateButtonAtPoint(ev.currentX, ev.currentY, hapticSelectionStart),\n onMove: ev => activateButtonAtPoint(ev.currentX, ev.currentY, hapticSelectionChanged),\n onEnd: () => {\n clearActiveButton(true);\n hapticSelectionEnd();\n initialTouchedButton = undefined;\n }\n });\n};\nexport { createButtonActiveGesture as c };","map":{"version":3,"names":["writeTask","h","hapticSelectionEnd","a","hapticSelectionStart","b","hapticSelectionChanged","createGesture","createButtonActiveGesture","el","isButton","currentTouchedButton","initialTouchedButton","activateButtonAtPoint","x","y","hapticFeedbackFn","document","target","elementFromPoint","disabled","clearActiveButton","setActiveButton","button","buttonToModify","classList","add","dispatchClick","remove","click","undefined","gestureName","threshold","onStart","ev","currentX","currentY","onMove","onEnd","c"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@ionic/core/components/button-active.js"],"sourcesContent":["/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nimport { writeTask } from '@stencil/core/internal/client';\nimport { h as hapticSelectionEnd, a as hapticSelectionStart, b as hapticSelectionChanged } from './haptic.js';\nimport { createGesture } from './index3.js';\n\nconst createButtonActiveGesture = (el, isButton) => {\n let currentTouchedButton;\n let initialTouchedButton;\n const activateButtonAtPoint = (x, y, hapticFeedbackFn) => {\n if (typeof document === 'undefined') {\n return;\n }\n const target = document.elementFromPoint(x, y);\n if (!target || !isButton(target) || target.disabled) {\n clearActiveButton();\n return;\n }\n if (target !== currentTouchedButton) {\n clearActiveButton();\n setActiveButton(target, hapticFeedbackFn);\n }\n };\n const setActiveButton = (button, hapticFeedbackFn) => {\n currentTouchedButton = button;\n if (!initialTouchedButton) {\n initialTouchedButton = currentTouchedButton;\n }\n const buttonToModify = currentTouchedButton;\n writeTask(() => buttonToModify.classList.add('ion-activated'));\n hapticFeedbackFn();\n };\n const clearActiveButton = (dispatchClick = false) => {\n if (!currentTouchedButton) {\n return;\n }\n const buttonToModify = currentTouchedButton;\n writeTask(() => buttonToModify.classList.remove('ion-activated'));\n /**\n * Clicking on one button, but releasing on another button\n * does not dispatch a click event in browsers, so we\n * need to do it manually here. Some browsers will\n * dispatch a click if clicking on one button, dragging over\n * another button, and releasing on the original button. In that\n * case, we need to make sure we do not cause a double click there.\n */\n if (dispatchClick && initialTouchedButton !== currentTouchedButton) {\n currentTouchedButton.click();\n }\n currentTouchedButton = undefined;\n };\n return createGesture({\n el,\n gestureName: 'buttonActiveDrag',\n threshold: 0,\n onStart: (ev) => activateButtonAtPoint(ev.currentX, ev.currentY, hapticSelectionStart),\n onMove: (ev) => activateButtonAtPoint(ev.currentX, ev.currentY, hapticSelectionChanged),\n onEnd: () => {\n clearActiveButton(true);\n hapticSelectionEnd();\n initialTouchedButton = undefined;\n },\n });\n};\n\nexport { createButtonActiveGesture as c };\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,+BAA+B;AACzD,SAASC,CAAC,IAAIC,kBAAkB,EAAEC,CAAC,IAAIC,oBAAoB,EAAEC,CAAC,IAAIC,sBAAsB,QAAQ,aAAa;AAC7G,SAASC,aAAa,QAAQ,aAAa;AAE3C,MAAMC,yBAAyB,GAAGA,CAACC,EAAE,EAAEC,QAAQ,KAAK;EAChD,IAAIC,oBAAoB;EACxB,IAAIC,oBAAoB;EACxB,MAAMC,qBAAqB,GAAGA,CAACC,CAAC,EAAEC,CAAC,EAAEC,gBAAgB,KAAK;IACtD,IAAI,OAAOC,QAAQ,KAAK,WAAW,EAAE;MACjC;IACJ;IACA,MAAMC,MAAM,GAAGD,QAAQ,CAACE,gBAAgB,CAACL,CAAC,EAAEC,CAAC,CAAC;IAC9C,IAAI,CAACG,MAAM,IAAI,CAACR,QAAQ,CAACQ,MAAM,CAAC,IAAIA,MAAM,CAACE,QAAQ,EAAE;MACjDC,iBAAiB,CAAC,CAAC;MACnB;IACJ;IACA,IAAIH,MAAM,KAAKP,oBAAoB,EAAE;MACjCU,iBAAiB,CAAC,CAAC;MACnBC,eAAe,CAACJ,MAAM,EAAEF,gBAAgB,CAAC;IAC7C;EACJ,CAAC;EACD,MAAMM,eAAe,GAAGA,CAACC,MAAM,EAAEP,gBAAgB,KAAK;IAClDL,oBAAoB,GAAGY,MAAM;IAC7B,IAAI,CAACX,oBAAoB,EAAE;MACvBA,oBAAoB,GAAGD,oBAAoB;IAC/C;IACA,MAAMa,cAAc,GA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