@ionic/core 8.4.2-dev.11734462711.1a2281e0 → 8.4.2-dev.11736277041.14f34ba1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * (C) Ionic http://ionicframework.com - MIT License
3
+ */
4
+ System.register([],(function(n){"use strict";return{execute:function(){var t="ion-focused";var u="ion-focusable";var o=n("startFocusVisible",(function(n){var o=[];var r=n?n.shadowRoot:document;var c=n?n:document.body;var e=function(n){o.forEach((function(n){return n.classList.remove(t)}));n.forEach((function(n){return n.classList.add(t)}));o=n};var s=function(){e([])};var i=function(n){var t=n.composedPath().filter((function(n){return n instanceof HTMLElement&&n.classList.contains(u)}));e(t)};var f=function(){if(r.activeElement===c){e([])}};r.addEventListener("focusin",i);r.addEventListener("focusout",f);r.addEventListener("touchstart",s,{passive:true});r.addEventListener("mousedown",s);var a=function(){r.removeEventListener("focusin",i);r.removeEventListener("focusout",f);r.removeEventListener("touchstart",s);r.removeEventListener("mousedown",s)};return{destroy:a,setFocus:e}}))}}}));
package/hydrate/index.js CHANGED
@@ -9203,23 +9203,8 @@ const updateScrollDetail = (detail, el, timestamp, shouldStart) => {
9203
9203
 
9204
9204
  const ION_FOCUSED = 'ion-focused';
9205
9205
  const ION_FOCUSABLE = 'ion-focusable';
9206
- const FOCUS_KEYS = [
9207
- 'Tab',
9208
- 'ArrowDown',
9209
- 'Space',
9210
- 'Escape',
9211
- ' ',
9212
- 'Shift',
9213
- 'Enter',
9214
- 'ArrowLeft',
9215
- 'ArrowRight',
9216
- 'ArrowUp',
9217
- 'Home',
9218
- 'End',
9219
- ];
9220
9206
  const startFocusVisible = (rootEl) => {
9221
9207
  let currentFocus = [];
9222
- let keyboardMode = true;
9223
9208
  const ref = rootEl ? rootEl.shadowRoot : document;
9224
9209
  const root = rootEl ? rootEl : document.body;
9225
9210
  const setFocus = (elements) => {
@@ -9228,39 +9213,24 @@ const startFocusVisible = (rootEl) => {
9228
9213
  currentFocus = elements;
9229
9214
  };
9230
9215
  const pointerDown = () => {
9231
- keyboardMode = false;
9232
9216
  setFocus([]);
9233
9217
  };
9234
- const onKeydown = (ev) => {
9235
- keyboardMode = FOCUS_KEYS.includes(ev.key);
9236
- if (!keyboardMode) {
9237
- setFocus([]);
9238
- }
9239
- };
9240
9218
  const onFocusin = (ev) => {
9241
- if (keyboardMode && ev.composedPath !== undefined) {
9242
- const toFocus = ev.composedPath().filter((el) => {
9243
- // TODO(FW-2832): type
9244
- if (el.classList) {
9245
- return el.classList.contains(ION_FOCUSABLE);
9246
- }
9247
- return false;
9248
- });
9249
- setFocus(toFocus);
9250
- }
9219
+ const toFocus = ev.composedPath().filter((el) => {
9220
+ return el instanceof HTMLElement && el.classList.contains(ION_FOCUSABLE);
9221
+ });
9222
+ setFocus(toFocus);
9251
9223
  };
9252
9224
  const onFocusout = () => {
9253
9225
  if (ref.activeElement === root) {
9254
9226
  setFocus([]);
9255
9227
  }
9256
9228
  };
9257
- ref.addEventListener('keydown', onKeydown);
9258
9229
  ref.addEventListener('focusin', onFocusin);
9259
9230
  ref.addEventListener('focusout', onFocusout);
9260
9231
  ref.addEventListener('touchstart', pointerDown, { passive: true });
9261
9232
  ref.addEventListener('mousedown', pointerDown);
9262
9233
  const destroy = () => {
9263
- ref.removeEventListener('keydown', onKeydown);
9264
9234
  ref.removeEventListener('focusin', onFocusin);
9265
9235
  ref.removeEventListener('focusout', onFocusout);
9266
9236
  ref.removeEventListener('touchstart', pointerDown);
package/hydrate/index.mjs CHANGED
@@ -9199,23 +9199,8 @@ const updateScrollDetail = (detail, el, timestamp, shouldStart) => {
9199
9199
 
9200
9200
  const ION_FOCUSED = 'ion-focused';
9201
9201
  const ION_FOCUSABLE = 'ion-focusable';
9202
- const FOCUS_KEYS = [
9203
- 'Tab',
9204
- 'ArrowDown',
9205
- 'Space',
9206
- 'Escape',
9207
- ' ',
9208
- 'Shift',
9209
- 'Enter',
9210
- 'ArrowLeft',
9211
- 'ArrowRight',
9212
- 'ArrowUp',
9213
- 'Home',
9214
- 'End',
9215
- ];
9216
9202
  const startFocusVisible = (rootEl) => {
9217
9203
  let currentFocus = [];
9218
- let keyboardMode = true;
9219
9204
  const ref = rootEl ? rootEl.shadowRoot : document;
9220
9205
  const root = rootEl ? rootEl : document.body;
9221
9206
  const setFocus = (elements) => {
@@ -9224,39 +9209,24 @@ const startFocusVisible = (rootEl) => {
9224
9209
  currentFocus = elements;
9225
9210
  };
9226
9211
  const pointerDown = () => {
9227
- keyboardMode = false;
9228
9212
  setFocus([]);
9229
9213
  };
9230
- const onKeydown = (ev) => {
9231
- keyboardMode = FOCUS_KEYS.includes(ev.key);
9232
- if (!keyboardMode) {
9233
- setFocus([]);
9234
- }
9235
- };
9236
9214
  const onFocusin = (ev) => {
9237
- if (keyboardMode && ev.composedPath !== undefined) {
9238
- const toFocus = ev.composedPath().filter((el) => {
9239
- // TODO(FW-2832): type
9240
- if (el.classList) {
9241
- return el.classList.contains(ION_FOCUSABLE);
9242
- }
9243
- return false;
9244
- });
9245
- setFocus(toFocus);
9246
- }
9215
+ const toFocus = ev.composedPath().filter((el) => {
9216
+ return el instanceof HTMLElement && el.classList.contains(ION_FOCUSABLE);
9217
+ });
9218
+ setFocus(toFocus);
9247
9219
  };
9248
9220
  const onFocusout = () => {
9249
9221
  if (ref.activeElement === root) {
9250
9222
  setFocus([]);
9251
9223
  }
9252
9224
  };
9253
- ref.addEventListener('keydown', onKeydown);
9254
9225
  ref.addEventListener('focusin', onFocusin);
9255
9226
  ref.addEventListener('focusout', onFocusout);
9256
9227
  ref.addEventListener('touchstart', pointerDown, { passive: true });
9257
9228
  ref.addEventListener('mousedown', pointerDown);
9258
9229
  const destroy = () => {
9259
- ref.removeEventListener('keydown', onKeydown);
9260
9230
  ref.removeEventListener('focusin', onFocusin);
9261
9231
  ref.removeEventListener('focusout', onFocusout);
9262
9232
  ref.removeEventListener('touchstart', pointerDown);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/core",
3
- "version": "8.4.2-dev.11734462711.1a2281e0",
3
+ "version": "8.4.2-dev.11736277041.14f34ba1",
4
4
  "description": "Base components for Ionic",
5
5
  "keywords": [
6
6
  "ionic",
@@ -1,4 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- var ION_FOCUSED="ion-focused";var ION_FOCUSABLE="ion-focusable";var FOCUS_KEYS=["Tab","ArrowDown","Space","Escape"," ","Shift","Enter","ArrowLeft","ArrowRight","ArrowUp","Home","End"];var startFocusVisible=function(r){var o=[];var n=true;var t=r?r.shadowRoot:document;var u=r?r:document.body;var e=function(r){o.forEach((function(r){return r.classList.remove(ION_FOCUSED)}));r.forEach((function(r){return r.classList.add(ION_FOCUSED)}));o=r};var a=function(){n=false;e([])};var i=function(r){n=FOCUS_KEYS.includes(r.key);if(!n){e([])}};var c=function(r){if(n&&r.composedPath!==undefined){var o=r.composedPath().filter((function(r){if(r.classList){return r.classList.contains(ION_FOCUSABLE)}return false}));e(o)}};var f=function(){if(t.activeElement===u){e([])}};t.addEventListener("keydown",i);t.addEventListener("focusin",c);t.addEventListener("focusout",f);t.addEventListener("touchstart",a,{passive:true});t.addEventListener("mousedown",a);var s=function(){t.removeEventListener("keydown",i);t.removeEventListener("focusin",c);t.removeEventListener("focusout",f);t.removeEventListener("touchstart",a);t.removeEventListener("mousedown",a)};return{destroy:s,setFocus:e}};export{startFocusVisible};
@@ -1,4 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- System.register([],(function(n){"use strict";return{execute:function(){var r="ion-focused";var t="ion-focusable";var o=["Tab","ArrowDown","Space","Escape"," ","Shift","Enter","ArrowLeft","ArrowRight","ArrowUp","Home","End"];var u=n("startFocusVisible",(function(n){var u=[];var e=true;var c=n?n.shadowRoot:document;var f=n?n:document.body;var i=function(n){u.forEach((function(n){return n.classList.remove(r)}));n.forEach((function(n){return n.classList.add(r)}));u=n};var a=function(){e=false;i([])};var s=function(n){e=o.includes(n.key);if(!e){i([])}};var v=function(n){if(e&&n.composedPath!==undefined){var r=n.composedPath().filter((function(n){if(n.classList){return n.classList.contains(t)}return false}));i(r)}};var d=function(){if(c.activeElement===f){i([])}};c.addEventListener("keydown",s);c.addEventListener("focusin",v);c.addEventListener("focusout",d);c.addEventListener("touchstart",a,{passive:true});c.addEventListener("mousedown",a);var w=function(){c.removeEventListener("keydown",s);c.removeEventListener("focusin",v);c.removeEventListener("focusout",d);c.removeEventListener("touchstart",a);c.removeEventListener("mousedown",a)};return{destroy:w,setFocus:i}}))}}}));
@@ -1,4 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- const o="ion-focused",t=["Tab","ArrowDown","Space","Escape"," ","Shift","Enter","ArrowLeft","ArrowRight","ArrowUp","Home","End"],e=e=>{let s=[],n=!0;const c=e?e.shadowRoot:document,u=e||document.body,r=t=>{s.forEach((t=>t.classList.remove(o))),t.forEach((t=>t.classList.add(o))),s=t},d=()=>{n=!1,r([])},f=o=>{n=t.includes(o.key),n||r([])},i=o=>{if(n&&void 0!==o.composedPath){const t=o.composedPath().filter((o=>!!o.classList&&o.classList.contains("ion-focusable")));r(t)}},w=()=>{c.activeElement===u&&r([])};return c.addEventListener("keydown",f),c.addEventListener("focusin",i),c.addEventListener("focusout",w),c.addEventListener("touchstart",d,{passive:!0}),c.addEventListener("mousedown",d),{destroy:()=>{c.removeEventListener("keydown",f),c.removeEventListener("focusin",i),c.removeEventListener("focusout",w),c.removeEventListener("touchstart",d),c.removeEventListener("mousedown",d)},setFocus:r}};export{e as startFocusVisible}