1 line
11 KiB
Plaintext
1 line
11 KiB
Plaintext
{"version":3,"sources":["webpack:///node_modules/@ionic/core/dist/esm/tap-click-71d2324a.js"],"names":["startTapClick","config","lastTouch","MOUSE_WAIT","lastActivated","scrollingEl","activatableEle","activeRipple","activeDefer","useRippleEffect","getBoolean","clearDefers","WeakMap","isScrolling","undefined","parentElement","onTouchStart","ev","pointerDown","onTouchEnd","pointerUp","onMouseDown","t","onMouseUp","cancelActive","clearTimeout","removeActivated","setActivatedElement","getActivatableTarget","el","x","y","has","Error","classList","contains","ACTIVATED","addActivated","deferId","get","delay","isInstant","ADD_ACTIVATED_DEFERS","remove","setTimeout","Date","now","add","rippleEffect","getRippleEffect","addRipple","removeRipple","then","smooth","active","time","CLEAR_STATE_DEFERS","set","doc","document","addEventListener","target","composedPath","path","i","length","closest","shadowRoot","ripple","querySelector"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;;AAEA,UAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,MAAD,EAAY;AAChC,YAAIC,SAAS,GAAG,CAACC,UAAD,GAAc,EAA9B;AACA,YAAIC,aAAa,GAAG,CAApB;AACA,YAAIC,WAAJ;AACA,YAAIC,cAAJ;AACA,YAAIC,YAAJ;AACA,YAAIC,WAAJ;AACA,YAAMC,eAAe,GAAGR,MAAM,CAACS,UAAP,CAAkB,UAAlB,EAA8B,IAA9B,KAAuCT,MAAM,CAACS,UAAP,CAAkB,cAAlB,EAAkC,IAAlC,CAA/D;AACA,YAAMC,WAAW,GAAG,IAAIC,OAAJ,EAApB;;AACA,YAAMC,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxB,iBAAOR,WAAW,KAAKS,SAAhB,IAA6BT,WAAW,CAACU,aAAZ,KAA8B,IAAlE;AACD,SAFD,CATgC,CAYhC;;;AACA,YAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,EAAD,EAAQ;AAC3Bf,mBAAS,GAA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C4C,MAAH,CAAUK,OAAV,CAAkB,kBAAlB,CAAP;AACD;AACF,OAbD;;AAcA,UAAMzB,SAAS,GAAG,SAAZA,SAAY,CAACZ,EAAD,EAAQ;AACxB,eAAOA,EAAE,CAACK,SAAH,CAAaC,QAAb,CAAsB,yBAAtB,CAAP;AACD,OAFD;;AAGA,UAAMc,eAAe,GAAG,SAAlBA,eAAkB,CAACpB,EAAD,EAAQ;AAC9B,YAAIA,EAAE,CAACsC,UAAP,EAAmB;AACjB,cAAMC,MAAM,GAAGvC,EAAE,CAACsC,UAAH,CAAcE,aAAd,CAA4B,mBAA5B,CAAf;;AACA,cAAID,MAAJ,EAAY;AACV,mBAAOA,MAAP;AACD;AACF;;AACD,eAAOvC,EAAE,CAACwC,aAAH,CAAiB,mBAAjB,CAAP;AACD,OARD;;AASA,UAAMjC,SAAS,GAAG,eAAlB;AACA,UAAMM,oBAAoB,GAAG,GAA7B;AACA,UAAMc,kBAAkB,GAAG,GAA3B;AACA,UAAMrD,UAAU,GAAG,IAAnB","file":"tap-click-71d2324a-js-es5.js","sourcesContent":["import { n as now, p as pointerCoord } from './helpers-90f46169.js';\n\nconst startTapClick = (config) => {\n let lastTouch = -MOUSE_WAIT * 10;\n let lastActivated = 0;\n let scrollingEl;\n let activatableEle;\n let activeRipple;\n let activeDefer;\n const useRippleEffect = config.getBoolean('animated', true) && config.getBoolean('rippleEffect', true);\n const clearDefers = new WeakMap();\n const isScrolling = () => {\n return scrollingEl !== undefined && scrollingEl.parentElement !== null;\n };\n // Touch Events\n const onTouchStart = (ev) => {\n lastTouch = now(ev);\n pointerDown(ev);\n };\n const onTouchEnd = (ev) => {\n lastTouch = now(ev);\n pointerUp(ev);\n };\n const onMouseDown = (ev) => {\n const t = now(ev) - MOUSE_WAIT;\n if (lastTouch < t) {\n pointerDown(ev);\n }\n };\n const onMouseUp = (ev) => {\n const t = now(ev) - MOUSE_WAIT;\n if (lastTouch < t) {\n pointerUp(ev);\n }\n };\n const cancelActive = () => {\n clearTimeout(activeDefer);\n activeDefer = undefined;\n if (activatableEle) {\n removeActivated(false);\n activatableEle = undefined;\n }\n };\n const pointerDown = (ev) => {\n if (activatableEle || isScrolling()) {\n return;\n }\n scrollingEl = undefined;\n setActivatedElement(getActivatableTarget(ev), ev);\n };\n const pointerUp = (ev) => {\n setActivatedElement(undefined, ev);\n };\n const setActivatedElement = (el, ev) => {\n // do nothing\n if (el && el === activatableEle) {\n return;\n }\n clearTimeout(activeDefer);\n activeDefer = undefined;\n const { x, y } = pointerCoord(ev);\n // deactivate selected\n if (activatableEle) {\n if (clearDefers.has(activatableEle)) {\n throw new Error('internal error');\n }\n if (!activatableEle.classList.contains(ACTIVATED)) {\n addActivated(activatableEle, x, y);\n }\n removeActivated(true);\n }\n // activate\n if (el) {\n const deferId = clearDefers.get(el);\n if (deferId) {\n clearTimeout(deferId);\n clearDefers.delete(el);\n }\n const delay = isInstant(el) ? 0 : ADD_ACTIVATED_DEFERS;\n el.classList.remove(ACTIVATED);\n activeDefer = setTimeout(() => {\n addActivated(el, x, y);\n activeDefer = undefined;\n }, delay);\n }\n activatableEle = el;\n };\n const addActivated = (el, x, y) => {\n lastActivated = Date.now();\n el.classList.add(ACTIVATED);\n const rippleEffect = useRippleEffect && getRippleEffect(el);\n if (rippleEffect && rippleEffect.addRipple) {\n removeRipple();\n activeRipple = rippleEffect.addRipple(x, y);\n }\n };\n const removeRipple = () => {\n if (activeRipple !== undefined) {\n activeRipple.then(remove => remove());\n activeRipple = undefined;\n }\n };\n const removeActivated = (smooth) => {\n removeRipple();\n const active = activatableEle;\n if (!active) {\n return;\n }\n const time = CLEAR_STATE_DEFERS - Date.now() + lastActivated;\n if (smooth && time > 0 && !isInstant(active)) {\n const deferId = setTimeout(() => {\n active.classList.remove(ACTIVATED);\n clearDefers.delete(active);\n }, CLEAR_STATE_DEFERS);\n clearDefers.set(active, deferId);\n }\n else {\n active.classList.remove(ACTIVATED);\n }\n };\n const doc = document;\n doc.addEventListener('ionScrollStart', ev => {\n scrollingEl = ev.target;\n cancelActive();\n });\n doc.addEventListener('ionScrollEnd', () => {\n scrollingEl = undefined;\n });\n doc.addEventListener('ionGestureCaptured', cancelActive);\n doc.addEventListener('touchstart', onTouchStart, true);\n doc.addEventListener('touchcancel', onTouchEnd, true);\n doc.addEventListener('touchend', onTouchEnd, true);\n doc.addEventListener('mousedown', onMouseDown, true);\n doc.addEventListener('mouseup', onMouseUp, true);\n};\nconst getActivatableTarget = (ev) => {\n if (ev.composedPath) {\n const path = ev.composedPath();\n for (let i = 0; i < path.length - 2; i++) {\n const el = path[i];\n if (el.classList && el.classList.contains('ion-activatable')) {\n return el;\n }\n }\n }\n else {\n return ev.target.closest('.ion-activatable');\n }\n};\nconst isInstant = (el) => {\n return el.classList.contains('ion-activatable-instant');\n};\nconst getRippleEffect = (el) => {\n if (el.shadowRoot) {\n const ripple = el.shadowRoot.querySelector('ion-ripple-effect');\n if (ripple) {\n return ripple;\n }\n }\n return el.querySelector('ion-ripple-effect');\n};\nconst ACTIVATED = 'ion-activated';\nconst ADD_ACTIVATED_DEFERS = 200;\nconst CLEAR_STATE_DEFERS = 200;\nconst MOUSE_WAIT = 2500;\n\nexport { startTapClick };\n"]} |