@rdlabo/ionic-theme-ios27 1.2.0-3 → 1.2.0-4

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.
Files changed (175) hide show
  1. package/README.md +15 -2
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/css/ionic-theme-ios27.css +1 -1
  4. package/dist/css/vertical-bars.css +1 -1
  5. package/dist/focus-controller/index.d.ts +4 -2
  6. package/dist/focus-controller/index.d.ts.map +1 -1
  7. package/dist/focus-controller/index.js +100 -57
  8. package/dist/focus-controller/index.js.map +1 -0
  9. package/dist/index.d.ts +10 -8
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +54 -60
  12. package/dist/index.js.map +1 -0
  13. package/dist/native/components/index.d.ts +13 -10
  14. package/dist/native/components/index.d.ts.map +1 -1
  15. package/dist/native/components/index.js +39 -41
  16. package/dist/native/components/index.js.map +1 -0
  17. package/dist/native/components/ion-back-button.d.ts +6 -1
  18. package/dist/native/components/ion-back-button.d.ts.map +1 -1
  19. package/dist/native/components/ion-back-button.js +19 -13
  20. package/dist/native/components/ion-back-button.js.map +1 -0
  21. package/dist/native/components/ion-button.d.ts +8 -2
  22. package/dist/native/components/ion-button.d.ts.map +1 -1
  23. package/dist/native/components/ion-button.js +22 -17
  24. package/dist/native/components/ion-button.js.map +1 -0
  25. package/dist/native/components/ion-buttons.d.ts +8 -2
  26. package/dist/native/components/ion-buttons.d.ts.map +1 -1
  27. package/dist/native/components/ion-buttons.js +29 -33
  28. package/dist/native/components/ion-buttons.js.map +1 -0
  29. package/dist/native/components/ion-fab.d.ts +6 -1
  30. package/dist/native/components/ion-fab.d.ts.map +1 -1
  31. package/dist/native/components/ion-fab.js +131 -151
  32. package/dist/native/components/ion-fab.js.map +1 -0
  33. package/dist/native/components/ion-menu-button.d.ts +8 -2
  34. package/dist/native/components/ion-menu-button.d.ts.map +1 -1
  35. package/dist/native/components/ion-menu-button.js +29 -19
  36. package/dist/native/components/ion-menu-button.js.map +1 -0
  37. package/dist/native/components/ion-segment.d.ts +6 -1
  38. package/dist/native/components/ion-segment.d.ts.map +1 -1
  39. package/dist/native/components/ion-segment.js +29 -23
  40. package/dist/native/components/ion-segment.js.map +1 -0
  41. package/dist/native/components/ion-tab-bar.d.ts +6 -1
  42. package/dist/native/components/ion-tab-bar.d.ts.map +1 -1
  43. package/dist/native/components/ion-tab-bar.js +49 -40
  44. package/dist/native/components/ion-tab-bar.js.map +1 -0
  45. package/dist/native/components/searchable-tabs.d.ts +17 -15
  46. package/dist/native/components/searchable-tabs.d.ts.map +1 -1
  47. package/dist/native/components/searchable-tabs.js +382 -434
  48. package/dist/native/components/searchable-tabs.js.map +1 -0
  49. package/dist/native/definitions.d.ts +118 -111
  50. package/dist/native/definitions.d.ts.map +1 -1
  51. package/dist/native/definitions.js +0 -1
  52. package/dist/native/foldable/fold-state.d.ts +5 -0
  53. package/dist/native/foldable/fold-state.d.ts.map +1 -0
  54. package/dist/native/foldable/fold-state.js +14 -0
  55. package/dist/native/foldable/fold-state.js.map +1 -0
  56. package/dist/native/foldable/types.d.ts +12 -0
  57. package/dist/native/foldable/types.d.ts.map +1 -0
  58. package/dist/native/foldable/types.js +0 -0
  59. package/dist/native/index.d.ts +6 -3
  60. package/dist/native/index.d.ts.map +1 -1
  61. package/dist/native/index.js +228 -204
  62. package/dist/native/index.js.map +1 -0
  63. package/dist/native/prehide.d.ts +4 -2
  64. package/dist/native/prehide.d.ts.map +1 -1
  65. package/dist/native/prehide.js +220 -242
  66. package/dist/native/prehide.js.map +1 -0
  67. package/dist/native/runtime.d.ts +3 -1
  68. package/dist/native/runtime.d.ts.map +1 -1
  69. package/dist/native/runtime.js +626 -730
  70. package/dist/native/runtime.js.map +1 -0
  71. package/dist/native/shared/candidate.d.ts +16 -11
  72. package/dist/native/shared/candidate.d.ts.map +1 -1
  73. package/dist/native/shared/candidate.js +96 -95
  74. package/dist/native/shared/candidate.js.map +1 -0
  75. package/dist/native/shared/crossfade.d.ts +6 -4
  76. package/dist/native/shared/crossfade.d.ts.map +1 -1
  77. package/dist/native/shared/crossfade.js +49 -45
  78. package/dist/native/shared/crossfade.js.map +1 -0
  79. package/dist/native/shared/dom.d.ts +7 -5
  80. package/dist/native/shared/dom.d.ts.map +1 -1
  81. package/dist/native/shared/dom.js +163 -211
  82. package/dist/native/shared/dom.js.map +1 -0
  83. package/dist/native/shared/events.d.ts +8 -6
  84. package/dist/native/shared/events.d.ts.map +1 -1
  85. package/dist/native/shared/events.js +12 -7
  86. package/dist/native/shared/events.js.map +1 -0
  87. package/dist/native/shared/icons.d.ts +4 -2
  88. package/dist/native/shared/icons.d.ts.map +1 -1
  89. package/dist/native/shared/icons.js +59 -53
  90. package/dist/native/shared/icons.js.map +1 -0
  91. package/dist/native/shared/modal.d.ts +3 -1
  92. package/dist/native/shared/modal.d.ts.map +1 -1
  93. package/dist/native/shared/modal.js +156 -139
  94. package/dist/native/shared/modal.js.map +1 -0
  95. package/dist/native/vertical-bars-web.d.ts +3 -1
  96. package/dist/native/vertical-bars-web.d.ts.map +1 -1
  97. package/dist/native/vertical-bars-web.js +332 -346
  98. package/dist/native/vertical-bars-web.js.map +1 -0
  99. package/dist/native-integration/index.d.ts +10 -8
  100. package/dist/native-integration/index.d.ts.map +1 -1
  101. package/dist/native-integration/index.js +102 -100
  102. package/dist/native-integration/index.js.map +1 -0
  103. package/dist/native-integration/transition.d.ts +3 -1
  104. package/dist/native-integration/transition.d.ts.map +1 -1
  105. package/dist/native-integration/transition.js +15 -6
  106. package/dist/native-integration/transition.js.map +1 -0
  107. package/dist/searchbar/index.d.ts +4 -2
  108. package/dist/searchbar/index.d.ts.map +1 -1
  109. package/dist/searchbar/index.js +64 -56
  110. package/dist/searchbar/index.js.map +1 -0
  111. package/dist/segment/index.d.ts +3 -1
  112. package/dist/segment/index.d.ts.map +1 -1
  113. package/dist/segment/index.js +465 -324
  114. package/dist/segment/index.js.map +1 -0
  115. package/dist/sheets-of-glass/animations.d.ts +13 -12
  116. package/dist/sheets-of-glass/animations.d.ts.map +1 -1
  117. package/dist/sheets-of-glass/animations.js +496 -306
  118. package/dist/sheets-of-glass/animations.js.map +1 -0
  119. package/dist/sheets-of-glass/index.d.ts +3 -1
  120. package/dist/sheets-of-glass/index.d.ts.map +1 -1
  121. package/dist/sheets-of-glass/index.js +294 -357
  122. package/dist/sheets-of-glass/index.js.map +1 -0
  123. package/dist/sheets-of-glass/interfaces.d.ts +11 -9
  124. package/dist/sheets-of-glass/interfaces.d.ts.map +1 -1
  125. package/dist/sheets-of-glass/interfaces.js +0 -1
  126. package/dist/tab-bar-searchable/animations/enter.d.ts +4 -2
  127. package/dist/tab-bar-searchable/animations/enter.d.ts.map +1 -1
  128. package/dist/tab-bar-searchable/animations/enter.js +50 -69
  129. package/dist/tab-bar-searchable/animations/enter.js.map +1 -0
  130. package/dist/tab-bar-searchable/animations/leave.d.ts +4 -2
  131. package/dist/tab-bar-searchable/animations/leave.d.ts.map +1 -1
  132. package/dist/tab-bar-searchable/animations/leave.js +48 -62
  133. package/dist/tab-bar-searchable/animations/leave.js.map +1 -0
  134. package/dist/tab-bar-searchable/index.d.ts +5 -3
  135. package/dist/tab-bar-searchable/index.d.ts.map +1 -1
  136. package/dist/tab-bar-searchable/index.js +123 -135
  137. package/dist/tab-bar-searchable/index.js.map +1 -0
  138. package/dist/transition/index.d.ts +9 -8
  139. package/dist/transition/index.d.ts.map +1 -1
  140. package/dist/transition/index.js +203 -192
  141. package/dist/transition/index.js.map +1 -0
  142. package/dist/transition/ios.transition.d.ts +7 -5
  143. package/dist/transition/ios.transition.d.ts.map +1 -1
  144. package/dist/transition/ios.transition.js +15 -11
  145. package/dist/transition/ios.transition.js.map +1 -0
  146. package/dist/utils.d.ts +10 -8
  147. package/dist/utils.d.ts.map +1 -1
  148. package/dist/utils.js +58 -66
  149. package/dist/utils.js.map +1 -0
  150. package/dist/vertical-bars.d.ts +5 -4
  151. package/dist/vertical-bars.js +4 -2
  152. package/docs/iphone-duo-with-original-theme.md +18 -29
  153. package/docs/iphone-duo.md +44 -204
  154. package/docs/native-ui-shell.md +10 -8
  155. package/docs/special-markup.md +2 -0
  156. package/docs/vertical-bars.md +283 -0
  157. package/ios/Sources/IonicNativeUIShellPlugin/Components/ShellVerticalBars.swift +34 -14
  158. package/ios/Sources/IonicNativeUIShellPlugin/Shared/ShellSnapshot.swift +2 -0
  159. package/ios/Tests/IonicNativeUIShellPluginTests/ShellSnapshotTests.swift +3 -0
  160. package/package.json +9 -6
  161. package/src/native/components/index.ts +3 -2
  162. package/src/native/components/ion-button.ts +3 -2
  163. package/src/native/components/ion-buttons.ts +4 -3
  164. package/src/native/components/ion-menu-button.ts +3 -2
  165. package/src/native/definitions.ts +22 -1
  166. package/src/native/foldable/fold-state.ts +9 -0
  167. package/src/native/foldable/types.ts +4 -0
  168. package/src/native/index.ts +17 -3
  169. package/src/native/prehide.ts +3 -1
  170. package/src/native/runtime.ts +2 -2
  171. package/src/native/shared/candidate.ts +39 -10
  172. package/src/native/shared/dom.ts +4 -4
  173. package/src/styles/vertical-bars.scss +4 -2
  174. package/src/vertical-bars.ts +9 -1
  175. package/dist/vertical-bars.d.ts.map +0 -1
