@ionic/core 7.3.0 → 7.3.1-dev.11692293668.19f31f09

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.
@@ -253,6 +253,68 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
253
253
  * Resize info is available on Capacitor 4+
254
254
  */
255
255
  const addScrollPadding = enableScrollPadding && (keyboardResize === undefined || keyboardResize.mode === KeyboardResize.None);
256
+ /**
257
+ * This tracks whether or not the keyboard has been
258
+ * presented for a single focused text field. Note
259
+ * that it does not track if the keyboard is open
260
+ * in general such as if the keyboard is open for
261
+ * a different focused text field.
262
+ */
263
+ let hasKeyboardBeenPresentedForTextField = false;
264
+ /**
265
+ * Scroll assist is run when a text field
266
+ * is focused. However, it may need to
267
+ * re-run when the keyboard size changes
268
+ * such that the text field is now hidden
269
+ * underneath the keyboard.
270
+ * This function re-runs scroll assist
271
+ * when that happens.
272
+ *
273
+ * One limitation of this is on a web browser
274
+ * where native keyboard APIs do not have cross-browser
275
+ * support. `ionKeyboardDidShow` relies on the Visual Viewport API.
276
+ * This means that if the keyboard changes but does not change
277
+ * geometry, then scroll assist will not re-run even if
278
+ * the user has scrolled the text field under the keyboard.
279
+ * This should not be a problem when running in Cordova/Capacitor
280
+ * because `ionKeyboardDidShow` uses the native events
281
+ * which fire every time the keyboard changes.
282
+ */
283
+ const keyboardShow = (ev) => {
284
+ /**
285
+ * If the keyboard has not yet been presented
286
+ * for this text field then the text field has just
287
+ * received focus. In that case, the focusin listener
288
+ * will run scroll assist.
289
+ */
290
+ if (hasKeyboardBeenPresentedForTextField === false) {
291
+ hasKeyboardBeenPresentedForTextField = true;
292
+ return;
293
+ }
294
+ /**
295
+ * Otherwise, the keyboard has already been presented
296
+ * for the focused text field.
297
+ * This means that the keyboard likely changed
298
+ * geometry, and we need to re-run scroll assist.
299
+ * This can happen when the user rotates their device
300
+ * or when they switch keyboards.
301
+ *
302
+ * Make sure we pass in the computed keyboard height
303
+ * rather than the estimated keyboard height.
304
+ *
305
+ * Since the keyboard is already open then we do not
306
+ * need to wait for the webview to resize, so we pass
307
+ * "waitForResize: false".
308
+ */
309
+ jsSetFocus(componentEl, inputEl, contentEl, footerEl, ev.detail.keyboardHeight, addScrollPadding, disableClonedInput, false);
310
+ };
311
+ /**
312
+ * Reset the internal state when the text field loses focus.
313
+ */
314
+ const focusOut = () => {
315
+ hasKeyboardBeenPresentedForTextField = false;
316
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
317
+ };
256
318
  /**
257
319
  * When the input is about to receive
258
320
  * focus, we need to move it to prevent
@@ -270,10 +332,22 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
270
332
  return;
271
333
  }
272
334
  jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput);
335
+ /**
336
+ * Listen for any changes to the keyboard
337
+ * dimensions in case we need to re-run scroll assist.
338
+ */
339
+ window.addEventListener('ionKeyboardDidShow', keyboardShow);
340
+ componentEl.addEventListener('focusout', focusOut, true);
273
341
  };
274
342
  componentEl.addEventListener('focusin', focusIn, true);
343
+ /**
344
+ * Scroll assist is being destroyed for this
345
+ * text field instance, so remove any remaining listeners.
346
+ */
275
347
  return () => {
276
348
  componentEl.removeEventListener('focusin', focusIn, true);
349
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
350
+ componentEl.removeEventListener('focusout', focusOut, true);
277
351
  };
278
352
  };
279
353
  /**
@@ -292,7 +366,7 @@ const setManualFocus = (el) => {
292
366
  el.setAttribute(SKIP_SCROLL_ASSIST, 'true');
293
367
  el.focus();
294
368
  };
295
- const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false) => {
369
+ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false, waitForResize = true) => {
296
370
  if (!contentEl && !footerEl) {
297
371
  return;
298
372
  }
@@ -383,7 +457,7 @@ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHei
383
457
  * bandwidth to become available.
384
458
  */
