keyboard-0272231f.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*!
  2. * (C) Ionic http://ionicframework.com - MIT License
  3. */
  4. 'use strict';
  5. const capacitor = require('./capacitor-c04564bf.js');
  6. var ExceptionCode;
  7. (function (ExceptionCode) {
  8. /**
  9. * API is not implemented.
  10. *
  11. * This usually means the API can't be used because it is not implemented for
  12. * the current platform.
  13. */
  14. ExceptionCode["Unimplemented"] = "UNIMPLEMENTED";
  15. /**
  16. * API is not available.
  17. *
  18. * This means the API can't be used right now because:
  19. * - it is currently missing a prerequisite, such as network connectivity
  20. * - it requires a particular platform or browser version
  21. */
  22. ExceptionCode["Unavailable"] = "UNAVAILABLE";
  23. })(ExceptionCode || (ExceptionCode = {}));
  24. exports.KeyboardResize = void 0;
  25. (function (KeyboardResize) {
  26. /**
  27. * Only the `body` HTML element will be resized.
  28. * Relative units are not affected, because the viewport does not change.
  29. *
  30. * @since 1.0.0
  31. */
  32. KeyboardResize["Body"] = "body";
  33. /**
  34. * Only the `ion-app` HTML element will be resized.
  35. * Use it only for Ionic Framework apps.
  36. *
  37. * @since 1.0.0
  38. */
  39. KeyboardResize["Ionic"] = "ionic";
  40. /**
  41. * The whole native Web View will be resized when the keyboard shows/hides.
  42. * This affects the `vh` relative unit.
  43. *
  44. * @since 1.0.0
  45. */
  46. KeyboardResize["Native"] = "native";
  47. /**
  48. * Neither the app nor the Web View are resized.
  49. *
  50. * @since 1.0.0
  51. */
  52. KeyboardResize["None"] = "none";
  53. })(exports.KeyboardResize || (exports.KeyboardResize = {}));
  54. const Keyboard = {
  55. getEngine() {
  56. const capacitor$1 = capacitor.getCapacitor();
  57. if (capacitor$1 === null || capacitor$1 === void 0 ? void 0 : capacitor$1.isPluginAvailable('Keyboard')) {
  58. return capacitor$1.Plugins.Keyboard;
  59. }
  60. return undefined;
  61. },
  62. getResizeMode() {
  63. const engine = this.getEngine();
  64. if (!(engine === null || engine === void 0 ? void 0 : engine.getResizeMode)) {
  65. return Promise.resolve(undefined);
  66. }
  67. return engine.getResizeMode().catch((e) => {
  68. if (e.code === ExceptionCode.Unimplemented) {
  69. // If the native implementation is not available
  70. // we treat it the same as if the plugin is not available.
  71. return undefined;
  72. }
  73. throw e;
  74. });
  75. },
  76. };
  77. exports.Keyboard = Keyboard;