@@ -1,219 +1,230 @@
1
- import { config } from '../utils';
2
- import { Build, writeTask } from '@stencil/core';
3
- import { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from '@ionic/core';
4
- import { createFocusController } from '../focus-controller';
5
- import { raf } from '../utils';
6
- const iosTransitionAnimation = () => import('./ios.transition');
1
+ import { config, raf } from "../utils.js";
2
+ import { createFocusController } from "../focus-controller/index.js";
3
+ import { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from "@ionic/core";
4
+ import { Build, writeTask } from "@stencil/core";
5
+ //#region src/transition/index.ts
6
+ const iosTransitionAnimation = () => import("./ios.transition.js");
7
7
  const focusController = createFocusController();
8
- export const transition = (opts) => {
9
- return new Promise((resolve, reject) => {
10
- writeTask(() => {
11
- const transitioningInactiveHeader = getIosIonHeader(opts);
12
- beforeTransition(opts, transitioningInactiveHeader);
13
- runTransition(opts)
14
- .then((result) => {
15
- if (result.animation) {
16
- result.animation.destroy();
17
- }
18
- afterTransition(opts);
19
- resolve(result);
20
- }, (error) => {
21
- afterTransition(opts);
22
- reject(error);
23
- })
24
- .finally(() => {
25
- setHeaderTransitionClass(transitioningInactiveHeader, false);
26
- });
27
- });
28
- });
8
+ /**
9
+ * Executes the main page transition.
10
+ * It also manages the lifecycle of header visibility (if any)
11
+ * to prevent visual flickering in iOS. The flickering only
12
+ * occurs for a condensed header that is placed above the content.
13
+ *
14
+ * @param opts Options for the transition.
15
+ * @returns A promise that resolves when the transition is complete.
16
+ */
17
+ const transition = (opts) => {
18
+ return new Promise((resolve, reject) => {
19
+ writeTask(() => {
20
+ const transitioningInactiveHeader = getIosIonHeader(opts);
21
+ beforeTransition(opts, transitioningInactiveHeader);
22
+ runTransition(opts).then((result) => {
23
+ if (result.animation) result.animation.destroy();
24
+ afterTransition(opts);
25
+ resolve(result);
26
+ }, (error) => {
27
+ afterTransition(opts);
28
+ reject(error);
29
+ }).finally(() => {
30
+ setHeaderTransitionClass(transitioningInactiveHeader, false);
31
+ });
32
+ });
33
+ });
29
34
  };
30
35
  const beforeTransition = (opts, transitioningInactiveHeader) => {
31
- const enteringEl = opts.enteringEl;
32
- const leavingEl = opts.leavingEl;
33
- focusController.saveViewFocus(leavingEl);
34
- setZIndex(enteringEl, leavingEl, opts.direction);
35
- setHeaderTransitionClass(transitioningInactiveHeader, true);
36
- if (opts.showGoBack) {
37
- enteringEl.classList.add('can-go-back');
38
- }
39
- else {
40
- enteringEl.classList.remove('can-go-back');
41
- }
42
- setPageHidden(enteringEl, false);
43
- enteringEl.style.setProperty('pointer-events', 'none');
44
- if (leavingEl) {
45
- setPageHidden(leavingEl, false);
46
- leavingEl.style.setProperty('pointer-events', 'none');
47
- }
36
+ const enteringEl = opts.enteringEl;
37
+ const leavingEl = opts.leavingEl;
38
+ focusController.saveViewFocus(leavingEl);
39
+ setZIndex(enteringEl, leavingEl, opts.direction);
40
+ setHeaderTransitionClass(transitioningInactiveHeader, true);
41
+ if (opts.showGoBack) enteringEl.classList.add("can-go-back");
42
+ else enteringEl.classList.remove("can-go-back");
43
+ setPageHidden(enteringEl, false);
44
+ /**
45
+ * When transitioning, the page should not
46
+ * respond to click events. This resolves small
47
+ * issues like users double tapping the ion-back-button.
48
+ * These pointer events are removed in `afterTransition`.
49
+ */
50
+ enteringEl.style.setProperty("pointer-events", "none");
51
+ if (leavingEl) {
52
+ setPageHidden(leavingEl, false);
53
+ leavingEl.style.setProperty("pointer-events", "none");
54
+ }
48
55
  };
49
56
  const runTransition = async (opts) => {
50
- const animationBuilder = await getAnimationBuilder(opts);
51
- const ani = animationBuilder && Build.isBrowser ? animation(animationBuilder, opts) : noAnimation(opts);
52
- return ani;
57
+ const animationBuilder = await getAnimationBuilder(opts);
58
+ return animationBuilder && Build.isBrowser ? animation(animationBuilder, opts) : noAnimation(opts);
53
59
  };
54
60
  const afterTransition = (opts) => {
55
- const enteringEl = opts.enteringEl;
56
- const leavingEl = opts.leavingEl;
57
- enteringEl.classList.remove('ion-page-invisible');
58
- enteringEl.style.removeProperty('pointer-events');
59
- if (leavingEl !== undefined) {
60
- leavingEl.classList.remove('ion-page-invisible');
61
- leavingEl.style.removeProperty('pointer-events');
62
- }
63
- focusController.setViewFocus(enteringEl);
61
+ const enteringEl = opts.enteringEl;
62
+ const leavingEl = opts.leavingEl;
63
+ enteringEl.classList.remove("ion-page-invisible");
64
+ enteringEl.style.removeProperty("pointer-events");
65
+ if (leavingEl !== void 0) {
66
+ leavingEl.classList.remove("ion-page-invisible");
67
+ leavingEl.style.removeProperty("pointer-events");
68
+ }
69
+ focusController.setViewFocus(enteringEl);
64
70
  };
65
71
  const getAnimationBuilder = async (opts) => {
66
- if (!opts.leavingEl || !opts.animated || opts.duration === 0) {
67
- return undefined;
68
- }
69
- if (opts.animationBuilder) {
70
- return opts.animationBuilder;
71
- }
72
- const getAnimation = (await iosTransitionAnimation()).iosTransitionAnimation;
73
- return getAnimation;
72
+ if (!opts.leavingEl || !opts.animated || opts.duration === 0) return;
73
+ if (opts.animationBuilder) return opts.animationBuilder;
74
+ return (await iosTransitionAnimation()).iosTransitionAnimation;
74
75
  };
75
76
  const animation = async (animationBuilder, opts) => {
76
- await waitForReady(opts, true);
77
- const trans = animationBuilder(opts.baseEl, opts);
78
- fireWillEvents(opts.enteringEl, opts.leavingEl);
79
- const didComplete = await playTransition(trans, opts);
80
- if (opts.progressCallback) {
81
- opts.progressCallback(undefined);
82
- }
83
- if (didComplete) {
84
- fireDidEvents(opts.enteringEl, opts.leavingEl);
85
- }
86
- return {
87
- hasCompleted: didComplete,
88
- animation: trans,
89
- };
77
+ await waitForReady(opts, true);
78
+ const trans = animationBuilder(opts.baseEl, opts);
79
+ fireWillEvents(opts.enteringEl, opts.leavingEl);
80
+ const didComplete = await playTransition(trans, opts);
81
+ if (opts.progressCallback) opts.progressCallback(void 0);
82
+ if (didComplete) fireDidEvents(opts.enteringEl, opts.leavingEl);
83
+ return {
84
+ hasCompleted: didComplete,
85
+ animation: trans
86
+ };
90
87
  };
91
88
  const noAnimation = async (opts) => {
92
- const enteringEl = opts.enteringEl;
93
- const leavingEl = opts.leavingEl;
94
- const focusManagerEnabled = config.get('focusManagerPriority', false);
95
- await waitForReady(opts, focusManagerEnabled);
96
- fireWillEvents(enteringEl, leavingEl);
97
- fireDidEvents(enteringEl, leavingEl);
98
- return {
99
- hasCompleted: true,
100
- };
89
+ const enteringEl = opts.enteringEl;
90
+ const leavingEl = opts.leavingEl;
91
+ const focusManagerEnabled = config.get("focusManagerPriority", false);
92
+ /**
93
+ * If the focus manager is enabled then we need to wait for Ionic components to be
94
+ * rendered otherwise the component to focus may not be focused because it is hidden.
95
+ */
96
+ await waitForReady(opts, focusManagerEnabled);
97
+ fireWillEvents(enteringEl, leavingEl);
98
+ fireDidEvents(enteringEl, leavingEl);
99
+ return { hasCompleted: true };
101
100
  };
102
101
  const waitForReady = async (opts, defaultDeep) => {
103
- const deep = opts.deepWait !== undefined ? opts.deepWait : defaultDeep;
104
- if (deep) {
105
- await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);
106
- }
107
- await notifyViewReady(opts.viewIsReady, opts.enteringEl);
102
+ if (opts.deepWait !== void 0 ? opts.deepWait : defaultDeep) await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);
103
+ await notifyViewReady(opts.viewIsReady, opts.enteringEl);
108
104
  };
109
105
  const notifyViewReady = async (viewIsReady, enteringEl) => {
110
- if (viewIsReady) {
111
- await viewIsReady(enteringEl);
112
- }
106
+ if (viewIsReady) await viewIsReady(enteringEl);
113
107
  };
114
108
  const playTransition = (trans, opts) => {
115
- const progressCallback = opts.progressCallback;
116
- const promise = new Promise((resolve) => {
117
- trans.onFinish((currentStep) => resolve(currentStep === 1));
118
- });
119
- if (progressCallback) {
120
- trans.progressStart(true);
121
- progressCallback(trans);
122
- }
123
- else {
124
- trans.play();
125
- }
126
- return promise;
109
+ const progressCallback = opts.progressCallback;
110
+ const promise = new Promise((resolve) => {
111
+ trans.onFinish((currentStep) => resolve(currentStep === 1));
112
+ });
113
+ if (progressCallback) {
114
+ trans.progressStart(true);
115
+ progressCallback(trans);
116
+ } else trans.play();
117
+ return promise;
127
118
  };
128
119
  const fireWillEvents = (enteringEl, leavingEl) => {
129
- lifecycle(leavingEl, LIFECYCLE_WILL_LEAVE);
130
- lifecycle(enteringEl, LIFECYCLE_WILL_ENTER);
120
+ lifecycle(leavingEl, LIFECYCLE_WILL_LEAVE);
121
+ lifecycle(enteringEl, LIFECYCLE_WILL_ENTER);
131
122
  };
132
123
  const fireDidEvents = (enteringEl, leavingEl) => {
133
- lifecycle(enteringEl, LIFECYCLE_DID_ENTER);
134
- lifecycle(leavingEl, LIFECYCLE_DID_LEAVE);
135
- };
136
- export const lifecycle = (el, eventName) => {
137
- if (el) {
138
- const ev = new CustomEvent(eventName, {
139
- bubbles: false,
140
- cancelable: false,
141
- });
142
- el.dispatchEvent(ev);
143
- }
144
- };
145
- export const waitForMount = () => {
146
- return new Promise((resolve) => raf(() => raf(() => resolve())));
147
- };
148
- export const deepReady = async (el) => {
149
- const element = el;
150
- if (element) {
151
- if (element.componentOnReady != null) {
152
- const stencilEl = await element.componentOnReady();
153
- if (stencilEl != null) {
154
- return;
155
- }
156
- }
157
- else if (element.__registerHost != null) {
158
- const waitForCustomElement = new Promise((resolve) => raf(resolve));
159
- await waitForCustomElement;
160
- return;
161
- }
162
- await Promise.all(Array.from(element.children).map((child) => deepReady(child)));
163
- }
164
- };
165
- export const setPageHidden = (el, hidden) => {
166
- if (hidden) {
167
- el.setAttribute('aria-hidden', 'true');
168
- el.classList.add('ion-page-hidden');
169
- }
170
- else {
171
- el.hidden = false;
172
- el.removeAttribute('aria-hidden');
173
- el.classList.remove('ion-page-hidden');
174
- }
124
+ lifecycle(enteringEl, LIFECYCLE_DID_ENTER);
125
+ lifecycle(leavingEl, LIFECYCLE_DID_LEAVE);
126
+ };
127
+ const lifecycle = (el, eventName) => {
128
+ if (el) {
129
+ const ev = new CustomEvent(eventName, {
130
+ bubbles: false,
131
+ cancelable: false
132
+ });
133
+ el.dispatchEvent(ev);
134
+ }
135
+ };
136
+ /**
137
+ * Wait two request animation frame loops.
138
+ * This allows the framework implementations enough time to mount
139
+ * the user-defined contents. This is often needed when using inline
140
+ * modals and popovers that accept user components. For popover,
141
+ * the contents must be mounted for the popover to be sized correctly.
142
+ * For modals, the contents must be mounted for iOS to run the
143
+ * transition correctly.
144
+ *
145
+ * On Angular and React, a single raf is enough time, but for Vue
146
+ * we need to wait two rafs. As a result we are using two rafs for
147
+ * all frameworks to ensure contents are mounted.
148
+ */
149
+ const waitForMount = () => {
150
+ return new Promise((resolve) => raf(() => raf(() => resolve())));
151
+ };
152
+ const deepReady = async (el) => {
153
+ const element = el;
154
+ if (element) {
155
+ if (element.componentOnReady != null) {
156
+ if (await element.componentOnReady() != null) return;
157
+ } else if (element.__registerHost != null) {
158
+ await new Promise((resolve) => raf(resolve));
159
+ return;
160
+ }
161
+ await Promise.all(Array.from(element.children).map((child) => deepReady(child)));
162
+ }
163
+ };
164
+ const setPageHidden = (el, hidden) => {
165
+ if (hidden) {
166
+ el.setAttribute("aria-hidden", "true");
167
+ el.classList.add("ion-page-hidden");
168
+ } else {
169
+ el.hidden = false;
170
+ el.removeAttribute("aria-hidden");
171
+ el.classList.remove("ion-page-hidden");
172
+ }
175
173
  };
176
174
  const setZIndex = (enteringEl, leavingEl, direction) => {
177
- if (enteringEl !== undefined) {
178
- enteringEl.style.zIndex = direction === 'back' ? '99' : '101';
179
- }
180
- if (leavingEl !== undefined) {
181
- leavingEl.style.zIndex = '100';
182
- }
183
- };
175
+ if (enteringEl !== void 0) enteringEl.style.zIndex = direction === "back" ? "99" : "101";
176
+ if (leavingEl !== void 0) leavingEl.style.zIndex = "100";
177
+ };
178
+ /**
179
+ * Add a class to ensure that the header (if any)
180
+ * does not flicker during the transition. By adding the
181
+ * transitioning class, we ensure that the header has
182
+ * the necessary styles to prevent the following flickers:
183
+ * 1. When entering a page with a condensed header, the
184
+ * header should never be visible. However,
185
+ * it briefly renders the background color while
186
+ * the transition is occurring.
187
+ * 2. When leaving a page with a condensed header, the
188
+ * header has an opacity of 0 and the pages
189
+ * have a z-index which causes the entering page to
190
+ * briefly show it's content underneath the leaving page.
191
+ * 3. When entering a page or leaving a page with a fade
192
+ * header, the header should not have a background color.
193
+ * However, it briefly shows the background color while
194
+ * the transition is occurring.
195
+ *
196
+ * @param header The header element to modify.
197
+ * @param isTransitioning Whether the transition is occurring.
198
+ */
184
199
  const setHeaderTransitionClass = (header, isTransitioning) => {
185
- if (!header) {
186
- return;
187
- }
188
- const transitionClass = 'header-transitioning';
189
- if (isTransitioning) {
190
- header.classList.add(transitionClass);
191
- }
192
- else {
193
- header.classList.remove(transitionClass);
194
- }
195
- };
196
- export const getIonPageElement = (element) => {
197
- if (element.classList.contains('ion-page')) {
198
- return element;
199
- }
200
- const ionPage = element.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs');
201
- if (ionPage) {
202
- return ionPage;
203
- }
204
- return element;
205
- };
200
+ if (!header) return;
201
+ const transitionClass = "header-transitioning";
202
+ if (isTransitioning) header.classList.add(transitionClass);
203
+ else header.classList.remove(transitionClass);
204
+ };
205
+ const getIonPageElement = (element) => {
206
+ if (element.classList.contains("ion-page")) return element;
207
+ const ionPage = element.querySelector(":scope > .ion-page, :scope > ion-nav, :scope > ion-tabs");
208
+ if (ionPage) return ionPage;
209
+ return element;
210
+ };
211
+ /**
212
+ * Retrieves the ion-header element from a page based on the
213
+ * direction of the transition.
214
+ *
215
+ * @param opts Options for the transition.
216
+ * @returns The ion-header element or null if not found or not in 'ios' mode.
217
+ */
206
218
  const getIosIonHeader = (opts) => {
207
- const enteringEl = opts.enteringEl;
208
- const leavingEl = opts.leavingEl;
209
- const direction = opts.direction;
210
- const mode = opts.mode;
211
- if (mode !== 'ios') {
212
- return null;
213
- }
214
- const element = direction === 'back' ? leavingEl : enteringEl;
215
- if (!element) {
216
- return null;
217
- }
218
- return element.querySelector('ion-header');
219
- };
219
+ const enteringEl = opts.enteringEl;
220
+ const leavingEl = opts.leavingEl;
221
+ const direction = opts.direction;
222
+ if (opts.mode !== "ios") return null;
223
+ const element = direction === "back" ? leavingEl : enteringEl;
224
+ if (!element) return null;
225
+ return element.querySelector("ion-header");
226
+ };
227
+ //#endregion
228
+ export { deepReady, getIonPageElement, lifecycle, setPageHidden, transition, waitForMount };
229
+
230
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/transition/index.ts"],"sourcesContent":["import { config } from '../utils';\nimport { Build, writeTask } from '@stencil/core';\n\nimport { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from '@ionic/core';\nimport type { NavOptions, NavDirection } from '@ionic/core';\nimport type { Animation, AnimationBuilder } from '@ionic/core';\nimport { createFocusController } from '../focus-controller';\nimport { raf } from '../utils';\n\nconst iosTransitionAnimation = () => import('./ios.transition');\n// const mdTransitionAnimation = () => import('./md.transition');\nconst focusController = createFocusController();\n\n// TODO(FW-2832): types\n\n/**\n * Executes the main page transition.\n * It also manages the lifecycle of header visibility (if any)\n * to prevent visual flickering in iOS. The flickering only\n * occurs for a condensed header that is placed above the content.\n *\n * @param opts Options for the transition.\n * @returns A promise that resolves when the transition is complete.\n */\nexport const transition = (opts: TransitionOptions): Promise<TransitionResult> => {\n return new Promise((resolve, reject) => {\n writeTask(() => {\n const transitioningInactiveHeader = getIosIonHeader(opts);\n beforeTransition(opts, transitioningInactiveHeader);\n runTransition(opts)\n .then(\n (result) => {\n if (result.animation) {\n result.animation.destroy();\n }\n afterTransition(opts);\n resolve(result);\n },\n (error) => {\n afterTransition(opts);\n reject(error);\n },\n )\n .finally(() => {\n // Ensure that the header is restored to its original state.\n setHeaderTransitionClass(transitioningInactiveHeader, false);\n });\n });\n });\n};\n\nconst beforeTransition = (opts: TransitionOptions, transitioningInactiveHeader: HTMLElement | null) => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n\n focusController.saveViewFocus(leavingEl);\n\n setZIndex(enteringEl, leavingEl, opts.direction);\n // Prevent flickering of the header by adding a class.\n setHeaderTransitionClass(transitioningInactiveHeader, true);\n\n if (opts.showGoBack) {\n enteringEl.classList.add('can-go-back');\n } else {\n enteringEl.classList.remove('can-go-back');\n }\n setPageHidden(enteringEl, false);\n\n /**\n * When transitioning, the page should not\n * respond to click events. This resolves small\n * issues like users double tapping the ion-back-button.\n * These pointer events are removed in `afterTransition`.\n */\n enteringEl.style.setProperty('pointer-events', 'none');\n\n if (leavingEl) {\n setPageHidden(leavingEl, false);\n leavingEl.style.setProperty('pointer-events', 'none');\n }\n};\n\nconst runTransition = async (opts: TransitionOptions): Promise<TransitionResult> => {\n const animationBuilder = await getAnimationBuilder(opts);\n\n const ani = animationBuilder && Build.isBrowser ? animation(animationBuilder, opts) : noAnimation(opts); // fast path for no animation\n\n return ani;\n};\n\nconst afterTransition = (opts: TransitionOptions) => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n enteringEl.classList.remove('ion-page-invisible');\n enteringEl.style.removeProperty('pointer-events');\n if (leavingEl !== undefined) {\n leavingEl.classList.remove('ion-page-invisible');\n leavingEl.style.removeProperty('pointer-events');\n }\n\n focusController.setViewFocus(enteringEl);\n};\n\nconst getAnimationBuilder = async (opts: TransitionOptions): Promise<AnimationBuilder | undefined> => {\n if (!opts.leavingEl || !opts.animated || opts.duration === 0) {\n return undefined;\n }\n\n if (opts.animationBuilder) {\n return opts.animationBuilder;\n }\n\n const getAnimation =\n // opts.mode === 'ios'\n (await iosTransitionAnimation()).iosTransitionAnimation;\n // : (await mdTransitionAnimation()).mdTransitionAnimation;\n\n return getAnimation;\n};\n\nconst animation = async (animationBuilder: AnimationBuilder, opts: TransitionOptions): Promise<TransitionResult> => {\n await waitForReady(opts, true);\n\n const trans = animationBuilder(opts.baseEl, opts);\n\n fireWillEvents(opts.enteringEl, opts.leavingEl);\n\n const didComplete = await playTransition(trans, opts);\n\n if (opts.progressCallback) {\n opts.progressCallback(undefined);\n }\n\n if (didComplete) {\n fireDidEvents(opts.enteringEl, opts.leavingEl);\n }\n\n return {\n hasCompleted: didComplete,\n animation: trans,\n };\n};\n\nconst noAnimation = async (opts: TransitionOptions): Promise<TransitionResult> => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n const focusManagerEnabled = config.get('focusManagerPriority', false);\n\n /**\n * If the focus manager is enabled then we need to wait for Ionic components to be\n * rendered otherwise the component to focus may not be focused because it is hidden.\n */\n await waitForReady(opts, focusManagerEnabled);\n\n fireWillEvents(enteringEl, leavingEl);\n fireDidEvents(enteringEl, leavingEl);\n\n return {\n hasCompleted: true,\n };\n};\n\nconst waitForReady = async (opts: TransitionOptions, defaultDeep: boolean) => {\n const deep = opts.deepWait !== undefined ? opts.deepWait : defaultDeep;\n\n if (deep) {\n await Promise.all([deepReady(opts.enteringEl), deepReady(opts.leavingEl)]);\n }\n\n await notifyViewReady(opts.viewIsReady, opts.enteringEl);\n};\n\nconst notifyViewReady = async (viewIsReady: undefined | ((enteringEl: HTMLElement) => Promise<unknown>), enteringEl: HTMLElement) => {\n if (viewIsReady) {\n await viewIsReady(enteringEl);\n }\n};\n\nconst playTransition = (trans: Animation, opts: TransitionOptions): Promise<boolean> => {\n const progressCallback = opts.progressCallback;\n\n const promise = new Promise<boolean>((resolve) => {\n trans.onFinish((currentStep) => resolve(currentStep === 1));\n });\n\n // cool, let's do this, start the transition\n if (progressCallback) {\n // this is a swipe to go back, just get the transition progress ready\n // kick off the swipe animation start\n trans.progressStart(true);\n progressCallback(trans);\n } else {\n // only the top level transition should actually start \"play\"\n // kick it off and let it play through\n // ******** DOM WRITE ****************\n trans.play();\n }\n // create a callback for when the animation is done\n return promise;\n};\n\nconst fireWillEvents = (enteringEl: HTMLElement | undefined, leavingEl: HTMLElement | undefined) => {\n lifecycle(leavingEl, LIFECYCLE_WILL_LEAVE);\n lifecycle(enteringEl, LIFECYCLE_WILL_ENTER);\n};\n\nconst fireDidEvents = (enteringEl: HTMLElement | undefined, leavingEl: HTMLElement | undefined) => {\n lifecycle(enteringEl, LIFECYCLE_DID_ENTER);\n lifecycle(leavingEl, LIFECYCLE_DID_LEAVE);\n};\n\nexport const lifecycle = (el: HTMLElement | undefined, eventName: string) => {\n if (el) {\n const ev = new CustomEvent(eventName, {\n bubbles: false,\n cancelable: false,\n });\n el.dispatchEvent(ev);\n }\n};\n\n/**\n * Wait two request animation frame loops.\n * This allows the framework implementations enough time to mount\n * the user-defined contents. This is often needed when using inline\n * modals and popovers that accept user components. For popover,\n * the contents must be mounted for the popover to be sized correctly.\n * For modals, the contents must be mounted for iOS to run the\n * transition correctly.\n *\n * On Angular and React, a single raf is enough time, but for Vue\n * we need to wait two rafs. As a result we are using two rafs for\n * all frameworks to ensure contents are mounted.\n */\nexport const waitForMount = (): Promise<void> => {\n return new Promise((resolve) => raf(() => raf(() => resolve())));\n};\n\ntype LazyLoadedElement = Element & {\n componentOnReady?: () => Promise<unknown>;\n __registerHost?: unknown;\n};\n\nexport const deepReady = async (el: Element | undefined): Promise<void> => {\n const element = el as LazyLoadedElement | undefined;\n if (element) {\n if (element.componentOnReady != null) {\n // eslint-disable-next-line custom-rules/no-component-on-ready-method\n const stencilEl = await element.componentOnReady();\n if (stencilEl != null) {\n return;\n }\n\n /**\n * Custom elements in Stencil will have __registerHost.\n */\n } else if (element.__registerHost != null) {\n /**\n * Non-lazy loaded custom elements need to wait\n * one frame for component to be loaded.\n */\n const waitForCustomElement = new Promise((resolve) => raf(resolve));\n await waitForCustomElement;\n\n return;\n }\n await Promise.all(Array.from(element.children).map((child) => deepReady(child)));\n }\n};\n\nexport const setPageHidden = (el: HTMLElement, hidden: boolean) => {\n if (hidden) {\n el.setAttribute('aria-hidden', 'true');\n el.classList.add('ion-page-hidden');\n } else {\n el.hidden = false;\n el.removeAttribute('aria-hidden');\n el.classList.remove('ion-page-hidden');\n }\n};\n\nconst setZIndex = (enteringEl: HTMLElement | undefined, leavingEl: HTMLElement | undefined, direction: NavDirection | undefined) => {\n if (enteringEl !== undefined) {\n enteringEl.style.zIndex = direction === 'back' ? '99' : '101';\n }\n if (leavingEl !== undefined) {\n leavingEl.style.zIndex = '100';\n }\n};\n\n/**\n * Add a class to ensure that the header (if any)\n * does not flicker during the transition. By adding the\n * transitioning class, we ensure that the header has\n * the necessary styles to prevent the following flickers:\n * 1. When entering a page with a condensed header, the\n * header should never be visible. However,\n * it briefly renders the background color while\n * the transition is occurring.\n * 2. When leaving a page with a condensed header, the\n * header has an opacity of 0 and the pages\n * have a z-index which causes the entering page to\n * briefly show it's content underneath the leaving page.\n * 3. When entering a page or leaving a page with a fade\n * header, the header should not have a background color.\n * However, it briefly shows the background color while\n * the transition is occurring.\n *\n * @param header The header element to modify.\n * @param isTransitioning Whether the transition is occurring.\n */\nconst setHeaderTransitionClass = (header: HTMLElement | null, isTransitioning: boolean) => {\n if (!header) {\n return;\n }\n\n const transitionClass = 'header-transitioning';\n if (isTransitioning) {\n header.classList.add(transitionClass);\n } else {\n header.classList.remove(transitionClass);\n }\n};\n\nexport const getIonPageElement = (element: HTMLElement) => {\n if (element.classList.contains('ion-page')) {\n return element;\n }\n\n const ionPage = element.querySelector(':scope > .ion-page, :scope > ion-nav, :scope > ion-tabs');\n if (ionPage) {\n return ionPage;\n }\n // idk, return the original element so at least something animates and we don't have a null pointer\n return element;\n};\n\n/**\n * Retrieves the ion-header element from a page based on the\n * direction of the transition.\n *\n * @param opts Options for the transition.\n * @returns The ion-header element or null if not found or not in 'ios' mode.\n */\nconst getIosIonHeader = (opts: TransitionOptions): HTMLElement | null => {\n const enteringEl = opts.enteringEl;\n const leavingEl = opts.leavingEl;\n const direction = opts.direction;\n const mode = opts.mode;\n\n if (mode !== 'ios') {\n return null;\n }\n\n const element = direction === 'back' ? leavingEl : enteringEl;\n\n if (!element) {\n return null;\n }\n\n return element.querySelector('ion-header');\n};\n\nexport interface TransitionOptions extends NavOptions {\n progressCallback?: (ani: Animation | undefined) => void;\n baseEl: HTMLElement;\n enteringEl: HTMLElement;\n leavingEl: HTMLElement | undefined;\n}\n\nexport interface TransitionResult {\n hasCompleted: boolean;\n animation?: Animation;\n}\n"],"mappings":";;;;;AASA,MAAM,+BAA+B,OAAO;AAE5C,MAAM,kBAAkB,sBAAsB;;;;;;;;;;AAa9C,MAAa,cAAc,SAAuD;CAChF,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,gBAAgB;GACd,MAAM,8BAA8B,gBAAgB,IAAI;GACxD,iBAAiB,MAAM,2BAA2B;GAClD,cAA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4BAA4B,QAA4B,oBAA6B;CACzF,IAAI,CAAC,QACH;CAGF,MAAM,kBAAkB;CACxB,IAAI,iBACF,OAAO,UAAU,IAAI,eAAe;MAEpC,OAAO,UAAU,OAAO,eAAe;AAE3C;AAEA,MAAa,qBAAqB,YAAyB;CACzD,IAAI,QAAQ,UAAU,SAAS,UAAU,GACvC,OAAO;CAGT,MAAM,UAAU,QAAQ,cAAc,yDAAyD;CAC/F,IAAI,SACF,OAAO;CAGT,OAAO;AACT;;;;;;;;AASA,MAAM,mBAAmB,SAAgD;CACvE,MAAM,aAAa,KAAK;CACxB,MAAM,YAAY,KAAK;CACvB,MAAM,YAAY,KAAK;CAGvB,IAFa,KAAK,SAEL,OACX,OAAO;CAGT,MAAM,UAAU,cAAc,SAAS,YAAY;CAEnD,IAAI,CAAC,SACH,OAAO;CAGT,OAAO,QAAQ,cAAc,YAAY;AAC3C"}
@@ -1,10 +1,12 @@
1
- import { shadow } from '@rdlabo/ionic-theme-utils';
2
- import type { Animation } from '@ionic/core';
3
- import type { TransitionOptions } from './index';
4
- export { shadow };
1
+ import { TransitionOptions } from "./index.js";
2
+ import { Animation } from "@ionic/core";
3
+ import { shadow } from "@rdlabo/ionic-theme-utils";
4
+ //#region src/transition/ios.transition.d.ts
5
5
  export interface IosTransitionConfig {
6
- radius: number;
6
+ radius: number;
7
7
  }
8
8
  export declare const setConfig: (config: Partial<IosTransitionConfig>) => void;
9
9
  export declare const iosTransitionAnimation: (navEl: HTMLElement, opts: TransitionOptions) => Animation;
10
+ //#endregion
11
+ export { shadow };
10
12
  //# sourceMappingURL=ios.transition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ios.transition.d.ts","sourceRoot":"","sources":["../../src/transition/ios.transition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AASD,eAAO,MAAM,SAAS,GAAI,QAAQ,OAAO,CAAC,mBAAmB,CAAC,KAAG,IAEhE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,iBAAiB,KAAK,SAErF,CAAC"}
1
+ {"version":3,"file":"ios.transition.d.ts","names":[],"sources":["../../src/transition/ios.transition.ts"],"mappings":";;;;iBAQiB;EACf;;qBAUW,YAAa,QAAQ,QAAQ;qBAI7B,yBAAyB,OAAO,aAAa,MAAM,sBAAsB"}
@@ -1,14 +1,18 @@
1
- import { createIosTransitionAnimation, shadow } from '@rdlabo/ionic-theme-utils';
2
- import { getIonPageElement } from './index';
3
- import { withNativeUIShellTransition } from '../native-integration/transition';
4
- export { shadow };
1
+ import { getIonPageElement } from "./index.js";
2
+ import { withNativeUIShellTransition } from "../native-integration/transition.js";
3
+ import { createIosTransitionAnimation, shadow } from "@rdlabo/ionic-theme-utils";
4
+ //#region src/transition/ios.transition.ts
5
5
  const transitionConfig = {
6
- offLeftPercent: 30,
7
- getIonPageElement,
8
- shouldAnimateFixedBackButton: (navEl) => !navEl.closest('ion-app.ios-theme-vertical-bars'),
9
- radius: 0,
6
+ offLeftPercent: 30,
7
+ getIonPageElement,
8
+ shouldAnimateFixedBackButton: (navEl) => !navEl.closest("ion-app.ios-theme-vertical-bars"),
9
+ radius: 0
10
10
  };
11
- export const setConfig = (config) => {
12
- Object.assign(transitionConfig, config);
11
+ const setConfig = (config) => {
12
+ Object.assign(transitionConfig, config);
13
13
  };
14
- export const iosTransitionAnimation = withNativeUIShellTransition(createIosTransitionAnimation(transitionConfig));
14
+ const iosTransitionAnimation = withNativeUIShellTransition(createIosTransitionAnimation(transitionConfig));
15
+ //#endregion
16
+ export { iosTransitionAnimation, setConfig, shadow };
17
+
18
+ //# sourceMappingURL=ios.transition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ios.transition.js","names":[],"sources":["../../src/transition/ios.transition.ts"],"sourcesContent":["import { createIosTransitionAnimation, shadow } from '@rdlabo/ionic-theme-utils';\nimport type { Animation } from '@ionic/core';\nimport type { TransitionOptions } from './index';\nimport { getIonPageElement } from './index';\nimport { withNativeUIShellTransition } from '../native-integration/transition';\n\nexport { shadow };\n\nexport interface IosTransitionConfig {\n radius: number;\n}\n\nconst transitionConfig = {\n offLeftPercent: 30,\n getIonPageElement,\n shouldAnimateFixedBackButton: (navEl: HTMLElement) => !navEl.closest('ion-app.ios-theme-vertical-bars'),\n radius: 0,\n};\n\nexport const setConfig = (config: Partial<IosTransitionConfig>): void => {\n Object.assign(transitionConfig, config);\n};\n\nexport const iosTransitionAnimation: (navEl: HTMLElement, opts: TransitionOptions) => Animation = withNativeUIShellTransition(\n createIosTransitionAnimation<TransitionOptions>(transitionConfig),\n);\n"],"mappings":";;;;AAYA,MAAM,mBAAmB;CACvB,gBAAgB;CAChB;CACA,+BAA+B,UAAuB,CAAC,MAAM,QAAQ,iCAAiC;CACtG,QAAQ;AACV;AAEA,MAAa,aAAa,WAA+C;CACvE,OAAO,OAAO,kBAAkB,MAAM;AACxC;AAEA,MAAa,yBAAqF,4BAChG,6BAAgD,gBAAgB,CAClE"}
package/dist/utils.d.ts CHANGED
@@ -1,17 +1,19 @@
1
- import { AnimationPosition } from './sheets-of-glass/interfaces';
2
- import { IonicConfig } from '@ionic/core';
1
+ import { AnimationPosition } from "./sheets-of-glass/interfaces.js";
2
+ import { IonicConfig } from "@ionic/core";
3
+ //#region src/utils.d.ts
3
4
  export declare const getElementRoot: (el: HTMLElement, fallback?: HTMLElement) => HTMLElement | ShadowRoot;
4
5
  export declare const raf: (h: FrameRequestCallback) => number;
5
6
  export declare const cloneElement: (tagName: string, useCache?: boolean) => HTMLElement;
6
7
  export declare const getStep: (targetX: number, animationPosition: AnimationPosition) => number;
7
8
  export declare const changeSelectedElement: (targetElement: HTMLElement, selectedElement: HTMLElement, effectTagName: string, selectedClassName: string) => void;
8
9
  export declare class Config {
9
- private m;
10
- reset(configObj: IonicConfig): void;
11
- get<T>(key: keyof IonicConfig, fallback?: T): T;
12
- getBoolean(key: keyof IonicConfig, fallback?: boolean): boolean;
13
- getNumber(key: keyof IonicConfig, fallback?: number): number;
14
- set(key: keyof IonicConfig, value: unknown): void;
10
+ private m;
11
+ reset(configObj: IonicConfig): void;
12
+ get<T>(key: keyof IonicConfig, fallback?: T): T;
13
+ getBoolean(key: keyof IonicConfig, fallback?: boolean): boolean;
14
+ getNumber(key: keyof IonicConfig, fallback?: number): number;
15
+ set(key: keyof IonicConfig, value: unknown): void;
15
16
  }
16
17
  export declare const config: Config;
18
+ //#endregion
17
19
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,eAAO,MAAM,cAAc,GAAI,IAAI,WAAW,EAAE,WAAU,WAAgB,6BAEzE,CAAC;AAEF,eAAO,MAAM,GAAG,GAAI,GAAG,oBAAoB,WAQ1C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,WAAU,OAAc,KAAG,WAcxE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,EAAE,mBAAmB,iBAAiB,WAQ5E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,eAAe,WAAW,EAC1B,iBAAiB,WAAW,EAC5B,eAAe,MAAM,EACrB,mBAAmB,MAAM,KACxB,IAMF,CAAC;AAEF,qBAAa,MAAM;IACjB,OAAO,CAAC,CAAC,CAAyC;IAElD,KAAK,CAAC,SAAS,EAAE,WAAW;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