385
459
  const totalScrollAmount = scrollEl.scrollHeight - scrollEl.clientHeight;
386
- if (scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
460
+ if (waitForResize && scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
387
461
  /**
388
462
  * On iOS devices, the system will show a "Passwords" bar above the keyboard
389
463
  * after the initial keyboard is shown. This prevents the webview from resizing
@@ -258,6 +258,68 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
258
258
  * Resize info is available on Capacitor 4+
259
259
  */
260
260
  const addScrollPadding = enableScrollPadding && (keyboardResize === undefined || keyboardResize.mode === keyboard.KeyboardResize.None);
261
+ /**
262
+ * This tracks whether or not the keyboard has been
263
+ * presented for a single focused text field. Note
264
+ * that it does not track if the keyboard is open
265
+ * in general such as if the keyboard is open for
266
+ * a different focused text field.
267
+ */
268
+ let hasKeyboardBeenPresentedForTextField = false;
269
+ /**
270
+ * Scroll assist is run when a text field
271
+ * is focused. However, it may need to
272
+ * re-run when the keyboard size changes
273
+ * such that the text field is now hidden
274
+ * underneath the keyboard.
275
+ * This function re-runs scroll assist
276
+ * when that happens.
277
+ *
278
+ * One limitation of this is on a web browser
279
+ * where native keyboard APIs do not have cross-browser
280
+ * support. `ionKeyboardDidShow` relies on the Visual Viewport API.
281
+ * This means that if the keyboard changes but does not change
282
+ * geometry, then scroll assist will not re-run even if
283
+ * the user has scrolled the text field under the keyboard.
284
+ * This should not be a problem when running in Cordova/Capacitor
285
+ * because `ionKeyboardDidShow` uses the native events
286
+ * which fire every time the keyboard changes.
287
+ */
288
+ const keyboardShow = (ev) => {
289
+ /**
290
+ * If the keyboard has not yet been presented
291
+ * for this text field then the text field has just
292
+ * received focus. In that case, the focusin listener
293
+ * will run scroll assist.
294
+ */
295
+ if (hasKeyboardBeenPresentedForTextField === false) {
296
+ hasKeyboardBeenPresentedForTextField = true;
297
+ return;
298
+ }
299
+ /**
300
+ * Otherwise, the keyboard has already been presented
301
+ * for the focused text field.
302
+ * This means that the keyboard likely changed
303
+ * geometry, and we need to re-run scroll assist.
304
+ * This can happen when the user rotates their device
305
+ * or when they switch keyboards.
306
+ *
307
+ * Make sure we pass in the computed keyboard height
308
+ * rather than the estimated keyboard height.
309
+ *
310
+ * Since the keyboard is already open then we do not
311
+ * need to wait for the webview to resize, so we pass
312
+ * "waitForResize: false".
313
+ */
314
+ jsSetFocus(componentEl, inputEl, contentEl, footerEl, ev.detail.keyboardHeight, addScrollPadding, disableClonedInput, false);
315
+ };
316
+ /**
317
+ * Reset the internal state when the text field loses focus.
318
+ */
319
+ const focusOut = () => {
320
+ hasKeyboardBeenPresentedForTextField = false;
321
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
322
+ };
261
323
  /**
262
324
  * When the input is about to receive
263
325
  * focus, we need to move it to prevent
@@ -275,10 +337,22 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
275
337
  return;
276
338
  }
277
339
  jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput);
340
+ /**
341
+ * Listen for any changes to the keyboard
342
+ * dimensions in case we need to re-run scroll assist.
343
+ */
344
+ window.addEventListener('ionKeyboardDidShow', keyboardShow);
345
+ componentEl.addEventListener('focusout', focusOut, true);
278
346
  };
279
347
  componentEl.addEventListener('focusin', focusIn, true);
348
+ /**
349
+ * Scroll assist is being destroyed for this
350
+ * text field instance, so remove any remaining listeners.
351
+ */
280
352
  return () => {
281
353
  componentEl.removeEventListener('focusin', focusIn, true);
354
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
355
+ componentEl.removeEventListener('focusout', focusOut, true);
282
356
  };
283
357
  };
