1 line
3.3 KiB
Plaintext
1 line
3.3 KiB
Plaintext
{"version":3,"sources":["webpack:///node_modules/@ionic/core/dist/esm/focus-visible-f4ad4f1a.js"],"names":["ION_FOCUSED","ION_FOCUSABLE","FOCUS_KEYS","startFocusVisible","currentFocus","keyboardMode","doc","document","setFocus","elements","forEach","el","classList","remove","add","pointerDown","addEventListener","ev","includes","key","composedPath","toFocus","filter","contains","activeElement","body"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;;;AAAA;AAAA;AAAA;;AAAA,UAAMA,WAAW,GAAG,aAApB;AACA,UAAMC,aAAa,GAAG,eAAtB;AACA,UAAMC,UAAU,GAAG,CAAC,KAAD,EAAQ,WAAR,EAAqB,OAArB,EAA8B,QAA9B,EAAwC,GAAxC,EAA6C,OAA7C,EAAsD,OAAtD,EAA+D,WAA/D,EAA4E,YAA5E,EAA0F,SAA1F,CAAnB;;AACA,UAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;AAC9B,YAAIC,YAAY,GAAG,EAAnB;AACA,YAAIC,YAAY,GAAG,IAAnB;AACA,YAAMC,GAAG,GAAGC,QAAZ;;AACA,YAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,QAAD,EAAc;AAC7BL,sBAAY,CAACM,OAAb,CAAqB,UAAAC,EAAE;AAAA,mBAAIA,EAAE,CAACC,SAAH,CAAaC,MAAb,CAAoBb,WAApB,CAAJ;AAAA,WAAvB;AACAS,kBAAQ,CAACC,OAAT,CAAiB,UAAAC,EAAE;AAAA,mBAAIA,EAAE,CAACC,SAAH,CAAaE,GAAb,CAAiBd,WAAjB,CAAJ;AAAA,WAAnB;AACAI,sBAAY,GAAGK,QAAf;AACD,SAJD;;AAKA,YAAMM,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxBV,sBAAY,GAAG,KAAf;AACAG,kBAAQ,CAAC,EAAD,CAAR;AACD,SAHD;;AAIAF,WAAG,CAACU,gBAAJ,CAAqB,SAArB,EAAgC,UAAAC,EAAE,EAAI;AACpCZ,sBAAY,GAAGH,UAAU,CAACgB,QAAX,CAAoBD,EAAE,CAACE,GAAvB,CAAf;;AACA,cAAI,CAACd,YAAL,EAAmB;AACjBG,oBAAQ,CAAC,EAAD,CAAR;AACD;AACF,SALD;AAMAF,WAAG,CAACU,gBAAJ,CAAqB,SAArB,EAAgC,UAAAC,EAAE,EAAI;AACpC,cAAIZ,YAAY,IAAIY,EAAE,CAACG,YAAvB,EAAqC;AACnC,gBAAMC,OAAO,GAAGJ,EAAE,CAACG,YAAH,GAAkBE,MAAlB,CAAyB,UAACX,EAAD,EAAQ;AAC/C,kBAAIA,EAAE,CAACC,SAAP,EAAkB;AAChB,uBAAOD,EAAE,CAACC,SAAH,CAAaW,QAAb,CAAsBtB,aAAtB,CAAP;AACD;;AACD,qBAAO,KAAP;AACD,aALe,CAAhB;AAMAO,oBAAQ,CAACa,OAAD,CAAR;AACD;AACF,SAVD;AAWAf,WAAG,CAACU,gBAAJ,CAAqB,UAArB,EAAiC,YAAM;AACrC,cAAIV,GAAG,CAACkB,aAAJ,KAAsBlB,GAAG,CAACmB,IAA9B,EAAoC;AAClCjB,oBAAQ,CAAC,EAAD,CAAR;AACD;AACF,SAJD;AAKAF,WAAG,CAACU,gBAAJ,CAAqB,YAArB,EAAmCD,WAAnC;AACAT,WAAG,CAACU,gBAAJ,CAAqB,WAArB,EAAkCD,WAAlC;AACD,OArCD","file":"focus-visible-f4ad4f1a-js-es5.js","sourcesContent":["const ION_FOCUSED = 'ion-focused';\nconst ION_FOCUSABLE = 'ion-focusable';\nconst FOCUS_KEYS = ['Tab', 'ArrowDown', 'Space', 'Escape', ' ', 'Shift', 'Enter', 'ArrowLeft', 'ArrowRight', 'ArrowUp'];\nconst startFocusVisible = () => {\n let currentFocus = [];\n let keyboardMode = true;\n const doc = document;\n const setFocus = (elements) => {\n currentFocus.forEach(el => el.classList.remove(ION_FOCUSED));\n elements.forEach(el => el.classList.add(ION_FOCUSED));\n currentFocus = elements;\n };\n const pointerDown = () => {\n keyboardMode = false;\n setFocus([]);\n };\n doc.addEventListener('keydown', ev => {\n keyboardMode = FOCUS_KEYS.includes(ev.key);\n if (!keyboardMode) {\n setFocus([]);\n }\n });\n doc.addEventListener('focusin', ev => {\n if (keyboardMode && ev.composedPath) {\n const toFocus = ev.composedPath().filter((el) => {\n if (el.classList) {\n return el.classList.contains(ION_FOCUSABLE);\n }\n return false;\n });\n setFocus(toFocus);\n }\n });\n doc.addEventListener('focusout', () => {\n if (doc.activeElement === doc.body) {\n setFocus([]);\n }\n });\n doc.addEventListener('touchstart', pointerDown);\n doc.addEventListener('mousedown', pointerDown);\n};\n\nexport { startFocusVisible };\n"]} |