284
358
  /**
@@ -297,7 +371,7 @@ const setManualFocus = (el) => {
297
371
  el.setAttribute(SKIP_SCROLL_ASSIST, 'true');
298
372
  el.focus();
299
373
  };
300
- const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false) => {
374
+ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false, waitForResize = true) => {
301
375
  if (!contentEl && !footerEl) {
302
376
  return;
303
377
  }
@@ -388,7 +462,7 @@ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHei
388
462
  * bandwidth to become available.
389
463
  */
390
464
  const totalScrollAmount = scrollEl.scrollHeight - scrollEl.clientHeight;
391
- if (scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
465
+ if (waitForResize && scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
392
466
  /**
393
467
  * On iOS devices, the system will show a "Passwords" bar above the keyboard
394
468
  * after the initial keyboard is shown. This prevents the webview from resizing
@@ -42,7 +42,7 @@ const App = class {
42
42
  * platforms proceed into this block.
43
43
  */
44
44
  const platform = ionicGlobal.isPlatform(window, 'ios') ? 'ios' : 'android';
45
- Promise.resolve().then(function () { return require('./input-shims-f8569707.js'); }).then((module) => module.startInputShims(ionicGlobal.config, platform));
45
+ Promise.resolve().then(function () { return require('./input-shims-d8e322aa.js'); }).then((module) => module.startInputShims(ionicGlobal.config, platform));
46
46
  }
47
47
  const hardwareBackButtonModule = await Promise.resolve().then(function () { return require('./hardware-back-button-b67c8e75.js'); });
48
48
  if (ionicGlobal.config.getBoolean('hardwareBackButton', isHybrid)) {
@@ -20,6 +20,68 @@ export const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, ke
20
20
  * Resize info is available on Capacitor 4+
21
21
  */
22
22
  const addScrollPadding = enableScrollPadding && (keyboardResize === undefined || keyboardResize.mode === KeyboardResize.None);
23
+ /**
24
+ * This tracks whether or not the keyboard has been
25
+ * presented for a single focused text field. Note
26
+ * that it does not track if the keyboard is open
27
+ * in general such as if the keyboard is open for
28
+ * a different focused text field.
29
+ */
30
+ let hasKeyboardBeenPresentedForTextField = false;
31
+ /**
32
+ * Scroll assist is run when a text field
33
+ * is focused. However, it may need to
34
+ * re-run when the keyboard size changes
35
+ * such that the text field is now hidden
36
+ * underneath the keyboard.
37
+ * This function re-runs scroll assist
38
+ * when that happens.
39
+ *
40
+ * One limitation of this is on a web browser
41
+ * where native keyboard APIs do not have cross-browser
42
+ * support. `ionKeyboardDidShow` relies on the Visual Viewport API.
43
+ * This means that if the keyboard changes but does not change
44
+ * geometry, then scroll assist will not re-run even if
45
+ * the user has scrolled the text field under the keyboard.
46
+ * This should not be a problem when running in Cordova/Capacitor
47
+ * because `ionKeyboardDidShow` uses the native events
48
+ * which fire every time the keyboard changes.
49
+ */
50
+ const keyboardShow = (ev) => {
51
+ /**
52
+ * If the keyboard has not yet been presented
53
+ * for this text field then the text field has just
54
+ * received focus. In that case, the focusin listener
55
+ * will run scroll assist.
56
+ */
57
+ if (hasKeyboardBeenPresentedForTextField === false) {
58
+ hasKeyboardBeenPresentedForTextField = true;
59
+ return;
60
+ }
61
+ /**
62
+ * Otherwise, the keyboard has already been presented
63
+ * for the focused text field.
64
+ * This means that the keyboard likely changed
65
+ * geometry, and we need to re-run scroll assist.
66
+ * This can happen when the user rotates their device
67
+ * or when they switch keyboards.
68
+ *
69
+ * Make sure we pass in the computed keyboard height
70
+ * rather than the estimated keyboard height.
71
+ *
72
+ * Since the keyboard is already open then we do not
73
+ * need to wait for the webview to resize, so we pass
74
+ * "waitForResize: false".
75
+ */
76
+ jsSetFocus(componentEl, inputEl, contentEl, footerEl, ev.detail.keyboardHeight, addScrollPadding, disableClonedInput, false);
77
+ };
78
+ /**
79
+ * Reset the internal state when the text field loses focus.
80
+ */
81
+ const focusOut = () => {
82
+ hasKeyboardBeenPresentedForTextField = false;
83
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
84
+ };
23
85
  /**
24
86
  * When the input is about to receive
25
87
  * focus, we need to move it to prevent
@@ -37,10 +99,22 @@ export const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, ke
37
99
  return;
38
100
  }
39
101
  jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput);
102
+ /**
103
+ * Listen for any changes to the keyboard
104
+ * dimensions in case we need to re-run scroll assist.
105
+ */
106
+ window.addEventListener('ionKeyboardDidShow', keyboardShow);
107
+ componentEl.addEventListener('focusout', focusOut, true);
40
108
  };
41
109
  componentEl.addEventListener('focusin', focusIn, true);
110
+ /**
111
+ * Scroll assist is being destroyed for this
112
+ * text field instance, so remove any remaining listeners.
113
+ */
42
114
  return () => {
43
115
  componentEl.removeEventListener('focusin', focusIn, true);
116
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
117
+ componentEl.removeEventListener('focusout', focusOut, true);
44
118
  };
45
119
  };
46
120
  /**
@@ -59,7 +133,7 @@ const setManualFocus = (el) => {
59
133
  el.setAttribute(SKIP_SCROLL_ASSIST, 'true');
60
134
  el.focus();
61
135
  };
62
- const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false) => {
136
+ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false, waitForResize = true) => {
63
137
  if (!contentEl && !footerEl) {
64
138
  return;
65
139
  }
@@ -150,7 +224,7 @@ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHei
150
224
  * bandwidth to become available.
151
225
  */
152
226
  const totalScrollAmount = scrollEl.scrollHeight - scrollEl.clientHeight;
153
- if (scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
227
+ if (waitForResize && scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
154
228
  /**
155
229
  * On iOS devices, the system will show a "Passwords" bar above the keyboard
156
230
  * after the initial keyboard is shown. This prevents the webview from resizing
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-08-16T14:17:02",
2
+ "timestamp": "2023-08-17T17:37:26",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.0.3",
@@ -256,6 +256,68 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
256
256
  * Resize info is available on Capacitor 4+
257
257
  */
258
258
  const addScrollPadding = enableScrollPadding && (keyboardResize === undefined || keyboardResize.mode === KeyboardResize.None);
259
+ /**
260
+ * This tracks whether or not the keyboard has been
261
+ * presented for a single focused text field. Note
262
+ * that it does not track if the keyboard is open
263
+ * in general such as if the keyboard is open for
264
+ * a different focused text field.
265
+ */
266
+ let hasKeyboardBeenPresentedForTextField = false;
267
+ /**
268
+ * Scroll assist is run when a text field
269
+ * is focused. However, it may need to
270
+ * re-run when the keyboard size changes
271
+ * such that the text field is now hidden
272
+ * underneath the keyboard.
273
+ * This function re-runs scroll assist
274
+ * when that happens.
275
+ *
276
+ * One limitation of this is on a web browser
277
+ * where native keyboard APIs do not have cross-browser
278
+ * support. `ionKeyboardDidShow` relies on the Visual Viewport API.
279
+ * This means that if the keyboard changes but does not change
280
+ * geometry, then scroll assist will not re-run even if
281
+ * the user has scrolled the text field under the keyboard.
282
+ * This should not be a problem when running in Cordova/Capacitor
283
+ * because `ionKeyboardDidShow` uses the native events
284
+ * which fire every time the keyboard changes.
285
+ */
286
+ const keyboardShow = (ev) => {
287
+ /**
288
+ * If the keyboard has not yet been presented
289
+ * for this text field then the text field has just
290
+ * received focus. In that case, the focusin listener
291
+ * will run scroll assist.
292
+ */
293
+ if (hasKeyboardBeenPresentedForTextField === false) {
294
+ hasKeyboardBeenPresentedForTextField = true;
295
+ return;
296
+ }
297
+ /**
298
+ * Otherwise, the keyboard has already been presented
299
+ * for the focused text field.
300
+ * This means that the keyboard likely changed
301
+ * geometry, and we need to re-run scroll assist.
302
+ * This can happen when the user rotates their device
303
+ * or when they switch keyboards.
304
+ *
305
+ * Make sure we pass in the computed keyboard height
306
+ * rather than the estimated keyboard height.
307
+ *
308
+ * Since the keyboard is already open then we do not
309
+ * need to wait for the webview to resize, so we pass
310
+ * "waitForResize: false".
311
+ */
312
+ jsSetFocus(componentEl, inputEl, contentEl, footerEl, ev.detail.keyboardHeight, addScrollPadding, disableClonedInput, false);
313
+ };
314
+ /**
315
+ * Reset the internal state when the text field loses focus.
316
+ */
317
+ const focusOut = () => {
318
+ hasKeyboardBeenPresentedForTextField = false;
319
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
320
+ };
259
321
  /**
260
322
  * When the input is about to receive
261
323
  * focus, we need to move it to prevent
@@ -273,10 +335,22 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
273
335
  return;
274
336
  }
275
337
  jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput);
338
+ /**
339
+ * Listen for any changes to the keyboard
340
+ * dimensions in case we need to re-run scroll assist.
341
+ */
342
+ window.addEventListener('ionKeyboardDidShow', keyboardShow);
343
+ componentEl.addEventListener('focusout', focusOut, true);
276
344
  };
277
345
  componentEl.addEventListener('focusin', focusIn, true);
346
+ /**
347
+ * Scroll assist is being destroyed for this
348
+ * text field instance, so remove any remaining listeners.
349
+ */
278
350
  return () => {
279
351
  componentEl.removeEventListener('focusin', focusIn, true);
352
+ window.removeEventListener('ionKeyboardDidShow', keyboardShow);
353
+ componentEl.removeEventListener('focusout', focusOut, true);
280
354
  };
281
355
  };
282
356
  /**
@@ -295,7 +369,7 @@ const setManualFocus = (el) => {
295
369
  el.setAttribute(SKIP_SCROLL_ASSIST, 'true');
296
370
  el.focus();
297
371
  };
298
- const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false) => {
372
+ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHeight, enableScrollPadding, disableClonedInput = false, waitForResize = true) => {
299
373
  if (!contentEl && !footerEl) {
300
374
  return;
301
375
  }
@@ -386,7 +460,7 @@ const jsSetFocus = async (componentEl, inputEl, contentEl, footerEl, keyboardHei
386
460
  * bandwidth to become available.
387
461
  */
388
462
  const totalScrollAmount = scrollEl.scrollHeight - scrollEl.clientHeight;
389
- if (scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
463
+ if (waitForResize && scrollData.scrollAmount > totalScrollAmount - scrollEl.scrollTop) {
390
464
  /**
391
465
  * On iOS devices, the system will show a "Passwords" bar above the keyboard
392
466
  * after the initial keyboard is shown. This prevents the webview from resizing
@@ -38,7 +38,7 @@ const App = class {
38
38
  * platforms proceed into this block.
39
39
  */
40
40
  const platform = isPlatform(window, 'ios') ? 'ios' : 'android';
41
- import('./input-shims-af993f05.js').then((module) => module.startInputShims(config, platform));
41
+ import('./input-shims-c738363e.js').then((module) => module.startInputShims(config, platform));
42
42
  }
43
43
  const hardwareBackButtonModule = await import('./hardware-back-button-39299f84.js');
44
44
  if (config.getBoolean('hardwareBackButton', isHybrid)) {
@@ -0,0 +1,4 @@
1
+ import{__awaiter,__generator}from"tslib";
2
+ /*!
3
+ * (C) Ionic http://ionicframework.com - MIT License
4
+ */import{g as getScrollElement,c as scrollByPoint,f as findClosestIonContent}from"./index-746a238e.js";import{a as addEventListener,b as removeEventListener,r as raf,c as componentOnReady}from"./helpers-3379ba19.js";import{a as KeyboardResize,K as Keyboard}from"./keyboard-b063f012.js";import"./index-595d62c9.js";import"./capacitor-b4979570.js";import"./index-7a14ecec.js";var cloneMap=new WeakMap;var relocateInput=function(e,t,n,r,o){if(r===void 0){r=0}if(o===void 0){o=false}if(cloneMap.has(e)===n){return}if(n){addClone(e,t,r,o)}else{removeClone(e,t)}};var isFocused=function(e){return e===e.getRootNode().activeElement};var addClone=function(e,t,n,r){if(r===void 0){r=false}var o=t.parentNode;var i=t.cloneNode(false);i.classList.add("cloned-input");i.tabIndex=-1;if(r){i.disabled=true}o.appendChild(i);cloneMap.set(e,i);var a=e.ownerDocument;var s=a.dir==="rtl"?9999:-9999;e.style.pointerEvents="none";t.style.transform="translate3d(".concat(s,"px,").concat(n,"px,0) scale(0)")};var removeClone=function(e,t){var n=cloneMap.get(e);if(n){cloneMap.delete(e);n.remove()}e.style.pointerEvents="";t.style.transform=""};var SCROLL_AMOUNT_PADDING=50;var enableHideCaretOnScroll=function(e,t,n){if(!n||!t){return function(){return}}var r=function(n){if(isFocused(t)){relocateInput(e,t,n)}};var o=function(){return relocateInput(e,t,false)};var i=function(){return r(true)};var a=function(){return r(false)};addEventListener(n,"ionScrollStart",i);addEventListener(n,"ionScrollEnd",a);t.addEventListener("blur",o);return function(){removeEventListener(n,"ionScrollStart",i);removeEventListener(n,"ionScrollEnd",a);t.removeEventListener("blur",o)}};var SKIP_SELECTOR="input, textarea, [no-blur], [contenteditable]";var enableInputBlurring=function(){var e=true;var t=false;var n=document;var r=function(){t=true};var o=function(){e=true};var i=function(r){if(t){t=false;return}var o=n.activeElement;if(!o){return}if(o.matches(SKIP_SELECTOR)){return}var i=r.target;if(i===o){return}if(i.matches(SKIP_SELECTOR)||i.closest(SKIP_SELECTOR)){return}e=false;setTimeout((function(){if(!e){o.blur()}}),50)};addEventListener(n,"ionScrollStart",r);n.addEventListener("focusin",o,true);n.addEventListener("touchend",i,false);return function(){removeEventListener(n,"ionScrollStart",r,true);n.removeEventListener("focusin",o,true);n.removeEventListener("touchend",i,false)}};var SCROLL_ASSIST_SPEED=.3;var getScrollData=function(e,t,n){var r;var o=(r=e.closest("ion-item,[ion-item]"))!==null&&r!==void 0?r:e;return calcScrollData(o.getBoundingClientRect(),t.getBoundingClientRect(),n,e.ownerDocument.defaultView.innerHeight)};var calcScrollData=function(e,t,n,r){var o=e.top;var i=e.bottom;var a=t.top;var s=Math.min(t.bottom,r-n);var u=a+15;var l=s-SCROLL_AMOUNT_PADDING;var d=l-i;var c=u-o;var f=Math.round(d<0?-d:c>0?-c:0);var v=Math.min(f,o-a);var S=Math.abs(v);var m=S/SCROLL_ASSIST_SPEED;var p=Math.min(400,Math.max(150,m));return{scrollAmount:v,scrollDuration:p,scrollPadding:n,inputSafeY:-(o-u)+4}};var PADDING_TIMER_KEY="$ionPaddingTimer";var setScrollPadding=function(e,t,n){var r=e[PADDING_TIMER_KEY];if(r){clearTimeout(r)}if(t>0){e.style.setProperty("--keyboard-offset","".concat(t,"px"))}else{e[PADDING_TIMER_KEY]=setTimeout((function(){e.style.setProperty("--keyboard-offset","0px");if(n){n()}}),120)}};var setClearScrollPaddingListener=function(e,t,n){var r=function(){if(t){setScrollPadding(t,0,n)}};e.addEventListener("focusout",r,{once:true})};var currentPadding=0;var SKIP_SCROLL_ASSIST="data-ionic-skip-scroll-assist";var enableScrollAssist=function(e,t,n,r,o,i,a,s){if(s===void 0){s=false}var u=i&&(a===undefined||a.mode===KeyboardResize.None);var l=false;var d=function(o){if(l===false){l=true;return}jsSetFocus(e,t,n,r,o.detail.keyboardHeight,u,s,false)};var c=function(){l=false;window.removeEventListener("ionKeyboardDidShow",d)};var f=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(i){if(t.hasAttribute(SKIP_SCROLL_ASSIST)){t.removeAttribute(SKIP_SCROLL_ASSIST);return[2]}jsSetFocus(e,t,n,r,o,u,s);window.addEventListener("ionKeyboardDidShow",d);e.addEventListener("focusout",c,true);return[2]}))}))};e.addEventListener("focusin",f,true);return function(){e.removeEventListener("focusin",f,true);window.removeEventListener("ionKeyboardDidShow",d);e.removeEventListener("focusout",c,true)}};var setManualFocus=function(e){if(document.activeElement===e){return}e.setAttribute(SKIP_SCROLL_ASSIST,"true");e.focus()};var jsSetFocus=function(e,t,n,r,o,i,a,s){if(a===void 0){a=false}if(s===void 0){s=true}return __awaiter(void 0,void 0,void 0,(function(){var u,l,d,c,f,v;return __generator(this,(function(S){switch(S.label){case 0:if(!n&&!r){return[2]}u=getScrollData(e,n||r,o);if(n&&Math.abs(u.scrollAmount)<4){setManualFocus(t);if(i&&n!==null){setScrollPadding(n,currentPadding);setClearScrollPaddingListener(t,n,(function(){return currentPadding=0}))}return[2]}relocateInput(e,t,true,u.inputSafeY,a);setManualFocus(t);raf((function(){return e.click()}));if(i&&n){currentPadding=u.scrollPadding;setScrollPadding(n,currentPadding)}if(!(typeof window!=="undefined"))return[3,3];d=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(r){switch(r.label){case 0:if(l!==undefined){clearTimeout(l)}window.removeEventListener("ionKeyboardDidShow",c);window.removeEventListener("ionKeyboardDidShow",d);if(!n)return[3,2];return[4,scrollByPoint(n,0,u.scrollAmount,u.scrollDuration)];case 1:r.sent();r.label=2;case 2:relocateInput(e,t,false,u.inputSafeY);setManualFocus(t);if(i){setClearScrollPaddingListener(t,n,(function(){return currentPadding=0}))}return[2]}}))}))};c=function(){window.removeEventListener("ionKeyboardDidShow",c);window.addEventListener("ionKeyboardDidShow",d)};if(!n)return[3,2];return[4,getScrollElement(n)];case 1:f=S.sent();v=f.scrollHeight-f.clientHeight;if(s&&u.scrollAmount>v-f.scrollTop){if(t.type==="password"){u.scrollAmount+=SCROLL_AMOUNT_PADDING;window.addEventListener("ionKeyboardDidShow",c)}else{window.addEventListener("ionKeyboardDidShow",d)}l=setTimeout(d,1e3);return[2]}S.label=2;case 2:d();S.label=3;case 3:return[2]}}))}))};var INPUT_BLURRING=true;var startInputShims=function(e,t){return __awaiter(void 0,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,d,c,f,v,S,m,p,L,E;return __generator(this,(function(_){switch(_.label){case 0:n=document;r=t==="ios";o=t==="android";i=e.getNumber("keyboardHeight",290);a=e.getBoolean("scrollAssist",true);s=e.getBoolean("hideCaretOnScroll",r);u=e.getBoolean("inputBlurring",r);l=e.getBoolean("scrollPadding",true);d=Array.from(n.querySelectorAll("ion-input, ion-textarea"));c=new WeakMap;f=new WeakMap;return[4,Keyboard.getResizeMode()];case 1:v=_.sent();S=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,n,r,u,d,S,d;return __generator(this,(function(m){switch(m.label){case 0:return[4,new Promise((function(t){return componentOnReady(e,t)}))];case 1:m.sent();t=e.shadowRoot||e;n=t.querySelector("input")||t.querySelector("textarea");r=findClosestIonContent(e);u=!r?e.closest("ion-footer"):null;if(!n){return[2]}if(!!r&&s&&!c.has(e)){d=enableHideCaretOnScroll(e,n,r);c.set(e,d)}S=n.type==="date"||n.type==="datetime-local";if(!S&&(!!r||!!u)&&a&&!f.has(e)){d=enableScrollAssist(e,n,r,u,i,l,v,o);f.set(e,d)}return[2]}}))}))};m=function(e){if(s){var t=c.get(e);if(t){t()}c.delete(e)}if(a){var t=f.get(e);if(t){t()}f.delete(e)}};if(u&&INPUT_BLURRING){enableInputBlurring()}for(p=0,L=d;p<L.length;p++){E=L[p];S(E)}n.addEventListener("ionInputDidLoad",(function(e){S(e.detail)}));n.addEventListener("ionInputDidUnload",(function(e){m(e.detail)}));return[2]}}))}))};export{startInputShims};